diff --git a/.CodeQL.yml b/.CodeQL.yml new file mode 100644 index 0000000000000..cbecd0d445e62 --- /dev/null +++ b/.CodeQL.yml @@ -0,0 +1,9 @@ +path_classifiers: + library: + # Nearly all folders in this repo are library code that we do not run static analysis + # over. We'll exclude folders that we wholly own. We instead rely on CG and similar + # registration mechanisms to report issues to us. + - "**/*" + - exclude: + - "eng" + - "nuget" diff --git a/.azuredevops/dependabot.yml b/.azuredevops/dependabot.yml new file mode 100644 index 0000000000000..f18e60565a42d --- /dev/null +++ b/.azuredevops/dependabot.yml @@ -0,0 +1,5 @@ +version: 2 + +# Disabling dependabot on Azure DevOps as this is a mirrored repo. Updates should go through github. +enable-campaigned-updates: false +enable-security-updates: false diff --git a/.azuredevops/policies/branchClassification.yml b/.azuredevops/policies/branchClassification.yml new file mode 100644 index 0000000000000..1d0715b25e05b --- /dev/null +++ b/.azuredevops/policies/branchClassification.yml @@ -0,0 +1,11 @@ +description: Branch classification configuration for repository +resource: repository +configuration: + branchClassificationSettings: + defaultClassification: nonproduction + ruleset: + - name: prod-branches + branchNames: + - dotnet/main-19.x + - dotnet/release/* + classification: production diff --git a/.config/CredScanSuppressions.json b/.config/CredScanSuppressions.json new file mode 100644 index 0000000000000..34d9703e67972 --- /dev/null +++ b/.config/CredScanSuppressions.json @@ -0,0 +1,9 @@ +{ + "tool": "Credential Scanner", + "suppressions": [ + { + "_justification": "Upstream code and these are supposed to be public passwords.", + "file": "flang/docs/GettingInvolved.md" + } + ] +} diff --git a/.config/PoliCheckExclusions.xml b/.config/PoliCheckExclusions.xml new file mode 100644 index 0000000000000..280812764b952 --- /dev/null +++ b/.config/PoliCheckExclusions.xml @@ -0,0 +1,5 @@ + + + + bolt|clang|clang-tools-extra|compiler-rt|cross-project-tests|flang|libc|libcxx|lld|lldb|llvm|mlir|openmp|polly + diff --git a/.config/tsaoptions.json b/.config/tsaoptions.json new file mode 100644 index 0000000000000..10b95194da845 --- /dev/null +++ b/.config/tsaoptions.json @@ -0,0 +1,10 @@ +{ + "instanceUrl": "https://devdiv.visualstudio.com/", + "template": "TFSDEVDIV", + "projectName": "DEVDIV", + "areaPath": "DevDiv\\NET Runtime\\WebAssembly", + "iterationPath": "DevDiv", + "notificationAliases": [ "runtimerepo-infra@microsoft.com" ], + "repositoryName": "llvm-project", + "codebaseName": "llvm-project" +} \ No newline at end of file diff --git a/.github/workflows/containers/github-action-ci/stage1.Dockerfile b/.github/workflows/containers/github-action-ci/stage1.Dockerfile deleted file mode 100644 index 8c6bcf4638410..0000000000000 --- a/.github/workflows/containers/github-action-ci/stage1.Dockerfile +++ /dev/null @@ -1,44 +0,0 @@ -FROM docker.io/library/ubuntu:22.04 as base -ENV LLVM_SYSROOT=/opt/llvm - -FROM base as stage1-toolchain -ENV LLVM_VERSION=17.0.6 - -RUN apt-get update && \ - apt-get install -y \ - wget \ - gcc \ - g++ \ - cmake \ - ninja-build \ - python3 \ - git \ - curl - -RUN curl -O -L https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-$LLVM_VERSION.tar.gz && tar -xf llvmorg-$LLVM_VERSION.tar.gz - -WORKDIR /llvm-project-llvmorg-$LLVM_VERSION - -COPY bootstrap.patch / - -# TODO(boomanaiden154): Remove the patch pulled from a LLVM PR once we bump -# the toolchain to version 18 and the patch is in-tree. -# TODO(boomanaiden154): Remove the bootstrap patch once we unsplit the build -# and no longer need to explicitly build the stage2 dependencies. -RUN curl https://github.com/llvm/llvm-project/commit/dd0356d741aefa25ece973d6cc4b55dcb73b84b4.patch | patch -p1 && cat /bootstrap.patch | patch -p1 - -RUN mkdir build - -RUN cmake -B ./build -G Ninja ./llvm \ - -C ./clang/cmake/caches/BOLT-PGO.cmake \ - -DBOOTSTRAP_LLVM_ENABLE_LLD=ON \ - -DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON \ - -DPGO_INSTRUMENT_LTO=Thin \ - -DLLVM_ENABLE_RUNTIMES="compiler-rt" \ - -DCMAKE_INSTALL_PREFIX="$LLVM_SYSROOT" \ - -DLLVM_ENABLE_PROJECTS="bolt;clang;lld;clang-tools-extra" \ - -DLLVM_DISTRIBUTION_COMPONENTS="lld;compiler-rt;clang-format;scan-build" \ - -DCLANG_DEFAULT_LINKER="lld" \ - -DBOOTSTRAP_CLANG_PGO_TRAINING_DATA_SOURCE_DIR=/llvm-project-llvmorg-$LLVM_VERSION/llvm - -RUN ninja -C ./build stage2-instrumented-clang stage2-instrumented-lld diff --git a/.github/workflows/containers/github-action-ci/stage2.Dockerfile b/.github/workflows/containers/github-action-ci/stage2.Dockerfile deleted file mode 100644 index 0ca0da87734c4..0000000000000 --- a/.github/workflows/containers/github-action-ci/stage2.Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM docker.io/library/ubuntu:22.04 as base -ENV LLVM_SYSROOT=/opt/llvm - -FROM stage1-toolchain AS stage2-toolchain - -RUN ninja -C ./build stage2-clang-bolt stage2-install-distribution && ninja -C ./build install-distribution && rm -rf ./build - -FROM base - -COPY --from=stage2-toolchain $LLVM_SYSROOT $LLVM_SYSROOT - -# Need to install curl for hendrikmuhs/ccache-action -# Need nodejs for some of the GitHub actions. -# Need perl-modules for clang analyzer tests. -# Need git for SPIRV-Tools tests. -RUN apt-get update && \ - apt-get install -y \ - binutils \ - cmake \ - curl \ - git \ - libstdc++-11-dev \ - ninja-build \ - nodejs \ - perl-modules \ - python3-psutil - -ENV LLVM_SYSROOT=$LLVM_SYSROOT -ENV PATH=${LLVM_SYSROOT}/bin:${PATH} diff --git a/.github/workflows/get-llvm-version/action.yml b/.github/workflows/get-llvm-version/action.yml new file mode 100644 index 0000000000000..2218d926fc13d --- /dev/null +++ b/.github/workflows/get-llvm-version/action.yml @@ -0,0 +1,26 @@ +name: Get LLVM Version +description: >- + Get the LLVM version from the llvm-project source tree. This action assumes + the llvm-project sources have already been checked out into GITHUB_WORKSPACE. + +outputs: + major: + description: LLVM major version + value: ${{ steps.version.outputs.major }} + minor: + description: LLVM minor version + value: ${{ steps.version.outputs.minor }} + patch: + description: LLVM patch version + value: ${{ steps.version.outputs.patch }} + +runs: + using: "composite" + steps: + - name: Get Version + shell: bash + id: version + run: | + for v in major minor patch; do + echo "$v=`llvm/utils/release/get-llvm-version.sh --$v`" >> $GITHUB_OUTPUT + done diff --git a/.github/workflows/libclang-abi-tests.yml b/.github/workflows/libclang-abi-tests.yml index 972d21c3bcedf..9e839ff49e283 100644 --- a/.github/workflows/libclang-abi-tests.yml +++ b/.github/workflows/libclang-abi-tests.yml @@ -33,9 +33,9 @@ jobs: ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }} ABI_LIBS: ${{ steps.vars.outputs.ABI_LIBS }} BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }} - LLVM_VERSION_MAJOR: ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - LLVM_VERSION_MINOR: ${{ steps.version.outputs.LLVM_VERSION_MINOR }} - LLVM_VERSION_PATCH: ${{ steps.version.outputs.LLVM_VERSION_PATCH }} + LLVM_VERSION_MAJOR: ${{ steps.version.outputs.major }} + LLVM_VERSION_MINOR: ${{ steps.version.outputs.minor }} + LLVM_VERSION_PATCH: ${{ steps.version.outputs.patch }} steps: - name: Checkout source uses: actions/checkout@v4 @@ -44,14 +44,14 @@ jobs: - name: Get LLVM version id: version - uses: llvm/actions/get-llvm-version@main + uses: ./.github/workflows/get-llvm-version - name: Setup Variables id: vars run: | remote_repo='https://github.com/llvm/llvm-project' - if [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then - major_version=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1)) + if [ ${{ steps.version.outputs.patch }} -eq 0 ]; then + major_version=$(( ${{ steps.version.outputs.major }} - 1)) baseline_ref="llvmorg-$major_version.1.0" # If there is a minor release, we want to use that as the base line. @@ -73,8 +73,8 @@ jobs: } >> "$GITHUB_OUTPUT" else { - echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.LLVM_VERSION_MAJOR }}" - echo "BASELINE_REF=llvmorg-${{ steps.version.outputs.LLVM_VERSION_MAJOR }}.1.0" + echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.major }}" + echo "BASELINE_REF=llvmorg-${{ steps.version.outputs.major }}.1.0" echo "ABI_HEADERS=." echo "ABI_LIBS=libclang.so libclang-cpp.so" } >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/llvm-project-tests.yml b/.github/workflows/llvm-project-tests.yml index 0a228c41f354e..17a54be16badc 100644 --- a/.github/workflows/llvm-project-tests.yml +++ b/.github/workflows/llvm-project-tests.yml @@ -131,6 +131,7 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DLLDB_INCLUDE_TESTS=OFF \ + -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl" \ -DCMAKE_C_COMPILER_LAUNCHER=sccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ $extra_cmake_args \ @@ -142,8 +143,6 @@ jobs: env: LLVM_BUILDDIR: ${{ steps.build-llvm.outputs.llvm-builddir }} run: | - # Make sure all of LLVM libraries that llvm-config needs are built. + # The libclc tests don't have a generated check target so all we can + # do is build it. ninja -C "$LLVM_BUILDDIR" - cmake -G Ninja -S libclc -B libclc-build -DLLVM_DIR="$LLVM_BUILDDIR"/lib/cmake/llvm -DLIBCLC_TARGETS_TO_BUILD="amdgcn--;amdgcn--amdhsa;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl" - ninja -C libclc-build - ninja -C libclc-build test diff --git a/.github/workflows/llvm-tests.yml b/.github/workflows/llvm-tests.yml index 64d60bc3da45e..26e644229aaa2 100644 --- a/.github/workflows/llvm-tests.yml +++ b/.github/workflows/llvm-tests.yml @@ -43,9 +43,9 @@ jobs: ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }} BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }} BASELINE_VERSION_MINOR: ${{ steps.vars.outputs.BASELINE_VERSION_MINOR }} - LLVM_VERSION_MAJOR: ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - LLVM_VERSION_MINOR: ${{ steps.version.outputs.LLVM_VERSION_MINOR }} - LLVM_VERSION_PATCH: ${{ steps.version.outputs.LLVM_VERSION_PATCH }} + LLVM_VERSION_MAJOR: ${{ steps.version.outputs.major }} + LLVM_VERSION_MINOR: ${{ steps.version.outputs.minor }} + LLVM_VERSION_PATCH: ${{ steps.version.outputs.patch }} steps: - name: Checkout source uses: actions/checkout@v4 @@ -54,7 +54,7 @@ jobs: - name: Get LLVM version id: version - uses: llvm/actions/get-llvm-version@main + uses: ./.github/workflows/get-llvm-version - name: Setup Variables id: vars @@ -66,14 +66,14 @@ jobs: # 18.1.0 We want to check 17.0.x # 18.1.1 We want to check 18.1.0 echo "BASELINE_VERSION_MINOR=1" >> "$GITHUB_OUTPUT" - if [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then + if [ ${{ steps.version.outputs.patch }} -eq 0 ]; then { - echo "BASELINE_VERSION_MAJOR=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1))" + echo "BASELINE_VERSION_MAJOR=$(( ${{ steps.version.outputs.major }} - 1))" echo "ABI_HEADERS=llvm-c" } >> "$GITHUB_OUTPUT" else { - echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.LLVM_VERSION_MAJOR }}" + echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.major }}" echo "ABI_HEADERS=." } >> "$GITHUB_OUTPUT" fi diff --git a/.github/workflows/release-binaries-all.yml b/.github/workflows/release-binaries-all.yml new file mode 100644 index 0000000000000..394b0c74d24ed --- /dev/null +++ b/.github/workflows/release-binaries-all.yml @@ -0,0 +1,98 @@ +name: Release Binaries All + +permissions: + contents: read # Default everything to read-only + +on: + workflow_dispatch: + inputs: + release-version: + description: 'Release Version' + required: true + type: string + upload: + description: 'Upload binaries to the release page' + required: true + default: false + type: boolean + + workflow_call: + inputs: + release-version: + description: 'Release Version' + required: true + type: string + upload: + description: 'Upload binaries to the release page' + required: true + default: false + type: boolean + + pull_request: + types: + - opened + - synchronize + - reopened + # When a PR is closed, we still start this workflow, but then skip + # all the jobs, which makes it effectively a no-op. The reason to + # do this is that it allows us to take advantage of concurrency groups + # to cancel in progress CI jobs whenever the PR is closed. + - closed + paths: + - '.github/workflows/release-binaries-all.yml' + - '.github/workflows/release-binaries.yml' + - '.github/workflows/release-binaries-setup-stage/*' + - '.github/workflows/release-binaries-save-stage/*' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || 'dispatch' }} + cancel-in-progress: True + +jobs: + setup-variables: + if: >- + (github.event_name != 'pull_request' || github.event.action != 'closed') + runs-on: ubuntu-22.04 + outputs: + release-version: ${{ steps.vars.outputs.release-version }} + upload: ${{ steps.vars.outputs.upload }} + steps: + - shell: bash + id: vars + run: | + upload="${{ inputs.upload }}" + release_version="${{ inputs.release-version }}" + if [ "${{ github.event_name }}" = "pull_request" ]; then + upload="false" + release_version="" + fi + echo "release-version=$release_version" >> "$GITHUB_OUTPUT" + echo "upload=$upload" >> "$GITHUB_OUTPUT" + + release-binaries-all: + name: Build Release Binaries + needs: + - setup-variables + permissions: + contents: write # For release uploads + id-token: write # For artifact attestations + attestations: write # For artifact attestations + strategy: + fail-fast: false + matrix: + runs-on: + - ubuntu-22.04 + - windows-2022 + - macos-13 + - macos-14 + + uses: ./.github/workflows/release-binaries.yml + with: + release-version: "${{ needs.setup-variables.outputs.release-version }}" + upload: ${{ needs.setup-variables.outputs.upload == 'true'}} + runs-on: "${{ matrix.runs-on }}" + secrets: + # This will be empty for pull_request events, but that's fine, because + # the release-binaries workflow does not use this secret for the + # pull_request event. + RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} diff --git a/.github/workflows/release-binaries-save-stage/action.yml b/.github/workflows/release-binaries-save-stage/action.yml new file mode 100644 index 0000000000000..f08088c7bc56f --- /dev/null +++ b/.github/workflows/release-binaries-save-stage/action.yml @@ -0,0 +1,44 @@ +name: Save Stage +description: >- + Upload the source and binary directories from a build stage so that they + can be re-used in the next stage. This action is used to the release + binaries workflow into multiple stages to avoid the 6 hour timeout on + the GitHub hosted runners. +inputs: + build-prefix: + description: "Directory containing the build directory." + required: true + type: 'string' + +permissions: + contents: read + +runs: + using: "composite" + steps: + # We need to create an archive of the build directory, because it has too + # many files to upload. + - name: Package Build and Source Directories + shell: bash + run: | + # Remove .git/config to avoid leaking GITHUB_TOKEN stored there. + # See https://unit42.paloaltonetworks.com/github-repo-artifacts-leak-tokens/ + rm -Rf .git/config + # Windows does not support symlinks, so we need to dereference them. + tar --exclude build/ ${{ (runner.os == 'Windows' && '-h') || '' }} -c . | zstd -T0 -c > ../llvm-project.tar.zst + mv ../llvm-project.tar.zst . + tar -C ${{ inputs.build-prefix }} -c build/ | zstd -T0 -c > build.tar.zst + + - name: Upload Stage 1 Source + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 + with: + name: ${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-source + path: llvm-project.tar.zst + retention-days: 2 + + - name: Upload Stage 1 Build Dir + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 + with: + name: ${{ runner.os}}-${{ runner.arch }}-${{ github.job }}-build + path: build.tar.zst + retention-days: 2 diff --git a/.github/workflows/release-binaries-setup-stage/action.yml b/.github/workflows/release-binaries-setup-stage/action.yml new file mode 100644 index 0000000000000..f5e5db27e6595 --- /dev/null +++ b/.github/workflows/release-binaries-setup-stage/action.yml @@ -0,0 +1,59 @@ +name: Setup Stage +description: >- + Setup the next stage of the release binaries workflow. This sets up the + environment correctly for a new stage of the release binaries workflow + and also restores the source and build directory from the previous stage. + +inputs: + previous-artifact: + description: >- + A unique descriptor for the artifact from the previous stage. This will + be used to construct the final artifact pattern, which is: + $RUNNER_OS-$RUNNER_ARCH-$PREVIOUS_ARTIFACT-* + required: false + type: 'string' + +outputs: + build-prefix: + description: "Directory containing the build directory." + value: ${{ steps.build-prefix.outputs.build-prefix }} + +runs: + using: "composite" + steps: + - name: Install Ninja + uses: llvm/actions/install-ninja@22e9f909d35b50bd1181709564bfe816eaeaae81 # main + + - name: Setup Windows + if: startsWith(runner.os, 'Windows') + uses: llvm/actions/setup-windows@main + with: + arch: amd64 + + - name: Set Build Prefix + id: build-prefix + shell: bash + run: | + build_prefix=`pwd` + if [ "${{ runner.os }}" = "Linux" ]; then + sudo chown $USER:$USER /mnt/ + build_prefix=/mnt/ + fi + echo "build-prefix=$build_prefix" >> $GITHUB_OUTPUT + + - name: Download Previous Stage Artifact + if: ${{ inputs.previous-artifact }} + id: download + uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + with: + pattern: ${{ runner.os }}-${{ runner.arch }}-${{ inputs.previous-artifact }}-* + merge-multiple: true + + - name: Unpack Artifact + if: ${{ steps.download.outputs.download-path }} + shell: bash + run: | + tar --zstd -xf llvm-project.tar.zst + rm llvm-project.tar.zst + tar --zstd -C ${{ steps.build-prefix.outputs.build-prefix}} -xf build.tar.zst + rm build.tar.zst diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml index 7de4d00334d14..fcd371d49e6c9 100644 --- a/.github/workflows/release-binaries.yml +++ b/.github/workflows/release-binaries.yml @@ -5,28 +5,43 @@ on: inputs: release-version: description: 'Release Version' - required: true + required: false type: string upload: description: 'Upload binaries to the release page' required: true default: false type: boolean + runs-on: + description: "Runner to use for the build" + required: true + type: choice + options: + - ubuntu-22.04 + - windows-2022 + - macos-13 + - macos-14 workflow_call: inputs: release-version: description: 'Release Version' - required: true + required: false type: string upload: description: 'Upload binaries to the release page' required: true default: false type: boolean - schedule: - # * is a special character in YAML so you have to quote this string - - cron: '0 8 1 * *' + runs-on: + description: "Runner to use for the build" + required: true + type: string + secrets: + RELEASE_TASKS_USER_TOKEN: + description: "Secret used to check user permissions." + required: false + permissions: contents: read # Default everything to read-only @@ -34,30 +49,45 @@ permissions: jobs: prepare: name: Prepare to build binaries - runs-on: ubuntu-22.04 + runs-on: ${{ inputs.runs-on }} if: github.repository == 'llvm/llvm-project' outputs: release-version: ${{ steps.vars.outputs.release-version }} ref: ${{ steps.vars.outputs.ref }} upload: ${{ steps.vars.outputs.upload }} + target-cmake-flags: ${{ steps.vars.outputs.target-cmake-flags }} + build-flang: ${{ steps.vars.outputs.build-flang }} + enable-pgo: ${{ steps.vars.outputs.enable-pgo }} + release-binary-basename: ${{ steps.vars.outputs.release-binary-basename }} + release-binary-filename: ${{ steps.vars.outputs.release-binary-filename }} steps: + # It's good practice to use setup-python, but this is also required on macos-14 + # due to https://github.com/actions/runner-images/issues/10385 + - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f + with: + python-version: '3.12' + - name: Checkout LLVM uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Install Dependencies + shell: bash run: | pip install --require-hashes -r ./llvm/utils/git/requirements.txt - name: Check Permissions + if: github.event_name != 'pull_request' env: GITHUB_TOKEN: ${{ github.token }} USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} + shell: bash run: | ./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} --user-token "$USER_TOKEN" check-permissions - name: Collect Variables id: vars + shell: bash # In order for the test-release.sh script to run correctly, the LLVM # source needs to be at the following location relative to the build dir: # | X.Y.Z-rcN | ./rcN/llvm-project @@ -67,242 +97,404 @@ jobs: # | X.Y.Z-rcN | -rc N -test-asserts # | X.Y.Z | -final run: | - tag="${{ github.ref_name }}" trimmed=$(echo ${{ inputs.release-version }} | xargs) - [[ "$trimmed" != "" ]] && tag="llvmorg-$trimmed" - if [ "$tag" = "main" ]; then - # If tag is main, then we've been triggered by a scheduled so pass so - # use the head commit as the tag. - tag=`git rev-parse HEAD` + if [ -n "$trimmed" ]; then + release_version="$trimmed" + ref="llvmorg-$release_version" + else + release_version="${{ (github.event_name == 'pull_request' && format('PR{0}', github.event.pull_request.number)) || 'CI'}}-${{ github.sha }}" + ref=${{ github.sha }} fi if [ -n "${{ inputs.upload }}" ]; then upload="${{ inputs.upload }}" else upload="false" fi - bash .github/workflows/set-release-binary-outputs.sh "$tag" "$upload" + echo "release-version=$release_version">> $GITHUB_OUTPUT + echo "ref=$ref" >> $GITHUB_OUTPUT + echo "upload=$upload" >> $GITHUB_OUTPUT + + release_binary_basename="LLVM-$release_version-${{ runner.os }}-${{ runner.arch }}" + echo "release-binary-basename=$release_binary_basename" >> $GITHUB_OUTPUT + echo "release-binary-filename=$release_binary_basename.tar.xz" >> $GITHUB_OUTPUT + + # Detect necessary CMake flags + target="${{ runner.os }}-${{ runner.arch }}" + echo "enable-pgo=false" >> $GITHUB_OUTPUT + target_cmake_flags="-DLLVM_RELEASE_ENABLE_PGO=OFF" + # The macOS builds try to cross compile some libraries so we need to + # add extra CMake args to disable them. + # See https://github.com/llvm/llvm-project/issues/99767 + if [ "${{ runner.os }}" = "macOS" ]; then + target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF" + if [ "${{ runner.arch }}" = "ARM64" ]; then + arches=arm64 + else + arches=x86_64 + fi + target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches" + fi - build-stage1-linux: - name: "Build Stage 1 Linux" + # x86 macOS and x86 Windows have trouble building flang, so disable it. + # Windows: https://github.com/llvm/llvm-project/issues/100202 + # macOS: 'rebase opcodes terminated early at offset 1 of 80016' when building __fortran_builtins.mod + build_flang="true" + + if [ "$target" = "Windows-X64" ]; then + target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PROJECTS=\"clang;lld;lldb;clang-tools-extra;bolt;polly;mlir\"" + build_flang="false" + fi + + if [ "${{ runner.os }}" = "Windows" ]; then + # The build times out on Windows, so we need to disable LTO. + target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF" + fi + + echo "target-cmake-flags=$target_cmake_flags" >> $GITHUB_OUTPUT + echo "build-flang=$build_flang" >> $GITHUB_OUTPUT + + build-stage1: + name: "Build Stage 1" needs: prepare - runs-on: ubuntu-22.04 if: github.repository == 'llvm/llvm-project' + runs-on: ${{ inputs.runs-on }} steps: + + - name: Checkout Actions + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }} + sparse-checkout: | + .github/workflows/ + sparse-checkout-cone-mode: false + # Check out outside of working directory so the source checkout doesn't + # remove it. + path: workflows + + # actions/checkout does not support paths outside of the GITHUB_WORKSPACE. + # Also, anything that we put inside of GITHUB_WORKSPACE will be overwritten + # by future actions/checkout steps. Therefore, in order to checkout the + # latest actions from main, we need to first checkout out the actions inside of + # GITHUB_WORKSPACE (see previous step), then use actions/checkout to checkout + # the code being built and the move the actions from main back into GITHUB_WORKSPACE, + # becasue the uses on composite actions only reads workflows from inside GITHUB_WORKSPACE. + - shell: bash + run: mv workflows ../workflows-main + - name: Checkout LLVM uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: ref: ${{ needs.prepare.outputs.ref }} - - name: Install Ninja - uses: llvm/actions/install-ninja@22e9f909d35b50bd1181709564bfe816eaeaae81 # main + - name: Copy main workflows + shell: bash + run: | + mv ../workflows-main . + + - name: Setup Stage + id: setup-stage + uses: ./workflows-main/.github/workflows/release-binaries-setup-stage - name: Setup sccache uses: hendrikmuhs/ccache-action@ca3acd2731eef11f1572ccb126356c2f9298d35e # v1.2.9 with: - max-size: 250M - key: sccache-${{ runner.os }}-release + # Default to 2G to workaround: https://github.com/hendrikmuhs/ccache-action/issues/174 + max-size: 2G + key: sccache-${{ runner.os }}-${{ runner.arch }}-release variant: sccache - name: Build Stage 1 Clang + id: build + shell: bash run: | - sudo chown $USER:$USER /mnt/ - cmake -G Ninja -C clang/cmake/caches/Release.cmake -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -S llvm -B /mnt/build - ninja -v -C /mnt/build - - # We need to create an archive of the build directory, because it has too - # many files to upload. - - name: Package Build and Source Directories - run: | - tar -c . | zstd -T0 -c > llvm-project.tar.zst - tar -C /mnt/ -c build/ | zstd -T0 -c > build.tar.zst - - - name: Upload Stage 1 Source - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 + # There were some issues on the ARM64 MacOS runners with trying to build x86 object, + # so we need to set some extra cmake flags to disable this. + cmake -G Ninja -S llvm -B ${{ steps.setup-stage.outputs.build-prefix }}/build \ + ${{ needs.prepare.outputs.target-cmake-flags }} \ + -C clang/cmake/caches/Release.cmake \ + -DBOOTSTRAP_LLVM_PARALLEL_LINK_JOBS=1 \ + -DBOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}" \ + -DCMAKE_C_COMPILER_LAUNCHER=sccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + ninja -v -C ${{ steps.setup-stage.outputs.build-prefix }}/build + # There is a race condition on the MacOS builders and this command is here + # to help debug that when it happens. + ls -ltr ${{ steps.setup-stage.outputs.build-prefix }}/build + + - name: Save Stage + uses: ./workflows-main/.github/workflows/release-binaries-save-stage with: - name: stage1-source - path: llvm-project.tar.zst - retention-days: 2 + build-prefix: ${{ steps.setup-stage.outputs.build-prefix }} - - name: Upload Stage 1 Build Dir - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 - with: - name: stage1-build - path: build.tar.zst - retention-days: 2 - - build-stage2-linux: - name: "Build Stage 2 Linux" + build-stage2: + name: "Build Stage 2" needs: - prepare - - build-stage1-linux - runs-on: ubuntu-22.04 + - build-stage1 if: github.repository == 'llvm/llvm-project' + runs-on: ${{ inputs.runs-on }} steps: - - name: Install Ninja - uses: llvm/actions/install-ninja@22e9f909d35b50bd1181709564bfe816eaeaae81 # main - - - name: Download Stage 1 Artifacts - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + - name: Checkout Actions + uses: actions/checkout@v4 with: - pattern: stage1-* - merge-multiple: true - - - name: Unpack Artifacts - run: | - tar --zstd -xf llvm-project.tar.zst - rm llvm-project.tar.zst - sudo chown $USER:$USER /mnt/ - tar --zstd -C /mnt -xf build.tar.zst - rm build.tar.zst + ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }} + sparse-checkout: | + .github/workflows/ + sparse-checkout-cone-mode: false + path: workflows + - name: Setup Stage + id: setup-stage + uses: ./workflows/.github/workflows/release-binaries-setup-stage + with: + previous-artifact: build-stage1 - name: Build Stage 2 # Re-enable once PGO builds are supported. - if: false + if: needs.prepare.outputs.enable-pgo == 'true' + shell: bash run: | - ninja -C /mnt/build stage2-instrumented + ninja -C ${{ steps.setup-stage.outputs.build-prefix}}/build stage2-instrumented - # We need to create an archive of the build directory, because it has too - # many files to upload. - - name: Save Build and Source Directories - run: | - tar -c . | zstd -T0 -c > llvm-project.tar.zst - tar -C /mnt/ -c build/ | zstd -T0 -c > build.tar.zst - - - name: Upload Stage 2 Source - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 + - name: Save Stage + uses: ./workflows/.github/workflows/release-binaries-save-stage with: - name: stage2-source - path: ${{ github.workspace }}/llvm-project.tar.zst - retention-days: 2 + build-prefix: ${{ steps.setup-stage.outputs.build-prefix }} - - name: Upload Stage 2 Build Dir - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 + build-stage3-clang: + name: "Build Stage 3 LLVM/Clang" + needs: + - prepare + - build-stage2 + if: github.repository == 'llvm/llvm-project' + runs-on: ${{ inputs.runs-on }} + steps: + - name: Checkout Actions + uses: actions/checkout@v4 with: - name: stage2-build - path: ${{ github.workspace }}/build.tar.zst - retention-days: 2 + ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }} + sparse-checkout: | + .github/workflows/ + sparse-checkout-cone-mode: false + path: workflows + - name: Setup Stage + id: setup-stage + uses: ./workflows/.github/workflows/release-binaries-setup-stage + with: + previous-artifact: build-stage2 + - name: Build LLVM/Clang + shell: bash + run: | + # There is a race condition on the MacOS builders and this command is here + # to help debug that when it happens. + ls -ltr ${{ steps.setup-stage.outputs.build-prefix }}/build + ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-clang + # Build some of the larger binaries here too. + ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ \ + clang-scan-deps \ + modularize clangd \ + clangd-indexer \ + clang-check \ + ${{ (runner.os == 'Linux' && 'clangd-fuzzer') || '' }} \ + clang-tidy \ + llc \ + lli \ + llvm-exegesis \ + llvm-opt-fuzzer \ + llvm-reduce \ + llvm-lto \ + dsymutil + + - name: Save Stage + uses: ./workflows/.github/workflows/release-binaries-save-stage + with: + build-prefix: ${{ steps.setup-stage.outputs.build-prefix }} - build-stage3-linux: - name: "Build Stage 3 Linux" + build-stage3-flang: + name: "Build Stage 3 Flang/MLIR/Bolt" needs: - prepare - - build-stage2-linux - outputs: - filename: ${{ steps.package-info.outputs.release-filename }} - runs-on: ubuntu-22.04-16x64 - if: github.repository == 'llvm/llvm-project' + - build-stage3-clang + runs-on: ${{ inputs.runs-on }} steps: - - name: Install Ninja - uses: llvm/actions/install-ninja@22e9f909d35b50bd1181709564bfe816eaeaae81 # main - - - name: 'Download artifact' - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + - name: Checkout Actions + uses: actions/checkout@v4 with: - pattern: stage2-* - merge-multiple: true + ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }} + sparse-checkout: | + .github/workflows/ + sparse-checkout-cone-mode: false + path: workflows + - name: Setup Stage + id: setup-stage + uses: ./workflows/.github/workflows/release-binaries-setup-stage + with: + previous-artifact: build-stage3-clang - - name: Unpack Artifact + - name: Build Flang / MLIR / Bolt + shell: bash run: | - tar --zstd -xf llvm-project.tar.zst - rm llvm-project.tar.zst - sudo chown $USER:$USER /mnt/ - tar --zstd -C /mnt -xf build.tar.zst - rm build.tar.zst + # Build some of the mlir tools that take a long time to link + if [ "${{ needs.prepare.outputs.build-flang }}" = "true" ]; then + ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ -j2 flang-new bbc + fi + ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/ \ + mlir-bytecode-parser-fuzzer \ + mlir-cpu-runner \ + mlir-lsp-server \ + mlir-opt \ + mlir-query \ + mlir-reduce \ + mlir-text-parser-fuzzer \ + mlir-translate \ + mlir-transform-opt \ + mlir-cat \ + mlir-minimal-opt \ + mlir-minimal-opt-canonicalize \ + mlir-pdll-lsp-server \ + llvm-bolt \ + llvm-bolt-heatmap + + - name: Save Stage + uses: ./workflows/.github/workflows/release-binaries-save-stage + with: + build-prefix: ${{ steps.setup-stage.outputs.build-prefix }} - - name: Build Release Package - run: | - ninja -C /mnt/build stage2-package + build-stage3-all: + name: "Build Stage 3" + needs: + - prepare + - build-stage3-flang + runs-on: ${{ inputs.runs-on }} + steps: + - name: Checkout Actions + uses: actions/checkout@v4 + with: + ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }} + sparse-checkout: | + .github/workflows/ + sparse-checkout-cone-mode: false + path: workflows + - name: Setup Stage + id: setup-stage + uses: ./workflows/.github/workflows/release-binaries-setup-stage + with: + previous-artifact: build-stage3-flang - - id: package-info + - name: Build Release Package + shell: bash run: | - filename="LLVM-${{ needs.prepare.outputs.release-version }}-Linux.tar.xz" - echo "filename=$filename" >> $GITHUB_OUTPUT - echo "path=/mnt/build/tools/clang/stage2-bins/$filename" >> $GITHUB_OUTPUT + which cmake + ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-package + # Copy Release artifact to the workspace so it is easier to upload. + # This is necessary, because on Windows, the build-prefix path can + # only be used on bash steps, because it uses the form of /d/files/ + # and other steps expect D:\files. + mv ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/${{ needs.prepare.outputs.release-binary-filename }} . - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 - if: always() with: - name: release-binary - path: ${{ steps.package-info.outputs.path }} + name: ${{ runner.os }}-${{ runner.arch }}-release-binary + # Due to path differences on Windows when running in bash vs running on node, + # we need to search for files in the current workspace. + path: | + ${{ needs.prepare.outputs.release-binary-filename }} # Clean up some build files to reduce size of artifact. - name: Clean Up Build Directory + shell: bash run: | - find /mnt/build -iname ${{ steps.package-info.outputs.filename }} -delete - - # We need to create an archive of the build directory, because it has too - # many files to upload. - - name: Save Build and Source Directories - run: | - tar -c . | zstd -T0 -c > llvm-project.tar.zst - tar -C /mnt/ -c build/ | zstd -T0 -c > build.tar.zst - - - name: Upload Stage 3 Source - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 - with: - name: stage3-source - path: llvm-project.tar.zst - retention-days: 2 + find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname ${{ needs.prepare.outputs.release-binary-filename }} -delete + rm -Rf ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/_CPack_Packages - - name: Upload Stage 3 Build Dir - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0 + - name: Save Stage + uses: ./workflows/.github/workflows/release-binaries-save-stage with: - name: stage3-build - path: build.tar.zst - retention-days: 2 + build-prefix: ${{ steps.setup-stage.outputs.build-prefix }} - upload-release-binaries-linux: - name: "Upload Linux Release Binaries" + upload-release-binaries: + name: "Upload Release Binaries" needs: - prepare - - build-stage3-linux - if : ${{ needs.prepare.outputs.upload == 'true' }} + - build-stage3-all + if: >- + always() && + github.event_name != 'pull_request' && + needs.prepare.outputs.upload == 'true' runs-on: ubuntu-22.04 permissions: contents: write # For release uploads + id-token: write # For artifact attestations + attestations: write # For artifact attestations steps: - name: 'Download artifact' uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 with: - name: release-binary + pattern: '*-release-binary' + merge-multiple: true + + - name: Attest Build Provenance + id: provenance + uses: actions/attest-build-provenance@897ed5eab6ed058a474202017ada7f40bfa52940 # v1.0.0 + with: + subject-path: ${{ needs.prepare.outputs.release-binary-filename }} + + - name: Rename attestation file + run: + mv ${{ steps.provenance.outputs.bundle-path }} ${{ needs.prepare.outputs.release-binary-filename }}.jsonl + + - name: Upload Build Provenance + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3 + with: + name: ${{ needs.prepare.outputs.release-binary-filename }}-attestation + path: ${{ needs.prepare.outputs.release-binary-filename }}.jsonl + + - name: Checkout Release Scripts + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + sparse-checkout: | + llvm/utils/release/github-upload-release.py + llvm/utils/git/requirements.txt + sparse-checkout-cone-mode: false + + - name: Install Python Requirements + run: | + pip install --require-hashes -r ./llvm/utils/git/requirements.txt - name: Upload Release + shell: bash run: | - sudo apt install python3-github - ./llvm-project/llvm/utils/release/github-upload-release.py \ + ./llvm/utils/release/github-upload-release.py \ --token ${{ github.token }} \ --release ${{ needs.prepare.outputs.release-version }} \ upload \ - --files ${{ needs.build-stage3-linux.outputs.release-filename }} - + --files ${{ needs.prepare.outputs.release-binary-filename }}* - test-stage3-linux: - name: "Test Stage 3 Linux" + test-stage3: + name: "Test Stage 3" needs: - prepare - - build-stage3-linux - runs-on: ubuntu-22.04 - if: github.repository == 'llvm/llvm-project' + - build-stage3-all + if: >- + github.repository == 'llvm/llvm-project' + runs-on: ${{ inputs.runs-on }} steps: - - name: Install Ninja - uses: llvm/actions/install-ninja@22e9f909d35b50bd1181709564bfe816eaeaae81 # main - - - name: 'Download artifact' - uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 + - name: Checkout Actions + uses: actions/checkout@v4 with: - pattern: stage3-* - merge-multiple: true - - - name: Unpack Artifact - run: | - tar --zstd -xf llvm-project.tar.zst - rm llvm-project.tar.zst - sudo chown $USER:$USER /mnt/ - tar --zstd -C /mnt -xf build.tar.zst - rm build.tar.zst + ref: ${{ (github.event_name == 'pull_request' && github.sha) || 'main' }} + sparse-checkout: | + .github/workflows/ + sparse-checkout-cone-mode: false + path: workflows + - name: Setup Stage + id: setup-stage + uses: ./workflows/.github/workflows/release-binaries-setup-stage + with: + previous-artifact: build-stage3-all - name: Run Tests + shell: bash run: | - ninja -C /mnt/build stage2-check-all + ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-check-all diff --git a/.github/workflows/release-doxygen.yml b/.github/workflows/release-doxygen.yml index ef00a438ce7ac..ea95e5bb12b2b 100644 --- a/.github/workflows/release-doxygen.yml +++ b/.github/workflows/release-doxygen.yml @@ -25,6 +25,10 @@ on: description: 'Upload documentation' required: false type: boolean + secrets: + RELEASE_TASKS_USER_TOKEN: + description: "Secret used to check user permissions." + required: false jobs: release-doxygen: @@ -63,5 +67,6 @@ jobs: if: env.upload env: GITHUB_TOKEN: ${{ github.token }} + USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} run: | - ./llvm/utils/release/github-upload-release.py --token "$GITHUB_TOKEN" --release "${{ inputs.release-version }}" --user "${{ github.actor }}" upload --files ./*doxygen*.tar.xz + ./llvm/utils/release/github-upload-release.py --token "$GITHUB_TOKEN" --release "${{ inputs.release-version }}" --user "${{ github.actor }}" --user-token "$USER_TOKEN" upload --files ./*doxygen*.tar.xz diff --git a/.github/workflows/release-lit.yml b/.github/workflows/release-lit.yml index 0316ba406041d..9d6f3140e6883 100644 --- a/.github/workflows/release-lit.yml +++ b/.github/workflows/release-lit.yml @@ -17,6 +17,10 @@ on: description: 'Release Version' required: true type: string + secrets: + RELEASE_TASKS_USER_TOKEN: + description: "Secret used to check user permissions." + required: false jobs: release-lit: @@ -36,8 +40,9 @@ jobs: - name: Check Permissions env: GITHUB_TOKEN: ${{ github.token }} + USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} run: | - ./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} check-permissions + ./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} --user-token "$USER_TOKEN" check-permissions - name: Setup Cpp uses: aminya/setup-cpp@v1 diff --git a/.github/workflows/release-sources.yml b/.github/workflows/release-sources.yml index 9c5b1a9f01709..a6c86823f99df 100644 --- a/.github/workflows/release-sources.yml +++ b/.github/workflows/release-sources.yml @@ -16,6 +16,10 @@ on: description: Release Version required: true type: string + secrets: + RELEASE_TASKS_USER_TOKEN: + description: "Secret used to check user permissions." + required: false # Run on pull_requests for testing purposes. pull_request: paths: @@ -47,7 +51,7 @@ jobs: steps: - id: inputs run: | - ref=${{ inputs.release-version || github.sha }} + ref=${{ (inputs.release-version && format('llvmorg-{0}', inputs.release-version)) || github.sha }} if [ -n "${{ inputs.release-version }}" ]; then export_args="-release ${{ inputs.release-version }} -final" else diff --git a/.github/workflows/release-tasks.yml b/.github/workflows/release-tasks.yml index 2ed56dace1d4c..780dd0ff6325c 100644 --- a/.github/workflows/release-tasks.yml +++ b/.github/workflows/release-tasks.yml @@ -66,6 +66,9 @@ jobs: with: release-version: ${{ needs.validate-tag.outputs.release-version }} upload: true + # Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use. + secrets: + RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} release-lit: name: Release Lit @@ -73,22 +76,41 @@ jobs: uses: ./.github/workflows/release-lit.yml with: release-version: ${{ needs.validate-tag.outputs.release-version }} + # Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use. + secrets: + RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} release-binaries: name: Build Release Binaries permissions: contents: write + id-token: write + attestations: write needs: - validate-tag - release-create + strategy: + fail-fast: false + matrix: + runs-on: + - ubuntu-22.04 + - windows-2022 + - macos-13 + - macos-14 + uses: ./.github/workflows/release-binaries.yml with: release-version: ${{ needs.validate-tag.outputs.release-version }} upload: true + runs-on: ${{ matrix.runs-on }} + # Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use. + secrets: + RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} release-sources: name: Package Release Sources permissions: + contents: read id-token: write attestations: write needs: @@ -96,3 +118,6 @@ jobs: uses: ./.github/workflows/release-sources.yml with: release-version: ${{ needs.validate-tag.outputs.release-version }} + # Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use. + secrets: + RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml index 4ce6119a407f5..894e07d323ca9 100644 --- a/.github/workflows/version-check.yml +++ b/.github/workflows/version-check.yml @@ -27,5 +27,5 @@ jobs: - name: Version Check run: | - version=$(grep -o 'LLVM_VERSION_\(MAJOR\|MINOR\|PATCH\) [0-9]\+' llvm/CMakeLists.txt | cut -d ' ' -f 2 | tr "\n" "." | sed 's/.$//g') + version=$(grep -o 'LLVM_VERSION_\(MAJOR\|MINOR\|PATCH\) [0-9]\+' cmake/Modules/LLVMVersion.cmake | cut -d ' ' -f 2 | tr "\n" "." | sed 's/.$//g') .github/workflows/version-check.py "$version" diff --git a/.gitignore b/.gitignore index 20c4f52cd3786..8d4c0484aec60 100644 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,7 @@ pythonenv* /clang/utils/analyzer/projects/*/RefScanBuildResults # automodapi puts generated documentation files here. /lldb/docs/python_api/ + +/artifacts +/.dotnet +/.packages diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000000000..a415a3f917864 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,10 @@ + + + + + + + + true + + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000000000..177d64c47ad11 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,4 @@ + + + + diff --git a/NuGet.config b/NuGet.config new file mode 100644 index 0000000000000..6082e261d277e --- /dev/null +++ b/NuGet.config @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index 33ebae3b6e6de..3d24936271bf8 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -2143,6 +2143,14 @@ bool RewriteInstance::analyzeRelocation( if (!Relocation::isSupported(RType)) return false; + auto IsWeakReference = [](const SymbolRef &Symbol) { + Expected SymFlagsOrErr = Symbol.getFlags(); + if (!SymFlagsOrErr) + return false; + return (*SymFlagsOrErr & SymbolRef::SF_Undefined) && + (*SymFlagsOrErr & SymbolRef::SF_Weak); + }; + const bool IsAArch64 = BC->isAArch64(); const size_t RelSize = Relocation::getSizeForType(RType); @@ -2174,7 +2182,8 @@ bool RewriteInstance::analyzeRelocation( // Section symbols are marked as ST_Debug. IsSectionRelocation = (cantFail(Symbol.getType()) == SymbolRef::ST_Debug); // Check for PLT entry registered with symbol name - if (!SymbolAddress && (IsAArch64 || BC->isRISCV())) { + if (!SymbolAddress && !IsWeakReference(Symbol) && + (IsAArch64 || BC->isRISCV())) { const BinaryData *BD = BC->getPLTBinaryDataByName(SymbolName); SymbolAddress = BD ? BD->getAddress() : 0; } @@ -2603,7 +2612,7 @@ void RewriteInstance::handleRelocation(const SectionRef &RelocatedSection, Expected SectionName = Section->getName(); if (SectionName && !SectionName->empty()) ReferencedSection = BC->getUniqueSectionByName(*SectionName); - } else if (ReferencedSymbol && ContainingBF && + } else if (BC->isRISCV() && ReferencedSymbol && ContainingBF && (cantFail(Symbol.getFlags()) & SymbolRef::SF_Absolute)) { // This might be a relocation for an ABS symbols like __global_pointer$ on // RISC-V @@ -5498,6 +5507,14 @@ uint64_t RewriteInstance::getNewFunctionOrDataAddress(uint64_t OldAddress) { if (const BinaryFunction *BF = BC->getBinaryFunctionContainingAddress(OldAddress)) { if (BF->isEmitted()) { + // If OldAddress is the another entry point of + // the function, then BOLT could get the new address. + if (BF->isMultiEntry()) { + for (const BinaryBasicBlock &BB : *BF) + if (BB.isEntryPoint() && + (BF->getAddress() + BB.getOffset()) == OldAddress) + return BF->getOutputAddress() + BB.getOffset(); + } BC->errs() << "BOLT-ERROR: unable to get new address corresponding to " "input address 0x" << Twine::utohexstr(OldAddress) << " in function " << *BF diff --git a/bolt/test/AArch64/Inputs/build_id.ldscript b/bolt/test/AArch64/Inputs/build_id.ldscript new file mode 100644 index 0000000000000..0af8e960f491b --- /dev/null +++ b/bolt/test/AArch64/Inputs/build_id.ldscript @@ -0,0 +1,9 @@ +SECTIONS +{ + PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS; + .note.gnu.build-id (0x400400): + { + build_id_note = ABSOLUTE(.); + *(.note.gnu.build-id) + } +} diff --git a/bolt/test/AArch64/build_id.c b/bolt/test/AArch64/build_id.c new file mode 100644 index 0000000000000..01e433c7ca8fd --- /dev/null +++ b/bolt/test/AArch64/build_id.c @@ -0,0 +1,25 @@ +// This test checks that referencing build_id through GOT table +// would result in GOT access after disassembly, not directly +// to build_id address. + +// RUN: %clang %cflags -fuse-ld=lld -Wl,-T,%S/Inputs/build_id.ldscript -Wl,-q \ +// RUN: -Wl,--no-relax -Wl,--build-id=sha1 %s -o %t.exe +// RUN: llvm-bolt -print-disasm --print-only=get_build_id %t.exe -o %t.bolt | \ +// RUN: FileCheck %s + +// CHECK: adrp [[REG:x[0-28]+]], __BOLT_got_zero +// CHECK: ldr x{{.*}}, [[[REG]], :lo12:__BOLT_got_zero{{.*}}] + +struct build_id_note { + char pad[16]; + char hash[20]; +}; + +extern const struct build_id_note build_id_note; + +__attribute__((noinline)) char get_build_id() { return build_id_note.hash[0]; } + +int main() { + get_build_id(); + return 0; +} diff --git a/bolt/test/AArch64/update-weak-reference-symbol.s b/bolt/test/AArch64/update-weak-reference-symbol.s new file mode 100644 index 0000000000000..600a06b8b6d8f --- /dev/null +++ b/bolt/test/AArch64/update-weak-reference-symbol.s @@ -0,0 +1,34 @@ +// This test checks whether BOLT can correctly handle relocations against weak symbols. + +// RUN: %clang %cflags -Wl,-z,notext -shared -Wl,-q %s -o %t.so +// RUN: llvm-bolt %t.so -o %t.so.bolt +// RUN: llvm-nm -n %t.so.bolt > %t.out.txt +// RUN: llvm-objdump -dj .rodata %t.so.bolt >> %t.out.txt +// RUN: FileCheck %s --input-file=%t.out.txt + +# CHECK: w func_1 +# CHECK: {{0+}}[[#%x,ADDR:]] W func_2 + +# CHECK: {{.*}} <.rodata>: +# CHECK-NEXT: {{.*}} .word 0x00000000 +# CHECK-NEXT: {{.*}} .word 0x00000000 +# CHECK-NEXT: {{.*}} .word 0x{{[0]+}}[[#ADDR]] +# CHECK-NEXT: {{.*}} .word 0x00000000 + + .text + .weak func_2 + .weak func_1 + .global wow + .type wow, %function +wow: + bl func_1 + bl func_2 + ret + .type func_2, %function +func_2: + ret + .section .rodata +.LC0: + .xword func_1 +.LC1: + .xword func_2 diff --git a/bolt/test/X86/Inputs/build_id.yaml b/bolt/test/X86/Inputs/build_id.yaml new file mode 100644 index 0000000000000..af012904ff950 --- /dev/null +++ b/bolt/test/X86/Inputs/build_id.yaml @@ -0,0 +1,326 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x4010A0 +ProgramHeaders: + - Type: PT_PHDR + Flags: [ PF_R ] + VAddr: 0x400040 + Align: 0x8 + Offset: 0x40 + - Type: PT_INTERP + Flags: [ PF_R ] + FirstSec: .interp + LastSec: .interp + VAddr: 0x400444 + Offset: 0x444 + - Type: PT_LOAD + Flags: [ PF_X, PF_R ] + FirstSec: .init + LastSec: .fini + VAddr: 0x401000 + Align: 0x1000 + Offset: 0x1000 + - Type: PT_LOAD + Flags: [ PF_R ] + FirstSec: .rodata + LastSec: .rodata + VAddr: 0x402000 + Align: 0x1000 + Offset: 0x2000 + - Type: PT_LOAD + Flags: [ PF_W, PF_R ] + FirstSec: .init_array + LastSec: .bss + VAddr: 0x403DD8 + Align: 0x1000 + Offset: 0x2DD8 + - Type: PT_DYNAMIC + Flags: [ PF_W, PF_R ] + FirstSec: .dynamic + LastSec: .dynamic + VAddr: 0x403DE8 + Align: 0x8 + Offset: 0x2DE8 + - Type: PT_NOTE + Flags: [ PF_R ] + FirstSec: .note.gnu.build-id + LastSec: .note.ABI-tag + VAddr: 0x400400 + Align: 0x4 + Offset: 0x400 +Sections: + - Name: .note.gnu.build-id + Type: SHT_NOTE + Flags: [ SHF_ALLOC ] + Address: 0x400400 + AddressAlign: 0x4 + Offset: 0x400 + Notes: + - Name: GNU + Desc: 3C34F7D1612996940C48F98DC272543BC3C9C956 + Type: NT_PRPSINFO + - Name: .note.ABI-tag + Type: SHT_NOTE + Flags: [ SHF_ALLOC ] + Address: 0x400424 + AddressAlign: 0x4 + Notes: + - Name: GNU + Desc: '00000000030000000200000000000000' + Type: NT_VERSION + - Name: .interp + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x400444 + AddressAlign: 0x1 + Content: 2F6C696236342F6C642D6C696E75782D7838362D36342E736F2E3200 + - Name: .gnu.hash + Type: SHT_GNU_HASH + Flags: [ SHF_ALLOC ] + Address: 0x400460 + Link: .dynsym + AddressAlign: 0x8 + Header: + SymNdx: 0x7 + Shift2: 0x6 + BloomFilter: [ 0x810000 ] + HashBuckets: [ 0x7, 0x0 ] + HashValues: [ 0x6DCE65D1 ] + - Name: .dynsym + Type: SHT_DYNSYM + Flags: [ SHF_ALLOC ] + Address: 0x400488 + Link: .dynstr + AddressAlign: 0x8 + - Name: .dynstr + Type: SHT_STRTAB + Flags: [ SHF_ALLOC ] + Address: 0x400548 + AddressAlign: 0x1 + - Name: .gnu.version + Type: SHT_GNU_versym + Flags: [ SHF_ALLOC ] + Address: 0x4005F2 + Link: .dynsym + AddressAlign: 0x2 + Entries: [ 0, 2, 3, 1, 1, 4, 1, 2 ] + - Name: .gnu.version_r + Type: SHT_GNU_verneed + Flags: [ SHF_ALLOC ] + Address: 0x400608 + Link: .dynstr + AddressAlign: 0x8 + Dependencies: + - Version: 1 + File: libc.so.6 + Entries: + - Name: GLIBC_2.3.4 + Hash: 157882740 + Flags: 0 + Other: 4 + - Name: GLIBC_2.34 + Hash: 110530996 + Flags: 0 + Other: 3 + - Name: GLIBC_2.2.5 + Hash: 157882997 + Flags: 0 + Other: 2 + - Name: .init + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x401000 + AddressAlign: 0x4 + Offset: 0x1000 + Content: F30F1EFA4883EC08488B05D92F00004885C07402FFD04883C408C3 + - Name: .plt.sec + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x401060 + AddressAlign: 0x10 + EntSize: 0x10 + Content: F30F1EFAF2FF25AD2F00000F1F440000F30F1EFAF2FF25A52F00000F1F440000 + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x401080 + AddressAlign: 0x10 + Content: F30F1EFA4883EC0831C0E80101000031C04883C408C3662E0F1F840000000000F30F1EFA31ED4989D15E4889E24883E4F050544531C031C9488D3DC1FFFFFFFF15132F0000F4662E0F1F840000000000488D3D612F0000488D055A2F00004839F87415488B05F62E00004885C07409FFE00F1F8000000000C30F1F8000000000488D3D312F0000488D352A2F00004829FE4889F048C1EE3F48C1F8034801C648D1FE7414488B05C52E00004885C07408FFE0660F1F440000C30F1F8000000000F30F1EFA803DED2E000000752B5548833DA22E0000004889E5740C488B3DCE2E0000E8E9FEFFFFE864FFFFFFC605C52E0000015DC30F1F00C30F1F8000000000F30F1EFAE977FFFFFF0F1F8000000000F30F1EFA415455488D2D660E000053488D1D6AF2FFFF4C8D6314660F1F4400000FB6134889EEBF0100000031C04883C301E8AAFEFFFF4C39E375E55BBF0A0000005D415CE987FEFFFF + - Name: .fini + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x4011DC + AddressAlign: 0x4 + Content: F30F1EFA4883EC084883C408C3 + - Name: .rodata + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x402000 + AddressAlign: 0x4 + Offset: 0x2000 + Content: '0100020025303268687800' + - Name: .init_array + Type: SHT_INIT_ARRAY + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x403DD8 + AddressAlign: 0x8 + EntSize: 0x8 + Offset: 0x2DD8 + Content: '8011400000000000' + - Name: .fini_array + Type: SHT_FINI_ARRAY + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x403DE0 + AddressAlign: 0x8 + EntSize: 0x8 + Content: '4011400000000000' + - Name: .dynamic + Type: SHT_DYNAMIC + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x403DE8 + Link: .dynstr + AddressAlign: 0x8 + Entries: + - Tag: DT_NEEDED + Value: 0x37 + - Tag: DT_INIT + Value: 0x401000 + - Tag: DT_FINI + Value: 0x4011DC + - Tag: DT_INIT_ARRAY + Value: 0x403DD8 + - Tag: DT_INIT_ARRAYSZ + Value: 0x8 + - Tag: DT_FINI_ARRAY + Value: 0x403DE0 + - Tag: DT_FINI_ARRAYSZ + Value: 0x8 + - Tag: DT_GNU_HASH + Value: 0x400460 + - Tag: DT_STRTAB + Value: 0x400548 + - Tag: DT_SYMTAB + Value: 0x400488 + - Tag: DT_STRSZ + Value: 0xA9 + - Tag: DT_SYMENT + Value: 0x18 + - Tag: DT_DEBUG + Value: 0x0 + - Tag: DT_PLTGOT + Value: 0x404000 + - Tag: DT_PLTRELSZ + Value: 0x30 + - Tag: DT_PLTREL + Value: 0x7 + - Tag: DT_FLAGS + Value: 0x8 + - Tag: DT_FLAGS_1 + Value: 0x8000001 + - Tag: DT_VERNEED + Value: 0x400608 + - Tag: DT_VERNEEDNUM + Value: 0x1 + - Tag: DT_VERSYM + Value: 0x4005F2 + - Tag: DT_RELACOUNT + Value: 0x3 + - Tag: DT_NULL + Value: 0x0 + - Name: .data + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x404028 + AddressAlign: 0x8 + Content: '00000000000000003040400000000000' + - Name: .tm_clone_table + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x404038 + AddressAlign: 0x8 + - Name: .bss + Type: SHT_NOBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x404038 + AddressAlign: 0x1 + Size: 0x8 + - Name: .rela.text + Type: SHT_RELA + Flags: [ SHF_INFO_LINK ] + Link: .symtab + AddressAlign: 0x8 + Info: .text + Relocations: + - Offset: 0x40108B + Symbol: print_build_id + Type: R_X86_64_PLT32 + Addend: -4 + - Offset: 0x4010BB + Symbol: main + Type: R_X86_64_PC32 + Addend: -4 + - Offset: 0x4011A2 + Symbol: build_id_note + Type: R_X86_64_PC32 + Addend: 12 + - Type: SectionHeaderTable + Sections: + - Name: .note.gnu.build-id + - Name: .note.ABI-tag + - Name: .interp + - Name: .gnu.hash + - Name: .dynsym + - Name: .dynstr + - Name: .gnu.version + - Name: .gnu.version_r + - Name: .init + - Name: .plt.sec + - Name: .text + - Name: .rela.text + - Name: .fini + - Name: .rodata + - Name: .init_array + - Name: .fini_array + - Name: .dynamic + - Name: .data + - Name: .tm_clone_table + - Name: .bss + - Name: .symtab + - Name: .strtab + - Name: .shstrtab +Symbols: + - Name: print_build_id + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + Value: 0x401190 + Size: 0x49 + - Name: _end + Section: .bss + Binding: STB_GLOBAL + Value: 0x404040 + - Name: _start + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + Value: 0x4010A0 + Size: 0x26 + - Name: __bss_start + Section: .bss + Binding: STB_GLOBAL + Value: 0x404038 + - Name: main + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + Value: 0x401080 + Size: 0x16 + - Name: build_id_note + Index: SHN_ABS + Binding: STB_GLOBAL + Value: 0x400400 +... diff --git a/bolt/test/X86/build_id.test b/bolt/test/X86/build_id.test new file mode 100644 index 0000000000000..8d28e12dbf94f --- /dev/null +++ b/bolt/test/X86/build_id.test @@ -0,0 +1,8 @@ +// This test checks that relocation addend used to address build_id fields +// is properly disassembled by BOLT. + +RUN: yaml2obj %p/Inputs/build_id.yaml &> %t.exe +RUN: llvm-bolt -print-disasm --print-only=print_build_id %t.exe -o %t.bolt | \ +RUN: FileCheck %s + +CHECK: leaq build_id_note+16(%rip), %rbx diff --git a/bolt/test/X86/dynamic-relocs-on-entry.s b/bolt/test/X86/dynamic-relocs-on-entry.s new file mode 100644 index 0000000000000..2a29a43c4939a --- /dev/null +++ b/bolt/test/X86/dynamic-relocs-on-entry.s @@ -0,0 +1,32 @@ +// This test examines whether BOLT can correctly process when +// dynamic relocation points to other entry points of the +// function. + +# RUN: %clang %cflags -fPIC -pie %s -o %t.exe -nostdlib -Wl,-q +# RUN: llvm-bolt %t.exe -o %t.bolt > %t.out.txt +# RUN: readelf -r %t.bolt >> %t.out.txt +# RUN: llvm-objdump --disassemble-symbols=chain %t.bolt >> %t.out.txt +# RUN: FileCheck %s --input-file=%t.out.txt + +## Check if the new address in `chain` is correctly updated by BOLT +# CHECK: Relocation section '.rela.dyn' at offset 0x{{.*}} contains 1 entry: +# CHECK: {{.*}} R_X86_64_RELATIVE [[#%x,ADDR:]] +# CHECK: [[#ADDR]]: c3 retq + .text + .type chain, @function +chain: + movq $1, %rax +Label: + ret + .size chain, .-chain + + .type _start, @function + .global _start +_start: + jmpq *.Lfoo(%rip) + ret + .size _start, .-_start + + .data +.Lfoo: + .quad Label \ No newline at end of file diff --git a/bolt/utils/docker/Dockerfile b/bolt/utils/docker/Dockerfile deleted file mode 100644 index 722a07e46f9e4..0000000000000 --- a/bolt/utils/docker/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM ubuntu:20.04 AS builder - -ARG DEBIAN_FRONTEND=noninteractive -ENV TZ=UTC - -RUN apt-get update && \ - apt-get install -y --no-install-recommends ca-certificates git \ - build-essential cmake ninja-build python3 libjemalloc-dev \ - python3-psutil && \ - rm -rf /var/lib/apt/lists - -WORKDIR /home/bolt - -RUN git clone --depth 1 https://github.com/llvm/llvm-project - -RUN mkdir build && \ - cd build && \ - cmake -G Ninja ../llvm-project/llvm \ - -DLLVM_ENABLE_PROJECTS="bolt;clang;lld" \ - -DLLVM_TARGETS_TO_BUILD="X86;AArch64" \ - -DCMAKE_BUILD_TYPE=Release \ - -DLLVM_ENABLE_ASSERTIONS=ON \ - -DCMAKE_EXE_LINKER_FLAGS="-Wl,--push-state -Wl,-whole-archive -ljemalloc_pic -Wl,--pop-state -lpthread -lstdc++ -lm -ldl" \ - -DCMAKE_INSTALL_PREFIX=/home/bolt/install && \ - ninja check-bolt && \ - ninja install-llvm-bolt install-perf2bolt install-merge-fdata \ - install-llvm-boltdiff install-bolt_rt - -FROM ubuntu:20.04 - -COPY --from=builder /home/bolt/install /usr/local diff --git a/build.cmd b/build.cmd new file mode 100644 index 0000000000000..1ba69afd9cc77 --- /dev/null +++ b/build.cmd @@ -0,0 +1,8 @@ +@echo off +setlocal + +set _args=%* +if "%~1"=="-?" set _args=-help + +powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0eng\build.ps1" %_args% +exit /b %ERRORLEVEL% diff --git a/build.sh b/build.sh new file mode 100755 index 0000000000000..da2ba1a158ec1 --- /dev/null +++ b/build.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +function is_cygwin_or_mingw() +{ + case $(uname -s) in + CYGWIN*) return 0;; + MINGW*) return 0;; + *) return 1;; + esac +} + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done + +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +if is_cygwin_or_mingw; then + # if bash shell running on Windows (not WSL), + # pass control to powershell build script. + scriptroot=$(cygpath -d "$scriptroot") + powershell -c "$scriptroot\\build.cmd" $@ +else + "$scriptroot/eng/build.sh" $@ +fi diff --git a/cgmanifest.json b/cgmanifest.json new file mode 100644 index 0000000000000..18e5950c9c595 --- /dev/null +++ b/cgmanifest.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json.schemastore.org/component-detection-manifest.json", + "version": 1, + "registrations": [ + { + "component": { + "type": "git", + "git": { + "repositoryUrl": "https://github.com/llvm/llvm-project", + "commitHash": "fc9f6b0e0d8d8f876883883227da3cbd9ab2eb53" + } + }, + "developmentDependency": false + } + ] +} diff --git a/clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp b/clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp index 95a3a5165e2e8..43b69a24bdb16 100644 --- a/clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp @@ -157,9 +157,12 @@ void NonConstParameterCheck::diagnoseNonConstParameters() { if (!Function) continue; unsigned Index = Par->getFunctionScopeIndex(); - for (FunctionDecl *FnDecl : Function->redecls()) + for (FunctionDecl *FnDecl : Function->redecls()) { + if (FnDecl->getNumParams() <= Index) + continue; Fixes.push_back(FixItHint::CreateInsertion( FnDecl->getParamDecl(Index)->getBeginLoc(), "const ")); + } diag(Par->getLocation(), "pointer parameter '%0' can be pointer to const") << Par->getName() << Fixes; diff --git a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp index e2daa5010e2ae..aba4d17ccd035 100644 --- a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp +++ b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp @@ -39,12 +39,6 @@ static constexpr const char ArgName[] = "ArgName"; namespace clang::tidy::utils { -static bool operator==(const UseRangesCheck::Indexes &L, - const UseRangesCheck::Indexes &R) { - return std::tie(L.BeginArg, L.EndArg, L.ReplaceArg) == - std::tie(R.BeginArg, R.EndArg, R.ReplaceArg); -} - static std::string getFullPrefix(ArrayRef Signature) { std::string Output; llvm::raw_string_ostream OS(Output); @@ -54,15 +48,6 @@ static std::string getFullPrefix(ArrayRef Signature) { return Output; } -static llvm::hash_code hash_value(const UseRangesCheck::Indexes &Indexes) { - return llvm::hash_combine(Indexes.BeginArg, Indexes.EndArg, - Indexes.ReplaceArg); -} - -static llvm::hash_code hash_value(const UseRangesCheck::Signature &Sig) { - return llvm::hash_combine_range(Sig.begin(), Sig.end()); -} - namespace { AST_MATCHER(Expr, hasSideEffects) { @@ -123,24 +108,26 @@ makeMatcherPair(StringRef State, const UseRangesCheck::Indexes &Indexes, } void UseRangesCheck::registerMatchers(MatchFinder *Finder) { - Replaces = getReplacerMap(); + auto Replaces = getReplacerMap(); ReverseDescriptor = getReverseDescriptor(); auto BeginEndNames = getFreeBeginEndMethods(); llvm::SmallVector BeginNames{ llvm::make_first_range(BeginEndNames)}; llvm::SmallVector EndNames{ llvm::make_second_range(BeginEndNames)}; - llvm::DenseSet> Seen; + Replacers.clear(); + llvm::DenseSet SeenRepl; for (auto I = Replaces.begin(), E = Replaces.end(); I != E; ++I) { - const ArrayRef &Signatures = - I->getValue()->getReplacementSignatures(); - if (!Seen.insert(Signatures).second) + auto Replacer = I->getValue(); + if (!SeenRepl.insert(Replacer.get()).second) continue; - assert(!Signatures.empty() && - llvm::all_of(Signatures, [](auto Index) { return !Index.empty(); })); + Replacers.push_back(Replacer); + assert(!Replacer->getReplacementSignatures().empty() && + llvm::all_of(Replacer->getReplacementSignatures(), + [](auto Index) { return !Index.empty(); })); std::vector Names(1, I->getKey()); for (auto J = std::next(I); J != E; ++J) - if (J->getValue()->getReplacementSignatures() == Signatures) + if (J->getValue() == Replacer) Names.push_back(J->getKey()); std::vector TotalMatchers; @@ -148,7 +135,7 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) { // signatures in order of length(longest to shortest). This way any // signature that is a subset of another signature will be matched after the // other. - SmallVector SigVec(Signatures); + SmallVector SigVec(Replacer->getReplacementSignatures()); llvm::sort(SigVec, [](auto &L, auto &R) { return R.size() < L.size(); }); for (const auto &Signature : SigVec) { std::vector Matchers; @@ -163,7 +150,8 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) { } Finder->addMatcher( callExpr( - callee(functionDecl(hasAnyName(std::move(Names))).bind(FuncDecl)), + callee(functionDecl(hasAnyName(std::move(Names))) + .bind((FuncDecl + Twine(Replacers.size() - 1).str()))), ast_matchers::internal::DynTypedMatcher::constructVariadic( ast_matchers::internal::DynTypedMatcher::VO_AnyOf, ASTNodeKind::getFromNodeKind(), @@ -205,21 +193,33 @@ static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, } void UseRangesCheck::check(const MatchFinder::MatchResult &Result) { - const auto *Function = Result.Nodes.getNodeAs(FuncDecl); - std::string Qualified = "::" + Function->getQualifiedNameAsString(); - auto Iter = Replaces.find(Qualified); - assert(Iter != Replaces.end()); + Replacer *Replacer = nullptr; + const FunctionDecl *Function = nullptr; + for (auto [Node, Value] : Result.Nodes.getMap()) { + StringRef NodeStr(Node); + if (!NodeStr.consume_front(FuncDecl)) + continue; + Function = Value.get(); + size_t Index; + if (NodeStr.getAsInteger(10, Index)) { + llvm_unreachable("Unable to extract replacer index"); + } + assert(Index < Replacers.size()); + Replacer = Replacers[Index].get(); + break; + } + assert(Replacer && Function); SmallString<64> Buffer; - for (const Signature &Sig : Iter->getValue()->getReplacementSignatures()) { + for (const Signature &Sig : Replacer->getReplacementSignatures()) { Buffer.assign({BoundCall, getFullPrefix(Sig)}); const auto *Call = Result.Nodes.getNodeAs(Buffer); if (!Call) continue; auto Diag = createDiag(*Call); - if (auto ReplaceName = Iter->getValue()->getReplaceName(*Function)) + if (auto ReplaceName = Replacer->getReplaceName(*Function)) Diag << FixItHint::CreateReplacement(Call->getCallee()->getSourceRange(), *ReplaceName); - if (auto Include = Iter->getValue()->getHeaderInclusion(*Function)) + if (auto Include = Replacer->getHeaderInclusion(*Function)) Diag << Inserter.createIncludeInsertion( Result.SourceManager->getFileID(Call->getBeginLoc()), *Include); llvm::SmallVector ToRemove; diff --git a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.h b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.h index 927e9694b0ec7..3a454bcf0cf07 100644 --- a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.h +++ b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.h @@ -85,7 +85,7 @@ class UseRangesCheck : public ClangTidyCheck { std::optional getCheckTraversalKind() const override; private: - ReplacerMap Replaces; + std::vector> Replacers; std::optional ReverseDescriptor; IncludeInserter Inserter; }; diff --git a/clang-tools-extra/clangd/TidyFastChecks.inc b/clang-tools-extra/clangd/TidyFastChecks.inc index 9050ce16127ff..de1a025602fa9 100644 --- a/clang-tools-extra/clangd/TidyFastChecks.inc +++ b/clang-tools-extra/clangd/TidyFastChecks.inc @@ -7,370 +7,435 @@ #define SLOW(CHECK, DELTA) #endif -FAST(abseil-cleanup-ctad, -1.0) +FAST(abseil-cleanup-ctad, -2.0) FAST(abseil-duration-addition, 0.0) -FAST(abseil-duration-comparison, 1.0) -FAST(abseil-duration-conversion-cast, 3.0) -FAST(abseil-duration-division, -0.0) -FAST(abseil-duration-factory-float, 1.0) -FAST(abseil-duration-factory-scale, -0.0) -FAST(abseil-duration-subtraction, 1.0) -FAST(abseil-duration-unnecessary-conversion, 4.0) -FAST(abseil-faster-strsplit-delimiter, 2.0) -FAST(abseil-no-internal-dependencies, -1.0) -FAST(abseil-no-namespace, -1.0) -FAST(abseil-redundant-strcat-calls, 2.0) -FAST(abseil-str-cat-append, 1.0) -FAST(abseil-string-find-startswith, 1.0) -FAST(abseil-string-find-str-contains, 1.0) -FAST(abseil-time-comparison, -0.0) -FAST(abseil-time-subtraction, 0.0) +FAST(abseil-duration-comparison, -1.0) +FAST(abseil-duration-conversion-cast, -1.0) +FAST(abseil-duration-division, 0.0) +FAST(abseil-duration-factory-float, 2.0) +FAST(abseil-duration-factory-scale, 1.0) +FAST(abseil-duration-subtraction, -1.0) +FAST(abseil-duration-unnecessary-conversion, -0.0) +FAST(abseil-faster-strsplit-delimiter, 3.0) +FAST(abseil-no-internal-dependencies, 1.0) +FAST(abseil-no-namespace, -0.0) +FAST(abseil-redundant-strcat-calls, 1.0) +FAST(abseil-str-cat-append, -0.0) +FAST(abseil-string-find-startswith, -1.0) +FAST(abseil-string-find-str-contains, 4.0) +FAST(abseil-time-comparison, -1.0) +FAST(abseil-time-subtraction, 1.0) FAST(abseil-upgrade-duration-conversions, 2.0) SLOW(altera-id-dependent-backward-branch, 13.0) -FAST(altera-kernel-name-restriction, -1.0) -FAST(altera-single-work-item-barrier, -1.0) -FAST(altera-struct-pack-align, -1.0) +FAST(altera-kernel-name-restriction, 4.0) +FAST(altera-single-work-item-barrier, 1.0) +FAST(altera-struct-pack-align, -0.0) FAST(altera-unroll-loops, 2.0) -FAST(android-cloexec-accept, -1.0) -FAST(android-cloexec-accept4, 3.0) -FAST(android-cloexec-creat, 0.0) -FAST(android-cloexec-dup, 3.0) -FAST(android-cloexec-epoll-create, -2.0) -FAST(android-cloexec-epoll-create1, -1.0) -FAST(android-cloexec-fopen, -0.0) -FAST(android-cloexec-inotify-init, 1.0) -FAST(android-cloexec-inotify-init1, 2.0) -FAST(android-cloexec-memfd-create, 2.0) -FAST(android-cloexec-open, -1.0) -FAST(android-cloexec-pipe, -1.0) +FAST(android-cloexec-accept, 0.0) +FAST(android-cloexec-accept4, 1.0) +FAST(android-cloexec-creat, 1.0) +FAST(android-cloexec-dup, 0.0) +FAST(android-cloexec-epoll-create, 2.0) +FAST(android-cloexec-epoll-create1, 0.0) +FAST(android-cloexec-fopen, -1.0) +FAST(android-cloexec-inotify-init, 2.0) +FAST(android-cloexec-inotify-init1, -0.0) +FAST(android-cloexec-memfd-create, -1.0) +FAST(android-cloexec-open, 1.0) +FAST(android-cloexec-pipe, -0.0) FAST(android-cloexec-pipe2, 0.0) FAST(android-cloexec-socket, 1.0) -FAST(android-comparison-in-temp-failure-retry, 0.0) -FAST(boost-use-to-string, 1.0) -FAST(bugprone-argument-comment, 2.0) +FAST(android-comparison-in-temp-failure-retry, 1.0) +FAST(boost-use-ranges, 2.0) +FAST(boost-use-to-string, 2.0) +FAST(bugprone-argument-comment, 4.0) FAST(bugprone-assert-side-effect, 1.0) -FAST(bugprone-assignment-in-if-condition, -0.0) -FAST(bugprone-bad-signal-to-kill-thread, -1.0) +FAST(bugprone-assignment-in-if-condition, 2.0) +FAST(bugprone-bad-signal-to-kill-thread, 1.0) FAST(bugprone-bool-pointer-implicit-conversion, 0.0) -FAST(bugprone-branch-clone, -0.0) +FAST(bugprone-branch-clone, 1.0) +FAST(bugprone-casting-through-void, 1.0) +FAST(bugprone-chained-comparison, 1.0) +FAST(bugprone-compare-pointer-to-member-virtual-function, -0.0) FAST(bugprone-copy-constructor-init, 1.0) -FAST(bugprone-dangling-handle, 0.0) -FAST(bugprone-dynamic-static-initializers, 1.0) +FAST(bugprone-crtp-constructor-accessibility, 0.0) +FAST(bugprone-dangling-handle, -0.0) +FAST(bugprone-dynamic-static-initializers, 0.0) FAST(bugprone-easily-swappable-parameters, 2.0) -FAST(bugprone-exception-escape, 1.0) -FAST(bugprone-fold-init-type, 2.0) +FAST(bugprone-empty-catch, 1.0) +FAST(bugprone-exception-escape, 0.0) +FAST(bugprone-fold-init-type, 1.0) FAST(bugprone-forward-declaration-namespace, 0.0) -FAST(bugprone-forwarding-reference-overload, -0.0) -FAST(bugprone-implicit-widening-of-multiplication-result, 3.0) +FAST(bugprone-forwarding-reference-overload, -1.0) +FAST(bugprone-implicit-widening-of-multiplication-result, 2.0) FAST(bugprone-inaccurate-erase, -0.0) +FAST(bugprone-inc-dec-in-conditions, 3.0) +FAST(bugprone-incorrect-enable-if, -1.0) FAST(bugprone-incorrect-roundings, 1.0) -FAST(bugprone-infinite-loop, 4.0) -FAST(bugprone-integer-division, -3.0) -FAST(bugprone-lambda-function-name, 1.0) -FAST(bugprone-macro-parentheses, 8.0) +FAST(bugprone-infinite-loop, 1.0) +FAST(bugprone-integer-division, -0.0) +FAST(bugprone-lambda-function-name, 0.0) +FAST(bugprone-macro-parentheses, 1.0) FAST(bugprone-macro-repeated-side-effects, 1.0) -FAST(bugprone-misplaced-operator-in-strlen-in-alloc, -0.0) -FAST(bugprone-misplaced-pointer-arithmetic-in-alloc, 2.0) -FAST(bugprone-misplaced-widening-cast, -2.0) -FAST(bugprone-move-forwarding-reference, -2.0) -FAST(bugprone-multiple-statement-macro, 1.0) -FAST(bugprone-narrowing-conversions, -1.0) -FAST(bugprone-no-escape, 3.0) -FAST(bugprone-not-null-terminated-result, 4.0) -FAST(bugprone-parent-virtual-call, 2.0) -FAST(bugprone-posix-return, 0.0) -FAST(bugprone-redundant-branch-condition, 0.0) -FAST(bugprone-reserved-identifier, 2.0) +FAST(bugprone-misplaced-operator-in-strlen-in-alloc, 0.0) +FAST(bugprone-misplaced-pointer-arithmetic-in-alloc, -0.0) +FAST(bugprone-misplaced-widening-cast, -1.0) +FAST(bugprone-move-forwarding-reference, -1.0) +FAST(bugprone-multi-level-implicit-pointer-conversion, -1.0) +FAST(bugprone-multiple-new-in-one-expression, 0.0) +FAST(bugprone-multiple-statement-macro, 2.0) +FAST(bugprone-narrowing-conversions, 2.0) +FAST(bugprone-no-escape, 1.0) +FAST(bugprone-non-zero-enum-to-bool-conversion, 0.0) +FAST(bugprone-not-null-terminated-result, 0.0) +FAST(bugprone-optional-value-conversion, 1.0) +FAST(bugprone-parent-virtual-call, 1.0) +FAST(bugprone-pointer-arithmetic-on-polymorphic-object, 0.0) +FAST(bugprone-posix-return, -0.0) +FAST(bugprone-redundant-branch-condition, -0.0) +FAST(bugprone-reserved-identifier, -1.0) +FAST(bugprone-return-const-ref-from-parameter, -2.0) FAST(bugprone-shared-ptr-array-mismatch, 0.0) -FAST(bugprone-signal-handler, -0.0) -FAST(bugprone-signed-char-misuse, 1.0) -FAST(bugprone-sizeof-container, -0.0) -FAST(bugprone-sizeof-expression, 0.0) -FAST(bugprone-spuriously-wake-up-functions, 3.0) -FAST(bugprone-string-constructor, 1.0) -FAST(bugprone-string-integer-assignment, 1.0) -FAST(bugprone-string-literal-with-embedded-nul, 0.0) -FAST(bugprone-stringview-nullptr, 2.0) -FAST(bugprone-suspicious-enum-usage, -0.0) -FAST(bugprone-suspicious-include, 1.0) +FAST(bugprone-signal-handler, -1.0) +FAST(bugprone-signed-char-misuse, -2.0) +FAST(bugprone-sizeof-container, -1.0) +FAST(bugprone-sizeof-expression, 1.0) +FAST(bugprone-spuriously-wake-up-functions, 1.0) +FAST(bugprone-standalone-empty, 7.0) +FAST(bugprone-string-constructor, 3.0) +FAST(bugprone-string-integer-assignment, -0.0) +FAST(bugprone-string-literal-with-embedded-nul, 1.0) +FAST(bugprone-stringview-nullptr, 4.0) +FAST(bugprone-suspicious-enum-usage, 2.0) +FAST(bugprone-suspicious-include, 0.0) FAST(bugprone-suspicious-memory-comparison, 0.0) -FAST(bugprone-suspicious-memset-usage, 2.0) -FAST(bugprone-suspicious-missing-comma, 0.0) -FAST(bugprone-suspicious-realloc-usage, 1.0) -FAST(bugprone-suspicious-semicolon, 0.0) -FAST(bugprone-suspicious-string-compare, 2.0) -FAST(bugprone-swapped-arguments, 0.0) -FAST(bugprone-terminating-continue, 2.0) -FAST(bugprone-throw-keyword-missing, -1.0) +FAST(bugprone-suspicious-memset-usage, 0.0) +FAST(bugprone-suspicious-missing-comma, -2.0) +FAST(bugprone-suspicious-realloc-usage, -0.0) +FAST(bugprone-suspicious-semicolon, 6.0) +FAST(bugprone-suspicious-string-compare, 1.0) +FAST(bugprone-suspicious-stringview-data-usage, 1.0) +FAST(bugprone-swapped-arguments, 1.0) +FAST(bugprone-switch-missing-default-case, 2.0) +FAST(bugprone-terminating-continue, -1.0) +FAST(bugprone-throw-keyword-missing, 0.0) FAST(bugprone-too-small-loop-variable, 0.0) -FAST(bugprone-unchecked-optional-access, 1.0) +FAST(bugprone-unchecked-optional-access, 2.0) FAST(bugprone-undefined-memory-manipulation, 1.0) -FAST(bugprone-undelegated-constructor, 0.0) -FAST(bugprone-unhandled-exception-at-new, 0.0) +FAST(bugprone-undelegated-constructor, 1.0) +FAST(bugprone-unhandled-exception-at-new, -1.0) FAST(bugprone-unhandled-self-assignment, 0.0) -FAST(bugprone-unused-raii, 2.0) -FAST(bugprone-unused-return-value, 0.0) -FAST(bugprone-use-after-move, 5.0) +FAST(bugprone-unique-ptr-array-mismatch, 0.0) +FAST(bugprone-unsafe-functions, 1.0) +FAST(bugprone-unused-local-non-trivial-variable, -1.0) +FAST(bugprone-unused-raii, 1.0) +FAST(bugprone-unused-return-value, 4.0) +FAST(bugprone-use-after-move, 4.0) FAST(bugprone-virtual-near-miss, 0.0) -FAST(cert-con36-c, 2.0) -FAST(cert-con54-cpp, 3.0) -FAST(cert-dcl03-c, 2.0) -FAST(cert-dcl16-c, -1.0) -FAST(cert-dcl37-c, 3.0) +FAST(cert-con36-c, 1.0) +FAST(cert-con54-cpp, 2.0) +FAST(cert-ctr56-cpp, 0.0) +FAST(cert-dcl03-c, 0.0) +FAST(cert-dcl16-c, 1.0) +FAST(cert-dcl37-c, 1.0) FAST(cert-dcl50-cpp, -1.0) -FAST(cert-dcl51-cpp, 1.0) +FAST(cert-dcl51-cpp, -1.0) FAST(cert-dcl54-cpp, 0.0) -FAST(cert-dcl58-cpp, 1.0) -FAST(cert-dcl59-cpp, 0.0) -FAST(cert-env33-c, -1.0) -FAST(cert-err09-cpp, 1.0) +FAST(cert-dcl58-cpp, -0.0) +FAST(cert-dcl59-cpp, 1.0) +FAST(cert-env33-c, 1.0) +FAST(cert-err09-cpp, -0.0) FAST(cert-err33-c, 4.0) -FAST(cert-err34-c, 0.0) -FAST(cert-err52-cpp, 1.0) -FAST(cert-err58-cpp, 0.0) -FAST(cert-err60-cpp, 0.0) -FAST(cert-err61-cpp, -0.0) -FAST(cert-exp42-c, 0.0) +FAST(cert-err34-c, -1.0) +FAST(cert-err52-cpp, -1.0) +FAST(cert-err58-cpp, -0.0) +FAST(cert-err60-cpp, -0.0) +FAST(cert-err61-cpp, 2.0) +FAST(cert-exp42-c, 1.0) FAST(cert-fio38-c, 1.0) -FAST(cert-flp30-c, 0.0) +FAST(cert-flp30-c, 3.0) FAST(cert-flp37-c, 1.0) +FAST(cert-int09-c, -1.0) FAST(cert-mem57-cpp, 0.0) -FAST(cert-msc30-c, -0.0) -FAST(cert-msc32-c, 1.0) -FAST(cert-msc50-cpp, -1.0) -FAST(cert-msc51-cpp, 1.0) -FAST(cert-msc54-cpp, -1.0) -FAST(cert-oop11-cpp, 1.0) -FAST(cert-oop54-cpp, -0.0) -FAST(cert-oop57-cpp, 1.0) +FAST(cert-msc24-c, 0.0) +FAST(cert-msc30-c, 0.0) +FAST(cert-msc32-c, -0.0) +FAST(cert-msc33-c, 2.0) +FAST(cert-msc50-cpp, -0.0) +FAST(cert-msc51-cpp, 2.0) +FAST(cert-msc54-cpp, -0.0) +FAST(cert-oop11-cpp, -0.0) +FAST(cert-oop54-cpp, 2.0) +FAST(cert-oop57-cpp, -0.0) FAST(cert-oop58-cpp, 0.0) -FAST(cert-pos44-c, 0.0) -FAST(cert-pos47-c, -0.0) -FAST(cert-sig30-c, 2.0) -FAST(cert-str34-c, 0.0) +FAST(cert-pos44-c, 2.0) +FAST(cert-pos47-c, 0.0) +FAST(cert-sig30-c, 1.0) +FAST(cert-str34-c, 2.0) FAST(concurrency-mt-unsafe, 3.0) FAST(concurrency-thread-canceltype-asynchronous, 1.0) -FAST(cppcoreguidelines-avoid-c-arrays, 2.0) -FAST(cppcoreguidelines-avoid-const-or-ref-data-members, 1.0) -FAST(cppcoreguidelines-avoid-do-while, -2.0) -FAST(cppcoreguidelines-avoid-goto, 2.0) -FAST(cppcoreguidelines-avoid-magic-numbers, 1.0) +FAST(cppcoreguidelines-avoid-c-arrays, 0.0) +FAST(cppcoreguidelines-avoid-capturing-lambda-coroutines, -1.0) +FAST(cppcoreguidelines-avoid-const-or-ref-data-members, -2.0) +FAST(cppcoreguidelines-avoid-do-while, -1.0) +FAST(cppcoreguidelines-avoid-goto, -1.0) +FAST(cppcoreguidelines-avoid-magic-numbers, -2.0) FAST(cppcoreguidelines-avoid-non-const-global-variables, -0.0) +FAST(cppcoreguidelines-avoid-reference-coroutine-parameters, -0.0) FAST(cppcoreguidelines-c-copy-assignment-signature, 1.0) -FAST(cppcoreguidelines-explicit-virtual-functions, -1.0) -FAST(cppcoreguidelines-init-variables, 2.0) -FAST(cppcoreguidelines-interfaces-global-init, -1.0) -FAST(cppcoreguidelines-macro-usage, 2.0) -FAST(cppcoreguidelines-narrowing-conversions, -2.0) +FAST(cppcoreguidelines-explicit-virtual-functions, 0.0) +FAST(cppcoreguidelines-init-variables, 1.0) +FAST(cppcoreguidelines-interfaces-global-init, 1.0) +FAST(cppcoreguidelines-macro-to-enum, 0.0) +FAST(cppcoreguidelines-macro-usage, -0.0) +FAST(cppcoreguidelines-misleading-capture-default-by-value, -1.0) +FAST(cppcoreguidelines-missing-std-forward, 0.0) +FAST(cppcoreguidelines-narrowing-conversions, 2.0) FAST(cppcoreguidelines-no-malloc, -1.0) -FAST(cppcoreguidelines-non-private-member-variables-in-classes, -0.0) +FAST(cppcoreguidelines-no-suspend-with-lock, 1.0) +FAST(cppcoreguidelines-noexcept-destructor, -0.0) +FAST(cppcoreguidelines-noexcept-move-operations, 2.0) +FAST(cppcoreguidelines-noexcept-swap, -2.0) +FAST(cppcoreguidelines-non-private-member-variables-in-classes, 1.0) FAST(cppcoreguidelines-owning-memory, 3.0) -FAST(cppcoreguidelines-prefer-member-initializer, 1.0) -FAST(cppcoreguidelines-pro-bounds-array-to-pointer-decay, 3.0) -FAST(cppcoreguidelines-pro-bounds-constant-array-index, 3.0) +FAST(cppcoreguidelines-prefer-member-initializer, 2.0) +FAST(cppcoreguidelines-pro-bounds-array-to-pointer-decay, 2.0) +FAST(cppcoreguidelines-pro-bounds-constant-array-index, 1.0) FAST(cppcoreguidelines-pro-bounds-pointer-arithmetic, 0.0) -FAST(cppcoreguidelines-pro-type-const-cast, 1.0) -FAST(cppcoreguidelines-pro-type-cstyle-cast, -1.0) +FAST(cppcoreguidelines-pro-type-const-cast, -1.0) +FAST(cppcoreguidelines-pro-type-cstyle-cast, 2.0) FAST(cppcoreguidelines-pro-type-member-init, 1.0) -FAST(cppcoreguidelines-pro-type-reinterpret-cast, 2.0) +FAST(cppcoreguidelines-pro-type-reinterpret-cast, -1.0) FAST(cppcoreguidelines-pro-type-static-cast-downcast, 0.0) -FAST(cppcoreguidelines-pro-type-union-access, 1.0) -FAST(cppcoreguidelines-pro-type-vararg, 1.0) -FAST(cppcoreguidelines-slicing, 3.0) +FAST(cppcoreguidelines-pro-type-union-access, 0.0) +FAST(cppcoreguidelines-pro-type-vararg, -1.0) +FAST(cppcoreguidelines-rvalue-reference-param-not-moved, 1.0) +FAST(cppcoreguidelines-slicing, 1.0) FAST(cppcoreguidelines-special-member-functions, -1.0) -FAST(cppcoreguidelines-virtual-class-destructor, 0.0) -FAST(darwin-avoid-spinlock, 1.0) -FAST(darwin-dispatch-once-nonstatic, -0.0) -FAST(fuchsia-default-arguments-calls, 2.0) +FAST(cppcoreguidelines-use-default-member-init, 0.0) +FAST(cppcoreguidelines-virtual-class-destructor, -0.0) +FAST(darwin-avoid-spinlock, 2.0) +FAST(darwin-dispatch-once-nonstatic, 0.0) +FAST(fuchsia-default-arguments-calls, 1.0) FAST(fuchsia-default-arguments-declarations, -0.0) FAST(fuchsia-header-anon-namespaces, -0.0) -FAST(fuchsia-multiple-inheritance, -1.0) -FAST(fuchsia-overloaded-operator, -0.0) +FAST(fuchsia-multiple-inheritance, 0.0) +FAST(fuchsia-overloaded-operator, 4.0) FAST(fuchsia-statically-constructed-objects, -0.0) -FAST(fuchsia-trailing-return, 2.0) +FAST(fuchsia-trailing-return, 1.0) FAST(fuchsia-virtual-inheritance, 1.0) -FAST(google-build-explicit-make-pair, 2.0) +FAST(google-build-explicit-make-pair, 3.0) FAST(google-build-namespaces, -1.0) -FAST(google-build-using-namespace, 0.0) -FAST(google-default-arguments, 1.0) +FAST(google-build-using-namespace, -0.0) +FAST(google-default-arguments, 0.0) FAST(google-explicit-constructor, 2.0) -FAST(google-global-names-in-headers, -1.0) +FAST(google-global-names-in-headers, 0.0) FAST(google-objc-avoid-nsobject-new, 1.0) -FAST(google-objc-avoid-throwing-exception, 1.0) -FAST(google-objc-function-naming, 1.0) -FAST(google-objc-global-variable-declaration, -0.0) -FAST(google-readability-avoid-underscore-in-googletest-name, -0.0) -FAST(google-readability-braces-around-statements, 1.0) -FAST(google-readability-casting, 1.0) -FAST(google-readability-function-size, 0.0) -FAST(google-readability-namespace-comments, 0.0) +FAST(google-objc-avoid-throwing-exception, -0.0) +FAST(google-objc-function-naming, -1.0) +FAST(google-objc-global-variable-declaration, 0.0) +FAST(google-readability-avoid-underscore-in-googletest-name, 1.0) +FAST(google-readability-braces-around-statements, 0.0) +FAST(google-readability-casting, -0.0) +FAST(google-readability-function-size, 3.0) +FAST(google-readability-namespace-comments, -0.0) FAST(google-readability-todo, 1.0) -FAST(google-runtime-int, -1.0) -FAST(google-runtime-operator, -0.0) -FAST(google-upgrade-googletest-case, 0.0) +FAST(google-runtime-int, 0.0) +FAST(google-runtime-operator, 0.0) +FAST(google-upgrade-googletest-case, 1.0) FAST(hicpp-avoid-c-arrays, 1.0) -FAST(hicpp-avoid-goto, 0.0) -FAST(hicpp-braces-around-statements, 1.0) -FAST(hicpp-deprecated-headers, -1.0) -FAST(hicpp-exception-baseclass, 0.0) -FAST(hicpp-explicit-conversions, -1.0) +FAST(hicpp-avoid-goto, -0.0) +FAST(hicpp-braces-around-statements, 0.0) +FAST(hicpp-deprecated-headers, 1.0) +FAST(hicpp-exception-baseclass, -1.0) +FAST(hicpp-explicit-conversions, 1.0) FAST(hicpp-function-size, 1.0) -FAST(hicpp-invalid-access-moved, 6.0) +FAST(hicpp-ignored-remove-result, 3.0) +FAST(hicpp-invalid-access-moved, 4.0) FAST(hicpp-member-init, 2.0) -FAST(hicpp-move-const-arg, 1.0) -FAST(hicpp-multiway-paths-covered, 3.0) -FAST(hicpp-named-parameter, 1.0) -FAST(hicpp-new-delete-operators, 0.0) -FAST(hicpp-no-array-decay, 3.0) -FAST(hicpp-no-assembler, -0.0) -FAST(hicpp-no-malloc, 1.0) +FAST(hicpp-move-const-arg, 3.0) +FAST(hicpp-multiway-paths-covered, 0.0) +FAST(hicpp-named-parameter, 2.0) +FAST(hicpp-new-delete-operators, -0.0) +FAST(hicpp-no-array-decay, 4.0) +FAST(hicpp-no-assembler, 1.0) +FAST(hicpp-no-malloc, 2.0) FAST(hicpp-noexcept-move, -0.0) -FAST(hicpp-signed-bitwise, 0.0) -FAST(hicpp-special-member-functions, 0.0) -FAST(hicpp-static-assert, 1.0) -FAST(hicpp-undelegated-constructor, 3.0) -FAST(hicpp-uppercase-literal-suffix, 3.0) -FAST(hicpp-use-auto, 3.0) -FAST(hicpp-use-emplace, 1.0) -FAST(hicpp-use-equals-default, 1.0) -FAST(hicpp-use-equals-delete, 0.0) -FAST(hicpp-use-noexcept, -1.0) -FAST(hicpp-use-nullptr, 2.0) -FAST(hicpp-use-override, -0.0) -FAST(hicpp-vararg, -2.0) -FAST(linuxkernel-must-check-errs, 1.0) -FAST(llvm-else-after-return, 0.0) -FAST(llvm-header-guard, 2.0) -FAST(llvm-include-order, 3.0) -FAST(llvm-namespace-comment, 1.0) -FAST(llvm-prefer-isa-or-dyn-cast-in-conditionals, 0.0) -FAST(llvm-prefer-register-over-unsigned, 1.0) -FAST(llvm-qualified-auto, 0.0) -FAST(llvm-twine-local, -2.0) -FAST(llvmlibc-callee-namespace, 2.0) -FAST(llvmlibc-implementation-in-namespace, 2.0) -FAST(llvmlibc-restrict-system-libc-headers, -0.0) -FAST(misc-confusable-identifiers, 1.0) -SLOW(misc-const-correctness, 261.0) +FAST(hicpp-signed-bitwise, -1.0) +FAST(hicpp-special-member-functions, -2.0) +FAST(hicpp-static-assert, 4.0) +FAST(hicpp-undelegated-constructor, 6.0) +FAST(hicpp-uppercase-literal-suffix, 5.0) +FAST(hicpp-use-auto, 0.0) +FAST(hicpp-use-emplace, 3.0) +FAST(hicpp-use-equals-default, 2.0) +FAST(hicpp-use-equals-delete, 1.0) +FAST(hicpp-use-noexcept, -0.0) +FAST(hicpp-use-nullptr, 1.0) +FAST(hicpp-use-override, -1.0) +FAST(hicpp-vararg, 0.0) +FAST(linuxkernel-must-check-errs, -0.0) +FAST(llvm-else-after-return, -1.0) +FAST(llvm-header-guard, 3.0) +FAST(llvm-include-order, 0.0) +FAST(llvm-namespace-comment, 0.0) +FAST(llvm-prefer-isa-or-dyn-cast-in-conditionals, 3.0) +FAST(llvm-prefer-register-over-unsigned, -0.0) +FAST(llvm-qualified-auto, 4.0) +FAST(llvm-twine-local, -0.0) +FAST(llvmlibc-callee-namespace, -0.0) +FAST(llvmlibc-implementation-in-namespace, 1.0) +FAST(llvmlibc-inline-function-decl, 3.0) +FAST(llvmlibc-restrict-system-libc-headers, 0.0) +FAST(misc-confusable-identifiers, -1.0) +SLOW(misc-const-correctness, 67.0) +FAST(misc-coroutine-hostile-raii, 1.0) FAST(misc-definitions-in-headers, -1.0) -FAST(misc-misleading-bidirectional, -0.0) -FAST(misc-misleading-identifier, -1.0) -FAST(misc-misplaced-const, 1.0) -FAST(misc-new-delete-overloads, -1.0) -FAST(misc-no-recursion, -2.0) -FAST(misc-non-copyable-objects, 1.0) -FAST(misc-non-private-member-variables-in-classes, 2.0) -FAST(misc-redundant-expression, 0.0) -FAST(misc-static-assert, 1.0) -FAST(misc-throw-by-value-catch-by-reference, -1.0) +SLOW(misc-header-include-cycle, 10.0) +FAST(misc-include-cleaner, 5.0) +FAST(misc-misleading-bidirectional, 1.0) +FAST(misc-misleading-identifier, 3.0) +FAST(misc-misplaced-const, -2.0) +FAST(misc-new-delete-overloads, 1.0) +FAST(misc-no-recursion, 0.0) +FAST(misc-non-copyable-objects, 0.0) +FAST(misc-non-private-member-variables-in-classes, -1.0) +FAST(misc-redundant-expression, 1.0) +FAST(misc-static-assert, 3.0) +FAST(misc-throw-by-value-catch-by-reference, -0.0) FAST(misc-unconventional-assign-operator, 1.0) -FAST(misc-uniqueptr-reset-release, 0.0) -FAST(misc-unused-alias-decls, 1.0) -FAST(misc-unused-parameters, 0.0) -FAST(misc-unused-using-decls, 4.0) +FAST(misc-uniqueptr-reset-release, 2.0) +FAST(misc-unused-alias-decls, 2.0) +FAST(misc-unused-parameters, 3.0) +FAST(misc-unused-using-decls, 1.0) +FAST(misc-use-anonymous-namespace, 1.0) +FAST(misc-use-internal-linkage, 1.0) FAST(modernize-avoid-bind, 1.0) FAST(modernize-avoid-c-arrays, 2.0) -FAST(modernize-concat-nested-namespaces, -1.0) -FAST(modernize-deprecated-headers, -0.0) -FAST(modernize-deprecated-ios-base-aliases, 1.0) +FAST(modernize-concat-nested-namespaces, -0.0) +FAST(modernize-deprecated-headers, 0.0) +FAST(modernize-deprecated-ios-base-aliases, 0.0) FAST(modernize-loop-convert, 2.0) -FAST(modernize-macro-to-enum, 1.0) -FAST(modernize-make-shared, -0.0) -FAST(modernize-make-unique, 0.0) -FAST(modernize-pass-by-value, 1.0) -FAST(modernize-raw-string-literal, 1.0) -FAST(modernize-redundant-void-arg, -1.0) -FAST(modernize-replace-auto-ptr, -1.0) -FAST(modernize-replace-disallow-copy-and-assign-macro, -2.0) -FAST(modernize-replace-random-shuffle, 0.0) -FAST(modernize-return-braced-init-list, -1.0) -FAST(modernize-shrink-to-fit, 2.0) -FAST(modernize-unary-static-assert, -1.0) -FAST(modernize-use-auto, 2.0) +FAST(modernize-macro-to-enum, 0.0) +FAST(modernize-make-shared, 2.0) +FAST(modernize-make-unique, 1.0) +FAST(modernize-min-max-use-initializer-list, 1.0) +FAST(modernize-pass-by-value, 0.0) +FAST(modernize-raw-string-literal, 2.0) +FAST(modernize-redundant-void-arg, 1.0) +FAST(modernize-replace-auto-ptr, 0.0) +FAST(modernize-replace-disallow-copy-and-assign-macro, -0.0) +FAST(modernize-replace-random-shuffle, 1.0) +FAST(modernize-return-braced-init-list, 1.0) +FAST(modernize-shrink-to-fit, 1.0) +FAST(modernize-type-traits, 1.0) +FAST(modernize-unary-static-assert, 1.0) +FAST(modernize-use-auto, 0.0) FAST(modernize-use-bool-literals, 1.0) -FAST(modernize-use-default-member-init, 2.0) -FAST(modernize-use-emplace, 1.0) -FAST(modernize-use-equals-default, 2.0) -FAST(modernize-use-equals-delete, 0.0) -FAST(modernize-use-nodiscard, 1.0) -FAST(modernize-use-noexcept, 1.0) -FAST(modernize-use-nullptr, 2.0) -FAST(modernize-use-override, 1.0) -FAST(modernize-use-trailing-return-type, -0.0) -FAST(modernize-use-transparent-functors, -1.0) -FAST(modernize-use-uncaught-exceptions, 1.0) +FAST(modernize-use-constraints, 1.0) +FAST(modernize-use-default-member-init, -0.0) +FAST(modernize-use-designated-initializers, 1.0) +FAST(modernize-use-emplace, 2.0) +FAST(modernize-use-equals-default, 1.0) +FAST(modernize-use-equals-delete, 2.0) +FAST(modernize-use-nodiscard, -2.0) +FAST(modernize-use-noexcept, -2.0) +FAST(modernize-use-nullptr, 1.0) +FAST(modernize-use-override, 0.0) +FAST(modernize-use-ranges, 0.0) +FAST(modernize-use-starts-ends-with, 0.0) +FAST(modernize-use-std-format, -1.0) +FAST(modernize-use-std-numbers, 0.0) +FAST(modernize-use-std-print, -0.0) +FAST(modernize-use-trailing-return-type, 3.0) +FAST(modernize-use-transparent-functors, 0.0) +FAST(modernize-use-uncaught-exceptions, 0.0) FAST(modernize-use-using, 1.0) -FAST(objc-assert-equals, -1.0) -FAST(objc-avoid-nserror-init, -2.0) -FAST(objc-dealloc-in-category, -0.0) -FAST(objc-forbidden-subclassing, 0.0) -FAST(objc-missing-hash, 1.0) -FAST(objc-nsdate-formatter, 1.0) -FAST(objc-nsinvocation-argument-lifetime, -2.0) -FAST(objc-property-declaration, -1.0) -FAST(objc-super-self, -0.0) -FAST(openmp-exception-escape, 1.0) -FAST(openmp-use-default-none, 1.0) -FAST(performance-faster-string-find, 2.0) -FAST(performance-for-range-copy, 2.0) -FAST(performance-implicit-conversion-in-loop, 1.0) -FAST(performance-inefficient-algorithm, 0.0) -FAST(performance-inefficient-string-concatenation, -0.0) -FAST(performance-inefficient-vector-operation, 1.0) -FAST(performance-move-const-arg, 3.0) -FAST(performance-move-constructor-init, 1.0) -FAST(performance-no-automatic-move, -1.0) -FAST(performance-no-int-to-ptr, 2.0) +FAST(objc-assert-equals, 1.0) +FAST(objc-avoid-nserror-init, -0.0) +FAST(objc-dealloc-in-category, 0.0) +FAST(objc-forbidden-subclassing, 2.0) +FAST(objc-missing-hash, -0.0) +FAST(objc-nsdate-formatter, 0.0) +FAST(objc-nsinvocation-argument-lifetime, 0.0) +FAST(objc-property-declaration, -0.0) +FAST(objc-super-self, -2.0) +FAST(openmp-exception-escape, -1.0) +FAST(openmp-use-default-none, 2.0) +FAST(performance-avoid-endl, 2.0) +FAST(performance-enum-size, -1.0) +FAST(performance-faster-string-find, 1.0) +FAST(performance-for-range-copy, 1.0) +FAST(performance-implicit-conversion-in-loop, 0.0) +FAST(performance-inefficient-algorithm, 1.0) +FAST(performance-inefficient-string-concatenation, 1.0) +FAST(performance-inefficient-vector-operation, -0.0) +FAST(performance-move-const-arg, 2.0) +FAST(performance-move-constructor-init, 2.0) +FAST(performance-no-automatic-move, 2.0) +FAST(performance-no-int-to-ptr, 0.0) +FAST(performance-noexcept-destructor, -2.0) FAST(performance-noexcept-move-constructor, 1.0) -FAST(performance-trivially-destructible, -1.0) -FAST(performance-type-promotion-in-math-fn, 4.0) -FAST(performance-unnecessary-copy-initialization, 4.0) +FAST(performance-noexcept-swap, -2.0) +FAST(performance-trivially-destructible, 3.0) +FAST(performance-type-promotion-in-math-fn, 2.0) +FAST(performance-unnecessary-copy-initialization, 2.0) FAST(performance-unnecessary-value-param, 2.0) -FAST(portability-restrict-system-includes, 2.0) -FAST(portability-simd-intrinsics, 2.0) -FAST(portability-std-allocator-const, 2.0) +FAST(portability-restrict-system-includes, 1.0) +FAST(portability-simd-intrinsics, 1.0) +FAST(portability-std-allocator-const, 3.0) FAST(readability-avoid-const-params-in-decls, -0.0) -FAST(readability-braces-around-statements, 2.0) -FAST(readability-const-return-type, -0.0) -FAST(readability-container-contains, -0.0) -FAST(readability-container-data-pointer, 0.0) -SLOW(readability-container-size-empty, 16.0) -FAST(readability-convert-member-functions-to-static, 0.0) -FAST(readability-delete-null-pointer, 0.0) -FAST(readability-duplicate-include, -0.0) -FAST(readability-else-after-return, 1.0) +FAST(readability-avoid-nested-conditional-operator, -1.0) +FAST(readability-avoid-return-with-void-value, 0.0) +FAST(readability-avoid-unconditional-preprocessor-if, -1.0) +FAST(readability-braces-around-statements, 1.0) +FAST(readability-const-return-type, -1.0) +FAST(readability-container-contains, 3.0) +FAST(readability-container-data-pointer, -1.0) +SLOW(readability-container-size-empty, 13.0) +FAST(readability-convert-member-functions-to-static, 4.0) +FAST(readability-delete-null-pointer, -1.0) +FAST(readability-duplicate-include, 2.0) +FAST(readability-else-after-return, 0.0) +FAST(readability-enum-initial-value, 0.0) FAST(readability-function-cognitive-complexity, 0.0) -FAST(readability-function-size, 3.0) -FAST(readability-identifier-length, -1.0) -FAST(readability-identifier-naming, 5.0) -FAST(readability-implicit-bool-conversion, 2.0) -FAST(readability-inconsistent-declaration-parameter-name, 1.0) -FAST(readability-isolate-declaration, 1.0) -FAST(readability-magic-numbers, -1.0) -FAST(readability-make-member-function-const, 2.0) -FAST(readability-misleading-indentation, 0.0) -FAST(readability-misplaced-array-index, -0.0) +FAST(readability-function-size, 0.0) +FAST(readability-identifier-length, 2.0) +FAST(readability-identifier-naming, 1.0) +FAST(readability-implicit-bool-conversion, 3.0) +FAST(readability-inconsistent-declaration-parameter-name, -0.0) +FAST(readability-isolate-declaration, 0.0) +FAST(readability-magic-numbers, 4.0) +FAST(readability-make-member-function-const, 1.0) +FAST(readability-math-missing-parentheses, 1.0) +FAST(readability-misleading-indentation, 1.0) +FAST(readability-misplaced-array-index, 0.0) FAST(readability-named-parameter, -0.0) -FAST(readability-non-const-parameter, 1.0) -FAST(readability-qualified-auto, -0.0) -FAST(readability-redundant-access-specifiers, -1.0) -FAST(readability-redundant-control-flow, -1.0) -FAST(readability-redundant-declaration, -0.0) -FAST(readability-redundant-function-ptr-dereference, -1.0) -FAST(readability-redundant-member-init, 0.0) -FAST(readability-redundant-preprocessor, 0.0) -FAST(readability-redundant-smartptr-get, 6.0) -FAST(readability-redundant-string-cstr, 0.0) -FAST(readability-redundant-string-init, 1.0) -FAST(readability-simplify-boolean-expr, 1.0) -FAST(readability-simplify-subscript-expr, -0.0) -FAST(readability-static-accessed-through-instance, 1.0) -FAST(readability-static-definition-in-anonymous-namespace, -0.0) +FAST(readability-non-const-parameter, 2.0) +FAST(readability-operators-representation, 0.0) +FAST(readability-qualified-auto, 0.0) +FAST(readability-redundant-access-specifiers, 1.0) +FAST(readability-redundant-casting, -0.0) +FAST(readability-redundant-control-flow, 1.0) +FAST(readability-redundant-declaration, 1.0) +FAST(readability-redundant-function-ptr-dereference, 0.0) +FAST(readability-redundant-inline-specifier, 0.0) +FAST(readability-redundant-member-init, 1.0) +FAST(readability-redundant-preprocessor, -0.0) +FAST(readability-redundant-smartptr-get, 4.0) +FAST(readability-redundant-string-cstr, 1.0) +FAST(readability-redundant-string-init, -0.0) +FAST(readability-reference-to-constructed-temporary, 3.0) +FAST(readability-simplify-boolean-expr, -0.0) +FAST(readability-simplify-subscript-expr, 1.0) +FAST(readability-static-accessed-through-instance, 0.0) +FAST(readability-static-definition-in-anonymous-namespace, 0.0) FAST(readability-string-compare, -0.0) -FAST(readability-suspicious-call-argument, 0.0) -FAST(readability-uniqueptr-delete-release, 1.0) -FAST(readability-uppercase-literal-suffix, 3.0) -FAST(readability-use-anyofallof, 1.0) +FAST(readability-suspicious-call-argument, -1.0) +FAST(readability-uniqueptr-delete-release, 3.0) +FAST(readability-uppercase-literal-suffix, 0.0) +FAST(readability-use-anyofallof, 2.0) +FAST(readability-use-std-min-max, -1.0) FAST(zircon-temporary-objects, 1.0) #undef FAST diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 083b098d05d4a..ebcdeca8c2ee5 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -61,6 +61,8 @@ Diagnostics Semantic Highlighting ^^^^^^^^^^^^^^^^^^^^^ +- Improved semantic token coverage in some edge cases, e.g. IndirectFieldDecl + Compile flags ^^^^^^^^^^^^^ @@ -70,24 +72,57 @@ Hover Code completion ^^^^^^^^^^^^^^^ +- ``--function-arg-placeholders=0`` is now respected for variable template argument lists + as well +- Macro proposals now use the completion item kind ``Constant`` (for object-like macros) + or ``Function`` (for function-style macros) even for proposals coming from the index + Code actions ^^^^^^^^^^^^ +- The "extract variable" tweak is no longer offered for the initializer expression of a + declaration - The tweak for turning unscoped into scoped enums now removes redundant prefixes from the enum values. +- Support "move function body out-of-line" in non-header files as well Signature help ^^^^^^^^^^^^^^ +- Signature help now shows function argument names for calls through pointers to + functions in struct fields + Cross-references ^^^^^^^^^^^^^^^^ +- Improve go-to-definition for some concept references + +Document outline +^^^^^^^^^^^^^^^^ + +- Improved precision of document outline information for symbols whose definitions + involve macro expansions + +Clang-tidy integration +^^^^^^^^^^^^^^^^^^^^^^ + +- The quick fix for clang-tidy's ``readability-identifier-naming`` diagnostic is now + hooked to invoke ``textDocument/rename``, renaming the identifier across the whole + project rather than just the translation unit of the diagnostic +- ``misc-const-correctness`` can now be enabled with ``FastCheckFilter: None`` + (previously clangd would force it off unconditionally due to its run time) + Objective-C ^^^^^^^^^^^ +- Added support for renaming Objective-C methods + Miscellaneous ^^^^^^^^^^^^^ +- Worked around a clang-format bug that caused memory exhaustion when opening some large + ``.h`` files due to the formatter's language guessing heuristic (#GH85703) +- Various other stability improvements, e.g. crash fixes - Added a boolean option `AnalyzeAngledIncludes` to `Includes` config section, which allows to enable unused includes detection for all angled ("system") headers. At this moment umbrella headers are not supported, so enabling this option @@ -496,6 +531,10 @@ Changes in existing checks ``static_cast``. Fixed false positives in C++20 spaceship operator by ignoring casts in implicit and defaulted functions. +- Improved :doc:`readability-non-const-parameter + ` check to not crash when + redeclaration have fewer parameters than expected. + - Improved :doc:`readability-redundant-inline-specifier ` check to properly emit warnings for static data member with an in-class initializer. diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h b/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h index 6596511c7a38b..69ac9954f4afa 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h @@ -7,8 +7,8 @@ template class vector { public: using iterator = T *; using const_iterator = const T *; - using reverse_iterator = T*; - using reverse_const_iterator = const T*; + using reverse_iterator = T *; + using reverse_const_iterator = const T *; constexpr const_iterator begin() const; constexpr const_iterator end() const; @@ -72,8 +72,8 @@ template constexpr auto crend(const Container &Cont) { return Cont.crend(); } // Find -template< class InputIt, class T > -InputIt find( InputIt first, InputIt last, const T& value ); +template +InputIt find(InputIt first, InputIt last, const T &value); // Reverse template void reverse(Iter begin, Iter end); @@ -82,6 +82,7 @@ template void reverse(Iter begin, Iter end); template bool includes(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2); +inline namespace _V1 { // IsPermutation template bool is_permutation(ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2); @@ -97,9 +98,10 @@ template bool equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2); template -bool equal(InputIt1 first1, InputIt1 last1, - InputIt2 first2, InputIt2 last2, BinaryPred p) { - // Need a definition to suppress undefined_internal_type when invoked with lambda +bool equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, + BinaryPred p) { + // Need a definition to suppress undefined_internal_type when invoked with + // lambda return true; } @@ -108,6 +110,7 @@ void iota(ForwardIt first, ForwardIt last, T value); template ForwardIt rotate(ForwardIt first, ForwardIt middle, ForwardIt last); +} // namespace _V1 } // namespace std diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/non-const-parameter.c b/clang-tools-extra/test/clang-tidy/checkers/readability/non-const-parameter.c new file mode 100644 index 0000000000000..db50467f3dd94 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/non-const-parameter.c @@ -0,0 +1,11 @@ +// RUN: %check_clang_tidy %s readability-non-const-parameter %t + +static int f(); + +int f(p) + int *p; +// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: pointer parameter 'p' can be pointer to const [readability-non-const-parameter] +// CHECK-FIXES: {{^}} const int *p;{{$}} +{ + return *p; +} diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake index 9e6feb479d45f..e5161dd9a27b9 100644 --- a/clang/cmake/caches/Release.cmake +++ b/clang/cmake/caches/Release.cmake @@ -29,9 +29,13 @@ endfunction() # cache file to CMake via -C. e.g. # # cmake -D LLVM_RELEASE_ENABLE_PGO=ON -C Release.cmake +set (DEFAULT_RUNTIMES "compiler-rt;libcxx") +if (NOT WIN32) + list(APPEND DEFAULT_RUNTIMES "libcxxabi" "libunwind") +endif() set(LLVM_RELEASE_ENABLE_LTO THIN CACHE STRING "") set(LLVM_RELEASE_ENABLE_PGO ON CACHE BOOL "") -set(LLVM_RELEASE_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "") +set(LLVM_RELEASE_ENABLE_RUNTIMES ${DEFAULT_RUNTIMES} CACHE STRING "") set(LLVM_RELEASE_ENABLE_PROJECTS "clang;lld;lldb;clang-tools-extra;bolt;polly;mlir;flang" CACHE STRING "") # Note we don't need to add install here, since it is one of the pre-defined # steps. diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake index 9d09be1936847..065b3b21ba215 100644 --- a/clang/cmake/modules/AddClang.cmake +++ b/clang/cmake/modules/AddClang.cmake @@ -178,6 +178,56 @@ macro(add_clang_tool name) DEPENDS ${name} COMPONENT ${name}) endif() + + if(APPLE) + if(LLVM_EXTERNALIZE_DEBUGINFO_INSTALL) + if(LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION) + set(file_ext ${LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION}) + elseif(LLVM_EXTERNALIZE_DEBUGINFO_FLATTEN) + set(file_ext dwarf) + else() + set(file_ext dSYM) + endif() + set(output_name "$.${file_ext}") + if(LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR) + set(output_path "${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR}/${output_name}") + else() + set(output_path "${output_name}") + endif() + get_filename_component(debuginfo_absolute_path ${output_path} REALPATH BASE_DIR $) + install(FILES ${debuginfo_absolute_path} DESTINATION bin OPTIONAL COMPONENT ${name}) + endif() + elseif(WIN32) + if(LLVM_EXTERNALIZE_DEBUGINFO_INSTALL) + install(FILES $ DESTINATION bin OPTIONAL COMPONENT ${name}) + endif() + else() + if(LLVM_EXTERNALIZE_DEBUGINFO_INSTALL) + if(LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION) + set(file_ext ${LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION}) + else() + set(file_ext debug) + endif() + + set(output_name "$.${file_ext}") + + if(LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR) + set(output_path "${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR}/${output_name}") + # If an output dir is specified, it must be manually mkdir'd on Linux, + # as that directory needs to exist before we can pipe to a file in it. + add_custom_command(TARGET ${name} POST_BUILD + WORKING_DIRECTORY ${LLVM_RUNTIME_OUTPUT_INTDIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR} + ) + else() + set(output_path "${output_name}") + endif() + + get_filename_component(debuginfo_absolute_path ${output_path} REALPATH BASE_DIR $) + install(FILES ${debuginfo_absolute_path} DESTINATION bin OPTIONAL COMPONENT ${name}) + endif() + endif() + set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name}) endif() endif() diff --git a/clang/docs/CommandGuide/clang.rst b/clang/docs/CommandGuide/clang.rst index 663aca1f6ddcb..a0c2594d06c61 100644 --- a/clang/docs/CommandGuide/clang.rst +++ b/clang/docs/CommandGuide/clang.rst @@ -429,8 +429,12 @@ Code Generation Options :option:`-Ofast` Enables all the optimizations from :option:`-O3` along with other aggressive optimizations that may violate strict compliance with - language standards. This is deprecated in favor of :option:`-O3` - in combination with :option:`-ffast-math`. + language standards. This is deprecated in Clang 19 and a warning is emitted + that :option:`-O3` in combination with :option:`-ffast-math` should be used + instead if the request for non-standard math behavior is intended. There + is no timeline yet for removal; the aim is to discourage use of + :option:`-Ofast` due to the surprising behavior of an optimization flag + changing the observable behavior of correct code. :option:`-Os` Like :option:`-O2` with extra optimizations to reduce code size. diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 81784c75081ba..1c4a6ecca2142 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -1503,6 +1503,7 @@ Conditional ``explicit`` __cpp_conditional_explicit C+ ``static operator()`` __cpp_static_call_operator C++23 C++03 Attributes on Lambda-Expressions C++23 C++11 Attributes on Structured Bindings __cpp_structured_bindings C++26 C++03 +Pack Indexing __cpp_pack_indexing C++26 C++03 ``= delete ("should have a reason");`` __cpp_deleted_function C++26 C++03 -------------------------------------------- -------------------------------- ------------- ------------- Designated initializers (N494) C99 C89 diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 24d88ed6edf00..8c7a6ba70acd2 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -147,7 +147,7 @@ Clang Frontend Potentially Breaking Changes that ``none`` means that there is no operating system. As opposed to an unknown type of operating system. - This change my cause clang to not find libraries, or libraries to be built at + This change can cause clang to not find libraries, or libraries to be built at different file system locations. This can be fixed by changing your builds to use the new normalized triple. However, we recommend instead getting the normalized triple from clang itself, as this will make your builds more @@ -447,6 +447,10 @@ Non-comprehensive list of changes in this release type of the pointer was taken into account. This improves compatibility with GCC's libstdc++. +- The type traits builtin ``__is_nullptr`` is deprecated in CLang 19 and will be + removed in Clang 20. ``__is_same(__remove_cv(T), decltype(nullptr))`` can be + used instead to check whether a type ``T`` is a ``nullptr``. + New Compiler Flags ------------------ - ``-fsanitize=implicit-bitfield-conversion`` checks implicit truncation and @@ -629,6 +633,9 @@ Attribute Changes in Clang The attributes declare constraints about a function's behavior pertaining to blocking and heap memory allocation. +- The ``hybrid_patchable`` attribute is now supported on ARM64EC targets. It can be used to specify + that a function requires an additional x86-64 thunk, which may be patched at runtime. + Improvements to Clang's diagnostics ----------------------------------- - Clang now emits an error instead of a warning for ``-Wundefined-internal`` @@ -751,7 +758,7 @@ Improvements to Clang's diagnostics - Clang now diagnoses dangling assignments for pointer-like objects (annotated with `[[gsl::Pointer]]`) under `-Wdangling-assignment-gsl` (off by default) Fixes #GH63310. - + - Clang now diagnoses uses of alias templates with a deprecated attribute. (Fixes #GH18236). .. code-block:: c++ @@ -765,6 +772,11 @@ Improvements to Clang's diagnostics UsingWithAttr objUsingWA; // warning: 'UsingWithAttr' is deprecated +- Clang now diagnoses undefined behavior in constant expressions more consistently. This includes invalid shifts, and signed overflow in arithmetic. + +- Clang now diagnoses dangling references to fields of temporary objects. Fixes #GH81589. + + Improvements to Clang's time-trace ---------------------------------- @@ -891,6 +903,9 @@ Bug Fixes in This Version - Fixed an assertion failure when a template non-type parameter contains an invalid expression. +- Fixed the definition of ``ATOMIC_FLAG_INIT`` in ```` so it can + be used in C++. + Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1106,6 +1121,9 @@ Bug Fixes to C++ Support Fixes (#GH85992). - Fixed a crash-on-invalid bug involving extraneous template parameter with concept substitution. (#GH73885) - Fixed assertion failure by skipping the analysis of an invalid field declaration. (#GH99868) +- Fix an issue with dependent source location expressions (#GH106428), (#GH81155), (#GH80210), (#GH85373) +- Fix handling of ``_`` as the name of a lambda's init capture variable. (#GH107024) + Bug Fixes to AST Handling ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1176,11 +1194,13 @@ Arm and AArch64 Support improvements for most targets. We have not changed the default behavior for ARMv6, but may revisit that decision in the future. Users can restore the old behavior with -m[no-]unaligned-access. + - An alias identifier (rdma) has been added for targeting the AArch64 Architecture Extension which uses Rounding Doubling Multiply Accumulate instructions (rdm). The identifier is available on the command line as a feature modifier for -march and -mcpu as well as via target attributes like ``target_version`` or ``target_clones``. + - Support has been added for the following processors (-mcpu identifiers in parenthesis): * Arm Cortex-R52+ (cortex-r52plus). * Arm Cortex-R82AE (cortex-r82ae). @@ -1192,6 +1212,20 @@ Arm and AArch64 Support * Arm Neoverse-N3 (neoverse-n3). * Arm Neoverse-V3 (neoverse-v3). * Arm Neoverse-V3AE (neoverse-v3ae). +- ``-mbranch-protection=gcs`` has been added which enables support for the + Guarded Control Stack extension, and ``-mbranch-protection=standard`` also + enables this. Enabling GCS causes the GCS GNU property bit to be set on output + objects. It doesn't cause any code generation changes, as the code generated + by clang is already compatible with GCS. + + - Experimental support has been added for pointer authentication ABI for С/C++. + + - Pointer authentication ABI could be enabled for AArch64 Linux via + ``-mabi=pauthtest`` option or via specifying ``pauthtest`` environment part of + target triple. + + - The C23 ``_BitInt`` implementation has been brought into compliance + with AAPCS32 and AAPCS64. Android Support ^^^^^^^^^^^^^^^ @@ -1248,6 +1282,14 @@ RISC-V Support accesses may be created. ``-m[no-]strict-align`` applies to both scalar and vector. +PowerPC Support +^^^^^^^^^^^^^^^ + +- Clang now emits errors for impossible ``__attribute__((musttail))``. +- Added support for ``-mcpu=[pwr11 | power11]`` and ``-mtune=[pwr11 | power11]``. +- Added support for ``builtin_cpu_supports`` on AIX, along with a subset of + features that can be queried. + CUDA/HIP Language Changes ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1266,6 +1308,14 @@ AIX Support base is encoded as an immediate operand. This access sequence is not used for TLS variables larger than 32KB, and is currently only supported on 64-bit mode. +- Introduced the options ``-mtocdata/-mno-tocdata`` to enable/disable TOC data + transformations for the listed suitable variables. +- Introduced the ``-maix-shared-lib-tls-model-opt`` option to enable the tuning + of changing local-dynamic mode access(es) to initial-exec access(es) at the + function level on 64-bit mode. +- Clang now emits errors for ``-gdwarf-5``. +- Added the support of the OpenMP runtime libomp on AIX. OpenMP applications can be + compiled with ``-fopenmp`` and execute on AIX. NetBSD Support ^^^^^^^^^^^^^^ @@ -1357,9 +1407,17 @@ Crash and bug fixes - Fixed a crash when storing through an address that refers to the address of a label. (#GH89185) +- Fixed a crash when using ``__builtin_bitcast(type, array)`` as an array + subscript. (#GH94496) + - Z3 crosschecking (aka. Z3 refutation) is now bounded, and can't consume more total time than the eymbolic execution itself. (#GH97298) +- In clang-18, we regressed in terms of analysis time for projects having many + nested loops with buffer indexing or shifting or other binary operations. + For example, functions computing different hash values. Some of this slowdown + was attributed to taint analysis, which is fixed now. (#GH105493) + - ``std::addressof``, ``std::as_const``, ``std::forward``, ``std::forward_like``, ``std::move``, ``std::move_if_noexcept``, are now modeled just like their builtin counterpart. (#GH94193) @@ -1420,6 +1478,7 @@ OpenMP Support -------------- - Added support for the `[[omp::assume]]` attribute. +- AIX added an include directory for ``omp.h`` at ``/opt/IBM/openxlCSDK/include/openmp``. Additional Information ====================== diff --git a/clang/docs/StandardCPlusPlusModules.rst b/clang/docs/StandardCPlusPlusModules.rst index b87491910e222..2478a77e7640c 100644 --- a/clang/docs/StandardCPlusPlusModules.rst +++ b/clang/docs/StandardCPlusPlusModules.rst @@ -398,6 +398,16 @@ BMIs cannot be shipped in an archive to create a module library. Instead, the BMIs(``*.pcm``) are compiled into object files(``*.o``) and those object files are added to the archive instead. +clang-cl +~~~~~~~~ + +``clang-cl`` supports the same options as ``clang++`` for modules as detailed above; +there is no need to prefix these options with ``/clang:``. Note that ``cl.exe`` +`options to emit/consume IFC files ` are *not* supported. +The resultant precompiled modules are also not compatible for use with ``cl.exe``. + +We recommend that build system authors use the above-mentioned ``clang++`` options with ``clang-cl`` to build modules. + Consistency Requirements ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1387,13 +1397,6 @@ have ``.cppm`` (or ``.ccm``, ``.cxxm``, ``.c++m``) as the file extension. However, the behavior is inconsistent with other compilers. This is tracked by `#57416 `_. -clang-cl is not compatible with standard C++ modules -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -``/clang:-fmodule-file`` and ``/clang:-fprebuilt-module-path`` cannot be used -to specify the BMI with ``clang-cl.exe``. This is tracked by -`#64118 `_. - Incorrect ODR violation diagnostics ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst index e9b95739ea2ab..64e991451bf70 100644 --- a/clang/docs/UsersManual.rst +++ b/clang/docs/UsersManual.rst @@ -4745,6 +4745,12 @@ Execute ``clang-cl /?`` to see a list of supported options: -flto= Set LTO mode to either 'full' or 'thin' -flto Enable LTO in 'full' mode -fmerge-all-constants Allow merging of constants + -fmodule-file== + Use the specified module file that provides the module + -fmodule-header=
+ Build
as a C++20 header unit + -fmodule-output= + Save intermediate module file results when compiling a standard C++ module unit. -fms-compatibility-version= Dot-separated value representing the Microsoft compiler version number to report in _MSC_VER (0 = don't define it; default is same value as installed cl.exe, or 1933) diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index 6d1c8ca8a2f96..16a19645d7f36 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -1805,13 +1805,6 @@ class ASTContext : public RefCountedBase { QualType DeducedType, bool IsDependent) const; -private: - QualType getDeducedTemplateSpecializationTypeInternal(TemplateName Template, - QualType DeducedType, - bool IsDependent, - QualType Canon) const; - -public: /// Return the unique reference to the type for the specified TagDecl /// (struct/union/class/enum) decl. QualType getTagDeclType(const TagDecl *Decl) const; diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index 40f01abf384e9..2a4bd0f9c2fda 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -670,6 +670,13 @@ class alignas(8) Decl { /// Whether this declaration comes from another module unit. bool isInAnotherModuleUnit() const; + /// Whether this declaration comes from the same module unit being compiled. + bool isInCurrentModuleUnit() const; + + /// Whether the definition of the declaration should be emitted in external + /// sources. + bool shouldEmitInExternalSource() const; + /// Whether this declaration comes from explicit global module. bool isFromExplicitGlobalModule() const; diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index fb52ac804849d..0923736a95f97 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -1210,6 +1210,13 @@ class CXXRecordDecl : public RecordDecl { return D.HasPublicFields || D.HasProtectedFields || D.HasPrivateFields; } + /// If this is a standard-layout class or union, any and all data members will + /// be declared in the same type. + /// + /// This retrieves the type where any fields are declared, + /// or the current class if there is no class with fields. + const CXXRecordDecl *getStandardLayoutBaseWithFields() const; + /// Whether this class is polymorphic (C++ [class.virtual]), /// which means that the class contains or inherits a virtual function. bool isPolymorphic() const { return data().Polymorphic; } diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h index c2feac525c1ea..45cfd7bfb7f92 100644 --- a/clang/include/clang/AST/ExprCXX.h +++ b/clang/include/clang/AST/ExprCXX.h @@ -3229,7 +3229,7 @@ class UnresolvedLookupExpr final const DeclarationNameInfo &NameInfo, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs, UnresolvedSetIterator Begin, UnresolvedSetIterator End, - bool KnownDependent); + bool KnownDependent, bool KnownInstantiationDependent); UnresolvedLookupExpr(EmptyShell Empty, unsigned NumResults, bool HasTemplateKWAndArgsInfo); @@ -3248,7 +3248,7 @@ class UnresolvedLookupExpr final NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, - bool KnownDependent); + bool KnownDependent, bool KnownInstantiationDependent); // After canonicalization, there may be dependent template arguments in // CanonicalConverted But none of Args is dependent. When any of @@ -3258,7 +3258,8 @@ class UnresolvedLookupExpr final NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, const TemplateArgumentListInfo *Args, UnresolvedSetIterator Begin, - UnresolvedSetIterator End, bool KnownDependent); + UnresolvedSetIterator End, bool KnownDependent, + bool KnownInstantiationDependent); static UnresolvedLookupExpr *CreateEmpty(const ASTContext &Context, unsigned NumResults, diff --git a/clang/include/clang/AST/TemplateName.h b/clang/include/clang/AST/TemplateName.h index e3b7dd261535d..e7313dee01281 100644 --- a/clang/include/clang/AST/TemplateName.h +++ b/clang/include/clang/AST/TemplateName.h @@ -347,9 +347,7 @@ class TemplateName { /// error. void dump() const; - void Profile(llvm::FoldingSetNodeID &ID) { - ID.AddPointer(Storage.getOpaqueValue()); - } + void Profile(llvm::FoldingSetNodeID &ID); /// Retrieve the template name as a void pointer. void *getAsVoidPointer() const { return Storage.getOpaqueValue(); } diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index 25defea58c2dc..9a711030cff9c 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -6421,27 +6421,30 @@ class DeducedTemplateSpecializationType : public DeducedType, DeducedTemplateSpecializationType(TemplateName Template, QualType DeducedAsType, - bool IsDeducedAsDependent, QualType Canon) + bool IsDeducedAsDependent) : DeducedType(DeducedTemplateSpecialization, DeducedAsType, toTypeDependence(Template.getDependence()) | (IsDeducedAsDependent ? TypeDependence::DependentInstantiation : TypeDependence::None), - Canon), + DeducedAsType.isNull() ? QualType(this, 0) + : DeducedAsType.getCanonicalType()), Template(Template) {} public: /// Retrieve the name of the template that we are deducing. TemplateName getTemplateName() const { return Template;} - void Profile(llvm::FoldingSetNodeID &ID) const { + void Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, getTemplateName(), getDeducedType(), isDependentType()); } static void Profile(llvm::FoldingSetNodeID &ID, TemplateName Template, QualType Deduced, bool IsDependent) { Template.Profile(ID); - Deduced.Profile(ID); + QualType CanonicalType = + Deduced.isNull() ? Deduced : Deduced.getCanonicalType(); + ID.AddPointer(CanonicalType.getAsOpaquePtr()); ID.AddBoolean(IsDependent || Template.isDependent()); } diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 4825979a974d2..46d0a66d59c37 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -477,6 +477,9 @@ def TargetELF : TargetSpec { def TargetELFOrMachO : TargetSpec { let ObjectFormats = ["ELF", "MachO"]; } +def TargetWindowsArm64EC : TargetSpec { + let CustomCode = [{ Target.getTriple().isWindowsArm64EC() }]; +} def TargetSupportsInitPriority : TargetSpec { let CustomCode = [{ !Target.getTriple().isOSzOS() }]; @@ -4027,6 +4030,12 @@ def SelectAny : InheritableAttr { let SimpleHandler = 1; } +def HybridPatchable : InheritableAttr, TargetSpecificAttr { + let Spellings = [Declspec<"hybrid_patchable">, Clang<"hybrid_patchable">]; + let Subjects = SubjectList<[Function]>; + let Documentation = [HybridPatchableDocs]; +} + def Thread : Attr { let Spellings = [Declspec<"thread">]; let LangOpts = [MicrosoftExt]; diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index 99738812c8157..b5d468eb5ec95 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -5985,6 +5985,16 @@ For more information see or `msvc documentation `_. }]; } +def HybridPatchableDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +The ``hybrid_patchable`` attribute declares an ARM64EC function with an additional +x86-64 thunk, which may be patched at runtime. + +For more information see +`ARM64EC ABI documentation `_. +}]; } + def WebAssemblyExportNameDocs : Documentation { let Category = DocCatFunction; let Content = [{ diff --git a/clang/include/clang/Basic/DiagnosticFrontendKinds.td b/clang/include/clang/Basic/DiagnosticFrontendKinds.td index 12a4617c64d87..8a1462c670d68 100644 --- a/clang/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/clang/include/clang/Basic/DiagnosticFrontendKinds.td @@ -288,6 +288,9 @@ def err_function_needs_feature : Error< let CategoryName = "Codegen ABI Check" in { def err_function_always_inline_attribute_mismatch : Error< "always_inline function %1 and its caller %0 have mismatching %2 attributes">; +def warn_function_always_inline_attribute_mismatch : Warning< + "always_inline function %1 and its caller %0 have mismatching %2 attributes, " + "inlining may change runtime behaviour">, InGroup; def err_function_always_inline_new_za : Error< "always_inline function %0 has new za state">; diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index f8d50d12bb935..12aab09f28556 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -1260,9 +1260,6 @@ def warn_pragma_intrinsic_builtin : Warning< def warn_pragma_unused_expected_var : Warning< "expected '#pragma unused' argument to be a variable name">, InGroup; -// - #pragma mc_func -def err_pragma_mc_func_not_supported : - Error<"#pragma mc_func is not supported">; // - #pragma init_seg def warn_pragma_init_seg_unsupported_target : Warning< "'#pragma init_seg' is only supported when targeting a " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index b8d97a6b14fe6..8a00fe21a08ce 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -942,6 +942,9 @@ def warn_ptrauth_auth_null_pointer : InGroup; def err_ptrauth_string_not_literal : Error< "argument must be a string literal%select{| of char type}0">; +def err_ptrauth_type_disc_undiscriminated : Error< + "cannot pass undiscriminated type %0 to " + "'__builtin_ptrauth_type_discriminator'">; def note_ptrauth_virtual_function_pointer_incomplete_arg_ret : Note<"cannot take an address of a virtual member function if its return or " @@ -3674,6 +3677,9 @@ def err_attribute_weak_static : Error< "weak declaration cannot have internal linkage">; def err_attribute_selectany_non_extern_data : Error< "'selectany' can only be applied to data items with external linkage">; +def warn_attribute_hybrid_patchable_non_extern : Warning< + "'hybrid_patchable' is ignored on functions without external linkage">, + InGroup; def err_declspec_thread_on_thread_variable : Error< "'__declspec(thread)' applied to variable that already has a " "thread-local storage specifier">; @@ -3805,8 +3811,6 @@ def warn_sme_locally_streaming_has_vl_args_returns : Warning< InGroup, DefaultIgnore; def err_conflicting_attributes_arm_state : Error< "conflicting attributes for state '%0'">; -def err_sme_streaming_cannot_be_multiversioned : Error< - "streaming function cannot be multi-versioned">; def err_unknown_arm_state : Error< "unknown state '%0'">; def err_missing_arm_state : Error< diff --git a/clang/include/clang/Basic/PointerAuthOptions.h b/clang/include/clang/Basic/PointerAuthOptions.h index 417b4b00648c7..a26af69e1fa24 100644 --- a/clang/include/clang/Basic/PointerAuthOptions.h +++ b/clang/include/clang/Basic/PointerAuthOptions.h @@ -159,6 +159,12 @@ class PointerAuthSchema { }; struct PointerAuthOptions { + /// Should return addresses be authenticated? + bool ReturnAddresses = false; + + /// Do authentication failures cause a trap? + bool AuthTraps = false; + /// Do indirect goto label addresses need to be authenticated? bool IndirectGotos = false; diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def index 7f4912b9bcd96..8c54661e65cf4 100644 --- a/clang/include/clang/Basic/TokenKinds.def +++ b/clang/include/clang/Basic/TokenKinds.def @@ -596,6 +596,8 @@ ALIAS("__is_same_as", __is_same, KEYCXX) KEYWORD(__private_extern__ , KEYALL) KEYWORD(__module_private__ , KEYALL) +UNARY_EXPR_OR_TYPE_TRAIT(__builtin_ptrauth_type_discriminator, PtrAuthTypeDiscriminator, KEYALL) + // Extension that will be enabled for Microsoft, Borland and PS4, but can be // disabled via '-fno-declspec'. KEYWORD(__declspec , 0) diff --git a/clang/include/clang/Basic/arm_sve.td b/clang/include/clang/Basic/arm_sve.td index 94c093d891156..fb11d743fd647 100644 --- a/clang/include/clang/Basic/arm_sve.td +++ b/clang/include/clang/Basic/arm_sve.td @@ -2116,7 +2116,7 @@ def SVFCLAMP_BF : SInst<"svclamp[_{d}]", "dddd", "b", MergeNone, "aarch64_sve_ multiclass MinMaxIntr { def SVS # NAME : SInst<"sv" # i # "[" # zm # "_{d}_" # mul # "]", t, "csil", MergeNone, "aarch64_sve_s" # i # zm # "_" # mul, [IsStreaming], []>; def SVU # NAME : SInst<"sv" # i # "[" # zm # "_{d}_" # mul # "]", t, "UcUsUiUl", MergeNone, "aarch64_sve_u" # i # zm # "_" # mul, [IsStreaming], []>; - def SVF # NAME : SInst<"sv" # i # "[" # zm # "_{d}_" # mul # "]", t, "bhfd", MergeNone, "aarch64_sve_f" # i # zm # "_" # mul, [IsStreaming], []>; + def SVF # NAME : SInst<"sv" # i # "[" # zm # "_{d}_" # mul # "]", t, "hfd", MergeNone, "aarch64_sve_f" # i # zm # "_" # mul, [IsStreaming], []>; } let SVETargetGuard = InvalidMode, SMETargetGuard = "sme2" in { @@ -2134,11 +2134,11 @@ let SVETargetGuard = InvalidMode, SMETargetGuard = "sme2" in { } multiclass SInstMinMaxByVector { - def NAME # _SINGLE_X2 : SInst<"sv" # name # "nm[_single_{d}_x2]", "22d", "bhfd", MergeNone, "aarch64_sve_f" # name # "nm_single_x2", [IsStreaming], []>; - def NAME # _SINGLE_X4 : SInst<"sv" # name # "nm[_single_{d}_x4]", "44d", "bhfd", MergeNone, "aarch64_sve_f" # name # "nm_single_x4", [IsStreaming], []>; + def NAME # _SINGLE_X2 : SInst<"sv" # name # "nm[_single_{d}_x2]", "22d", "hfd", MergeNone, "aarch64_sve_f" # name # "nm_single_x2", [IsStreaming], []>; + def NAME # _SINGLE_X4 : SInst<"sv" # name # "nm[_single_{d}_x4]", "44d", "hfd", MergeNone, "aarch64_sve_f" # name # "nm_single_x4", [IsStreaming], []>; - def NAME # _X2 : SInst<"sv" # name # "nm[_{d}_x2]", "222", "bhfd", MergeNone, "aarch64_sve_f" # name # "nm_x2", [IsStreaming], []>; - def NAME # _X4 : SInst<"sv" # name # "nm[_{d}_x4]", "444", "bhfd", MergeNone, "aarch64_sve_f" # name # "nm_x4", [IsStreaming], []>; + def NAME # _X2 : SInst<"sv" # name # "nm[_{d}_x2]", "222", "hfd", MergeNone, "aarch64_sve_f" # name # "nm_x2", [IsStreaming], []>; + def NAME # _X4 : SInst<"sv" # name # "nm[_{d}_x4]", "444", "hfd", MergeNone, "aarch64_sve_f" # name # "nm_x4", [IsStreaming], []>; } let SVETargetGuard = InvalidMode, SMETargetGuard = "sme2" in { @@ -2172,9 +2172,25 @@ let SVETargetGuard = InvalidMode, SMETargetGuard = "sme2" in { def SVFCLAMP_X4 : SInst<"svclamp[_single_{d}_x4]", "44dd", "hfd", MergeNone, "aarch64_sve_fclamp_single_x4", [IsStreaming], []>; } +multiclass BfSingleMultiVector { + def NAME # _SINGLE_X2 : SInst<"sv" # name # "[_single_{d}_x2]", "22d", "b", MergeNone, "aarch64_sve_f" # name # "_single_x2", [IsStreaming], []>; + def NAME # _SINGLE_X4 : SInst<"sv" # name # "[_single_{d}_x4]", "44d", "b", MergeNone, "aarch64_sve_f" # name # "_single_x4", [IsStreaming], []>; + + def NAME # _X2 : SInst<"sv" # name # "[_{d}_x2]", "222", "b", MergeNone, "aarch64_sve_f" # name # "_x2", [IsStreaming], []>; + def NAME # _X4 : SInst<"sv" # name # "[_{d}_x4]", "444", "b", MergeNone, "aarch64_sve_f" # name # "_x4", [IsStreaming], []>; +} + let SVETargetGuard = InvalidMode, SMETargetGuard = "sme2,b16b16"in { def SVBFCLAMP_X2 : SInst<"svclamp[_single_{d}_x2]", "22dd", "b", MergeNone, "aarch64_sve_bfclamp_single_x2", [IsStreaming], []>; def SVBFCLAMP_X4 : SInst<"svclamp[_single_{d}_x4]", "44dd", "b", MergeNone, "aarch64_sve_bfclamp_single_x4", [IsStreaming], []>; + + // bfmin, bfmax (single, multi) + defm SVBFMIN : BfSingleMultiVector<"min">; + defm SVBFMAX : BfSingleMultiVector<"max">; + + // bfminnm, bfmaxnm (single, multi) + defm SVBFMINNM : BfSingleMultiVector<"minnm">; + defm SVBFMAXNM : BfSingleMultiVector<"maxnm">; } let SVETargetGuard = InvalidMode, SMETargetGuard = "sme2" in { diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 69269cf7537b0..15f9ee75492e3 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -932,8 +932,9 @@ def O_flag : Flag<["-"], "O">, Visibility<[ClangOption, CC1Option, FC1Option]>, Alias, AliasArgs<["1"]>; def Ofast : Joined<["-"], "Ofast">, Group, Visibility<[ClangOption, CC1Option, FlangOption]>, - HelpText<"Deprecated; use '-O3 -ffast-math' for the same behavior," - " or '-O3' to enable only conforming optimizations">; + HelpTextForVariants<[ClangOption, CC1Option], + "Deprecated; use '-O3 -ffast-math' for the same behavior," + " or '-O3' to enable only conforming optimizations">; def P : Flag<["-"], "P">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>, Group, @@ -1165,19 +1166,19 @@ def client__name : JoinedOrSeparate<["-"], "client_name">; def combine : Flag<["-", "--"], "combine">, Flags<[NoXarchOption, Unsupported]>; def compatibility__version : JoinedOrSeparate<["-"], "compatibility_version">; def config : Joined<["--"], "config=">, Flags<[NoXarchOption]>, - Visibility<[ClangOption, CLOption, DXCOption]>, MetaVarName<"">, + Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, MetaVarName<"">, HelpText<"Specify configuration file">; -def : Separate<["--"], "config">, Alias; +def : Separate<["--"], "config">, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def no_default_config : Flag<["--"], "no-default-config">, - Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption]>, + Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, HelpText<"Disable loading default configuration files">; def config_system_dir_EQ : Joined<["--"], "config-system-dir=">, Flags<[NoXarchOption, HelpHidden]>, - Visibility<[ClangOption, CLOption, DXCOption]>, + Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, HelpText<"System directory for configuration files">; def config_user_dir_EQ : Joined<["--"], "config-user-dir=">, Flags<[NoXarchOption, HelpHidden]>, - Visibility<[ClangOption, CLOption, DXCOption]>, + Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, HelpText<"User directory for configuration files">; def coverage : Flag<["-", "--"], "coverage">, Group, Visibility<[ClangOption, CLOption]>; @@ -3106,7 +3107,7 @@ def fmodules_user_build_path : Separate<["-"], "fmodules-user-build-path">, Grou HelpText<"Specify the module user build path">, MarshallingInfoString>; def fprebuilt_module_path : Joined<["-"], "fprebuilt-module-path=">, Group, - Flags<[]>, Visibility<[ClangOption, CC1Option]>, + Flags<[]>, Visibility<[ClangOption, CLOption, CC1Option]>, MetaVarName<"">, HelpText<"Specify the prebuilt module path">; defm prebuilt_implicit_modules : BoolFOption<"prebuilt-implicit-modules", @@ -3115,11 +3116,11 @@ defm prebuilt_implicit_modules : BoolFOption<"prebuilt-implicit-modules", NegFlag, BothFlags<[], [ClangOption, CC1Option]>>; def fmodule_output_EQ : Joined<["-"], "fmodule-output=">, - Flags<[NoXarchOption]>, Visibility<[ClangOption, CC1Option]>, + Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, CC1Option]>, MarshallingInfoString>, HelpText<"Save intermediate module file results when compiling a standard C++ module unit.">; def fmodule_output : Flag<["-"], "fmodule-output">, Flags<[NoXarchOption]>, - Visibility<[ClangOption, CC1Option]>, + Visibility<[ClangOption, CLOption, CC1Option]>, HelpText<"Save intermediate module file results when compiling a standard C++ module unit.">; defm skip_odr_check_in_gmf : BoolOption<"f", "skip-odr-check-in-gmf", @@ -3299,8 +3300,10 @@ def fretain_comments_from_system_headers : Flag<["-"], "fretain-comments-from-sy Visibility<[ClangOption, CC1Option]>, MarshallingInfoFlag>; def fmodule_header : Flag <["-"], "fmodule-header">, Group, + Visibility<[ClangOption, CLOption]>, HelpText<"Build a C++20 Header Unit from a header">; def fmodule_header_EQ : Joined<["-"], "fmodule-header=">, Group, + Visibility<[ClangOption, CLOption]>, MetaVarName<"">, HelpText<"Build a C++20 Header Unit from a header that should be found in the user (fmodule-header=user) or system (fmodule-header=system) search path.">; @@ -5945,6 +5948,7 @@ def _output : Separate<["--"], "output">, Alias; def _param : Separate<["--"], "param">, Group; def _param_EQ : Joined<["--"], "param=">, Alias<_param>; def _precompile : Flag<["--"], "precompile">, Flags<[NoXarchOption]>, + Visibility<[ClangOption, CLOption]>, Group, HelpText<"Only precompile the input">; def _prefix_EQ : Joined<["--"], "prefix=">, Alias; def _prefix : Separate<["--"], "prefix">, Alias; @@ -8086,13 +8090,6 @@ def source_date_epoch : Separate<["-"], "source-date-epoch">, } // let Visibility = [CC1Option] -defm err_pragma_mc_func_aix : BoolFOption<"err-pragma-mc-func-aix", - PreprocessorOpts<"ErrorOnPragmaMcfuncOnAIX">, DefaultFalse, - PosFlag, - NegFlag>; - //===----------------------------------------------------------------------===// // CUDA Options //===----------------------------------------------------------------------===// diff --git a/clang/include/clang/Lex/PreprocessorOptions.h b/clang/include/clang/Lex/PreprocessorOptions.h index 3f7dd9db18ba7..c2e3d68333024 100644 --- a/clang/include/clang/Lex/PreprocessorOptions.h +++ b/clang/include/clang/Lex/PreprocessorOptions.h @@ -211,10 +211,6 @@ class PreprocessorOptions { /// If set, the UNIX timestamp specified by SOURCE_DATE_EPOCH. std::optional SourceDateEpoch; - /// If set, the preprocessor reports an error when processing #pragma mc_func - /// on AIX. - bool ErrorOnPragmaMcfuncOnAIX = false; - public: PreprocessorOptions() : PrecompiledPreambleBytes(0, false) {} @@ -252,7 +248,6 @@ class PreprocessorOptions { PrecompiledPreambleBytes.first = 0; PrecompiledPreambleBytes.second = false; RetainExcludedConditionalBlocks = false; - ErrorOnPragmaMcfuncOnAIX = false; } }; diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index 613bab9120dfc..f256d603ae626 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -221,7 +221,6 @@ class Parser : public CodeCompletionHandler { std::unique_ptr MaxTokensHerePragmaHandler; std::unique_ptr MaxTokensTotalPragmaHandler; std::unique_ptr RISCVPragmaHandler; - std::unique_ptr MCFuncPragmaHandler; std::unique_ptr CommentSemaHandler; @@ -3890,6 +3889,8 @@ class Parser : public CodeCompletionHandler { ExprResult ParseArrayTypeTrait(); ExprResult ParseExpressionTrait(); + ExprResult ParseBuiltinPtrauthTypeDiscriminator(); + //===--------------------------------------------------------------------===// // Preprocessor code-completion pass-through void CodeCompleteDirective(bool InConditional) override; diff --git a/clang/include/clang/Sema/Overload.h b/clang/include/clang/Sema/Overload.h index 9d8b797af6663..26ffe057c74a2 100644 --- a/clang/include/clang/Sema/Overload.h +++ b/clang/include/clang/Sema/Overload.h @@ -998,7 +998,9 @@ class Sema; private: friend class OverloadCandidateSet; OverloadCandidate() - : IsSurrogate(false), IsADLCandidate(CallExpr::NotADL), RewriteKind(CRK_None) {} + : IsSurrogate(false), IgnoreObjectArgument(false), + TookAddressOfOverload(false), IsADLCandidate(CallExpr::NotADL), + RewriteKind(CRK_None) {} }; /// OverloadCandidateSet - A set of overload candidates, used in C++ diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index d638d31e050dc..7bfdaaae45a93 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -3456,6 +3456,8 @@ class Sema final : public SemaBase { TemplateIdAnnotation *TemplateId, bool IsMemberSpecialization); + bool checkPointerAuthEnabled(SourceLocation Loc, SourceRange Range); + bool checkConstantPointerAuthKey(Expr *keyExpr, unsigned &key); /// Diagnose function specifiers on a declaration of an identifier that diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h index 5dd0ba33f8a9c..9b7e3af0e449b 100644 --- a/clang/include/clang/Serialization/ASTBitCodes.h +++ b/clang/include/clang/Serialization/ASTBitCodes.h @@ -721,6 +721,9 @@ enum ASTRecordTypes { /// Record code for \#pragma clang unsafe_buffer_usage begin/end PP_UNSAFE_BUFFER_USAGE = 69, + + /// Record code for vtables to emit. + VTABLES_TO_EMIT = 70, }; /// Record types used within a source manager block. diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h index 76e51ac7ab979..671520a3602b3 100644 --- a/clang/include/clang/Serialization/ASTReader.h +++ b/clang/include/clang/Serialization/ASTReader.h @@ -790,6 +790,11 @@ class ASTReader /// the consumer eagerly. SmallVector EagerlyDeserializedDecls; + /// The IDs of all vtables to emit. The referenced declarations are passed + /// to the consumers' HandleVTable eagerly after passing + /// EagerlyDeserializedDecls. + SmallVector VTablesToEmit; + /// The IDs of all tentative definitions stored in the chain. /// /// Sema keeps track of all tentative definitions in a TU because it has to @@ -1500,6 +1505,7 @@ class ASTReader bool isConsumerInterestedIn(Decl *D); void PassInterestingDeclsToConsumer(); void PassInterestingDeclToConsumer(Decl *D); + void PassVTableToConsumer(CXXRecordDecl *RD); void finishPendingActions(); void diagnoseOdrViolations(); diff --git a/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h index a0e475ec9f862..700f0ad001116 100644 --- a/clang/include/clang/Serialization/ASTWriter.h +++ b/clang/include/clang/Serialization/ASTWriter.h @@ -500,6 +500,10 @@ class ASTWriter : public ASTDeserializationListener, std::vector NonAffectingRanges; std::vector NonAffectingOffsetAdjustments; + /// A list of classes in named modules which need to emit the VTable in + /// the corresponding object file. + llvm::SmallVector PendingEmittingVTables; + /// Computes input files that didn't affect compilation of the current module, /// and initializes data structures necessary for leaving those files out /// during \c SourceManager serialization. @@ -857,6 +861,8 @@ class ASTWriter : public ASTDeserializationListener, return PredefinedDecls.count(D); } + void handleVTable(CXXRecordDecl *RD); + private: // ASTDeserializationListener implementation void ReaderInitialized(ASTReader *Reader) override; @@ -951,6 +957,7 @@ class PCHGenerator : public SemaConsumer { void InitializeSema(Sema &S) override { SemaPtr = &S; } void HandleTranslationUnit(ASTContext &Ctx) override; + void HandleVTable(CXXRecordDecl *RD) override { Writer.handleVTable(RD); } ASTMutationListener *GetASTMutationListener() override; ASTDeserializationListener *GetASTDeserializationListener() override; bool hasEmittedPCH() const { return Buffer->IsComplete; } diff --git a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def index 29aa6a3b8a16e..737bc8e86cfb6 100644 --- a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def +++ b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def @@ -407,6 +407,11 @@ ANALYZER_OPTION( ANALYZER_OPTION(unsigned, MaxSymbolComplexity, "max-symbol-complexity", "The maximum complexity of symbolic constraint.", 35) +// HACK:https://discourse.llvm.org/t/rfc-make-istainted-and-complex-symbols-friends/79570 +// Ideally, we should get rid of this option soon. +ANALYZER_OPTION(unsigned, MaxTaintedSymbolComplexity, "max-tainted-symbol-complexity", + "[DEPRECATED] The maximum complexity of a symbol to carry taint", 9) + ANALYZER_OPTION(unsigned, MaxTimesInlineLarge, "max-times-inline-large", "The maximum times a large function could be inlined.", 32) diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 7af9ea7105bb0..1064507f34616 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -6269,9 +6269,11 @@ QualType ASTContext::getUnconstrainedType(QualType T) const { return T; } -QualType ASTContext::getDeducedTemplateSpecializationTypeInternal( - TemplateName Template, QualType DeducedType, bool IsDependent, - QualType Canon) const { +/// Return the uniqued reference to the deduced template specialization type +/// which has been deduced to the given type, or to the canonical undeduced +/// such type, or the canonical deduced-but-dependent such type. +QualType ASTContext::getDeducedTemplateSpecializationType( + TemplateName Template, QualType DeducedType, bool IsDependent) const { // Look in the folding set for an existing type. void *InsertPos = nullptr; llvm::FoldingSetNodeID ID; @@ -6282,8 +6284,7 @@ QualType ASTContext::getDeducedTemplateSpecializationTypeInternal( return QualType(DTST, 0); auto *DTST = new (*this, alignof(DeducedTemplateSpecializationType)) - DeducedTemplateSpecializationType(Template, DeducedType, IsDependent, - Canon); + DeducedTemplateSpecializationType(Template, DeducedType, IsDependent); llvm::FoldingSetNodeID TempID; DTST->Profile(TempID); assert(ID == TempID && "ID does not match"); @@ -6292,20 +6293,6 @@ QualType ASTContext::getDeducedTemplateSpecializationTypeInternal( return QualType(DTST, 0); } -/// Return the uniqued reference to the deduced template specialization type -/// which has been deduced to the given type, or to the canonical undeduced -/// such type, or the canonical deduced-but-dependent such type. -QualType ASTContext::getDeducedTemplateSpecializationType( - TemplateName Template, QualType DeducedType, bool IsDependent) const { - QualType Canon = DeducedType.isNull() - ? getDeducedTemplateSpecializationTypeInternal( - getCanonicalTemplateName(Template), QualType(), - IsDependent, QualType()) - : DeducedType.getCanonicalType(); - return getDeducedTemplateSpecializationTypeInternal(Template, DeducedType, - IsDependent, Canon); -} - /// getAtomicType - Return the uniqued reference to the atomic type for /// the given value type. QualType ASTContext::getAtomicType(QualType T) const { @@ -12405,8 +12392,7 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { !isMSStaticDataMemberInlineDefinition(VD)) return false; - // Variables in other module units shouldn't be forced to be emitted. - if (VD->isInAnotherModuleUnit()) + if (VD->shouldEmitInExternalSource()) return false; // Variables that can be needed in other TUs are required. diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 08ef09d353afc..e95992b99f7e9 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -8578,13 +8578,15 @@ ASTNodeImporter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) { return UnresolvedLookupExpr::Create( Importer.getToContext(), *ToNamingClassOrErr, *ToQualifierLocOrErr, *ToTemplateKeywordLocOrErr, ToNameInfo, E->requiresADL(), &ToTAInfo, - ToDecls.begin(), ToDecls.end(), KnownDependent); + ToDecls.begin(), ToDecls.end(), KnownDependent, + /*KnownInstantiationDependent=*/E->isInstantiationDependent()); } return UnresolvedLookupExpr::Create( Importer.getToContext(), *ToNamingClassOrErr, *ToQualifierLocOrErr, ToNameInfo, E->requiresADL(), ToDecls.begin(), ToDecls.end(), - /*KnownDependent=*/E->isTypeDependent()); + /*KnownDependent=*/E->isTypeDependent(), + /*KnownInstantiationDependent=*/E->isInstantiationDependent()); } ExpectedStmt diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index bc5a9206c0db2..b59f118380ca4 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -1125,20 +1125,36 @@ bool Decl::isInAnotherModuleUnit() const { if (!M) return false; + // FIXME or NOTE: maybe we need to be clear about the semantics + // of clang header modules. e.g., if this lives in a clang header + // module included by the current unit, should we return false + // here? + // + // This is clear for header units as the specification says the + // header units live in a synthesised translation unit. So we + // can return false here. M = M->getTopLevelModule(); - // FIXME: It is problematic if the header module lives in another module - // unit. Consider to fix this by techniques like - // ExternalASTSource::hasExternalDefinitions. - if (M->isHeaderLikeModule()) + if (!M->isNamedModule()) return false; - // A global module without parent implies that we're parsing the global - // module. So it can't be in another module unit. - if (M->isGlobalModule()) + return M != getASTContext().getCurrentNamedModule(); +} + +bool Decl::isInCurrentModuleUnit() const { + auto *M = getOwningModule(); + + if (!M || !M->isNamedModule()) return false; - assert(M->isNamedModule() && "New module kind?"); - return M != getASTContext().getCurrentNamedModule(); + return M == getASTContext().getCurrentNamedModule(); +} + +bool Decl::shouldEmitInExternalSource() const { + ExternalASTSource *Source = getASTContext().getExternalSource(); + if (!Source) + return false; + + return Source->hasExternalDefinitions(this) == ExternalASTSource::EK_Always; } bool Decl::isFromExplicitGlobalModule() const { diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index b573c2713a3aa..9a3ede426e914 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -561,6 +561,42 @@ void CXXRecordDecl::addedClassSubobject(CXXRecordDecl *Subobj) { data().StructuralIfLiteral = false; } +const CXXRecordDecl *CXXRecordDecl::getStandardLayoutBaseWithFields() const { + assert( + isStandardLayout() && + "getStandardLayoutBaseWithFields called on a non-standard-layout type"); +#ifdef EXPENSIVE_CHECKS + { + unsigned NumberOfBasesWithFields = 0; + if (!field_empty()) + ++NumberOfBasesWithFields; + llvm::SmallPtrSet UniqueBases; + forallBases([&](const CXXRecordDecl *Base) -> bool { + if (!Base->field_empty()) + ++NumberOfBasesWithFields; + assert( + UniqueBases.insert(Base->getCanonicalDecl()).second && + "Standard layout struct has multiple base classes of the same type"); + return true; + }); + assert(NumberOfBasesWithFields <= 1 && + "Standard layout struct has fields declared in more than one class"); + } +#endif + if (!field_empty()) + return this; + const CXXRecordDecl *Result = this; + forallBases([&](const CXXRecordDecl *Base) -> bool { + if (!Base->field_empty()) { + // This is the base where the fields are declared; return early + Result = Base; + return false; + } + return true; + }); + return Result; +} + bool CXXRecordDecl::hasConstexprDestructor() const { auto *Dtor = getDestructor(); return Dtor ? Dtor->isConstexpr() : defaultedDestructorIsConstexpr(); diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp index 8d2a1b5611ccc..45e2badf2ddd4 100644 --- a/clang/lib/AST/ExprCXX.cpp +++ b/clang/lib/AST/ExprCXX.cpp @@ -402,10 +402,11 @@ UnresolvedLookupExpr::UnresolvedLookupExpr( NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs, UnresolvedSetIterator Begin, - UnresolvedSetIterator End, bool KnownDependent) + UnresolvedSetIterator End, bool KnownDependent, + bool KnownInstantiationDependent) : OverloadExpr(UnresolvedLookupExprClass, Context, QualifierLoc, TemplateKWLoc, NameInfo, TemplateArgs, Begin, End, - KnownDependent, false, false), + KnownDependent, KnownInstantiationDependent, false), NamingClass(NamingClass) { UnresolvedLookupExprBits.RequiresADL = RequiresADL; } @@ -420,7 +421,7 @@ UnresolvedLookupExpr *UnresolvedLookupExpr::Create( const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, UnresolvedSetIterator Begin, UnresolvedSetIterator End, - bool KnownDependent) { + bool KnownDependent, bool KnownInstantiationDependent) { unsigned NumResults = End - Begin; unsigned Size = totalSizeToAlloc(NumResults, 0, 0); @@ -428,7 +429,8 @@ UnresolvedLookupExpr *UnresolvedLookupExpr::Create( return new (Mem) UnresolvedLookupExpr( Context, NamingClass, QualifierLoc, /*TemplateKWLoc=*/SourceLocation(), NameInfo, RequiresADL, - /*TemplateArgs=*/nullptr, Begin, End, KnownDependent); + /*TemplateArgs=*/nullptr, Begin, End, KnownDependent, + KnownInstantiationDependent); } UnresolvedLookupExpr *UnresolvedLookupExpr::Create( @@ -436,7 +438,8 @@ UnresolvedLookupExpr *UnresolvedLookupExpr::Create( NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, const TemplateArgumentListInfo *Args, UnresolvedSetIterator Begin, - UnresolvedSetIterator End, bool KnownDependent) { + UnresolvedSetIterator End, bool KnownDependent, + bool KnownInstantiationDependent) { unsigned NumResults = End - Begin; bool HasTemplateKWAndArgsInfo = Args || TemplateKWLoc.isValid(); unsigned NumTemplateArgs = Args ? Args->size() : 0; @@ -444,9 +447,9 @@ UnresolvedLookupExpr *UnresolvedLookupExpr::Create( TemplateArgumentLoc>( NumResults, HasTemplateKWAndArgsInfo, NumTemplateArgs); void *Mem = Context.Allocate(Size, alignof(UnresolvedLookupExpr)); - return new (Mem) UnresolvedLookupExpr(Context, NamingClass, QualifierLoc, - TemplateKWLoc, NameInfo, RequiresADL, - Args, Begin, End, KnownDependent); + return new (Mem) UnresolvedLookupExpr( + Context, NamingClass, QualifierLoc, TemplateKWLoc, NameInfo, RequiresADL, + Args, Begin, End, KnownDependent, KnownInstantiationDependent); } UnresolvedLookupExpr *UnresolvedLookupExpr::CreateEmpty( diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index fcb382474ea62..5e57b5e8bc8f1 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -2839,6 +2839,8 @@ static bool handleIntIntBinOp(EvalInfo &Info, const BinaryOperator *E, // During constant-folding, a negative shift is an opposite shift. Such // a shift is not a constant expression. Info.CCEDiag(E, diag::note_constexpr_negative_shift) << RHS; + if (!Info.noteUndefinedBehavior()) + return false; RHS = -RHS; goto shift_right; } @@ -2849,19 +2851,23 @@ static bool handleIntIntBinOp(EvalInfo &Info, const BinaryOperator *E, if (SA != RHS) { Info.CCEDiag(E, diag::note_constexpr_large_shift) << RHS << E->getType() << LHS.getBitWidth(); + if (!Info.noteUndefinedBehavior()) + return false; } else if (LHS.isSigned() && !Info.getLangOpts().CPlusPlus20) { // C++11 [expr.shift]p2: A signed left shift must have a non-negative // operand, and must not overflow the corresponding unsigned type. // C++2a [expr.shift]p2: E1 << E2 is the unique value congruent to // E1 x 2^E2 module 2^N. - if (LHS.isNegative()) + if (LHS.isNegative()) { Info.CCEDiag(E, diag::note_constexpr_lshift_of_negative) << LHS; - else if (LHS.countl_zero() < SA) + if (!Info.noteUndefinedBehavior()) + return false; + } else if (LHS.countl_zero() < SA) { Info.CCEDiag(E, diag::note_constexpr_lshift_discards); + if (!Info.noteUndefinedBehavior()) + return false; + } } - if (Info.EvalStatus.Diag && !Info.EvalStatus.Diag->empty() && - Info.getLangOpts().CPlusPlus11) - return false; Result = LHS << SA; return true; } @@ -2875,6 +2881,8 @@ static bool handleIntIntBinOp(EvalInfo &Info, const BinaryOperator *E, // During constant-folding, a negative shift is an opposite shift. Such a // shift is not a constant expression. Info.CCEDiag(E, diag::note_constexpr_negative_shift) << RHS; + if (!Info.noteUndefinedBehavior()) + return false; RHS = -RHS; goto shift_left; } @@ -2882,13 +2890,13 @@ static bool handleIntIntBinOp(EvalInfo &Info, const BinaryOperator *E, // C++11 [expr.shift]p1: Shift width must be less than the bit width of the // shifted type. unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1); - if (SA != RHS) + if (SA != RHS) { Info.CCEDiag(E, diag::note_constexpr_large_shift) << RHS << E->getType() << LHS.getBitWidth(); + if (!Info.noteUndefinedBehavior()) + return false; + } - if (Info.EvalStatus.Diag && !Info.EvalStatus.Diag->empty() && - Info.getLangOpts().CPlusPlus11) - return false; Result = LHS >> SA; return true; } @@ -14054,6 +14062,12 @@ bool IntExprEvaluator::VisitUnaryExprOrTypeTraitExpr( E); } + case UETT_PtrAuthTypeDiscriminator: { + if (E->getArgumentType()->isDependentType()) + return false; + return Success( + Info.Ctx.getPointerAuthTypeDiscriminator(E->getArgumentType()), E); + } case UETT_VecStep: { QualType Ty = E->getTypeOfArgument(); diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h index 8e96f78d90568..253a433e7340a 100644 --- a/clang/lib/AST/Interp/Interp.h +++ b/clang/lib/AST/Interp/Interp.h @@ -153,7 +153,8 @@ bool CheckShift(InterpState &S, CodePtr OpPC, const LT &LHS, const RT &RHS, if (RHS.isNegative()) { const SourceInfo &Loc = S.Current->getSource(OpPC); S.CCEDiag(Loc, diag::note_constexpr_negative_shift) << RHS.toAPSInt(); - return false; + if (!S.noteUndefinedBehavior()) + return false; } // C++11 [expr.shift]p1: Shift width must be less than the bit width of @@ -163,17 +164,24 @@ bool CheckShift(InterpState &S, CodePtr OpPC, const LT &LHS, const RT &RHS, const APSInt Val = RHS.toAPSInt(); QualType Ty = E->getType(); S.CCEDiag(E, diag::note_constexpr_large_shift) << Val << Ty << Bits; - return !(S.getEvalStatus().Diag && !S.getEvalStatus().Diag->empty() && S.getLangOpts().CPlusPlus11); + if (!S.noteUndefinedBehavior()) + return false; } if (LHS.isSigned() && !S.getLangOpts().CPlusPlus20) { const Expr *E = S.Current->getExpr(OpPC); // C++11 [expr.shift]p2: A signed left shift must have a non-negative // operand, and must not overflow the corresponding unsigned type. - if (LHS.isNegative()) + if (LHS.isNegative()) { S.CCEDiag(E, diag::note_constexpr_lshift_of_negative) << LHS.toAPSInt(); - else if (LHS.toUnsigned().countLeadingZeros() < static_cast(RHS)) + if (!S.noteUndefinedBehavior()) + return false; + } else if (LHS.toUnsigned().countLeadingZeros() < + static_cast(RHS)) { S.CCEDiag(E, diag::note_constexpr_lshift_discards); + if (!S.noteUndefinedBehavior()) + return false; + } } // C++2a [expr.shift]p2: [P0907R4]: @@ -2269,8 +2277,7 @@ inline bool DoShift(InterpState &S, CodePtr OpPC, LT &LHS, RT &RHS) { // shift is not a constant expression. const SourceInfo &Loc = S.Current->getSource(OpPC); S.CCEDiag(Loc, diag::note_constexpr_negative_shift) << RHS.toAPSInt(); - if (S.getLangOpts().CPlusPlus11 && S.getEvalStatus().Diag && - !S.getEvalStatus().Diag->empty()) + if (!S.noteUndefinedBehavior()) return false; RHS = -RHS; return DoShift < LT, RT, @@ -2286,8 +2293,7 @@ inline bool DoShift(InterpState &S, CodePtr OpPC, LT &LHS, RT &RHS) { // E1 x 2^E2 module 2^N. const SourceInfo &Loc = S.Current->getSource(OpPC); S.CCEDiag(Loc, diag::note_constexpr_lshift_of_negative) << LHS.toAPSInt(); - if (S.getLangOpts().CPlusPlus11 && S.getEvalStatus().Diag && - !S.getEvalStatus().Diag->empty()) + if (!S.noteUndefinedBehavior()) return false; } } diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 40ef82785f454..d46d621d4c7d4 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -5179,6 +5179,14 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity, Diags.Report(DiagID); return; } + case UETT_PtrAuthTypeDiscriminator: { + DiagnosticsEngine &Diags = Context.getDiags(); + unsigned DiagID = Diags.getCustomDiagID( + DiagnosticsEngine::Error, + "cannot yet mangle __builtin_ptrauth_type_discriminator expression"); + Diags.Report(E->getExprLoc(), DiagID); + return; + } case UETT_VecStep: { DiagnosticsEngine &Diags = Context.getDiags(); unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error, diff --git a/clang/lib/AST/TemplateName.cpp b/clang/lib/AST/TemplateName.cpp index d4e8a8971a971..11544dbb56e31 100644 --- a/clang/lib/AST/TemplateName.cpp +++ b/clang/lib/AST/TemplateName.cpp @@ -264,6 +264,15 @@ bool TemplateName::containsUnexpandedParameterPack() const { return getDependence() & TemplateNameDependence::UnexpandedPack; } +void TemplateName::Profile(llvm::FoldingSetNodeID &ID) { + if (const auto* USD = getAsUsingShadowDecl()) + ID.AddPointer(USD->getCanonicalDecl()); + else if (const auto *TD = getAsTemplateDecl()) + ID.AddPointer(TD->getCanonicalDecl()); + else + ID.AddPointer(Storage.getOpaqueValue()); +} + void TemplateName::print(raw_ostream &OS, const PrintingPolicy &Policy, Qualified Qual) const { auto handleAnonymousTTP = [](TemplateDecl *TD, raw_ostream &OS) { diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp index 6ba31cc05a0d7..63fc15f916c55 100644 --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -471,23 +471,25 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts, if (HasSVE2 && HasSVE2SM4) Builder.defineMacro("__ARM_FEATURE_SVE2_SM4", "1"); + if (HasSVEB16B16) + Builder.defineMacro("__ARM_FEATURE_SVE_B16B16", "1"); + if (HasSME) { Builder.defineMacro("__ARM_FEATURE_SME"); Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1"); } - if (HasSME2) { - Builder.defineMacro("__ARM_FEATURE_SME", "1"); + if (HasSME2) Builder.defineMacro("__ARM_FEATURE_SME2", "1"); - Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1"); - } - if (HasSME2p1) { - Builder.defineMacro("__ARM_FEATURE_SME", "1"); - Builder.defineMacro("__ARM_FEATURE_SME2", "1"); + if (HasSME2p1) Builder.defineMacro("__ARM_FEATURE_SME2p1", "1"); - Builder.defineMacro("__ARM_FEATURE_LOCALLY_STREAMING", "1"); - } + + if (HasSMEF16F16) + Builder.defineMacro("__ARM_FEATURE_SME_F16F16", "1"); + + if (HasSMEB16B16) + Builder.defineMacro("__ARM_FEATURE_SME_B16B16", "1"); if (HasCRC) Builder.defineMacro("__ARM_FEATURE_CRC32", "1"); @@ -749,6 +751,7 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const { .Case("sve", FPU & SveMode) .Case("sve-bf16", FPU & SveMode && HasBFloat16) .Case("sve-i8mm", FPU & SveMode && HasMatMul) + .Case("sve-b16b16", HasSVEB16B16) .Case("f32mm", FPU & SveMode && HasMatmulFP32) .Case("f64mm", FPU & SveMode && HasMatmulFP64) .Case("sve2", FPU & SveMode && HasSVE2) @@ -763,6 +766,8 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const { .Case("sme-f64f64", HasSMEF64F64) .Case("sme-i16i64", HasSMEI16I64) .Case("sme-fa64", HasSMEFA64) + .Case("sme-f16f16", HasSMEF16F16) + .Case("sme-b16b16", HasSMEB16B16) .Cases("memtag", "memtag2", HasMTE) .Case("sb", HasSB) .Case("predres", HasPredRes) @@ -863,6 +868,8 @@ bool AArch64TargetInfo::handleTargetFeatures(std::vector &Features, HasSVE2 = true; HasSVE2SM4 = true; } + if (Feature == "+sve-b16b16") + HasSVEB16B16 = true; if (Feature == "+sve2-bitperm") { FPU |= NeonMode; FPU |= SveMode; @@ -919,6 +926,21 @@ bool AArch64TargetInfo::handleTargetFeatures(std::vector &Features, HasSVE2 = true; HasSMEFA64 = true; } + if (Feature == "+sme-f16f16") { + HasSME = true; + HasSME2 = true; + HasBFloat16 = true; + HasFullFP16 = true; + HasSMEF16F16 = true; + } + if (Feature == "+sme-b16b16") { + HasSME = true; + HasSME2 = true; + HasBFloat16 = true; + HasFullFP16 = true; + HasSVEB16B16 = true; + HasSMEB16B16 = true; + } if (Feature == "+sb") HasSB = true; if (Feature == "+predres") diff --git a/clang/lib/Basic/Targets/AArch64.h b/clang/lib/Basic/Targets/AArch64.h index 7bdf5a2b4106e..526f7f30a3861 100644 --- a/clang/lib/Basic/Targets/AArch64.h +++ b/clang/lib/Basic/Targets/AArch64.h @@ -53,6 +53,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo { bool HasSVE2AES = false; bool HasSVE2SHA3 = false; bool HasSVE2SM4 = false; + bool HasSVEB16B16 = false; bool HasSVE2BitPerm = false; bool HasMatmulFP64 = false; bool HasMatmulFP32 = false; @@ -71,6 +72,8 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo { bool HasSME2 = false; bool HasSMEF64F64 = false; bool HasSMEI16I64 = false; + bool HasSMEF16F16 = false; + bool HasSMEB16B16 = false; bool HasSME2p1 = false; bool HasSB = false; bool HasPredRes = false; diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp index 4ba4a49311d36..9ff54083c923b 100644 --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -385,6 +385,8 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("_ARCH_PWR9"); if (ArchDefs & ArchDefinePwr10) Builder.defineMacro("_ARCH_PWR10"); + if (ArchDefs & ArchDefinePwr11) + Builder.defineMacro("_ARCH_PWR11"); if (ArchDefs & ArchDefineA2) Builder.defineMacro("_ARCH_A2"); if (ArchDefs & ArchDefineE500) @@ -622,10 +624,17 @@ bool PPCTargetInfo::initFeatureMap( addP10SpecificFeatures(Features); } - // Future CPU should include all of the features of Power 10 as well as any + // Power11 includes all the same features as Power10 plus any features + // specific to the Power11 core. + if (CPU == "pwr11" || CPU == "power11") { + initFeatureMap(Features, Diags, "pwr10", FeaturesVec); + addP11SpecificFeatures(Features); + } + + // Future CPU should include all of the features of Power 11 as well as any // additional features (yet to be determined) specific to it. if (CPU == "future") { - initFeatureMap(Features, Diags, "pwr10", FeaturesVec); + initFeatureMap(Features, Diags, "pwr11", FeaturesVec); addFutureSpecificFeatures(Features); } @@ -696,6 +705,10 @@ void PPCTargetInfo::addP10SpecificFeatures( Features["isa-v31-instructions"] = true; } +// Add any Power11 specific features. +void PPCTargetInfo::addP11SpecificFeatures( + llvm::StringMap &Features) const {} + // Add features specific to the "Future" CPU. void PPCTargetInfo::addFutureSpecificFeatures( llvm::StringMap &Features) const {} @@ -870,17 +883,17 @@ ArrayRef PPCTargetInfo::getGCCAddlRegNames() const { } static constexpr llvm::StringLiteral ValidCPUNames[] = { - {"generic"}, {"440"}, {"450"}, {"601"}, {"602"}, - {"603"}, {"603e"}, {"603ev"}, {"604"}, {"604e"}, - {"620"}, {"630"}, {"g3"}, {"7400"}, {"g4"}, - {"7450"}, {"g4+"}, {"750"}, {"8548"}, {"970"}, - {"g5"}, {"a2"}, {"e500"}, {"e500mc"}, {"e5500"}, - {"power3"}, {"pwr3"}, {"power4"}, {"pwr4"}, {"power5"}, - {"pwr5"}, {"power5x"}, {"pwr5x"}, {"power6"}, {"pwr6"}, - {"power6x"}, {"pwr6x"}, {"power7"}, {"pwr7"}, {"power8"}, - {"pwr8"}, {"power9"}, {"pwr9"}, {"power10"}, {"pwr10"}, - {"powerpc"}, {"ppc"}, {"ppc32"}, {"powerpc64"}, {"ppc64"}, - {"powerpc64le"}, {"ppc64le"}, {"future"}}; + {"generic"}, {"440"}, {"450"}, {"601"}, {"602"}, + {"603"}, {"603e"}, {"603ev"}, {"604"}, {"604e"}, + {"620"}, {"630"}, {"g3"}, {"7400"}, {"g4"}, + {"7450"}, {"g4+"}, {"750"}, {"8548"}, {"970"}, + {"g5"}, {"a2"}, {"e500"}, {"e500mc"}, {"e5500"}, + {"power3"}, {"pwr3"}, {"power4"}, {"pwr4"}, {"power5"}, + {"pwr5"}, {"power5x"}, {"pwr5x"}, {"power6"}, {"pwr6"}, + {"power6x"}, {"pwr6x"}, {"power7"}, {"pwr7"}, {"power8"}, + {"pwr8"}, {"power9"}, {"pwr9"}, {"power10"}, {"pwr10"}, + {"power11"}, {"pwr11"}, {"powerpc"}, {"ppc"}, {"ppc32"}, + {"powerpc64"}, {"ppc64"}, {"powerpc64le"}, {"ppc64le"}, {"future"}}; bool PPCTargetInfo::isValidCPUName(StringRef Name) const { return llvm::is_contained(ValidCPUNames, Name); diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h index b15ab6fbcf492..6d5d8dd54d013 100644 --- a/clang/lib/Basic/Targets/PPC.h +++ b/clang/lib/Basic/Targets/PPC.h @@ -44,8 +44,9 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo { ArchDefinePwr8 = 1 << 12, ArchDefinePwr9 = 1 << 13, ArchDefinePwr10 = 1 << 14, - ArchDefineFuture = 1 << 15, - ArchDefineA2 = 1 << 16, + ArchDefinePwr11 = 1 << 15, + ArchDefineFuture = 1 << 16, + ArchDefineA2 = 1 << 17, ArchDefineE500 = 1 << 18 } ArchDefineTypes; @@ -166,11 +167,16 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo { ArchDefinePwr7 | ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) + .Cases("power11", "pwr11", + ArchDefinePwr11 | ArchDefinePwr10 | ArchDefinePwr9 | + ArchDefinePwr8 | ArchDefinePwr7 | ArchDefinePwr6 | + ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 | + ArchDefinePpcgr | ArchDefinePpcsq) .Case("future", - ArchDefineFuture | ArchDefinePwr10 | ArchDefinePwr9 | - ArchDefinePwr8 | ArchDefinePwr7 | ArchDefinePwr6 | - ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 | - ArchDefinePpcgr | ArchDefinePpcsq) + ArchDefineFuture | ArchDefinePwr11 | ArchDefinePwr10 | + ArchDefinePwr9 | ArchDefinePwr8 | ArchDefinePwr7 | + ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 | + ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) .Cases("8548", "e500", ArchDefineE500) .Default(ArchDefineNone); } @@ -192,6 +198,7 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo { const std::vector &FeaturesVec) const override; void addP10SpecificFeatures(llvm::StringMap &Features) const; + void addP11SpecificFeatures(llvm::StringMap &Features) const; void addFutureSpecificFeatures(llvm::StringMap &Features) const; bool handleTargetFeatures(std::vector &Features, diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index 18e6dbf03e00d..072c97e6c8c6e 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -723,6 +723,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, case CK_ZNVER4: defineCPUMacros(Builder, "znver4"); break; + case CK_ZNVER5: + defineCPUMacros(Builder, "znver5"); + break; case CK_Geode: defineCPUMacros(Builder, "geode"); break; @@ -1613,6 +1616,7 @@ std::optional X86TargetInfo::getCPUCacheLineSize() const { case CK_ZNVER2: case CK_ZNVER3: case CK_ZNVER4: + case CK_ZNVER5: // Deprecated case CK_x86_64: case CK_x86_64_v2: diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 234a9c16e39df..d7ebffa8c5e4e 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -1336,75 +1336,50 @@ static llvm::Value *CreateCoercedLoad(Address Src, llvm::Type *Ty, return CGF.Builder.CreateLoad(Tmp); } -// Function to store a first-class aggregate into memory. We prefer to -// store the elements rather than the aggregate to be more friendly to -// fast-isel. -// FIXME: Do we need to recurse here? -void CodeGenFunction::EmitAggregateStore(llvm::Value *Val, Address Dest, - bool DestIsVolatile) { - // Prefer scalar stores to first-class aggregate stores. - if (llvm::StructType *STy = dyn_cast(Val->getType())) { - for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { - Address EltPtr = Builder.CreateStructGEP(Dest, i); - llvm::Value *Elt = Builder.CreateExtractValue(Val, i); - Builder.CreateStore(Elt, EltPtr, DestIsVolatile); - } - } else { - Builder.CreateStore(Val, Dest, DestIsVolatile); - } -} - -/// CreateCoercedStore - Create a store to \arg DstPtr from \arg Src, -/// where the source and destination may have different types. The -/// destination is known to be aligned to \arg DstAlign bytes. -/// -/// This safely handles the case when the src type is larger than the -/// destination type; the upper bits of the src will be lost. -static void CreateCoercedStore(llvm::Value *Src, - Address Dst, - bool DstIsVolatile, - CodeGenFunction &CGF) { - llvm::Type *SrcTy = Src->getType(); - llvm::Type *DstTy = Dst.getElementType(); - if (SrcTy == DstTy) { - CGF.Builder.CreateStore(Src, Dst, DstIsVolatile); - return; - } - - llvm::TypeSize SrcSize = CGF.CGM.getDataLayout().getTypeAllocSize(SrcTy); - - if (llvm::StructType *DstSTy = dyn_cast(DstTy)) { - Dst = EnterStructPointerForCoercedAccess(Dst, DstSTy, - SrcSize.getFixedValue(), CGF); - DstTy = Dst.getElementType(); - } - - llvm::PointerType *SrcPtrTy = llvm::dyn_cast(SrcTy); - llvm::PointerType *DstPtrTy = llvm::dyn_cast(DstTy); - if (SrcPtrTy && DstPtrTy && - SrcPtrTy->getAddressSpace() != DstPtrTy->getAddressSpace()) { - Src = CGF.Builder.CreateAddrSpaceCast(Src, DstTy); - CGF.Builder.CreateStore(Src, Dst, DstIsVolatile); +void CodeGenFunction::CreateCoercedStore(llvm::Value *Src, Address Dst, + llvm::TypeSize DstSize, + bool DstIsVolatile) { + if (!DstSize) return; - } - // If the source and destination are integer or pointer types, just do an - // extension or truncation to the desired type. - if ((isa(SrcTy) || isa(SrcTy)) && - (isa(DstTy) || isa(DstTy))) { - Src = CoerceIntOrPtrToIntOrPtr(Src, DstTy, CGF); - CGF.Builder.CreateStore(Src, Dst, DstIsVolatile); - return; + llvm::Type *SrcTy = Src->getType(); + llvm::TypeSize SrcSize = CGM.getDataLayout().getTypeAllocSize(SrcTy); + + // GEP into structs to try to make types match. + // FIXME: This isn't really that useful with opaque types, but it impacts a + // lot of regression tests. + if (SrcTy != Dst.getElementType()) { + if (llvm::StructType *DstSTy = + dyn_cast(Dst.getElementType())) { + assert(!SrcSize.isScalable()); + Dst = EnterStructPointerForCoercedAccess(Dst, DstSTy, + SrcSize.getFixedValue(), *this); + } } - llvm::TypeSize DstSize = CGF.CGM.getDataLayout().getTypeAllocSize(DstTy); - - // If store is legal, just bitcast the src pointer. - if (isa(SrcTy) || - isa(DstTy) || - SrcSize.getFixedValue() <= DstSize.getFixedValue()) { - Dst = Dst.withElementType(SrcTy); - CGF.EmitAggregateStore(Src, Dst, DstIsVolatile); + if (SrcSize.isScalable() || SrcSize <= DstSize) { + if (SrcTy->isIntegerTy() && Dst.getElementType()->isPointerTy() && + SrcSize == CGM.getDataLayout().getTypeAllocSize(Dst.getElementType())) { + // If the value is supposed to be a pointer, convert it before storing it. + Src = CoerceIntOrPtrToIntOrPtr(Src, Dst.getElementType(), *this); + Builder.CreateStore(Src, Dst, DstIsVolatile); + } else if (llvm::StructType *STy = + dyn_cast(Src->getType())) { + // Prefer scalar stores to first-class aggregate stores. + Dst = Dst.withElementType(SrcTy); + for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { + Address EltPtr = Builder.CreateStructGEP(Dst, i); + llvm::Value *Elt = Builder.CreateExtractValue(Src, i); + Builder.CreateStore(Elt, EltPtr, DstIsVolatile); + } + } else { + Builder.CreateStore(Src, Dst.withElementType(SrcTy), DstIsVolatile); + } + } else if (SrcTy->isIntegerTy()) { + // If the source is a simple integer, coerce it directly. + llvm::Type *DstIntTy = Builder.getIntNTy(DstSize.getFixedValue() * 8); + Src = CoerceIntOrPtrToIntOrPtr(Src, DstIntTy, *this); + Builder.CreateStore(Src, Dst.withElementType(DstIntTy), DstIsVolatile); } else { // Otherwise do coercion through memory. This is stupid, but // simple. @@ -1416,12 +1391,12 @@ static void CreateCoercedStore(llvm::Value *Src, // FIXME: Assert that we aren't truncating non-padding bits when have access // to that information. RawAddress Tmp = - CreateTempAllocaForCoercion(CGF, SrcTy, Dst.getAlignment()); - CGF.Builder.CreateStore(Src, Tmp); - CGF.Builder.CreateMemCpy( - Dst.emitRawPointer(CGF), Dst.getAlignment().getAsAlign(), - Tmp.getPointer(), Tmp.getAlignment().getAsAlign(), - llvm::ConstantInt::get(CGF.IntPtrTy, DstSize.getFixedValue())); + CreateTempAllocaForCoercion(*this, SrcTy, Dst.getAlignment()); + Builder.CreateStore(Src, Tmp); + Builder.CreateMemCpy(Dst.emitRawPointer(*this), + Dst.getAlignment().getAsAlign(), Tmp.getPointer(), + Tmp.getAlignment().getAsAlign(), + Builder.CreateTypeSize(IntPtrTy, DstSize)); } } @@ -2032,7 +2007,7 @@ static void getTrivialDefaultFunctionAttributes( } TargetInfo::BranchProtectionInfo BPI(LangOpts); - TargetCodeGenInfo::setBranchProtectionFnAttributes(BPI, FuncAttrs); + TargetCodeGenInfo::initBranchProtectionFnAttributes(BPI, FuncAttrs); } /// Merges `target-features` from \TargetOpts and \F, and sets the result in @@ -3309,7 +3284,12 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, assert(NumIRArgs == 1); auto AI = Fn->getArg(FirstIRArg); AI->setName(Arg->getName() + ".coerce"); - CreateCoercedStore(AI, Ptr, /*DstIsVolatile=*/false, *this); + CreateCoercedStore( + AI, Ptr, + llvm::TypeSize::getFixed( + getContext().getTypeSizeInChars(Ty).getQuantity() - + ArgI.getDirectOffset()), + /*DstIsVolatile=*/false); } // Match to what EmitParmDecl is expecting for this type. @@ -5939,17 +5919,8 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, llvm::Value *Imag = Builder.CreateExtractValue(CI, 1); return RValue::getComplex(std::make_pair(Real, Imag)); } - case TEK_Aggregate: { - Address DestPtr = ReturnValue.getAddress(); - bool DestIsVolatile = ReturnValue.isVolatile(); - - if (!DestPtr.isValid()) { - DestPtr = CreateMemTemp(RetTy, "agg.tmp"); - DestIsVolatile = false; - } - EmitAggregateStore(CI, DestPtr, DestIsVolatile); - return RValue::getAggregate(DestPtr); - } + case TEK_Aggregate: + break; case TEK_Scalar: { // If the argument doesn't match, perform a bitcast to coerce it. // This can happen due to trivial type mismatches. @@ -5959,7 +5930,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, return RValue::get(V); } } - llvm_unreachable("bad evaluation kind"); } // If coercing a fixed vector from a scalable vector for ABI @@ -5981,10 +5951,13 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, Address DestPtr = ReturnValue.getValue(); bool DestIsVolatile = ReturnValue.isVolatile(); + uint64_t DestSize = + getContext().getTypeInfoDataSizeInChars(RetTy).Width.getQuantity(); if (!DestPtr.isValid()) { DestPtr = CreateMemTemp(RetTy, "coerce"); DestIsVolatile = false; + DestSize = getContext().getTypeSizeInChars(RetTy).getQuantity(); } // An empty record can overlap other data (if declared with @@ -5993,7 +5966,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, if (!isEmptyRecord(getContext(), RetTy, true)) { // If the value is offset in memory, apply the offset now. Address StorePtr = emitAddressAtOffset(*this, DestPtr, RetAI); - CreateCoercedStore(CI, StorePtr, DestIsVolatile, *this); + CreateCoercedStore( + CI, StorePtr, + llvm::TypeSize::getFixed(DestSize - RetAI.getDirectOffset()), + DestIsVolatile); } return convertTempToRValue(DestPtr, RetTy, SourceLocation()); diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index c3c10e73ff05e..d9f44f4be617e 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -131,15 +131,12 @@ class AggExprEmitter : public StmtVisitor { EnsureDest(E->getType()); if (llvm::Value *Result = ConstantEmitter(CGF).tryEmitConstantExpr(E)) { - Address StoreDest = Dest.getAddress(); - // The emitted value is guaranteed to have the same size as the - // destination but can have a different type. Just do a bitcast in this - // case to avoid incorrect GEPs. - if (Result->getType() != StoreDest.getType()) - StoreDest = StoreDest.withElementType(Result->getType()); - - CGF.EmitAggregateStore(Result, StoreDest, - E->getType().isVolatileQualified()); + CGF.CreateCoercedStore( + Result, Dest.getAddress(), + llvm::TypeSize::getFixed( + Dest.getPreferredSize(CGF.getContext(), E->getType()) + .getQuantity()), + E->getType().isVolatileQualified()); return; } return Visit(E->getSubExpr()); @@ -2050,6 +2047,10 @@ CodeGenFunction::getOverlapForFieldInit(const FieldDecl *FD) { if (!FD->hasAttr() || !FD->getType()->isRecordType()) return AggValueSlot::DoesNotOverlap; + // Empty fields can overlap earlier fields. + if (FD->getType()->getAsCXXRecordDecl()->isEmpty()) + return AggValueSlot::MayOverlap; + // If the field lies entirely within the enclosing class's nvsize, its tail // padding cannot overlap any already-initialized object. (The only subobjects // with greater addresses that might already be initialized are vbases.) @@ -2072,6 +2073,10 @@ AggValueSlot::Overlap_t CodeGenFunction::getOverlapForBaseInit( if (IsVirtual) return AggValueSlot::MayOverlap; + // Empty bases can overlap earlier bases. + if (BaseRD->isEmpty()) + return AggValueSlot::MayOverlap; + // If the base class is laid out entirely within the nvsize of the derived // class, its tail padding cannot yet be initialized, so we can issue // stores at the full width of the base class. diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp index f5bd4a141cc2d..8965a14d88a6f 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp @@ -1695,7 +1695,8 @@ void CGOpenMPRuntimeGPU::emitReduction( CGF.AllocaInsertPt->getIterator()); InsertPointTy CodeGenIP(CGF.Builder.GetInsertBlock(), CGF.Builder.GetInsertPoint()); - llvm::OpenMPIRBuilder::LocationDescription OmpLoc(CodeGenIP); + llvm::OpenMPIRBuilder::LocationDescription OmpLoc( + CodeGenIP, CGF.SourceLocToDebugLoc(Loc)); llvm::SmallVector ReductionInfos; CodeGenFunction::OMPPrivateScope Scope(CGF); diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index aa97f685ac7a9..2f466602d2f68 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -745,7 +745,7 @@ void CodeGenFunction::EmitAttributedStmt(const AttributedStmt &S) { } break; case attr::CXXAssume: { const Expr *Assumption = cast(A)->getAssumption(); - if (getLangOpts().CXXAssumptions && + if (getLangOpts().CXXAssumptions && Builder.GetInsertBlock() && !Assumption->HasSideEffects(getContext())) { llvm::Value *AssumptionVal = EvaluateExprAsBool(Assumption); Builder.CreateAssumption(AssumptionVal); diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index 7f729d359b82b..267bdf0982970 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -1078,29 +1078,41 @@ llvm::GlobalVariable::LinkageTypes CodeGenModule::getVTableLinkage(const CXXRecordDecl *RD) { if (!RD->isExternallyVisible()) return llvm::GlobalVariable::InternalLinkage; - - // We're at the end of the translation unit, so the current key - // function is fully correct. - const CXXMethodDecl *keyFunction = Context.getCurrentKeyFunction(RD); - if (keyFunction && !RD->hasAttr()) { + + // In windows, the linkage of vtable is not related to modules. + bool IsInNamedModule = !getTarget().getCXXABI().isMicrosoft() && + RD->isInNamedModule(); + // If the CXXRecordDecl is not in a module unit, we need to get + // its key function. We're at the end of the translation unit, so the current + // key function is fully correct. + const CXXMethodDecl *keyFunction = + IsInNamedModule ? nullptr : Context.getCurrentKeyFunction(RD); + if (IsInNamedModule || (keyFunction && !RD->hasAttr())) { // If this class has a key function, use that to determine the // linkage of the vtable. const FunctionDecl *def = nullptr; - if (keyFunction->hasBody(def)) + if (keyFunction && keyFunction->hasBody(def)) keyFunction = cast(def); - switch (keyFunction->getTemplateSpecializationKind()) { - case TSK_Undeclared: - case TSK_ExplicitSpecialization: + bool IsExternalDefinition = + IsInNamedModule ? RD->shouldEmitInExternalSource() : !def; + + TemplateSpecializationKind Kind = + IsInNamedModule ? RD->getTemplateSpecializationKind() + : keyFunction->getTemplateSpecializationKind(); + + switch (Kind) { + case TSK_Undeclared: + case TSK_ExplicitSpecialization: assert( - (def || CodeGenOpts.OptimizationLevel > 0 || + (IsInNamedModule || def || CodeGenOpts.OptimizationLevel > 0 || CodeGenOpts.getDebugInfo() != llvm::codegenoptions::NoDebugInfo) && - "Shouldn't query vtable linkage without key function, " - "optimizations, or debug info"); - if (!def && CodeGenOpts.OptimizationLevel > 0) + "Shouldn't query vtable linkage without the class in module units, " + "key function, optimizations, or debug info"); + if (IsExternalDefinition && CodeGenOpts.OptimizationLevel > 0) return llvm::GlobalVariable::AvailableExternallyLinkage; - if (keyFunction->isInlined()) + if (keyFunction && keyFunction->isInlined()) return !Context.getLangOpts().AppleKext ? llvm::GlobalVariable::LinkOnceODRLinkage : llvm::Function::InternalLinkage; @@ -1119,7 +1131,7 @@ CodeGenModule::getVTableLinkage(const CXXRecordDecl *RD) { case TSK_ExplicitInstantiationDeclaration: llvm_unreachable("Should not have been asked to emit this"); - } + } } // -fapple-kext mode does not support weak linkage, so we must use @@ -1213,22 +1225,20 @@ bool CodeGenVTables::isVTableExternal(const CXXRecordDecl *RD) { TSK == TSK_ExplicitInstantiationDefinition) return false; + // Otherwise, if the class is attached to a module, the tables are uniquely + // emitted in the object for the module unit in which it is defined. + if (RD->isInNamedModule()) + return RD->shouldEmitInExternalSource(); + // Otherwise, if the class doesn't have a key function (possibly // anymore), the vtable must be defined here. const CXXMethodDecl *keyFunction = CGM.getContext().getCurrentKeyFunction(RD); if (!keyFunction) return false; - const FunctionDecl *Def; // Otherwise, if we don't have a definition of the key function, the // vtable must be defined somewhere else. - if (!keyFunction->hasBody(Def)) - return true; - - assert(Def && "The body of the key function is not assigned to Def?"); - // If the non-inline key function comes from another module unit, the vtable - // must be defined there. - return Def->isInAnotherModuleUnit() && !Def->isInlineSpecified(); + return !keyFunction->hasBody(); } /// Given that we're currently at the end of the translation unit, and diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index d6078696a7d91..2b2e23f1e5d7f 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -880,8 +880,12 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, // Add pointer authentication attributes. const CodeGenOptions &CodeGenOpts = CGM.getCodeGenOpts(); + if (CodeGenOpts.PointerAuth.ReturnAddresses) + Fn->addFnAttr("ptrauth-returns"); if (CodeGenOpts.PointerAuth.FunctionPointers) Fn->addFnAttr("ptrauth-calls"); + if (CodeGenOpts.PointerAuth.AuthTraps) + Fn->addFnAttr("ptrauth-auth-traps"); if (CodeGenOpts.PointerAuth.IndirectGotos) Fn->addFnAttr("ptrauth-indirect-gotos"); @@ -991,6 +995,9 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, if (D && D->hasAttr()) Fn->addFnAttr(llvm::Attribute::NoProfile); + if (D && D->hasAttr()) + Fn->addFnAttr(llvm::Attribute::HybridPatchable); + if (D) { // Function attributes take precedence over command line flags. if (auto *A = D->getAttr()) { diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index ba7b565d97559..60e6841e1b3d6 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -4838,9 +4838,10 @@ class CodeGenFunction : public CodeGenTypeCache { void EmitAggFinalDestCopy(QualType Type, AggValueSlot Dest, const LValue &Src, ExprValueKind SrcKind); - /// Build all the stores needed to initialize an aggregate at Dest with the - /// value Val. - void EmitAggregateStore(llvm::Value *Val, Address Dest, bool DestIsVolatile); + /// Create a store to \arg DstPtr from \arg Src, truncating the stored value + /// to at most \arg DstSize bytes. + void CreateCoercedStore(llvm::Value *Src, Address Dst, llvm::TypeSize DstSize, + bool DstIsVolatile); /// EmitExtendGCLifetime - Given a pointer to an Objective-C object, /// make sure it survives garbage collection until this point. diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index cd76f8406e7b7..0be92fb2e2757 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -2315,6 +2315,9 @@ bool ItaniumCXXABI::canSpeculativelyEmitVTable(const CXXRecordDecl *RD) const { if (!canSpeculativelyEmitVTableAsBaseClass(RD)) return false; + if (RD->shouldEmitInExternalSource()) + return false; + // For a complete-object vtable (or more specifically, for the VTT), we need // to be able to speculatively emit the vtables of all dynamic virtual bases. for (const auto &B : RD->vbases()) { diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 38faa50cf19cf..64a9a5554caf7 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -209,13 +209,37 @@ llvm::Value *TargetCodeGenInfo::createEnqueuedBlockKernel( void TargetCodeGenInfo::setBranchProtectionFnAttributes( const TargetInfo::BranchProtectionInfo &BPI, llvm::Function &F) { - llvm::AttrBuilder FuncAttrs(F.getContext()); - setBranchProtectionFnAttributes(BPI, FuncAttrs); - F.addFnAttrs(FuncAttrs); + // Called on already created and initialized function where attributes already + // set from command line attributes but some might need to be removed as the + // actual BPI is different. + if (BPI.SignReturnAddr != LangOptions::SignReturnAddressScopeKind::None) { + F.addFnAttr("sign-return-address", BPI.getSignReturnAddrStr()); + F.addFnAttr("sign-return-address-key", BPI.getSignKeyStr()); + } else { + if (F.hasFnAttribute("sign-return-address")) + F.removeFnAttr("sign-return-address"); + if (F.hasFnAttribute("sign-return-address-key")) + F.removeFnAttr("sign-return-address-key"); + } + + auto AddRemoveAttributeAsSet = [&](bool Set, const StringRef &ModAttr) { + if (Set) + F.addFnAttr(ModAttr); + else if (F.hasFnAttribute(ModAttr)) + F.removeFnAttr(ModAttr); + }; + + AddRemoveAttributeAsSet(BPI.BranchTargetEnforcement, + "branch-target-enforcement"); + AddRemoveAttributeAsSet(BPI.BranchProtectionPAuthLR, + "branch-protection-pauth-lr"); + AddRemoveAttributeAsSet(BPI.GuardedControlStack, "guarded-control-stack"); } -void TargetCodeGenInfo::setBranchProtectionFnAttributes( +void TargetCodeGenInfo::initBranchProtectionFnAttributes( const TargetInfo::BranchProtectionInfo &BPI, llvm::AttrBuilder &FuncAttrs) { + // Only used for initializing attributes in the AttrBuilder, which will not + // contain any of these attributes so no need to remove anything. if (BPI.SignReturnAddr != LangOptions::SignReturnAddressScopeKind::None) { FuncAttrs.addAttribute("sign-return-address", BPI.getSignReturnAddrStr()); FuncAttrs.addAttribute("sign-return-address-key", BPI.getSignKeyStr()); diff --git a/clang/lib/CodeGen/TargetInfo.h b/clang/lib/CodeGen/TargetInfo.h index 2f2138582ba1e..156b4ff4353be 100644 --- a/clang/lib/CodeGen/TargetInfo.h +++ b/clang/lib/CodeGen/TargetInfo.h @@ -414,13 +414,16 @@ class TargetCodeGenInfo { return nullptr; } + // Set the Branch Protection Attributes of the Function accordingly to the + // BPI. Remove attributes that contradict with current BPI. static void setBranchProtectionFnAttributes(const TargetInfo::BranchProtectionInfo &BPI, llvm::Function &F); + // Add the Branch Protection Attributes of the FuncAttrs. static void - setBranchProtectionFnAttributes(const TargetInfo::BranchProtectionInfo &BPI, - llvm::AttrBuilder &FuncAttrs); + initBranchProtectionFnAttributes(const TargetInfo::BranchProtectionInfo &BPI, + llvm::AttrBuilder &FuncAttrs); protected: static std::string qualifyWindowsLibrary(StringRef Lib); diff --git a/clang/lib/CodeGen/Targets/AArch64.cpp b/clang/lib/CodeGen/Targets/AArch64.cpp index b9df54b0c67c4..97381f673c284 100644 --- a/clang/lib/CodeGen/Targets/AArch64.cpp +++ b/clang/lib/CodeGen/Targets/AArch64.cpp @@ -840,12 +840,13 @@ static bool isStreamingCompatible(const FunctionDecl *F) { static void diagnoseIfNeedsFPReg(DiagnosticsEngine &Diags, const StringRef ABIName, const AArch64ABIInfo &ABIInfo, - const QualType &Ty, const NamedDecl *D) { + const QualType &Ty, const NamedDecl *D, + SourceLocation loc) { const Type *HABase = nullptr; uint64_t HAMembers = 0; if (Ty->isFloatingType() || Ty->isVectorType() || ABIInfo.isHomogeneousAggregate(Ty, HABase, HAMembers)) { - Diags.Report(D->getLocation(), diag::err_target_unsupported_type_for_abi) + Diags.Report(loc, diag::err_target_unsupported_type_for_abi) << D->getDeclName() << Ty << ABIName; } } @@ -860,10 +861,11 @@ void AArch64TargetCodeGenInfo::checkFunctionABI( if (!TI.hasFeature("fp") && !ABIInfo.isSoftFloat()) { diagnoseIfNeedsFPReg(CGM.getDiags(), TI.getABI(), ABIInfo, - FuncDecl->getReturnType(), FuncDecl); + FuncDecl->getReturnType(), FuncDecl, + FuncDecl->getLocation()); for (ParmVarDecl *PVD : FuncDecl->parameters()) { diagnoseIfNeedsFPReg(CGM.getDiags(), TI.getABI(), ABIInfo, PVD->getType(), - PVD); + PVD, FuncDecl->getLocation()); } } } @@ -883,8 +885,10 @@ void AArch64TargetCodeGenInfo::checkFunctionCallABIStreaming( if (!CalleeIsStreamingCompatible && (CallerIsStreaming != CalleeIsStreaming || CallerIsStreamingCompatible)) - CGM.getDiags().Report(CallLoc, - diag::err_function_always_inline_attribute_mismatch) + CGM.getDiags().Report( + CallLoc, CalleeIsStreaming + ? diag::err_function_always_inline_attribute_mismatch + : diag::warn_function_always_inline_attribute_mismatch) << Caller->getDeclName() << Callee->getDeclName() << "streaming"; if (auto *NewAttr = Callee->getAttr()) if (NewAttr->isNewZA()) @@ -906,11 +910,11 @@ void AArch64TargetCodeGenInfo::checkFunctionCallABISoftFloat( return; diagnoseIfNeedsFPReg(CGM.getDiags(), TI.getABI(), ABIInfo, ReturnType, - Caller); + Callee ? Callee : Caller, CallLoc); for (const CallArg &Arg : Args) diagnoseIfNeedsFPReg(CGM.getDiags(), TI.getABI(), ABIInfo, Arg.getType(), - Caller); + Callee ? Callee : Caller, CallLoc); } void AArch64TargetCodeGenInfo::checkFunctionCallABI(CodeGenModule &CGM, diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp index fb780fb75651d..b04502a57a9f7 100644 --- a/clang/lib/Driver/ToolChains/AIX.cpp +++ b/clang/lib/Driver/ToolChains/AIX.cpp @@ -557,12 +557,6 @@ void AIX::addClangTargetOptions( if (!Args.getLastArgNoClaim(options::OPT_fsized_deallocation, options::OPT_fno_sized_deallocation)) CC1Args.push_back("-fno-sized-deallocation"); - - if (Args.hasFlag(options::OPT_ferr_pragma_mc_func_aix, - options::OPT_fno_err_pragma_mc_func_aix, false)) - CC1Args.push_back("-ferr-pragma-mc-func-aix"); - else - CC1Args.push_back("-fno-err-pragma-mc-func-aix"); } void AIX::addProfileRTLibs(const llvm::opt::ArgList &Args, diff --git a/clang/lib/Driver/ToolChains/Arch/PPC.cpp b/clang/lib/Driver/ToolChains/Arch/PPC.cpp index 634c096523319..acd5757d6ea97 100644 --- a/clang/lib/Driver/ToolChains/Arch/PPC.cpp +++ b/clang/lib/Driver/ToolChains/Arch/PPC.cpp @@ -70,6 +70,7 @@ static std::string normalizeCPUName(StringRef CPUName, const llvm::Triple &T) { .Case("power8", "pwr8") .Case("power9", "pwr9") .Case("power10", "pwr10") + .Case("power11", "pwr11") .Case("future", "future") .Case("powerpc", "ppc") .Case("powerpc64", "ppc64") @@ -103,6 +104,8 @@ const char *ppc::getPPCAsmModeForCPU(StringRef Name) { .Case("power9", "-mpower9") .Case("pwr10", "-mpower10") .Case("power10", "-mpower10") + .Case("pwr11", "-mpower11") + .Case("power11", "-mpower11") .Default("-many"); } diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 78936fd634f33..366b147a052bf 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1516,6 +1516,10 @@ static void handlePAuthABI(const ArgList &DriverArgs, ArgStringList &CC1Args) { options::OPT_fno_ptrauth_vtable_pointer_type_discrimination)) CC1Args.push_back("-fptrauth-vtable-pointer-type-discrimination"); + if (!DriverArgs.hasArg(options::OPT_fptrauth_indirect_gotos, + options::OPT_fno_ptrauth_indirect_gotos)) + CC1Args.push_back("-fptrauth-indirect-gotos"); + if (!DriverArgs.hasArg(options::OPT_fptrauth_init_fini, options::OPT_fno_ptrauth_init_fini)) CC1Args.push_back("-fptrauth-init-fini"); @@ -1843,6 +1847,9 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args, Args.addOptInFlag( CmdArgs, options::OPT_fptrauth_vtable_pointer_type_discrimination, options::OPT_fno_ptrauth_vtable_pointer_type_discrimination); + Args.addOptInFlag( + CmdArgs, options::OPT_fptrauth_type_info_vtable_pointer_discrimination, + options::OPT_fno_ptrauth_type_info_vtable_pointer_discrimination); Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_init_fini, options::OPT_fno_ptrauth_init_fini); Args.addOptInFlag( diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp index 59453c484ae4f..61d12b10dfb62 100644 --- a/clang/lib/Driver/ToolChains/Cuda.cpp +++ b/clang/lib/Driver/ToolChains/Cuda.cpp @@ -609,6 +609,10 @@ void NVPTX::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back(Args.MakeArgString( "--pxtas-path=" + Args.getLastArgValue(options::OPT_ptxas_path_EQ))); + if (Args.hasArg(options::OPT_cuda_path_EQ)) + CmdArgs.push_back(Args.MakeArgString( + "--cuda-path=" + Args.getLastArgValue(options::OPT_cuda_path_EQ))); + // Add paths specified in LIBRARY_PATH environment variable as -L options. addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH"); diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp index c6f9d7beffb1d..e576efaf5ca88 100644 --- a/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/clang/lib/Driver/ToolChains/Darwin.cpp @@ -2923,22 +2923,53 @@ bool Darwin::isAlignedAllocationUnavailable() const { return TargetVersion < alignedAllocMinVersion(OS); } -static bool sdkSupportsBuiltinModules(const Darwin::DarwinPlatformKind &TargetPlatform, const std::optional &SDKInfo) { +static bool sdkSupportsBuiltinModules( + const Darwin::DarwinPlatformKind &TargetPlatform, + const Darwin::DarwinEnvironmentKind &TargetEnvironment, + const std::optional &SDKInfo) { + if (TargetEnvironment == Darwin::NativeEnvironment || + TargetEnvironment == Darwin::Simulator || + TargetEnvironment == Darwin::MacCatalyst) { + // Standard xnu/Mach/Darwin based environments + // depend on the SDK version. + } else { + // All other environments support builtin modules from the start. + return true; + } + if (!SDKInfo) + // If there is no SDK info, assume this is building against a + // pre-SDK version of macOS (i.e. before Mac OS X 10.4). Those + // don't support modules anyway, but the headers definitely + // don't support builtin modules either. It might also be some + // kind of degenerate build environment, err on the side of + // the old behavior which is to not use builtin modules. return false; VersionTuple SDKVersion = SDKInfo->getVersion(); switch (TargetPlatform) { + // Existing SDKs added support for builtin modules in the fall + // 2024 major releases. case Darwin::MacOS: - return SDKVersion >= VersionTuple(99U); + return SDKVersion >= VersionTuple(15U); case Darwin::IPhoneOS: - return SDKVersion >= VersionTuple(99U); + switch (TargetEnvironment) { + case Darwin::MacCatalyst: + // Mac Catalyst uses `-target arm64-apple-ios18.0-macabi` so the platform + // is iOS, but it builds with the macOS SDK, so it's the macOS SDK version + // that's relevant. + return SDKVersion >= VersionTuple(15U); + default: + return SDKVersion >= VersionTuple(18U); + } case Darwin::TvOS: - return SDKVersion >= VersionTuple(99U); + return SDKVersion >= VersionTuple(18U); case Darwin::WatchOS: - return SDKVersion >= VersionTuple(99U); + return SDKVersion >= VersionTuple(11U); case Darwin::XROS: - return SDKVersion >= VersionTuple(99U); + return SDKVersion >= VersionTuple(2U); + + // New SDKs support builtin modules from the start. default: return true; } @@ -3030,7 +3061,7 @@ void Darwin::addClangTargetOptions( // i.e. when the builtin stdint.h is in the Darwin module too, the cycle // goes away. Note that -fbuiltin-headers-in-system-modules does nothing // to fix the same problem with C++ headers, and is generally fragile. - if (!sdkSupportsBuiltinModules(TargetPlatform, SDKInfo)) + if (!sdkSupportsBuiltinModules(TargetPlatform, TargetEnvironment, SDKInfo)) CC1Args.push_back("-fbuiltin-headers-in-system-modules"); if (!DriverArgs.hasArgNoClaim(options::OPT_fdefine_target_os_macros, diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index 52c2ee90b1b28..543f3965dfd4f 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -2463,7 +2463,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( // lists should shrink over time. Please don't add more elements to *Triples. static const char *const AArch64LibDirs[] = {"/lib64", "/lib"}; static const char *const AArch64Triples[] = { - "aarch64-none-linux-gnu", "aarch64-redhat-linux", "aarch64-suse-linux"}; + "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux", + "aarch64-suse-linux"}; static const char *const AArch64beLibDirs[] = {"/lib"}; static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu"}; diff --git a/clang/lib/Driver/Types.cpp b/clang/lib/Driver/Types.cpp index a7b6b9000e1d2..2b9b391c19c9f 100644 --- a/clang/lib/Driver/Types.cpp +++ b/clang/lib/Driver/Types.cpp @@ -242,7 +242,9 @@ bool types::isCXX(ID Id) { case TY_CXXHUHeader: case TY_PP_CXXHeaderUnit: case TY_ObjCXXHeader: case TY_PP_ObjCXXHeader: - case TY_CXXModule: case TY_PP_CXXModule: + case TY_CXXModule: + case TY_PP_CXXModule: + case TY_ModuleFile: case TY_PP_CLCXX: case TY_CUDA: case TY_PP_CUDA: case TY_CUDA_DEVICE: case TY_HIP: diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index b07360425ca6e..7d89f0e63dd22 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -842,10 +842,8 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, CurrentState.ContainsUnwrappedBuilder = true; } - if (Current.is(TT_TrailingReturnArrow) && - Style.Language == FormatStyle::LK_Java) { + if (Current.is(TT_LambdaArrow) && Style.Language == FormatStyle::LK_Java) CurrentState.NoLineBreak = true; - } if (Current.isMemberAccess() && Previous.is(tok::r_paren) && (Previous.MatchingParen && (Previous.TotalLength - Previous.MatchingParen->TotalLength > 10))) { @@ -1000,7 +998,7 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State, // // is common and should be formatted like a free-standing function. The same // goes for wrapping before the lambda return type arrow. - if (Current.isNot(TT_TrailingReturnArrow) && + if (Current.isNot(TT_LambdaArrow) && (!Style.isJavaScript() || Current.NestingLevel != 0 || !PreviousNonComment || PreviousNonComment->isNot(tok::equal) || !Current.isOneOf(Keywords.kw_async, Keywords.kw_function))) { @@ -1257,7 +1255,7 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) { } return CurrentState.Indent; } - if (Current.is(TT_TrailingReturnArrow) && + if (Current.is(TT_LambdaArrow) && Previous.isOneOf(tok::kw_noexcept, tok::kw_mutable, tok::kw_constexpr, tok::kw_consteval, tok::kw_static, TT_AttributeSquare)) { return ContinuationIndent; @@ -1590,7 +1588,7 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State, } if (Current.isOneOf(TT_BinaryOperator, TT_ConditionalExpr) && Newline) CurrentState.NestedBlockIndent = State.Column + Current.ColumnWidth + 1; - if (Current.isOneOf(TT_LambdaLSquare, TT_TrailingReturnArrow)) + if (Current.isOneOf(TT_LambdaLSquare, TT_LambdaArrow)) CurrentState.LastSpace = State.Column; if (Current.is(TT_RequiresExpression) && Style.RequiresExpressionIndentation == FormatStyle::REI_Keyword) { diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h index cc45d5a8c5c1e..9bfeb2052164e 100644 --- a/clang/lib/Format/FormatToken.h +++ b/clang/lib/Format/FormatToken.h @@ -102,6 +102,7 @@ namespace format { TYPE(JsTypeColon) \ TYPE(JsTypeOperator) \ TYPE(JsTypeOptionalQuestion) \ + TYPE(LambdaArrow) \ TYPE(LambdaLBrace) \ TYPE(LambdaLSquare) \ TYPE(LeadingJavaAnnotation) \ @@ -725,7 +726,7 @@ struct FormatToken { bool isMemberAccess() const { return isOneOf(tok::arrow, tok::period, tok::arrowstar) && !isOneOf(TT_DesignatedInitializerPeriod, TT_TrailingReturnArrow, - TT_LeadingJavaAnnotation); + TT_LambdaArrow, TT_LeadingJavaAnnotation); } bool isPointerOrReference() const { diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 21924a8fe17d1..3f00a28e62988 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -154,8 +154,8 @@ class AnnotatingParser { if (NonTemplateLess.count(CurrentToken->Previous) > 0) return false; - const FormatToken &Previous = *CurrentToken->Previous; // The '<'. - if (Previous.Previous) { + if (const auto &Previous = *CurrentToken->Previous; // The '<'. + Previous.Previous) { if (Previous.Previous->Tok.isLiteral()) return false; if (Previous.Previous->is(tok::r_brace)) @@ -175,11 +175,13 @@ class AnnotatingParser { FormatToken *Left = CurrentToken->Previous; Left->ParentBracket = Contexts.back().ContextKind; ScopedContextCreator ContextCreator(*this, tok::less, 12); - Contexts.back().IsExpression = false; + + const auto *BeforeLess = Left->Previous; + // If there's a template keyword before the opening angle bracket, this is a // template parameter, not an argument. - if (Left->Previous && Left->Previous->isNot(tok::kw_template)) + if (BeforeLess && BeforeLess->isNot(tok::kw_template)) Contexts.back().ContextType = Context::TemplateArgument; if (Style.Language == FormatStyle::LK_Java && @@ -187,19 +189,24 @@ class AnnotatingParser { next(); } - while (CurrentToken) { + for (bool SeenTernaryOperator = false; CurrentToken;) { + const bool InExpr = Contexts[Contexts.size() - 2].IsExpression; if (CurrentToken->is(tok::greater)) { + const auto *Next = CurrentToken->Next; // Try to do a better job at looking for ">>" within the condition of // a statement. Conservatively insert spaces between consecutive ">" // tokens to prevent splitting right bitshift operators and potentially // altering program semantics. This check is overly conservative and // will prevent spaces from being inserted in select nested template // parameter cases, but should not alter program semantics. - if (CurrentToken->Next && CurrentToken->Next->is(tok::greater) && + if (Next && Next->is(tok::greater) && Left->ParentBracket != tok::less && CurrentToken->getStartOfNonWhitespace() == - CurrentToken->Next->getStartOfNonWhitespace().getLocWithOffset( - -1)) { + Next->getStartOfNonWhitespace().getLocWithOffset(-1)) { + return false; + } + if (InExpr && SeenTernaryOperator && + (!Next || !Next->isOneOf(tok::l_paren, tok::l_brace))) { return false; } Left->MatchingParen = CurrentToken; @@ -210,14 +217,14 @@ class AnnotatingParser { // msg: < item: data > // In TT_TextProto, map does not occur. if (Style.Language == FormatStyle::LK_TextProto || - (Style.Language == FormatStyle::LK_Proto && Left->Previous && - Left->Previous->isOneOf(TT_SelectorName, TT_DictLiteral))) { + (Style.Language == FormatStyle::LK_Proto && BeforeLess && + BeforeLess->isOneOf(TT_SelectorName, TT_DictLiteral))) { CurrentToken->setType(TT_DictLiteral); } else { CurrentToken->setType(TT_TemplateCloser); CurrentToken->Tok.setLength(1); } - if (CurrentToken->Next && CurrentToken->Next->Tok.isLiteral()) + if (Next && Next->Tok.isLiteral()) return false; next(); return true; @@ -229,18 +236,21 @@ class AnnotatingParser { } if (CurrentToken->isOneOf(tok::r_paren, tok::r_square, tok::r_brace)) return false; + const auto &Prev = *CurrentToken->Previous; // If a && or || is found and interpreted as a binary operator, this set // of angles is likely part of something like "a < b && c > d". If the // angles are inside an expression, the ||/&& might also be a binary // operator that was misinterpreted because we are parsing template // parameters. // FIXME: This is getting out of hand, write a decent parser. - if (CurrentToken->Previous->isOneOf(tok::pipepipe, tok::ampamp) && - CurrentToken->Previous->is(TT_BinaryOperator) && - Contexts[Contexts.size() - 2].IsExpression && - !Line.startsWith(tok::kw_template)) { - return false; + if (InExpr && !Line.startsWith(tok::kw_template) && + Prev.is(TT_BinaryOperator)) { + const auto Precedence = Prev.getPrecedence(); + if (Precedence > prec::Conditional && Precedence < prec::Relational) + return false; } + if (Prev.isOneOf(tok::question, tok::colon) && !Style.isProto()) + SeenTernaryOperator = true; updateParameterCount(Left, CurrentToken); if (Style.Language == FormatStyle::LK_Proto) { if (FormatToken *Previous = CurrentToken->getPreviousNonComment()) { @@ -372,6 +382,10 @@ class AnnotatingParser { OpeningParen.Previous->is(tok::kw__Generic)) { Contexts.back().ContextType = Context::C11GenericSelection; Contexts.back().IsExpression = true; + } else if (Line.InPPDirective && + (!OpeningParen.Previous || + OpeningParen.Previous->isNot(tok::identifier))) { + Contexts.back().IsExpression = true; } else if (Contexts[Contexts.size() - 2].CaretFound) { // This is the parameter list of an ObjC block. Contexts.back().IsExpression = false; @@ -384,20 +398,7 @@ class AnnotatingParser { OpeningParen.Previous->MatchingParen->isOneOf( TT_ObjCBlockLParen, TT_FunctionTypeLParen)) { Contexts.back().IsExpression = false; - } else if (Line.InPPDirective) { - auto IsExpr = [&OpeningParen] { - const auto *Tok = OpeningParen.Previous; - if (!Tok || Tok->isNot(tok::identifier)) - return true; - Tok = Tok->Previous; - while (Tok && Tok->endsSequence(tok::coloncolon, tok::identifier)) { - assert(Tok->Previous); - Tok = Tok->Previous->Previous; - } - return !Tok || !Tok->Tok.getIdentifierInfo(); - }; - Contexts.back().IsExpression = IsExpr(); - } else if (!Line.MustBeDeclaration) { + } else if (!Line.MustBeDeclaration && !Line.InPPDirective) { bool IsForOrCatch = OpeningParen.Previous && OpeningParen.Previous->isOneOf(tok::kw_for, tok::kw_catch); @@ -830,7 +831,7 @@ class AnnotatingParser { } // An arrow after an ObjC method expression is not a lambda arrow. if (CurrentToken->is(TT_ObjCMethodExpr) && CurrentToken->Next && - CurrentToken->Next->is(TT_TrailingReturnArrow)) { + CurrentToken->Next->is(TT_LambdaArrow)) { CurrentToken->Next->overwriteFixedType(TT_Unknown); } Left->MatchingParen = CurrentToken; @@ -1768,8 +1769,10 @@ class AnnotatingParser { } break; case tok::arrow: - if (Tok->Previous && Tok->Previous->is(tok::kw_noexcept)) + if (Tok->isNot(TT_LambdaArrow) && Tok->Previous && + Tok->Previous->is(tok::kw_noexcept)) { Tok->setType(TT_TrailingReturnArrow); + } break; case tok::equal: // In TableGen, there must be a value after "="; @@ -2055,11 +2058,11 @@ class AnnotatingParser { TT_LambdaLSquare, TT_LambdaLBrace, TT_AttributeMacro, TT_IfMacro, TT_ForEachMacro, TT_TypenameMacro, TT_FunctionLBrace, TT_ImplicitStringLiteral, TT_InlineASMBrace, TT_FatArrow, - TT_NamespaceMacro, TT_OverloadedOperator, TT_RegexLiteral, - TT_TemplateString, TT_ObjCStringLiteral, TT_UntouchableMacroFunc, - TT_StatementAttributeLikeMacro, TT_FunctionLikeOrFreestandingMacro, - TT_ClassLBrace, TT_EnumLBrace, TT_RecordLBrace, TT_StructLBrace, - TT_UnionLBrace, TT_RequiresClause, + TT_LambdaArrow, TT_NamespaceMacro, TT_OverloadedOperator, + TT_RegexLiteral, TT_TemplateString, TT_ObjCStringLiteral, + TT_UntouchableMacroFunc, TT_StatementAttributeLikeMacro, + TT_FunctionLikeOrFreestandingMacro, TT_ClassLBrace, TT_EnumLBrace, + TT_RecordLBrace, TT_StructLBrace, TT_UnionLBrace, TT_RequiresClause, TT_RequiresClauseInARequiresExpression, TT_RequiresExpression, TT_RequiresExpressionLParen, TT_RequiresExpressionLBrace, TT_BracedListLBrace)) { @@ -2245,7 +2248,7 @@ class AnnotatingParser { Contexts.back().IsExpression = true; } else if (Current.is(TT_TrailingReturnArrow)) { Contexts.back().IsExpression = false; - } else if (Current.is(Keywords.kw_assert)) { + } else if (Current.isOneOf(TT_LambdaArrow, Keywords.kw_assert)) { Contexts.back().IsExpression = Style.Language == FormatStyle::LK_Java; } else if (Current.Previous && Current.Previous->is(TT_CtorInitializerColon)) { @@ -2380,7 +2383,7 @@ class AnnotatingParser { AutoFound = true; } else if (Current.is(tok::arrow) && Style.Language == FormatStyle::LK_Java) { - Current.setType(TT_TrailingReturnArrow); + Current.setType(TT_LambdaArrow); } else if (Current.is(tok::arrow) && Style.isVerilog()) { // The implication operator. Current.setType(TT_BinaryOperator); @@ -2871,9 +2874,20 @@ class AnnotatingParser { return false; // Search for unexpected tokens. - for (auto *Prev = BeforeRParen; Prev != LParen; Prev = Prev->Previous) + for (auto *Prev = BeforeRParen; Prev != LParen; Prev = Prev->Previous) { + if (Prev->is(tok::r_paren)) { + if (Prev->is(TT_CastRParen)) + return false; + Prev = Prev->MatchingParen; + if (!Prev) + return false; + if (Prev->is(TT_FunctionTypeLParen)) + break; + continue; + } if (!Prev->isOneOf(tok::kw_const, tok::identifier, tok::coloncolon)) return false; + } return true; } @@ -3266,7 +3280,7 @@ class ExpressionParser { } if (Current->is(TT_JsComputedPropertyName)) return prec::Assignment; - if (Current->is(TT_TrailingReturnArrow)) + if (Current->is(TT_LambdaArrow)) return prec::Comma; if (Current->is(TT_FatArrow)) return prec::Assignment; @@ -4190,7 +4204,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line, } if (Right.is(TT_PointerOrReference)) return 190; - if (Right.is(TT_TrailingReturnArrow)) + if (Right.is(TT_LambdaArrow)) return 110; if (Left.is(tok::equal) && Right.is(tok::l_brace)) return 160; @@ -4457,10 +4471,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, } if (Left.is(tok::colon)) return Left.isNot(TT_ObjCMethodExpr); - if (Left.is(tok::coloncolon)) { - return Right.is(tok::star) && Right.is(TT_PointerOrReference) && - Style.PointerAlignment != FormatStyle::PAS_Left; - } + if (Left.is(tok::coloncolon)) + return false; if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) { if (Style.Language == FormatStyle::LK_TextProto || (Style.Language == FormatStyle::LK_Proto && @@ -4570,8 +4582,14 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, if (!BeforeLeft) return false; if (BeforeLeft->is(tok::coloncolon)) { - return Left.is(tok::star) && - Style.PointerAlignment != FormatStyle::PAS_Right; + if (Left.isNot(tok::star)) + return false; + assert(Style.PointerAlignment != FormatStyle::PAS_Right); + if (!Right.startsSequence(tok::identifier, tok::r_paren)) + return true; + assert(Right.Next); + const auto *LParen = Right.Next->MatchingParen; + return !LParen || LParen->isNot(TT_FunctionTypeLParen); } return !BeforeLeft->isOneOf(tok::l_paren, tok::l_square); } @@ -5264,9 +5282,10 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, return false; } - if (Right.is(TT_TrailingReturnArrow) || Left.is(TT_TrailingReturnArrow)) + if (Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow) || + Left.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow)) { return true; - + } if (Left.is(tok::comma) && Right.isNot(TT_OverloadedOperatorLParen) && // In an unexpanded macro call we only find the parentheses and commas // in a line; the commas and closing parenthesis do not require a space. @@ -6284,8 +6303,8 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace, tok::kw_class, tok::kw_struct, tok::comment) || Right.isMemberAccess() || - Right.isOneOf(TT_TrailingReturnArrow, tok::lessless, tok::colon, - tok::l_square, tok::at) || + Right.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow, tok::lessless, + tok::colon, tok::l_square, tok::at) || (Left.is(tok::r_paren) && Right.isOneOf(tok::identifier, tok::kw_const)) || (Left.is(tok::l_paren) && Right.isNot(tok::r_paren)) || diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index d406a531a5c0c..7813d86ff0ea1 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -507,6 +507,9 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) { if (!Line->InMacroBody && !Style.isTableGen()) { // Skip PPDirective lines and comments. while (NextTok->is(tok::hash)) { + NextTok = Tokens->getNextToken(); + if (NextTok->is(tok::pp_not_keyword)) + break; do { NextTok = Tokens->getNextToken(); } while (NextTok->NewlinesBefore == 0 && NextTok->isNot(tok::eof)); @@ -567,7 +570,8 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) { NextTok->isOneOf(Keywords.kw_of, Keywords.kw_in, Keywords.kw_as)); ProbablyBracedList = - ProbablyBracedList || (IsCpp && NextTok->is(tok::l_paren)); + ProbablyBracedList || (IsCpp && (PrevTok->Tok.isLiteral() || + NextTok->is(tok::l_paren))); // If there is a comma, semicolon or right paren after the closing // brace, we assume this is a braced initializer list. @@ -2319,7 +2323,7 @@ bool UnwrappedLineParser::tryToParseLambda() { // This might or might not actually be a lambda arrow (this could be an // ObjC method invocation followed by a dereferencing arrow). We might // reset this back to TT_Unknown in TokenAnnotator. - FormatTok->setFinalizedType(TT_TrailingReturnArrow); + FormatTok->setFinalizedType(TT_LambdaArrow); SeenArrow = true; nextToken(); break; @@ -2665,6 +2669,7 @@ void UnwrappedLineParser::parseSquare(bool LambdaIntroducer) { break; } case tok::at: + case tok::colon: nextToken(); if (FormatTok->is(tok::l_brace)) { nextToken(); @@ -3975,6 +3980,9 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) { auto IsNonMacroIdentifier = [](const FormatToken *Tok) { return Tok->is(tok::identifier) && Tok->TokenText != Tok->TokenText.upper(); }; + // JavaScript/TypeScript supports anonymous classes like: + // a = class extends foo { } + bool JSPastExtendsOrImplements = false; // The actual identifier can be a nested name specifier, and in macros // it is often token-pasted. // An [[attribute]] can be before the identifier. @@ -3985,6 +3993,7 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) { FormatTok->isOneOf(tok::period, tok::comma))) { if (Style.isJavaScript() && FormatTok->isOneOf(Keywords.kw_extends, Keywords.kw_implements)) { + JSPastExtendsOrImplements = true; // JavaScript/TypeScript supports inline object types in // extends/implements positions: // class Foo implements {bar: number} { } @@ -4008,10 +4017,11 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) { } break; case tok::coloncolon: + case tok::hashhash: break; default: - if (!ClassName && Previous->is(tok::identifier) && - Previous->isNot(TT_AttributeMacro)) { + if (!JSPastExtendsOrImplements && !ClassName && + Previous->is(tok::identifier) && Previous->isNot(TT_AttributeMacro)) { ClassName = Previous; } } diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp index a31874a7c3195..fd4a40a86082e 100644 --- a/clang/lib/Format/WhitespaceManager.cpp +++ b/clang/lib/Format/WhitespaceManager.cpp @@ -469,7 +469,9 @@ AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End, // except if the token is equal, then a space is needed. if ((Style.PointerAlignment == FormatStyle::PAS_Right || Style.ReferenceAlignment == FormatStyle::RAS_Right) && - CurrentChange.Spaces != 0 && CurrentChange.Tok->isNot(tok::equal)) { + CurrentChange.Spaces != 0 && + !CurrentChange.Tok->isOneOf(tok::equal, tok::r_paren, + TT_TemplateCloser)) { const bool ReferenceNotRightAligned = Style.ReferenceAlignment != FormatStyle::RAS_Right && Style.ReferenceAlignment != FormatStyle::RAS_Pointer; diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index f6b6c44a4cab6..028fdb2cc6b9d 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1504,6 +1504,8 @@ void CompilerInvocation::setDefaultPointerAuthOptions( Opts.CXXMemberFunctionPointers = PointerAuthSchema(Key::ASIA, false, Discrimination::Type); } + Opts.ReturnAddresses = LangOpts.PointerAuthReturns; + Opts.AuthTraps = LangOpts.PointerAuthAuthTraps; Opts.IndirectGotos = LangOpts.PointerAuthIndirectGotos; } @@ -1511,7 +1513,8 @@ static void parsePointerAuthOptions(PointerAuthOptions &Opts, const LangOptions &LangOpts, const llvm::Triple &Triple, DiagnosticsEngine &Diags) { - if (!LangOpts.PointerAuthCalls && !LangOpts.PointerAuthIndirectGotos) + if (!LangOpts.PointerAuthCalls && !LangOpts.PointerAuthReturns && + !LangOpts.PointerAuthAuthTraps && !LangOpts.PointerAuthIndirectGotos) return; CompilerInvocation::setDefaultPointerAuthOptions(Opts, LangOpts, Triple); diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 920ddf7e59913..3ed7243deba8a 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -763,6 +763,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, Builder.defineMacro("__cpp_placeholder_variables", "202306L"); // C++26 features supported in earlier language modes. + Builder.defineMacro("__cpp_pack_indexing", "202311L"); Builder.defineMacro("__cpp_deleted_function", "202403L"); if (LangOpts.Char8) diff --git a/clang/lib/Headers/emmintrin.h b/clang/lib/Headers/emmintrin.h index e85bfc47aa5cc..4dff6421350c0 100644 --- a/clang/lib/Headers/emmintrin.h +++ b/clang/lib/Headers/emmintrin.h @@ -1771,7 +1771,7 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_undefined_pd(void) { /// lower 64 bits contain the value of the parameter. The upper 64 bits are /// set to zero. static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_set_sd(double __w) { - return __extension__(__m128d){__w, 0}; + return __extension__(__m128d){__w, 0.0}; } /// Constructs a 128-bit floating-point vector of [2 x double], with each diff --git a/clang/lib/Headers/ptrauth.h b/clang/lib/Headers/ptrauth.h index e0bc8c4f9acf7..154b599862a8e 100644 --- a/clang/lib/Headers/ptrauth.h +++ b/clang/lib/Headers/ptrauth.h @@ -28,6 +28,12 @@ typedef enum { /* A process-specific key which can be used to sign data pointers. */ ptrauth_key_process_dependent_data = ptrauth_key_asdb, + /* The key used to sign return addresses on the stack. + The extra data is based on the storage address of the return address. + On AArch64, that is always the storage address of the return address + 8 + (or, in other words, the value of the stack pointer on function entry) */ + ptrauth_key_return_address = ptrauth_key_process_dependent_code, + /* The key used to sign C function pointers. The extra data is always 0. */ ptrauth_key_function_pointer = ptrauth_key_process_independent_code, @@ -202,6 +208,23 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t; #define ptrauth_string_discriminator(__string) \ __builtin_ptrauth_string_discriminator(__string) +/* Compute a constant discriminator from the given type. + + The result can be used as the second argument to + ptrauth_blend_discriminator or the third argument to the + __ptrauth qualifier. It has type size_t. + + If the type is a C++ member function pointer type, the result is + the discriminator used to signed member function pointers of that + type. If the type is a function, function pointer, or function + reference type, the result is the discriminator used to sign + functions of that type. It is ill-formed to use this macro with any + other type. + + A call to this function is an integer constant expression. */ +#define ptrauth_type_discriminator(__type) \ + __builtin_ptrauth_type_discriminator(__type) + /* Compute a signature for the given pair of pointer-sized values. The order of the arguments is significant. @@ -289,6 +312,8 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t; ((ptrauth_extra_data_t)0); \ }) +#define ptrauth_type_discriminator(__type) ((ptrauth_extra_data_t)0) + #define ptrauth_sign_generic_data(__value, __data) \ ({ \ (void)__value; \ diff --git a/clang/lib/Headers/stdarg.h b/clang/lib/Headers/stdarg.h index 8292ab907becf..6203d7a600a23 100644 --- a/clang/lib/Headers/stdarg.h +++ b/clang/lib/Headers/stdarg.h @@ -20,19 +20,18 @@ * modules. */ #if defined(__MVS__) && __has_include_next() -#include <__stdarg_header_macro.h> #undef __need___va_list #undef __need_va_list #undef __need_va_arg #undef __need___va_copy #undef __need_va_copy +#include <__stdarg_header_macro.h> #include_next #else #if !defined(__need___va_list) && !defined(__need_va_list) && \ !defined(__need_va_arg) && !defined(__need___va_copy) && \ !defined(__need_va_copy) -#include <__stdarg_header_macro.h> #define __need___va_list #define __need_va_list #define __need_va_arg @@ -45,6 +44,7 @@ !defined(__STRICT_ANSI__) #define __need_va_copy #endif +#include <__stdarg_header_macro.h> #endif #ifdef __need___va_list diff --git a/clang/lib/Headers/stdatomic.h b/clang/lib/Headers/stdatomic.h index 2027055f38796..1991351f9e9ef 100644 --- a/clang/lib/Headers/stdatomic.h +++ b/clang/lib/Headers/stdatomic.h @@ -172,7 +172,11 @@ typedef _Atomic(uintmax_t) atomic_uintmax_t; typedef struct atomic_flag { atomic_bool _Value; } atomic_flag; +#ifdef __cplusplus +#define ATOMIC_FLAG_INIT {false} +#else #define ATOMIC_FLAG_INIT { 0 } +#endif /* These should be provided by the libc implementation. */ #ifdef __cplusplus diff --git a/clang/lib/Headers/stddef.h b/clang/lib/Headers/stddef.h index 8985c526e8fc5..99b275aebf5aa 100644 --- a/clang/lib/Headers/stddef.h +++ b/clang/lib/Headers/stddef.h @@ -20,7 +20,6 @@ * modules. */ #if defined(__MVS__) && __has_include_next() -#include <__stddef_header_macro.h> #undef __need_ptrdiff_t #undef __need_size_t #undef __need_rsize_t @@ -31,6 +30,7 @@ #undef __need_max_align_t #undef __need_offsetof #undef __need_wint_t +#include <__stddef_header_macro.h> #include_next #else @@ -40,7 +40,6 @@ !defined(__need_NULL) && !defined(__need_nullptr_t) && \ !defined(__need_unreachable) && !defined(__need_max_align_t) && \ !defined(__need_offsetof) && !defined(__need_wint_t) -#include <__stddef_header_macro.h> #define __need_ptrdiff_t #define __need_size_t /* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is @@ -49,7 +48,24 @@ #define __need_rsize_t #endif #define __need_wchar_t +#if !defined(__STDDEF_H) || __has_feature(modules) +/* + * __stddef_null.h is special when building without modules: if __need_NULL is + * set, then it will unconditionally redefine NULL. To avoid stepping on client + * definitions of NULL, __need_NULL should only be set the first time this + * header is included, that is when __STDDEF_H is not defined. However, when + * building with modules, this header is a textual header and needs to + * unconditionally include __stdef_null.h to support multiple submodules + * exporting _Builtin_stddef.null. Take module SM with submodules A and B, whose + * headers both include stddef.h When SM.A builds, __STDDEF_H will be defined. + * When SM.B builds, the definition from SM.A will leak when building without + * local submodule visibility. stddef.h wouldn't include __stddef_null.h, and + * SM.B wouldn't import _Builtin_stddef.null, and SM.B's `export *` wouldn't + * export NULL as expected. When building with modules, always include + * __stddef_null.h so that everything works as expected. + */ #define __need_NULL +#endif #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \ defined(__cplusplus) #define __need_nullptr_t @@ -65,6 +81,7 @@ /* wint_t is provided by and not . It's here * for compatibility, but must be explicitly requested. Therefore * __need_wint_t is intentionally not defined here. */ +#include <__stddef_header_macro.h> #endif #if defined(__need_ptrdiff_t) diff --git a/clang/lib/Headers/xmmintrin.h b/clang/lib/Headers/xmmintrin.h index 1ef89de9c9f56..6fb27297af927 100644 --- a/clang/lib/Headers/xmmintrin.h +++ b/clang/lib/Headers/xmmintrin.h @@ -1910,7 +1910,7 @@ _mm_undefined_ps(void) static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_set_ss(float __w) { - return __extension__ (__m128){ __w, 0, 0, 0 }; + return __extension__ (__m128){ __w, 0.0f, 0.0f, 0.0f }; } /// Constructs a 128-bit floating-point vector of [4 x float], with each diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index a12c375c8d48c..e82b565272831 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -763,6 +763,9 @@ class CastExpressionIdValidator final : public CorrectionCandidateCallback { bool Parser::isRevertibleTypeTrait(const IdentifierInfo *II, tok::TokenKind *Kind) { if (RevertibleTypeTraits.empty()) { +// Revertible type trait is a feature for backwards compatibility with older +// standard libraries that declare their own structs with the same name as +// the builtins listed below. New builtins should NOT be added to this list. #define RTT_JOIN(X, Y) X##Y #define REVERTIBLE_TYPE_TRAIT(Name) \ RevertibleTypeTraits[PP.getIdentifierInfo(#Name)] = RTT_JOIN(tok::kw_, Name) @@ -790,7 +793,6 @@ bool Parser::isRevertibleTypeTrait(const IdentifierInfo *II, REVERTIBLE_TYPE_TRAIT(__is_fundamental); REVERTIBLE_TYPE_TRAIT(__is_integral); REVERTIBLE_TYPE_TRAIT(__is_interface_class); - REVERTIBLE_TYPE_TRAIT(__is_layout_compatible); REVERTIBLE_TYPE_TRAIT(__is_literal); REVERTIBLE_TYPE_TRAIT(__is_lvalue_expr); REVERTIBLE_TYPE_TRAIT(__is_lvalue_reference); @@ -841,6 +843,26 @@ bool Parser::isRevertibleTypeTrait(const IdentifierInfo *II, return false; } +ExprResult Parser::ParseBuiltinPtrauthTypeDiscriminator() { + SourceLocation Loc = ConsumeToken(); + + BalancedDelimiterTracker T(*this, tok::l_paren); + if (T.expectAndConsume()) + return ExprError(); + + TypeResult Ty = ParseTypeName(); + if (Ty.isInvalid()) { + SkipUntil(tok::r_paren, StopAtSemi); + return ExprError(); + } + + SourceLocation EndLoc = Tok.getLocation(); + T.consumeClose(); + return Actions.ActOnUnaryExprOrTypeTraitExpr( + Loc, UETT_PtrAuthTypeDiscriminator, + /*isType=*/true, Ty.get().getAsOpaquePtr(), SourceRange(Loc, EndLoc)); +} + /// Parse a cast-expression, or, if \pisUnaryExpression is true, parse /// a unary-expression. /// @@ -1806,6 +1828,9 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind, Res = ParseArrayTypeTrait(); break; + case tok::kw___builtin_ptrauth_type_discriminator: + return ParseBuiltinPtrauthTypeDiscriminator(); + case tok::kw___is_lvalue_expr: case tok::kw___is_rvalue_expr: if (NotPrimaryExpression) diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp index aef4ddb758816..cc6f18b5b319f 100644 --- a/clang/lib/Parse/ParsePragma.cpp +++ b/clang/lib/Parse/ParsePragma.cpp @@ -14,7 +14,6 @@ #include "clang/Basic/PragmaKinds.h" #include "clang/Basic/TargetInfo.h" #include "clang/Lex/Preprocessor.h" -#include "clang/Lex/PreprocessorOptions.h" #include "clang/Lex/Token.h" #include "clang/Parse/LoopHint.h" #include "clang/Parse/ParseDiagnostic.h" @@ -412,19 +411,6 @@ struct PragmaRISCVHandler : public PragmaHandler { Sema &Actions; }; -struct PragmaMCFuncHandler : public PragmaHandler { - PragmaMCFuncHandler(bool ReportError) - : PragmaHandler("mc_func"), ReportError(ReportError) {} - void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer, - Token &Tok) override { - if (ReportError) - PP.Diag(Tok, diag::err_pragma_mc_func_not_supported); - } - -private: - bool ReportError = false; -}; - void markAsReinjectedForRelexing(llvm::MutableArrayRef Toks) { for (auto &T : Toks) T.setFlag(clang::Token::IsReinjected); @@ -582,12 +568,6 @@ void Parser::initializePragmaHandlers() { RISCVPragmaHandler = std::make_unique(Actions); PP.AddPragmaHandler("clang", RISCVPragmaHandler.get()); } - - if (getTargetInfo().getTriple().isOSAIX()) { - MCFuncPragmaHandler = std::make_unique( - PP.getPreprocessorOpts().ErrorOnPragmaMcfuncOnAIX); - PP.AddPragmaHandler(MCFuncPragmaHandler.get()); - } } void Parser::resetPragmaHandlers() { @@ -722,11 +702,6 @@ void Parser::resetPragmaHandlers() { PP.RemovePragmaHandler("clang", RISCVPragmaHandler.get()); RISCVPragmaHandler.reset(); } - - if (getTargetInfo().getTriple().isOSAIX()) { - PP.RemovePragmaHandler(MCFuncPragmaHandler.get()); - MCFuncPragmaHandler.reset(); - } } /// Handle the annotation token produced for #pragma unused(...) diff --git a/clang/lib/Sema/CheckExprLifetime.cpp b/clang/lib/Sema/CheckExprLifetime.cpp index 5c8ef564f30aa..112cf3d081822 100644 --- a/clang/lib/Sema/CheckExprLifetime.cpp +++ b/clang/lib/Sema/CheckExprLifetime.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "CheckExprLifetime.h" +#include "clang/AST/Decl.h" #include "clang/AST/Expr.h" #include "clang/Basic/DiagnosticSema.h" #include "clang/Sema/Initialization.h" @@ -548,6 +549,14 @@ static void visitLocalsRetainedByReferenceBinding(IndirectLocalPath &Path, EnableLifetimeWarnings); } + if (auto *M = dyn_cast(Init)) { + // Lifetime of a non-reference type field is same as base object. + if (auto *F = dyn_cast(M->getMemberDecl()); + F && !F->getType()->isReferenceType()) + visitLocalsRetainedByInitializer(Path, M->getBase(), Visit, true, + EnableLifetimeWarnings); + } + if (isa(Init)) { if (EnableLifetimeWarnings) handleGslAnnotatedTypes(Path, Init, Visit); diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 45b9bbb23dbf7..9088b5e285bf8 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -1489,14 +1489,18 @@ enum PointerAuthOpKind { }; } -static bool checkPointerAuthEnabled(Sema &S, Expr *E) { - if (S.getLangOpts().PointerAuthIntrinsics) +bool Sema::checkPointerAuthEnabled(SourceLocation Loc, SourceRange Range) { + if (getLangOpts().PointerAuthIntrinsics) return false; - S.Diag(E->getExprLoc(), diag::err_ptrauth_disabled) << E->getSourceRange(); + Diag(Loc, diag::err_ptrauth_disabled) << Range; return true; } +static bool checkPointerAuthEnabled(Sema &S, Expr *E) { + return S.checkPointerAuthEnabled(E->getExprLoc(), E->getSourceRange()); +} + static bool checkPointerAuthKey(Sema &S, Expr *&Arg) { // Convert it to type 'int'. if (convertArgumentToType(S, Arg, S.Context.IntTy)) @@ -13660,10 +13664,11 @@ void Sema::DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr, //===--- Layout compatibility ----------------------------------------------// -static bool isLayoutCompatible(ASTContext &C, QualType T1, QualType T2); +static bool isLayoutCompatible(const ASTContext &C, QualType T1, QualType T2); /// Check if two enumeration types are layout-compatible. -static bool isLayoutCompatible(ASTContext &C, EnumDecl *ED1, EnumDecl *ED2) { +static bool isLayoutCompatible(const ASTContext &C, const EnumDecl *ED1, + const EnumDecl *ED2) { // C++11 [dcl.enum] p8: // Two enumeration types are layout-compatible if they have the same // underlying type. @@ -13674,8 +13679,8 @@ static bool isLayoutCompatible(ASTContext &C, EnumDecl *ED1, EnumDecl *ED2) { /// Check if two fields are layout-compatible. /// Can be used on union members, which are exempt from alignment requirement /// of common initial sequence. -static bool isLayoutCompatible(ASTContext &C, FieldDecl *Field1, - FieldDecl *Field2, +static bool isLayoutCompatible(const ASTContext &C, const FieldDecl *Field1, + const FieldDecl *Field2, bool AreUnionMembers = false) { [[maybe_unused]] const Type *Field1Parent = Field1->getParent()->getTypeForDecl(); @@ -13718,60 +13723,33 @@ static bool isLayoutCompatible(ASTContext &C, FieldDecl *Field1, /// Check if two standard-layout structs are layout-compatible. /// (C++11 [class.mem] p17) -static bool isLayoutCompatibleStruct(ASTContext &C, RecordDecl *RD1, - RecordDecl *RD2) { - // If both records are C++ classes, check that base classes match. - if (const CXXRecordDecl *D1CXX = dyn_cast(RD1)) { - // If one of records is a CXXRecordDecl we are in C++ mode, - // thus the other one is a CXXRecordDecl, too. - const CXXRecordDecl *D2CXX = cast(RD2); - // Check number of base classes. - if (D1CXX->getNumBases() != D2CXX->getNumBases()) - return false; +static bool isLayoutCompatibleStruct(const ASTContext &C, const RecordDecl *RD1, + const RecordDecl *RD2) { + // Get to the class where the fields are declared + if (const CXXRecordDecl *D1CXX = dyn_cast(RD1)) + RD1 = D1CXX->getStandardLayoutBaseWithFields(); - // Check the base classes. - for (CXXRecordDecl::base_class_const_iterator - Base1 = D1CXX->bases_begin(), - BaseEnd1 = D1CXX->bases_end(), - Base2 = D2CXX->bases_begin(); - Base1 != BaseEnd1; - ++Base1, ++Base2) { - if (!isLayoutCompatible(C, Base1->getType(), Base2->getType())) - return false; - } - } else if (const CXXRecordDecl *D2CXX = dyn_cast(RD2)) { - // If only RD2 is a C++ class, it should have zero base classes. - if (D2CXX->getNumBases() > 0) - return false; - } + if (const CXXRecordDecl *D2CXX = dyn_cast(RD2)) + RD2 = D2CXX->getStandardLayoutBaseWithFields(); // Check the fields. - RecordDecl::field_iterator Field2 = RD2->field_begin(), - Field2End = RD2->field_end(), - Field1 = RD1->field_begin(), - Field1End = RD1->field_end(); - for ( ; Field1 != Field1End && Field2 != Field2End; ++Field1, ++Field2) { - if (!isLayoutCompatible(C, *Field1, *Field2)) - return false; - } - if (Field1 != Field1End || Field2 != Field2End) - return false; - - return true; + return llvm::equal(RD1->fields(), RD2->fields(), + [&C](const FieldDecl *F1, const FieldDecl *F2) -> bool { + return isLayoutCompatible(C, F1, F2); + }); } /// Check if two standard-layout unions are layout-compatible. /// (C++11 [class.mem] p18) -static bool isLayoutCompatibleUnion(ASTContext &C, RecordDecl *RD1, - RecordDecl *RD2) { - llvm::SmallPtrSet UnmatchedFields; +static bool isLayoutCompatibleUnion(const ASTContext &C, const RecordDecl *RD1, + const RecordDecl *RD2) { + llvm::SmallPtrSet UnmatchedFields; for (auto *Field2 : RD2->fields()) UnmatchedFields.insert(Field2); for (auto *Field1 : RD1->fields()) { - llvm::SmallPtrSet::iterator - I = UnmatchedFields.begin(), - E = UnmatchedFields.end(); + auto I = UnmatchedFields.begin(); + auto E = UnmatchedFields.end(); for ( ; I != E; ++I) { if (isLayoutCompatible(C, Field1, *I, /*IsUnionMember=*/true)) { @@ -13788,8 +13766,8 @@ static bool isLayoutCompatibleUnion(ASTContext &C, RecordDecl *RD1, return UnmatchedFields.empty(); } -static bool isLayoutCompatible(ASTContext &C, RecordDecl *RD1, - RecordDecl *RD2) { +static bool isLayoutCompatible(const ASTContext &C, const RecordDecl *RD1, + const RecordDecl *RD2) { if (RD1->isUnion() != RD2->isUnion()) return false; @@ -13800,7 +13778,7 @@ static bool isLayoutCompatible(ASTContext &C, RecordDecl *RD1, } /// Check if two types are layout-compatible in C++11 sense. -static bool isLayoutCompatible(ASTContext &C, QualType T1, QualType T2) { +static bool isLayoutCompatible(const ASTContext &C, QualType T1, QualType T2) { if (T1.isNull() || T2.isNull()) return false; diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp index 9e16b67284be4..c34d32002b5ad 100644 --- a/clang/lib/Sema/SemaConcept.cpp +++ b/clang/lib/Sema/SemaConcept.cpp @@ -531,6 +531,10 @@ static ExprResult calculateConstraintSatisfaction( std::optional EvaluateFoldExpandedConstraintSize(const CXXFoldExpr *FE) const { + + // We should ignore errors in the presence of packs of different size. + Sema::SFINAETrap Trap(S); + Expr *Pattern = FE->getPattern(); SmallVector Unexpanded; diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp index 81334c817b2af..4e180d648cd82 100644 --- a/clang/lib/Sema/SemaCoroutine.cpp +++ b/clang/lib/Sema/SemaCoroutine.cpp @@ -820,7 +820,8 @@ ExprResult Sema::BuildOperatorCoawaitLookupExpr(Scope *S, SourceLocation Loc) { Expr *CoawaitOp = UnresolvedLookupExpr::Create( Context, /*NamingClass*/ nullptr, NestedNameSpecifierLoc(), DeclarationNameInfo(OpName, Loc), /*RequiresADL*/ true, Functions.begin(), - Functions.end(), /*KnownDependent=*/false); + Functions.end(), /*KnownDependent=*/false, + /*KnownInstantiationDependent=*/false); assert(CoawaitOp); return CoawaitOp; } diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index bb25a0b3a45ae..d608dd92a4b47 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1219,7 +1219,7 @@ Sema::NameClassification Sema::ClassifyName(Scope *S, CXXScopeSpec &SS, return NameClassification::OverloadSet(UnresolvedLookupExpr::Create( Context, Result.getNamingClass(), SS.getWithLocInContext(Context), Result.getLookupNameInfo(), ADL, Result.begin(), Result.end(), - /*KnownDependent=*/false)); + /*KnownDependent=*/false, /*KnownInstantiationDependent=*/false)); } ExprResult @@ -6890,6 +6890,11 @@ static void checkAttributesAfterMerging(Sema &S, NamedDecl &ND) { } } + if (HybridPatchableAttr *Attr = ND.getAttr()) { + if (!ND.isExternallyVisible()) + S.Diag(Attr->getLocation(), + diag::warn_attribute_hybrid_patchable_non_extern); + } if (const InheritableAttr *Attr = getDLLAttr(&ND)) { auto *VD = dyn_cast(&ND); bool IsAnonymousNS = false; @@ -11009,6 +11014,9 @@ static bool AttrCompatibleWithMultiVersion(attr::Kind Kind, switch (Kind) { default: return false; + case attr::ArmLocallyStreaming: + return MVKind == MultiVersionKind::TargetVersion || + MVKind == MultiVersionKind::TargetClones; case attr::Used: return MVKind == MultiVersionKind::Target; case attr::NonNull: @@ -11145,7 +11153,21 @@ bool Sema::areMultiversionVariantFunctionsCompatible( FunctionType::ExtInfo OldTypeInfo = OldType->getExtInfo(); FunctionType::ExtInfo NewTypeInfo = NewType->getExtInfo(); - if (OldTypeInfo.getCC() != NewTypeInfo.getCC()) + const auto *OldFPT = OldFD->getType()->getAs(); + const auto *NewFPT = NewFD->getType()->getAs(); + + bool ArmStreamingCCMismatched = false; + if (OldFPT && NewFPT) { + unsigned Diff = + OldFPT->getAArch64SMEAttributes() ^ NewFPT->getAArch64SMEAttributes(); + // Arm-streaming, arm-streaming-compatible and non-streaming versions + // cannot be mixed. + if (Diff & (FunctionType::SME_PStateSMEnabledMask | + FunctionType::SME_PStateSMCompatibleMask)) + ArmStreamingCCMismatched = true; + } + + if (OldTypeInfo.getCC() != NewTypeInfo.getCC() || ArmStreamingCCMismatched) return Diag(DiffDiagIDAt.first, DiffDiagIDAt.second) << CallingConv; QualType OldReturnType = OldType->getReturnType(); @@ -11165,9 +11187,8 @@ bool Sema::areMultiversionVariantFunctionsCompatible( if (!CLinkageMayDiffer && OldFD->isExternC() != NewFD->isExternC()) return Diag(DiffDiagIDAt.first, DiffDiagIDAt.second) << LanguageLinkage; - if (CheckEquivalentExceptionSpec( - OldFD->getType()->getAs(), OldFD->getLocation(), - NewFD->getType()->getAs(), NewFD->getLocation())) + if (CheckEquivalentExceptionSpec(OldFPT, OldFD->getLocation(), NewFPT, + NewFD->getLocation())) return true; } return false; @@ -18052,6 +18073,15 @@ void Sema::ActOnTagFinishDefinition(Scope *S, Decl *TagD, if (NumInitMethods > 1 || !Def->hasInitMethod()) Diag(RD->getLocation(), diag::err_sycl_special_type_num_init_method); } + + // If we're defining a dynamic class in a module interface unit, we always + // need to produce the vtable for it, even if the vtable is not used in the + // current TU. + // + // The case where the current class is not dynamic is handled in + // MarkVTableUsed. + if (getCurrentModule() && getCurrentModule()->isInterfaceOrPartition()) + MarkVTableUsed(RD->getLocation(), RD, /*DefinitionRequired=*/true); } // Exit this scope of this tag's definition. diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 5fd8622c90dd8..e2eada24f9fcc 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -3024,9 +3024,6 @@ bool Sema::checkTargetVersionAttr(SourceLocation LiteralLoc, Decl *D, return Diag(LiteralLoc, diag::warn_unsupported_target_attribute) << Unsupported << None << CurFeature << TargetVersion; } - if (IsArmStreamingFunction(cast(D), - /*IncludeLocallyStreaming=*/false)) - return Diag(LiteralLoc, diag::err_sme_streaming_cannot_be_multiversioned); return false; } @@ -3123,10 +3120,6 @@ bool Sema::checkTargetClonesAttrString( HasNotDefault = true; } } - if (IsArmStreamingFunction(cast(D), - /*IncludeLocallyStreaming=*/false)) - return Diag(LiteralLoc, - diag::err_sme_streaming_cannot_be_multiversioned); } else { // Other targets ( currently X86 ) if (Cur.starts_with("arch=")) { @@ -6868,6 +6861,9 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL, case ParsedAttr::AT_MSConstexpr: handleMSConstexprAttr(S, D, AL); break; + case ParsedAttr::AT_HybridPatchable: + handleSimpleAttribute(S, D, AL); + break; // HLSL attributes: case ParsedAttr::AT_HLSLNumThreads: diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 04b8d88cae217..4e4f91de8cd5a 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -1289,7 +1289,7 @@ static bool checkTupleLikeDecomposition(Sema &S, S.Context, nullptr, NestedNameSpecifierLoc(), SourceLocation(), DeclarationNameInfo(GetDN, Loc), /*RequiresADL=*/true, &Args, UnresolvedSetIterator(), UnresolvedSetIterator(), - /*KnownDependent=*/false); + /*KnownDependent=*/false, /*KnownInstantiationDependent=*/false); Expr *Arg = E.get(); E = S.BuildCallExpr(nullptr, Get, Loc, Arg, Loc); @@ -7042,11 +7042,43 @@ void Sema::CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record) { } } + bool EffectivelyConstexprDestructor = true; + // Avoid triggering vtable instantiation due to a dtor that is not + // "effectively constexpr" for better compatibility. + // See https://github.com/llvm/llvm-project/issues/102293 for more info. + if (isa(M)) { + auto Check = [](QualType T, auto &&Check) -> bool { + const CXXRecordDecl *RD = + T->getBaseElementTypeUnsafe()->getAsCXXRecordDecl(); + if (!RD || !RD->isCompleteDefinition()) + return true; + + if (!RD->hasConstexprDestructor()) + return false; + + QualType CanUnqualT = T.getCanonicalType().getUnqualifiedType(); + for (const CXXBaseSpecifier &B : RD->bases()) + if (B.getType().getCanonicalType().getUnqualifiedType() != + CanUnqualT && + !Check(B.getType(), Check)) + return false; + for (const FieldDecl *FD : RD->fields()) + if (FD->getType().getCanonicalType().getUnqualifiedType() != + CanUnqualT && + !Check(FD->getType(), Check)) + return false; + return true; + }; + EffectivelyConstexprDestructor = + Check(QualType(Record->getTypeForDecl(), 0), Check); + } + // Define defaulted constexpr virtual functions that override a base class // function right away. // FIXME: We can defer doing this until the vtable is marked as used. if (CSM != CXXSpecialMemberKind::Invalid && !M->isDeleted() && - M->isDefaulted() && M->isConstexpr() && M->size_overridden_methods()) + M->isDefaulted() && M->isConstexpr() && M->size_overridden_methods() && + EffectivelyConstexprDestructor) DefineDefaultedFunction(*this, M, M->getLocation()); if (!Incomplete) @@ -18485,11 +18517,15 @@ bool Sema::DefineUsedVTables() { bool DefineVTable = true; - // If this class has a key function, but that key function is - // defined in another translation unit, we don't need to emit the - // vtable even though we're using it. const CXXMethodDecl *KeyFunction = Context.getCurrentKeyFunction(Class); - if (KeyFunction && !KeyFunction->hasBody()) { + // V-tables for non-template classes with an owning module are always + // uniquely emitted in that module. + if (Class->isInCurrentModuleUnit()) { + DefineVTable = true; + } else if (KeyFunction && !KeyFunction->hasBody()) { + // If this class has a key function, but that key function is + // defined in another translation unit, we don't need to emit the + // vtable even though we're using it. // The key function is in another translation unit. DefineVTable = false; TemplateSpecializationKind TSK = @@ -18534,7 +18570,7 @@ bool Sema::DefineUsedVTables() { DefinedAnything = true; MarkVirtualMembersReferenced(Loc, Class); CXXRecordDecl *Canonical = Class->getCanonicalDecl(); - if (VTablesUsed[Canonical]) + if (VTablesUsed[Canonical] && !Class->shouldEmitInExternalSource()) Consumer.HandleVTable(Class); // Warn if we're emitting a weak vtable. The vtable will be weak if there is diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 439db55668cc6..f56ca398cda81 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3188,7 +3188,7 @@ ExprResult Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, UnresolvedLookupExpr *ULE = UnresolvedLookupExpr::Create( Context, R.getNamingClass(), SS.getWithLocInContext(Context), R.getLookupNameInfo(), NeedsADL, R.begin(), R.end(), - /*KnownDependent=*/false); + /*KnownDependent=*/false, /*KnownInstantiationDependent=*/false); return ULE; } @@ -4117,6 +4117,21 @@ static bool CheckVectorElementsTraitOperandType(Sema &S, QualType T, return false; } +static bool checkPtrAuthTypeDiscriminatorOperandType(Sema &S, QualType T, + SourceLocation Loc, + SourceRange ArgRange) { + if (S.checkPointerAuthEnabled(Loc, ArgRange)) + return true; + + if (!T->isFunctionType() && !T->isFunctionPointerType() && + !T->isFunctionReferenceType() && !T->isMemberFunctionPointerType()) { + S.Diag(Loc, diag::err_ptrauth_type_disc_undiscriminated) << T << ArgRange; + return true; + } + + return false; +} + static bool CheckExtensionTraitOperandType(Sema &S, QualType T, SourceLocation Loc, SourceRange ArgRange, @@ -4511,6 +4526,10 @@ bool Sema::CheckUnaryExprOrTypeTraitOperand(QualType ExprType, return CheckVectorElementsTraitOperandType(*this, ExprType, OpLoc, ExprRange); + if (ExprKind == UETT_PtrAuthTypeDiscriminator) + return checkPtrAuthTypeDiscriminatorOperandType(*this, ExprType, OpLoc, + ExprRange); + // Explicitly list some types as extensions. if (!CheckExtensionTraitOperandType(*this, ExprType, OpLoc, ExprRange, ExprKind)) @@ -5411,11 +5430,24 @@ struct EnsureImmediateInvocationInDefaultArgs // Rewrite to source location to refer to the context in which they are used. ExprResult TransformSourceLocExpr(SourceLocExpr *E) { - if (E->getParentContext() == SemaRef.CurContext) + DeclContext *DC = E->getParentContext(); + if (DC == SemaRef.CurContext) return E; - return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(), - E->getBeginLoc(), E->getEndLoc(), - SemaRef.CurContext); + + // FIXME: During instantiation, because the rebuild of defaults arguments + // is not always done in the context of the template instantiator, + // we run the risk of producing a dependent source location + // that would never be rebuilt. + // This usually happens during overload resolution, or in contexts + // where the value of the source location does not matter. + // However, we should find a better way to deal with source location + // of function templates. + if (!SemaRef.CurrentInstantiationScope || + !SemaRef.CurContext->isDependentContext() || DC->isDependentContext()) + DC = SemaRef.CurContext; + + return getDerived().RebuildSourceLocExpr( + E->getIdentKind(), E->getType(), E->getBeginLoc(), E->getEndLoc(), DC); } }; @@ -5711,7 +5743,6 @@ static bool isParenthetizedAndQualifiedAddressOfExpr(Expr *Fn) { if (!UO || UO->getOpcode() != clang::UO_AddrOf) return false; if (auto *DRE = dyn_cast(UO->getSubExpr()->IgnoreParens())) { - assert(isa(DRE->getDecl()) && "expected a function"); return DRE->hasQualifier(); } if (auto *OVL = dyn_cast(UO->getSubExpr()->IgnoreParens())) @@ -17027,7 +17058,8 @@ Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, // not a constant expression as a side-effect. bool Folded = E->EvaluateAsRValue(EvalResult, Context, /*isConstantContext*/ true) && - EvalResult.Val.isInt() && !EvalResult.HasSideEffects; + EvalResult.Val.isInt() && !EvalResult.HasSideEffects && + (!getLangOpts().CPlusPlus || !EvalResult.HasUndefinedBehavior); if (!isa(E)) E = ConstantExpr::Create(Context, E, EvalResult.Val); diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 14d1f395af90e..de50786f4d6c0 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -5140,7 +5140,8 @@ static bool HasNonDeletedDefaultedEqualityComparison(Sema &S, // const ClassT& obj; OpaqueValueExpr Operand( - {}, Decl->getTypeForDecl()->getCanonicalTypeUnqualified().withConst(), + KeyLoc, + Decl->getTypeForDecl()->getCanonicalTypeUnqualified().withConst(), ExprValueKind::VK_LValue); UnresolvedSet<16> Functions; // obj == obj; diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp index 2070f3b7bb3a2..f1ba26f38520a 100644 --- a/clang/lib/Sema/SemaExprMember.cpp +++ b/clang/lib/Sema/SemaExprMember.cpp @@ -331,7 +331,8 @@ ExprResult Sema::BuildPossibleImplicitMemberExpr( return UnresolvedLookupExpr::Create( Context, R.getNamingClass(), SS.getWithLocInContext(Context), TemplateKWLoc, R.getLookupNameInfo(), /*RequiresADL=*/false, - TemplateArgs, R.begin(), R.end(), /*KnownDependent=*/true); + TemplateArgs, R.begin(), R.end(), /*KnownDependent=*/true, + /*KnownInstantiationDependent=*/true); case IMA_Error_StaticOrExplicitContext: case IMA_Error_Unrelated: diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index dc2ba039afe7f..eea4bdfa68b52 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -515,8 +515,8 @@ class InitListChecker { uint64_t ElsCount = 1; // Otherwise try to fill whole array with embed data. if (Entity.getKind() == InitializedEntity::EK_ArrayElement) { - ValueDecl *ArrDecl = Entity.getParent()->getDecl(); - auto *AType = SemaRef.Context.getAsArrayType(ArrDecl->getType()); + auto *AType = + SemaRef.Context.getAsArrayType(Entity.getParent()->getType()); assert(AType && "expected array type when initializing array"); ElsCount = Embed->getDataElementCount(); if (const auto *CAType = dyn_cast(AType)) diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index 601077e9f3334..809b94bb7412b 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -1318,7 +1318,6 @@ void Sema::ActOnLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro, if (C->Init.isUsable()) { addInitCapture(LSI, cast(Var), C->Kind == LCK_ByRef); - PushOnScopeChains(Var, CurScope, false); } else { TryCaptureKind Kind = C->Kind == LCK_ByRef ? TryCapture_ExplicitByRef : TryCapture_ExplicitByVal; diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 7a6a64529f52e..d3d4bf27ae728 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -570,7 +570,7 @@ void LookupResult::resolveKind() { // For non-type declarations, check for a prior lookup result naming this // canonical declaration. - if (!D->isPlaceholderVar(getSema().getLangOpts()) && !ExistingI) { + if (!ExistingI) { auto UniqueResult = Unique.insert(std::make_pair(D, I)); if (!UniqueResult.second) { // We've seen this entity before. diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 67e3c1d9067f3..6cbc075302eb5 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -17968,7 +17968,8 @@ buildDeclareReductionRef(Sema &SemaRef, SourceLocation Loc, SourceRange Range, return UnresolvedLookupExpr::Create( SemaRef.Context, /*NamingClass=*/nullptr, ReductionIdScopeSpec.getWithLocInContext(SemaRef.Context), ReductionId, - /*ADL=*/true, ResSet.begin(), ResSet.end(), /*KnownDependent=*/false); + /*ADL=*/true, ResSet.begin(), ResSet.end(), /*KnownDependent=*/false, + /*KnownInstantiationDependent=*/false); } // Lookup inside the classes. // C++ [over.match.oper]p3: @@ -20834,7 +20835,8 @@ static ExprResult buildUserDefinedMapperRef(Sema &SemaRef, Scope *S, return UnresolvedLookupExpr::Create( SemaRef.Context, /*NamingClass=*/nullptr, MapperIdScopeSpec.getWithLocInContext(SemaRef.Context), MapperId, - /*ADL=*/false, URS.begin(), URS.end(), /*KnownDependent=*/false); + /*ADL=*/false, URS.begin(), URS.end(), /*KnownDependent=*/false, + /*KnownInstantiationDependent=*/false); } SourceLocation Loc = MapperId.getLoc(); // [OpenMP 5.0], 2.19.7.3 declare mapper Directive, Restrictions diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index a8d250fbabfed..28fd3b06156b9 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -6857,10 +6857,7 @@ void Sema::AddOverloadCandidate( Candidate.Viable = true; Candidate.RewriteKind = CandidateSet.getRewriteInfo().getRewriteKind(Function, PO); - Candidate.IsSurrogate = false; Candidate.IsADLCandidate = IsADLCandidate; - Candidate.IgnoreObjectArgument = false; - Candidate.TookAddressOfOverload = false; Candidate.ExplicitCallArguments = Args.size(); // Explicit functions are not actually candidates at all if we're not @@ -7422,8 +7419,6 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl, Candidate.Function = Method; Candidate.RewriteKind = CandidateSet.getRewriteInfo().getRewriteKind(Method, PO); - Candidate.IsSurrogate = false; - Candidate.IgnoreObjectArgument = false; Candidate.TookAddressOfOverload = CandidateSet.getKind() == OverloadCandidateSet::CSK_AddressOfOverloadSet; Candidate.ExplicitCallArguments = Args.size(); @@ -7617,7 +7612,6 @@ void Sema::AddMethodTemplateCandidate( Candidate.IgnoreObjectArgument = cast(Candidate.Function)->isStatic() || ObjectType.isNull(); - Candidate.TookAddressOfOverload = false; Candidate.ExplicitCallArguments = Args.size(); if (Result == TemplateDeductionResult::NonDependentConversionFailure) Candidate.FailureKind = ovl_fail_bad_conversion; @@ -7705,7 +7699,6 @@ void Sema::AddTemplateOverloadCandidate( Candidate.IgnoreObjectArgument = isa(Candidate.Function) && !isa(Candidate.Function); - Candidate.TookAddressOfOverload = false; Candidate.ExplicitCallArguments = Args.size(); if (Result == TemplateDeductionResult::NonDependentConversionFailure) Candidate.FailureKind = ovl_fail_bad_conversion; @@ -7886,9 +7879,6 @@ void Sema::AddConversionCandidate( OverloadCandidate &Candidate = CandidateSet.addCandidate(1); Candidate.FoundDecl = FoundDecl; Candidate.Function = Conversion; - Candidate.IsSurrogate = false; - Candidate.IgnoreObjectArgument = false; - Candidate.TookAddressOfOverload = false; Candidate.FinalConversion.setAsIdentityConversion(); Candidate.FinalConversion.setFromType(ConvType); Candidate.FinalConversion.setAllToTypes(ToType); @@ -8084,9 +8074,6 @@ void Sema::AddTemplateConversionCandidate( Candidate.Function = FunctionTemplate->getTemplatedDecl(); Candidate.Viable = false; Candidate.FailureKind = ovl_fail_bad_deduction; - Candidate.IsSurrogate = false; - Candidate.IgnoreObjectArgument = false; - Candidate.TookAddressOfOverload = false; Candidate.ExplicitCallArguments = 1; Candidate.DeductionFailure = MakeDeductionFailureInfo(Context, Result, Info); @@ -8119,10 +8106,8 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion, Candidate.FoundDecl = FoundDecl; Candidate.Function = nullptr; Candidate.Surrogate = Conversion; - Candidate.Viable = true; Candidate.IsSurrogate = true; - Candidate.IgnoreObjectArgument = false; - Candidate.TookAddressOfOverload = false; + Candidate.Viable = true; Candidate.ExplicitCallArguments = Args.size(); // Determine the implicit conversion sequence for the implicit @@ -8328,9 +8313,6 @@ void Sema::AddBuiltinCandidate(QualType *ParamTys, ArrayRef Args, OverloadCandidate &Candidate = CandidateSet.addCandidate(Args.size()); Candidate.FoundDecl = DeclAccessPair::make(nullptr, AS_none); Candidate.Function = nullptr; - Candidate.IsSurrogate = false; - Candidate.IgnoreObjectArgument = false; - Candidate.TookAddressOfOverload = false; std::copy(ParamTys, ParamTys + Args.size(), Candidate.BuiltinParamTypes); // Determine the implicit conversion sequences for each of the @@ -14101,9 +14083,9 @@ ExprResult Sema::CreateUnresolvedLookupExpr(CXXRecordDecl *NamingClass, DeclarationNameInfo DNI, const UnresolvedSetImpl &Fns, bool PerformADL) { - return UnresolvedLookupExpr::Create(Context, NamingClass, NNSLoc, DNI, - PerformADL, Fns.begin(), Fns.end(), - /*KnownDependent=*/false); + return UnresolvedLookupExpr::Create( + Context, NamingClass, NNSLoc, DNI, PerformADL, Fns.begin(), Fns.end(), + /*KnownDependent=*/false, /*KnownInstantiationDependent=*/false); } ExprResult Sema::BuildCXXMemberCallExpr(Expr *E, NamedDecl *FoundDecl, diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 87b1f98bbe5ac..ca71542d886fa 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -4436,7 +4436,8 @@ ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS, UnresolvedLookupExpr *ULE = UnresolvedLookupExpr::Create( Context, R.getNamingClass(), SS.getWithLocInContext(Context), TemplateKWLoc, R.getLookupNameInfo(), RequiresADL, TemplateArgs, - R.begin(), R.end(), KnownDependent); + R.begin(), R.end(), KnownDependent, + /*KnownInstantiationDependent=*/false); // Model the templates with UnresolvedTemplateTy. The expression should then // either be transformed in an instantiation or be diagnosed in diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 8995d461362d7..a09e3be83c454 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -20,6 +20,7 @@ #include "clang/AST/Expr.h" #include "clang/AST/ExprConcepts.h" #include "clang/AST/PrettyDeclStackTrace.h" +#include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/Type.h" #include "clang/AST/TypeLoc.h" #include "clang/AST/TypeVisitor.h" @@ -87,12 +88,19 @@ struct Response { // than lambda classes. const FunctionDecl * getPrimaryTemplateOfGenericLambda(const FunctionDecl *LambdaCallOperator) { + if (!isLambdaCallOperator(LambdaCallOperator)) + return LambdaCallOperator; while (true) { if (auto *FTD = dyn_cast_if_present( LambdaCallOperator->getDescribedTemplate()); FTD && FTD->getInstantiatedFromMemberTemplate()) { LambdaCallOperator = FTD->getInstantiatedFromMemberTemplate()->getTemplatedDecl(); + } else if (LambdaCallOperator->getPrimaryTemplate()) { + // Cases where the lambda operator is instantiated in + // TemplateDeclInstantiator::VisitCXXMethodDecl. + LambdaCallOperator = + LambdaCallOperator->getPrimaryTemplate()->getTemplatedDecl(); } else if (auto *Prev = cast(LambdaCallOperator) ->getInstantiatedFromMemberFunction()) LambdaCallOperator = Prev; @@ -138,22 +146,28 @@ getEnclosingTypeAliasTemplateDecl(Sema &SemaRef) { // Check if we are currently inside of a lambda expression that is // surrounded by a using alias declaration. e.g. // template using type = decltype([](auto) { ^ }()); -// By checking if: -// 1. The lambda expression and the using alias declaration share the -// same declaration context. -// 2. They have the same template depth. // We have to do so since a TypeAliasTemplateDecl (or a TypeAliasDecl) is never // a DeclContext, nor does it have an associated specialization Decl from which // we could collect these template arguments. bool isLambdaEnclosedByTypeAliasDecl( - const FunctionDecl *PrimaryLambdaCallOperator, + const FunctionDecl *LambdaCallOperator, const TypeAliasTemplateDecl *PrimaryTypeAliasDecl) { - return cast(PrimaryLambdaCallOperator->getDeclContext()) - ->getTemplateDepth() == - PrimaryTypeAliasDecl->getTemplateDepth() && - getLambdaAwareParentOfDeclContext( - const_cast(PrimaryLambdaCallOperator)) == - PrimaryTypeAliasDecl->getDeclContext(); + struct Visitor : RecursiveASTVisitor { + Visitor(const FunctionDecl *CallOperator) : CallOperator(CallOperator) {} + bool VisitLambdaExpr(const LambdaExpr *LE) { + // Return true to bail out of the traversal, implying the Decl contains + // the lambda. + return getPrimaryTemplateOfGenericLambda(LE->getCallOperator()) != + CallOperator; + } + const FunctionDecl *CallOperator; + }; + + QualType Underlying = + PrimaryTypeAliasDecl->getTemplatedDecl()->getUnderlyingType(); + + return !Visitor(getPrimaryTemplateOfGenericLambda(LambdaCallOperator)) + .TraverseType(Underlying); } // Add template arguments from a variable template instantiation. @@ -290,23 +304,8 @@ Response HandleFunction(Sema &SemaRef, const FunctionDecl *Function, // If this function is a generic lambda specialization, we are done. if (!ForConstraintInstantiation && - isGenericLambdaCallOperatorOrStaticInvokerSpecialization(Function)) { - // TypeAliasTemplateDecls should be taken into account, e.g. - // when we're deducing the return type of a lambda. - // - // template int Value = 0; - // template - // using T = decltype([]() { return Value; }()); - // - if (auto TypeAlias = getEnclosingTypeAliasTemplateDecl(SemaRef)) { - if (isLambdaEnclosedByTypeAliasDecl( - /*PrimaryLambdaCallOperator=*/getPrimaryTemplateOfGenericLambda( - Function), - /*PrimaryTypeAliasDecl=*/TypeAlias.PrimaryTypeAliasDecl)) - return Response::UseNextDecl(Function); - } + isGenericLambdaCallOperatorOrStaticInvokerSpecialization(Function)) return Response::Done(); - } } else if (Function->getDescribedFunctionTemplate()) { assert( @@ -418,10 +417,9 @@ Response HandleRecordDecl(Sema &SemaRef, const CXXRecordDecl *Rec, // Retrieve the template arguments for a using alias declaration. // This is necessary for constraint checking, since we always keep // constraints relative to the primary template. - if (auto TypeAlias = getEnclosingTypeAliasTemplateDecl(SemaRef)) { - const FunctionDecl *PrimaryLambdaCallOperator = - getPrimaryTemplateOfGenericLambda(Rec->getLambdaCallOperator()); - if (isLambdaEnclosedByTypeAliasDecl(PrimaryLambdaCallOperator, + if (auto TypeAlias = getEnclosingTypeAliasTemplateDecl(SemaRef); + ForConstraintInstantiation && TypeAlias) { + if (isLambdaEnclosedByTypeAliasDecl(Rec->getLambdaCallOperator(), TypeAlias.PrimaryTypeAliasDecl)) { Result.addOuterTemplateArguments(TypeAlias.Template, TypeAlias.AssociatedTemplateArguments, @@ -1642,12 +1640,17 @@ namespace { CXXRecordDecl::LambdaDependencyKind ComputeLambdaDependency(LambdaScopeInfo *LSI) { - auto &CCS = SemaRef.CodeSynthesisContexts.back(); - if (CCS.Kind == - Sema::CodeSynthesisContext::TypeAliasTemplateInstantiation) { - unsigned TypeAliasDeclDepth = CCS.Entity->getTemplateDepth(); + if (auto TypeAlias = + TemplateInstArgsHelpers::getEnclosingTypeAliasTemplateDecl( + getSema()); + TypeAlias && TemplateInstArgsHelpers::isLambdaEnclosedByTypeAliasDecl( + LSI->CallOperator, TypeAlias.PrimaryTypeAliasDecl)) { + unsigned TypeAliasDeclDepth = TypeAlias.Template->getTemplateDepth(); if (TypeAliasDeclDepth >= TemplateArgs.getNumSubstitutedLevels()) return CXXRecordDecl::LambdaDependencyKind::LDK_AlwaysDependent; + for (const TemplateArgument &TA : TypeAlias.AssociatedTemplateArguments) + if (TA.isDependent()) + return CXXRecordDecl::LambdaDependencyKind::LDK_AlwaysDependent; } return inherited::ComputeLambdaDependency(LSI); } diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 84e846356e437..51e6a4845bf6f 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -10541,7 +10541,7 @@ TreeTransform::TransformOMPReductionClause(OMPReductionClause *C) { SemaRef.Context, /*NamingClass=*/nullptr, ReductionIdScopeSpec.getWithLocInContext(SemaRef.Context), NameInfo, /*ADL=*/true, Decls.begin(), Decls.end(), - /*KnownDependent=*/false)); + /*KnownDependent=*/false, /*KnownInstantiationDependent=*/false)); } else UnresolvedReductions.push_back(nullptr); } @@ -10588,7 +10588,7 @@ OMPClause *TreeTransform::TransformOMPTaskReductionClause( SemaRef.Context, /*NamingClass=*/nullptr, ReductionIdScopeSpec.getWithLocInContext(SemaRef.Context), NameInfo, /*ADL=*/true, Decls.begin(), Decls.end(), - /*KnownDependent=*/false)); + /*KnownDependent=*/false, /*KnownInstantiationDependent=*/false)); } else UnresolvedReductions.push_back(nullptr); } @@ -10634,7 +10634,7 @@ TreeTransform::TransformOMPInReductionClause(OMPInReductionClause *C) { SemaRef.Context, /*NamingClass=*/nullptr, ReductionIdScopeSpec.getWithLocInContext(SemaRef.Context), NameInfo, /*ADL=*/true, Decls.begin(), Decls.end(), - /*KnownDependent=*/false)); + /*KnownDependent=*/false, /*KnownInstantiationDependent=*/false)); } else UnresolvedReductions.push_back(nullptr); } @@ -10816,7 +10816,7 @@ bool transformOMPMappableExprListClause( TT.getSema().Context, /*NamingClass=*/nullptr, MapperIdScopeSpec.getWithLocInContext(TT.getSema().Context), MapperIdInfo, /*ADL=*/true, Decls.begin(), Decls.end(), - /*KnownDependent=*/false)); + /*KnownDependent=*/false, /*KnownInstantiationDependent=*/false)); } else { UnresolvedMappers.push_back(nullptr); } diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 3cb96df12e4da..29aec144aec1a 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -3921,6 +3921,13 @@ llvm::Error ASTReader::ReadASTBlock(ModuleFile &F, } break; + case VTABLES_TO_EMIT: + if (F.Kind == MK_MainFile || + getContext().getLangOpts().BuildingPCHWithObjectFile) + for (unsigned I = 0, N = Record.size(); I != N;) + VTablesToEmit.push_back(ReadDeclID(F, Record, I)); + break; + case IMPORTED_MODULES: if (!F.isModule()) { // If we aren't loading a module (which has its own exports), make @@ -8110,6 +8117,10 @@ void ASTReader::PassInterestingDeclToConsumer(Decl *D) { Consumer->HandleInterestingDecl(DeclGroupRef(D)); } +void ASTReader::PassVTableToConsumer(CXXRecordDecl *RD) { + Consumer->HandleVTable(RD); +} + void ASTReader::StartTranslationUnit(ASTConsumer *Consumer) { this->Consumer = Consumer; diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 31ab6c651d59f..c118f3818467d 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -3684,6 +3684,54 @@ static void inheritDefaultTemplateArguments(ASTContext &Context, } } +// [basic.link]/p10: +// If two declarations of an entity are attached to different modules, +// the program is ill-formed; +static void checkMultipleDefinitionInNamedModules(ASTReader &Reader, Decl *D, + Decl *Previous) { + Module *M = Previous->getOwningModule(); + + // We only care about the case in named modules. + if (!M || !M->isNamedModule()) + return; + + // If it is previous implcitly introduced, it is not meaningful to + // diagnose it. + if (Previous->isImplicit()) + return; + + // FIXME: Get rid of the enumeration of decl types once we have an appropriate + // abstract for decls of an entity. e.g., the namespace decl and using decl + // doesn't introduce an entity. + if (!isa(Previous)) + return; + + // Skip implicit instantiations since it may give false positive diagnostic + // messages. + // FIXME: Maybe this shows the implicit instantiations may have incorrect + // module owner ships. But given we've finished the compilation of a module, + // how can we add new entities to that module? + if (auto *VTSD = dyn_cast(Previous); + VTSD && !VTSD->isExplicitSpecialization()) + return; + if (auto *CTSD = dyn_cast(Previous); + CTSD && !CTSD->isExplicitSpecialization()) + return; + if (auto *Func = dyn_cast(Previous)) + if (auto *FTSI = Func->getTemplateSpecializationInfo(); + FTSI && !FTSI->isExplicitSpecialization()) + return; + + // It is fine if they are in the same module. + if (Reader.getContext().isInSameModule(M, D->getOwningModule())) + return; + + Reader.Diag(Previous->getLocation(), + diag::err_multiple_decl_in_different_modules) + << cast(Previous) << M->Name; + Reader.Diag(D->getLocation(), diag::note_also_found); +} + void ASTDeclReader::attachPreviousDecl(ASTReader &Reader, Decl *D, Decl *Previous, Decl *Canon) { assert(D && Previous); @@ -3697,22 +3745,7 @@ void ASTDeclReader::attachPreviousDecl(ASTReader &Reader, Decl *D, #include "clang/AST/DeclNodes.inc" } - // [basic.link]/p10: - // If two declarations of an entity are attached to different modules, - // the program is ill-formed; - // - // FIXME: Get rid of the enumeration of decl types once we have an appropriate - // abstract for decls of an entity. e.g., the namespace decl and using decl - // doesn't introduce an entity. - if (Module *M = Previous->getOwningModule(); - M && M->isNamedModule() && - isa(Previous) && - !Reader.getContext().isInSameModule(M, D->getOwningModule())) { - Reader.Diag(Previous->getLocation(), - diag::err_multiple_decl_in_different_modules) - << cast(Previous) << M->Name; - Reader.Diag(D->getLocation(), diag::note_also_found); - } + checkMultipleDefinitionInNamedModules(Reader, D, Previous); // If the declaration was visible in one module, a redeclaration of it in // another module remains visible even if it wouldn't be visible by itself. @@ -4209,6 +4242,13 @@ void ASTReader::PassInterestingDeclsToConsumer() { // If we add any new potential interesting decl in the last call, consume it. ConsumingPotentialInterestingDecls(); + + for (GlobalDeclID ID : VTablesToEmit) { + auto *RD = cast(GetDecl(ID)); + assert(!RD->shouldEmitInExternalSource()); + PassVTableToConsumer(RD); + } + VTablesToEmit.clear(); } void ASTReader::loadDeclUpdateRecords(PendingUpdateRecord &Record) { diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index c78d8943d6d92..cb63dec92e331 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -927,6 +927,7 @@ void ASTWriter::WriteBlockInfoBlock() { RECORD(DECLS_TO_CHECK_FOR_DEFERRED_DIAGS); RECORD(PP_ASSUME_NONNULL_LOC); RECORD(PP_UNSAFE_BUFFER_USAGE); + RECORD(VTABLES_TO_EMIT); // SourceManager Block. BLOCK(SOURCE_MANAGER_BLOCK); @@ -3961,6 +3962,13 @@ void ASTWriter::WriteIdentifierTable(Preprocessor &PP, Stream.EmitRecord(INTERESTING_IDENTIFIERS, InterestingIdents); } +void ASTWriter::handleVTable(CXXRecordDecl *RD) { + if (!RD->isInNamedModule()) + return; + + PendingEmittingVTables.push_back(RD); +} + //===----------------------------------------------------------------------===// // DeclContext's Name Lookup Table Serialization //===----------------------------------------------------------------------===// @@ -5163,6 +5171,13 @@ void ASTWriter::PrepareWritingSpecialDecls(Sema &SemaRef) { // Write all of the DeclsToCheckForDeferredDiags. for (auto *D : SemaRef.DeclsToCheckForDeferredDiags) GetDeclRef(D); + + // Write all classes that need to emit the vtable definitions if required. + if (isWritingStdCXXNamedModules()) + for (CXXRecordDecl *RD : PendingEmittingVTables) + GetDeclRef(RD); + else + PendingEmittingVTables.clear(); } void ASTWriter::WriteSpecialDeclRecords(Sema &SemaRef) { @@ -5317,6 +5332,17 @@ void ASTWriter::WriteSpecialDeclRecords(Sema &SemaRef) { } if (!DeleteExprsToAnalyze.empty()) Stream.EmitRecord(DELETE_EXPRS_TO_ANALYZE, DeleteExprsToAnalyze); + + RecordData VTablesToEmit; + for (CXXRecordDecl *RD : PendingEmittingVTables) { + if (!wasDeclEmitted(RD)) + continue; + + AddDeclRef(RD, VTablesToEmit); + } + + if (!VTablesToEmit.empty()) + Stream.EmitRecord(VTABLES_TO_EMIT, VTablesToEmit); } ASTFileSignature ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot, @@ -6559,10 +6585,12 @@ void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) { // computed. Record->push_back(D->getODRHash()); - bool ModulesDebugInfo = - Writer->Context->getLangOpts().ModulesDebugInfo && !D->isDependentType(); - Record->push_back(ModulesDebugInfo); - if (ModulesDebugInfo) + bool ModulesCodegen = + !D->isDependentType() && + (Writer->Context->getLangOpts().ModulesDebugInfo || + D->isInNamedModule()); + Record->push_back(ModulesCodegen); + if (ModulesCodegen) Writer->AddDeclRef(D, Writer->ModularCodegenDecls); // IsLambda bit is already saved. diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index 17c774038571e..8a4ca54349e38 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -1529,8 +1529,14 @@ void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) { if (D->isThisDeclarationADefinition()) Record.AddCXXDefinitionData(D); + if (D->isCompleteDefinition() && D->isInNamedModule()) + Writer.AddDeclRef(D, Writer.ModularCodegenDecls); + // Store (what we currently believe to be) the key function to avoid // deserializing every method so we can compute it. + // + // FIXME: Avoid adding the key function if the class is defined in + // module purview since in that case the key function is meaningless. if (D->isCompleteDefinition()) Record.AddDeclRef(Context.getCurrentKeyFunction(D)); diff --git a/clang/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp index 40f7e9cede1f1..4cd2f2802f30c 100644 --- a/clang/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp @@ -147,10 +147,18 @@ using MutexDescriptor = class BlockInCriticalSectionChecker : public Checker { private: const std::array MutexDescriptors{ - MemberMutexDescriptor({/*MatchAs=*/CDM::CXXMethod, - /*QualifiedName=*/{"std", "mutex", "lock"}, - /*RequiredArgs=*/0}, - {CDM::CXXMethod, {"std", "mutex", "unlock"}, 0}), + // NOTE: There are standard library implementations where some methods + // of `std::mutex` are inherited from an implementation detail base + // class, and those aren't matched by the name specification {"std", + // "mutex", "lock"}. + // As a workaround here we omit the class name and only require the + // presence of the name parts "std" and "lock"/"unlock". + // TODO: Ensure that CallDescription understands inherited methods. + MemberMutexDescriptor( + {/*MatchAs=*/CDM::CXXMethod, + /*QualifiedName=*/{"std", /*"mutex",*/ "lock"}, + /*RequiredArgs=*/0}, + {CDM::CXXMethod, {"std", /*"mutex",*/ "unlock"}, 0}), FirstArgMutexDescriptor({CDM::CLibrary, {"pthread_mutex_lock"}, 1}, {CDM::CLibrary, {"pthread_mutex_unlock"}, 1}), FirstArgMutexDescriptor({CDM::CLibrary, {"mtx_lock"}, 1}, diff --git a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp index e8d538388e56c..7638fc7a88fe6 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp @@ -10,6 +10,11 @@ // //===----------------------------------------------------------------------===// +// work around MSVC bug: https://developercommunity.visualstudio.com/t/C1001-triggered-by-StreamCheckercpp-of/10667148 +#if defined(_MSC_VER) && (_MSC_VER < 1941) +#pragma optimize("", off) +#endif + #include "NoOwnershipChangeVisitor.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/ASTMatchers/ASTMatchers.h" diff --git a/clang/lib/StaticAnalyzer/Checkers/Taint.cpp b/clang/lib/StaticAnalyzer/Checkers/Taint.cpp index 6362c82b009d7..0bb5739db4b75 100644 --- a/clang/lib/StaticAnalyzer/Checkers/Taint.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/Taint.cpp @@ -12,6 +12,7 @@ #include "clang/StaticAnalyzer/Checkers/Taint.h" #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h" #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h" #include @@ -256,6 +257,12 @@ std::vector taint::getTaintedSymbolsImpl(ProgramStateRef State, if (!Sym) return TaintedSymbols; + // HACK:https://discourse.llvm.org/t/rfc-make-istainted-and-complex-symbols-friends/79570 + if (const auto &Opts = State->getAnalysisManager().getAnalyzerOptions(); + Sym->computeComplexity() > Opts.MaxTaintedSymbolComplexity) { + return {}; + } + // Traverse all the symbols this symbol depends on to see if any are tainted. for (SymbolRef SubSym : Sym->symbols()) { if (!isa(SubSym)) diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 62a240ecbc600..c11468a08ae5c 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1928,6 +1928,7 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred, case Stmt::CXXRewrittenBinaryOperatorClass: case Stmt::RequiresExprClass: case Expr::CXXParenListInitExprClass: + case Stmt::EmbedExprClass: // Fall through. // Cases we intentionally don't evaluate, since they don't need @@ -2430,10 +2431,6 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred, Bldr.addNodes(Dst); break; } - - case Stmt::EmbedExprClass: - llvm::report_fatal_error("Support for EmbedExpr is not implemented."); - break; } } diff --git a/clang/lib/StaticAnalyzer/Core/Store.cpp b/clang/lib/StaticAnalyzer/Core/Store.cpp index 67ca61bb56ba2..b436dd746d21f 100644 --- a/clang/lib/StaticAnalyzer/Core/Store.cpp +++ b/clang/lib/StaticAnalyzer/Core/Store.cpp @@ -472,7 +472,17 @@ SVal StoreManager::getLValueElement(QualType elementType, NonLoc Offset, const auto *ElemR = dyn_cast(BaseRegion); // Convert the offset to the appropriate size and signedness. - Offset = svalBuilder.convertToArrayIndex(Offset).castAs(); + auto Off = svalBuilder.convertToArrayIndex(Offset).getAs(); + if (!Off) { + // Handle cases when LazyCompoundVal is used for an array index. + // Such case is possible if code does: + // char b[4]; + // a[__builtin_bitcast(int, b)]; + // Return UnknownVal, since we cannot model it. + return UnknownVal(); + } + + Offset = Off.value(); if (!ElemR) { // If the base region is not an ElementRegion, create one. diff --git a/clang/test/AST/ast-dump-ptrauth-json.cpp b/clang/test/AST/ast-dump-ptrauth-json.cpp new file mode 100644 index 0000000000000..125cda0cff53a --- /dev/null +++ b/clang/test/AST/ast-dump-ptrauth-json.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -std=c++11 -ast-dump=json %s | FileCheck %s + +// CHECK: "name": "__builtin_ptrauth_type_discriminator", + +int d = __builtin_ptrauth_type_discriminator(int()); diff --git a/clang/test/Analysis/analyzer-config.c b/clang/test/Analysis/analyzer-config.c index 2a4c40005a4dc..1ee0d8e4eeceb 100644 --- a/clang/test/Analysis/analyzer-config.c +++ b/clang/test/Analysis/analyzer-config.c @@ -96,6 +96,7 @@ // CHECK-NEXT: max-inlinable-size = 100 // CHECK-NEXT: max-nodes = 225000 // CHECK-NEXT: max-symbol-complexity = 35 +// CHECK-NEXT: max-tainted-symbol-complexity = 9 // CHECK-NEXT: max-times-inline-large = 32 // CHECK-NEXT: min-cfg-size-treat-functions-as-large = 14 // CHECK-NEXT: mode = deep diff --git a/clang/test/Analysis/block-in-critical-section-inheritance.cpp b/clang/test/Analysis/block-in-critical-section-inheritance.cpp new file mode 100644 index 0000000000000..db20df8c60a5c --- /dev/null +++ b/clang/test/Analysis/block-in-critical-section-inheritance.cpp @@ -0,0 +1,31 @@ +// RUN: %clang_analyze_cc1 \ +// RUN: -analyzer-checker=unix.BlockInCriticalSection \ +// RUN: -std=c++11 \ +// RUN: -analyzer-output text \ +// RUN: -verify %s + +unsigned int sleep(unsigned int seconds) {return 0;} +namespace std { +// There are some standard library implementations where some mutex methods +// come from an implementation detail base class. We need to ensure that these +// are matched correctly. +class __mutex_base { +public: + void lock(); +}; +class mutex : public __mutex_base{ +public: + void unlock(); + bool try_lock(); +}; +} // namespace std + +void gh_99628() { + std::mutex m; + m.lock(); + // expected-note@-1 {{Entering critical section here}} + sleep(10); + // expected-warning@-1 {{Call to blocking function 'sleep' inside of critical section}} + // expected-note@-2 {{Call to blocking function 'sleep' inside of critical section}} + m.unlock(); +} diff --git a/clang/test/Analysis/embed.c b/clang/test/Analysis/embed.c new file mode 100644 index 0000000000000..32f6c13032574 --- /dev/null +++ b/clang/test/Analysis/embed.c @@ -0,0 +1,12 @@ +// RUN: %clang_analyze_cc1 -std=c23 -analyzer-checker=core,debug.ExprInspection -verify %s + +void clang_analyzer_dump_ptr(const unsigned char *ptr); +void clang_analyzer_dump(unsigned char val); + +int main() { + const unsigned char SelfBytes[] = { + #embed "embed.c" + }; + clang_analyzer_dump_ptr(SelfBytes); // expected-warning {{&Element{SelfBytes,0 S64b,unsigned char}}} + clang_analyzer_dump(SelfBytes[0]); // expected-warning {{Unknown}} FIXME: This should be the `/` character. +} diff --git a/clang/test/Analysis/exercise-ps.c b/clang/test/Analysis/exercise-ps.c index d1e1771afddb5..50643d5b04687 100644 --- a/clang/test/Analysis/exercise-ps.c +++ b/clang/test/Analysis/exercise-ps.c @@ -1,10 +1,13 @@ -// RUN: %clang_analyze_cc1 %s -verify -Wno-error=implicit-function-declaration \ -// RUN: -analyzer-checker=core,unix.Malloc \ +// RUN: %clang_analyze_cc1 %s -triple=x86_64-unknown-linux \ +// RUN: -verify -Wno-error=implicit-function-declaration \ +// RUN: -analyzer-checker=core,unix.Malloc,debug.ExprInspection \ // RUN: -analyzer-config core.CallAndMessage:ArgPointeeInitializedness=true // // Just exercise the analyzer on code that has at one point caused issues // (i.e., no assertions or crashes). +void clang_analyzer_dump_int(int); + static void f1(const char *x, char *y) { while (*x != 0) { *y++ = *x++; @@ -30,3 +33,16 @@ void f3(void *dest) { void *src = __builtin_alloca(5); memcpy(dest, src, 1); // expected-warning{{2nd function call argument is a pointer to uninitialized value}} } + +// Reproduce crash from GH#94496. When array is used as subcript to another array, CSA cannot model it +// and should just assume it's unknown and do not crash. +void f4(char *array) { + char b[4] = {0}; + + _Static_assert(sizeof(int) == 4, "Wrong triple for the test"); + + clang_analyzer_dump_int(__builtin_bit_cast(int, b)); // expected-warning {{lazyCompoundVal}} + clang_analyzer_dump_int(array[__builtin_bit_cast(int, b)]); // expected-warning {{Unknown}} + + array[__builtin_bit_cast(int, b)] = 0x10; // no crash +} diff --git a/clang/test/Analysis/taint-generic.c b/clang/test/Analysis/taint-generic.c index b0df85f237298..1c139312734bc 100644 --- a/clang/test/Analysis/taint-generic.c +++ b/clang/test/Analysis/taint-generic.c @@ -63,6 +63,7 @@ void clang_analyzer_isTainted_char(char); void clang_analyzer_isTainted_wchar(wchar_t); void clang_analyzer_isTainted_charp(char*); void clang_analyzer_isTainted_int(int); +void clang_analyzer_dump_int(int); int coin(); @@ -459,7 +460,53 @@ unsigned radar11369570_hanging(const unsigned char *arr, int l) { longcmp(a, t, c); l -= 12; } - return 5/a; // expected-warning {{Division by a tainted value, possibly zero}} + return 5/a; // FIXME: Should be a "div by tainted" warning here. +} + +// This computation used to take a very long time. +void complex_taint_queries(const int *p) { + int tainted = 0; + scanf("%d", &tainted); + + // Make "tmp" tainted. + int tmp = tainted + tainted; + clang_analyzer_isTainted_int(tmp); // expected-warning{{YES}} + + // Make "tmp" SymExpr a lot more complicated by applying computation. + // This should balloon the symbol complexity. + tmp += p[0] + p[0]; + tmp += p[1] + p[1]; + tmp += p[2] + p[2]; + clang_analyzer_dump_int(tmp); // expected-warning{{((((conj_}} symbol complexity: 8 + clang_analyzer_isTainted_int(tmp); // expected-warning{{YES}} + + tmp += p[3] + p[3]; + clang_analyzer_dump_int(tmp); // expected-warning{{(((((conj_}} symbol complexity: 10 + clang_analyzer_isTainted_int(tmp); // expected-warning{{NO}} 10 is already too complex to be traversed + + tmp += p[4] + p[4]; + tmp += p[5] + p[5]; + tmp += p[6] + p[6]; + tmp += p[7] + p[7]; + tmp += p[8] + p[8]; + tmp += p[9] + p[9]; + tmp += p[10] + p[10]; + tmp += p[11] + p[11]; + tmp += p[12] + p[12]; + tmp += p[13] + p[13]; + tmp += p[14] + p[14]; + tmp += p[15] + p[15]; + + // The SymExpr still holds the full history of the computation, yet, "isTainted" doesn't traverse the tree as the complexity is over the threshold. + clang_analyzer_dump_int(tmp); + // expected-warning@-1{{(((((((((((((((((conj_}} symbol complexity: 34 + clang_analyzer_isTainted_int(tmp); // expected-warning{{NO}} FIXME: Ideally, this should still result in "tainted". + + // By making it even one step more complex, then it would hit the "max-symbol-complexity" + // threshold and the engine would cut the SymExpr and replace it by a new conjured symbol. + tmp += p[16]; + clang_analyzer_dump_int(tmp); // expected-warning{{conj_}} symbol complexity: 1 + clang_analyzer_isTainted_int(tmp); // expected-warning{{NO}} } // Check that we do not assert of the following code. diff --git a/clang/test/CXX/basic/basic.types/p10.cpp b/clang/test/CXX/basic/basic.types/p10.cpp index a543f248e5371..92d6da0035ea5 100644 --- a/clang/test/CXX/basic/basic.types/p10.cpp +++ b/clang/test/CXX/basic/basic.types/p10.cpp @@ -142,7 +142,7 @@ constexpr int arb(int n) { // expected-note {{declared here}} expected-note {{function parameter 'n' with unknown value cannot be used in a constant expression}} } constexpr long Overflow[(1 << 30) << 2]{}; // expected-warning {{requires 34 bits to represent}} \ - expected-warning {{variable length array folded to constant array as an extension}} \ + expected-error {{variable length array declaration not allowed at file scope}} \ expected-warning {{variable length arrays in C++ are a Clang extension}} \ expected-note {{signed left shift discards bits}} diff --git a/clang/test/CodeGen/X86/strictfp_patterns.c b/clang/test/CodeGen/X86/strictfp_patterns.c new file mode 100644 index 0000000000000..55d85f22c3ba3 --- /dev/null +++ b/clang/test/CodeGen/X86/strictfp_patterns.c @@ -0,0 +1,26 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 %s -O2 -emit-llvm -o - -triple x86_64-unknown-unknown -ffreestanding -ffp-exception-behavior=maytrap -Wall -Werror | FileCheck %s + +#include + +// PR104848 - ensure the _mm_set_ss/d headers don't implicity promote any integer/fp values. + +// CHECK-LABEL: @test_mm_set_ss( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[VECINIT3_I:%.*]] = insertelement <4 x float> , float [[NUM:%.*]], i64 0 +// CHECK-NEXT: ret <4 x float> [[VECINIT3_I]] +// +__m128 test_mm_set_ss(float num) +{ + return _mm_set_ss(num); +} + +// CHECK-LABEL: @test_mm_set_sd( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[VECINIT1_I:%.*]] = insertelement <2 x double> , double [[NUM:%.*]], i64 0 +// CHECK-NEXT: ret <2 x double> [[VECINIT1_I]] +// +__m128d test_mm_set_sd(double num) +{ + return _mm_set_sd(num); +} diff --git a/clang/test/CodeGen/aarch64-branch-protection-attr.c b/clang/test/CodeGen/aarch64-branch-protection-attr.c index e7ae7fb1570c9..c66bce1bee6d3 100644 --- a/clang/test/CodeGen/aarch64-branch-protection-attr.c +++ b/clang/test/CodeGen/aarch64-branch-protection-attr.c @@ -1,6 +1,18 @@ // REQUIRES: aarch64-registered-target // RUN: %clang_cc1 -triple aarch64 -emit-llvm -target-cpu generic -target-feature +v8.5a %s -o - \ // RUN: | FileCheck %s --check-prefix=CHECK +// RUN: %clang_cc1 -triple aarch64 -emit-llvm -target-cpu generic -target-feature +v8.5a -mbranch-target-enforce %s -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK +// RUN: %clang_cc1 -triple aarch64 -emit-llvm -target-cpu generic -target-feature +v8.5a -mguarded-control-stack %s -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK +// RUN: %clang_cc1 -triple aarch64 -emit-llvm -target-cpu generic -target-feature +v8.5a -msign-return-address=non-leaf -msign-return-address-key=a_key %s -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK +// RUN: %clang_cc1 -triple aarch64 -emit-llvm -target-cpu generic -target-feature +v8.5a -msign-return-address=all -msign-return-address-key=b_key %s -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK +// RUN: %clang_cc1 -triple aarch64 -emit-llvm -target-cpu generic -target-feature +v8.5a -mbranch-protection-pauth-lr -msign-return-address=all -msign-return-address-key=a_key %s -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK +// RUN: %clang_cc1 -triple aarch64 -emit-llvm -target-cpu generic -target-feature +v8.5a -mguarded-control-stack -mbranch-target-enforce -mbranch-protection-pauth-lr -msign-return-address=all -msign-return-address-key=a_key %s -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK __attribute__ ((target("branch-protection=none"))) void none() {} @@ -83,7 +95,6 @@ void gcs() {} // CHECK-DAG: attributes #[[#BTIPACLEAF]] = { {{.*}} "branch-target-enforcement" {{.*}}"sign-return-address"="all" "sign-return-address-key"="a_key" - // CHECK-DAG: attributes #[[#PAUTHLR]] = { {{.*}} "branch-protection-pauth-lr" {{.*}}"sign-return-address"="non-leaf" "sign-return-address-key"="a_key" // CHECK-DAG: attributes #[[#PAUTHLR_BKEY]] = { {{.*}} "branch-protection-pauth-lr" {{.*}}"sign-return-address"="non-leaf" "sign-return-address-key"="b_key" diff --git a/clang/test/CodeGen/aarch64-fmv-streaming.c b/clang/test/CodeGen/aarch64-fmv-streaming.c new file mode 100644 index 0000000000000..e549ccda59ad8 --- /dev/null +++ b/clang/test/CodeGen/aarch64-fmv-streaming.c @@ -0,0 +1,107 @@ +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -emit-llvm -o - %s | FileCheck %s + + +// CHECK-LABEL: define {{[^@]+}}@n_callee._Msve +// CHECK-SAME: () #[[ATTR0:[0-9]+]] { +// +// CHECK-LABEL: define {{[^@]+}}@n_callee._Msimd +// CHECK-SAME: () #[[ATTR1:[0-9]+]] { +// +__arm_locally_streaming __attribute__((target_clones("sve", "simd"))) void n_callee(void) {} +// CHECK-LABEL: define {{[^@]+}}@n_callee._Msme2 +// CHECK-SAME: () #[[ATTR2:[0-9]+]] { +// +__attribute__((target_version("sme2"))) void n_callee(void) {} +// CHECK-LABEL: define {{[^@]+}}@n_callee.default +// CHECK-SAME: () #[[ATTR3:[0-9]+]] { +// +__attribute__((target_version("default"))) void n_callee(void) {} + + +// CHECK-LABEL: define {{[^@]+}}@s_callee._Msve +// CHECK-SAME: () #[[ATTR4:[0-9]+]] { +// +// CHECK-LABEL: define {{[^@]+}}@s_callee._Msimd +// CHECK-SAME: () #[[ATTR5:[0-9]+]] { +// +__attribute__((target_clones("sve", "simd"))) void s_callee(void) __arm_streaming {} +// CHECK-LABEL: define {{[^@]+}}@s_callee._Msme2 +// CHECK-SAME: () #[[ATTR6:[0-9]+]] { +// +__arm_locally_streaming __attribute__((target_version("sme2"))) void s_callee(void) __arm_streaming {} +// CHECK-LABEL: define {{[^@]+}}@s_callee.default +// CHECK-SAME: () #[[ATTR7:[0-9]+]] { +// +__attribute__((target_version("default"))) void s_callee(void) __arm_streaming {} + + +// CHECK-LABEL: define {{[^@]+}}@sc_callee._Msve +// CHECK-SAME: () #[[ATTR8:[0-9]+]] { +// +// CHECK-LABEL: define {{[^@]+}}@sc_callee._Msimd +// CHECK-SAME: () #[[ATTR9:[0-9]+]] { +// +__attribute__((target_clones("sve", "simd"))) void sc_callee(void) __arm_streaming_compatible {} +// CHECK-LABEL: define {{[^@]+}}@sc_callee._Msme2 +// CHECK-SAME: () #[[ATTR10:[0-9]+]] { +// +__arm_locally_streaming __attribute__((target_version("sme2"))) void sc_callee(void) __arm_streaming_compatible {} +// CHECK-LABEL: define {{[^@]+}}@sc_callee.default +// CHECK-SAME: () #[[ATTR11:[0-9]+]] { +// +__attribute__((target_version("default"))) void sc_callee(void) __arm_streaming_compatible {} + + +// CHECK-LABEL: define {{[^@]+}}@n_caller +// CHECK-SAME: () #[[ATTR3:[0-9]+]] { +// CHECK: call void @n_callee() +// CHECK: call void @s_callee() #[[ATTR12:[0-9]+]] +// CHECK: call void @sc_callee() #[[ATTR13:[0-9]+]] +// +void n_caller(void) { + n_callee(); + s_callee(); + sc_callee(); +} + + +// CHECK-LABEL: define {{[^@]+}}@s_caller +// CHECK-SAME: () #[[ATTR7:[0-9]+]] { +// CHECK: call void @n_callee() +// CHECK: call void @s_callee() #[[ATTR12]] +// CHECK: call void @sc_callee() #[[ATTR13]] +// +void s_caller(void) __arm_streaming { + n_callee(); + s_callee(); + sc_callee(); +} + + +// CHECK-LABEL: define {{[^@]+}}@sc_caller +// CHECK-SAME: () #[[ATTR11:[0-9]+]] { +// CHECK: call void @n_callee() +// CHECK: call void @s_callee() #[[ATTR12]] +// CHECK: call void @sc_callee() #[[ATTR13]] +// +void sc_caller(void) __arm_streaming_compatible { + n_callee(); + s_callee(); + sc_callee(); +} + + +// CHECK: attributes #[[ATTR0:[0-9]+]] = {{.*}} "aarch64_pstate_sm_body" +// CHECK: attributes #[[ATTR1:[0-9]+]] = {{.*}} "aarch64_pstate_sm_body" +// CHECK: attributes #[[ATTR2:[0-9]+]] = {{.*}} +// CHECK: attributes #[[ATTR3]] = {{.*}} +// CHECK: attributes #[[ATTR4:[0-9]+]] = {{.*}} "aarch64_pstate_sm_enabled" +// CHECK: attributes #[[ATTR5:[0-9]+]] = {{.*}} "aarch64_pstate_sm_enabled" +// CHECK: attributes #[[ATTR6:[0-9]+]] = {{.*}} "aarch64_pstate_sm_body" "aarch64_pstate_sm_enabled" +// CHECK: attributes #[[ATTR7]] = {{.*}} "aarch64_pstate_sm_enabled" +// CHECK: attributes #[[ATTR8:[0-9]+]] = {{.*}} "aarch64_pstate_sm_compatible" +// CHECK: attributes #[[ATTR9:[0-9]+]] = {{.*}} "aarch64_pstate_sm_compatible" +// CHECK: attributes #[[ATTR10]] = {{.*}} "aarch64_pstate_sm_body" "aarch64_pstate_sm_compatible" +// CHECK: attributes #[[ATTR11]] = {{.*}} "aarch64_pstate_sm_compatible" +// CHECK: attributes #[[ATTR12]] = {{.*}} "aarch64_pstate_sm_enabled" +// CHECK: attributes #[[ATTR13]] = {{.*}} "aarch64_pstate_sm_compatible" diff --git a/clang/test/CodeGen/aarch64-sme-inline-streaming-attrs.c b/clang/test/CodeGen/aarch64-sme-inline-streaming-attrs.c index 25aebeced9379..9c3d08a25945a 100644 --- a/clang/test/CodeGen/aarch64-sme-inline-streaming-attrs.c +++ b/clang/test/CodeGen/aarch64-sme-inline-streaming-attrs.c @@ -3,6 +3,8 @@ // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -verify -DTEST_STREAMING %s // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -verify -DTEST_LOCALLY %s +// REQUIRES: aarch64-registered-target + #define __ai __attribute__((always_inline)) __ai void inlined_fn(void) {} __ai void inlined_fn_streaming_compatible(void) __arm_streaming_compatible {} @@ -20,7 +22,7 @@ void caller(void) { #ifdef TEST_COMPATIBLE void caller_compatible(void) __arm_streaming_compatible { - inlined_fn(); // expected-error {{always_inline function 'inlined_fn' and its caller 'caller_compatible' have mismatching streaming attributes}} + inlined_fn(); // expected-warning {{always_inline function 'inlined_fn' and its caller 'caller_compatible' have mismatching streaming attributes, inlining may change runtime behaviour}} inlined_fn_streaming_compatible(); inlined_fn_streaming(); // expected-error {{always_inline function 'inlined_fn_streaming' and its caller 'caller_compatible' have mismatching streaming attributes}} inlined_fn_local(); // expected-error {{always_inline function 'inlined_fn_local' and its caller 'caller_compatible' have mismatching streaming attributes}} @@ -29,7 +31,7 @@ void caller_compatible(void) __arm_streaming_compatible { #ifdef TEST_STREAMING void caller_streaming(void) __arm_streaming { - inlined_fn(); // expected-error {{always_inline function 'inlined_fn' and its caller 'caller_streaming' have mismatching streaming attributes}} + inlined_fn(); // expected-warning {{always_inline function 'inlined_fn' and its caller 'caller_streaming' have mismatching streaming attributes, inlining may change runtime behaviour}} inlined_fn_streaming_compatible(); inlined_fn_streaming(); inlined_fn_local(); @@ -39,7 +41,7 @@ void caller_streaming(void) __arm_streaming { #ifdef TEST_LOCALLY __arm_locally_streaming void caller_local(void) { - inlined_fn(); // expected-error {{always_inline function 'inlined_fn' and its caller 'caller_local' have mismatching streaming attributes}} + inlined_fn(); // expected-warning {{always_inline function 'inlined_fn' and its caller 'caller_local' have mismatching streaming attributes, inlining may change runtime behaviour}} inlined_fn_streaming_compatible(); inlined_fn_streaming(); inlined_fn_local(); diff --git a/clang/test/CodeGen/aarch64-soft-float-abi-errors.c b/clang/test/CodeGen/aarch64-soft-float-abi-errors.c index 95b7668aca1b0..6961ee4b88886 100644 --- a/clang/test/CodeGen/aarch64-soft-float-abi-errors.c +++ b/clang/test/CodeGen/aarch64-soft-float-abi-errors.c @@ -69,7 +69,7 @@ inline void test_float_arg_inline(float a) {} inline void test_float_arg_inline_used(float a) {} // nofp-hard-opt-error@-1 {{'a' requires 'float' type support, but ABI 'aapcs' does not support it}} void use_inline() { test_float_arg_inline_used(1.0f); } -// nofp-hard-error@-1 {{'use_inline' requires 'float' type support, but ABI 'aapcs' does not support it}} +// nofp-hard-error@-1 {{'test_float_arg_inline_used' requires 'float' type support, but ABI 'aapcs' does not support it}} // The always_inline attribute causes an inline function to always be // code-genned, even at -O0, so we always emit the error. @@ -77,7 +77,7 @@ __attribute((always_inline)) inline void test_float_arg_always_inline_used(float a) {} // nofp-hard-error@-1 {{'a' requires 'float' type support, but ABI 'aapcs' does not support it}} void use_always_inline() { test_float_arg_always_inline_used(1.0f); } -// nofp-hard-error@-1 {{'use_always_inline' requires 'float' type support, but ABI 'aapcs' does not support it}} +// nofp-hard-error@-1 {{'test_float_arg_always_inline_used' requires 'float' type support, but ABI 'aapcs' does not support it}} // Floating-point expressions, global variables and local variables do not // affect the ABI, so are allowed. GCC does reject some uses of floating point @@ -103,9 +103,9 @@ int test_var_double(int a) { extern void extern_float_arg(float); extern float extern_float_ret(void); void call_extern_float_arg() { extern_float_arg(1.0f); } -// nofp-hard-error@-1 {{'call_extern_float_arg' requires 'float' type support, but ABI 'aapcs' does not support it}} +// nofp-hard-error@-1 {{'extern_float_arg' requires 'float' type support, but ABI 'aapcs' does not support it}} void call_extern_float_ret() { extern_float_ret(); } -// nofp-hard-error@-1 {{'call_extern_float_ret' requires 'float' type support, but ABI 'aapcs' does not support it}} +// nofp-hard-error@-1 {{'extern_float_ret' requires 'float' type support, but ABI 'aapcs' does not support it}} // Definitions of variadic functions, and calls to them which only use integer // argument registers, are both fine. @@ -115,7 +115,7 @@ void call_variadic_int() { variadic(0, 1); } // Calls to variadic functions with floating-point arguments are an error, // since this would require floating-point registers. void call_variadic_double() { variadic(0, 1.0); } -// nofp-hard-error@-1 {{'call_variadic_double' requires 'double' type support, but ABI 'aapcs' does not support it}} +// nofp-hard-error@-1 {{'variadic' requires 'double' type support, but ABI 'aapcs' does not support it}} // Calls through function pointers are also diagnosed. void (*fptr)(float); diff --git a/clang/test/CodeGen/aarch64-targetattr.c b/clang/test/CodeGen/aarch64-targetattr.c index 4f891f938b618..a5f94b46cbb17 100644 --- a/clang/test/CodeGen/aarch64-targetattr.c +++ b/clang/test/CodeGen/aarch64-targetattr.c @@ -191,25 +191,34 @@ __attribute__((target("no-v9.3a"))) // void minusarch() {} +__attribute__((target("cpu=apple-m4"))) +// CHECK-LABEL: define {{[^@]+}}@applem4 +// CHECK-SAME: () #[[ATTR18:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: ret void +// +void applem4() {} + //. // CHECK: attributes #[[ATTR0]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc,+fp-armv8,+lse,+neon,+ras,+rdm,+v8.1a,+v8.2a,+v8a" } // CHECK: attributes #[[ATTR1]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rdm,+sve,+v8.1a,+v8.2a,+v8a" } // CHECK: attributes #[[ATTR2]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rdm,+sve,+sve2,+v8.1a,+v8.2a,+v8a" } -// CHECK: attributes #[[ATTR3]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+complxnum,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+ras,+rcpc,+rdm,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a" } -// CHECK: attributes #[[ATTR4]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a710" "target-features"="+bf16,+complxnum,+crc,+dotprod,+ete,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+mte,+neon,+pauth,+perfmon,+ras,+rcpc,+rdm,+sb,+sve,+sve2,+sve2-bitperm,+trbe,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+v9a" } +// CHECK: attributes #[[ATTR3]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+predres,+ras,+rcpc,+rdm,+sb,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a" } +// CHECK: attributes #[[ATTR4]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a710" "target-features"="+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+ete,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+mte,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+ssbs,+sve,+sve2,+sve2-bitperm,+trbe,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+v9a" } // CHECK: attributes #[[ATTR5]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "tune-cpu"="cortex-a710" } // CHECK: attributes #[[ATTR6]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+ete,+fp-armv8,+neon,+trbe,+v8a" } // CHECK: attributes #[[ATTR7]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "tune-cpu"="generic" } // CHECK: attributes #[[ATTR8]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-n1" "target-features"="+aes,+crc,+dotprod,+fp-armv8,+fullfp16,+lse,+neon,+perfmon,+ras,+rcpc,+rdm,+sha2,+spe,+ssbs,+v8.1a,+v8.2a,+v8a" "tune-cpu"="cortex-a710" } // CHECK: attributes #[[ATTR9]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+sve" "tune-cpu"="cortex-a710" } -// CHECK: attributes #[[ATTR10]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-v1" "target-features"="+aes,+bf16,+ccdp,+complxnum,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } -// CHECK: attributes #[[ATTR11]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-v1" "target-features"="+aes,+bf16,+ccdp,+complxnum,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,-sve" } +// CHECK: attributes #[[ATTR10]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-v1" "target-features"="+aes,+bf16,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" } +// CHECK: attributes #[[ATTR11]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-v1" "target-features"="+aes,+bf16,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,-sve" } // CHECK: attributes #[[ATTR12]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+sve" } // CHECK: attributes #[[ATTR13]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16" } -// CHECK: attributes #[[ATTR14]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-n1" "target-features"="+aes,+bf16,+complxnum,+crc,+dotprod,+fp-armv8,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+ras,+rcpc,+rdm,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a" "tune-cpu"="cortex-a710" } -// CHECK: attributes #[[ATTR15]] = { noinline nounwind optnone "branch-target-enforcement" "guarded-control-stack" "no-trapping-math"="true" "sign-return-address"="non-leaf" "sign-return-address-key"="a_key" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-n1" "target-features"="+aes,+bf16,+complxnum,+crc,+dotprod,+fp-armv8,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+ras,+rcpc,+rdm,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a" "tune-cpu"="cortex-a710" } +// CHECK: attributes #[[ATTR14]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-n1" "target-features"="+aes,+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a" "tune-cpu"="cortex-a710" } +// CHECK: attributes #[[ATTR15]] = { noinline nounwind optnone "branch-target-enforcement" "guarded-control-stack" "no-trapping-math"="true" "sign-return-address"="non-leaf" "sign-return-address-key"="a_key" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-n1" "target-features"="+aes,+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a" "tune-cpu"="cortex-a710" } // CHECK: attributes #[[ATTR16]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" } // CHECK: attributes #[[ATTR17]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-v9.3a" } +// CHECK: attributes #[[ATTR18]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m4" "target-features"="+aes,+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+sme,+sme-f64f64,+sme-i16i64,+sme2,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8.7a,+v8a,+wfxt" } //. // CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4} // CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"} diff --git a/clang/test/CodeGen/aix-builtin-cpu-is.c b/clang/test/CodeGen/aix-builtin-cpu-is.c index e17cf7353511a..04644dd7020e0 100644 --- a/clang/test/CodeGen/aix-builtin-cpu-is.c +++ b/clang/test/CodeGen/aix-builtin-cpu-is.c @@ -50,6 +50,10 @@ // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=262144 \ // RUN: --check-prefix=CHECKOP +// RUN: echo "int main() { return __builtin_cpu_is(\"power11\");}" > %t.c +// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=524288 \ +// RUN: --check-prefix=CHECKOP + // CHECK: define i32 @main() #0 { // CHECK-NEXT: entry: // CHECK-NEXT: %retval = alloca i32, align 4 diff --git a/clang/test/CodeGen/arm-branch-protection-attr-1.c b/clang/test/CodeGen/arm-branch-protection-attr-1.c index dd38cf347f04f..5ca6a1a4d13b4 100644 --- a/clang/test/CodeGen/arm-branch-protection-attr-1.c +++ b/clang/test/CodeGen/arm-branch-protection-attr-1.c @@ -1,6 +1,12 @@ // REQUIRES: arm-registered-target // RUN: %clang_cc1 -triple thumbv7m-unknown-unknown-eabi -emit-llvm %s -o - \ // RUN: | FileCheck %s --check-prefix=CHECK +// RUN: %clang_cc1 -triple thumbv7m-unknown-unknown-eabi -mbranch-target-enforce -emit-llvm %s -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK +// RUN: %clang_cc1 -triple thumbv7m-unknown-unknown-eabi -msign-return-address=all -emit-llvm %s -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK +// RUN: %clang_cc1 -triple thumbv7m-unknown-unknown-eabi -mbranch-target-enforce -msign-return-address=all -emit-llvm %s -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK __attribute__((target("branch-protection=none"))) void none() {} // CHECK: define{{.*}} void @none() #[[#NONE:]] diff --git a/clang/test/CodeGen/arm-mve-intrinsics/vld24.c b/clang/test/CodeGen/arm-mve-intrinsics/vld24.c index 03c870e281549..15619bef5373d 100644 --- a/clang/test/CodeGen/arm-mve-intrinsics/vld24.c +++ b/clang/test/CodeGen/arm-mve-intrinsics/vld24.c @@ -48,10 +48,13 @@ uint8x16x4_t test_vld4q_u8(const uint8_t *addr) // CHECK-LABEL: @test_vst2q_u32( // CHECK-NEXT: entry: -// CHECK-NEXT: [[VALUE_COERCE_FCA_0_0_EXTRACT:%.*]] = extractvalue [[STRUCT_UINT32X4X2_T:%.*]] [[VALUE_COERCE:%.*]], 0, 0 -// CHECK-NEXT: [[VALUE_COERCE_FCA_0_1_EXTRACT:%.*]] = extractvalue [[STRUCT_UINT32X4X2_T]] [[VALUE_COERCE]], 0, 1 -// CHECK-NEXT: call void @llvm.arm.mve.vst2q.p0.v4i32(ptr [[ADDR:%.*]], <4 x i32> [[VALUE_COERCE_FCA_0_0_EXTRACT]], <4 x i32> [[VALUE_COERCE_FCA_0_1_EXTRACT]], i32 0) -// CHECK-NEXT: call void @llvm.arm.mve.vst2q.p0.v4i32(ptr [[ADDR]], <4 x i32> [[VALUE_COERCE_FCA_0_0_EXTRACT]], <4 x i32> [[VALUE_COERCE_FCA_0_1_EXTRACT]], i32 1) +// CHECK-NEXT: [[TMP0:%.*]] = extractvalue [[STRUCT_UINT32X4X2_T:%.*]] [[VALUE_COERCE:%.*]], 0 +// CHECK-NEXT: [[DOTFCA_0_EXTRACT:%.*]] = extractvalue [2 x <4 x i32>] [[TMP0]], 0 +// CHECK-NEXT: [[DOTFCA_1_EXTRACT:%.*]] = extractvalue [2 x <4 x i32>] [[TMP0]], 1 +// CHECK-NEXT: [[DOTFCA_0_0_INSERT:%.*]] = insertvalue [[STRUCT_UINT32X4X2_T]] poison, <4 x i32> [[DOTFCA_0_EXTRACT]], 0, 0 +// CHECK-NEXT: [[DOTFCA_0_1_INSERT:%.*]] = insertvalue [[STRUCT_UINT32X4X2_T]] [[DOTFCA_0_0_INSERT]], <4 x i32> [[DOTFCA_1_EXTRACT]], 0, 1 +// CHECK-NEXT: call void @llvm.arm.mve.vst2q.p0.v4i32(ptr [[ADDR:%.*]], <4 x i32> [[DOTFCA_0_EXTRACT]], <4 x i32> [[DOTFCA_1_EXTRACT]], i32 0) +// CHECK-NEXT: call void @llvm.arm.mve.vst2q.p0.v4i32(ptr [[ADDR]], <4 x i32> [[DOTFCA_0_EXTRACT]], <4 x i32> [[DOTFCA_1_EXTRACT]], i32 1) // CHECK-NEXT: ret void // void test_vst2q_u32(uint32_t *addr, uint32x4x2_t value) @@ -65,14 +68,19 @@ void test_vst2q_u32(uint32_t *addr, uint32x4x2_t value) // CHECK-LABEL: @test_vst4q_s8( // CHECK-NEXT: entry: -// CHECK-NEXT: [[VALUE_COERCE_FCA_0_0_EXTRACT:%.*]] = extractvalue [[STRUCT_INT8X16X4_T:%.*]] [[VALUE_COERCE:%.*]], 0, 0 -// CHECK-NEXT: [[VALUE_COERCE_FCA_0_1_EXTRACT:%.*]] = extractvalue [[STRUCT_INT8X16X4_T]] [[VALUE_COERCE]], 0, 1 -// CHECK-NEXT: [[VALUE_COERCE_FCA_0_2_EXTRACT:%.*]] = extractvalue [[STRUCT_INT8X16X4_T]] [[VALUE_COERCE]], 0, 2 -// CHECK-NEXT: [[VALUE_COERCE_FCA_0_3_EXTRACT:%.*]] = extractvalue [[STRUCT_INT8X16X4_T]] [[VALUE_COERCE]], 0, 3 -// CHECK-NEXT: call void @llvm.arm.mve.vst4q.p0.v16i8(ptr [[ADDR:%.*]], <16 x i8> [[VALUE_COERCE_FCA_0_0_EXTRACT]], <16 x i8> [[VALUE_COERCE_FCA_0_1_EXTRACT]], <16 x i8> [[VALUE_COERCE_FCA_0_2_EXTRACT]], <16 x i8> [[VALUE_COERCE_FCA_0_3_EXTRACT]], i32 0) -// CHECK-NEXT: call void @llvm.arm.mve.vst4q.p0.v16i8(ptr [[ADDR]], <16 x i8> [[VALUE_COERCE_FCA_0_0_EXTRACT]], <16 x i8> [[VALUE_COERCE_FCA_0_1_EXTRACT]], <16 x i8> [[VALUE_COERCE_FCA_0_2_EXTRACT]], <16 x i8> [[VALUE_COERCE_FCA_0_3_EXTRACT]], i32 1) -// CHECK-NEXT: call void @llvm.arm.mve.vst4q.p0.v16i8(ptr [[ADDR]], <16 x i8> [[VALUE_COERCE_FCA_0_0_EXTRACT]], <16 x i8> [[VALUE_COERCE_FCA_0_1_EXTRACT]], <16 x i8> [[VALUE_COERCE_FCA_0_2_EXTRACT]], <16 x i8> [[VALUE_COERCE_FCA_0_3_EXTRACT]], i32 2) -// CHECK-NEXT: call void @llvm.arm.mve.vst4q.p0.v16i8(ptr [[ADDR]], <16 x i8> [[VALUE_COERCE_FCA_0_0_EXTRACT]], <16 x i8> [[VALUE_COERCE_FCA_0_1_EXTRACT]], <16 x i8> [[VALUE_COERCE_FCA_0_2_EXTRACT]], <16 x i8> [[VALUE_COERCE_FCA_0_3_EXTRACT]], i32 3) +// CHECK-NEXT: [[TMP0:%.*]] = extractvalue [[STRUCT_INT8X16X4_T:%.*]] [[VALUE_COERCE:%.*]], 0 +// CHECK-NEXT: [[DOTFCA_0_EXTRACT:%.*]] = extractvalue [4 x <16 x i8>] [[TMP0]], 0 +// CHECK-NEXT: [[DOTFCA_1_EXTRACT:%.*]] = extractvalue [4 x <16 x i8>] [[TMP0]], 1 +// CHECK-NEXT: [[DOTFCA_2_EXTRACT:%.*]] = extractvalue [4 x <16 x i8>] [[TMP0]], 2 +// CHECK-NEXT: [[DOTFCA_3_EXTRACT:%.*]] = extractvalue [4 x <16 x i8>] [[TMP0]], 3 +// CHECK-NEXT: [[DOTFCA_0_0_INSERT:%.*]] = insertvalue [[STRUCT_INT8X16X4_T]] poison, <16 x i8> [[DOTFCA_0_EXTRACT]], 0, 0 +// CHECK-NEXT: [[DOTFCA_0_1_INSERT:%.*]] = insertvalue [[STRUCT_INT8X16X4_T]] [[DOTFCA_0_0_INSERT]], <16 x i8> [[DOTFCA_1_EXTRACT]], 0, 1 +// CHECK-NEXT: [[DOTFCA_0_2_INSERT:%.*]] = insertvalue [[STRUCT_INT8X16X4_T]] [[DOTFCA_0_1_INSERT]], <16 x i8> [[DOTFCA_2_EXTRACT]], 0, 2 +// CHECK-NEXT: [[DOTFCA_0_3_INSERT:%.*]] = insertvalue [[STRUCT_INT8X16X4_T]] [[DOTFCA_0_2_INSERT]], <16 x i8> [[DOTFCA_3_EXTRACT]], 0, 3 +// CHECK-NEXT: call void @llvm.arm.mve.vst4q.p0.v16i8(ptr [[ADDR:%.*]], <16 x i8> [[DOTFCA_0_EXTRACT]], <16 x i8> [[DOTFCA_1_EXTRACT]], <16 x i8> [[DOTFCA_2_EXTRACT]], <16 x i8> [[DOTFCA_3_EXTRACT]], i32 0) +// CHECK-NEXT: call void @llvm.arm.mve.vst4q.p0.v16i8(ptr [[ADDR]], <16 x i8> [[DOTFCA_0_EXTRACT]], <16 x i8> [[DOTFCA_1_EXTRACT]], <16 x i8> [[DOTFCA_2_EXTRACT]], <16 x i8> [[DOTFCA_3_EXTRACT]], i32 1) +// CHECK-NEXT: call void @llvm.arm.mve.vst4q.p0.v16i8(ptr [[ADDR]], <16 x i8> [[DOTFCA_0_EXTRACT]], <16 x i8> [[DOTFCA_1_EXTRACT]], <16 x i8> [[DOTFCA_2_EXTRACT]], <16 x i8> [[DOTFCA_3_EXTRACT]], i32 2) +// CHECK-NEXT: call void @llvm.arm.mve.vst4q.p0.v16i8(ptr [[ADDR]], <16 x i8> [[DOTFCA_0_EXTRACT]], <16 x i8> [[DOTFCA_1_EXTRACT]], <16 x i8> [[DOTFCA_2_EXTRACT]], <16 x i8> [[DOTFCA_3_EXTRACT]], i32 3) // CHECK-NEXT: ret void // void test_vst4q_s8(int8_t *addr, int8x16x4_t value) @@ -86,10 +94,13 @@ void test_vst4q_s8(int8_t *addr, int8x16x4_t value) // CHECK-LABEL: @test_vst2q_f16( // CHECK-NEXT: entry: -// CHECK-NEXT: [[VALUE_COERCE_FCA_0_0_EXTRACT:%.*]] = extractvalue [[STRUCT_FLOAT16X8X2_T:%.*]] [[VALUE_COERCE:%.*]], 0, 0 -// CHECK-NEXT: [[VALUE_COERCE_FCA_0_1_EXTRACT:%.*]] = extractvalue [[STRUCT_FLOAT16X8X2_T]] [[VALUE_COERCE]], 0, 1 -// CHECK-NEXT: call void @llvm.arm.mve.vst2q.p0.v8f16(ptr [[ADDR:%.*]], <8 x half> [[VALUE_COERCE_FCA_0_0_EXTRACT]], <8 x half> [[VALUE_COERCE_FCA_0_1_EXTRACT]], i32 0) -// CHECK-NEXT: call void @llvm.arm.mve.vst2q.p0.v8f16(ptr [[ADDR]], <8 x half> [[VALUE_COERCE_FCA_0_0_EXTRACT]], <8 x half> [[VALUE_COERCE_FCA_0_1_EXTRACT]], i32 1) +// CHECK-NEXT: [[TMP0:%.*]] = extractvalue [[STRUCT_FLOAT16X8X2_T:%.*]] [[VALUE_COERCE:%.*]], 0 +// CHECK-NEXT: [[DOTFCA_0_EXTRACT:%.*]] = extractvalue [2 x <8 x half>] [[TMP0]], 0 +// CHECK-NEXT: [[DOTFCA_1_EXTRACT:%.*]] = extractvalue [2 x <8 x half>] [[TMP0]], 1 +// CHECK-NEXT: [[DOTFCA_0_0_INSERT:%.*]] = insertvalue [[STRUCT_FLOAT16X8X2_T]] poison, <8 x half> [[DOTFCA_0_EXTRACT]], 0, 0 +// CHECK-NEXT: [[DOTFCA_0_1_INSERT:%.*]] = insertvalue [[STRUCT_FLOAT16X8X2_T]] [[DOTFCA_0_0_INSERT]], <8 x half> [[DOTFCA_1_EXTRACT]], 0, 1 +// CHECK-NEXT: call void @llvm.arm.mve.vst2q.p0.v8f16(ptr [[ADDR:%.*]], <8 x half> [[DOTFCA_0_EXTRACT]], <8 x half> [[DOTFCA_1_EXTRACT]], i32 0) +// CHECK-NEXT: call void @llvm.arm.mve.vst2q.p0.v8f16(ptr [[ADDR]], <8 x half> [[DOTFCA_0_EXTRACT]], <8 x half> [[DOTFCA_1_EXTRACT]], i32 1) // CHECK-NEXT: ret void // void test_vst2q_f16(float16_t *addr, float16x8x2_t value) diff --git a/clang/test/CodeGen/arm-vfp16-arguments2.cpp b/clang/test/CodeGen/arm-vfp16-arguments2.cpp index 6221e85e856b4..b7c6852c47b7f 100644 --- a/clang/test/CodeGen/arm-vfp16-arguments2.cpp +++ b/clang/test/CodeGen/arm-vfp16-arguments2.cpp @@ -44,20 +44,20 @@ struct S1 f1(struct S1 s1) { return s1; } // CHECK-SOFT: define{{.*}} void @_Z2f22S2(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.S2) align 8 %agg.result, [4 x i32] %s2.coerce) // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc [2 x <2 x i32>] @_Z2f22S2([2 x <2 x i32>] returned %s2.coerce) -// CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.S2 @_Z2f22S2(%struct.S2 returned %s2.coerce) +// CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.S2 @_Z2f22S2(%struct.S2 %s2.coerce) struct S2 f2(struct S2 s2) { return s2; } // CHECK-SOFT: define{{.*}} void @_Z2f32S3(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.S3) align 8 %agg.result, [2 x i64] %s3.coerce) // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc [2 x <2 x i32>] @_Z2f32S3([2 x <2 x i32>] returned %s3.coerce) -// CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.S3 @_Z2f32S3(%struct.S3 returned %s3.coerce) +// CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.S3 @_Z2f32S3(%struct.S3 %s3.coerce) struct S3 f3(struct S3 s3) { return s3; } // CHECK-SOFT: define{{.*}} void @_Z2f42S4(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.S4) align 8 %agg.result, [2 x i64] %s4.coerce) // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc [2 x <2 x i32>] @_Z2f42S4([2 x <2 x i32>] returned %s4.coerce) -// CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.S4 @_Z2f42S4(%struct.S4 returned %s4.coerce) +// CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.S4 @_Z2f42S4(%struct.S4 %s4.coerce) struct S4 f4(struct S4 s4) { return s4; } // CHECK-SOFT: define{{.*}} void @_Z2f52S5(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.S5) align 8 %agg.result, [2 x i64] %s5.coerce) -// CHECK-HARD: define{{.*}} arm_aapcs_vfpcc %struct.S5 @_Z2f52S5(%struct.S5 returned %s5.coerce) -// CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.S5 @_Z2f52S5(%struct.S5 returned %s5.coerce) +// CHECK-HARD: define{{.*}} arm_aapcs_vfpcc %struct.S5 @_Z2f52S5(%struct.S5 %s5.coerce) +// CHECK-FULL: define{{.*}} arm_aapcs_vfpcc %struct.S5 @_Z2f52S5(%struct.S5 %s5.coerce) struct S5 f5(struct S5 s5) { return s5; } diff --git a/clang/test/CodeGen/arm64ec-hybrid-patchable.c b/clang/test/CodeGen/arm64ec-hybrid-patchable.c new file mode 100644 index 0000000000000..4d1fa12afd2aa --- /dev/null +++ b/clang/test/CodeGen/arm64ec-hybrid-patchable.c @@ -0,0 +1,34 @@ +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple arm64ec-pc-windows -fms-extensions -emit-llvm -o - %s -verify | FileCheck %s + +// CHECK: ; Function Attrs: hybrid_patchable noinline nounwind optnone +// CHECK-NEXT: define dso_local i32 @func() #0 { +int __attribute__((hybrid_patchable)) func(void) { return 1; } + +// CHECK: ; Function Attrs: hybrid_patchable noinline nounwind optnone +// CHECK-NEXT: define dso_local i32 @func2() #0 { +int __declspec(hybrid_patchable) func2(void) { return 2; } + +// CHECK: ; Function Attrs: hybrid_patchable noinline nounwind optnone +// CHECK-NEXT: define dso_local i32 @func3() #0 { +int __declspec(hybrid_patchable) func3(void); +int func3(void) { return 3; } + +// CHECK: ; Function Attrs: hybrid_patchable noinline nounwind optnone +// CHECK-NEXT: define dso_local i32 @func4() #0 { +[[clang::hybrid_patchable]] int func4(void); +int func4(void) { return 3; } + +// CHECK: ; Function Attrs: hybrid_patchable noinline nounwind optnone +// CHECK-NEXT: define internal void @static_func() #0 { +// expected-warning@+1 {{'hybrid_patchable' is ignored on functions without external linkage}} +static void __declspec(hybrid_patchable) static_func(void) {} + +// CHECK: ; Function Attrs: hybrid_patchable noinline nounwind optnone +// CHECK-NEXT: define linkonce_odr dso_local i32 @func5() #0 comdat { +int inline __declspec(hybrid_patchable) func5(void) { return 4; } + +void caller(void) { + static_func(); + func5(); +} diff --git a/clang/test/CodeGen/builtin-cpu-supports.c b/clang/test/CodeGen/builtin-cpu-supports.c index 88eb7b0fa786e..f960040ab094b 100644 --- a/clang/test/CodeGen/builtin-cpu-supports.c +++ b/clang/test/CodeGen/builtin-cpu-supports.c @@ -129,25 +129,69 @@ int v4() { return __builtin_cpu_supports("x86-64-v4"); } // CHECK-PPC: if.else3: // CHECK-PPC-NEXT: [[CPU_IS:%.*]] = call i32 @llvm.ppc.fixed.addr.ld(i32 3) // CHECK-PPC-NEXT: [[TMP6:%.*]] = icmp eq i32 [[CPU_IS]], 39 -// CHECK-PPC-NEXT: br i1 [[TMP6]], label [[IF_THEN4:%.*]], label [[IF_END:%.*]] +// CHECK-PPC-NEXT: br i1 [[TMP6]], label [[IF_THEN4:%.*]], label [[IF_ELSE5:%.*]] // CHECK-PPC: if.then4: // CHECK-PPC-NEXT: [[TMP7:%.*]] = load i32, ptr [[A_ADDR]], align 4 // CHECK-PPC-NEXT: [[TMP8:%.*]] = load i32, ptr [[A_ADDR]], align 4 // CHECK-PPC-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP7]], [[TMP8]] // CHECK-PPC-NEXT: store i32 [[ADD]], ptr [[RETVAL]], align 4 // CHECK-PPC-NEXT: br label [[RETURN]] +// CHECK-PPC: if.else5: +// CHECK-PPC-NEXT: [[CPU_IS6:%.*]] = call i32 @llvm.ppc.fixed.addr.ld(i32 3) +// CHECK-PPC-NEXT: [[TMP9:%.*]] = icmp eq i32 [[CPU_IS6]], 45 +// CHECK-PPC-NEXT: br i1 [[TMP9]], label [[IF_THEN7:%.*]], label [[IF_ELSE9:%.*]] +// CHECK-PPC: if.then7: +// CHECK-PPC-NEXT: [[TMP10:%.*]] = load i32, ptr [[A_ADDR]], align 4 +// CHECK-PPC-NEXT: [[ADD8:%.*]] = add nsw i32 [[TMP10]], 3 +// CHECK-PPC-NEXT: store i32 [[ADD8]], ptr [[RETVAL]], align 4 +// CHECK-PPC-NEXT: br label [[RETURN]] +// CHECK-PPC: if.else9: +// CHECK-PPC-NEXT: [[CPU_IS10:%.*]] = call i32 @llvm.ppc.fixed.addr.ld(i32 3) +// CHECK-PPC-NEXT: [[TMP11:%.*]] = icmp eq i32 [[CPU_IS10]], 46 +// CHECK-PPC-NEXT: br i1 [[TMP11]], label [[IF_THEN11:%.*]], label [[IF_ELSE13:%.*]] +// CHECK-PPC: if.then11: +// CHECK-PPC-NEXT: [[TMP12:%.*]] = load i32, ptr [[A_ADDR]], align 4 +// CHECK-PPC-NEXT: [[SUB12:%.*]] = sub nsw i32 [[TMP12]], 3 +// CHECK-PPC-NEXT: store i32 [[SUB12]], ptr [[RETVAL]], align 4 +// CHECK-PPC-NEXT: br label [[RETURN]] +// CHECK-PPC: if.else13: +// CHECK-PPC-NEXT: [[CPU_IS14:%.*]] = call i32 @llvm.ppc.fixed.addr.ld(i32 3) +// CHECK-PPC-NEXT: [[TMP13:%.*]] = icmp eq i32 [[CPU_IS14]], 47 +// CHECK-PPC-NEXT: br i1 [[TMP13]], label [[IF_THEN15:%.*]], label [[IF_ELSE17:%.*]] +// CHECK-PPC: if.then15: +// CHECK-PPC-NEXT: [[TMP14:%.*]] = load i32, ptr [[A_ADDR]], align 4 +// CHECK-PPC-NEXT: [[ADD16:%.*]] = add nsw i32 [[TMP14]], 7 +// CHECK-PPC-NEXT: store i32 [[ADD16]], ptr [[RETVAL]], align 4 +// CHECK-PPC-NEXT: br label [[RETURN]] +// CHECK-PPC: if.else17: +// CHECK-PPC-NEXT: [[CPU_IS18:%.*]] = call i32 @llvm.ppc.fixed.addr.ld(i32 3) +// CHECK-PPC-NEXT: [[TMP15:%.*]] = icmp eq i32 [[CPU_IS18]], 48 +// CHECK-PPC-NEXT: br i1 [[TMP15]], label [[IF_THEN19:%.*]], label [[IF_END:%.*]] +// CHECK-PPC: if.then19: +// CHECK-PPC-NEXT: [[TMP16:%.*]] = load i32, ptr [[A_ADDR]], align 4 +// CHECK-PPC-NEXT: [[SUB20:%.*]] = sub nsw i32 [[TMP16]], 7 +// CHECK-PPC-NEXT: store i32 [[SUB20]], ptr [[RETVAL]], align 4 +// CHECK-PPC-NEXT: br label [[RETURN]] // CHECK-PPC: if.end: -// CHECK-PPC-NEXT: br label [[IF_END5:%.*]] -// CHECK-PPC: if.end5: -// CHECK-PPC-NEXT: br label [[IF_END6:%.*]] -// CHECK-PPC: if.end6: -// CHECK-PPC-NEXT: [[TMP9:%.*]] = load i32, ptr [[A_ADDR]], align 4 -// CHECK-PPC-NEXT: [[ADD7:%.*]] = add nsw i32 [[TMP9]], 5 -// CHECK-PPC-NEXT: store i32 [[ADD7]], ptr [[RETVAL]], align 4 +// CHECK-PPC-NEXT: br label [[IF_END21:%.*]] +// CHECK-PPC: if.end21: +// CHECK-PPC-NEXT: br label [[IF_END22:%.*]] +// CHECK-PPC: if.end22: +// CHECK-PPC-NEXT: br label [[IF_END23:%.*]] +// CHECK-PPC: if.end23: +// CHECK-PPC-NEXT: br label [[IF_END24:%.*]] +// CHECK-PPC: if.end24: +// CHECK-PPC-NEXT: br label [[IF_END25:%.*]] +// CHECK-PPC: if.end25: +// CHECK-PPC-NEXT: br label [[IF_END26:%.*]] +// CHECK-PPC: if.end26: +// CHECK-PPC-NEXT: [[TMP17:%.*]] = load i32, ptr [[A_ADDR]], align 4 +// CHECK-PPC-NEXT: [[ADD27:%.*]] = add nsw i32 [[TMP17]], 5 +// CHECK-PPC-NEXT: store i32 [[ADD27]], ptr [[RETVAL]], align 4 // CHECK-PPC-NEXT: br label [[RETURN]] // CHECK-PPC: return: -// CHECK-PPC-NEXT: [[TMP10:%.*]] = load i32, ptr [[RETVAL]], align 4 -// CHECK-PPC-NEXT: ret i32 [[TMP10]] +// CHECK-PPC-NEXT: [[TMP18:%.*]] = load i32, ptr [[RETVAL]], align 4 +// CHECK-PPC-NEXT: ret i32 [[TMP18]] // int test(int a) { if (__builtin_cpu_supports("arch_3_00")) // HWCAP2 @@ -156,6 +200,14 @@ int test(int a) { return a - 5; else if (__builtin_cpu_is("power7")) // CPUID return a + a; + else if (__builtin_cpu_is("power8")) + return a + 3; + else if (__builtin_cpu_is("power9")) + return a - 3; + else if (__builtin_cpu_is("power10")) + return a + 7; + else if (__builtin_cpu_is("power11")) + return a - 7; return a + 5; } #endif diff --git a/clang/test/CodeGen/ptrauth-function-attributes.c b/clang/test/CodeGen/ptrauth-function-attributes.c index 7f93ccc7c4bce..e7081f00b4f68 100644 --- a/clang/test/CodeGen/ptrauth-function-attributes.c +++ b/clang/test/CodeGen/ptrauth-function-attributes.c @@ -1,11 +1,18 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,OFF // RUN: %clang_cc1 -triple arm64e-apple-ios -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,OFF // RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,OFF -// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,CALLS +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,CALLS // RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,CALLS -// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-indirect-gotos -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,GOTOS -// RUN: %clang_cc1 -triple arm64e-apple-ios -fptrauth-indirect-gotos -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,GOTOS +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-returns -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,RETS +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-returns -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,RETS + +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-auth-traps -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,TRAPS +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-auth-traps -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,TRAPS + +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-indirect-gotos -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,GOTOS +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-indirect-gotos -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,GOTOS // ALL: define {{(dso_local )?}}void @test() #0 void test() { @@ -13,6 +20,10 @@ void test() { // CALLS: attributes #0 = {{{.*}} "ptrauth-calls" {{.*}}} +// RETS: attributes #0 = {{{.*}} "ptrauth-returns" {{.*}}} + +// TRAPS: attributes #0 = {{{.*}} "ptrauth-auth-traps" {{.*}}} + // GOTOS: attributes #0 = {{{.*}} "ptrauth-indirect-gotos" {{.*}}} // OFF-NOT: attributes {{.*}} "ptrauth- diff --git a/clang/test/CodeGen/target-builtin-noerror.c b/clang/test/CodeGen/target-builtin-noerror.c index 2e16fd8b9fe4d..d681dcd3a13e8 100644 --- a/clang/test/CodeGen/target-builtin-noerror.c +++ b/clang/test/CodeGen/target-builtin-noerror.c @@ -205,4 +205,5 @@ void verifycpustrings(void) { (void)__builtin_cpu_is("znver2"); (void)__builtin_cpu_is("znver3"); (void)__builtin_cpu_is("znver4"); + (void)__builtin_cpu_is("znver5"); } diff --git a/clang/test/CodeGen/ubsan-function.cpp b/clang/test/CodeGen/ubsan-function.cpp index 8478f05a10b78..76d4237383f83 100644 --- a/clang/test/CodeGen/ubsan-function.cpp +++ b/clang/test/CodeGen/ubsan-function.cpp @@ -4,7 +4,8 @@ // RUN: %clang_cc1 -triple aarch64_be-linux-gnu -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all | FileCheck %s --check-prefixes=CHECK,GNU,64 // RUN: %clang_cc1 -triple arm-none-eabi -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all | FileCheck %s --check-prefixes=CHECK,ARM,GNU,32 -// RUN: %clang_cc1 -triple arm64e-apple-ios -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all -fptrauth-calls | FileCheck %s --check-prefixes=CHECK,GNU,64,64e +// RUN: %clang_cc1 -triple arm64e-apple-ios -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all -fptrauth-calls | FileCheck %s --check-prefixes=CHECK,GNU,64,AUTH +// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all -fptrauth-calls | FileCheck %s --check-prefixes=CHECK,GNU,64,AUTH // GNU: define{{.*}} void @_Z3funv() #0 !func_sanitize ![[FUNCSAN:.*]] { // MSVC: define{{.*}} void @"?fun@@YAXXZ"() #0 !func_sanitize ![[FUNCSAN:.*]] { @@ -15,8 +16,8 @@ void fun() {} // ARM: ptrtoint ptr {{.*}} to i32, !nosanitize !5 // ARM: and i32 {{.*}}, -2, !nosanitize !5 // ARM: inttoptr i32 {{.*}} to ptr, !nosanitize !5 -// 64e: %[[STRIPPED:.*]] = ptrtoint ptr {{.*}} to i64, !nosanitize -// 64e: call i64 @llvm.ptrauth.auth(i64 %[[STRIPPED]], i32 0, i64 0), !nosanitize +// AUTH: %[[STRIPPED:.*]] = ptrtoint ptr {{.*}} to i64, !nosanitize +// AUTH: call i64 @llvm.ptrauth.auth(i64 %[[STRIPPED]], i32 0, i64 0), !nosanitize // CHECK: getelementptr <{ i32, i32 }>, ptr {{.*}}, i32 -1, i32 0, !nosanitize // CHECK: load i32, ptr {{.*}}, align {{.*}}, !nosanitize // CHECK: icmp eq i32 {{.*}}, -1056584962, !nosanitize diff --git a/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu b/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu index a5135ab01f0f3..70c86cbb8c3d4 100644 --- a/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu +++ b/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu @@ -16,9 +16,8 @@ // HOST: define{{.*}} void @_Z22__device_stub__kernel1Pi(ptr noundef %x) // COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel1Pi(ptr addrspace(1){{.*}} %x.coerce) -// CHECK: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr // CHECK-NOT: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr -// OPT: [[VAL:%.*]] = load i32, ptr addrspace(1) %x.coerce, align 4, !amdgpu.noclobber ![[MD:[0-9]+]] +// OPT: [[VAL:%.*]] = load i32, ptr addrspace(1) %x.coerce, align 4{{$}} // OPT: [[INC:%.*]] = add nsw i32 [[VAL]], 1 // OPT: store i32 [[INC]], ptr addrspace(1) %x.coerce, align 4 // OPT: ret void @@ -28,9 +27,8 @@ __global__ void kernel1(int *x) { // HOST: define{{.*}} void @_Z22__device_stub__kernel2Ri(ptr noundef nonnull align 4 dereferenceable(4) %x) // COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel2Ri(ptr addrspace(1){{.*}} nonnull align 4 dereferenceable(4) %x.coerce) -// CHECK: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr // CHECK-NOT: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr -// OPT: [[VAL:%.*]] = load i32, ptr addrspace(1) %x.coerce, align 4, !amdgpu.noclobber ![[MD]] +// OPT: [[VAL:%.*]] = load i32, ptr addrspace(1) %x.coerce, align 4{{$}} // OPT: [[INC:%.*]] = add nsw i32 [[VAL]], 1 // OPT: store i32 [[INC]], ptr addrspace(1) %x.coerce, align 4 // OPT: ret void @@ -67,7 +65,7 @@ struct S { // OPT: [[R1:%.*]] = getelementptr inbounds i8, ptr addrspace(4) %0, i64 8 // OPT: [[P1:%.*]] = load ptr, ptr addrspace(4) [[R1]], align 8 // OPT: [[G1:%.*]] ={{.*}} addrspacecast ptr [[P1]] to ptr addrspace(1) -// OPT: [[V0:%.*]] = load i32, ptr addrspace(1) [[G0]], align 4, !amdgpu.noclobber ![[MD]] +// OPT: [[V0:%.*]] = load i32, ptr addrspace(1) [[G0]], align 4, !amdgpu.noclobber ![[MD:[0-9]+]] // OPT: [[INC:%.*]] = add nsw i32 [[V0]], 1 // OPT: store i32 [[INC]], ptr addrspace(1) [[G0]], align 4 // OPT: [[V1:%.*]] = load float, ptr addrspace(1) [[G1]], align 4 @@ -126,9 +124,8 @@ struct SS { }; // HOST: define{{.*}} void @_Z22__device_stub__kernel82SS(ptr %a.coerce) // COMMON-LABEL: define{{.*}} amdgpu_kernel void @_Z7kernel82SS(ptr addrspace(1){{.*}} %a.coerce) -// CHECK: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr // CHECK-NOT: ={{.*}} addrspacecast ptr addrspace(1) %{{.*}} to ptr -// OPT: [[VAL:%.*]] = load float, ptr addrspace(1) %a.coerce, align 4, !amdgpu.noclobber ![[MD]] +// OPT: [[VAL:%.*]] = load float, ptr addrspace(1) %a.coerce, align 4{{$}} // OPT: [[INC:%.*]] = fadd contract float [[VAL]], 3.000000e+00 // OPT: store float [[INC]], ptr addrspace(1) %a.coerce, align 4 // OPT: ret void diff --git a/clang/test/CodeGenCUDA/builtins-amdgcn.cu b/clang/test/CodeGenCUDA/builtins-amdgcn.cu index 2e88afac813f4..4bf23e529c7a5 100644 --- a/clang/test/CodeGenCUDA/builtins-amdgcn.cu +++ b/clang/test/CodeGenCUDA/builtins-amdgcn.cu @@ -17,17 +17,16 @@ // CHECK-NEXT: [[OUT_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[OUT]] to ptr // CHECK-NEXT: [[OUT_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[OUT_ADDR]] to ptr // CHECK-NEXT: [[DISPATCH_PTR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[DISPATCH_PTR]] to ptr -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[OUT_COERCE:%.*]] to ptr -// CHECK-NEXT: store ptr [[TMP0]], ptr [[OUT_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[OUT_COERCE:%.*]], ptr [[OUT_ASCAST]], align 8 // CHECK-NEXT: [[OUT1:%.*]] = load ptr, ptr [[OUT_ASCAST]], align 8 // CHECK-NEXT: store ptr [[OUT1]], ptr [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = call align 4 dereferenceable(64) ptr addrspace(4) @llvm.amdgcn.dispatch.ptr() -// CHECK-NEXT: [[TMP2:%.*]] = addrspacecast ptr addrspace(4) [[TMP1]] to ptr -// CHECK-NEXT: store ptr [[TMP2]], ptr [[DISPATCH_PTR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DISPATCH_PTR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4 -// CHECK-NEXT: [[TMP5:%.*]] = load ptr, ptr [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: store i32 [[TMP4]], ptr [[TMP5]], align 4 +// CHECK-NEXT: [[TMP0:%.*]] = call align 4 dereferenceable(64) ptr addrspace(4) @llvm.amdgcn.dispatch.ptr() +// CHECK-NEXT: [[TMP1:%.*]] = addrspacecast ptr addrspace(4) [[TMP0]] to ptr +// CHECK-NEXT: store ptr [[TMP1]], ptr [[DISPATCH_PTR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DISPATCH_PTR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP2]], align 4 +// CHECK-NEXT: [[TMP4:%.*]] = load ptr, ptr [[OUT_ADDR_ASCAST]], align 8 +// CHECK-NEXT: store i32 [[TMP3]], ptr [[TMP4]], align 4 // CHECK-NEXT: ret void // __global__ void use_dispatch_ptr(int* out) { @@ -43,17 +42,16 @@ __global__ void use_dispatch_ptr(int* out) { // CHECK-NEXT: [[OUT_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[OUT]] to ptr // CHECK-NEXT: [[OUT_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[OUT_ADDR]] to ptr // CHECK-NEXT: [[QUEUE_PTR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[QUEUE_PTR]] to ptr -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[OUT_COERCE:%.*]] to ptr -// CHECK-NEXT: store ptr [[TMP0]], ptr [[OUT_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[OUT_COERCE:%.*]], ptr [[OUT_ASCAST]], align 8 // CHECK-NEXT: [[OUT1:%.*]] = load ptr, ptr [[OUT_ASCAST]], align 8 // CHECK-NEXT: store ptr [[OUT1]], ptr [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(4) @llvm.amdgcn.queue.ptr() -// CHECK-NEXT: [[TMP2:%.*]] = addrspacecast ptr addrspace(4) [[TMP1]] to ptr -// CHECK-NEXT: store ptr [[TMP2]], ptr [[QUEUE_PTR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[QUEUE_PTR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4 -// CHECK-NEXT: [[TMP5:%.*]] = load ptr, ptr [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: store i32 [[TMP4]], ptr [[TMP5]], align 4 +// CHECK-NEXT: [[TMP0:%.*]] = call ptr addrspace(4) @llvm.amdgcn.queue.ptr() +// CHECK-NEXT: [[TMP1:%.*]] = addrspacecast ptr addrspace(4) [[TMP0]] to ptr +// CHECK-NEXT: store ptr [[TMP1]], ptr [[QUEUE_PTR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load ptr, ptr [[QUEUE_PTR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP2]], align 4 +// CHECK-NEXT: [[TMP4:%.*]] = load ptr, ptr [[OUT_ADDR_ASCAST]], align 8 +// CHECK-NEXT: store i32 [[TMP3]], ptr [[TMP4]], align 4 // CHECK-NEXT: ret void // __global__ void use_queue_ptr(int* out) { @@ -69,17 +67,16 @@ __global__ void use_queue_ptr(int* out) { // CHECK-NEXT: [[OUT_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[OUT]] to ptr // CHECK-NEXT: [[OUT_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[OUT_ADDR]] to ptr // CHECK-NEXT: [[IMPLICITARG_PTR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[IMPLICITARG_PTR]] to ptr -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[OUT_COERCE:%.*]] to ptr -// CHECK-NEXT: store ptr [[TMP0]], ptr [[OUT_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[OUT_COERCE:%.*]], ptr [[OUT_ASCAST]], align 8 // CHECK-NEXT: [[OUT1:%.*]] = load ptr, ptr [[OUT_ASCAST]], align 8 // CHECK-NEXT: store ptr [[OUT1]], ptr [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = call ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr() -// CHECK-NEXT: [[TMP2:%.*]] = addrspacecast ptr addrspace(4) [[TMP1]] to ptr -// CHECK-NEXT: store ptr [[TMP2]], ptr [[IMPLICITARG_PTR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[IMPLICITARG_PTR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4 -// CHECK-NEXT: [[TMP5:%.*]] = load ptr, ptr [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: store i32 [[TMP4]], ptr [[TMP5]], align 4 +// CHECK-NEXT: [[TMP0:%.*]] = call ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr() +// CHECK-NEXT: [[TMP1:%.*]] = addrspacecast ptr addrspace(4) [[TMP0]] to ptr +// CHECK-NEXT: store ptr [[TMP1]], ptr [[IMPLICITARG_PTR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load ptr, ptr [[IMPLICITARG_PTR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP2]], align 4 +// CHECK-NEXT: [[TMP4:%.*]] = load ptr, ptr [[OUT_ADDR_ASCAST]], align 8 +// CHECK-NEXT: store i32 [[TMP3]], ptr [[TMP4]], align 4 // CHECK-NEXT: ret void // __global__ void use_implicitarg_ptr(int* out) { @@ -134,16 +131,15 @@ __global__ void test_ds_fadd(float src) { // CHECK-NEXT: [[SRC_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[SRC_ADDR]] to ptr // CHECK-NEXT: [[SHARED_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[SHARED_ADDR]] to ptr // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X]] to ptr -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[SHARED_COERCE:%.*]] to ptr -// CHECK-NEXT: store ptr [[TMP0]], ptr [[SHARED_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[SHARED_COERCE:%.*]], ptr [[SHARED_ASCAST]], align 8 // CHECK-NEXT: [[SHARED1:%.*]] = load ptr, ptr [[SHARED_ASCAST]], align 8 // CHECK-NEXT: store float [[SRC:%.*]], ptr [[SRC_ADDR_ASCAST]], align 4 // CHECK-NEXT: store ptr [[SHARED1]], ptr [[SHARED_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[SHARED_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP2:%.*]] = addrspacecast ptr [[TMP1]] to ptr addrspace(3) -// CHECK-NEXT: [[TMP3:%.*]] = load float, ptr [[SRC_ADDR_ASCAST]], align 4 -// CHECK-NEXT: [[TMP4:%.*]] = atomicrmw fmin ptr addrspace(3) [[TMP2]], float [[TMP3]] monotonic, align 4 -// CHECK-NEXT: store volatile float [[TMP4]], ptr [[X_ASCAST]], align 4 +// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SHARED_ADDR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = addrspacecast ptr [[TMP0]] to ptr addrspace(3) +// CHECK-NEXT: [[TMP2:%.*]] = load float, ptr [[SRC_ADDR_ASCAST]], align 4 +// CHECK-NEXT: [[TMP3:%.*]] = atomicrmw fmin ptr addrspace(3) [[TMP1]], float [[TMP2]] monotonic, align 4 +// CHECK-NEXT: store volatile float [[TMP3]], ptr [[X_ASCAST]], align 4 // CHECK-NEXT: ret void // __global__ void test_ds_fmin(float src, float *shared) { @@ -184,17 +180,16 @@ __global__ void endpgm() { // CHECK-NEXT: [[OUT_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[OUT_ADDR]] to ptr // CHECK-NEXT: [[A_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[A_ADDR]] to ptr // CHECK-NEXT: [[B_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[B_ADDR]] to ptr -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[OUT_COERCE:%.*]] to ptr -// CHECK-NEXT: store ptr [[TMP0]], ptr [[OUT_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[OUT_COERCE:%.*]], ptr [[OUT_ASCAST]], align 8 // CHECK-NEXT: [[OUT1:%.*]] = load ptr, ptr [[OUT_ASCAST]], align 8 // CHECK-NEXT: store ptr [[OUT1]], ptr [[OUT_ADDR_ASCAST]], align 8 // CHECK-NEXT: store i64 [[A:%.*]], ptr [[A_ADDR_ASCAST]], align 8 // CHECK-NEXT: store i64 [[B:%.*]], ptr [[B_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load i64, ptr [[A_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP2:%.*]] = load i64, ptr [[B_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP3:%.*]] = call i64 @llvm.amdgcn.icmp.i64.i64(i64 [[TMP1]], i64 [[TMP2]], i32 35) -// CHECK-NEXT: [[TMP4:%.*]] = load ptr, ptr [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: store i64 [[TMP3]], ptr [[TMP4]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr [[A_ADDR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load i64, ptr [[B_ADDR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = call i64 @llvm.amdgcn.icmp.i64.i64(i64 [[TMP0]], i64 [[TMP1]], i32 35) +// CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[OUT_ADDR_ASCAST]], align 8 +// CHECK-NEXT: store i64 [[TMP2]], ptr [[TMP3]], align 8 // CHECK-NEXT: ret void // __global__ void test_uicmp_i64(unsigned long long *out, unsigned long long a, unsigned long long b) @@ -210,13 +205,12 @@ __global__ void test_uicmp_i64(unsigned long long *out, unsigned long long a, un // CHECK-NEXT: [[OUT_ADDR:%.*]] = alloca ptr, align 8, addrspace(5) // CHECK-NEXT: [[OUT_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[OUT]] to ptr // CHECK-NEXT: [[OUT_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[OUT_ADDR]] to ptr -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[OUT_COERCE:%.*]] to ptr -// CHECK-NEXT: store ptr [[TMP0]], ptr [[OUT_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[OUT_COERCE:%.*]], ptr [[OUT_ASCAST]], align 8 // CHECK-NEXT: [[OUT1:%.*]] = load ptr, ptr [[OUT_ASCAST]], align 8 // CHECK-NEXT: store ptr [[OUT1]], ptr [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = call i64 @llvm.amdgcn.s.memtime() -// CHECK-NEXT: [[TMP2:%.*]] = load ptr, ptr [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: store i64 [[TMP1]], ptr [[TMP2]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = call i64 @llvm.amdgcn.s.memtime() +// CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[OUT_ADDR_ASCAST]], align 8 +// CHECK-NEXT: store i64 [[TMP0]], ptr [[TMP1]], align 8 // CHECK-NEXT: ret void // __global__ void test_s_memtime(unsigned long long* out) @@ -237,18 +231,17 @@ __device__ void func(float *x); // CHECK-NEXT: [[SRC_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[SRC_ADDR]] to ptr // CHECK-NEXT: [[SHARED_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[SHARED_ADDR]] to ptr // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X]] to ptr -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[SHARED_COERCE:%.*]] to ptr -// CHECK-NEXT: store ptr [[TMP0]], ptr [[SHARED_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[SHARED_COERCE:%.*]], ptr [[SHARED_ASCAST]], align 8 // CHECK-NEXT: [[SHARED1:%.*]] = load ptr, ptr [[SHARED_ASCAST]], align 8 // CHECK-NEXT: store float [[SRC:%.*]], ptr [[SRC_ADDR_ASCAST]], align 4 // CHECK-NEXT: store ptr [[SHARED1]], ptr [[SHARED_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[SHARED_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP2:%.*]] = addrspacecast ptr [[TMP1]] to ptr addrspace(3) -// CHECK-NEXT: [[TMP3:%.*]] = load float, ptr [[SRC_ADDR_ASCAST]], align 4 -// CHECK-NEXT: [[TMP4:%.*]] = atomicrmw fmin ptr addrspace(3) [[TMP2]], float [[TMP3]] monotonic, align 4 -// CHECK-NEXT: store volatile float [[TMP4]], ptr [[X_ASCAST]], align 4 -// CHECK-NEXT: [[TMP5:%.*]] = load ptr, ptr [[SHARED_ADDR_ASCAST]], align 8 -// CHECK-NEXT: call void @_Z4funcPf(ptr noundef [[TMP5]]) #[[ATTR7:[0-9]+]] +// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SHARED_ADDR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = addrspacecast ptr [[TMP0]] to ptr addrspace(3) +// CHECK-NEXT: [[TMP2:%.*]] = load float, ptr [[SRC_ADDR_ASCAST]], align 4 +// CHECK-NEXT: [[TMP3:%.*]] = atomicrmw fmin ptr addrspace(3) [[TMP1]], float [[TMP2]] monotonic, align 4 +// CHECK-NEXT: store volatile float [[TMP3]], ptr [[X_ASCAST]], align 4 +// CHECK-NEXT: [[TMP4:%.*]] = load ptr, ptr [[SHARED_ADDR_ASCAST]], align 8 +// CHECK-NEXT: call void @_Z4funcPf(ptr noundef [[TMP4]]) #[[ATTR7:[0-9]+]] // CHECK-NEXT: ret void // __global__ void test_ds_fmin_func(float src, float *__restrict shared) { @@ -264,14 +257,13 @@ __global__ void test_ds_fmin_func(float src, float *__restrict shared) { // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X]] to ptr // CHECK-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X_ADDR]] to ptr // CHECK-NEXT: [[RET_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[RET]] to ptr -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[X_COERCE:%.*]] to ptr -// CHECK-NEXT: store ptr [[TMP0]], ptr [[X_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[X_COERCE:%.*]], ptr [[X_ASCAST]], align 8 // CHECK-NEXT: [[X1:%.*]] = load ptr, ptr [[X_ASCAST]], align 8 // CHECK-NEXT: store ptr [[X1]], ptr [[X_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[X_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP2:%.*]] = call i1 @llvm.amdgcn.is.shared(ptr [[TMP1]]) -// CHECK-NEXT: [[FROMBOOL:%.*]] = zext i1 [[TMP2]] to i8 -// CHECK-NEXT: store i8 [[FROMBOOL]], ptr [[RET_ASCAST]], align 1 +// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[X_ADDR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.amdgcn.is.shared(ptr [[TMP0]]) +// CHECK-NEXT: [[STOREDV:%.*]] = zext i1 [[TMP1]] to i8 +// CHECK-NEXT: store i8 [[STOREDV]], ptr [[RET_ASCAST]], align 1 // CHECK-NEXT: ret void // __global__ void test_is_shared(float *x){ @@ -286,14 +278,13 @@ __global__ void test_is_shared(float *x){ // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X]] to ptr // CHECK-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X_ADDR]] to ptr // CHECK-NEXT: [[RET_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[RET]] to ptr -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[X_COERCE:%.*]] to ptr -// CHECK-NEXT: store ptr [[TMP0]], ptr [[X_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[X_COERCE:%.*]], ptr [[X_ASCAST]], align 8 // CHECK-NEXT: [[X1:%.*]] = load ptr, ptr [[X_ASCAST]], align 8 // CHECK-NEXT: store ptr [[X1]], ptr [[X_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[X_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP2:%.*]] = call i1 @llvm.amdgcn.is.private(ptr [[TMP1]]) -// CHECK-NEXT: [[FROMBOOL:%.*]] = zext i1 [[TMP2]] to i8 -// CHECK-NEXT: store i8 [[FROMBOOL]], ptr [[RET_ASCAST]], align 1 +// CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[X_ADDR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.amdgcn.is.private(ptr [[TMP0]]) +// CHECK-NEXT: [[STOREDV:%.*]] = zext i1 [[TMP1]] to i8 +// CHECK-NEXT: store i8 [[STOREDV]], ptr [[RET_ASCAST]], align 1 // CHECK-NEXT: ret void // __global__ void test_is_private(int *x){ diff --git a/clang/test/CodeGenCUDA/builtins-spirv-amdgcn.cu b/clang/test/CodeGenCUDA/builtins-spirv-amdgcn.cu index 32851805298f1..1cbe358910b85 100644 --- a/clang/test/CodeGenCUDA/builtins-spirv-amdgcn.cu +++ b/clang/test/CodeGenCUDA/builtins-spirv-amdgcn.cu @@ -17,16 +17,15 @@ // CHECK-NEXT: [[OUT_ASCAST:%.*]] = addrspacecast ptr [[OUT]] to ptr addrspace(4) // CHECK-NEXT: [[OUT_ADDR_ASCAST:%.*]] = addrspacecast ptr [[OUT_ADDR]] to ptr addrspace(4) // CHECK-NEXT: [[DISPATCH_PTR_ASCAST:%.*]] = addrspacecast ptr [[DISPATCH_PTR]] to ptr addrspace(4) -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[OUT_COERCE:%.*]] to ptr addrspace(4) -// CHECK-NEXT: store ptr addrspace(4) [[TMP0]], ptr addrspace(4) [[OUT_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[OUT_COERCE:%.*]], ptr addrspace(4) [[OUT_ASCAST]], align 8 // CHECK-NEXT: [[OUT1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ASCAST]], align 8 // CHECK-NEXT: store ptr addrspace(4) [[OUT1]], ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = call align 4 dereferenceable(64) addrspace(4) ptr addrspace(4) @llvm.amdgcn.dispatch.ptr() -// CHECK-NEXT: store ptr addrspace(4) [[TMP1]], ptr addrspace(4) [[DISPATCH_PTR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP2:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[DISPATCH_PTR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr addrspace(4) [[TMP2]], align 4 -// CHECK-NEXT: [[TMP4:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: store i32 [[TMP3]], ptr addrspace(4) [[TMP4]], align 4 +// CHECK-NEXT: [[TMP0:%.*]] = call align 4 dereferenceable(64) addrspace(4) ptr addrspace(4) @llvm.amdgcn.dispatch.ptr() +// CHECK-NEXT: store ptr addrspace(4) [[TMP0]], ptr addrspace(4) [[DISPATCH_PTR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[DISPATCH_PTR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr addrspace(4) [[TMP1]], align 4 +// CHECK-NEXT: [[TMP3:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 +// CHECK-NEXT: store i32 [[TMP2]], ptr addrspace(4) [[TMP3]], align 4 // CHECK-NEXT: ret void // __global__ void use_dispatch_ptr(int* out) { @@ -42,16 +41,15 @@ __global__ void use_dispatch_ptr(int* out) { // CHECK-NEXT: [[OUT_ASCAST:%.*]] = addrspacecast ptr [[OUT]] to ptr addrspace(4) // CHECK-NEXT: [[OUT_ADDR_ASCAST:%.*]] = addrspacecast ptr [[OUT_ADDR]] to ptr addrspace(4) // CHECK-NEXT: [[QUEUE_PTR_ASCAST:%.*]] = addrspacecast ptr [[QUEUE_PTR]] to ptr addrspace(4) -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[OUT_COERCE:%.*]] to ptr addrspace(4) -// CHECK-NEXT: store ptr addrspace(4) [[TMP0]], ptr addrspace(4) [[OUT_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[OUT_COERCE:%.*]], ptr addrspace(4) [[OUT_ASCAST]], align 8 // CHECK-NEXT: [[OUT1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ASCAST]], align 8 // CHECK-NEXT: store ptr addrspace(4) [[OUT1]], ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = call addrspace(4) ptr addrspace(4) @llvm.amdgcn.queue.ptr() -// CHECK-NEXT: store ptr addrspace(4) [[TMP1]], ptr addrspace(4) [[QUEUE_PTR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP2:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[QUEUE_PTR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr addrspace(4) [[TMP2]], align 4 -// CHECK-NEXT: [[TMP4:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: store i32 [[TMP3]], ptr addrspace(4) [[TMP4]], align 4 +// CHECK-NEXT: [[TMP0:%.*]] = call addrspace(4) ptr addrspace(4) @llvm.amdgcn.queue.ptr() +// CHECK-NEXT: store ptr addrspace(4) [[TMP0]], ptr addrspace(4) [[QUEUE_PTR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[QUEUE_PTR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr addrspace(4) [[TMP1]], align 4 +// CHECK-NEXT: [[TMP3:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 +// CHECK-NEXT: store i32 [[TMP2]], ptr addrspace(4) [[TMP3]], align 4 // CHECK-NEXT: ret void // __global__ void use_queue_ptr(int* out) { @@ -67,16 +65,15 @@ __global__ void use_queue_ptr(int* out) { // CHECK-NEXT: [[OUT_ASCAST:%.*]] = addrspacecast ptr [[OUT]] to ptr addrspace(4) // CHECK-NEXT: [[OUT_ADDR_ASCAST:%.*]] = addrspacecast ptr [[OUT_ADDR]] to ptr addrspace(4) // CHECK-NEXT: [[IMPLICITARG_PTR_ASCAST:%.*]] = addrspacecast ptr [[IMPLICITARG_PTR]] to ptr addrspace(4) -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[OUT_COERCE:%.*]] to ptr addrspace(4) -// CHECK-NEXT: store ptr addrspace(4) [[TMP0]], ptr addrspace(4) [[OUT_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[OUT_COERCE:%.*]], ptr addrspace(4) [[OUT_ASCAST]], align 8 // CHECK-NEXT: [[OUT1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ASCAST]], align 8 // CHECK-NEXT: store ptr addrspace(4) [[OUT1]], ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = call addrspace(4) ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr() -// CHECK-NEXT: store ptr addrspace(4) [[TMP1]], ptr addrspace(4) [[IMPLICITARG_PTR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP2:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[IMPLICITARG_PTR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr addrspace(4) [[TMP2]], align 4 -// CHECK-NEXT: [[TMP4:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: store i32 [[TMP3]], ptr addrspace(4) [[TMP4]], align 4 +// CHECK-NEXT: [[TMP0:%.*]] = call addrspace(4) ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr() +// CHECK-NEXT: store ptr addrspace(4) [[TMP0]], ptr addrspace(4) [[IMPLICITARG_PTR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[IMPLICITARG_PTR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr addrspace(4) [[TMP1]], align 4 +// CHECK-NEXT: [[TMP3:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 +// CHECK-NEXT: store i32 [[TMP2]], ptr addrspace(4) [[TMP3]], align 4 // CHECK-NEXT: ret void // __global__ void use_implicitarg_ptr(int* out) { @@ -131,16 +128,15 @@ __global__ void test_ds_fadd(float src) { // CHECK-NEXT: [[SRC_ADDR_ASCAST:%.*]] = addrspacecast ptr [[SRC_ADDR]] to ptr addrspace(4) // CHECK-NEXT: [[SHARED_ADDR_ASCAST:%.*]] = addrspacecast ptr [[SHARED_ADDR]] to ptr addrspace(4) // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast ptr [[X]] to ptr addrspace(4) -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[SHARED_COERCE:%.*]] to ptr addrspace(4) -// CHECK-NEXT: store ptr addrspace(4) [[TMP0]], ptr addrspace(4) [[SHARED_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[SHARED_COERCE:%.*]], ptr addrspace(4) [[SHARED_ASCAST]], align 8 // CHECK-NEXT: [[SHARED1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[SHARED_ASCAST]], align 8 // CHECK-NEXT: store float [[SRC:%.*]], ptr addrspace(4) [[SRC_ADDR_ASCAST]], align 4 // CHECK-NEXT: store ptr addrspace(4) [[SHARED1]], ptr addrspace(4) [[SHARED_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[SHARED_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP2:%.*]] = addrspacecast ptr addrspace(4) [[TMP1]] to ptr addrspace(3) -// CHECK-NEXT: [[TMP3:%.*]] = load float, ptr addrspace(4) [[SRC_ADDR_ASCAST]], align 4 -// CHECK-NEXT: [[TMP4:%.*]] = atomicrmw fmin ptr addrspace(3) [[TMP2]], float [[TMP3]] monotonic, align 4 -// CHECK-NEXT: store volatile float [[TMP4]], ptr addrspace(4) [[X_ASCAST]], align 4 +// CHECK-NEXT: [[TMP0:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[SHARED_ADDR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = addrspacecast ptr addrspace(4) [[TMP0]] to ptr addrspace(3) +// CHECK-NEXT: [[TMP2:%.*]] = load float, ptr addrspace(4) [[SRC_ADDR_ASCAST]], align 4 +// CHECK-NEXT: [[TMP3:%.*]] = atomicrmw fmin ptr addrspace(3) [[TMP1]], float [[TMP2]] monotonic, align 4 +// CHECK-NEXT: store volatile float [[TMP3]], ptr addrspace(4) [[X_ASCAST]], align 4 // CHECK-NEXT: ret void // __global__ void test_ds_fmin(float src, float *shared) { @@ -175,17 +171,16 @@ __global__ void endpgm() { // CHECK-NEXT: [[OUT_ADDR_ASCAST:%.*]] = addrspacecast ptr [[OUT_ADDR]] to ptr addrspace(4) // CHECK-NEXT: [[A_ADDR_ASCAST:%.*]] = addrspacecast ptr [[A_ADDR]] to ptr addrspace(4) // CHECK-NEXT: [[B_ADDR_ASCAST:%.*]] = addrspacecast ptr [[B_ADDR]] to ptr addrspace(4) -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[OUT_COERCE:%.*]] to ptr addrspace(4) -// CHECK-NEXT: store ptr addrspace(4) [[TMP0]], ptr addrspace(4) [[OUT_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[OUT_COERCE:%.*]], ptr addrspace(4) [[OUT_ASCAST]], align 8 // CHECK-NEXT: [[OUT1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ASCAST]], align 8 // CHECK-NEXT: store ptr addrspace(4) [[OUT1]], ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 // CHECK-NEXT: store i64 [[A:%.*]], ptr addrspace(4) [[A_ADDR_ASCAST]], align 8 // CHECK-NEXT: store i64 [[B:%.*]], ptr addrspace(4) [[B_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load i64, ptr addrspace(4) [[A_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP2:%.*]] = load i64, ptr addrspace(4) [[B_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP3:%.*]] = call addrspace(4) i64 @llvm.amdgcn.icmp.i64.i64(i64 [[TMP1]], i64 [[TMP2]], i32 35) -// CHECK-NEXT: [[TMP4:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: store i64 [[TMP3]], ptr addrspace(4) [[TMP4]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr addrspace(4) [[A_ADDR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load i64, ptr addrspace(4) [[B_ADDR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = call addrspace(4) i64 @llvm.amdgcn.icmp.i64.i64(i64 [[TMP0]], i64 [[TMP1]], i32 35) +// CHECK-NEXT: [[TMP3:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 +// CHECK-NEXT: store i64 [[TMP2]], ptr addrspace(4) [[TMP3]], align 8 // CHECK-NEXT: ret void // __global__ void test_uicmp_i64(unsigned long long *out, unsigned long long a, unsigned long long b) @@ -201,13 +196,12 @@ __global__ void test_uicmp_i64(unsigned long long *out, unsigned long long a, un // CHECK-NEXT: [[OUT_ADDR:%.*]] = alloca ptr addrspace(4), align 8 // CHECK-NEXT: [[OUT_ASCAST:%.*]] = addrspacecast ptr [[OUT]] to ptr addrspace(4) // CHECK-NEXT: [[OUT_ADDR_ASCAST:%.*]] = addrspacecast ptr [[OUT_ADDR]] to ptr addrspace(4) -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[OUT_COERCE:%.*]] to ptr addrspace(4) -// CHECK-NEXT: store ptr addrspace(4) [[TMP0]], ptr addrspace(4) [[OUT_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[OUT_COERCE:%.*]], ptr addrspace(4) [[OUT_ASCAST]], align 8 // CHECK-NEXT: [[OUT1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ASCAST]], align 8 // CHECK-NEXT: store ptr addrspace(4) [[OUT1]], ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = call addrspace(4) i64 @llvm.amdgcn.s.memtime() -// CHECK-NEXT: [[TMP2:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 -// CHECK-NEXT: store i64 [[TMP1]], ptr addrspace(4) [[TMP2]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = call addrspace(4) i64 @llvm.amdgcn.s.memtime() +// CHECK-NEXT: [[TMP1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[OUT_ADDR_ASCAST]], align 8 +// CHECK-NEXT: store i64 [[TMP0]], ptr addrspace(4) [[TMP1]], align 8 // CHECK-NEXT: ret void // __global__ void test_s_memtime(unsigned long long* out) @@ -228,18 +222,17 @@ __device__ void func(float *x); // CHECK-NEXT: [[SRC_ADDR_ASCAST:%.*]] = addrspacecast ptr [[SRC_ADDR]] to ptr addrspace(4) // CHECK-NEXT: [[SHARED_ADDR_ASCAST:%.*]] = addrspacecast ptr [[SHARED_ADDR]] to ptr addrspace(4) // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast ptr [[X]] to ptr addrspace(4) -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[SHARED_COERCE:%.*]] to ptr addrspace(4) -// CHECK-NEXT: store ptr addrspace(4) [[TMP0]], ptr addrspace(4) [[SHARED_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[SHARED_COERCE:%.*]], ptr addrspace(4) [[SHARED_ASCAST]], align 8 // CHECK-NEXT: [[SHARED1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[SHARED_ASCAST]], align 8 // CHECK-NEXT: store float [[SRC:%.*]], ptr addrspace(4) [[SRC_ADDR_ASCAST]], align 4 // CHECK-NEXT: store ptr addrspace(4) [[SHARED1]], ptr addrspace(4) [[SHARED_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[SHARED_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP2:%.*]] = addrspacecast ptr addrspace(4) [[TMP1]] to ptr addrspace(3) -// CHECK-NEXT: [[TMP3:%.*]] = load float, ptr addrspace(4) [[SRC_ADDR_ASCAST]], align 4 -// CHECK-NEXT: [[TMP4:%.*]] = atomicrmw fmin ptr addrspace(3) [[TMP2]], float [[TMP3]] monotonic, align 4 -// CHECK-NEXT: store volatile float [[TMP4]], ptr addrspace(4) [[X_ASCAST]], align 4 -// CHECK-NEXT: [[TMP5:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[SHARED_ADDR_ASCAST]], align 8 -// CHECK-NEXT: call spir_func addrspace(4) void @_Z4funcPf(ptr addrspace(4) noundef [[TMP5]]) #[[ATTR6:[0-9]+]] +// CHECK-NEXT: [[TMP0:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[SHARED_ADDR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = addrspacecast ptr addrspace(4) [[TMP0]] to ptr addrspace(3) +// CHECK-NEXT: [[TMP2:%.*]] = load float, ptr addrspace(4) [[SRC_ADDR_ASCAST]], align 4 +// CHECK-NEXT: [[TMP3:%.*]] = atomicrmw fmin ptr addrspace(3) [[TMP1]], float [[TMP2]] monotonic, align 4 +// CHECK-NEXT: store volatile float [[TMP3]], ptr addrspace(4) [[X_ASCAST]], align 4 +// CHECK-NEXT: [[TMP4:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[SHARED_ADDR_ASCAST]], align 8 +// CHECK-NEXT: call spir_func addrspace(4) void @_Z4funcPf(ptr addrspace(4) noundef [[TMP4]]) #[[ATTR6:[0-9]+]] // CHECK-NEXT: ret void // __global__ void test_ds_fmin_func(float src, float *__restrict shared) { @@ -255,15 +248,14 @@ __global__ void test_ds_fmin_func(float src, float *__restrict shared) { // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast ptr [[X]] to ptr addrspace(4) // CHECK-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr [[X_ADDR]] to ptr addrspace(4) // CHECK-NEXT: [[RET_ASCAST:%.*]] = addrspacecast ptr [[RET]] to ptr addrspace(4) -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[X_COERCE:%.*]] to ptr addrspace(4) -// CHECK-NEXT: store ptr addrspace(4) [[TMP0]], ptr addrspace(4) [[X_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[X_COERCE:%.*]], ptr addrspace(4) [[X_ASCAST]], align 8 // CHECK-NEXT: [[X1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[X_ASCAST]], align 8 // CHECK-NEXT: store ptr addrspace(4) [[X1]], ptr addrspace(4) [[X_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[X_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP2:%.*]] = addrspacecast ptr addrspace(4) [[TMP1]] to ptr -// CHECK-NEXT: [[TMP3:%.*]] = call addrspace(4) i1 @llvm.amdgcn.is.shared(ptr [[TMP2]]) -// CHECK-NEXT: [[FROMBOOL:%.*]] = zext i1 [[TMP3]] to i8 -// CHECK-NEXT: store i8 [[FROMBOOL]], ptr addrspace(4) [[RET_ASCAST]], align 1 +// CHECK-NEXT: [[TMP0:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[X_ADDR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = addrspacecast ptr addrspace(4) [[TMP0]] to ptr +// CHECK-NEXT: [[TMP2:%.*]] = call addrspace(4) i1 @llvm.amdgcn.is.shared(ptr [[TMP1]]) +// CHECK-NEXT: [[STOREDV:%.*]] = zext i1 [[TMP2]] to i8 +// CHECK-NEXT: store i8 [[STOREDV]], ptr addrspace(4) [[RET_ASCAST]], align 1 // CHECK-NEXT: ret void // __global__ void test_is_shared(float *x){ @@ -278,15 +270,14 @@ __global__ void test_is_shared(float *x){ // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast ptr [[X]] to ptr addrspace(4) // CHECK-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr [[X_ADDR]] to ptr addrspace(4) // CHECK-NEXT: [[RET_ASCAST:%.*]] = addrspacecast ptr [[RET]] to ptr addrspace(4) -// CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr addrspace(1) [[X_COERCE:%.*]] to ptr addrspace(4) -// CHECK-NEXT: store ptr addrspace(4) [[TMP0]], ptr addrspace(4) [[X_ASCAST]], align 8 +// CHECK-NEXT: store ptr addrspace(1) [[X_COERCE:%.*]], ptr addrspace(4) [[X_ASCAST]], align 8 // CHECK-NEXT: [[X1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[X_ASCAST]], align 8 // CHECK-NEXT: store ptr addrspace(4) [[X1]], ptr addrspace(4) [[X_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP1:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[X_ADDR_ASCAST]], align 8 -// CHECK-NEXT: [[TMP2:%.*]] = addrspacecast ptr addrspace(4) [[TMP1]] to ptr -// CHECK-NEXT: [[TMP3:%.*]] = call addrspace(4) i1 @llvm.amdgcn.is.private(ptr [[TMP2]]) -// CHECK-NEXT: [[FROMBOOL:%.*]] = zext i1 [[TMP3]] to i8 -// CHECK-NEXT: store i8 [[FROMBOOL]], ptr addrspace(4) [[RET_ASCAST]], align 1 +// CHECK-NEXT: [[TMP0:%.*]] = load ptr addrspace(4), ptr addrspace(4) [[X_ADDR_ASCAST]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = addrspacecast ptr addrspace(4) [[TMP0]] to ptr +// CHECK-NEXT: [[TMP2:%.*]] = call addrspace(4) i1 @llvm.amdgcn.is.private(ptr [[TMP1]]) +// CHECK-NEXT: [[STOREDV:%.*]] = zext i1 [[TMP2]] to i8 +// CHECK-NEXT: store i8 [[STOREDV]], ptr addrspace(4) [[RET_ASCAST]], align 1 // CHECK-NEXT: ret void // __global__ void test_is_private(int *x){ diff --git a/clang/test/CodeGenCXX/address-space-cast-coerce.cpp b/clang/test/CodeGenCXX/address-space-cast-coerce.cpp index 7279b6c7f23a0..1ad46042b6efd 100644 --- a/clang/test/CodeGenCXX/address-space-cast-coerce.cpp +++ b/clang/test/CodeGenCXX/address-space-cast-coerce.cpp @@ -46,9 +46,9 @@ int mane() { char1 f1{1}; char1 f2{1}; -// CHECK: [[TMP:%.+]] = alloca i16 -// CHECK: [[COERCE:%.+]] = addrspacecast ptr addrspace(5) [[TMP]] to ptr -// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %{{.+}}, ptr align 2 [[COERCE]], i64 1, i1 false) +// CHECK: [[CALL:%.*]] = call i16 +// CHECK: [[TRUNC:%.*]] = trunc i16 [[CALL]] to i8 +// CHECK: store i8 [[TRUNC]] char1 f3 = f1 + f2; } diff --git a/clang/test/CodeGenCXX/cxx2a-consteval.cpp b/clang/test/CodeGenCXX/cxx2a-consteval.cpp index 075cab58358ab..6c09053a74d24 100644 --- a/clang/test/CodeGenCXX/cxx2a-consteval.cpp +++ b/clang/test/CodeGenCXX/cxx2a-consteval.cpp @@ -1,4 +1,3 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // RUN: %clang_cc1 -emit-llvm %s -std=c++2a -triple x86_64-unknown-linux-gnu -o %t.ll // RUN: FileCheck -check-prefix=EVAL -input-file=%t.ll %s // RUN: FileCheck -check-prefix=EVAL-STATIC -input-file=%t.ll %s @@ -275,3 +274,26 @@ void f() { // EVAL-FN: call void @_ZN7GH821542S3C2Ei } } + +namespace GH93040 { +struct C { char c = 1; }; +struct Empty { consteval Empty() {} }; +struct Empty2 { consteval Empty2() {} }; +struct Test : C, Empty { + [[no_unique_address]] Empty2 e; +}; +static_assert(sizeof(Test) == 1); +void f() { + Test test; + +// Make sure we don't overwrite the initialization of c. + +// EVAL-FN-LABEL: define {{.*}} void @_ZN7GH930404TestC2Ev +// EVAL-FN: entry: +// EVAL-FN-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// EVAL-FN-NEXT: store ptr {{.*}}, ptr [[THIS_ADDR]], align 8 +// EVAL-FN-NEXT: [[THIS:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// EVAL-FN-NEXT: call void @_ZN7GH930401CC2Ev(ptr noundef nonnull align 1 dereferenceable(1) [[THIS]]) +// EVAL-FN-NEXT: ret void +} +} diff --git a/clang/test/CodeGenCXX/mangle-fail.cpp b/clang/test/CodeGenCXX/mangle-fail.cpp index b588d57749fa3..f3b50cfb54dbd 100644 --- a/clang/test/CodeGenCXX/mangle-fail.cpp +++ b/clang/test/CodeGenCXX/mangle-fail.cpp @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -emit-llvm-only -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=1 // RUN: %clang_cc1 -emit-llvm-only -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=2 +// RUN: %clang_cc1 -emit-llvm-only -x c++ -std=c++11 -triple aarch64-linux-gnu -fptrauth-intrinsics -verify %s -DN=3 struct A { int a; }; @@ -13,6 +14,19 @@ template void test(int (&)[sizeof(int)]); template void test(int (&)[sizeof((A){}, T())]) {} // expected-error {{cannot yet mangle}} template void test(int (&)[sizeof(A)]); +#elif N == 3 +// __builtin_ptrauth_type_discriminator +template +struct S1 {}; + +template +void func(S1 s1) { // expected-error {{cannot yet mangle __builtin_ptrauth_type_discriminator expression}} +} + +void testfunc1() { + func(S1()); +} + // FIXME: There are several more cases we can't yet mangle. #else diff --git a/clang/test/CodeGenCXX/modules-vtable.cppm b/clang/test/CodeGenCXX/modules-vtable.cppm index fb179b1de4880..5cc3504d72628 100644 --- a/clang/test/CodeGenCXX/modules-vtable.cppm +++ b/clang/test/CodeGenCXX/modules-vtable.cppm @@ -24,6 +24,8 @@ // RUN: %t/M-A.cppm -o %t/M-A.pcm // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 -fmodule-file=M:A=%t/M-A.pcm \ // RUN: %t/M-B.cppm -emit-llvm -o - | FileCheck %t/M-B.cppm +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 \ +// RUN: %t/M-A.pcm -emit-llvm -o - | FileCheck %t/M-A.cppm //--- Mod.cppm export module Mod; @@ -41,9 +43,10 @@ Base::~Base() {} // CHECK: @_ZTSW3Mod4Base = constant // CHECK: @_ZTIW3Mod4Base = constant -// CHECK-INLINE: @_ZTVW3Mod4Base = linkonce_odr {{.*}}unnamed_addr constant -// CHECK-INLINE: @_ZTSW3Mod4Base = linkonce_odr {{.*}}constant -// CHECK-INLINE: @_ZTIW3Mod4Base = linkonce_odr {{.*}}constant +// With the new Itanium C++ ABI, the linkage of vtables in modules don't need to be linkonce ODR. +// CHECK-INLINE: @_ZTVW3Mod4Base = {{.*}}unnamed_addr constant +// CHECK-INLINE: @_ZTSW3Mod4Base = {{.*}}constant +// CHECK-INLINE: @_ZTIW3Mod4Base = {{.*}}constant module :private; int private_use() { @@ -58,13 +61,13 @@ int use() { return 43; } -// CHECK-NOT: @_ZTSW3Mod4Base = constant -// CHECK-NOT: @_ZTIW3Mod4Base = constant -// CHECK: @_ZTVW3Mod4Base = external unnamed_addr +// CHECK-NOT: @_ZTSW3Mod4Base +// CHECK-NOT: @_ZTIW3Mod4Base +// CHECK: @_ZTVW3Mod4Base = external -// CHECK-INLINE: @_ZTVW3Mod4Base = linkonce_odr {{.*}}unnamed_addr constant -// CHECK-INLINE: @_ZTSW3Mod4Base = linkonce_odr {{.*}}constant -// CHECK-INLINE: @_ZTIW3Mod4Base = linkonce_odr {{.*}}constant +// CHECK-INLINE-NOT: @_ZTSW3Mod4Base +// CHECK-INLINE-NOT: @_ZTIW3Mod4Base +// CHECK-INLINE: @_ZTVW3Mod4Base = external // Check the case that the declaration of the key function comes from another // module unit but the definition of the key function comes from the current @@ -82,6 +85,10 @@ int a_use() { return 43; } +// CHECK: @_ZTVW1M1C = unnamed_addr constant +// CHECK: @_ZTSW1M1C = constant +// CHECK: @_ZTIW1M1C = constant + //--- M-B.cppm export module M:B; import :A; @@ -93,6 +100,6 @@ int b_use() { return 43; } -// CHECK: @_ZTVW1M1C = unnamed_addr constant -// CHECK: @_ZTSW1M1C = constant -// CHECK: @_ZTIW1M1C = constant +// CHECK: @_ZTVW1M1C = external +// CHECK-NOT: @_ZTSW1M1C +// CHECK-NOT: @_ZTIW1M1C diff --git a/clang/test/CodeGenCXX/pr70585.cppm b/clang/test/CodeGenCXX/pr70585.cppm new file mode 100644 index 0000000000000..ad4e13589d86e --- /dev/null +++ b/clang/test/CodeGenCXX/pr70585.cppm @@ -0,0 +1,47 @@ +// REQUIRES: !system-windows + +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: cd %t +// +// RUN: %clang_cc1 -std=c++20 %t/layer1.cppm -triple %itanium_abi_triple \ +// RUN: -emit-module-interface -o %t/foo-layer1.pcm +// RUN: %clang_cc1 -std=c++20 %t/layer2.cppm -triple %itanium_abi_triple \ +// RUN: -emit-module-interface -fmodule-file=foo:layer1=%t/foo-layer1.pcm \ +// RUN: -o %t/foo-layer2.pcm +// RUN: %clang_cc1 -std=c++20 %t/foo-layer1.pcm -emit-llvm -o - | FileCheck %t/layer1.cppm +// RUN: %clang_cc1 -std=c++20 %t/foo-layer2.pcm -emit-llvm -o - \ +// RUN: -fmodule-file=foo:layer1=%t/foo-layer1.pcm | FileCheck %t/layer2.cppm +// +// Check the case about emitting object files from sources directly. +// RUN: %clang_cc1 -std=c++20 %t/layer1.cppm -triple %itanium_abi_triple \ +// RUN: -emit-llvm -o - | FileCheck %t/layer1.cppm +// RUN: %clang_cc1 -std=c++20 %t/layer2.cppm -triple %itanium_abi_triple -emit-llvm \ +// RUN: -fmodule-file=foo:layer1=%t/foo-layer1.pcm -o - | FileCheck %t/layer2.cppm + +//--- layer1.cppm +export module foo:layer1; +struct Fruit { + virtual ~Fruit() = default; + virtual void eval(); +}; + +// CHECK-DAG: @_ZTVW3foo5Fruit = unnamed_addr constant +// CHECK-DAG: @_ZTSW3foo5Fruit = constant +// CHECK-DAG: @_ZTIW3foo5Fruit = constant + +// Testing that: +// (1) The use of virtual functions won't produce the vtable. +// (2) The definition of key functions won't produce the vtable. +// +//--- layer2.cppm +export module foo:layer2; +import :layer1; +export void layer2_fun() { + Fruit *b = new Fruit(); + b->eval(); +} +void Fruit::eval() {} +// CHECK: @_ZTVW3foo5Fruit = external unnamed_addr constant +// CHECK-NOT: @_ZTSW3foo5Fruit +// CHECK-NOT: @_ZTIW3foo5Fruit diff --git a/clang/test/CodeGenCXX/ptrauth-global-constant-initializers.cpp b/clang/test/CodeGenCXX/ptrauth-global-constant-initializers.cpp index f0c3ea83d8958..9ce9def6156ef 100644 --- a/clang/test/CodeGenCXX/ptrauth-global-constant-initializers.cpp +++ b/clang/test/CodeGenCXX/ptrauth-global-constant-initializers.cpp @@ -1,4 +1,7 @@ -// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fno-rtti -fptrauth-vtable-pointer-type-discrimination -fptrauth-vtable-pointer-address-discrimination -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fno-rtti -fptrauth-vtable-pointer-type-discrimination \ +// RUN: -fptrauth-vtable-pointer-address-discrimination -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,DARWIN +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fno-rtti -fptrauth-vtable-pointer-type-discrimination \ +// RUN: -fptrauth-vtable-pointer-address-discrimination -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,ELF // CHECK: %struct.Base1 = type { ptr } // CHECK: %struct.Base2 = type { ptr } @@ -6,27 +9,27 @@ // CHECK: %struct.Derived2 = type { %struct.Base2, %struct.Base1 } // CHECK: %struct.Derived3 = type { %struct.Base1, %struct.Base2 } -// CHECK: @_ZTV5Base1 = linkonce_odr unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC:38871]], ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTV5Base1, i32 0, i32 0, i32 2))] }, align 8 -// CHECK: @g_b1 = global %struct.Base1 { ptr ptrauth (ptr getelementptr inbounds inrange(-16, 8) ({ [3 x ptr] }, ptr @_ZTV5Base1, i32 0, i32 0, i32 2), i32 2, i64 [[BASE1_VTABLE_DISC:6511]], ptr @g_b1) }, align 8 -// CHECK: @_ZTV5Base2 = linkonce_odr unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC:27651]], ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTV5Base2, i32 0, i32 0, i32 2))] }, align 8 -// CHECK: @g_b2 = global %struct.Base2 { ptr ptrauth (ptr getelementptr inbounds inrange(-16, 8) ({ [3 x ptr] }, ptr @_ZTV5Base2, i32 0, i32 0, i32 2), i32 2, i64 [[BASE2_VTABLE_DISC:63631]], ptr @g_b2) }, align 8 -// CHECK: @_ZTV8Derived1 = linkonce_odr unnamed_addr constant { [5 x ptr], [3 x ptr] } { [5 x ptr] [ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived1, i32 0, i32 0, i32 2)), ptr ptrauth (ptr @_ZN8Derived11cEv, i32 0, i64 [[DERIVED1_C_DISC:54092]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived1, i32 0, i32 0, i32 3)), ptr ptrauth (ptr @_ZN8Derived11dEv, i32 0, i64 [[DERIVED1_D_DISC:37391]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived1, i32 0, i32 0, i32 4))], [3 x ptr] [ptr inttoptr (i64 -8 to ptr), ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived1, i32 0, i32 1, i32 2))] }, align 8 -// CHECK: @g_d1 = global { ptr, ptr } { ptr ptrauth (ptr getelementptr inbounds inrange(-16, 24) ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived1, i32 0, i32 0, i32 2), i32 2, i64 [[BASE1_VTABLE_DISC]], ptr @g_d1), ptr ptrauth (ptr getelementptr inbounds inrange(-16, 8) ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived1, i32 0, i32 1, i32 2), i32 2, i64 [[BASE2_VTABLE_DISC]], ptr getelementptr inbounds ({ ptr, ptr }, ptr @g_d1, i32 0, i32 1)) }, align 8 -// CHECK: @_ZTV8Derived2 = linkonce_odr unnamed_addr constant { [5 x ptr], [3 x ptr] } { [5 x ptr] [ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived2, i32 0, i32 0, i32 2)), ptr ptrauth (ptr @_ZN8Derived21cEv, i32 0, i64 [[DERIVED2_C_DISC:15537]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived2, i32 0, i32 0, i32 3)), ptr ptrauth (ptr @_ZN8Derived21eEv, i32 0, i64 209, ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived2, i32 0, i32 0, i32 4))], [3 x ptr] [ptr inttoptr (i64 -8 to ptr), ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived2, i32 0, i32 1, i32 2))] }, align 8 -// CHECK: @g_d2 = global { ptr, ptr } { ptr ptrauth (ptr getelementptr inbounds inrange(-16, 24) ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived2, i32 0, i32 0, i32 2), i32 2, i64 [[BASE2_VTABLE_DISC]], ptr @g_d2), ptr ptrauth (ptr getelementptr inbounds inrange(-16, 8) ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived2, i32 0, i32 1, i32 2), i32 2, i64 [[BASE1_VTABLE_DISC]], ptr getelementptr inbounds ({ ptr, ptr }, ptr @g_d2, i32 0, i32 1)) }, align 8 -// CHECK: @_ZTV8Derived3 = linkonce_odr unnamed_addr constant { [4 x ptr], [3 x ptr] } { [4 x ptr] [ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [4 x ptr], [3 x ptr] }, ptr @_ZTV8Derived3, i32 0, i32 0, i32 2)), ptr ptrauth (ptr @_ZN8Derived31iEv, i32 0, i64 [[DERIVED3_I_DISC:19084]], ptr getelementptr inbounds ({ [4 x ptr], [3 x ptr] }, ptr @_ZTV8Derived3, i32 0, i32 0, i32 3))], [3 x ptr] [ptr inttoptr (i64 -8 to ptr), ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC]], ptr getelementptr inbounds ({ [4 x ptr], [3 x ptr] }, ptr @_ZTV8Derived3, i32 0, i32 1, i32 2))] }, align 8 -// CHECK: @g_d3 = global { ptr, ptr } { ptr ptrauth (ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr], [3 x ptr] }, ptr @_ZTV8Derived3, i32 0, i32 0, i32 2), i32 2, i64 [[BASE1_VTABLE_DISC]], ptr @g_d3), ptr ptrauth (ptr getelementptr inbounds inrange(-16, 8) ({ [4 x ptr], [3 x ptr] }, ptr @_ZTV8Derived3, i32 0, i32 1, i32 2), i32 2, i64 [[BASE2_VTABLE_DISC]], ptr getelementptr inbounds ({ ptr, ptr }, ptr @g_d3, i32 0, i32 1)) }, align 8 -// CHECK: @g_vb1 = global %struct.VirtualBase1 zeroinitializer, align 8 -// CHECK: @g_vb2 = global %struct.VirtualBase2 zeroinitializer, align 8 -// CHECK: @g_d4 = global %struct.Derived4 zeroinitializer, align 8 -// CHECK: @_ZTV12VirtualBase1 = linkonce_odr unnamed_addr constant { [6 x ptr] } { [6 x ptr] [ptr null, ptr null, ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [6 x ptr] }, ptr @_ZTV12VirtualBase1, i32 0, i32 0, i32 4)), ptr ptrauth (ptr @_ZN12VirtualBase11fEv, i32 0, i64 [[VIRTUALBASE1_F_DISC:7987]], ptr getelementptr inbounds ({ [6 x ptr] }, ptr @_ZTV12VirtualBase1, i32 0, i32 0, i32 5))] }, align 8 -// CHECK: @_ZTT12VirtualBase1 = linkonce_odr unnamed_addr constant [2 x ptr] [ptr ptrauth (ptr getelementptr inbounds inrange(-32, 16) ({ [6 x ptr] }, ptr @_ZTV12VirtualBase1, i32 0, i32 0, i32 4), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-32, 16) ({ [6 x ptr] }, ptr @_ZTV12VirtualBase1, i32 0, i32 0, i32 4), i32 2)], align 8 -// CHECK: @_ZTV12VirtualBase2 = linkonce_odr unnamed_addr constant { [5 x ptr], [4 x ptr] } { [5 x ptr] [ptr inttoptr (i64 8 to ptr), ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [4 x ptr] }, ptr @_ZTV12VirtualBase2, i32 0, i32 0, i32 3)), ptr ptrauth (ptr @_ZN12VirtualBase21gEv, i32 0, i64 [[VIRTUALBASE2_G_DISC:51224]], ptr getelementptr inbounds ({ [5 x ptr], [4 x ptr] }, ptr @_ZTV12VirtualBase2, i32 0, i32 0, i32 4))], [4 x ptr] [ptr null, ptr inttoptr (i64 -8 to ptr), ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [4 x ptr] }, ptr @_ZTV12VirtualBase2, i32 0, i32 1, i32 3))] }, align 8 -// CHECK: @_ZTT12VirtualBase2 = linkonce_odr unnamed_addr constant [2 x ptr] [ptr ptrauth (ptr getelementptr inbounds inrange(-24, 16) ({ [5 x ptr], [4 x ptr] }, ptr @_ZTV12VirtualBase2, i32 0, i32 0, i32 3), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-24, 8) ({ [5 x ptr], [4 x ptr] }, ptr @_ZTV12VirtualBase2, i32 0, i32 1, i32 3), i32 2)], align 8 -// CHECK: @_ZTV8Derived4 = linkonce_odr unnamed_addr constant { [7 x ptr], [5 x ptr] } { [7 x ptr] [ptr null, ptr null, ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 0, i32 4)), ptr ptrauth (ptr @_ZN12VirtualBase11fEv, i32 0, i64 [[VIRTUALBASE1_F_DISC]], ptr getelementptr inbounds ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 0, i32 5)), ptr ptrauth (ptr @_ZN8Derived41hEv, i32 0, i64 [[DERIVED4_H_DISC:31844]], ptr getelementptr inbounds ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 0, i32 6))], [5 x ptr] [ptr inttoptr (i64 -8 to ptr), ptr inttoptr (i64 -8 to ptr), ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC]], ptr getelementptr inbounds ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 1, i32 3)), ptr ptrauth (ptr @_ZN12VirtualBase21gEv, i32 0, i64 [[VIRTUALBASE2_G_DISC]], ptr getelementptr inbounds ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 1, i32 4))] }, align 8 -// CHECK: @_ZTT8Derived4 = linkonce_odr unnamed_addr constant [7 x ptr] [ptr ptrauth (ptr getelementptr inbounds inrange(-32, 24) ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 0, i32 4), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-32, 16) ({ [6 x ptr] }, ptr @_ZTC8Derived40_12VirtualBase1, i32 0, i32 0, i32 4), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-32, 16) ({ [6 x ptr] }, ptr @_ZTC8Derived40_12VirtualBase1, i32 0, i32 0, i32 4), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-24, 16) ({ [5 x ptr], [4 x ptr] }, ptr @_ZTC8Derived48_12VirtualBase2, i32 0, i32 0, i32 3), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-24, 8) ({ [5 x ptr], [4 x ptr] }, ptr @_ZTC8Derived48_12VirtualBase2, i32 0, i32 1, i32 3), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-32, 24) ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 0, i32 4), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-24, 16) ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 1, i32 3), i32 2)], align 8 -// CHECK: @_ZTC8Derived40_12VirtualBase1 = linkonce_odr unnamed_addr constant { [6 x ptr] } { [6 x ptr] [ptr null, ptr null, ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [6 x ptr] }, ptr @_ZTC8Derived40_12VirtualBase1, i32 0, i32 0, i32 4)), ptr ptrauth (ptr @_ZN12VirtualBase11fEv, i32 0, i64 [[VIRTUALBASE1_F_DISC]], ptr getelementptr inbounds ({ [6 x ptr] }, ptr @_ZTC8Derived40_12VirtualBase1, i32 0, i32 0, i32 5))] }, align 8 -// CHECK: @_ZTC8Derived48_12VirtualBase2 = linkonce_odr unnamed_addr constant { [5 x ptr], [4 x ptr] } { [5 x ptr] [ptr inttoptr (i64 -8 to ptr), ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [4 x ptr] }, ptr @_ZTC8Derived48_12VirtualBase2, i32 0, i32 0, i32 3)), ptr ptrauth (ptr @_ZN12VirtualBase21gEv, i32 0, i64 [[VIRTUALBASE2_G_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [4 x ptr] }, ptr @_ZTC8Derived48_12VirtualBase2, i32 0, i32 0, i32 4))], [4 x ptr] [ptr null, ptr inttoptr (i64 8 to ptr), ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [4 x ptr] }, ptr @_ZTC8Derived48_12VirtualBase2, i32 0, i32 1, i32 3))] }, align 8 +// CHECK: @_ZTV5Base1 = linkonce_odr unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC:38871]], ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTV5Base1, i32 0, i32 0, i32 2))] },{{.*}} align 8 +// CHECK: @g_b1 = global %struct.Base1 { ptr ptrauth (ptr getelementptr inbounds inrange(-16, 8) ({ [3 x ptr] }, ptr @_ZTV5Base1, i32 0, i32 0, i32 2), i32 2, i64 [[BASE1_VTABLE_DISC:6511]], ptr @g_b1) },{{.*}} align 8 +// CHECK: @_ZTV5Base2 = linkonce_odr unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC:27651]], ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTV5Base2, i32 0, i32 0, i32 2))] },{{.*}} align 8 +// CHECK: @g_b2 = global %struct.Base2 { ptr ptrauth (ptr getelementptr inbounds inrange(-16, 8) ({ [3 x ptr] }, ptr @_ZTV5Base2, i32 0, i32 0, i32 2), i32 2, i64 [[BASE2_VTABLE_DISC:63631]], ptr @g_b2) },{{.*}} align 8 +// CHECK: @_ZTV8Derived1 = linkonce_odr unnamed_addr constant { [5 x ptr], [3 x ptr] } { [5 x ptr] [ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived1, i32 0, i32 0, i32 2)), ptr ptrauth (ptr @_ZN8Derived11cEv, i32 0, i64 [[DERIVED1_C_DISC:54092]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived1, i32 0, i32 0, i32 3)), ptr ptrauth (ptr @_ZN8Derived11dEv, i32 0, i64 [[DERIVED1_D_DISC:37391]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived1, i32 0, i32 0, i32 4))], [3 x ptr] [ptr inttoptr (i64 -8 to ptr), ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived1, i32 0, i32 1, i32 2))] },{{.*}} align 8 +// CHECK: @g_d1 = global { ptr, ptr } { ptr ptrauth (ptr getelementptr inbounds inrange(-16, 24) ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived1, i32 0, i32 0, i32 2), i32 2, i64 [[BASE1_VTABLE_DISC]], ptr @g_d1), ptr ptrauth (ptr getelementptr inbounds inrange(-16, 8) ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived1, i32 0, i32 1, i32 2), i32 2, i64 [[BASE2_VTABLE_DISC]], ptr getelementptr inbounds ({ ptr, ptr }, ptr @g_d1, i32 0, i32 1)) },{{.*}} align 8 +// CHECK: @_ZTV8Derived2 = linkonce_odr unnamed_addr constant { [5 x ptr], [3 x ptr] } { [5 x ptr] [ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived2, i32 0, i32 0, i32 2)), ptr ptrauth (ptr @_ZN8Derived21cEv, i32 0, i64 [[DERIVED2_C_DISC:15537]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived2, i32 0, i32 0, i32 3)), ptr ptrauth (ptr @_ZN8Derived21eEv, i32 0, i64 209, ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived2, i32 0, i32 0, i32 4))], [3 x ptr] [ptr inttoptr (i64 -8 to ptr), ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived2, i32 0, i32 1, i32 2))] },{{.*}} align 8 +// CHECK: @g_d2 = global { ptr, ptr } { ptr ptrauth (ptr getelementptr inbounds inrange(-16, 24) ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived2, i32 0, i32 0, i32 2), i32 2, i64 [[BASE2_VTABLE_DISC]], ptr @g_d2), ptr ptrauth (ptr getelementptr inbounds inrange(-16, 8) ({ [5 x ptr], [3 x ptr] }, ptr @_ZTV8Derived2, i32 0, i32 1, i32 2), i32 2, i64 [[BASE1_VTABLE_DISC]], ptr getelementptr inbounds ({ ptr, ptr }, ptr @g_d2, i32 0, i32 1)) },{{.*}} align 8 +// CHECK: @_ZTV8Derived3 = linkonce_odr unnamed_addr constant { [4 x ptr], [3 x ptr] } { [4 x ptr] [ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [4 x ptr], [3 x ptr] }, ptr @_ZTV8Derived3, i32 0, i32 0, i32 2)), ptr ptrauth (ptr @_ZN8Derived31iEv, i32 0, i64 [[DERIVED3_I_DISC:19084]], ptr getelementptr inbounds ({ [4 x ptr], [3 x ptr] }, ptr @_ZTV8Derived3, i32 0, i32 0, i32 3))], [3 x ptr] [ptr inttoptr (i64 -8 to ptr), ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC]], ptr getelementptr inbounds ({ [4 x ptr], [3 x ptr] }, ptr @_ZTV8Derived3, i32 0, i32 1, i32 2))] },{{.*}} align 8 +// CHECK: @g_d3 = global { ptr, ptr } { ptr ptrauth (ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr], [3 x ptr] }, ptr @_ZTV8Derived3, i32 0, i32 0, i32 2), i32 2, i64 [[BASE1_VTABLE_DISC]], ptr @g_d3), ptr ptrauth (ptr getelementptr inbounds inrange(-16, 8) ({ [4 x ptr], [3 x ptr] }, ptr @_ZTV8Derived3, i32 0, i32 1, i32 2), i32 2, i64 [[BASE2_VTABLE_DISC]], ptr getelementptr inbounds ({ ptr, ptr }, ptr @g_d3, i32 0, i32 1)) },{{.*}} align 8 +// CHECK: @g_vb1 = global %struct.VirtualBase1 zeroinitializer,{{.*}} align 8 +// CHECK: @g_vb2 = global %struct.VirtualBase2 zeroinitializer,{{.*}} align 8 +// CHECK: @g_d4 = global %struct.Derived4 zeroinitializer,{{.*}} align 8 +// CHECK: @_ZTV12VirtualBase1 = linkonce_odr unnamed_addr constant { [6 x ptr] } { [6 x ptr] [ptr null, ptr null, ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [6 x ptr] }, ptr @_ZTV12VirtualBase1, i32 0, i32 0, i32 4)), ptr ptrauth (ptr @_ZN12VirtualBase11fEv, i32 0, i64 [[VIRTUALBASE1_F_DISC:7987]], ptr getelementptr inbounds ({ [6 x ptr] }, ptr @_ZTV12VirtualBase1, i32 0, i32 0, i32 5))] },{{.*}} align 8 +// CHECK: @_ZTT12VirtualBase1 = linkonce_odr unnamed_addr constant [2 x ptr] [ptr ptrauth (ptr getelementptr inbounds inrange(-32, 16) ({ [6 x ptr] }, ptr @_ZTV12VirtualBase1, i32 0, i32 0, i32 4), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-32, 16) ({ [6 x ptr] }, ptr @_ZTV12VirtualBase1, i32 0, i32 0, i32 4), i32 2)],{{.*}} align 8 +// CHECK: @_ZTV12VirtualBase2 = linkonce_odr unnamed_addr constant { [5 x ptr], [4 x ptr] } { [5 x ptr] [ptr inttoptr (i64 8 to ptr), ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [4 x ptr] }, ptr @_ZTV12VirtualBase2, i32 0, i32 0, i32 3)), ptr ptrauth (ptr @_ZN12VirtualBase21gEv, i32 0, i64 [[VIRTUALBASE2_G_DISC:51224]], ptr getelementptr inbounds ({ [5 x ptr], [4 x ptr] }, ptr @_ZTV12VirtualBase2, i32 0, i32 0, i32 4))], [4 x ptr] [ptr null, ptr inttoptr (i64 -8 to ptr), ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [4 x ptr] }, ptr @_ZTV12VirtualBase2, i32 0, i32 1, i32 3))] },{{.*}} align 8 +// CHECK: @_ZTT12VirtualBase2 = linkonce_odr unnamed_addr constant [2 x ptr] [ptr ptrauth (ptr getelementptr inbounds inrange(-24, 16) ({ [5 x ptr], [4 x ptr] }, ptr @_ZTV12VirtualBase2, i32 0, i32 0, i32 3), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-24, 8) ({ [5 x ptr], [4 x ptr] }, ptr @_ZTV12VirtualBase2, i32 0, i32 1, i32 3), i32 2)],{{.*}} align 8 +// CHECK: @_ZTV8Derived4 = linkonce_odr unnamed_addr constant { [7 x ptr], [5 x ptr] } { [7 x ptr] [ptr null, ptr null, ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 0, i32 4)), ptr ptrauth (ptr @_ZN12VirtualBase11fEv, i32 0, i64 [[VIRTUALBASE1_F_DISC]], ptr getelementptr inbounds ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 0, i32 5)), ptr ptrauth (ptr @_ZN8Derived41hEv, i32 0, i64 [[DERIVED4_H_DISC:31844]], ptr getelementptr inbounds ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 0, i32 6))], [5 x ptr] [ptr inttoptr (i64 -8 to ptr), ptr inttoptr (i64 -8 to ptr), ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC]], ptr getelementptr inbounds ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 1, i32 3)), ptr ptrauth (ptr @_ZN12VirtualBase21gEv, i32 0, i64 [[VIRTUALBASE2_G_DISC]], ptr getelementptr inbounds ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 1, i32 4))] },{{.*}} align 8 +// CHECK: @_ZTT8Derived4 = linkonce_odr unnamed_addr constant [7 x ptr] [ptr ptrauth (ptr getelementptr inbounds inrange(-32, 24) ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 0, i32 4), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-32, 16) ({ [6 x ptr] }, ptr @_ZTC8Derived40_12VirtualBase1, i32 0, i32 0, i32 4), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-32, 16) ({ [6 x ptr] }, ptr @_ZTC8Derived40_12VirtualBase1, i32 0, i32 0, i32 4), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-24, 16) ({ [5 x ptr], [4 x ptr] }, ptr @_ZTC8Derived48_12VirtualBase2, i32 0, i32 0, i32 3), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-24, 8) ({ [5 x ptr], [4 x ptr] }, ptr @_ZTC8Derived48_12VirtualBase2, i32 0, i32 1, i32 3), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-32, 24) ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 0, i32 4), i32 2), ptr ptrauth (ptr getelementptr inbounds inrange(-24, 16) ({ [7 x ptr], [5 x ptr] }, ptr @_ZTV8Derived4, i32 0, i32 1, i32 3), i32 2)],{{.*}} align 8 +// CHECK: @_ZTC8Derived40_12VirtualBase1 = linkonce_odr unnamed_addr constant { [6 x ptr] } { [6 x ptr] [ptr null, ptr null, ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [6 x ptr] }, ptr @_ZTC8Derived40_12VirtualBase1, i32 0, i32 0, i32 4)), ptr ptrauth (ptr @_ZN12VirtualBase11fEv, i32 0, i64 [[VIRTUALBASE1_F_DISC]], ptr getelementptr inbounds ({ [6 x ptr] }, ptr @_ZTC8Derived40_12VirtualBase1, i32 0, i32 0, i32 5))] },{{.*}} align 8 +// CHECK: @_ZTC8Derived48_12VirtualBase2 = linkonce_odr unnamed_addr constant { [5 x ptr], [4 x ptr] } { [5 x ptr] [ptr inttoptr (i64 -8 to ptr), ptr null, ptr null, ptr ptrauth (ptr @_ZN5Base21bEv, i32 0, i64 [[BASE2_B_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [4 x ptr] }, ptr @_ZTC8Derived48_12VirtualBase2, i32 0, i32 0, i32 3)), ptr ptrauth (ptr @_ZN12VirtualBase21gEv, i32 0, i64 [[VIRTUALBASE2_G_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [4 x ptr] }, ptr @_ZTC8Derived48_12VirtualBase2, i32 0, i32 0, i32 4))], [4 x ptr] [ptr null, ptr inttoptr (i64 8 to ptr), ptr null, ptr ptrauth (ptr @_ZN5Base11aEv, i32 0, i64 [[BASE1_A_DISC]], ptr getelementptr inbounds ({ [5 x ptr], [4 x ptr] }, ptr @_ZTC8Derived48_12VirtualBase2, i32 0, i32 1, i32 3))] },{{.*}} align 8 struct Base1 { virtual void a() {} }; struct Base2 { virtual void b() {} }; @@ -73,20 +76,24 @@ struct Derived5 : VirtualBase2, VirtualBase1 { virtual void h() {} }; -// CHECK-LABEL: define {{.*}} ptr @_ZN12VirtualBase1C1Ev +// DARWIN-LABEL: define {{.*}} ptr @_ZN12VirtualBase1C1Ev +// ELF-LABEL: define {{.*}} void @_ZN12VirtualBase1C1Ev // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_VTABLE_DISC]]) // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_VTABLE_DISC]]) -// CHECK-LABEL: define {{.*}} ptr @_ZN12VirtualBase2C1Ev +// DARWIN-LABEL: define {{.*}} ptr @_ZN12VirtualBase2C1Ev +// ELF-LABEL: define {{.*}} void @_ZN12VirtualBase2C1Ev // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE2_VTABLE_DISC]]) // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_VTABLE_DISC]]) -// CHECK-LABEL: define {{.*}} ptr @_ZN8Derived4C1Ev +// DARWIN-LABEL: define {{.*}} ptr @_ZN8Derived4C1Ev +// ELF-LABEL: define {{.*}} void @_ZN8Derived4C1Ev // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_VTABLE_DISC]]) // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_VTABLE_DISC]]) // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE2_VTABLE_DISC]]) -// CHECK-LABEL: define {{.*}} ptr @_ZN8Derived5C1Ev +// DARWIN-LABEL: define {{.*}} ptr @_ZN8Derived5C1Ev +// ELF-LABEL: define {{.*}} void @_ZN8Derived5C1Ev // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE2_VTABLE_DISC]]) // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_VTABLE_DISC]]) // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_VTABLE_DISC]]) @@ -155,7 +162,7 @@ extern "C" void cross_check_vtables(Base1 *b1, d5->h(); } -// CHECK-LABEL: define void @cross_check_vtables( +// CHECK-LABEL: define{{.*}} void @cross_check_vtables( // CHECK: "; b1->a()", // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_VTABLE_DISC]]) // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_A_DISC]]) @@ -214,21 +221,25 @@ extern "C" void cross_check_vtables(Base1 *b1, // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_VTABLE_DISC]]) // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[DERIVED4_H_DISC]]) -// CHECK-LABEL: define {{.*}} ptr @_ZN5Base1C2Ev +// DARWIN-LABEL: define {{.*}} ptr @_ZN5Base1C2Ev +// ELF-LABEL: define {{.*}} void @_ZN5Base1C2Ev // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_VTABLE_DISC]]) -// CHECK-LABEL: define {{.*}} ptr @_ZN5Base2C2Ev +// DARWIN-LABEL: define {{.*}} ptr @_ZN5Base2C2Ev +// ELF-LABEL: define {{.*}} void @_ZN5Base2C2Ev // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE2_VTABLE_DISC]]) -// CHECK-LABEL: define {{.*}} ptr @_ZN8Derived1C2Ev +// DARWIN-LABEL: define {{.*}} ptr @_ZN8Derived1C2Ev +// ELF-LABEL: define {{.*}} void @_ZN8Derived1C2Ev // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_VTABLE_DISC]]) // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE2_VTABLE_DISC]]) -// CHECK-LABEL: define {{.*}} ptr @_ZN8Derived2C2Ev +// DARWIN-LABEL: define {{.*}} ptr @_ZN8Derived2C2Ev +// ELF-LABEL: define {{.*}} void @_ZN8Derived2C2Ev // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE2_VTABLE_DISC]]) // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_VTABLE_DISC]]) -// CHECK-LABEL: define {{.*}} ptr @_ZN8Derived3C2Ev +// DARWIN-LABEL: define {{.*}} ptr @_ZN8Derived3C2Ev +// ELF-LABEL: define {{.*}} void @_ZN8Derived3C2Ev // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE1_VTABLE_DISC]]) // CHECK: call i64 @llvm.ptrauth.blend(i64 {{%.*}}, i64 [[BASE2_VTABLE_DISC]]) - diff --git a/clang/test/CodeGenCXX/ptrauth-member-function-pointer.cpp b/clang/test/CodeGenCXX/ptrauth-member-function-pointer.cpp index 5e84e3e7bc5e9..0a9ac3fa510f5 100644 --- a/clang/test/CodeGenCXX/ptrauth-member-function-pointer.cpp +++ b/clang/test/CodeGenCXX/ptrauth-member-function-pointer.cpp @@ -1,8 +1,14 @@ -// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -o - %s | FileCheck -check-prefixes=CHECK,NODEBUG %s -// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -debug-info-kind=limited -o - %s | FileCheck -check-prefixes=CHECK %s -// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 1 -o - %s | FileCheck %s -check-prefix=STACK-PROT -// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 2 -o - %s | FileCheck %s -check-prefix=STACK-PROT -// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 3 -o - %s | FileCheck %s -check-prefix=STACK-PROT +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -o - %s | FileCheck -check-prefixes=CHECK,NODEBUG,DARWIN %s +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -debug-info-kind=limited -o - %s | FileCheck -check-prefixes=CHECK,DARWIN %s +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 1 -o - %s | FileCheck %s -check-prefix=STACK-PROT +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 2 -o - %s | FileCheck %s -check-prefix=STACK-PROT +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 3 -o - %s | FileCheck %s -check-prefix=STACK-PROT + +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -o - %s | FileCheck -check-prefixes=CHECK,NODEBUG,ELF %s +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -debug-info-kind=limited -o - %s | FileCheck -check-prefixes=CHECK,ELF %s +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 1 -o - %s | FileCheck %s -check-prefix=STACK-PROT +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 2 -o - %s | FileCheck %s -check-prefix=STACK-PROT +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -emit-llvm -std=c++11 -O1 -disable-llvm-passes -stack-protector 3 -o - %s | FileCheck %s -check-prefix=STACK-PROT // CHECK: @gmethod0 = global { i64, i64 } { i64 ptrtoint (ptr ptrauth (ptr @_ZN5Base011nonvirtual0Ev, i32 0, i64 [[TYPEDISC1:35591]]) to i64), i64 0 }, align 8 @@ -78,9 +84,9 @@ struct Class0 { MethodTy1 m0; }; -// CHECK: define void @_ZN5Base08virtual1Ev( +// CHECK: define{{.*}} void @_ZN5Base08virtual1Ev( -// CHECK: define void @_Z5test0v() +// CHECK: define{{.*}} void @_Z5test0v() // CHECK: %[[METHOD0:.*]] = alloca { i64, i64 }, align 8 // CHECK-NEXT: %[[VARMETHOD1:.*]] = alloca { i64, i64 }, align 8 // CHECK-NEXT: %[[METHOD2:.*]] = alloca { i64, i64 }, align 8 @@ -246,7 +252,7 @@ void test0() { method7 = &Derived1::virtual1; } -// CHECK: define void @_Z5test1P5Base0MS_FvvE(ptr noundef %[[A0:.*]], [2 x i64] %[[A1_COERCE:.*]]) +// CHECK: define{{.*}} void @_Z5test1P5Base0MS_FvvE(ptr noundef %[[A0:.*]], [2 x i64] %[[A1_COERCE:.*]]) // CHECK: %[[A1:.*]] = alloca { i64, i64 }, align 8 // CHECK: %[[A0_ADDR:.*]] = alloca ptr, align 8 // CHECK: %[[A1_ADDR:.*]] = alloca { i64, i64 }, align 8 @@ -264,15 +270,16 @@ void test0() { // CHECK: %[[MEMPTR_ISVIRTUAL:.*]] = icmp ne i64 %[[V5]], 0 // CHECK: br i1 %[[MEMPTR_ISVIRTUAL]] -// CHECK: %[[VTABLE:.*]] = load ptr, ptr %[[V4]], align 8 -// CHECK: %[[V7:.*]] = ptrtoint ptr %[[VTABLE]] to i64 -// CHECK: %[[V8:.*]] = call i64 @llvm.ptrauth.auth(i64 %[[V7]], i32 2, i64 0) -// CHECK: %[[V9:.*]] = inttoptr i64 %[[V8]] to ptr -// CHECK: %[[V10:.*]] = trunc i64 %[[MEMPTR_PTR]] to i32 -// CHECK: %[[V11:.*]] = zext i32 %[[V10]] to i64 -// CHECK: %[[V12:.*]] = getelementptr i8, ptr %[[V9]], i64 %[[V11]] -// CHECK: %[[MEMPTR_VIRTUALFN:.*]] = load ptr, ptr %[[V12]], align 8 -// CHECK: br +// CHECK: %[[VTABLE:.*]] = load ptr, ptr %[[V4]], align 8 +// CHECK: %[[V7:.*]] = ptrtoint ptr %[[VTABLE]] to i64 +// CHECK: %[[V8:.*]] = call i64 @llvm.ptrauth.auth(i64 %[[V7]], i32 2, i64 0) +// CHECK: %[[V9:.*]] = inttoptr i64 %[[V8]] to ptr +// DARWIN: %[[V10:.*]] = trunc i64 %[[MEMPTR_PTR]] to i32 +// DARWIN: %[[V11:.*]] = zext i32 %[[V10]] to i64 +// DARWIN: %[[V12:.*]] = getelementptr i8, ptr %[[V9]], i64 %[[V11]] +// ELF: %[[V12:.*]] = getelementptr i8, ptr %[[V9]], i64 %[[MEMPTR_PTR]] +// CHECK: %[[MEMPTR_VIRTUALFN:.*]] = load ptr, ptr %[[V12]], align 8 +// CHECK: br // CHECK: %[[MEMPTR_NONVIRTUALFN:.*]] = inttoptr i64 %[[MEMPTR_PTR]] to ptr // CHECK: br @@ -286,7 +293,7 @@ void test1(Base0 *a0, MethodTy0 a1) { (a0->*a1)(); } -// CHECK: define void @_Z15testConversion0M5Base0FvvEM8Derived0FvvE([2 x i64] %[[METHOD0_COERCE:.*]], [2 x i64] %[[METHOD1_COERCE:.*]]) +// CHECK: define{{.*}} void @_Z15testConversion0M5Base0FvvEM8Derived0FvvE([2 x i64] %[[METHOD0_COERCE:.*]], [2 x i64] %[[METHOD1_COERCE:.*]]) // CHECK: %[[METHOD0:.*]] = alloca { i64, i64 }, align 8 // CHECK: %[[METHOD1:.*]] = alloca { i64, i64 }, align 8 // CHECK: %[[METHOD0_ADDR:.*]] = alloca { i64, i64 }, align 8 @@ -326,21 +333,21 @@ void testConversion0(MethodTy0 method0, MethodTy1 method1) { method1 = method0; } -// CHECK: define void @_Z15testConversion1M5Base0FvvE( +// CHECK: define{{.*}} void @_Z15testConversion1M5Base0FvvE( // CHECK: call i64 @llvm.ptrauth.resign(i64 %{{.*}}, i32 0, i64 [[TYPEDISC0]], i32 0, i64 [[TYPEDISC1]]) void testConversion1(MethodTy0 method0) { MethodTy1 method1 = reinterpret_cast(method0); } -// CHECK: define void @_Z15testConversion2M8Derived0FvvE( +// CHECK: define{{.*}} void @_Z15testConversion2M8Derived0FvvE( // CHECK: call i64 @llvm.ptrauth.resign(i64 %{{.*}}, i32 0, i64 [[TYPEDISC1]], i32 0, i64 [[TYPEDISC0]]) void testConversion2(MethodTy1 method1) { MethodTy0 method0 = static_cast(method1); } -// CHECK: define void @_Z15testConversion3M8Derived0FvvE( +// CHECK: define{{.*}} void @_Z15testConversion3M8Derived0FvvE( // CHECK: call i64 @llvm.ptrauth.resign(i64 %{{.*}}, i32 0, i64 [[TYPEDISC1]], i32 0, i64 [[TYPEDISC0]]) void testConversion3(MethodTy1 method1) { @@ -350,7 +357,7 @@ void testConversion3(MethodTy1 method1) { // No need to call @llvm.ptrauth.resign if the source member function // pointer is a constant. -// CHECK: define void @_Z15testConversion4v( +// CHECK: define{{.*}} void @_Z15testConversion4v( // CHECK: %[[METHOD0:.*]] = alloca { i64, i64 }, align 8 // CHECK: store { i64, i64 } { i64 ptrtoint (ptr ptrauth (ptr @_ZN5Base08virtual1Ev_vfpthunk_, i32 0, i64 [[TYPEDISC0]]) to i64), i64 0 }, ptr %[[METHOD0]], align 8 // CHECK: ret void @@ -396,7 +403,7 @@ MethodTy1 gmethod0 = reinterpret_cast(&Base0::nonvirtual0); MethodTy0 gmethod1 = reinterpret_cast(&Derived0::nonvirtual5); MethodTy0 gmethod2 = reinterpret_cast(&Derived0::virtual1); -// CHECK-LABEL: define void @_Z13testArrayInitv() +// CHECK-LABEL: define{{.*}} void @_Z13testArrayInitv() // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %p0, ptr align 8 @__const._Z13testArrayInitv.p0, i64 16, i1 false) // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %p1, ptr align 8 @__const._Z13testArrayInitv.p1, i64 16, i1 false) // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %c0, ptr align 8 @__const._Z13testArrayInitv.c0, i64 16, i1 false) @@ -424,7 +431,7 @@ void testArrayInit() { // STACK-PROT-NOT: sspreq // STACK-PROT-NEXT: attributes -// CHECK: define void @_Z15testConvertNullv( +// CHECK: define{{.*}} void @_Z15testConvertNullv( // CHECK: %[[T:.*]] = alloca { i64, i64 }, // store { i64, i64 } zeroinitializer, { i64, i64 }* %[[T]], diff --git a/clang/test/CodeGenCXX/ptrauth-static-destructors.cpp b/clang/test/CodeGenCXX/ptrauth-static-destructors.cpp index 1240f26d329da..634450bf62ea9 100644 --- a/clang/test/CodeGenCXX/ptrauth-static-destructors.cpp +++ b/clang/test/CodeGenCXX/ptrauth-static-destructors.cpp @@ -2,13 +2,27 @@ // RUN: | FileCheck %s --check-prefix=CXAATEXIT // RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -emit-llvm -std=c++11 %s -o - \ -// RUN: -fno-use-cxa-atexit | FileCheck %s --check-prefixes=ATEXIT,DARWIN +// RUN: -fno-use-cxa-atexit | FileCheck %s --check-prefixes=ATEXIT,ATEXIT_DARWIN // RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -emit-llvm -std=c++11 %s -o - \ // RUN: | FileCheck %s --check-prefix=CXAATEXIT // RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -emit-llvm -std=c++11 %s -o - \ -// RUN: -fno-use-cxa-atexit | FileCheck %s --check-prefixes=ATEXIT,ELF +// RUN: -fno-use-cxa-atexit | FileCheck %s --check-prefixes=ATEXIT,ATEXIT_ELF + +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -emit-llvm -std=c++11 %s \ +// RUN: -fptrauth-function-pointer-type-discrimination -o - | FileCheck %s --check-prefix=CXAATEXIT_DISC + +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -emit-llvm -std=c++11 %s -o - \ +// RUN: -fptrauth-function-pointer-type-discrimination -fno-use-cxa-atexit \ +// RUN: | FileCheck %s --check-prefixes=ATEXIT_DISC,ATEXIT_DISC_DARWIN + +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -emit-llvm -std=c++11 %s \ +// RUN: -fptrauth-function-pointer-type-discrimination -o - | FileCheck %s --check-prefix=CXAATEXIT_DISC + +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -emit-llvm -std=c++11 %s -o - \ +// RUN: -fptrauth-function-pointer-type-discrimination -fno-use-cxa-atexit \ +// RUN: | FileCheck %s --check-prefixes=ATEXIT_DISC,ATEXIT_DISC_ELF class Foo { public: @@ -21,11 +35,22 @@ Foo global; // CXAATEXIT: define internal void @__cxx_global_var_init() // CXAATEXIT: call i32 @__cxa_atexit(ptr ptrauth (ptr @_ZN3FooD1Ev, i32 0), ptr @global, ptr @__dso_handle) +// CXAATEXIT_DISC: define internal void @__cxx_global_var_init() +// CXAATEXIT_DISC: call i32 @__cxa_atexit(ptr ptrauth (ptr @_ZN3FooD1Ev, i32 0, i64 10942), ptr @global, ptr @__dso_handle) // ATEXIT: define internal void @__cxx_global_var_init() // ATEXIT: %{{.*}} = call i32 @atexit(ptr ptrauth (ptr @__dtor_global, i32 0)) -// DARWIN: define internal void @__dtor_global() {{.*}} section "__TEXT,__StaticInit,regular,pure_instructions" { -// ELF: define internal void @__dtor_global() {{.*}} section ".text.startup" { -// DARWIN: %{{.*}} = call ptr @_ZN3FooD1Ev(ptr @global) -// ELF: call void @_ZN3FooD1Ev(ptr @global) +// ATEXIT_DARWIN: define internal void @__dtor_global() {{.*}} section "__TEXT,__StaticInit,regular,pure_instructions" { +// ATEXIT_ELF: define internal void @__dtor_global() {{.*}} section ".text.startup" { +// ATEXIT_DARWIN: %{{.*}} = call ptr @_ZN3FooD1Ev(ptr @global) +// ATEXIT_ELF: call void @_ZN3FooD1Ev(ptr @global) + +// ATEXIT_DISC: define internal void @__cxx_global_var_init() +// ATEXIT_DISC: %{{.*}} = call i32 @atexit(ptr ptrauth (ptr @__dtor_global, i32 0, i64 10942)) + + +// ATEXIT_DISC_DARWIN: define internal void @__dtor_global() {{.*}} section "__TEXT,__StaticInit,regular,pure_instructions" { +// ATEXIT_DISC_ELF: define internal void @__dtor_global() {{.*}} section ".text.startup" { +// ATEXIT_DISC_DARWIN: %{{.*}} = call ptr @_ZN3FooD1Ev(ptr @global) +// ATEXIT_DISC_ELF: call void @_ZN3FooD1Ev(ptr @global) diff --git a/clang/test/CodeGenCXX/ptrauth-type-info-vtable.cpp b/clang/test/CodeGenCXX/ptrauth-type-info-vtable.cpp index d5f69e0485140..174aeda89d175 100644 --- a/clang/test/CodeGenCXX/ptrauth-type-info-vtable.cpp +++ b/clang/test/CodeGenCXX/ptrauth-type-info-vtable.cpp @@ -4,6 +4,12 @@ // RUN: -fptrauth-vtable-pointer-address-discrimination \ // RUN: %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,NODISC +// RUN: %clang_cc1 -DENABLE_TID=0 -I%S -std=c++11 -triple=aarch64-linux-gnu \ +// RUN: -fptrauth-calls -fptrauth-intrinsics \ +// RUN: -fptrauth-vtable-pointer-type-discrimination \ +// RUN: -fptrauth-vtable-pointer-address-discrimination \ +// RUN: %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,NODISC + // RUN: %clang_cc1 -DENABLE_TID=1 -I%S -std=c++11 -triple=arm64e-apple-darwin \ // RUN: -fptrauth-calls -fptrauth-intrinsics \ // RUN: -fptrauth-vtable-pointer-type-discrimination \ @@ -11,6 +17,13 @@ // RUN: -fptrauth-type-info-vtable-pointer-discrimination \ // RUN: %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,DISC +// RUN: %clang_cc1 -DENABLE_TID=1 -I%S -std=c++11 -triple=aarch64-linux-gnu \ +// RUN: -fptrauth-calls -fptrauth-intrinsics \ +// RUN: -fptrauth-vtable-pointer-type-discrimination \ +// RUN: -fptrauth-vtable-pointer-address-discrimination \ +// RUN: -fptrauth-type-info-vtable-pointer-discrimination \ +// RUN: %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,DISC + // copied from typeinfo namespace std { @@ -64,7 +77,7 @@ TestStruct::~TestStruct(){} extern "C" void test_vtable(std::type_info* t) { t->test_method(); } -// NODISC: define void @test_vtable(ptr noundef %t) +// NODISC: define{{.*}} void @test_vtable(ptr noundef %t) // NODISC: [[T_ADDR:%.*]] = alloca ptr, align 8 // NODISC: store ptr %t, ptr [[T_ADDR]], align 8 // NODISC: [[T:%.*]] = load ptr, ptr [[T_ADDR]], align 8 @@ -72,7 +85,7 @@ extern "C" void test_vtable(std::type_info* t) { // NODISC: [[CAST_VPTR:%.*]] = ptrtoint ptr [[VPTR]] to i64 // NODISC: [[AUTHED:%.*]] = call i64 @llvm.ptrauth.auth(i64 [[CAST_VPTR]], i32 2, i64 0) -// DISC: define void @test_vtable(ptr noundef %t) +// DISC: define{{.*}} void @test_vtable(ptr noundef %t) // DISC: [[T_ADDR:%.*]] = alloca ptr, align 8 // DISC: store ptr %t, ptr [[T_ADDR]], align 8 // DISC: [[T:%.*]] = load ptr, ptr [[T_ADDR]], align 8 diff --git a/clang/test/CodeGenCXX/trivial_abi.cpp b/clang/test/CodeGenCXX/trivial_abi.cpp index 3012b0f2bc33d..54912a617c287 100644 --- a/clang/test/CodeGenCXX/trivial_abi.cpp +++ b/clang/test/CodeGenCXX/trivial_abi.cpp @@ -262,6 +262,26 @@ void testExceptionLarge() { calleeExceptionLarge(Large(), Large()); } +// CHECK: define void @_ZN7GH930401gEPNS_1SE +// CHECK: [[CALL:%.*]] = call i64 @_ZN7GH930401fEv +// CHECK-NEXT: [[TRUNC:%.*]] = trunc i64 [[CALL]] to i56 +// CHECK-NEXT: store i56 [[TRUNC]] +// CHECK-NEXT: ret void +void* operator new(unsigned long, void*); +namespace GH93040 { +struct [[clang::trivial_abi]] S { + char a; + int x; + __attribute((aligned(2))) char y; + S(); +} __attribute((packed)); +S f(); +void g(S* s) { new(s) S(f()); } +struct S2 { [[no_unique_address]] S s; char c;}; +static_assert(sizeof(S) == 8 && sizeof(S2) == 8, ""); +} + + // PR42961 // CHECK: define{{.*}} @"_ZN3$_08__invokeEv"() diff --git a/clang/test/CodeGenHIP/dpp-const-fold.hip b/clang/test/CodeGenHIP/dpp-const-fold.hip index f5a97c6b0e77f..c5450ec4b8413 100644 --- a/clang/test/CodeGenHIP/dpp-const-fold.hip +++ b/clang/test/CodeGenHIP/dpp-const-fold.hip @@ -22,25 +22,25 @@ constexpr static bool BountCtrl() return true & false; } -// CHECK: call i32 @llvm.amdgcn.update.dpp.i32(i32 %1, i32 %2, i32 16, i32 0, i32 0, i1 false) +// CHECK: call i32 @llvm.amdgcn.update.dpp.i32(i32 %0, i32 %1, i32 16, i32 0, i32 0, i1 false) __attribute__((global)) void test_update_dpp_const_fold_imm_operand_2(int* out, int a, int b) { *out = __builtin_amdgcn_update_dpp(a, b, OpCtrl(), 0, 0, false); } -// CHECK: call i32 @llvm.amdgcn.update.dpp.i32(i32 %1, i32 %2, i32 0, i32 4, i32 0, i1 false) +// CHECK: call i32 @llvm.amdgcn.update.dpp.i32(i32 %0, i32 %1, i32 0, i32 4, i32 0, i1 false) __attribute__((global)) void test_update_dpp_const_fold_imm_operand_3(int* out, int a, int b) { *out = __builtin_amdgcn_update_dpp(a, b, 0, RowMask(), 0, false); } -// CHECK: call i32 @llvm.amdgcn.update.dpp.i32(i32 %1, i32 %2, i32 0, i32 0, i32 3, i1 false) +// CHECK: call i32 @llvm.amdgcn.update.dpp.i32(i32 %0, i32 %1, i32 0, i32 0, i32 3, i1 false) __attribute__((global)) void test_update_dpp_const_fold_imm_operand_4(int* out, int a, int b) { *out = __builtin_amdgcn_update_dpp(a, b, 0, 0, BankMask(), false); } -// CHECK: call i32 @llvm.amdgcn.update.dpp.i32(i32 %1, i32 %2, i32 0, i32 0, i32 0, i1 false) +// CHECK: call i32 @llvm.amdgcn.update.dpp.i32(i32 %0, i32 %1, i32 0, i32 0, i32 0, i1 false) __attribute__((global)) void test_update_dpp_const_fold_imm_operand_5(int* out, int a, int b) { *out = __builtin_amdgcn_update_dpp(a, b, 0, 0, 0, BountCtrl()); diff --git a/clang/test/CodeGenHIP/spirv-amdgcn-dpp-const-fold.hip b/clang/test/CodeGenHIP/spirv-amdgcn-dpp-const-fold.hip index 2b785200e8eea..71270bc1c68d8 100644 --- a/clang/test/CodeGenHIP/spirv-amdgcn-dpp-const-fold.hip +++ b/clang/test/CodeGenHIP/spirv-amdgcn-dpp-const-fold.hip @@ -21,25 +21,25 @@ constexpr static bool BountCtrl() return true & false; } -// CHECK: call{{.*}} i32 @llvm.amdgcn.update.dpp.i32(i32 %1, i32 %2, i32 16, i32 0, i32 0, i1 false) +// CHECK: call{{.*}} i32 @llvm.amdgcn.update.dpp.i32(i32 %0, i32 %1, i32 16, i32 0, i32 0, i1 false) __attribute__((global)) void test_update_dpp_const_fold_imm_operand_2(int* out, int a, int b) { *out = __builtin_amdgcn_update_dpp(a, b, OpCtrl(), 0, 0, false); } -// CHECK: call{{.*}} i32 @llvm.amdgcn.update.dpp.i32(i32 %1, i32 %2, i32 0, i32 4, i32 0, i1 false) +// CHECK: call{{.*}} i32 @llvm.amdgcn.update.dpp.i32(i32 %0, i32 %1, i32 0, i32 4, i32 0, i1 false) __attribute__((global)) void test_update_dpp_const_fold_imm_operand_3(int* out, int a, int b) { *out = __builtin_amdgcn_update_dpp(a, b, 0, RowMask(), 0, false); } -// CHECK: call{{.*}} i32 @llvm.amdgcn.update.dpp.i32(i32 %1, i32 %2, i32 0, i32 0, i32 3, i1 false) +// CHECK: call{{.*}} i32 @llvm.amdgcn.update.dpp.i32(i32 %0, i32 %1, i32 0, i32 0, i32 3, i1 false) __attribute__((global)) void test_update_dpp_const_fold_imm_operand_4(int* out, int a, int b) { *out = __builtin_amdgcn_update_dpp(a, b, 0, 0, BankMask(), false); } -// CHECK: call{{.*}} i32 @llvm.amdgcn.update.dpp.i32(i32 %1, i32 %2, i32 0, i32 0, i32 0, i1 false) +// CHECK: call{{.*}} i32 @llvm.amdgcn.update.dpp.i32(i32 %0, i32 %1, i32 0, i32 0, i32 0, i1 false) __attribute__((global)) void test_update_dpp_const_fold_imm_operand_5(int* out, int a, int b) { *out = __builtin_amdgcn_update_dpp(a, b, 0, 0, 0, BountCtrl()); diff --git a/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl b/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl index 385f8a753cd8e..1651cb379a20f 100644 --- a/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl +++ b/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl @@ -145,7 +145,9 @@ kernel void KernelOneMemberSpir(global struct StructOneMember* u) { // AMDGCN-LABEL: define{{.*}} amdgpu_kernel void @KernelLargeOneMember( // AMDGCN: %[[U:.*]] = alloca %struct.LargeStructOneMember, align 8, addrspace(5) -// AMDGCN: store %struct.LargeStructOneMember %u.coerce, ptr addrspace(5) %[[U]], align 8 +// AMDGCN: %[[U_ELEM:.*]] = getelementptr inbounds %struct.LargeStructOneMember, ptr addrspace(5) %[[U]], i32 0, i32 0 +// AMDGCN: %[[EXTRACT:.*]] = extractvalue %struct.LargeStructOneMember %u.coerce, 0 +// AMDGCN: store [100 x <2 x i32>] %[[EXTRACT]], ptr addrspace(5) %[[U_ELEM]], align 8 // AMDGCN: call void @FuncOneLargeMember(ptr addrspace(5) noundef byref(%struct.LargeStructOneMember) align 8 %[[U]]) kernel void KernelLargeOneMember(struct LargeStructOneMember u) { FuncOneLargeMember(u); @@ -177,7 +179,12 @@ kernel void KernelTwoMember(struct StructTwoMember u) { // AMDGCN-LABEL: define{{.*}} amdgpu_kernel void @KernelLargeTwoMember // AMDGCN-SAME: (%struct.LargeStructTwoMember %[[u_coerce:.*]]) // AMDGCN: %[[u:.*]] = alloca %struct.LargeStructTwoMember, align 8, addrspace(5) -// AMDGCN: store %struct.LargeStructTwoMember %[[u_coerce]], ptr addrspace(5) %[[u]] +// AMDGCN: %[[U_PTR0:.*]] = getelementptr inbounds %struct.LargeStructTwoMember, ptr addrspace(5) %[[u]], i32 0, i32 0 +// AMDGCN: %[[EXTRACT0:.*]] = extractvalue %struct.LargeStructTwoMember %u.coerce, 0 +// AMDGCN: store [40 x <2 x i32>] %[[EXTRACT0]], ptr addrspace(5) %[[U_PTR0]] +// AMDGCN: %[[U_PTR1:.*]] = getelementptr inbounds %struct.LargeStructTwoMember, ptr addrspace(5) %[[u]], i32 0, i32 1 +// AMDGCN: %[[EXTRACT1:.*]] = extractvalue %struct.LargeStructTwoMember %u.coerce, 1 +// AMDGCN: store [20 x <2 x i32>] %[[EXTRACT1]], ptr addrspace(5) %[[U_PTR1]] // AMDGCN: call void @FuncLargeTwoMember(ptr addrspace(5) noundef byref(%struct.LargeStructTwoMember) align 8 %[[u]]) kernel void KernelLargeTwoMember(struct LargeStructTwoMember u) { FuncLargeTwoMember(u); diff --git a/clang/test/CodeGenOpenCL/amdgpu-abi-struct-arg-byref.cl b/clang/test/CodeGenOpenCL/amdgpu-abi-struct-arg-byref.cl index fa83a38a01b0a..fe0a2f9578db0 100644 --- a/clang/test/CodeGenOpenCL/amdgpu-abi-struct-arg-byref.cl +++ b/clang/test/CodeGenOpenCL/amdgpu-abi-struct-arg-byref.cl @@ -61,7 +61,7 @@ Mat4X4 __attribute__((noinline)) foo(Mat3X3 in) { // the return value. // AMDGCN-LABEL: define dso_local amdgpu_kernel void @ker -// AMDGCN-SAME: (ptr addrspace(1) noundef align 4 [[IN:%.*]], ptr addrspace(1) noundef align 4 [[OUT:%.*]]) #[[ATTR1:[0-9]+]] !kernel_arg_addr_space !4 !kernel_arg_access_qual !5 !kernel_arg_type !6 !kernel_arg_base_type !6 !kernel_arg_type_qual !7 { +// AMDGCN-SAME: (ptr addrspace(1) noundef align 4 [[IN:%.*]], ptr addrspace(1) noundef align 4 [[OUT:%.*]]) #[[ATTR1:[0-9]+]] !kernel_arg_addr_space [[META4:![0-9]+]] !kernel_arg_access_qual [[META5:![0-9]+]] !kernel_arg_type [[META6:![0-9]+]] !kernel_arg_base_type [[META6]] !kernel_arg_type_qual [[META7:![0-9]+]] { // AMDGCN-NEXT: entry: // AMDGCN-NEXT: [[IN_ADDR:%.*]] = alloca ptr addrspace(1), align 8, addrspace(5) // AMDGCN-NEXT: [[OUT_ADDR:%.*]] = alloca ptr addrspace(1), align 8, addrspace(5) @@ -74,7 +74,7 @@ Mat4X4 __attribute__((noinline)) foo(Mat3X3 in) { // AMDGCN-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds [[STRUCT_MAT3X3:%.*]], ptr addrspace(1) [[TMP1]], i64 1 // AMDGCN-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[STRUCT_MAT3X3]], ptr addrspace(1) [[ARRAYIDX1]], i32 0, i32 0 // AMDGCN-NEXT: [[TMP3:%.*]] = load [9 x i32], ptr addrspace(1) [[TMP2]], align 4 -// AMDGCN-NEXT: [[CALL:%.*]] = call [[STRUCT_MAT4X4]] @foo([9 x i32] [[TMP3]]) #[[ATTR3:[0-9]+]] +// AMDGCN-NEXT: [[CALL:%.*]] = call [[STRUCT_MAT4X4]] @[[FOO:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]]([9 x i32] [[TMP3]]) #[[ATTR3:[0-9]+]] // AMDGCN-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[STRUCT_MAT4X4]], ptr addrspace(5) [[TMP]], i32 0, i32 0 // AMDGCN-NEXT: [[TMP5:%.*]] = extractvalue [[STRUCT_MAT4X4]] [[CALL]], 0 // AMDGCN-NEXT: store [16 x i32] [[TMP5]], ptr addrspace(5) [[TMP4]], align 4 @@ -98,7 +98,7 @@ Mat64X64 __attribute__((noinline)) foo_large(Mat32X32 in) { } // AMDGCN-LABEL: define dso_local amdgpu_kernel void @ker_large -// AMDGCN-SAME: (ptr addrspace(1) noundef align 4 [[IN:%.*]], ptr addrspace(1) noundef align 4 [[OUT:%.*]]) #[[ATTR1]] !kernel_arg_addr_space !4 !kernel_arg_access_qual !5 !kernel_arg_type !8 !kernel_arg_base_type !8 !kernel_arg_type_qual !7 { +// AMDGCN-SAME: (ptr addrspace(1) noundef align 4 [[IN:%.*]], ptr addrspace(1) noundef align 4 [[OUT:%.*]]) #[[ATTR1]] !kernel_arg_addr_space [[META4]] !kernel_arg_access_qual [[META5]] !kernel_arg_type [[META8:![0-9]+]] !kernel_arg_base_type [[META8]] !kernel_arg_type_qual [[META7]] { // AMDGCN-NEXT: entry: // AMDGCN-NEXT: [[IN_ADDR:%.*]] = alloca ptr addrspace(1), align 8, addrspace(5) // AMDGCN-NEXT: [[OUT_ADDR:%.*]] = alloca ptr addrspace(1), align 8, addrspace(5) @@ -168,7 +168,7 @@ void test_indirect_arg_globl(void) { #endif // AMDGCN-LABEL: define dso_local amdgpu_kernel void @test_indirect_arg_local -// AMDGCN-SAME: () #[[ATTR1]] !kernel_arg_addr_space !9 !kernel_arg_access_qual !9 !kernel_arg_type !9 !kernel_arg_base_type !9 !kernel_arg_type_qual !9 { +// AMDGCN-SAME: () #[[ATTR1]] !kernel_arg_addr_space [[META9:![0-9]+]] !kernel_arg_access_qual [[META9]] !kernel_arg_type [[META9]] !kernel_arg_base_type [[META9]] !kernel_arg_type_qual [[META9]] { // AMDGCN-NEXT: entry: // AMDGCN-NEXT: [[BYVAL_TEMP:%.*]] = alloca [[STRUCT_LARGESTRUCTONEMEMBER:%.*]], align 8, addrspace(5) // AMDGCN-NEXT: call void @llvm.memcpy.p5.p3.i64(ptr addrspace(5) align 8 [[BYVAL_TEMP]], ptr addrspace(3) align 8 @test_indirect_arg_local.l_s, i64 800, i1 false) @@ -193,7 +193,7 @@ void test_indirect_arg_private(void) { } // AMDGCN-LABEL: define dso_local amdgpu_kernel void @KernelOneMember -// AMDGCN-SAME: (<2 x i32> [[U_COERCE:%.*]]) #[[ATTR1]] !kernel_arg_addr_space !10 !kernel_arg_access_qual !11 !kernel_arg_type !12 !kernel_arg_base_type !12 !kernel_arg_type_qual !13 { +// AMDGCN-SAME: (<2 x i32> [[U_COERCE:%.*]]) #[[ATTR1]] !kernel_arg_addr_space [[META10:![0-9]+]] !kernel_arg_access_qual [[META11:![0-9]+]] !kernel_arg_type [[META12:![0-9]+]] !kernel_arg_base_type [[META12]] !kernel_arg_type_qual [[META13:![0-9]+]] { // AMDGCN-NEXT: entry: // AMDGCN-NEXT: [[U:%.*]] = alloca [[STRUCT_STRUCTONEMEMBER:%.*]], align 8, addrspace(5) // AMDGCN-NEXT: [[COERCE_DIVE:%.*]] = getelementptr inbounds [[STRUCT_STRUCTONEMEMBER]], ptr addrspace(5) [[U]], i32 0, i32 0 @@ -208,7 +208,7 @@ kernel void KernelOneMember(struct StructOneMember u) { } // AMDGCN-LABEL: define dso_local amdgpu_kernel void @KernelOneMemberSpir -// AMDGCN-SAME: (ptr addrspace(1) noundef align 8 [[U:%.*]]) #[[ATTR1]] !kernel_arg_addr_space !14 !kernel_arg_access_qual !11 !kernel_arg_type !15 !kernel_arg_base_type !15 !kernel_arg_type_qual !13 { +// AMDGCN-SAME: (ptr addrspace(1) noundef align 8 [[U:%.*]]) #[[ATTR1]] !kernel_arg_addr_space [[META14:![0-9]+]] !kernel_arg_access_qual [[META11]] !kernel_arg_type [[META15:![0-9]+]] !kernel_arg_base_type [[META15]] !kernel_arg_type_qual [[META13]] { // AMDGCN-NEXT: entry: // AMDGCN-NEXT: [[U_ADDR:%.*]] = alloca ptr addrspace(1), align 8, addrspace(5) // AMDGCN-NEXT: store ptr addrspace(1) [[U]], ptr addrspace(5) [[U_ADDR]], align 8 @@ -223,10 +223,12 @@ kernel void KernelOneMemberSpir(global struct StructOneMember* u) { } // AMDGCN-LABEL: define dso_local amdgpu_kernel void @KernelLargeOneMember -// AMDGCN-SAME: ([[STRUCT_LARGESTRUCTONEMEMBER:%.*]] [[U_COERCE:%.*]]) #[[ATTR1]] !kernel_arg_addr_space !10 !kernel_arg_access_qual !11 !kernel_arg_type !16 !kernel_arg_base_type !16 !kernel_arg_type_qual !13 { +// AMDGCN-SAME: ([[STRUCT_LARGESTRUCTONEMEMBER:%.*]] [[U_COERCE:%.*]]) #[[ATTR1]] !kernel_arg_addr_space [[META10]] !kernel_arg_access_qual [[META11]] !kernel_arg_type [[META16:![0-9]+]] !kernel_arg_base_type [[META16]] !kernel_arg_type_qual [[META13]] { // AMDGCN-NEXT: entry: // AMDGCN-NEXT: [[U:%.*]] = alloca [[STRUCT_LARGESTRUCTONEMEMBER]], align 8, addrspace(5) -// AMDGCN-NEXT: store [[STRUCT_LARGESTRUCTONEMEMBER]] [[U_COERCE]], ptr addrspace(5) [[U]], align 8 +// AMDGCN-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_LARGESTRUCTONEMEMBER]], ptr addrspace(5) [[U]], i32 0, i32 0 +// AMDGCN-NEXT: [[TMP1:%.*]] = extractvalue [[STRUCT_LARGESTRUCTONEMEMBER]] [[U_COERCE]], 0 +// AMDGCN-NEXT: store [100 x <2 x i32>] [[TMP1]], ptr addrspace(5) [[TMP0]], align 8 // AMDGCN-NEXT: call void @FuncOneLargeMember(ptr addrspace(5) noundef byref([[STRUCT_LARGESTRUCTONEMEMBER]]) align 8 [[U]]) #[[ATTR3]] // AMDGCN-NEXT: ret void // @@ -271,15 +273,20 @@ void FuncLargeTwoMember(struct LargeStructTwoMember u) { } // AMDGCN-LABEL: define dso_local amdgpu_kernel void @KernelTwoMember -// AMDGCN-SAME: ([[STRUCT_STRUCTTWOMEMBER:%.*]] [[U_COERCE:%.*]]) #[[ATTR1]] !kernel_arg_addr_space !10 !kernel_arg_access_qual !11 !kernel_arg_type !17 !kernel_arg_base_type !17 !kernel_arg_type_qual !13 { +// AMDGCN-SAME: ([[STRUCT_STRUCTTWOMEMBER:%.*]] [[U_COERCE:%.*]]) #[[ATTR1]] !kernel_arg_addr_space [[META10]] !kernel_arg_access_qual [[META11]] !kernel_arg_type [[META17:![0-9]+]] !kernel_arg_base_type [[META17]] !kernel_arg_type_qual [[META13]] { // AMDGCN-NEXT: entry: // AMDGCN-NEXT: [[U:%.*]] = alloca [[STRUCT_STRUCTTWOMEMBER]], align 8, addrspace(5) -// AMDGCN-NEXT: store [[STRUCT_STRUCTTWOMEMBER]] [[U_COERCE]], ptr addrspace(5) [[U]], align 8 // AMDGCN-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_STRUCTTWOMEMBER]], ptr addrspace(5) [[U]], i32 0, i32 0 -// AMDGCN-NEXT: [[TMP1:%.*]] = load <2 x i32>, ptr addrspace(5) [[TMP0]], align 8 +// AMDGCN-NEXT: [[TMP1:%.*]] = extractvalue [[STRUCT_STRUCTTWOMEMBER]] [[U_COERCE]], 0 +// AMDGCN-NEXT: store <2 x i32> [[TMP1]], ptr addrspace(5) [[TMP0]], align 8 // AMDGCN-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[STRUCT_STRUCTTWOMEMBER]], ptr addrspace(5) [[U]], i32 0, i32 1 -// AMDGCN-NEXT: [[TMP3:%.*]] = load <2 x i32>, ptr addrspace(5) [[TMP2]], align 8 -// AMDGCN-NEXT: call void @FuncTwoMember(<2 x i32> [[TMP1]], <2 x i32> [[TMP3]]) #[[ATTR3]] +// AMDGCN-NEXT: [[TMP3:%.*]] = extractvalue [[STRUCT_STRUCTTWOMEMBER]] [[U_COERCE]], 1 +// AMDGCN-NEXT: store <2 x i32> [[TMP3]], ptr addrspace(5) [[TMP2]], align 8 +// AMDGCN-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[STRUCT_STRUCTTWOMEMBER]], ptr addrspace(5) [[U]], i32 0, i32 0 +// AMDGCN-NEXT: [[TMP5:%.*]] = load <2 x i32>, ptr addrspace(5) [[TMP4]], align 8 +// AMDGCN-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT_STRUCTTWOMEMBER]], ptr addrspace(5) [[U]], i32 0, i32 1 +// AMDGCN-NEXT: [[TMP7:%.*]] = load <2 x i32>, ptr addrspace(5) [[TMP6]], align 8 +// AMDGCN-NEXT: call void @FuncTwoMember(<2 x i32> [[TMP5]], <2 x i32> [[TMP7]]) #[[ATTR3]] // AMDGCN-NEXT: ret void // kernel void KernelTwoMember(struct StructTwoMember u) { @@ -287,10 +294,15 @@ kernel void KernelTwoMember(struct StructTwoMember u) { } // AMDGCN-LABEL: define dso_local amdgpu_kernel void @KernelLargeTwoMember -// AMDGCN-SAME: ([[STRUCT_LARGESTRUCTTWOMEMBER:%.*]] [[U_COERCE:%.*]]) #[[ATTR1]] !kernel_arg_addr_space !10 !kernel_arg_access_qual !11 !kernel_arg_type !18 !kernel_arg_base_type !18 !kernel_arg_type_qual !13 { +// AMDGCN-SAME: ([[STRUCT_LARGESTRUCTTWOMEMBER:%.*]] [[U_COERCE:%.*]]) #[[ATTR1]] !kernel_arg_addr_space [[META10]] !kernel_arg_access_qual [[META11]] !kernel_arg_type [[META18:![0-9]+]] !kernel_arg_base_type [[META18]] !kernel_arg_type_qual [[META13]] { // AMDGCN-NEXT: entry: // AMDGCN-NEXT: [[U:%.*]] = alloca [[STRUCT_LARGESTRUCTTWOMEMBER]], align 8, addrspace(5) -// AMDGCN-NEXT: store [[STRUCT_LARGESTRUCTTWOMEMBER]] [[U_COERCE]], ptr addrspace(5) [[U]], align 8 +// AMDGCN-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_LARGESTRUCTTWOMEMBER]], ptr addrspace(5) [[U]], i32 0, i32 0 +// AMDGCN-NEXT: [[TMP1:%.*]] = extractvalue [[STRUCT_LARGESTRUCTTWOMEMBER]] [[U_COERCE]], 0 +// AMDGCN-NEXT: store [40 x <2 x i32>] [[TMP1]], ptr addrspace(5) [[TMP0]], align 8 +// AMDGCN-NEXT: [[TMP2:%.*]] = getelementptr inbounds [[STRUCT_LARGESTRUCTTWOMEMBER]], ptr addrspace(5) [[U]], i32 0, i32 1 +// AMDGCN-NEXT: [[TMP3:%.*]] = extractvalue [[STRUCT_LARGESTRUCTTWOMEMBER]] [[U_COERCE]], 1 +// AMDGCN-NEXT: store [20 x <2 x i32>] [[TMP3]], ptr addrspace(5) [[TMP2]], align 8 // AMDGCN-NEXT: call void @FuncLargeTwoMember(ptr addrspace(5) noundef byref([[STRUCT_LARGESTRUCTTWOMEMBER]]) align 8 [[U]]) #[[ATTR3]] // AMDGCN-NEXT: ret void // diff --git a/clang/test/Driver/Inputs/DriverKit23.0.sdk/SDKSettings.json b/clang/test/Driver/Inputs/DriverKit23.0.sdk/SDKSettings.json new file mode 100644 index 0000000000000..7ba6c244df211 --- /dev/null +++ b/clang/test/Driver/Inputs/DriverKit23.0.sdk/SDKSettings.json @@ -0,0 +1 @@ +{"Version":"23.0", "MaximumDeploymentTarget": "23.0.99"} diff --git a/clang/test/Driver/Inputs/MacOSX15.0.sdk/SDKSettings.json b/clang/test/Driver/Inputs/MacOSX15.0.sdk/SDKSettings.json new file mode 100644 index 0000000000000..ced45d5c21996 --- /dev/null +++ b/clang/test/Driver/Inputs/MacOSX15.0.sdk/SDKSettings.json @@ -0,0 +1 @@ +{"Version":"15.0", "MaximumDeploymentTarget": "15.0.99"} diff --git a/clang/test/Driver/Inputs/MacOSX15.1.sdk/SDKSettings.json b/clang/test/Driver/Inputs/MacOSX15.1.sdk/SDKSettings.json new file mode 100644 index 0000000000000..d46295b2ab5a1 --- /dev/null +++ b/clang/test/Driver/Inputs/MacOSX15.1.sdk/SDKSettings.json @@ -0,0 +1 @@ +{"Version":"15.1", "MaximumDeploymentTarget": "15.1.99"} diff --git a/clang/test/Driver/Inputs/MacOSX99.0.sdk/SDKSettings.json b/clang/test/Driver/Inputs/MacOSX99.0.sdk/SDKSettings.json deleted file mode 100644 index 77b70e1a83c19..0000000000000 --- a/clang/test/Driver/Inputs/MacOSX99.0.sdk/SDKSettings.json +++ /dev/null @@ -1 +0,0 @@ -{"Version":"990.0", "MaximumDeploymentTarget": "99.0.99"} diff --git a/clang/test/Driver/aarch64-negative-modifiers-for-default-features.c b/clang/test/Driver/aarch64-negative-modifiers-for-default-features.c new file mode 100644 index 0000000000000..03dd8af7588ca --- /dev/null +++ b/clang/test/Driver/aarch64-negative-modifiers-for-default-features.c @@ -0,0 +1,12 @@ +// Test that default features (e.g. flagm/sb/ssbs for 8.5) can be disabled via -march. + +// RUN: %clang --target=aarch64 -march=armv8.5-a+noflagm+nosb+nossbs -c %s -### 2>&1 | FileCheck %s +// CHECK: "-triple" "aarch64" +// CHECK-SAME: "-target-feature" "+v8.5a" +// CHECK-SAME: "-target-feature" "-flagm" +// CHECK-SAME: "-target-feature" "-sb" +// CHECK-SAME: "-target-feature" "-ssbs" + +// CHECK-NOT: "-target-feature" "+flagm" +// CHECK-NOT: "-target-feature" "+sb" +// CHECK-NOT: "-target-feature" "+ssbs" diff --git a/clang/test/Driver/aarch64-ptrauth.c b/clang/test/Driver/aarch64-ptrauth.c index d13930e8f4b37..c8e3aeef1640a 100644 --- a/clang/test/Driver/aarch64-ptrauth.c +++ b/clang/test/Driver/aarch64-ptrauth.c @@ -11,36 +11,41 @@ // RUN: -fno-ptrauth-auth-traps -fptrauth-auth-traps \ // RUN: -fno-ptrauth-vtable-pointer-address-discrimination -fptrauth-vtable-pointer-address-discrimination \ // RUN: -fno-ptrauth-vtable-pointer-type-discrimination -fptrauth-vtable-pointer-type-discrimination \ +// RUN: -fno-ptrauth-type-info-vtable-pointer-discrimination -fptrauth-type-info-vtable-pointer-discrimination \ // RUN: -fno-ptrauth-init-fini -fptrauth-init-fini \ +// RUN: -fno-ptrauth-indirect-gotos -fptrauth-indirect-gotos \ // RUN: %s 2>&1 | FileCheck %s --check-prefix=ALL -// ALL: "-cc1"{{.*}} "-fptrauth-intrinsics" "-fptrauth-calls" "-fptrauth-returns" "-fptrauth-auth-traps" "-fptrauth-vtable-pointer-address-discrimination" "-fptrauth-vtable-pointer-type-discrimination" "-fptrauth-init-fini" +// ALL: "-cc1"{{.*}} "-fptrauth-intrinsics" "-fptrauth-calls" "-fptrauth-returns" "-fptrauth-auth-traps" "-fptrauth-vtable-pointer-address-discrimination" "-fptrauth-vtable-pointer-type-discrimination" "-fptrauth-type-info-vtable-pointer-discrimination" "-fptrauth-init-fini" "-fptrauth-indirect-gotos" // RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI1 // RUN: %clang -### -c --target=aarch64-linux-pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI1 // PAUTHABI1: "-cc1"{{.*}} "-triple" "aarch64-unknown-linux-pauthtest" // PAUTHABI1-SAME: "-target-abi" "pauthtest" -// PAUTHABI1-SAME: "-fptrauth-intrinsics" "-fptrauth-calls" "-fptrauth-returns" "-fptrauth-auth-traps" "-fptrauth-vtable-pointer-address-discrimination" "-fptrauth-vtable-pointer-type-discrimination" "-fptrauth-init-fini" +// PAUTHABI1-SAME: "-fptrauth-intrinsics" "-fptrauth-calls" "-fptrauth-returns" "-fptrauth-auth-traps" "-fptrauth-vtable-pointer-address-discrimination" "-fptrauth-vtable-pointer-type-discrimination" "-fptrauth-indirect-gotos" "-fptrauth-init-fini" // RUN: %clang -### -c --target=aarch64 -mabi=pauthtest -fno-ptrauth-intrinsics \ // RUN: -fno-ptrauth-calls -fno-ptrauth-returns -fno-ptrauth-auth-traps \ // RUN: -fno-ptrauth-vtable-pointer-address-discrimination -fno-ptrauth-vtable-pointer-type-discrimination \ -// RUN: -fno-ptrauth-init-fini %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI2 +// RUN: -fno-ptrauth-indirect-gotos -fno-ptrauth-init-fini %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI2 // RUN: %clang -### -c --target=aarch64-pauthtest -fno-ptrauth-intrinsics \ // RUN: -fno-ptrauth-calls -fno-ptrauth-returns -fno-ptrauth-auth-traps \ // RUN: -fno-ptrauth-vtable-pointer-address-discrimination -fno-ptrauth-vtable-pointer-type-discrimination \ -// RUN: -fno-ptrauth-init-fini %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI2 +// RUN: -fno-ptrauth-indirect-gotos -fno-ptrauth-init-fini %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI2 // PAUTHABI2: "-cc1" // PAUTHABI2-NOT: "-fptrauth- // RUN: not %clang -### -c --target=x86_64 -fptrauth-intrinsics -fptrauth-calls -fptrauth-returns -fptrauth-auth-traps \ // RUN: -fptrauth-vtable-pointer-address-discrimination -fptrauth-vtable-pointer-type-discrimination \ -// RUN: -fptrauth-init-fini %s 2>&1 | FileCheck %s --check-prefix=ERR1 +// RUN: -fptrauth-type-info-vtable-pointer-discrimination -fptrauth-indirect-gotos -fptrauth-init-fini %s 2>&1 | \ +// RUN: FileCheck %s --check-prefix=ERR1 // ERR1: error: unsupported option '-fptrauth-intrinsics' for target '{{.*}}' // ERR1-NEXT: error: unsupported option '-fptrauth-calls' for target '{{.*}}' // ERR1-NEXT: error: unsupported option '-fptrauth-returns' for target '{{.*}}' // ERR1-NEXT: error: unsupported option '-fptrauth-auth-traps' for target '{{.*}}' // ERR1-NEXT: error: unsupported option '-fptrauth-vtable-pointer-address-discrimination' for target '{{.*}}' // ERR1-NEXT: error: unsupported option '-fptrauth-vtable-pointer-type-discrimination' for target '{{.*}}' +// ERR1-NEXT: error: unsupported option '-fptrauth-type-info-vtable-pointer-discrimination' for target '{{.*}}' +// ERR1-NEXT: error: unsupported option '-fptrauth-indirect-gotos' for target '{{.*}}' // ERR1-NEXT: error: unsupported option '-fptrauth-init-fini' for target '{{.*}}' //// Only support PAuth ABI for Linux as for now. diff --git a/clang/test/Driver/arm-sb.c b/clang/test/Driver/arm-sb.c index f2704f33c2711..9c0f381171cb6 100644 --- a/clang/test/Driver/arm-sb.c +++ b/clang/test/Driver/arm-sb.c @@ -11,6 +11,6 @@ // RUN: %clang -### -target arm-none-none-eabi %s 2>&1 | FileCheck %s --check-prefix=ABSENT // RUN: %clang -### -target aarch64-none-elf %s 2>&1 | FileCheck %s --check-prefix=ABSENT -// RUN: %clang -### -target aarch64-none-elf -march=armv8.5a+nosb %s 2>&1 | FileCheck %s --check-prefix=ABSENT +// RUN: %clang -### -target aarch64-none-elf -march=armv8.5a+nosb %s 2>&1 | FileCheck %s --check-prefix=NOSB // ABSENT-NOT: "-target-feature" "+sb" // ABSENT-NOT: "-target-feature" "-sb" diff --git a/clang/test/Driver/cl-cxx20-modules.cppm b/clang/test/Driver/cl-cxx20-modules.cppm new file mode 100644 index 0000000000000..43dbf517485a0 --- /dev/null +++ b/clang/test/Driver/cl-cxx20-modules.cppm @@ -0,0 +1,16 @@ +// RUN: rm -rf %t +// RUN: split-file %s %t + +// RUN: %clang_cl /std:c++20 --precompile -### -- %s 2>&1 | FileCheck --check-prefix=PRECOMPILE %s +// PRECOMPILE: -emit-module-interface + +// RUN: %clang_cl /std:c++20 --fmodule-file=Foo=Foo.pcm -### -- %s 2>&1 | FileCheck --check-prefix=FMODULEFILE %s +// FMODULEFILE: -fmodule-file=Foo=Foo.pcm + +// RUN: %clang_cl /std:c++20 --fprebuilt-module-path=. -### -- %s 2>&1 | FileCheck --check-prefix=FPREBUILT %s +// FPREBUILT: -fprebuilt-module-path=. + +// RUN: %clang_cl %t/test.pcm /std:c++20 -### 2>&1 | FileCheck --check-prefix=CPP20WARNING %t/test.pcm + +//--- test.pcm +// CPP20WARNING-NOT: clang-cl: warning: argument unused during compilation: '/std:c++20' [-Wunused-command-line-argument] diff --git a/clang/test/Driver/darwin-builtin-modules.c b/clang/test/Driver/darwin-builtin-modules.c index 1c56e13bfb929..4564d7317d7ab 100644 --- a/clang/test/Driver/darwin-builtin-modules.c +++ b/clang/test/Driver/darwin-builtin-modules.c @@ -6,6 +6,10 @@ // RUN: %clang -isysroot %S/Inputs/iPhoneOS13.0.sdk -target arm64-apple-ios13.0 -### %s 2>&1 | FileCheck %s // CHECK: -fbuiltin-headers-in-system-modules -// RUN: %clang -isysroot %S/Inputs/MacOSX99.0.sdk -target x86_64-apple-macos98.0 -### %s 2>&1 | FileCheck --check-prefix=CHECK_FUTURE %s -// RUN: %clang -isysroot %S/Inputs/MacOSX99.0.sdk -target x86_64-apple-macos99.0 -### %s 2>&1 | FileCheck --check-prefix=CHECK_FUTURE %s +// RUN: %clang -isysroot %S/Inputs/MacOSX15.0.sdk -target x86_64-apple-macos14.0 -### %s 2>&1 | FileCheck --check-prefix=CHECK_FUTURE %s +// RUN: %clang -isysroot %S/Inputs/MacOSX15.0.sdk -target x86_64-apple-macos15.0 -### %s 2>&1 | FileCheck --check-prefix=CHECK_FUTURE %s +// RUN: %clang -isysroot %S/Inputs/MacOSX15.0.sdk -target x86_64-apple-ios18.0-macabi -### %s 2>&1 | FileCheck --check-prefix=CHECK_FUTURE %s +// RUN: %clang -isysroot %S/Inputs/MacOSX15.1.sdk -target x86_64-apple-macos15.1 -darwin-target-variant x86_64-apple-ios18.1-macabi -### %s 2>&1 | FileCheck --check-prefix=CHECK_FUTURE %s +// RUN: %clang -isysroot %S/Inputs/MacOSX15.1.sdk -target x86_64-apple-ios18.1-macabi -darwin-target-variant x86_64-apple-macos15.1 -### %s 2>&1 | FileCheck --check-prefix=CHECK_FUTURE %s +// RUN: %clang -isysroot %S/Inputs/DriverKit23.0.sdk -target arm64-apple-driverkit23.0 -### %s 2>&1 | FileCheck --check-prefix=CHECK_FUTURE %s // CHECK_FUTURE-NOT: -fbuiltin-headers-in-system-modules diff --git a/clang/test/Driver/ftime-trace-sections.py b/clang/test/Driver/ftime-trace-sections.py old mode 100755 new mode 100644 index b332931d29a62..02afa4ac54eb7 --- a/clang/test/Driver/ftime-trace-sections.py +++ b/clang/test/Driver/ftime-trace-sections.py @@ -19,10 +19,7 @@ def is_before(range1, range2): log_contents = json.loads(sys.stdin.read()) events = log_contents["traceEvents"] - -instants = [event for event in events if event["name"] == "InstantiateFunction"] codegens = [event for event in events if event["name"] == "CodeGen Function"] -opts = [event for event in events if event["name"] == "OptFunction"] frontends = [event for event in events if event["name"] == "Frontend"] backends = [event for event in events if event["name"] == "Backend"] @@ -51,11 +48,3 @@ def is_before(range1, range2): ] ): sys.exit("Not all Frontend section are before all Backend sections!") - -# Check that entries for foo exist and are in a demangled form. -if not any(e for e in instants if "foo" in e["args"]["detail"]): - sys.exit("Missing Instantiate entry for foo!") -if not any(e for e in codegens if "foo" in e["args"]["detail"]): - sys.exit("Missing CodeGen entry for foo!") -if not any(e for e in opts if "foo" in e["args"]["detail"]): - sys.exit("Missing Optimize entry for foo!") diff --git a/clang/test/Driver/linker-wrapper-passes.c b/clang/test/Driver/linker-wrapper-passes.c deleted file mode 100644 index aadcf472e9b63..0000000000000 --- a/clang/test/Driver/linker-wrapper-passes.c +++ /dev/null @@ -1,72 +0,0 @@ -// Check various clang-linker-wrapper pass options after -offload-opt. - -// REQUIRES: llvm-plugins, llvm-examples -// REQUIRES: x86-registered-target -// REQUIRES: amdgpu-registered-target - -// Setup. -// RUN: mkdir -p %t -// RUN: %clang -cc1 -emit-llvm-bc -o %t/host-x86_64-unknown-linux-gnu.bc \ -// RUN: -disable-O0-optnone -triple=x86_64-unknown-linux-gnu %s -// RUN: %clang -cc1 -emit-llvm-bc -o %t/openmp-amdgcn-amd-amdhsa.bc \ -// RUN: -disable-O0-optnone -triple=amdgcn-amd-amdhsa %s -// RUN: opt %t/openmp-amdgcn-amd-amdhsa.bc -o %t/openmp-amdgcn-amd-amdhsa.bc \ -// RUN: -passes=forceattrs -force-remove-attribute=f:noinline -// RUN: clang-offload-packager -o %t/openmp-x86_64-unknown-linux-gnu.out \ -// RUN: --image=file=%t/openmp-amdgcn-amd-amdhsa.bc,triple=amdgcn-amd-amdhsa -// RUN: %clang -cc1 -S -o %t/host-x86_64-unknown-linux-gnu.s \ -// RUN: -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa \ -// RUN: -fembed-offload-object=%t/openmp-x86_64-unknown-linux-gnu.out \ -// RUN: %t/host-x86_64-unknown-linux-gnu.bc -// RUN: %clang -cc1as -o %t/host-x86_64-unknown-linux-gnu.o \ -// RUN: -triple x86_64-unknown-linux-gnu -filetype obj -target-cpu x86-64 \ -// RUN: %t/host-x86_64-unknown-linux-gnu.s - -// Check plugin, -passes, and no remarks. -// RUN: clang-linker-wrapper -o a.out --embed-bitcode \ -// RUN: --linker-path=/usr/bin/true %t/host-x86_64-unknown-linux-gnu.o \ -// RUN: %offload-opt-loadbye --offload-opt=-wave-goodbye \ -// RUN: --offload-opt=-passes="function(goodbye),module(inline)" 2>&1 | \ -// RUN: FileCheck -match-full-lines -check-prefixes=OUT %s - -// Check plugin, -p, and remarks. -// RUN: clang-linker-wrapper -o a.out --embed-bitcode \ -// RUN: --linker-path=/usr/bin/true %t/host-x86_64-unknown-linux-gnu.o \ -// RUN: %offload-opt-loadbye --offload-opt=-wave-goodbye \ -// RUN: --offload-opt=-p="function(goodbye),module(inline)" \ -// RUN: --offload-opt=-pass-remarks=inline \ -// RUN: --offload-opt=-pass-remarks-output=%t/remarks.yml \ -// RUN: --offload-opt=-pass-remarks-filter=inline \ -// RUN: --offload-opt=-pass-remarks-format=yaml 2>&1 | \ -// RUN: FileCheck -match-full-lines -check-prefixes=OUT,REM %s -// RUN: FileCheck -input-file=%t/remarks.yml -match-full-lines \ -// RUN: -check-prefixes=YML %s - -// Check handling of bad plugin. -// RUN: not clang-linker-wrapper \ -// RUN: --offload-opt=-load-pass-plugin=%t/nonexistent.so 2>&1 | \ -// RUN: FileCheck -match-full-lines -check-prefixes=BAD-PLUGIN %s - -// OUT-NOT: {{.}} -// OUT: Bye: f -// OUT-NEXT: Bye: test -// REM-NEXT: remark: {{.*}} 'f' inlined into 'test' {{.*}} -// OUT-NOT: {{.}} - -// YML-NOT: {{.}} -// YML: --- !Passed -// YML-NEXT: Pass: inline -// YML-NEXT: Name: Inlined -// YML-NEXT: Function: test -// YML-NEXT: Args: -// YML: - Callee: f -// YML: - Caller: test -// YML: ... -// YML-NOT: {{.}} - -// BAD-PLUGIN-NOT: {{.}} -// BAD-PLUGIN: {{.*}}Could not load library {{.*}}nonexistent.so{{.*}} -// BAD-PLUGIN-NOT: {{.}} - -void f() {} -void test() { f(); } diff --git a/clang/test/Driver/nvlink-wrapper.c b/clang/test/Driver/nvlink-wrapper.c index fdda93f1f9cdc..318315ddaca34 100644 --- a/clang/test/Driver/nvlink-wrapper.c +++ b/clang/test/Driver/nvlink-wrapper.c @@ -63,3 +63,10 @@ int baz() { return y + x; } // RUN: -arch sm_52 -o a.out 2>&1 | FileCheck %s --check-prefix=LTO // LTO: ptxas{{.*}} -m64 -c [[PTX:.+]].s -O3 -arch sm_52 -o [[CUBIN:.+]].cubin // LTO: nvlink{{.*}} -arch sm_52 -o a.out [[CUBIN]].cubin {{.*}}-u-{{.*}}.cubin {{.*}}-y-{{.*}}.cubin + +// +// Check that we don't forward some arguments. +// +// RUN: clang-nvlink-wrapper --dry-run %t.o %t-u.o %t-y.a \ +// RUN: -arch sm_52 --cuda-path/opt/cuda -o a.out 2>&1 | FileCheck %s --check-prefix=PATH +// PATH-NOT: --cuda-path=/opt/cuda diff --git a/clang/test/Driver/print-enabled-extensions/aarch64-apple-a12.c b/clang/test/Driver/print-enabled-extensions/aarch64-apple-a12.c index 27f066a310708..fcc8b674df33f 100644 --- a/clang/test/Driver/print-enabled-extensions/aarch64-apple-a12.c +++ b/clang/test/Driver/print-enabled-extensions/aarch64-apple-a12.c @@ -6,7 +6,6 @@ // CHECK-NEXT: Architecture Feature(s) Description // CHECK-NEXT: FEAT_AES, FEAT_PMULL Enable AES support // CHECK-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions -// CHECK-NEXT: FEAT_CCIDX Enable Armv8.3-A Extend of the CCSIDR number of sets // CHECK-NEXT: FEAT_CRC32 Enable Armv8.0-A CRC-32 checksum instructions // CHECK-NEXT: FEAT_DPB Enable Armv8.2-A data Cache Clean to Point of Persistence // CHECK-NEXT: FEAT_FCMA Enable Armv8.3-A Floating-point complex number support diff --git a/clang/test/Driver/print-enabled-extensions/aarch64-apple-a13.c b/clang/test/Driver/print-enabled-extensions/aarch64-apple-a13.c index 197b210259951..dae95b1297e14 100644 --- a/clang/test/Driver/print-enabled-extensions/aarch64-apple-a13.c +++ b/clang/test/Driver/print-enabled-extensions/aarch64-apple-a13.c @@ -7,7 +7,6 @@ // CHECK-NEXT: FEAT_AES, FEAT_PMULL Enable AES support // CHECK-NEXT: FEAT_AMUv1 Enable Armv8.4-A Activity Monitors extension // CHECK-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions -// CHECK-NEXT: FEAT_CCIDX Enable Armv8.3-A Extend of the CCSIDR number of sets // CHECK-NEXT: FEAT_CRC32 Enable Armv8.0-A CRC-32 checksum instructions // CHECK-NEXT: FEAT_DIT Enable Armv8.4-A Data Independent Timing instructions // CHECK-NEXT: FEAT_DPB Enable Armv8.2-A data Cache Clean to Point of Persistence diff --git a/clang/test/Driver/print-enabled-extensions/aarch64-apple-a14.c b/clang/test/Driver/print-enabled-extensions/aarch64-apple-a14.c index f1731ef034a0c..8ddcddede4110 100644 --- a/clang/test/Driver/print-enabled-extensions/aarch64-apple-a14.c +++ b/clang/test/Driver/print-enabled-extensions/aarch64-apple-a14.c @@ -7,7 +7,6 @@ // CHECK-NEXT: FEAT_AES, FEAT_PMULL Enable AES support // CHECK-NEXT: FEAT_AMUv1 Enable Armv8.4-A Activity Monitors extension // CHECK-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions -// CHECK-NEXT: FEAT_CCIDX Enable Armv8.3-A Extend of the CCSIDR number of sets // CHECK-NEXT: FEAT_CRC32 Enable Armv8.0-A CRC-32 checksum instructions // CHECK-NEXT: FEAT_CSV2_2 Enable architectural speculation restriction // CHECK-NEXT: FEAT_DIT Enable Armv8.4-A Data Independent Timing instructions diff --git a/clang/test/Driver/print-enabled-extensions/aarch64-apple-a15.c b/clang/test/Driver/print-enabled-extensions/aarch64-apple-a15.c index 267287eaf7b6e..302661a80db30 100644 --- a/clang/test/Driver/print-enabled-extensions/aarch64-apple-a15.c +++ b/clang/test/Driver/print-enabled-extensions/aarch64-apple-a15.c @@ -10,7 +10,6 @@ // CHECK-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions // CHECK-NEXT: FEAT_BF16 Enable BFloat16 Extension // CHECK-NEXT: FEAT_BTI Enable Branch Target Identification -// CHECK-NEXT: FEAT_CCIDX Enable Armv8.3-A Extend of the CCSIDR number of sets // CHECK-NEXT: FEAT_CRC32 Enable Armv8.0-A CRC-32 checksum instructions // CHECK-NEXT: FEAT_CSV2_2 Enable architectural speculation restriction // CHECK-NEXT: FEAT_DIT Enable Armv8.4-A Data Independent Timing instructions diff --git a/clang/test/Driver/print-enabled-extensions/aarch64-apple-a16.c b/clang/test/Driver/print-enabled-extensions/aarch64-apple-a16.c index de382a3497b81..a3f5150f87c28 100644 --- a/clang/test/Driver/print-enabled-extensions/aarch64-apple-a16.c +++ b/clang/test/Driver/print-enabled-extensions/aarch64-apple-a16.c @@ -10,7 +10,6 @@ // CHECK-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions // CHECK-NEXT: FEAT_BF16 Enable BFloat16 Extension // CHECK-NEXT: FEAT_BTI Enable Branch Target Identification -// CHECK-NEXT: FEAT_CCIDX Enable Armv8.3-A Extend of the CCSIDR number of sets // CHECK-NEXT: FEAT_CRC32 Enable Armv8.0-A CRC-32 checksum instructions // CHECK-NEXT: FEAT_CSV2_2 Enable architectural speculation restriction // CHECK-NEXT: FEAT_DIT Enable Armv8.4-A Data Independent Timing instructions diff --git a/clang/test/Driver/print-enabled-extensions/aarch64-apple-a17.c b/clang/test/Driver/print-enabled-extensions/aarch64-apple-a17.c index 641aa3f82387b..dec90ffddb6ee 100644 --- a/clang/test/Driver/print-enabled-extensions/aarch64-apple-a17.c +++ b/clang/test/Driver/print-enabled-extensions/aarch64-apple-a17.c @@ -10,7 +10,6 @@ // CHECK-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions // CHECK-NEXT: FEAT_BF16 Enable BFloat16 Extension // CHECK-NEXT: FEAT_BTI Enable Branch Target Identification -// CHECK-NEXT: FEAT_CCIDX Enable Armv8.3-A Extend of the CCSIDR number of sets // CHECK-NEXT: FEAT_CRC32 Enable Armv8.0-A CRC-32 checksum instructions // CHECK-NEXT: FEAT_CSV2_2 Enable architectural speculation restriction // CHECK-NEXT: FEAT_DIT Enable Armv8.4-A Data Independent Timing instructions diff --git a/clang/test/Driver/print-enabled-extensions/aarch64-apple-m4.c b/clang/test/Driver/print-enabled-extensions/aarch64-apple-m4.c index 5096bc6940520..0a815174033dc 100644 --- a/clang/test/Driver/print-enabled-extensions/aarch64-apple-m4.c +++ b/clang/test/Driver/print-enabled-extensions/aarch64-apple-m4.c @@ -10,7 +10,6 @@ // CHECK-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions // CHECK-NEXT: FEAT_BF16 Enable BFloat16 Extension // CHECK-NEXT: FEAT_BTI Enable Branch Target Identification -// CHECK-NEXT: FEAT_CCIDX Enable Armv8.3-A Extend of the CCSIDR number of sets // CHECK-NEXT: FEAT_CRC32 Enable Armv8.0-A CRC-32 checksum instructions // CHECK-NEXT: FEAT_CSV2_2 Enable architectural speculation restriction // CHECK-NEXT: FEAT_DIT Enable Armv8.4-A Data Independent Timing instructions @@ -51,7 +50,6 @@ // CHECK-NEXT: FEAT_SME_F64F64 Enable Scalable Matrix Extension (SME) F64F64 instructions // CHECK-NEXT: FEAT_SME_I16I64 Enable Scalable Matrix Extension (SME) I16I64 instructions // CHECK-NEXT: FEAT_SPECRES Enable Armv8.5-A execution and data prediction invalidation instructions -// CHECK-NEXT: FEAT_SSBS, FEAT_SSBS2 Enable Speculative Store Bypass Safe bit // CHECK-NEXT: FEAT_TLBIOS, FEAT_TLBIRANGE Enable Armv8.4-A TLB Range and Maintenance instructions // CHECK-NEXT: FEAT_TRF Enable Armv8.4-A Trace extension // CHECK-NEXT: FEAT_UAO Enable Armv8.2-A UAO PState diff --git a/clang/test/Driver/print-enabled-extensions/aarch64-cortex-r82.c b/clang/test/Driver/print-enabled-extensions/aarch64-cortex-r82.c index 2b85201c2c6fe..9875c6922d379 100644 --- a/clang/test/Driver/print-enabled-extensions/aarch64-cortex-r82.c +++ b/clang/test/Driver/print-enabled-extensions/aarch64-cortex-r82.c @@ -5,7 +5,6 @@ // CHECK-EMPTY: // CHECK-NEXT: Architecture Feature(s) Description // CHECK-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions -// CHECK-NEXT: FEAT_CCIDX Enable Armv8.3-A Extend of the CCSIDR number of sets // CHECK-NEXT: FEAT_CRC32 Enable Armv8.0-A CRC-32 checksum instructions // CHECK-NEXT: FEAT_CSV2_2 Enable architectural speculation restriction // CHECK-NEXT: FEAT_DIT Enable Armv8.4-A Data Independent Timing instructions diff --git a/clang/test/Driver/print-enabled-extensions/aarch64-cortex-r82ae.c b/clang/test/Driver/print-enabled-extensions/aarch64-cortex-r82ae.c index 417687b4af287..2db44d7827aad 100644 --- a/clang/test/Driver/print-enabled-extensions/aarch64-cortex-r82ae.c +++ b/clang/test/Driver/print-enabled-extensions/aarch64-cortex-r82ae.c @@ -5,7 +5,6 @@ // CHECK-EMPTY: // CHECK-NEXT: Architecture Feature(s) Description // CHECK-NEXT: FEAT_AdvSIMD Enable Advanced SIMD instructions -// CHECK-NEXT: FEAT_CCIDX Enable Armv8.3-A Extend of the CCSIDR number of sets // CHECK-NEXT: FEAT_CRC32 Enable Armv8.0-A CRC-32 checksum instructions // CHECK-NEXT: FEAT_CSV2_2 Enable architectural speculation restriction // CHECK-NEXT: FEAT_DIT Enable Armv8.4-A Data Independent Timing instructions diff --git a/clang/test/Driver/print-supported-extensions-aarch64.c b/clang/test/Driver/print-supported-extensions-aarch64.c index 6b969d50610f8..023647aafc8b7 100644 --- a/clang/test/Driver/print-supported-extensions-aarch64.c +++ b/clang/test/Driver/print-supported-extensions-aarch64.c @@ -55,6 +55,7 @@ // CHECK-NEXT: sha3 FEAT_SHA3, FEAT_SHA512 Enable SHA512 and SHA3 support // CHECK-NEXT: sm4 FEAT_SM4, FEAT_SM3 Enable SM3 and SM4 support // CHECK-NEXT: sme FEAT_SME Enable Scalable Matrix Extension (SME) +// CHECK-NEXT: sme-b16b16 FEAT_SME_B16B16 Enable SME2.1 ZA-targeting non-widening BFloat16 instructions // CHECK-NEXT: sme-f16f16 FEAT_SME_F16F16 Enable SME non-widening Float16 instructions // CHECK-NEXT: sme-f64f64 FEAT_SME_F64F64 Enable Scalable Matrix Extension (SME) F64F64 instructions // CHECK-NEXT: sme-f8f16 FEAT_SME_F8F16 Enable Scalable Matrix Extension (SME) F8F16 instructions @@ -71,6 +72,7 @@ // CHECK-NEXT: ssve-fp8dot4 FEAT_SSVE_FP8DOT4 Enable SVE2 FP8 4-way dot product instructions // CHECK-NEXT: ssve-fp8fma FEAT_SSVE_FP8FMA Enable SVE2 FP8 multiply-add instructions // CHECK-NEXT: sve FEAT_SVE Enable Scalable Vector Extension (SVE) instructions +// CHECK-NEXT: sve-b16b16 FEAT_SVE_B16B16 Enable SVE2 non-widening and SME2 Z-targeting non-widening BFloat16 instructions // CHECK-NEXT: sve2 FEAT_SVE2 Enable Scalable Vector Extension 2 (SVE2) instructions // CHECK-NEXT: sve2-aes FEAT_SVE_AES, FEAT_SVE_PMULL128 Enable AES SVE2 instructions // CHECK-NEXT: sve2-bitperm FEAT_SVE_BitPerm Enable bit permutation SVE2 instructions diff --git a/clang/test/Driver/x86-march.c b/clang/test/Driver/x86-march.c index cc993b53937c1..3bc2a82ae778d 100644 --- a/clang/test/Driver/x86-march.c +++ b/clang/test/Driver/x86-march.c @@ -242,6 +242,10 @@ // RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=znver4 2>&1 \ // RUN: | FileCheck %s -check-prefix=znver4 // znver4: "-target-cpu" "znver4" +// +// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=znver5 2>&1 \ +// RUN: | FileCheck %s -check-prefix=znver5 +// znver5: "-target-cpu" "znver5" // RUN: %clang -target x86_64 -c -### %s -march=x86-64 2>&1 | FileCheck %s --check-prefix=x86-64 // x86-64: "-target-cpu" "x86-64" diff --git a/clang/test/Format/list-ignored.cpp b/clang/test/Format/list-ignored.cpp new file mode 100644 index 0000000000000..6e65a68a6f996 --- /dev/null +++ b/clang/test/Format/list-ignored.cpp @@ -0,0 +1,60 @@ +// RUN: rm -rf %t.dir +// RUN: mkdir -p %t.dir/level1/level2 + +// RUN: cd %t.dir +// RUN: echo "*" > .clang-format-ignore +// RUN: echo "level*/*.c*" >> .clang-format-ignore +// RUN: echo "*/*2/foo.*" >> .clang-format-ignore + +// RUN: touch foo.cc +// RUN: clang-format -list-ignored .clang-format-ignore foo.cc \ +// RUN: | FileCheck %s +// CHECK: .clang-format-ignore +// CHECK-NEXT: foo.cc + +// RUN: cd level1 +// RUN: touch bar.cc baz.c +// RUN: clang-format -list-ignored bar.cc baz.c \ +// RUN: | FileCheck %s -check-prefix=CHECK2 +// CHECK2: bar.cc +// CHECK2-NEXT: baz.c + +// RUN: cd level2 +// RUN: touch foo.c foo.js +// RUN: clang-format -list-ignored foo.c foo.js \ +// RUN: | FileCheck %s -check-prefix=CHECK3 +// CHECK3: foo.c +// CHECK3-NEXT: foo.js + +// RUN: touch .clang-format-ignore +// RUN: clang-format -list-ignored foo.c foo.js \ +// RUN: | FileCheck %s -allow-empty -check-prefix=CHECK4 +// CHECK4-NOT: foo.c +// CHECK4-NOT: foo.js + +// RUN: echo "*.js" > .clang-format-ignore +// RUN: clang-format -list-ignored foo.c foo.js \ +// RUN: | FileCheck %s -check-prefix=CHECK5 +// CHECK5-NOT: foo.c +// CHECK5: foo.js + +// RUN: cd ../.. +// RUN: clang-format -list-ignored *.cc level1/*.c* level1/level2/foo.* \ +// RUN: | FileCheck %s -check-prefix=CHECK6 +// CHECK6: foo.cc +// CHECK6-NEXT: bar.cc +// CHECK6-NEXT: baz.c +// CHECK6-NOT: foo.c +// CHECK6-NEXT: foo.js + +// RUN: rm .clang-format-ignore +// RUN: clang-format -list-ignored *.cc level1/*.c* level1/level2/foo.* \ +// RUN: | FileCheck %s -check-prefix=CHECK7 +// CHECK7-NOT: foo.cc +// CHECK7-NOT: bar.cc +// CHECK7-NOT: baz.c +// CHECK7-NOT: foo.c +// CHECK7: foo.js + +// RUN: cd .. +// RUN: rm -r %t.dir diff --git a/clang/test/Frontend/x86-target-cpu.c b/clang/test/Frontend/x86-target-cpu.c index 6c8502ac2c21e..f2885a040c370 100644 --- a/clang/test/Frontend/x86-target-cpu.c +++ b/clang/test/Frontend/x86-target-cpu.c @@ -38,5 +38,6 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu znver2 -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu znver3 -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu znver4 -verify %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu znver5 -verify %s // // expected-no-diagnostics diff --git a/clang/test/Headers/stdatomic.c b/clang/test/Headers/stdatomic.c index 3643fd4245b31..9afd531a9ed9b 100644 --- a/clang/test/Headers/stdatomic.c +++ b/clang/test/Headers/stdatomic.c @@ -1,5 +1,8 @@ // RUN: %clang_cc1 -std=c11 -E %s | FileCheck %s // RUN: %clang_cc1 -std=c11 -fms-compatibility -E %s | FileCheck %s +// RUN: %clang_cc1 -std=c11 %s -verify +// RUN: %clang_cc1 -x c++ -std=c++11 %s -verify +// expected-no-diagnostics #include int bool_lock_free = ATOMIC_BOOL_LOCK_FREE; @@ -31,3 +34,5 @@ int llong_lock_free = ATOMIC_LLONG_LOCK_FREE; int pointer_lock_free = ATOMIC_POINTER_LOCK_FREE; // CHECK: pointer_lock_free = {{ *[012] *;}} + +atomic_flag f = ATOMIC_FLAG_INIT; diff --git a/clang/test/Headers/stddefneeds.cpp b/clang/test/Headers/stddefneeds.cpp index 0763bbdee13ae..0282e8afa600d 100644 --- a/clang/test/Headers/stddefneeds.cpp +++ b/clang/test/Headers/stddefneeds.cpp @@ -56,14 +56,21 @@ max_align_t m5; #undef NULL #define NULL 0 -// glibc (and other) headers then define __need_NULL and rely on stddef.h -// to redefine NULL to the correct value again. -#define __need_NULL +// Including stddef.h again shouldn't redefine NULL #include // gtk headers then use __attribute__((sentinel)), which doesn't work if NULL // is 0. -void f(const char* c, ...) __attribute__((sentinel)); +void f(const char* c, ...) __attribute__((sentinel)); // expected-note{{function has been explicitly marked sentinel here}} void g() { + f("", NULL); // expected-warning{{missing sentinel in function call}} +} + +// glibc (and other) headers then define __need_NULL and rely on stddef.h +// to redefine NULL to the correct value again. +#define __need_NULL +#include + +void h() { f("", NULL); // Shouldn't warn. } diff --git a/clang/test/Lexer/cxx-features.cpp b/clang/test/Lexer/cxx-features.cpp index 4c2aa3ae2c544..08b732132228b 100644 --- a/clang/test/Lexer/cxx-features.cpp +++ b/clang/test/Lexer/cxx-features.cpp @@ -38,6 +38,10 @@ #error "wrong value for __cpp_deleted_function" #endif +#if check(pack_indexing, 202311, 202311, 202311, 202311, 202311, 202311, 202311) +#error "wrong value for __cpp_pack_indexing" +#endif + #if check(placeholder_variables, 202306, 202306, 202306, 202306, 202306, 202306, 202306) #error "wrong value for __cpp_placeholder_variables" #endif diff --git a/clang/test/Misc/pragma-attribute-supported-attributes-list.test b/clang/test/Misc/pragma-attribute-supported-attributes-list.test index 33f9c2f51363c..e082db698ef0c 100644 --- a/clang/test/Misc/pragma-attribute-supported-attributes-list.test +++ b/clang/test/Misc/pragma-attribute-supported-attributes-list.test @@ -83,6 +83,7 @@ // CHECK-NEXT: HIPManaged (SubjectMatchRule_variable) // CHECK-NEXT: HLSLResourceClass (SubjectMatchRule_record_not_is_union) // CHECK-NEXT: Hot (SubjectMatchRule_function) +// CHECK-NEXT: HybridPatchable (SubjectMatchRule_function) // CHECK-NEXT: IBAction (SubjectMatchRule_objc_method_is_instance) // CHECK-NEXT: IFunc (SubjectMatchRule_function) // CHECK-NEXT: InitPriority (SubjectMatchRule_variable) diff --git a/clang/test/Misc/target-invalid-cpu-note.c b/clang/test/Misc/target-invalid-cpu-note.c index a5f9ffa21220a..6fd71bb82381a 100644 --- a/clang/test/Misc/target-invalid-cpu-note.c +++ b/clang/test/Misc/target-invalid-cpu-note.c @@ -13,19 +13,19 @@ // RUN: not %clang_cc1 -triple i386--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix X86 // X86: error: unknown target CPU 'not-a-cpu' -// X86-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, x86-64-v2, x86-64-v3, x86-64-v4, geode{{$}} +// X86-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, znver5, x86-64, x86-64-v2, x86-64-v3, x86-64-v4, geode{{$}} // RUN: not %clang_cc1 -triple x86_64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix X86_64 // X86_64: error: unknown target CPU 'not-a-cpu' -// X86_64-NEXT: note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, x86-64-v2, x86-64-v3, x86-64-v4{{$}} +// X86_64-NEXT: note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, znver5, x86-64, x86-64-v2, x86-64-v3, x86-64-v4{{$}} // RUN: not %clang_cc1 -triple i386--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_X86 // TUNE_X86: error: unknown target CPU 'not-a-cpu' -// TUNE_X86-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, geode{{$}} +// TUNE_X86-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, znver5, x86-64, geode{{$}} // RUN: not %clang_cc1 -triple x86_64--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_X86_64 // TUNE_X86_64: error: unknown target CPU 'not-a-cpu' -// TUNE_X86_64-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, geode{{$}} +// TUNE_X86_64-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, znver5, x86-64, geode{{$}} // RUN: not %clang_cc1 -triple nvptx--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix NVPTX // NVPTX: error: unknown target CPU 'not-a-cpu' @@ -57,7 +57,7 @@ // RUN: not %clang_cc1 -triple powerpc--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix PPC // PPC: error: unknown target CPU 'not-a-cpu' -// PPC-NEXT: note: valid target CPU values are: generic, 440, 450, 601, 602, 603, 603e, 603ev, 604, 604e, 620, 630, g3, 7400, g4, 7450, g4+, 750, 8548, 970, g5, a2, e500, e500mc, e5500, power3, pwr3, power4, pwr4, power5, pwr5, power5x, pwr5x, power6, pwr6, power6x, pwr6x, power7, pwr7, power8, pwr8, power9, pwr9, power10, pwr10, powerpc, ppc, ppc32, powerpc64, ppc64, powerpc64le, ppc64le, future{{$}} +// PPC-NEXT: note: valid target CPU values are: generic, 440, 450, 601, 602, 603, 603e, 603ev, 604, 604e, 620, 630, g3, 7400, g4, 7450, g4+, 750, 8548, 970, g5, a2, e500, e500mc, e5500, power3, pwr3, power4, pwr4, power5, pwr5, power5x, pwr5x, power6, pwr6, power6x, pwr6x, power7, pwr7, power8, pwr8, power9, pwr9, power10, pwr10, power11, pwr11, powerpc, ppc, ppc32, powerpc64, ppc64, powerpc64le, ppc64le, future{{$}} // RUN: not %clang_cc1 -triple mips--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix MIPS // MIPS: error: unknown target CPU 'not-a-cpu' diff --git a/clang/test/Modules/pr102349.cppm b/clang/test/Modules/pr102349.cppm new file mode 100644 index 0000000000000..2d166c9e93fcf --- /dev/null +++ b/clang/test/Modules/pr102349.cppm @@ -0,0 +1,52 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm +// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm \ +// RUN: -fprebuilt-module-path=%t +// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -o %t/c.pcm \ +// RUN: -fprebuilt-module-path=%t +// RUN: %clang_cc1 -std=c++20 %t/d.cpp -fsyntax-only -verify \ +// RUN: -fprebuilt-module-path=%t + +//--- a.cppm +export module a; + +export template +struct a; + +template +struct a { +}; + +export template +constexpr auto aa = a(); + +//--- b.cppm +export module b; + +import a; + +static void b() { + static_cast(a()); +} + +//--- c.cppm +export module c; + +import a; + +static void c() { + static_cast(aa); +} + +//--- d.cpp +// expected-no-diagnostics +import a; +import b; +import c; + +static void d() { + static_cast(a()); +} diff --git a/clang/test/Modules/pr102360.cppm b/clang/test/Modules/pr102360.cppm new file mode 100644 index 0000000000000..e0dab1a031801 --- /dev/null +++ b/clang/test/Modules/pr102360.cppm @@ -0,0 +1,53 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm +// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm \ +// RUN: -fprebuilt-module-path=%t +// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -o %t/c.pcm \ +// RUN: -fprebuilt-module-path=%t +// RUN: %clang_cc1 -std=c++20 %t/d.cpp -fsyntax-only -verify \ +// RUN: -fprebuilt-module-path=%t + +//--- a.cppm +export module a; + +template +constexpr auto impl = true; + +export template +void a() { +} + +export template requires impl +void a() { +} + +//--- b.cppm +export module b; + +import a; + +static void b() { + a(); +} + +//--- c.cppm +export module c; + +import a; + +static void c() { + a(); +} + +//--- d.cpp +// expected-no-diagnostics +import a; +import b; +import c; + +static void d() { + a(); +} diff --git a/clang/test/Modules/pr106483.cppm b/clang/test/Modules/pr106483.cppm new file mode 100644 index 0000000000000..a19316b9dd50c --- /dev/null +++ b/clang/test/Modules/pr106483.cppm @@ -0,0 +1,41 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: %clang_cc1 -std=c++23 %t/a.cppm -emit-module-interface -o %t/a.pcm +// RUN: %clang_cc1 -std=c++23 %t/b.cppm -emit-module-interface -o %t/b.pcm \ +// RUN: -fprebuilt-module-path=%t +// RUN: %clang_cc1 -std=c++23 -fprebuilt-module-path=%t %t/b.pcm -emit-llvm \ +// RUN: -disable-llvm-passes -o - | FileCheck %t/b.cppm + +//--- a.cppm +module; + +struct base { + virtual void f() const; +}; + +inline void base::f() const { +} + +export module a; +export using ::base; + +//--- b.cppm +module; + +struct base { + virtual void f() const; +}; + +inline void base::f() const { +} + +export module b; +import a; +export using ::base; + +export extern "C" void func() {} + +// We only need to check that the IR are successfully emitted instead of crash. +// CHECK: func diff --git a/clang/test/Modules/pr97313.cppm b/clang/test/Modules/pr97313.cppm new file mode 100644 index 0000000000000..ebbd0ee4e2c65 --- /dev/null +++ b/clang/test/Modules/pr97313.cppm @@ -0,0 +1,118 @@ +// REQUIRES: !system-windows +// +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Base.cppm \ +// RUN: -emit-module-interface -o %t/Base.pcm +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Sub.cppm \ +// RUN: -emit-module-interface -o %t/Sub.pcm -fprebuilt-module-path=%t +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Sub.pcm \ +// RUN: -emit-llvm -o %t/Sub.pcm -o - -fprebuilt-module-path=%t | \ +// RUN: FileCheck %t/Sub.cppm +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/main.cpp \ +// RUN: -emit-llvm -fprebuilt-module-path=%t -o - | FileCheck %t/main.cpp +// +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Mod.cppm \ +// RUN: -emit-module-interface -o %t/Mod.pcm +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Mod.pcm \ +// RUN: -emit-llvm -o - | FileCheck %t/Mod.cppm +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Use.cpp \ +// RUN: -emit-llvm -fprebuilt-module-path=%t -o - | \ +// RUN: FileCheck %t/Use.cpp + +//--- Base.cppm +export module Base; + +export template +class Base +{ +public: + constexpr Base(); + constexpr virtual ~Base(); +}; + +template +constexpr Base::Base() = default; + +template +constexpr Base::~Base() = default; + +//--- Sub.cppm +export module Sub; +export import Base; + +export class Sub : public Base +{ +}; + +// CHECK: @_ZTIW4Base4BaseIiE = {{.*}}linkonce_odr + +//--- main.cpp +import Sub; + +int main() +{ + Base *b = new Sub(); + delete b; +} + +// CHECK: @_ZTIW4Base4BaseIiE = {{.*}}linkonce_odr + +//--- Mod.cppm +export module Mod; + +export class NonTemplate { +public: + virtual ~NonTemplate(); +}; + +// CHECK: @_ZTIW3Mod11NonTemplate = {{.*}}constant + +export template +class Template { +public: + virtual ~Template(); +}; + +export template<> +class Template { +public: + virtual ~Template(); +}; + +// CHECK: @_ZTIW3Mod8TemplateIcE = {{.*}}constant + +export template class Template; + +// CHECK: @_ZTIW3Mod8TemplateIjE = {{.*}}weak_odr + +export extern template class Template; + +auto v = new Template(); + +// CHECK: @_ZTIW3Mod8TemplateIiE = {{.*}}linkonce_odr + +//--- Use.cpp +import Mod; + +auto v1 = new NonTemplate(); +auto v2 = new Template(); +auto v3 = new Template(); +auto v4 = new Template(); +auto v5 = new Template(); +auto v6 = new Template(); + +// CHECK: @_ZTVW3Mod11NonTemplate = {{.*}}external +// CHECK: @_ZTVW3Mod8TemplateIcE = {{.*}}external +// CHECK: @_ZTVW3Mod8TemplateIjE = {{.*}}weak_odr +// CHECK: @_ZTSW3Mod8TemplateIjE = {{.*}}weak_odr +// CHECK: @_ZTIW3Mod8TemplateIjE = {{.*}}weak_odr +// CHECK: @_ZTVW3Mod8TemplateIdE = {{.*}}external +// CHECK: @_ZTVW3Mod8TemplateIiE = {{.*}}linkonce_odr +// CHECK: @_ZTSW3Mod8TemplateIiE = {{.*}}linkonce_odr +// CHECK: @_ZTIW3Mod8TemplateIiE = {{.*}}linkonce_odr +// CHECK: @_ZTVW3Mod8TemplateIS_11NonTemplateE = {{.*}}linkonce_odr +// CHECK: @_ZTSW3Mod8TemplateIS_11NonTemplateE = {{.*}}linkonce_odr +// CHECK: @_ZTIW3Mod8TemplateIS_11NonTemplateE = {{.*}}linkonce_odr diff --git a/clang/test/Modules/static-func-in-private.cppm b/clang/test/Modules/static-func-in-private.cppm new file mode 100644 index 0000000000000..d7ce663f16d52 --- /dev/null +++ b/clang/test/Modules/static-func-in-private.cppm @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -std=c++20 %s -verify -fsyntax-only +// expected-no-diagnostics +export module a; +module :private; +static void f() {} +void g() { + f(); +} diff --git a/clang/test/Modules/stddef.cpp b/clang/test/Modules/stddef.cpp new file mode 100644 index 0000000000000..c53bfa3485194 --- /dev/null +++ b/clang/test/Modules/stddef.cpp @@ -0,0 +1,73 @@ +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/no-lsv -I%t %t/stddef.cpp -verify +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-local-submodule-visibility -fmodules-cache-path=%t/lsv -I%t %t/stddef.cpp -verify + +//--- stddef.cpp +#include + +void *pointer = NULL; +size_t size = 0; + +// When building with modules, a pcm is never re-imported, so re-including +// stddef.h will not re-import _Builtin_stddef.null to restore the definition of +// NULL, even though stddef.h will unconditionally include __stddef_null.h when +// building with modules. +#undef NULL +#include + +void *anotherPointer = NULL; // expected-error{{use of undeclared identifier 'NULL'}} + +// stddef.h needs to be a `textual` header to support clients doing things like +// this. +// +// #define __need_NULL +// #include +// +// As a textual header designed to be included multiple times, it can't directly +// declare anything, or those declarations would go into every module that +// included it. e.g. if stddef.h contained all of its declarations, and modules +// A and B included stddef.h, they would both have the declaration for size_t. +// That breaks Swift, which uses the module name as part of the type name, i.e. +// A.size_t and B.size_t are treated as completely different types in Swift and +// cannot be interchanged. To fix that, stddef.h (and stdarg.h) are split out +// into a separate file per __need macro that can be normal headers in explicit +// submodules. That runs into yet another wrinkle though. When modules build, +// declarations from previous submodules leak into subsequent ones when not +// using local submodule visibility. Consider if stddef.h did the normal thing. +// +// #ifndef __STDDEF_H +// #define __STDDEF_H +// // include all of the sub-headers +// #endif +// +// When SM builds without local submodule visibility, it will precompile a.h +// first. When it gets to b.h, the __STDDEF_H declaration from precompiling a.h +// will leak, and so when b.h includes stddef.h, it won't include any of its +// sub-headers, and SM.B will thus not import _Builtin_stddef or make any of its +// submodules visible. Precompiling b.h will be fine since it sees all of the +// declarations from a.h including stddef.h, but clients that only include b.h +// will not see any of the stddef.h types. stddef.h thus has to make sure to +// always include the necessary sub-headers, even if they've been included +// already. They all have their own header guards to allow this. +// __stddef_null.h is extra special, so this test makes sure to cover NULL plus +// one of the normal stddef.h types. + +//--- module.modulemap +module SM { + module A { + header "a.h" + export * + } + + module B { + header "b.h" + export * + } +} + +//--- a.h +#include + +//--- b.h +#include diff --git a/clang/test/Modules/vtable-windows.cppm b/clang/test/Modules/vtable-windows.cppm new file mode 100644 index 0000000000000..dbde24c8a9bdd --- /dev/null +++ b/clang/test/Modules/vtable-windows.cppm @@ -0,0 +1,26 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: split-file %s %t +// +// RUN: %clang_cc1 -std=c++20 -triple i686-pc-windows-msvc %t/foo.cppm -emit-module-interface \ +// RUN: -o %t/foo.pcm +// RUN: %clang_cc1 -std=c++20 -triple i686-pc-windows-msvc %t/user.cc -fmodule-file=foo=%t/foo.pcm \ +// RUN: -emit-llvm -o - -disable-llvm-passes | FileCheck %t/user.cc + +//--- foo.cppm +export module foo; +export struct Fruit { + virtual ~Fruit() = default; + virtual void eval(); +}; + +//--- user.cc +import foo; +void test() { + Fruit *f = new Fruit(); + f->eval(); +} + +// Check that the virtual table is an unnamed_addr constant in comdat that can +// be merged with the virtual table with other TUs. +// CHECK: unnamed_addr constant {{.*}}[ptr @"??_R4Fruit@@6B@", ptr @"??_GFruit@@UAEPAXI@Z", ptr @"?eval@Fruit@@UAEXXZ"{{.*}}comdat($"??_7Fruit@@6B@") diff --git a/clang/test/Preprocessor/aarch64-target-features.c b/clang/test/Preprocessor/aarch64-target-features.c index 87bd3e142d2c4..ae2bdda6f536c 100644 --- a/clang/test/Preprocessor/aarch64-target-features.c +++ b/clang/test/Preprocessor/aarch64-target-features.c @@ -709,3 +709,19 @@ // CHECK-SME2p1: __ARM_FEATURE_SME 1 // CHECK-SME2p1: __ARM_FEATURE_SME2 1 // CHECK-SME2p1: __ARM_FEATURE_SME2p1 1 + +// RUN: %clang --target=aarch64 -march=armv9-a+sve-b16b16 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVEB16B16 %s +// CHECK-SVEB16B16: __ARM_FEATURE_SVE_B16B16 1 + +// RUN: %clang --target=aarch64 -march=armv9-a+sme-f16f16 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SMEF16F16 %s +// CHECK-SMEF16F16: __ARM_FEATURE_LOCALLY_STREAMING 1 +// CHECK-SMEF16F16: __ARM_FEATURE_SME 1 +// CHECK-SMEF16F16: __ARM_FEATURE_SME2 1 +// CHECK-SMEF16F16: __ARM_FEATURE_SME_F16F16 1 + +// RUN: %clang --target=aarch64 -march=armv9-a+sme-b16b16 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SMEB16B16 %s +// CHECK-SMEB16B16: __ARM_FEATURE_LOCALLY_STREAMING 1 +// CHECK-SMEB16B16: __ARM_FEATURE_SME 1 +// CHECK-SMEB16B16: __ARM_FEATURE_SME2 1 +// CHECK-SMEB16B16: __ARM_FEATURE_SME_B16B16 1 +// CHECK-SMEB16B16: __ARM_FEATURE_SVE_B16B16 1 diff --git a/clang/test/Preprocessor/init-ppc64.c b/clang/test/Preprocessor/init-ppc64.c index 42e5232824de7..56164beb913d5 100644 --- a/clang/test/Preprocessor/init-ppc64.c +++ b/clang/test/Preprocessor/init-ppc64.c @@ -632,6 +632,27 @@ // PPCPOWER10:#define __PCREL__ 1 // PPCPOWER10-NOT:#define __ROP_PROTECT__ 1 // +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu pwr11 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCPOWER11 %s +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu power11 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCPOWER11 %s +// +// PPCPOWER11:#define _ARCH_PPC 1 +// PPCPOWER11:#define _ARCH_PPC64 1 +// PPCPOWER11:#define _ARCH_PPCGR 1 +// PPCPOWER11:#define _ARCH_PPCSQ 1 +// PPCPOWER11:#define _ARCH_PWR10 1 +// PPCPOWER11:#define _ARCH_PWR11 1 +// PPCPOWER11:#define _ARCH_PWR4 1 +// PPCPOWER11:#define _ARCH_PWR5 1 +// PPCPOWER11:#define _ARCH_PWR5X 1 +// PPCPOWER11:#define _ARCH_PWR6 1 +// PPCPOWER11-NOT:#define _ARCH_PWR6X 1 +// PPCPOWER11:#define _ARCH_PWR7 1 +// PPCPOWER11:#define _ARCH_PWR8 1 +// PPCPOWER11:#define _ARCH_PWR9 1 +// PPCPOWER11:#define __MMA__ 1 +// PPCPOWER11:#define __PCREL__ 1 +// PPCPOWER11-NOT:#define __ROP_PROTECT__ 1 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu future -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPCFUTURE %s // // PPCFUTURE:#define _ARCH_PPC 1 @@ -639,6 +660,7 @@ // PPCFUTURE:#define _ARCH_PPCGR 1 // PPCFUTURE:#define _ARCH_PPCSQ 1 // PPCFUTURE:#define _ARCH_PWR10 1 +// PPCFUTURE:#define _ARCH_PWR11 1 // PPCFUTURE:#define _ARCH_PWR4 1 // PPCFUTURE:#define _ARCH_PWR5 1 // PPCFUTURE:#define _ARCH_PWR5X 1 diff --git a/clang/test/Preprocessor/pragma_mc_func.c b/clang/test/Preprocessor/pragma_mc_func.c deleted file mode 100644 index f0d3e49e5dddc..0000000000000 --- a/clang/test/Preprocessor/pragma_mc_func.c +++ /dev/null @@ -1,23 +0,0 @@ -// RUN: not %clang --target=powerpc64-ibm-aix -ferr-pragma-mc-func-aix -fsyntax-only \ -// RUN: %s 2>&1 | FileCheck %s -#pragma mc_func asm_barrier {"60000000"} - -// CHECK: error: #pragma mc_func is not supported - -// Cases where no errors occur. -// RUN: %clang --target=powerpc64-ibm-aix -fno-err-pragma-mc-func-aix -fsyntax-only %s -// RUN: %clang --target=powerpc64-ibm-aix -ferr-pragma-mc-func-aix -fsyntax-only \ -// RUN: -fno-err-pragma-mc-func-aix %s -// RUN: %clang --target=powerpc64-ibm-aix -fsyntax-only %s -// RUN: %clang --target=powerpc64-ibm-aix -Werror=unknown-pragmas \ -// RUN: -fno-err-pragma-mc-func-aix -fsyntax-only %s - -// Cases where we have errors or warnings. -// RUN: not %clang --target=powerpc64le-unknown-linux-gnu \ -// RUN: -Werror=unknown-pragmas -fno-err-pragma-mc-func-aix -fsyntax-only %s 2>&1 | \ -// RUN: FileCheck --check-prefix=UNUSED %s -// RUN: %clang --target=powerpc64le-unknown-linux-gnu \ -// RUN: -fno-err-pragma-mc-func-aix -fsyntax-only %s 2>&1 | \ -// RUN: FileCheck --check-prefix=UNUSED %s - -// UNUSED: clang: warning: argument unused during compilation: '-fno-err-pragma-mc-func-aix' [-Wunused-command-line-argument] diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c index 6f470d85ca563..a90ec1f56b1a3 100644 --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -3923,6 +3923,148 @@ // CHECK_ZNVER4_M64: #define __znver4 1 // CHECK_ZNVER4_M64: #define __znver4__ 1 +// RUN: %clang -march=znver5 -m32 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_ZNVER5_M32 +// CHECK_ZNVER5_M32-NOT: #define __3dNOW_A__ 1 +// CHECK_ZNVER5_M32-NOT: #define __3dNOW__ 1 +// CHECK_ZNVER5_M32: #define __ADX__ 1 +// CHECK_ZNVER5_M32: #define __AES__ 1 +// CHECK_ZNVER5_M32: #define __AVX2__ 1 +// CHECK_ZNVER5_M32: #define __AVX512BF16__ 1 +// CHECK_ZNVER5_M32: #define __AVX512BITALG__ 1 +// CHECK_ZNVER5_M32: #define __AVX512BW__ 1 +// CHECK_ZNVER5_M32: #define __AVX512CD__ 1 +// CHECK_ZNVER5_M32: #define __AVX512DQ__ 1 +// CHECK_ZNVER5_M32: #define __AVX512F__ 1 +// CHECK_ZNVER5_M32: #define __AVX512IFMA__ 1 +// CHECK_ZNVER5_M32: #define __AVX512VBMI2__ 1 +// CHECK_ZNVER5_M32: #define __AVX512VBMI__ 1 +// CHECK_ZNVER5_M32: #define __AVX512VL__ 1 +// CHECK_ZNVER5_M32: #define __AVX512VNNI__ 1 +// CHECK_ZNVER5_M32: #define __AVX512VP2INTERSECT__ 1 +// CHECK_ZNVER5_M32: #define __AVX512VPOPCNTDQ__ 1 +// CHECK_ZNVER5_M32: #define __AVXVNNI__ 1 +// CHECK_ZNVER5_M32: #define __AVX__ 1 +// CHECK_ZNVER5_M32: #define __BMI2__ 1 +// CHECK_ZNVER5_M32: #define __BMI__ 1 +// CHECK_ZNVER5_M32: #define __CLFLUSHOPT__ 1 +// CHECK_ZNVER5_M32: #define __CLWB__ 1 +// CHECK_ZNVER5_M32: #define __CLZERO__ 1 +// CHECK_ZNVER5_M32: #define __F16C__ 1 +// CHECK_ZNVER5_M32-NOT: #define __FMA4__ 1 +// CHECK_ZNVER5_M32: #define __FMA__ 1 +// CHECK_ZNVER5_M32: #define __FSGSBASE__ 1 +// CHECK_ZNVER5_M32: #define __GFNI__ 1 +// CHECK_ZNVER5_M32: #define __LZCNT__ 1 +// CHECK_ZNVER5_M32: #define __MMX__ 1 +// CHECK_ZNVER5_M32: #define __MOVDIR64B__ 1 +// CHECK_ZNVER5_M32: #define __MOVDIRI__ 1 +// CHECK_ZNVER5_M32: #define __PCLMUL__ 1 +// CHECK_ZNVER5_M32: #define __PKU__ 1 +// CHECK_ZNVER5_M32: #define __POPCNT__ 1 +// CHECK_ZNVER5_M32: #define __PREFETCHI__ 1 +// CHECK_ZNVER5_M32: #define __PRFCHW__ 1 +// CHECK_ZNVER5_M32: #define __RDPID__ 1 +// CHECK_ZNVER5_M32: #define __RDPRU__ 1 +// CHECK_ZNVER5_M32: #define __RDRND__ 1 +// CHECK_ZNVER5_M32: #define __RDSEED__ 1 +// CHECK_ZNVER5_M32: #define __SHA__ 1 +// CHECK_ZNVER5_M32: #define __SSE2_MATH__ 1 +// CHECK_ZNVER5_M32: #define __SSE2__ 1 +// CHECK_ZNVER5_M32: #define __SSE3__ 1 +// CHECK_ZNVER5_M32: #define __SSE4A__ 1 +// CHECK_ZNVER5_M32: #define __SSE4_1__ 1 +// CHECK_ZNVER5_M32: #define __SSE4_2__ 1 +// CHECK_ZNVER5_M32: #define __SSE_MATH__ 1 +// CHECK_ZNVER5_M32: #define __SSE__ 1 +// CHECK_ZNVER5_M32: #define __SSSE3__ 1 +// CHECK_ZNVER5_M32-NOT: #define __TBM__ 1 +// CHECK_ZNVER5_M32: #define __WBNOINVD__ 1 +// CHECK_ZNVER5_M32-NOT: #define __XOP__ 1 +// CHECK_ZNVER5_M32: #define __XSAVEC__ 1 +// CHECK_ZNVER5_M32: #define __XSAVEOPT__ 1 +// CHECK_ZNVER5_M32: #define __XSAVES__ 1 +// CHECK_ZNVER5_M32: #define __XSAVE__ 1 +// CHECK_ZNVER5_M32: #define __i386 1 +// CHECK_ZNVER5_M32: #define __i386__ 1 +// CHECK_ZNVER5_M32: #define __tune_znver5__ 1 +// CHECK_ZNVER5_M32: #define __znver5 1 +// CHECK_ZNVER5_M32: #define __znver5__ 1 + +// RUN: %clang -march=znver5 -m64 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_ZNVER5_M64 +// CHECK_ZNVER5_M64-NOT: #define __3dNOW_A__ 1 +// CHECK_ZNVER5_M64-NOT: #define __3dNOW__ 1 +// CHECK_ZNVER5_M64: #define __ADX__ 1 +// CHECK_ZNVER5_M64: #define __AES__ 1 +// CHECK_ZNVER5_M64: #define __AVX2__ 1 +// CHECK_ZNVER5_M64: #define __AVX512BF16__ 1 +// CHECK_ZNVER5_M64: #define __AVX512BITALG__ 1 +// CHECK_ZNVER5_M64: #define __AVX512BW__ 1 +// CHECK_ZNVER5_M64: #define __AVX512CD__ 1 +// CHECK_ZNVER5_M64: #define __AVX512DQ__ 1 +// CHECK_ZNVER5_M64: #define __AVX512F__ 1 +// CHECK_ZNVER5_M64: #define __AVX512IFMA__ 1 +// CHECK_ZNVER5_M64: #define __AVX512VBMI2__ 1 +// CHECK_ZNVER5_M64: #define __AVX512VBMI__ 1 +// CHECK_ZNVER5_M64: #define __AVX512VL__ 1 +// CHECK_ZNVER5_M64: #define __AVX512VNNI__ 1 +// CHECK_ZNVER5_M64: #define __AVX512VP2INTERSECT__ 1 +// CHECK_ZNVER5_M64: #define __AVX512VPOPCNTDQ__ 1 +// CHECK_ZNVER5_M64: #define __AVXVNNI__ 1 +// CHECK_ZNVER5_M64: #define __AVX__ 1 +// CHECK_ZNVER5_M64: #define __BMI2__ 1 +// CHECK_ZNVER5_M64: #define __BMI__ 1 +// CHECK_ZNVER5_M64: #define __CLFLUSHOPT__ 1 +// CHECK_ZNVER5_M64: #define __CLWB__ 1 +// CHECK_ZNVER5_M64: #define __CLZERO__ 1 +// CHECK_ZNVER5_M64: #define __F16C__ 1 +// CHECK_ZNVER5_M64-NOT: #define __FMA4__ 1 +// CHECK_ZNVER5_M64: #define __FMA__ 1 +// CHECK_ZNVER5_M64: #define __FSGSBASE__ 1 +// CHECK_ZNVER5_M64: #define __GFNI__ 1 +// CHECK_ZNVER5_M64: #define __LZCNT__ 1 +// CHECK_ZNVER5_M64: #define __MMX__ 1 +// CHECK_ZNVER5_M64: #define __MOVDIR64B__ 1 +// CHECK_ZNVER5_M64: #define __MOVDIRI__ 1 +// CHECK_ZNVER5_M64: #define __PCLMUL__ 1 +// CHECK_ZNVER5_M64: #define __PKU__ 1 +// CHECK_ZNVER5_M64: #define __POPCNT__ 1 +// CHECK_ZNVER5_M64: #define __PREFETCHI__ 1 +// CHECK_ZNVER5_M64: #define __PRFCHW__ 1 +// CHECK_ZNVER5_M64: #define __RDPID__ 1 +// CHECK_ZNVER5_M64: #define __RDPRU__ 1 +// CHECK_ZNVER5_M64: #define __RDRND__ 1 +// CHECK_ZNVER5_M64: #define __RDSEED__ 1 +// CHECK_ZNVER5_M64: #define __SHA__ 1 +// CHECK_ZNVER5_M64: #define __SSE2_MATH__ 1 +// CHECK_ZNVER5_M64: #define __SSE2__ 1 +// CHECK_ZNVER5_M64: #define __SSE3__ 1 +// CHECK_ZNVER5_M64: #define __SSE4A__ 1 +// CHECK_ZNVER5_M64: #define __SSE4_1__ 1 +// CHECK_ZNVER5_M64: #define __SSE4_2__ 1 +// CHECK_ZNVER5_M64: #define __SSE_MATH__ 1 +// CHECK_ZNVER5_M64: #define __SSE__ 1 +// CHECK_ZNVER5_M64: #define __SSSE3__ 1 +// CHECK_ZNVER5_M64-NOT: #define __TBM__ 1 +// CHECK_ZNVER5_M64: #define __VAES__ 1 +// CHECK_ZNVER5_M64: #define __VPCLMULQDQ__ 1 +// CHECK_ZNVER5_M64: #define __WBNOINVD__ 1 +// CHECK_ZNVER5_M64-NOT: #define __XOP__ 1 +// CHECK_ZNVER5_M64: #define __XSAVEC__ 1 +// CHECK_ZNVER5_M64: #define __XSAVEOPT__ 1 +// CHECK_ZNVER5_M64: #define __XSAVES__ 1 +// CHECK_ZNVER5_M64: #define __XSAVE__ 1 +// CHECK_ZNVER5_M64: #define __amd64 1 +// CHECK_ZNVER5_M64: #define __amd64__ 1 +// CHECK_ZNVER5_M64: #define __tune_znver5__ 1 +// CHECK_ZNVER5_M64: #define __x86_64 1 +// CHECK_ZNVER5_M64: #define __x86_64__ 1 +// CHECK_ZNVER5_M64: #define __znver5 1 +// CHECK_ZNVER5_M64: #define __znver5__ 1 + // End X86/GCC/Linux tests ------------------ // Begin PPC/GCC/Linux tests ---------------- diff --git a/clang/test/Preprocessor/ptrauth_feature.c b/clang/test/Preprocessor/ptrauth_feature.c index 1330ad10b4b47..14059f827b94c 100644 --- a/clang/test/Preprocessor/ptrauth_feature.c +++ b/clang/test/Preprocessor/ptrauth_feature.c @@ -2,25 +2,31 @@ //// For example, -fptrauth-init-fini will not affect codegen without -fptrauth-calls, but the preprocessor feature would be set anyway. // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-intrinsics | \ -// RUN: FileCheck %s --check-prefixes=INTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOFUNC,NOINITFINI +// RUN: FileCheck %s --check-prefixes=INTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOGOTOS // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-calls | \ -// RUN: FileCheck %s --check-prefixes=NOINTRIN,CALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOFUNC,NOINITFINI +// RUN: FileCheck %s --check-prefixes=NOINTRIN,CALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOGOTOS // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-returns | \ -// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,RETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOFUNC,NOINITFINI +// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,RETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOGOTOS // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-vtable-pointer-address-discrimination | \ -// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,VPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOFUNC,NOINITFINI +// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,VPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOGOTOS // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-vtable-pointer-type-discrimination | \ -// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,VPTR_TYPE_DISCR,NOFUNC,NOINITFINI +// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,VPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOGOTOS + +// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-type-info-vtable-pointer-discrimination | \ +// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,TYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOGOTOS // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-function-pointer-type-discrimination | \ -// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,FUNC,NOINITFINI +// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,FUNC,NOINITFINI,NOGOTOS // RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-init-fini | \ -// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOFUNC,INITFINI +// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,INITFINI,NOGOTOS + +// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-indirect-gotos | \ +// RUN: FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,GOTOS #if __has_feature(ptrauth_intrinsics) // INTRIN: has_ptrauth_intrinsics @@ -71,6 +77,14 @@ void has_ptrauth_vtable_pointer_type_discrimination() {} void no_ptrauth_vtable_pointer_type_discrimination() {} #endif +#if __has_feature(ptrauth_type_info_vtable_pointer_discrimination) +// TYPE_INFO_DISCR: has_ptrauth_type_info_vtable_pointer_discrimination +void has_ptrauth_type_info_vtable_pointer_discrimination() {} +#else +// NOTYPE_INFO_DISCR: no_ptrauth_type_info_vtable_pointer_discrimination +void no_ptrauth_type_info_vtable_pointer_discrimination() {} +#endif + #if __has_feature(ptrauth_function_pointer_type_discrimination) // FUNC: has_ptrauth_function_pointer_type_discrimination void has_ptrauth_function_pointer_type_discrimination() {} @@ -86,3 +100,11 @@ void has_ptrauth_init_fini() {} // NOINITFINI: no_ptrauth_init_fini void no_ptrauth_init_fini() {} #endif + +#if __has_feature(ptrauth_indirect_gotos) +// GOTOS: has_ptrauth_indirect_gotos +void has_ptrauth_indirect_gotos() {} +#else +// NOGOTOS: no_ptrauth_indirect_gotos +void no_ptrauth_indirect_gotos() {} +#endif diff --git a/clang/test/Sema/aarch64-fmv-streaming.c b/clang/test/Sema/aarch64-fmv-streaming.c new file mode 100644 index 0000000000000..93b7656216c0c --- /dev/null +++ b/clang/test/Sema/aarch64-fmv-streaming.c @@ -0,0 +1,46 @@ +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -Waarch64-sme-attributes -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -Waarch64-sme-attributes -fsyntax-only -verify=expected-cpp -x c++ %s + +__attribute__((target_clones("sve", "simd"))) void ok_arm_streaming(void) __arm_streaming {} +__arm_locally_streaming __attribute__((target_version("sme2"))) void ok_arm_streaming(void) __arm_streaming {} +__attribute__((target_version("default"))) void ok_arm_streaming(void) __arm_streaming {} + +__attribute__((target_clones("sve", "simd"))) void ok_arm_streaming_compatible(void) __arm_streaming_compatible {} +__arm_locally_streaming __attribute__((target_version("sme2"))) void ok_arm_streaming_compatible(void) __arm_streaming_compatible {} +__attribute__((target_version("default"))) void ok_arm_streaming_compatible(void) __arm_streaming_compatible {} + +__arm_locally_streaming __attribute__((target_clones("sve", "simd"))) void ok_no_streaming(void) {} +__attribute__((target_version("sme2"))) void ok_no_streaming(void) {} +__attribute__((target_version("default"))) void ok_no_streaming(void) {} + +__attribute__((target_clones("sve", "simd"))) void bad_mixed_streaming(void) {} +// expected-cpp-error@+2 {{multiversioned function declaration has a different calling convention}} +// expected-error@+1 {{multiversioned function declaration has a different calling convention}} +__attribute__((target_version("sme2"))) void bad_mixed_streaming(void) __arm_streaming {} +// expected-cpp-error@+2 {{multiversioned function declaration has a different calling convention}} +// expected-error@+1 {{multiversioned function declaration has a different calling convention}} +__attribute__((target_version("default"))) void bad_mixed_streaming(void) __arm_streaming_compatible {} +// expected-cpp-error@+2 {{multiversioned function declaration has a different calling convention}} +// expected-error@+1 {{multiversioned function declaration has a different calling convention}} +__arm_locally_streaming __attribute__((target_version("dotprod"))) void bad_mixed_streaming(void) __arm_streaming {} + +void n_caller(void) { + ok_arm_streaming(); + ok_arm_streaming_compatible(); + ok_no_streaming(); + bad_mixed_streaming(); +} + +void s_caller(void) __arm_streaming { + ok_arm_streaming(); + ok_arm_streaming_compatible(); + ok_no_streaming(); + bad_mixed_streaming(); +} + +void sc_caller(void) __arm_streaming_compatible { + ok_arm_streaming(); + ok_arm_streaming_compatible(); + ok_no_streaming(); + bad_mixed_streaming(); +} diff --git a/clang/test/Sema/aarch64-sme-func-attrs.c b/clang/test/Sema/aarch64-sme-func-attrs.c index 6db39d6a71e36..0c263eb2610cf 100644 --- a/clang/test/Sema/aarch64-sme-func-attrs.c +++ b/clang/test/Sema/aarch64-sme-func-attrs.c @@ -455,48 +455,6 @@ void unimplemented_spill_fill_za(void (*share_zt0_only)(void) __arm_inout("zt0") share_zt0_only(); } -// expected-cpp-error@+2 {{streaming function cannot be multi-versioned}} -// expected-error@+1 {{streaming function cannot be multi-versioned}} -__attribute__((target_version("sme2"))) -void cannot_work_version(void) __arm_streaming {} -// expected-cpp-error@+5 {{function declared 'void ()' was previously declared 'void () __arm_streaming', which has different SME function attributes}} -// expected-cpp-note@-2 {{previous declaration is here}} -// expected-error@+3 {{function declared 'void (void)' was previously declared 'void (void) __arm_streaming', which has different SME function attributes}} -// expected-note@-4 {{previous declaration is here}} -__attribute__((target_version("default"))) -void cannot_work_version(void) {} - - -// expected-cpp-error@+2 {{streaming function cannot be multi-versioned}} -// expected-error@+1 {{streaming function cannot be multi-versioned}} -__attribute__((target_clones("sme2"))) -void cannot_work_clones(void) __arm_streaming {} - - -__attribute__((target("sme2"))) -void just_fine_streaming(void) __arm_streaming {} -__attribute__((target_version("sme2"))) -void just_fine(void) { just_fine_streaming(); } -__attribute__((target_version("default"))) -void just_fine(void) {} - - -__arm_locally_streaming -__attribute__((target_version("sme2"))) -void incompatible_locally_streaming(void) {} -// expected-error@-1 {{attribute 'target_version' multiversioning cannot be combined with attribute '__arm_locally_streaming'}} -// expected-cpp-error@-2 {{attribute 'target_version' multiversioning cannot be combined with attribute '__arm_locally_streaming'}} -__attribute__((target_version("default"))) -void incompatible_locally_streaming(void) {} - - -void fmv_caller() { - cannot_work_version(); - cannot_work_clones(); - just_fine(); - incompatible_locally_streaming(); -} - void sme_streaming_with_vl_arg(__SVInt8_t a) __arm_streaming { } __SVInt8_t sme_streaming_returns_vl(void) __arm_streaming { __SVInt8_t r; return r; } diff --git a/clang/test/Sema/constant-builtins-2.c b/clang/test/Sema/constant-builtins-2.c index 00767267cd6c2..37b63cf4f6b32 100644 --- a/clang/test/Sema/constant-builtins-2.c +++ b/clang/test/Sema/constant-builtins-2.c @@ -265,10 +265,8 @@ char clz52[__builtin_clzg((unsigned __int128)0x1) == BITSIZE(__int128) - 1 ? 1 : char clz53[__builtin_clzg((unsigned __int128)0x1, 42) == BITSIZE(__int128) - 1 ? 1 : -1]; char clz54[__builtin_clzg((unsigned __int128)0xf) == BITSIZE(__int128) - 4 ? 1 : -1]; char clz55[__builtin_clzg((unsigned __int128)0xf, 42) == BITSIZE(__int128) - 4 ? 1 : -1]; -char clz56[__builtin_clzg((unsigned __int128)(1 << (BITSIZE(__int128) - 1))) == 0 ? 1 : -1]; // expected-warning {{variable length array folded to constant array as an extension}} - // expected-note@-1 {{shift count 127 >= width of type 'int' (32 bits)}} -char clz57[__builtin_clzg((unsigned __int128)(1 << (BITSIZE(__int128) - 1)), 42) == 0 ? 1 : -1]; // expected-warning {{variable length array folded to constant array as an extension}} - // expected-note@-1 {{shift count 127 >= width of type 'int' (32 bits)}} +char clz56[__builtin_clzg((unsigned __int128)(1 << (BITSIZE(__int128) - 1))) == 0 ? 1 : -1]; // expected-error {{variable length array declaration not allowed at file scope}} +char clz57[__builtin_clzg((unsigned __int128)(1 << (BITSIZE(__int128) - 1)), 42) == 0 ? 1 : -1]; // expected-error {{variable length array declaration not allowed at file scope}} #endif int clz58 = __builtin_clzg((unsigned _BitInt(128))0); // expected-error {{not a compile-time constant}} char clz59[__builtin_clzg((unsigned _BitInt(128))0, 42) == 42 ? 1 : -1]; @@ -276,10 +274,8 @@ char clz60[__builtin_clzg((unsigned _BitInt(128))0x1) == BITSIZE(_BitInt(128)) - char clz61[__builtin_clzg((unsigned _BitInt(128))0x1, 42) == BITSIZE(_BitInt(128)) - 1 ? 1 : -1]; char clz62[__builtin_clzg((unsigned _BitInt(128))0xf) == BITSIZE(_BitInt(128)) - 4 ? 1 : -1]; char clz63[__builtin_clzg((unsigned _BitInt(128))0xf, 42) == BITSIZE(_BitInt(128)) - 4 ? 1 : -1]; -char clz64[__builtin_clzg((unsigned _BitInt(128))(1 << (BITSIZE(_BitInt(128)) - 1))) == 0 ? 1 : -1]; // expected-warning {{variable length array folded to constant array as an extension}} - // expected-note@-1 {{shift count 127 >= width of type 'int' (32 bits)}} -char clz65[__builtin_clzg((unsigned _BitInt(128))(1 << (BITSIZE(_BitInt(128)) - 1)), 42) == 0 ? 1 : -1]; // expected-warning {{variable length array folded to constant array as an extension}} - // expected-note@-1 {{shift count 127 >= width of type 'int' (32 bits)}} +char clz64[__builtin_clzg((unsigned _BitInt(128))(1 << (BITSIZE(_BitInt(128)) - 1))) == 0 ? 1 : -1]; // expected-error {{variable length array declaration not allowed at file scope}} +char clz65[__builtin_clzg((unsigned _BitInt(128))(1 << (BITSIZE(_BitInt(128)) - 1)), 42) == 0 ? 1 : -1]; // expected-error {{variable length array declaration not allowed at file scope}} char ctz1[__builtin_ctz(1) == 0 ? 1 : -1]; char ctz2[__builtin_ctz(8) == 3 ? 1 : -1]; diff --git a/clang/test/Sema/embed_compound_literal.c b/clang/test/Sema/embed_compound_literal.c new file mode 100644 index 0000000000000..7ba6fd8e64968 --- /dev/null +++ b/clang/test/Sema/embed_compound_literal.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -std=c23 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -x c++ -Wno-c23-extensions %s +// expected-no-diagnostics + +char *p1 = (char[]){ +#embed __FILE__ +}; + +int *p2 = (int[]){ +#embed __FILE__ +}; + +int *p3 = (int[30]){ +#embed __FILE__ limit(30) +}; diff --git a/clang/test/Sema/ptrauth-indirect-goto.c b/clang/test/Sema/ptrauth-indirect-goto.c index 47bc76738d23b..7304f5c30a117 100644 --- a/clang/test/Sema/ptrauth-indirect-goto.c +++ b/clang/test/Sema/ptrauth-indirect-goto.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple arm64e-apple-darwin -fsyntax-only -verify %s -fptrauth-indirect-gotos +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify %s -fptrauth-indirect-gotos int f() { static void *addrs[] = { &&l1, &&l2 }; diff --git a/clang/test/Sema/ptrauth-intrinsics-macro.c b/clang/test/Sema/ptrauth-intrinsics-macro.c index f76f677315dd3..adbb71a9d6e50 100644 --- a/clang/test/Sema/ptrauth-intrinsics-macro.c +++ b/clang/test/Sema/ptrauth-intrinsics-macro.c @@ -38,6 +38,11 @@ void test_string_discriminator(int *dp) { (void)t0; } +void test_type_discriminator(int *dp) { + ptrauth_extra_data_t t0 = ptrauth_type_discriminator(int (*)(int)); + (void)t0; +} + void test_sign_constant(int *dp) { dp = ptrauth_sign_constant(&dv, VALID_DATA_KEY, 0); } diff --git a/clang/test/SemaCXX/attr-lifetimebound.cpp b/clang/test/SemaCXX/attr-lifetimebound.cpp index 70bc545c07bd9..7db0a4d64d259 100644 --- a/clang/test/SemaCXX/attr-lifetimebound.cpp +++ b/clang/test/SemaCXX/attr-lifetimebound.cpp @@ -47,6 +47,31 @@ namespace usage_ok { q = A(); // expected-warning {{object backing the pointer q will be destroyed at the end of the full-expression}} r = A(1); // expected-warning {{object backing the pointer r will be destroyed at the end of the full-expression}} } + + struct FieldCheck { + struct Set { + int a; + }; + struct Pair { + const int& a; + int b; + Set c; + int * d; + }; + Pair p; + FieldCheck(const int& a): p(a){} + Pair& getR() [[clang::lifetimebound]] { return p; } + Pair* getP() [[clang::lifetimebound]] { return &p; } + Pair* getNoLB() { return &p; } + }; + void test_field_access() { + int x = 0; + const int& a = FieldCheck{x}.getR().a; + const int& b = FieldCheck{x}.getP()->b; // expected-warning {{temporary bound to local reference 'b' will be destroyed at the end of the full-expression}} + const int& c = FieldCheck{x}.getP()->c.a; // expected-warning {{temporary bound to local reference 'c' will be destroyed at the end of the full-expression}} + const int& d = FieldCheck{x}.getNoLB()->c.a; + const int* e = FieldCheck{x}.getR().d; + } } # 1 "" 1 3 @@ -239,3 +264,4 @@ namespace move_forward_et_al_examples { S X; S *AddressOfOk = std::addressof(X); } // namespace move_forward_et_al_examples + diff --git a/clang/test/SemaCXX/class.cpp b/clang/test/SemaCXX/class.cpp index f874b7be2b70e..2f59544e7f36c 100644 --- a/clang/test/SemaCXX/class.cpp +++ b/clang/test/SemaCXX/class.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -Wc++11-compat %s +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx11 -Wc++11-compat %s // RUN: %clang_cc1 -fsyntax-only -verify -Wc++11-compat %s -std=c++98 class C { public: @@ -55,6 +55,13 @@ class C { // expected-error@-2 {{static const volatile data member must be initialized out of line}} #endif static const E evi = 0; + static const int overflow = 1000000*1000000; // cxx11-error {{in-class initializer for static data member is not a constant expression}} + // expected-warning@-1 {{overflow in expression}} + static const int overflow_shift = 1<<32; // cxx11-error {{in-class initializer for static data member is not a constant expression}} + static const int overflow_shift2 = 1>>32; // cxx11-error {{in-class initializer for static data member is not a constant expression}} + static const int overflow_shift3 = 1<<-1; // cxx11-error {{in-class initializer for static data member is not a constant expression}} + static const int overflow_shift4 = 1<<-1; // cxx11-error {{in-class initializer for static data member is not a constant expression}} + static const int overflow_shift5 = -1<<1; // cxx11-error {{in-class initializer for static data member is not a constant expression}} void m() { sx = 0; diff --git a/clang/test/SemaCXX/cxx23-assume.cpp b/clang/test/SemaCXX/cxx23-assume.cpp index 9138501d726dd..eeae59daea3f7 100644 --- a/clang/test/SemaCXX/cxx23-assume.cpp +++ b/clang/test/SemaCXX/cxx23-assume.cpp @@ -158,3 +158,12 @@ foo (int x, int y) return x + y; } } + +// Do not crash when assumptions are unreachable. +namespace gh106898 { +int foo () { + while(1); + int a = 0, b = 1; + __attribute__((assume (a < b))); +} +} diff --git a/clang/test/SemaCXX/cxx2b-deducing-this.cpp b/clang/test/SemaCXX/cxx2b-deducing-this.cpp index 5cbc1f735383b..4811b6052254c 100644 --- a/clang/test/SemaCXX/cxx2b-deducing-this.cpp +++ b/clang/test/SemaCXX/cxx2b-deducing-this.cpp @@ -895,6 +895,10 @@ void g() { } namespace P2797 { + +int bar(void) { return 55; } +int (&fref)(void) = bar; + struct C { void c(this const C&); // #first void c() &; // #second @@ -915,6 +919,8 @@ struct C { (&C::c)(C{}); (&C::c)(*this); // expected-error {{call to non-static member function without an object argument}} (&C::c)(); + + (&fref)(); } }; } diff --git a/clang/test/SemaCXX/cxx2c-fold-exprs.cpp b/clang/test/SemaCXX/cxx2c-fold-exprs.cpp index 1e0bc7bcfb4e7..0674135aac483 100644 --- a/clang/test/SemaCXX/cxx2c-fold-exprs.cpp +++ b/clang/test/SemaCXX/cxx2c-fold-exprs.cpp @@ -275,3 +275,33 @@ static_assert(S::g() == 2); // expected-error {{call to 'g' is ambiguo } + +namespace GH99430 { + +template +using _Synth_three_way_result = int; + +template +class tuple; + +template +struct tuple_element; + +template +struct _Three_way_comparison_result_with_tuple_like { + using type = int; +}; + +template + requires(requires { + typename _Synth_three_way_result<_TTypes, tuple_element<_Indices>>; + } && ...) + +struct _Three_way_comparison_result_with_tuple_like, _Indices...>{ + using type = long; +}; + +static_assert(__is_same_as(_Three_way_comparison_result_with_tuple_like, 0, 1>::type, int)); +static_assert(__is_same_as(_Three_way_comparison_result_with_tuple_like, 0>::type, long)); + +} diff --git a/clang/test/SemaCXX/cxx2c-placeholder-vars.cpp b/clang/test/SemaCXX/cxx2c-placeholder-vars.cpp index 5cf66b48784e9..29ca3b5ef3df7 100644 --- a/clang/test/SemaCXX/cxx2c-placeholder-vars.cpp +++ b/clang/test/SemaCXX/cxx2c-placeholder-vars.cpp @@ -50,14 +50,16 @@ void f() { void lambda() { (void)[_ = 0, _ = 1] { // expected-warning {{placeholder variables are incompatible with C++ standards before C++2c}} \ - // expected-note 4{{placeholder declared here}} + // expected-note 2{{placeholder declared here}} (void)_++; // expected-error {{ambiguous reference to placeholder '_', which is defined multiple times}} }; { int _ = 12; - (void)[_ = 0]{}; // no warning (different scope) + (void)[_ = 0]{ return _;}; // no warning (different scope) } + + auto GH107024 = [_ = 42]() { return _; }(); } namespace global_var { diff --git a/clang/test/SemaCXX/decltype.cpp b/clang/test/SemaCXX/decltype.cpp index 96abb60836e40..a37b89939565d 100644 --- a/clang/test/SemaCXX/decltype.cpp +++ b/clang/test/SemaCXX/decltype.cpp @@ -139,6 +139,31 @@ namespace GH58674 { } } +namespace GH99873 { +struct B { + int x; +}; + +template +struct A { + template + constexpr int f() const { + return 1; + } + + template<> + constexpr int f() const { + return decltype(B::x)(); + } +}; + +// This shouldn't crash. +static_assert(A().f() == 0, ""); +// The result should not be dependent. +static_assert(A().f() != 0, ""); // expected-error {{static assertion failed due to requirement 'GH99873::A().f() != 0'}} + // expected-note@-1 {{expression evaluates to '0 != 0'}} +} + template class conditional { }; diff --git a/clang/test/SemaCXX/enum.cpp b/clang/test/SemaCXX/enum.cpp index 739d35ec4a06b..9c398cc8da886 100644 --- a/clang/test/SemaCXX/enum.cpp +++ b/clang/test/SemaCXX/enum.cpp @@ -103,14 +103,14 @@ void PR8089() { // This is accepted as a GNU extension. In C++98, there was no provision for // expressions with UB to be non-constant. enum { overflow = 123456 * 234567 }; -#if __cplusplus >= 201103L -// expected-warning@-2 {{expression is not an integral constant expression; folding it to a constant is a GNU extension}} -// expected-note@-3 {{value 28958703552 is outside the range of representable values of type 'int'}} -#else -// expected-error@-5 {{expression is not an integral constant expression}} -// expected-note@-6 {{value 28958703552 is outside the range of representable values of type 'int'}} -// expected-warning@-7 {{overflow in expression; result is -1'106'067'520 with type 'int'}} +// expected-error@-1 {{expression is not an integral constant expression}} +// expected-note@-2 {{value 28958703552 is outside the range of representable values of type 'int'}} +#if __cplusplus < 201103L +// expected-warning@-4 {{overflow in expression; result is -1'106'067'520 with type 'int'}} #endif +enum { overflow_shift = 1 << 32 }; +// expected-error@-1 {{expression is not an integral constant expression}} +// expected-note@-2 {{shift count 32 >= width of type 'int' (32 bits)}} // FIXME: This is not consistent with the above case. enum NoFold : int { overflow2 = 123456 * 234567 }; @@ -123,6 +123,16 @@ enum NoFold : int { overflow2 = 123456 * 234567 }; // expected-error@-7 {{expression is not an integral constant expression}} // expected-note@-8 {{value 28958703552 is outside the range of representable values of type 'int'}} #endif +enum : int { overflow2_shift = 1 << 32 }; +#if __cplusplus >= 201103L +// expected-error@-2 {{enumerator value is not a constant expression}} +// expected-note@-3 {{shift count 32 >= width of type 'int' (32 bits)}} +#else +// expected-error@-5 {{expression is not an integral constant expression}} +// expected-note@-6 {{shift count 32 >= width of type 'int' (32 bits)}} +// expected-warning@-7 {{enumeration types with a fixed underlying type are a C++11 extension}} +#endif + // PR28903 struct PR28903 { diff --git a/clang/test/SemaCXX/gh102293.cpp b/clang/test/SemaCXX/gh102293.cpp new file mode 100644 index 0000000000000..d4218cc13dcec --- /dev/null +++ b/clang/test/SemaCXX/gh102293.cpp @@ -0,0 +1,47 @@ +// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s + +template static void destroy() { + T t; + ++t; +} + +struct Incomplete; + +template struct HasD { + ~HasD() { destroy(); } +}; + +struct HasVT { + virtual ~HasVT(); +}; + +struct S : HasVT { + HasD<> v; +}; + +// Ensure we don't get infinite recursion from the check, however. See GH104802 +namespace GH104802 { +class foo { // expected-note {{definition of 'GH104802::foo' is not complete until the closing '}'}} + foo a; // expected-error {{field has incomplete type 'foo'}} + + virtual int c(); +}; + +class bar { // expected-note {{definition of 'GH104802::bar' is not complete until the closing '}'}} + const bar a; // expected-error {{field has incomplete type 'const bar'}} + + virtual int c(); +}; + +class baz { // expected-note {{definition of 'GH104802::baz' is not complete until the closing '}'}} + typedef class baz blech; + blech a; // expected-error {{field has incomplete type 'blech' (aka 'GH104802::baz')}} + + virtual int c(); +}; + +class quux : quux { // expected-error {{base class has incomplete type}} \ + expected-note {{definition of 'GH104802::quux' is not complete until the closing '}'}} + virtual int c(); +}; +} diff --git a/clang/test/SemaCXX/ptrauth-type-discriminator.cpp b/clang/test/SemaCXX/ptrauth-type-discriminator.cpp new file mode 100644 index 0000000000000..685ca1f03fddd --- /dev/null +++ b/clang/test/SemaCXX/ptrauth-type-discriminator.cpp @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++17 -Wno-vla -fsyntax-only -verify -fptrauth-intrinsics %s +// RUN: %clang_cc1 -triple aarch64-linux-gnu -std=c++17 -Wno-vla -fsyntax-only -verify -fptrauth-intrinsics %s + +// RUN: not %clang_cc1 -triple arm64-apple-ios -std=c++17 -Wno-vla -fsyntax-only %s 2>&1 | FileCheck %s +// CHECK: this target does not support pointer authentication + +struct S { + virtual int foo(); +}; + +template +constexpr unsigned dependentOperandDisc() { + return __builtin_ptrauth_type_discriminator(T); +} + +void test_builtin_ptrauth_type_discriminator(unsigned s) { + typedef int (S::*MemFnTy)(); + MemFnTy memFnPtr; + int (S::*memFnPtr2)(); + constexpr unsigned d0 = __builtin_ptrauth_type_discriminator(MemFnTy); + static_assert(d0 == __builtin_ptrauth_string_discriminator("_ZTSM1SFivE")); + static_assert(d0 == 60844); + static_assert(__builtin_ptrauth_type_discriminator(int (S::*)()) == d0); + static_assert(__builtin_ptrauth_type_discriminator(decltype(memFnPtr)) == d0); + static_assert(__builtin_ptrauth_type_discriminator(decltype(memFnPtr2)) == d0); + static_assert(__builtin_ptrauth_type_discriminator(decltype(&S::foo)) == d0); + static_assert(dependentOperandDisc() == d0); + + constexpr unsigned d1 = __builtin_ptrauth_type_discriminator(void (S::*)(int)); + static_assert(__builtin_ptrauth_string_discriminator("_ZTSM1SFviE") == d1); + static_assert(d1 == 39121); + + constexpr unsigned d2 = __builtin_ptrauth_type_discriminator(void (S::*)(float)); + static_assert(__builtin_ptrauth_string_discriminator("_ZTSM1SFvfE") == d2); + static_assert(d2 == 52453); + + constexpr unsigned d3 = __builtin_ptrauth_type_discriminator(int (*())[s]); + static_assert(__builtin_ptrauth_string_discriminator("FPE") == d3); + static_assert(d3 == 34128); + + int f4(float); + constexpr unsigned d4 = __builtin_ptrauth_type_discriminator(decltype(f4)); + static_assert(__builtin_ptrauth_type_discriminator(int (*)(float)) == d4); + static_assert(__builtin_ptrauth_string_discriminator("FifE") == d4); + static_assert(d4 == 48468); + + int f5(int); + constexpr unsigned d5 = __builtin_ptrauth_type_discriminator(decltype(f5)); + static_assert(__builtin_ptrauth_type_discriminator(int (*)(int)) == d5); + static_assert(__builtin_ptrauth_type_discriminator(short (*)(short)) == d5); + static_assert(__builtin_ptrauth_type_discriminator(char (*)(char)) == d5); + static_assert(__builtin_ptrauth_type_discriminator(long (*)(long)) == d5); + static_assert(__builtin_ptrauth_type_discriminator(unsigned int (*)(unsigned int)) == d5); + static_assert(__builtin_ptrauth_type_discriminator(int (&)(int)) == d5); + static_assert(__builtin_ptrauth_string_discriminator("FiiE") == d5); + static_assert(d5 == 2981); + + int t; + int vmarray[s]; + (void)__builtin_ptrauth_type_discriminator(t); // expected-error {{unknown type name 't'}} + (void)__builtin_ptrauth_type_discriminator(&t); // expected-error {{expected a type}} + (void)__builtin_ptrauth_type_discriminator(decltype(vmarray)); // expected-error {{cannot pass undiscriminated type 'decltype(vmarray)' (aka 'int[s]')}} + (void)__builtin_ptrauth_type_discriminator(int *); // expected-error {{cannot pass undiscriminated type 'int *' to '__builtin_ptrauth_type_discriminator'}} + (void)__builtin_ptrauth_type_discriminator(); // expected-error {{expected a type}} + (void)__builtin_ptrauth_type_discriminator(int (*)(int), int (*)(int)); + // expected-error@-1 {{expected ')'}} + // expected-note@-2 {{to match this '('}} +} diff --git a/clang/test/SemaCXX/source_location.cpp b/clang/test/SemaCXX/source_location.cpp index 6b3610d703e71..34177bfe287fc 100644 --- a/clang/test/SemaCXX/source_location.cpp +++ b/clang/test/SemaCXX/source_location.cpp @@ -929,3 +929,63 @@ void test() { } } + +namespace GH106428 { + +struct add_fn { + template + constexpr auto operator()(T lhs, T rhs, + const std::source_location loc = std::source_location::current()) + const -> T + { + return lhs + rhs; + } +}; + + +template +decltype(_Fp{}(0, 0)) +__invoke(_Fp&& __f); + +template +struct type_identity { using type = T; }; + +template +struct invoke_result : type_identity {}; + +using i = invoke_result::type; +static_assert(__is_same(i, int)); + +} + +#if __cplusplus >= 202002L + +namespace GH81155 { +struct buff { + buff(buff &, const char * = __builtin_FUNCTION()); +}; + +template +Ty declval(); + +template +auto Call(buff arg) -> decltype(Fx{}(arg)); + +template +struct F {}; + +template +struct InvocableR : F(declval()))> { + static constexpr bool value = false; +}; + +template ::value> +void Help(Fx) {} + +void Test() { + Help([](buff) {}); +} + +} + +#endif diff --git a/clang/test/SemaCXX/type-traits.cpp b/clang/test/SemaCXX/type-traits.cpp index 23b07cac13eaf..608852da70331 100644 --- a/clang/test/SemaCXX/type-traits.cpp +++ b/clang/test/SemaCXX/type-traits.cpp @@ -1738,6 +1738,11 @@ struct CStructWithFMA2 { int f[]; }; +template +struct UniqueEmpty {}; +template +struct D : Bases... {}; + void is_layout_compatible(int n) { static_assert(__is_layout_compatible(void, void)); @@ -1841,6 +1846,12 @@ void is_layout_compatible(int n) static_assert(!__is_layout_compatible(EnumClassLayout, int)); static_assert(!__is_layout_compatible(EnumForward, int)); static_assert(!__is_layout_compatible(EnumClassForward, int)); + static_assert(__is_layout_compatible(CStruct, D)); + static_assert(__is_layout_compatible(CStruct, D, CStruct>)); + static_assert(__is_layout_compatible(CStruct, D, D, CStruct>, D>>)); + static_assert(__is_layout_compatible(CStruct, D)); + static_assert(__is_layout_compatible(CStruct, D, CStructWithQualifiers>)); + static_assert(__is_layout_compatible(CStructWithQualifiers, D, D, CStruct>, D>>)); } namespace IPIBO { @@ -3947,6 +3958,24 @@ class Template {}; // Make sure we don't crash when instantiating a type static_assert(!__is_trivially_equality_comparable(Template>)); + +struct S operator==(S, S); + +template struct basic_string_view {}; + +struct basic_string { + operator basic_string_view() const; +}; + +template +const bool is_trivially_equality_comparable = __is_trivially_equality_comparable(T); + +template > +void find(); + +void func() { find(); } + + namespace hidden_friend { struct TriviallyEqualityComparable { diff --git a/clang/test/SemaTemplate/alias-template-with-lambdas.cpp b/clang/test/SemaTemplate/alias-template-with-lambdas.cpp index ff94031e4d86f..5ec93163e4d18 100644 --- a/clang/test/SemaTemplate/alias-template-with-lambdas.cpp +++ b/clang/test/SemaTemplate/alias-template-with-lambdas.cpp @@ -91,15 +91,84 @@ void bar() { namespace GH82104 { -template int Zero = 0; +template constexpr int Value = sizeof...(D); -template -using T14 = decltype([]() { return Zero; }()); +template +using T14 = decltype([](auto Param) { + return Value + V + (int)sizeof(Param); +}("hello")); template using T15 = T14; static_assert(__is_same(T15, int)); +// FIXME: This still crashes because we can't extract template arguments T and U +// outside of the instantiation context of T16. +#if 0 +template +using T16 = decltype([](auto Param) requires (sizeof(Param) != 1 && sizeof...(U) > 0) { + return Value + sizeof(Param); +}); +static_assert(T16()(42) == 2 + sizeof(42)); +#endif } // namespace GH82104 +namespace GH89853 { + +template +static constexpr auto innocuous = [] { return m; }; + +template > +using broken = decltype(Pred.template operator()<42>()); + +broken<> *boom; + +template { + (void)static_cast(c); + }> +using broken2 = decltype(Pred.template operator()<42>()); + +broken2<> *boom2; + +template { return m; }> +using broken3 = decltype(Pred.template operator()<42>()); + +broken3<> *boom3; + +static constexpr auto non_default = [](True auto) { + (void) static_cast(c); +}; + +template +using broken4 = decltype(Pred.template operator()<42>(Pred)); + +broken4* boom4; + +} // namespace GH89853 + +namespace GH105885 { + +template +using test = decltype([](auto...) { +}()); + +static_assert(__is_same(test<0>, void)); + +} // namespace GH105885 + +namespace GH102760 { + +auto make_tuple = []< class Tag, class... Captures>(Tag, Captures...) { + return []< class _Fun >( _Fun) -> void requires requires { 0; } + {}; +}; + +template < class, class... _As > +using Result = decltype(make_tuple(0)(_As{}...)); + +using T = Result; + +} // namespace GH102760 + } // namespace lambda_calls diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py index 2bd7501136a10..92a3361ce672e 100644 --- a/clang/test/lit.cfg.py +++ b/clang/test/lit.cfg.py @@ -110,15 +110,6 @@ if config.clang_examples: config.available_features.add("examples") -if config.llvm_examples: - config.available_features.add("llvm-examples") - -if config.llvm_linked_bye_extension: - config.substitutions.append(("%offload-opt-loadbye", "")) -else: - loadbye = f"-load-pass-plugin={config.llvm_shlib_dir}/Bye{config.llvm_shlib_ext}" - config.substitutions.append(("%offload-opt-loadbye", f"--offload-opt={loadbye}")) - def have_host_jit_feature_support(feature_name): clang_repl_exe = lit.util.which("clang-repl", config.clang_tools_dir) @@ -223,9 +214,6 @@ def have_host_clang_repl_cuda(): if config.has_plugins and config.llvm_plugin_ext: config.available_features.add("plugins") -if config.llvm_has_plugins and config.llvm_plugin_ext: - config.available_features.add("llvm-plugins") - if config.clang_default_pie_on_linux: config.available_features.add("default-pie-on-linux") diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in index 2cc70e52f1aa1..1cbd876ac5bb9 100644 --- a/clang/test/lit.site.cfg.py.in +++ b/clang/test/lit.site.cfg.py.in @@ -7,7 +7,6 @@ config.llvm_obj_root = path(r"@LLVM_BINARY_DIR@") config.llvm_tools_dir = lit_config.substitute(path(r"@LLVM_TOOLS_DIR@")) config.llvm_libs_dir = lit_config.substitute(path(r"@LLVM_LIBS_DIR@")) config.llvm_shlib_dir = lit_config.substitute(path(r"@SHLIBDIR@")) -config.llvm_shlib_ext = "@SHLIBEXT@" config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@" config.lit_tools_dir = path(r"@LLVM_LIT_TOOLS_DIR@") config.errc_messages = "@LLVM_LIT_ERRC_MESSAGES@" @@ -40,10 +39,7 @@ config.python_executable = "@Python3_EXECUTABLE@" config.use_z3_solver = lit_config.params.get('USE_Z3_SOLVER', "@USE_Z3_SOLVER@") config.has_plugins = @CLANG_PLUGIN_SUPPORT@ config.clang_vendor_uti = "@CLANG_VENDOR_UTI@" -config.llvm_examples = @LLVM_BUILD_EXAMPLES@ -config.llvm_linked_bye_extension = @LLVM_BYE_LINK_INTO_TOOLS@ config.llvm_external_lit = path(r"@LLVM_EXTERNAL_LIT@") -config.llvm_has_plugins = @LLVM_ENABLE_PLUGINS@ config.standalone_build = @CLANG_BUILT_STANDALONE@ config.ppc_linux_default_ieeelongdouble = @PPC_LINUX_DEFAULT_IEEELONGDOUBLE@ config.have_llvm_driver = @LLVM_TOOL_LLVM_DRIVER_BUILD@ diff --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp index 6cba1267f3b0d..c4b6209a71a88 100644 --- a/clang/tools/clang-format/ClangFormat.cpp +++ b/clang/tools/clang-format/ClangFormat.cpp @@ -210,6 +210,10 @@ static cl::opt FailOnIncompleteFormat( cl::desc("If set, fail with exit code 1 on incomplete format."), cl::init(false), cl::cat(ClangFormatCategory)); +static cl::opt ListIgnored("list-ignored", + cl::desc("List ignored files."), + cl::cat(ClangFormatCategory), cl::Hidden); + namespace clang { namespace format { @@ -715,7 +719,13 @@ int main(int argc, const char **argv) { unsigned FileNo = 1; bool Error = false; for (const auto &FileName : FileNames) { - if (isIgnored(FileName)) + const bool Ignored = isIgnored(FileName); + if (ListIgnored) { + if (Ignored) + outs() << FileName << '\n'; + continue; + } + if (Ignored) continue; if (Verbose) { errs() << "Formatting [" << FileNo++ << "/" << FileNames.size() << "] " diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format index d33fd478d77fd..714ba8a6e77d5 100755 --- a/clang/tools/clang-format/git-clang-format +++ b/clang/tools/clang-format/git-clang-format @@ -173,11 +173,12 @@ def main(): # those files. cd_to_toplevel() filter_symlinks(changed_lines) + filter_ignored_files(changed_lines, binary=opts.binary) if opts.verbose >= 1: ignored_files.difference_update(changed_lines) if ignored_files: - print( - 'Ignoring changes in the following files (wrong extension or symlink):') + print('Ignoring the following files (wrong extension, symlink, or ' + 'ignored by clang-format):') for filename in ignored_files: print(' %s' % filename) if changed_lines: @@ -399,6 +400,16 @@ def filter_symlinks(dictionary): del dictionary[filename] +def filter_ignored_files(dictionary, binary): + """Delete every key in `dictionary` that is ignored by clang-format.""" + ignored_files = run(binary, '-list-ignored', *dictionary.keys()) + if not ignored_files: + return + ignored_files = ignored_files.split('\n') + for filename in ignored_files: + del dictionary[filename] + + def cd_to_toplevel(): """Change to the top level of the git repository.""" toplevel = run('git', 'rev-parse', '--show-toplevel') diff --git a/clang/tools/clang-fuzzer/Dockerfile b/clang/tools/clang-fuzzer/Dockerfile deleted file mode 100644 index 1ddf82954e219..0000000000000 --- a/clang/tools/clang-fuzzer/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -#===- llvm/tools/clang/tools/clang-fuzzer ---------------------------------===// -# -# 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 -# -#===----------------------------------------------------------------------===// -# Produces an image that builds clang-proto-fuzzer -FROM ubuntu:16.04 -RUN apt-get update -y -RUN apt-get install -y autoconf automake libtool curl make g++ unzip wget git \ - binutils liblzma-dev libz-dev python-all cmake ninja-build subversion \ - pkg-config docbook2x - -WORKDIR /root - -# Get protobuf -RUN wget -qO- https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz | tar zxf - -RUN cd protobuf-3.3.0 && ./autogen.sh && ./configure && make -j $(nproc) && make check -j $(nproc) && make install && ldconfig -# Get LLVM -RUN svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm -RUN cd llvm/tools && svn co http://llvm.org/svn/llvm-project/cfe/trunk clang -r $(cd ../ && svn info | grep Revision | awk '{print $2}') -RUN cd llvm/projects && svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt -r $(cd ../ && svn info | grep Revision | awk '{print $2}') -# Build plain LLVM (stage 0) -RUN mkdir build0 && cd build0 && cmake -GNinja -DCMAKE_BUILD_TYPE=Release ../llvm && ninja -# Configure instrumented LLVM (stage 1) -RUN mkdir build1 && cd build1 && cmake -GNinja -DCMAKE_BUILD_TYPE=Release ../llvm \ - -DLLVM_ENABLE_ASSERTIONS=ON \ - -DCMAKE_C_COMPILER=`pwd`/../build0/bin/clang \ - -DCMAKE_CXX_COMPILER=`pwd`/../build0/bin/clang++ \ - -DLLVM_USE_SANITIZE_COVERAGE=YES \ - -DLLVM_USE_SANITIZER=Address -DCLANG_ENABLE_PROTO_FUZZER=ON -# Build the fuzzers -RUN cd build1 && ninja clang-fuzzer -RUN cd build1 && ninja clang-objc-fuzzer -RUN cd build1 && ninja clang-proto-fuzzer -RUN cd build1 && ninja clang-proto-to-cxx -RUN cd build1 && ninja clang-loop-proto-to-cxx -RUN cd build1 && ninja clang-loop-proto-to-llvm -RUN cd build1 && ninja clang-loop-proto-fuzzer -RUN cd build1 && ninja clang-llvm-proto-fuzzer diff --git a/clang/tools/clang-nvlink-wrapper/NVLinkOpts.td b/clang/tools/clang-nvlink-wrapper/NVLinkOpts.td index e84b530f2787d..8c80a51b12a44 100644 --- a/clang/tools/clang-nvlink-wrapper/NVLinkOpts.td +++ b/clang/tools/clang-nvlink-wrapper/NVLinkOpts.td @@ -12,9 +12,9 @@ def verbose : Flag<["-"], "v">, HelpText<"Print verbose information">; def version : Flag<["--"], "version">, HelpText<"Display the version number and exit">; -def cuda_path_EQ : Joined<["--"], "cuda-path=">, +def cuda_path_EQ : Joined<["--"], "cuda-path=">, Flags<[WrapperOnlyOption]>, MetaVarName<"">, HelpText<"Set the system CUDA path">; -def ptxas_path_EQ : Joined<["--"], "ptxas-path=">, +def ptxas_path_EQ : Joined<["--"], "ptxas-path=">, Flags<[WrapperOnlyOption]>, MetaVarName<"">, HelpText<"Set the 'ptxas' path">; def o : JoinedOrSeparate<["-"], "o">, MetaVarName<"">, diff --git a/clang/tools/libclang/libclang.map b/clang/tools/libclang/libclang.map index 91c329b5765d4..371fe512ce71c 100644 --- a/clang/tools/libclang/libclang.map +++ b/clang/tools/libclang/libclang.map @@ -54,8 +54,6 @@ LLVM_13 { clang_Cursor_Evaluate; clang_Cursor_getArgument; clang_Cursor_getBriefCommentText; - clang_Cursor_getBinaryOpcode; - clang_Cursor_getBinaryOpcodeStr; clang_Cursor_getCXXManglings; clang_Cursor_getCommentRange; clang_Cursor_getMangling; @@ -430,6 +428,12 @@ LLVM_17 { clang_getCursorUnaryOperatorKind; }; +LLVM_19 { + global: + clang_Cursor_getBinaryOpcode; + clang_Cursor_getBinaryOpcodeStr; +}; + # Example of how to add a new symbol version entry. If you do add a new symbol # version, please update the example to depend on the version you added. # LLVM_X { diff --git a/clang/tools/scan-build-py/CMakeLists.txt b/clang/tools/scan-build-py/CMakeLists.txt index 3aca22c0b0a8d..9273eb5ed977e 100644 --- a/clang/tools/scan-build-py/CMakeLists.txt +++ b/clang/tools/scan-build-py/CMakeLists.txt @@ -88,7 +88,7 @@ foreach(lib ${LibScanbuild}) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/${lib}) list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libscanbuild/${lib}) install(FILES lib/libscanbuild/${lib} - DESTINATION lib${CLANG_LIBDIR_SUFFIX}/libscanbuild + DESTINATION lib/libscanbuild COMPONENT scan-build-py) endforeach() @@ -106,7 +106,7 @@ foreach(resource ${LibScanbuildResources}) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/resources/${resource}) list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libscanbuild/resources/${resource}) install(FILES lib/libscanbuild/resources/${resource} - DESTINATION lib${CLANG_LIBDIR_SUFFIX}/libscanbuild/resources + DESTINATION lib/libscanbuild/resources COMPONENT scan-build-py) endforeach() @@ -122,7 +122,7 @@ foreach(lib ${LibEar}) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libear/${lib}) list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libear/${lib}) install(FILES lib/libear/${lib} - DESTINATION lib${CLANG_LIBDIR_SUFFIX}/libear + DESTINATION lib/libear COMPONENT scan-build-py) endforeach() diff --git a/clang/unittests/AST/CMakeLists.txt b/clang/unittests/AST/CMakeLists.txt index dcc9bc0f39ac2..29d2b39cff8b1 100644 --- a/clang/unittests/AST/CMakeLists.txt +++ b/clang/unittests/AST/CMakeLists.txt @@ -31,7 +31,6 @@ add_clang_unittest(ASTTests EvaluateAsRValueTest.cpp ExternalASTSourceTest.cpp NamedDeclPrinterTest.cpp - ProfilingTest.cpp RandstructTest.cpp RecursiveASTVisitorTest.cpp SizelessTypesTest.cpp diff --git a/clang/unittests/AST/ProfilingTest.cpp b/clang/unittests/AST/ProfilingTest.cpp deleted file mode 100644 index 27a4a197f1cbf..0000000000000 --- a/clang/unittests/AST/ProfilingTest.cpp +++ /dev/null @@ -1,75 +0,0 @@ -//===- unittests/AST/ProfilingTest.cpp --- Tests for Profiling ------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -#include "clang/AST/ASTContext.h" -#include "clang/ASTMatchers/ASTMatchFinder.h" -#include "clang/ASTMatchers/ASTMatchers.h" -#include "clang/Tooling/Tooling.h" -#include "gtest/gtest.h" -#include - -namespace clang { -namespace { -using namespace ast_matchers; - -static auto getClassTemplateRedecls() { - std::string Code = R"cpp( - template struct A; - template struct A; - template struct A; - )cpp"; - auto AST = tooling::buildASTFromCode(Code); - ASTContext &Ctx = AST->getASTContext(); - - auto MatchResults = match(classTemplateDecl().bind("id"), Ctx); - SmallVector Res; - for (BoundNodes &N : MatchResults) { - if (auto *CTD = const_cast( - N.getNodeAs("id"))) - Res.push_back(CTD); - } - assert(Res.size() == 3); -#ifndef NDEBUG - for (auto &&I : Res) - assert(I->getCanonicalDecl() == Res[0]); -#endif - return std::make_tuple(std::move(AST), Res[1], Res[2]); -} - -template static void testTypeNode(const T *T1, const T *T2) { - { - llvm::FoldingSetNodeID ID1, ID2; - T1->Profile(ID1); - T2->Profile(ID2); - ASSERT_NE(ID1, ID2); - } - auto *CT1 = cast(T1->getCanonicalTypeInternal()); - auto *CT2 = cast(T2->getCanonicalTypeInternal()); - { - llvm::FoldingSetNodeID ID1, ID2; - CT1->Profile(ID1); - CT2->Profile(ID2); - ASSERT_EQ(ID1, ID2); - } -} - -TEST(Profiling, DeducedTemplateSpecializationType_Name) { - auto [AST, CTD1, CTD2] = getClassTemplateRedecls(); - ASTContext &Ctx = AST->getASTContext(); - - auto *T1 = cast( - Ctx.getDeducedTemplateSpecializationType(TemplateName(CTD1), QualType(), - false)); - auto *T2 = cast( - Ctx.getDeducedTemplateSpecializationType(TemplateName(CTD2), QualType(), - false)); - testTypeNode(T1, T2); -} - -} // namespace -} // namespace clang diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 39fcbab3447a7..29200b72d3d00 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -3646,8 +3646,8 @@ TEST_F(FormatTest, FormatsClasses) { " : public aaaaaaaaaaaaaaaaaaa {};"); verifyFormat("template \n" - "struct Aaaaaaaaaaaaaaaaa\n" - " : Aaaaaaaaaaaaaaaaa {};"); + "struct Aaaaaaaaaaaaaaaaa\n" + " : Aaaaaaaaaaaaaaaaa {};"); verifyFormat("class ::A::B {};"); } @@ -11141,10 +11141,10 @@ TEST_F(FormatTest, UnderstandsBinaryOperators) { } TEST_F(FormatTest, UnderstandsPointersToMembers) { - verifyFormat("int A:: *x;"); - verifyFormat("int (S:: *func)(void *);"); - verifyFormat("void f() { int (S:: *func)(void *); }"); - verifyFormat("typedef bool *(Class:: *Member)() const;"); + verifyFormat("int A::*x;"); + verifyFormat("int (S::*func)(void *);"); + verifyFormat("void f() { int (S::*func)(void *); }"); + verifyFormat("typedef bool *(Class::*Member)() const;"); verifyFormat("void f() {\n" " (a->*f)();\n" " a->*x;\n" @@ -11162,16 +11162,16 @@ TEST_F(FormatTest, UnderstandsPointersToMembers) { FormatStyle Style = getLLVMStyle(); EXPECT_EQ(Style.PointerAlignment, FormatStyle::PAS_Right); - verifyFormat("typedef bool *(Class:: *Member)() const;", Style); - verifyFormat("void f(int A:: *p) { int A:: *v = &A::B; }", Style); + verifyFormat("typedef bool *(Class::*Member)() const;", Style); + verifyFormat("void f(int A::*p) { int A::*v = &A::B; }", Style); Style.PointerAlignment = FormatStyle::PAS_Left; - verifyFormat("typedef bool* (Class::* Member)() const;", Style); + verifyFormat("typedef bool* (Class::*Member)() const;", Style); verifyFormat("void f(int A::* p) { int A::* v = &A::B; }", Style); Style.PointerAlignment = FormatStyle::PAS_Middle; - verifyFormat("typedef bool * (Class:: * Member)() const;", Style); - verifyFormat("void f(int A:: * p) { int A:: * v = &A::B; }", Style); + verifyFormat("typedef bool * (Class::*Member)() const;", Style); + verifyFormat("void f(int A::* p) { int A::* v = &A::B; }", Style); } TEST_F(FormatTest, UnderstandsUnaryOperators) { @@ -12514,7 +12514,7 @@ TEST_F(FormatTest, FormatsFunctionTypes) { verifyFormat("int (*func)(void *);"); verifyFormat("void f() { int (*func)(void *); }"); verifyFormat("template \n" - "using Callback = void (CallbackClass:: *)(SomeObject *Data);"); + "using MyCallback = void (CallbackClass::*)(SomeObject *Data);"); verifyGoogleFormat("A;"); verifyGoogleFormat("void* (*a)(int);"); @@ -19186,6 +19186,24 @@ TEST_F(FormatTest, AlignConsecutiveAssignments) { "X = func(looooooooooooooooooooooooong,\n" " arrrrrrrrrrg);", Alignment); + + Alignment.ColumnLimit = 80; + Alignment.SpacesInAngles = FormatStyle::SIAS_Always; + verifyFormat("void **ptr = reinterpret_cast< void ** >(unkn);\n" + "ptr = reinterpret_cast< void ** >(ptr[0]);", + Alignment); + verifyFormat("quint32 *dstimg = reinterpret_cast< quint32 * >(out(i));\n" + "quint32 *dstmask = reinterpret_cast< quint32 * >(outmask(i));", + Alignment); + + Alignment.SpacesInParens = FormatStyle::SIPO_Custom; + Alignment.SpacesInParensOptions.InCStyleCasts = true; + verifyFormat("void **ptr = ( void ** )unkn;\n" + "ptr = ( void ** )ptr[0];", + Alignment); + verifyFormat("quint32 *dstimg = ( quint32 * )out.scanLine(i);\n" + "quint32 *dstmask = ( quint32 * )outmask.scanLine(i);", + Alignment); } TEST_F(FormatTest, AlignConsecutiveBitFields) { @@ -19437,13 +19455,13 @@ TEST_F(FormatTest, AlignConsecutiveDeclarations) { "int bbbbbbb = 0;", Alignment); // http://llvm.org/PR68079 - verifyFormat("using Fn = int (A:: *)();\n" - "using RFn = int (A:: *)() &;\n" - "using RRFn = int (A:: *)() &&;", + verifyFormat("using Fn = int (A::*)();\n" + "using RFn = int (A::*)() &;\n" + "using RRFn = int (A::*)() &&;", Alignment); - verifyFormat("using Fn = int (A:: *)();\n" - "using RFn = int *(A:: *)() &;\n" - "using RRFn = double (A:: *)() &&;", + verifyFormat("using Fn = int (A::*)();\n" + "using RFn = int *(A::*)() &;\n" + "using RRFn = double (A::*)() &&;", Alignment); // PAS_Right diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index b910ce620de7a..4b29ba720f682 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -579,6 +579,14 @@ TEST_F(FormatTestJS, GoogScopes) { "});"); } +TEST_F(FormatTestJS, GoogAnonymousClass) { + verifyFormat("a = class extends goog.structs.a {\n" + " a() {\n" + " return 0;\n" + " }\n" + "};"); +} + TEST_F(FormatTestJS, IIFEs) { // Internal calling parens; no semi. verifyFormat("(function() {\n" diff --git a/clang/unittests/Format/QualifierFixerTest.cpp b/clang/unittests/Format/QualifierFixerTest.cpp index 3a5f63e5de65b..f9255c6e4c708 100644 --- a/clang/unittests/Format/QualifierFixerTest.cpp +++ b/clang/unittests/Format/QualifierFixerTest.cpp @@ -305,7 +305,7 @@ TEST_F(QualifierFixerTest, RightQualifier) { verifyFormat("Foo inline static const;", "Foo inline const static;", Style); verifyFormat("Foo inline static const;", Style); - verifyFormat("Foo::Bar const volatile A:: *;", + verifyFormat("Foo::Bar const volatile A::*;", "volatile const Foo::Bar A::*;", Style); @@ -523,15 +523,14 @@ TEST_F(QualifierFixerTest, RightQualifier) { verifyFormat("const INTPTR a;", Style); // Pointers to members - verifyFormat("int S:: *a;", Style); - verifyFormat("int const S:: *a;", "const int S:: *a;", Style); - verifyFormat("int const S:: *const a;", "const int S::* const a;", Style); - verifyFormat("int A:: *const A:: *p1;", Style); - verifyFormat("float (C:: *p)(int);", Style); - verifyFormat("float (C:: *const p)(int);", Style); - verifyFormat("float (C:: *p)(int) const;", Style); - verifyFormat("float const (C:: *p)(int);", "const float (C::*p)(int);", - Style); + verifyFormat("int S::*a;", Style); + verifyFormat("int const S::*a;", "const int S::*a;", Style); + verifyFormat("int const S::*const a;", "const int S::* const a;", Style); + verifyFormat("int A::*const A::*p1;", Style); + verifyFormat("float (C::*p)(int);", Style); + verifyFormat("float (C::*const p)(int);", Style); + verifyFormat("float (C::*p)(int) const;", Style); + verifyFormat("float const (C::*p)(int);", "const float (C::*p)(int);", Style); } TEST_F(QualifierFixerTest, LeftQualifier) { @@ -831,15 +830,14 @@ TEST_F(QualifierFixerTest, LeftQualifier) { verifyFormat("INTPTR const a;", Style); // Pointers to members - verifyFormat("int S:: *a;", Style); - verifyFormat("const int S:: *a;", "int const S:: *a;", Style); - verifyFormat("const int S:: *const a;", "int const S::* const a;", Style); - verifyFormat("int A:: *const A:: *p1;", Style); - verifyFormat("float (C:: *p)(int);", Style); - verifyFormat("float (C:: *const p)(int);", Style); - verifyFormat("float (C:: *p)(int) const;", Style); - verifyFormat("const float (C:: *p)(int);", "float const (C::*p)(int);", - Style); + verifyFormat("int S::*a;", Style); + verifyFormat("const int S::*a;", "int const S::*a;", Style); + verifyFormat("const int S::*const a;", "int const S::*const a;", Style); + verifyFormat("int A::*const A::*p1;", Style); + verifyFormat("float (C::*p)(int);", Style); + verifyFormat("float (C::*const p)(int);", Style); + verifyFormat("float (C::*p)(int) const;", Style); + verifyFormat("const float (C::*p)(int);", "float const (C::*p)(int);", Style); } TEST_F(QualifierFixerTest, ConstVolatileQualifiersOrder) { diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp b/clang/unittests/Format/TokenAnnotatorTest.cpp index b01ca322505b1..dd58fbc70cb91 100644 --- a/clang/unittests/Format/TokenAnnotatorTest.cpp +++ b/clang/unittests/Format/TokenAnnotatorTest.cpp @@ -42,6 +42,8 @@ class TokenAnnotatorTest : public testing::Test { EXPECT_EQ((FormatTok)->getPrecedence(), Prec) << *(FormatTok) #define EXPECT_BRACE_KIND(FormatTok, Kind) \ EXPECT_EQ(FormatTok->getBlockKind(), Kind) << *(FormatTok) +#define EXPECT_SPLIT_PENALTY(FormatTok, Penalty) \ + EXPECT_EQ(FormatTok->SplitPenalty, Penalty) << *(FormatTok) #define EXPECT_TOKEN(FormatTok, Kind, Type) \ do { \ EXPECT_TOKEN_KIND(FormatTok, Kind); \ @@ -75,26 +77,6 @@ TEST_F(TokenAnnotatorTest, UnderstandsUsesOfStarAndAmp) { EXPECT_TOKEN(Tokens[10], tok::r_paren, TT_TypeDeclarationParen); EXPECT_TOKEN(Tokens[11], tok::star, TT_PointerOrReference); - Tokens = annotate("#define FOO bar(a * b)"); - ASSERT_EQ(Tokens.size(), 10u) << Tokens; - EXPECT_TOKEN(Tokens[6], tok::star, TT_BinaryOperator); - - Tokens = annotate("#define FOO foo.bar(a & b)"); - ASSERT_EQ(Tokens.size(), 12u) << Tokens; - EXPECT_TOKEN(Tokens[8], tok::amp, TT_BinaryOperator); - - Tokens = annotate("#define FOO foo::bar(a && b)"); - ASSERT_EQ(Tokens.size(), 12u) << Tokens; - EXPECT_TOKEN(Tokens[8], tok::ampamp, TT_BinaryOperator); - - Tokens = annotate("#define FOO foo bar(a *b)"); - ASSERT_EQ(Tokens.size(), 11u) << Tokens; - EXPECT_TOKEN(Tokens[7], tok::star, TT_PointerOrReference); - - Tokens = annotate("#define FOO void foo::bar(a &b)"); - ASSERT_EQ(Tokens.size(), 13u) << Tokens; - EXPECT_TOKEN(Tokens[9], tok::amp, TT_PointerOrReference); - Tokens = annotate("void f() {\n" " while (p < a && *p == 'a')\n" " p++;\n" @@ -597,12 +579,20 @@ TEST_F(TokenAnnotatorTest, UnderstandsTernaryInTemplate) { EXPECT_TOKEN(Tokens[7], tok::greater, TT_TemplateCloser); // IsExpression = true + Tokens = annotate("return foo();"); ASSERT_EQ(Tokens.size(), 13u) << Tokens; EXPECT_TOKEN(Tokens[2], tok::less, TT_TemplateOpener); EXPECT_TOKEN(Tokens[4], tok::question, TT_ConditionalExpr); EXPECT_TOKEN(Tokens[6], tok::colon, TT_ConditionalExpr); EXPECT_TOKEN(Tokens[8], tok::greater, TT_TemplateCloser); + + Tokens = annotate("return foo{};"); + ASSERT_EQ(Tokens.size(), 13u) << Tokens; + EXPECT_TOKEN(Tokens[2], tok::less, TT_TemplateOpener); + EXPECT_TOKEN(Tokens[4], tok::question, TT_ConditionalExpr); + EXPECT_TOKEN(Tokens[6], tok::colon, TT_ConditionalExpr); + EXPECT_TOKEN(Tokens[8], tok::greater, TT_TemplateCloser); } TEST_F(TokenAnnotatorTest, UnderstandsNonTemplateAngleBrackets) { @@ -616,6 +606,26 @@ TEST_F(TokenAnnotatorTest, UnderstandsNonTemplateAngleBrackets) { EXPECT_TOKEN(Tokens[1], tok::less, TT_BinaryOperator); EXPECT_TOKEN(Tokens[7], tok::greater, TT_BinaryOperator); + Tokens = annotate("return A < B ? true : A > B;"); + ASSERT_EQ(Tokens.size(), 12u) << Tokens; + EXPECT_TOKEN(Tokens[2], tok::less, TT_BinaryOperator); + EXPECT_TOKEN(Tokens[8], tok::greater, TT_BinaryOperator); + + Tokens = annotate("return A < B ? true : A > B ? false : false;"); + ASSERT_EQ(Tokens.size(), 16u) << Tokens; + EXPECT_TOKEN(Tokens[2], tok::less, TT_BinaryOperator); + EXPECT_TOKEN(Tokens[8], tok::greater, TT_BinaryOperator); + + Tokens = annotate("return checklower ? a < b : a > b;"); + ASSERT_EQ(Tokens.size(), 12u) << Tokens; + EXPECT_TOKEN(Tokens[4], tok::less, TT_BinaryOperator); + EXPECT_TOKEN(Tokens[8], tok::greater, TT_BinaryOperator); + + Tokens = annotate("return A < B ^ A > B;"); + ASSERT_EQ(Tokens.size(), 10u) << Tokens; + EXPECT_TOKEN(Tokens[2], tok::less, TT_BinaryOperator); + EXPECT_TOKEN(Tokens[6], tok::greater, TT_BinaryOperator); + Tokens = annotate("ratio{-1, 2} < ratio{-1, 3} == -1 / 3 > -1 / 2;"); ASSERT_EQ(Tokens.size(), 27u) << Tokens; EXPECT_TOKEN(Tokens[7], tok::less, TT_BinaryOperator); @@ -731,6 +741,19 @@ TEST_F(TokenAnnotatorTest, UnderstandsCasts) { EXPECT_TOKEN(Tokens[10], tok::r_paren, TT_Unknown); EXPECT_TOKEN(Tokens[11], tok::amp, TT_BinaryOperator); + Tokens = annotate("func((void (*)())&a);"); + ASSERT_EQ(Tokens.size(), 15u) << Tokens; + EXPECT_TOKEN(Tokens[4], tok::l_paren, TT_FunctionTypeLParen); + EXPECT_TOKEN(Tokens[5], tok::star, TT_PointerOrReference); + EXPECT_TOKEN(Tokens[9], tok::r_paren, TT_CastRParen); + EXPECT_TOKEN(Tokens[10], tok::amp, TT_UnaryOperator); + + Tokens = annotate("int result = ((int)a) - b;"); + ASSERT_EQ(Tokens.size(), 13u) << Tokens; + EXPECT_TOKEN(Tokens[6], tok::r_paren, TT_CastRParen); + EXPECT_TOKEN(Tokens[8], tok::r_paren, TT_Unknown); + EXPECT_TOKEN(Tokens[9], tok::minus, TT_BinaryOperator); + auto Style = getLLVMStyle(); Style.TypeNames.push_back("Foo"); Tokens = annotate("#define FOO(bar) foo((Foo)&bar)", Style); @@ -1685,19 +1708,19 @@ TEST_F(TokenAnnotatorTest, UnderstandsLambdas) { Tokens = annotate("[]() -> auto {}"); ASSERT_EQ(Tokens.size(), 9u) << Tokens; EXPECT_TOKEN(Tokens[0], tok::l_square, TT_LambdaLSquare); - EXPECT_TOKEN(Tokens[4], tok::arrow, TT_TrailingReturnArrow); + EXPECT_TOKEN(Tokens[4], tok::arrow, TT_LambdaArrow); EXPECT_TOKEN(Tokens[6], tok::l_brace, TT_LambdaLBrace); Tokens = annotate("[]() -> auto & {}"); ASSERT_EQ(Tokens.size(), 10u) << Tokens; EXPECT_TOKEN(Tokens[0], tok::l_square, TT_LambdaLSquare); - EXPECT_TOKEN(Tokens[4], tok::arrow, TT_TrailingReturnArrow); + EXPECT_TOKEN(Tokens[4], tok::arrow, TT_LambdaArrow); EXPECT_TOKEN(Tokens[7], tok::l_brace, TT_LambdaLBrace); Tokens = annotate("[]() -> auto * {}"); ASSERT_EQ(Tokens.size(), 10u) << Tokens; EXPECT_TOKEN(Tokens[0], tok::l_square, TT_LambdaLSquare); - EXPECT_TOKEN(Tokens[4], tok::arrow, TT_TrailingReturnArrow); + EXPECT_TOKEN(Tokens[4], tok::arrow, TT_LambdaArrow); EXPECT_TOKEN(Tokens[7], tok::l_brace, TT_LambdaLBrace); Tokens = annotate("[] {}"); @@ -1713,19 +1736,19 @@ TEST_F(TokenAnnotatorTest, UnderstandsLambdas) { Tokens = annotate("[] -> auto {}"); ASSERT_EQ(Tokens.size(), 7u) << Tokens; EXPECT_TOKEN(Tokens[0], tok::l_square, TT_LambdaLSquare); - EXPECT_TOKEN(Tokens[2], tok::arrow, TT_TrailingReturnArrow); + EXPECT_TOKEN(Tokens[2], tok::arrow, TT_LambdaArrow); EXPECT_TOKEN(Tokens[4], tok::l_brace, TT_LambdaLBrace); Tokens = annotate("[] -> struct S { return {}; }"); ASSERT_EQ(Tokens.size(), 12u) << Tokens; EXPECT_TOKEN(Tokens[0], tok::l_square, TT_LambdaLSquare); - EXPECT_TOKEN(Tokens[2], tok::arrow, TT_TrailingReturnArrow); + EXPECT_TOKEN(Tokens[2], tok::arrow, TT_LambdaArrow); EXPECT_TOKEN(Tokens[5], tok::l_brace, TT_LambdaLBrace); Tokens = annotate("foo([&](u32 bar) __attribute__((attr)) -> void {});"); ASSERT_EQ(Tokens.size(), 22u) << Tokens; EXPECT_TOKEN(Tokens[2], tok::l_square, TT_LambdaLSquare); - EXPECT_TOKEN(Tokens[15], tok::arrow, TT_TrailingReturnArrow); + EXPECT_TOKEN(Tokens[15], tok::arrow, TT_LambdaArrow); EXPECT_TOKEN(Tokens[17], tok::l_brace, TT_LambdaLBrace); Tokens = annotate("[] () {}"); @@ -1806,7 +1829,7 @@ TEST_F(TokenAnnotatorTest, UnderstandsLambdas) { ASSERT_EQ(Tokens.size(), 20u) << Tokens; EXPECT_TOKEN(Tokens[0], tok::l_square, TT_LambdaLSquare); EXPECT_TOKEN(Tokens[2], tok::less, TT_TemplateOpener); - EXPECT_TOKEN(Tokens[10], tok::arrow, TT_TrailingReturnArrow); + EXPECT_TOKEN(Tokens[10], tok::arrow, TT_LambdaArrow); EXPECT_TOKEN(Tokens[12], tok::kw_requires, TT_RequiresClause); EXPECT_TRUE(Tokens[16]->ClosesRequiresClause); EXPECT_TOKEN(Tokens[17], tok::l_brace, TT_LambdaLBrace); @@ -1867,7 +1890,7 @@ TEST_F(TokenAnnotatorTest, UnderstandsLambdas) { EXPECT_TOKEN(Tokens[2], tok::less, TT_TemplateOpener); EXPECT_TOKEN(Tokens[6], tok::kw_requires, TT_RequiresClause); EXPECT_TRUE(Tokens[10]->ClosesRequiresClause); - EXPECT_TOKEN(Tokens[11], tok::arrow, TT_TrailingReturnArrow); + EXPECT_TOKEN(Tokens[11], tok::arrow, TT_LambdaArrow); EXPECT_TOKEN(Tokens[13], tok::l_brace, TT_LambdaLBrace); Tokens = annotate("[] requires Foo (T t) requires Bar {}"); @@ -3168,6 +3191,53 @@ TEST_F(TokenAnnotatorTest, BraceKind) { EXPECT_BRACE_KIND(Tokens[17], BK_Block); EXPECT_BRACE_KIND(Tokens[22], BK_Block); EXPECT_BRACE_KIND(Tokens[26], BK_Block); + + Tokens = annotate("{\n" + "#define M(x) \\\n" + " return {#x};\n" + "}"); + ASSERT_EQ(Tokens.size(), 15u) << Tokens; + EXPECT_TOKEN(Tokens[0], tok::l_brace, TT_BlockLBrace); + EXPECT_BRACE_KIND(Tokens[0], BK_Block); + EXPECT_BRACE_KIND(Tokens[8], BK_BracedInit); + EXPECT_BRACE_KIND(Tokens[11], BK_BracedInit); + EXPECT_BRACE_KIND(Tokens[13], BK_Block); + + Tokens = annotate("a = class extends goog.a {};", + getGoogleStyle(FormatStyle::LK_JavaScript)); + ASSERT_EQ(Tokens.size(), 11u) << Tokens; + EXPECT_TOKEN(Tokens[7], tok::l_brace, TT_ClassLBrace); + EXPECT_BRACE_KIND(Tokens[7], BK_Block); + EXPECT_TOKEN(Tokens[8], tok::r_brace, TT_ClassRBrace); + EXPECT_BRACE_KIND(Tokens[8], BK_Block); + + Tokens = annotate("#define FOO(X) \\\n" + " struct X##_tag_ {};"); + ASSERT_EQ(Tokens.size(), 14u) << Tokens; + EXPECT_TOKEN(Tokens[10], tok::l_brace, TT_StructLBrace); + EXPECT_BRACE_KIND(Tokens[10], BK_Block); + EXPECT_TOKEN(Tokens[11], tok::r_brace, TT_StructRBrace); + EXPECT_BRACE_KIND(Tokens[11], BK_Block); + + Tokens = annotate("#define MACRO \\\n" + " struct hash { \\\n" + " void f() { return; } \\\n" + " };"); + ASSERT_EQ(Tokens.size(), 20u) << Tokens; + EXPECT_TOKEN(Tokens[8], tok::l_brace, TT_StructLBrace); + EXPECT_BRACE_KIND(Tokens[8], BK_Block); + EXPECT_TOKEN(Tokens[10], tok::identifier, TT_FunctionDeclarationName); + EXPECT_TOKEN(Tokens[11], tok::l_paren, TT_FunctionDeclarationLParen); + EXPECT_TOKEN(Tokens[13], tok::l_brace, TT_FunctionLBrace); + EXPECT_BRACE_KIND(Tokens[13], BK_Block); + EXPECT_BRACE_KIND(Tokens[16], BK_Block); + EXPECT_TOKEN(Tokens[17], tok::r_brace, TT_StructRBrace); + EXPECT_BRACE_KIND(Tokens[17], BK_Block); + + Tokens = annotate("#define MEMBER(NAME) NAME{\"\"}"); + ASSERT_EQ(Tokens.size(), 11u) << Tokens; + EXPECT_BRACE_KIND(Tokens[7], BK_BracedInit); + EXPECT_BRACE_KIND(Tokens[9], BK_BracedInit); } TEST_F(TokenAnnotatorTest, UnderstandsElaboratedTypeSpecifier) { @@ -3198,6 +3268,15 @@ TEST_F(TokenAnnotatorTest, BlockLBrace) { EXPECT_BRACE_KIND(Tokens[4], BK_Block); EXPECT_TOKEN(Tokens[5], tok::l_brace, TT_BlockLBrace); EXPECT_BRACE_KIND(Tokens[5], BK_Block); + + Tokens = annotate("[foo bar:{{0, 1}} baz:baz];", + getLLVMStyle(FormatStyle::LK_ObjC)); + ASSERT_EQ(Tokens.size(), 17u) << Tokens; + EXPECT_TOKEN(Tokens[4], tok::l_brace, TT_Unknown); // Not TT_BlockLBrace. + EXPECT_BRACE_KIND(Tokens[4], BK_Unknown); // Not BK_Block. + EXPECT_BRACE_KIND(Tokens[5], BK_BracedInit); + EXPECT_BRACE_KIND(Tokens[9], BK_Unknown); // Not BK_Block. + EXPECT_BRACE_KIND(Tokens[10], BK_Unknown); // Not BK_Block. } TEST_F(TokenAnnotatorTest, SwitchExpression) { @@ -3283,7 +3362,7 @@ TEST_F(TokenAnnotatorTest, FunctionTryBlock) { EXPECT_TOKEN(Tokens[3], tok::l_paren, TT_FunctionDeclarationLParen); EXPECT_TOKEN(Tokens[11], tok::colon, TT_CtorInitializerColon); EXPECT_TOKEN(Tokens[14], tok::l_square, TT_LambdaLSquare); - EXPECT_TOKEN(Tokens[16], tok::arrow, TT_TrailingReturnArrow); + EXPECT_TOKEN(Tokens[16], tok::arrow, TT_LambdaArrow); EXPECT_TOKEN(Tokens[20], tok::l_brace, TT_LambdaLBrace); EXPECT_TOKEN(Tokens[31], tok::comma, TT_CtorInitializerComma); EXPECT_TOKEN(Tokens[36], tok::l_brace, TT_FunctionLBrace); @@ -3301,6 +3380,20 @@ TEST_F(TokenAnnotatorTest, TypenameMacro) { EXPECT_TOKEN(Tokens[6], tok::l_brace, TT_Unknown); } +TEST_F(TokenAnnotatorTest, SplitPenalty) { + auto Style = getLLVMStyle(); + Style.ColumnLimit = 20; + + auto Tokens = annotate("class foo {\n" + " auto bar()\n" + " -> bool;\n" + "};", + Style); + ASSERT_EQ(Tokens.size(), 13u) << Tokens; + EXPECT_TOKEN(Tokens[7], tok::arrow, TT_TrailingReturnArrow); + EXPECT_SPLIT_PENALTY(Tokens[7], 23u); +} + } // namespace } // namespace format } // namespace clang diff --git a/clang/utils/analyzer/Dockerfile b/clang/utils/analyzer/Dockerfile deleted file mode 100644 index cc73ed973b811..0000000000000 --- a/clang/utils/analyzer/Dockerfile +++ /dev/null @@ -1,74 +0,0 @@ -FROM ubuntu:bionic - -RUN apt-get update && apt-get install -y \ - apt-transport-https \ - ca-certificates \ - gnupg \ - software-properties-common \ - wget - -# newer CMake is required by LLVM -RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null -RUN apt-add-repository -y 'deb https://apt.kitware.com/ubuntu/ bionic main' - -# test system dependencies -RUN apt-get update && apt-get install -y \ - git=1:2.17.1* \ - gettext=0.19.8.1* \ - python3=3.6.7-1~18.04 \ - python3-pip=9.0.1-2.3* \ - cmake=3.20.5* \ - cmake-data=3.20.5* \ - ninja-build=1.8.2-1 - -# box2d dependencies -RUN apt-get install -y \ - libx11-dev=2:1.6.4-3* \ - libxrandr-dev=2:1.5.1-1 \ - libxinerama-dev=2:1.1.3-1 \ - libxcursor-dev=1:1.1.15-1 \ - libxi-dev=2:1.7.9-1 - -# symengine dependencies -RUN apt-get install -y \ - libgmp10=2:6.1.2+dfsg-2ubuntu0.1 \ - libgmp-dev=2:6.1.2+dfsg-2ubuntu0.1 - -# simbody dependencies -RUN apt-get install -y \ - liblapack-dev=3.7.1-4* - -# drogon dependencies -RUN apt-get install -y \ - libjsonrpccpp-dev=0.7.0-1* \ - uuid-dev=2.31.1-0.4* - -# tmux dependencies -RUN apt-get install -y \ - autotools-dev=20180224.1 \ - automake=1:1.15.1-3* \ - libncurses5-dev=6.1-1* \ - libevent-dev=2.1.8* \ - pkg-config=0.29.1-0* \ - flex=2.6.4-6 \ - bison=2:3.0.4.* - -RUN apt-get install -y \ - libjpeg-dev - -RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 - -VOLUME /analyzer -VOLUME /projects -VOLUME /llvm-project -VOLUME /build -VOLUME /scripts - -ENV PATH="/analyzer/bin:${PATH}" - -ADD entrypoint.py /entrypoint.py - -ADD requirements.txt /requirements.txt -RUN pip3 install -r /requirements.txt - -ENTRYPOINT ["python", "/entrypoint.py"] diff --git a/cmake/Modules/LLVMVersion.cmake b/cmake/Modules/LLVMVersion.cmake index 5e28283fbc1c6..928c6c439bd1f 100644 --- a/cmake/Modules/LLVMVersion.cmake +++ b/cmake/Modules/LLVMVersion.cmake @@ -4,12 +4,12 @@ if(NOT DEFINED LLVM_VERSION_MAJOR) set(LLVM_VERSION_MAJOR 19) endif() if(NOT DEFINED LLVM_VERSION_MINOR) - set(LLVM_VERSION_MINOR 0) + set(LLVM_VERSION_MINOR 1) endif() if(NOT DEFINED LLVM_VERSION_PATCH) set(LLVM_VERSION_PATCH 0) endif() if(NOT DEFINED LLVM_VERSION_SUFFIX) - set(LLVM_VERSION_SUFFIX git) + set(LLVM_VERSION_SUFFIX) endif() diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 65063e0057bbc..2207555b03a03 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -604,10 +604,6 @@ if (COMPILER_RT_TEST_STANDALONE_BUILD_LIBS) if ("${COMPILER_RT_TEST_COMPILER_ID}" MATCHES "Clang") list(APPEND COMPILER_RT_UNITTEST_LINK_FLAGS "-resource-dir=${COMPILER_RT_OUTPUT_DIR}") endif() - get_compiler_rt_output_dir(${COMPILER_RT_DEFAULT_TARGET_ARCH} rtlib_dir) - if (NOT WIN32) - list(APPEND COMPILER_RT_UNITTEST_LINK_FLAGS "-Wl,-rpath,${rtlib_dir}") - endif() endif() if(COMPILER_RT_USE_LLVM_UNWINDER) @@ -801,6 +797,10 @@ if(ANDROID) append_list_if(COMPILER_RT_HAS_FUSE_LD_LLD_FLAG -fuse-ld=lld SANITIZER_COMMON_LINK_FLAGS) append_list_if(COMPILER_RT_HAS_LLD -fuse-ld=lld COMPILER_RT_UNITTEST_LINK_FLAGS) endif() +if(${COMPILER_RT_DEFAULT_TARGET_ARCH} MATCHES sparc) + # lld has several bugs/limitations on SPARC, so disable (Issue #100320). + set(COMPILER_RT_HAS_LLD FALSE) +endif() pythonize_bool(COMPILER_RT_HAS_LLD) pythonize_bool(COMPILER_RT_TEST_USE_LLD) diff --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake index 29e5beb6182ba..37ad48bef818a 100644 --- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake +++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake @@ -24,6 +24,10 @@ if(APPLE) set(X86_64 x86_64 x86_64h) endif() +if(WIN32) + set(ARM32 ${ARM32} armv7) +endif() + set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64} ${RISCV64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON} ${LOONGARCH64}) diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake index 3a151772e268a..dad557af2ae8c 100644 --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake @@ -267,6 +267,19 @@ function(get_target_link_flags_for_arch arch out_var) endif() endfunction() +# Returns a list of architecture specific dynamic ldflags in @out_var list. +function(get_dynamic_link_flags_for_arch arch out_var) + list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX) + if(ARCH_INDEX EQUAL -1) + message(FATAL_ERROR "Unsupported architecture: ${arch}") + else() + get_compiler_rt_output_dir(${arch} rtlib_dir) + if (NOT WIN32) + set(${out_var} "-Wl,-rpath,${rtlib_dir}" PARENT_SCOPE) + endif() + endif() +endfunction() + # Returns a compiler and CFLAGS that should be used to run tests for the # specific architecture. When cross-compiling, this is controled via # COMPILER_RT_TEST_COMPILER and COMPILER_RT_TEST_COMPILER_CFLAGS. diff --git a/compiler-rt/lib/asan/tests/CMakeLists.txt b/compiler-rt/lib/asan/tests/CMakeLists.txt index 7abd4c89ac6bc..b489bb99aeff3 100644 --- a/compiler-rt/lib/asan/tests/CMakeLists.txt +++ b/compiler-rt/lib/asan/tests/CMakeLists.txt @@ -206,13 +206,15 @@ function(add_asan_tests arch test_runtime) -Wl,-nodefaultlib:libcmt,-defaultlib:msvcrt,-defaultlib:oldnames ) else() + set(DYNAMIC_LINK_FLAGS) + get_dynamic_link_flags_for_arch(${arch} DYNAMIC_LINK_FLAGS) # Otherwise, reuse ASAN_INST_TEST_OBJECTS. add_compiler_rt_test(AsanDynamicUnitTests "${dynamic_test_name}" "${arch}" SUBDIR "${CONFIG_NAME_DYNAMIC}" OBJECTS ${ASAN_INST_TEST_OBJECTS} DEPS asan ${ASAN_INST_TEST_OBJECTS} - LINK_FLAGS ${ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINK_FLAGS} ${TARGET_LINK_FLAGS} + LINK_FLAGS ${ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINK_FLAGS} ${TARGET_LINK_FLAGS} ${DYNAMIC_LINK_FLAGS} ) endif() endif() diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt index 88a5998fd4610..e0b2d08c20775 100644 --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -739,7 +739,6 @@ endif() set(powerpc64le_SOURCES ${powerpc64_SOURCES}) set(riscv_SOURCES - riscv/feature_bits.c riscv/fp_mode.c riscv/save.S riscv/restore.S @@ -868,10 +867,12 @@ else () endif() endif() endif() - check_c_source_compiles("_Float16 foo(_Float16 x) { return x; }" + check_c_source_compiles("_Float16 foo(_Float16 x) { return x; } + int main(void) { return 0; }" COMPILER_RT_HAS_${arch}_FLOAT16) append_list_if(COMPILER_RT_HAS_${arch}_FLOAT16 -DCOMPILER_RT_HAS_FLOAT16 BUILTIN_CFLAGS_${arch}) - check_c_source_compiles("__bf16 foo(__bf16 x) { return x; }" + check_c_source_compiles("__bf16 foo(__bf16 x) { return x; } + int main(void) { return 0; }" COMPILER_RT_HAS_${arch}_BFLOAT16) # Build BF16 files only when "__bf16" is available. if(COMPILER_RT_HAS_${arch}_BFLOAT16) diff --git a/compiler-rt/lib/builtins/README.txt b/compiler-rt/lib/builtins/README.txt index 2d213d95f333a..19f26c92a0f94 100644 --- a/compiler-rt/lib/builtins/README.txt +++ b/compiler-rt/lib/builtins/README.txt @@ -272,6 +272,11 @@ switch32 switch8 switchu8 +// This function generates a custom trampoline function with the specific +// realFunc and localsPtr values. +void __trampoline_setup(uint32_t* trampOnStack, int trampSizeAllocated, + const void* realFunc, void* localsPtr); + // There is no C interface to the *_vfp_d8_d15_regs functions. There are // called in the prolog and epilog of Thumb1 functions. When the C++ ABI use // SJLJ for exceptions, each function with a catch clause or destructors needs diff --git a/compiler-rt/lib/builtins/aarch64/sme-abi-vg.c b/compiler-rt/lib/builtins/aarch64/sme-abi-vg.c index 062cf80fc6848..20061012e16c6 100644 --- a/compiler-rt/lib/builtins/aarch64/sme-abi-vg.c +++ b/compiler-rt/lib/builtins/aarch64/sme-abi-vg.c @@ -10,15 +10,6 @@ struct FEATURES { extern struct FEATURES __aarch64_cpu_features; -struct SME_STATE { - long PSTATE; - long TPIDR2_EL0; -}; - -extern struct SME_STATE __arm_sme_state(void) __arm_streaming_compatible; - -extern bool __aarch64_has_sme_and_tpidr2_el0; - #if __GNUC__ >= 9 #pragma GCC diagnostic ignored "-Wprio-ctor-dtor" #endif @@ -28,22 +19,3 @@ __attribute__((constructor(90))) static void get_aarch64_cpu_features(void) { __init_cpu_features(); } - -__attribute__((target("sve"))) long -__arm_get_current_vg(void) __arm_streaming_compatible { - struct SME_STATE State = __arm_sme_state(); - unsigned long long features = - __atomic_load_n(&__aarch64_cpu_features.features, __ATOMIC_RELAXED); - bool HasSVE = features & (1ULL << FEAT_SVE); - - if (!HasSVE && !__aarch64_has_sme_and_tpidr2_el0) - return 0; - - if (HasSVE || (State.PSTATE & 1)) { - long vl; - __asm__ __volatile__("cntd %0" : "=r"(vl)); - return vl; - } - - return 0; -} diff --git a/compiler-rt/lib/builtins/aarch64/sme-abi.S b/compiler-rt/lib/builtins/aarch64/sme-abi.S index 4c0ff66931db7..cd8153f60670f 100644 --- a/compiler-rt/lib/builtins/aarch64/sme-abi.S +++ b/compiler-rt/lib/builtins/aarch64/sme-abi.S @@ -12,11 +12,15 @@ #if !defined(__APPLE__) #define TPIDR2_SYMBOL SYMBOL_NAME(__aarch64_has_sme_and_tpidr2_el0) #define TPIDR2_SYMBOL_OFFSET :lo12:SYMBOL_NAME(__aarch64_has_sme_and_tpidr2_el0) +#define CPU_FEATS_SYMBOL SYMBOL_NAME(__aarch64_cpu_features) +#define CPU_FEATS_SYMBOL_OFFSET :lo12:SYMBOL_NAME(__aarch64_cpu_features) #else // MachO requires @page/@pageoff directives because the global is defined // in a different file. Otherwise this file may fail to build. #define TPIDR2_SYMBOL SYMBOL_NAME(__aarch64_has_sme_and_tpidr2_el0)@page #define TPIDR2_SYMBOL_OFFSET SYMBOL_NAME(__aarch64_has_sme_and_tpidr2_el0)@pageoff +#define CPU_FEATS_SYMBOL SYMBOL_NAME(__aarch64_cpu_features)@page +#define CPU_FEATS_SYMBOL_OFFSET SYMBOL_NAME(__aarch64_cpu_features)@pageoff #endif .arch armv9-a+sme @@ -180,6 +184,46 @@ DEFINE_COMPILERRT_OUTLINE_FUNCTION_UNMANGLED(__arm_za_disable) ret END_COMPILERRT_OUTLINE_FUNCTION(__arm_za_disable) +DEFINE_COMPILERRT_OUTLINE_FUNCTION_UNMANGLED(__arm_get_current_vg) + .variant_pcs __arm_get_current_vg + BTI_C + + stp x29, x30, [sp, #-16]! + .cfi_def_cfa_offset 16 + mov x29, sp + .cfi_def_cfa w29, 16 + .cfi_offset w30, -8 + .cfi_offset w29, -16 + adrp x17, CPU_FEATS_SYMBOL + ldr w17, [x17, CPU_FEATS_SYMBOL_OFFSET] + tbnz w17, #30, 0f + adrp x16, TPIDR2_SYMBOL + ldrb w16, [x16, TPIDR2_SYMBOL_OFFSET] + cbz w16, 1f +0: + mov x18, x1 + bl __arm_sme_state + mov x1, x18 + and x17, x17, #0x40000000 + bfxil x17, x0, #0, #1 + cbz x17, 1f + cntd x0 + .cfi_def_cfa wsp, 16 + ldp x29, x30, [sp], #16 + .cfi_def_cfa_offset 0 + .cfi_restore w30 + .cfi_restore w29 + ret +1: + mov x0, xzr + .cfi_def_cfa wsp, 16 + ldp x29, x30, [sp], #16 + .cfi_def_cfa_offset 0 + .cfi_restore w30 + .cfi_restore w29 + ret +END_COMPILERRT_OUTLINE_FUNCTION(__arm_get_current_vg) + NO_EXEC_STACK_DIRECTIVE // GNU property note for BTI and PAC diff --git a/compiler-rt/lib/builtins/aarch64/sme-libc-mem-routines.S b/compiler-rt/lib/builtins/aarch64/sme-libc-mem-routines.S index 926ad3b1b6331..0318d9a6f1ebd 100644 --- a/compiler-rt/lib/builtins/aarch64/sme-libc-mem-routines.S +++ b/compiler-rt/lib/builtins/aarch64/sme-libc-mem-routines.S @@ -252,7 +252,15 @@ DEFINE_COMPILERRT_FUNCTION_ALIAS(__arm_sc_memmove, __arm_sc_memcpy) #define zva_val x5 DEFINE_COMPILERRT_OUTLINE_FUNCTION_UNMANGLED(__arm_sc_memset) - dup v0.16B, valw +#ifdef __ARM_FEATURE_SVE + mov z0.b, valw +#else + bfi valw, valw, #8, #8 + bfi valw, valw, #16, #16 + bfi val, val, #32, #32 + fmov d0, val + fmov v0.d[1], val +#endif add dstend2, dstin, count cmp count, 96 diff --git a/compiler-rt/lib/builtins/cpu_model/x86.c b/compiler-rt/lib/builtins/cpu_model/x86.c index 867ed97e57bf2..b1c4abd9d11df 100644 --- a/compiler-rt/lib/builtins/cpu_model/x86.c +++ b/compiler-rt/lib/builtins/cpu_model/x86.c @@ -59,6 +59,7 @@ enum ProcessorTypes { INTEL_SIERRAFOREST, INTEL_GRANDRIDGE, INTEL_CLEARWATERFOREST, + AMDFAM1AH, CPU_TYPE_MAX }; @@ -97,6 +98,7 @@ enum ProcessorSubtypes { INTEL_COREI7_ARROWLAKE, INTEL_COREI7_ARROWLAKE_S, INTEL_COREI7_PANTHERLAKE, + AMDFAM1AH_ZNVER5, CPU_SUBTYPE_MAX }; @@ -803,6 +805,24 @@ static const char *getAMDProcessorTypeAndSubtype(unsigned Family, break; // "znver4" } break; // family 19h + case 26: + CPU = "znver5"; + *Type = AMDFAM1AH; + if (Model <= 0x77) { + // Models 00h-0Fh (Breithorn). + // Models 10h-1Fh (Breithorn-Dense). + // Models 20h-2Fh (Strix 1). + // Models 30h-37h (Strix 2). + // Models 38h-3Fh (Strix 3). + // Models 40h-4Fh (Granite Ridge). + // Models 50h-5Fh (Weisshorn). + // Models 60h-6Fh (Krackan1). + // Models 70h-77h (Sarlak). + CPU = "znver5"; + *Subtype = AMDFAM1AH_ZNVER5; + break; // "znver5" + } + break; default: break; // Unknown AMD CPU. } diff --git a/compiler-rt/lib/builtins/divtc3.c b/compiler-rt/lib/builtins/divtc3.c index 099de5802daf0..c393de815337e 100644 --- a/compiler-rt/lib/builtins/divtc3.c +++ b/compiler-rt/lib/builtins/divtc3.c @@ -13,7 +13,7 @@ #define QUAD_PRECISION #include "fp_lib.h" -#if defined(CRT_HAS_F128) +#if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) // Returns: the quotient of (a + ib) / (c + id) diff --git a/compiler-rt/lib/builtins/multc3.c b/compiler-rt/lib/builtins/multc3.c index 61a3f45e47279..a89832f0e883e 100644 --- a/compiler-rt/lib/builtins/multc3.c +++ b/compiler-rt/lib/builtins/multc3.c @@ -15,7 +15,7 @@ #include "int_lib.h" #include "int_math.h" -#if defined(CRT_HAS_F128) +#if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) // Returns: the product of a + ib and c + id diff --git a/compiler-rt/lib/builtins/riscv/feature_bits.c b/compiler-rt/lib/builtins/riscv/feature_bits.c deleted file mode 100644 index 77422935bd2d3..0000000000000 --- a/compiler-rt/lib/builtins/riscv/feature_bits.c +++ /dev/null @@ -1,298 +0,0 @@ -//=== feature_bits.c - Update RISC-V Feature Bits Structure -*- 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 -// -//===----------------------------------------------------------------------===// - -#define RISCV_FEATURE_BITS_LENGTH 1 -struct { - unsigned length; - unsigned long long features[RISCV_FEATURE_BITS_LENGTH]; -} __riscv_feature_bits __attribute__((visibility("hidden"), nocommon)); - -#define RISCV_VENDOR_FEATURE_BITS_LENGTH 1 -struct { - unsigned vendorID; - unsigned length; - unsigned long long features[RISCV_VENDOR_FEATURE_BITS_LENGTH]; -} __riscv_vendor_feature_bits __attribute__((visibility("hidden"), nocommon)); - -// NOTE: Should sync-up with RISCVFeatures.td -// TODO: Maybe generate a header from tablegen then include it. -#define A_GROUPID 0 -#define A_BITMASK (1ULL << 0) -#define C_GROUPID 0 -#define C_BITMASK (1ULL << 2) -#define D_GROUPID 0 -#define D_BITMASK (1ULL << 3) -#define F_GROUPID 0 -#define F_BITMASK (1ULL << 5) -#define I_GROUPID 0 -#define I_BITMASK (1ULL << 8) -#define M_GROUPID 0 -#define M_BITMASK (1ULL << 12) -#define V_GROUPID 0 -#define V_BITMASK (1ULL << 21) -#define ZACAS_GROUPID 0 -#define ZACAS_BITMASK (1ULL << 26) -#define ZBA_GROUPID 0 -#define ZBA_BITMASK (1ULL << 27) -#define ZBB_GROUPID 0 -#define ZBB_BITMASK (1ULL << 28) -#define ZBC_GROUPID 0 -#define ZBC_BITMASK (1ULL << 29) -#define ZBKB_GROUPID 0 -#define ZBKB_BITMASK (1ULL << 30) -#define ZBKC_GROUPID 0 -#define ZBKC_BITMASK (1ULL << 31) -#define ZBKX_GROUPID 0 -#define ZBKX_BITMASK (1ULL << 32) -#define ZBS_GROUPID 0 -#define ZBS_BITMASK (1ULL << 33) -#define ZFA_GROUPID 0 -#define ZFA_BITMASK (1ULL << 34) -#define ZFH_GROUPID 0 -#define ZFH_BITMASK (1ULL << 35) -#define ZFHMIN_GROUPID 0 -#define ZFHMIN_BITMASK (1ULL << 36) -#define ZICBOZ_GROUPID 0 -#define ZICBOZ_BITMASK (1ULL << 37) -#define ZICOND_GROUPID 0 -#define ZICOND_BITMASK (1ULL << 38) -#define ZIHINTNTL_GROUPID 0 -#define ZIHINTNTL_BITMASK (1ULL << 39) -#define ZIHINTPAUSE_GROUPID 0 -#define ZIHINTPAUSE_BITMASK (1ULL << 40) -#define ZKND_GROUPID 0 -#define ZKND_BITMASK (1ULL << 41) -#define ZKNE_GROUPID 0 -#define ZKNE_BITMASK (1ULL << 42) -#define ZKNH_GROUPID 0 -#define ZKNH_BITMASK (1ULL << 43) -#define ZKSED_GROUPID 0 -#define ZKSED_BITMASK (1ULL << 44) -#define ZKSH_GROUPID 0 -#define ZKSH_BITMASK (1ULL << 45) -#define ZKT_GROUPID 0 -#define ZKT_BITMASK (1ULL << 46) -#define ZTSO_GROUPID 0 -#define ZTSO_BITMASK (1ULL << 47) -#define ZVBB_GROUPID 0 -#define ZVBB_BITMASK (1ULL << 48) -#define ZVBC_GROUPID 0 -#define ZVBC_BITMASK (1ULL << 49) -#define ZVFH_GROUPID 0 -#define ZVFH_BITMASK (1ULL << 50) -#define ZVFHMIN_GROUPID 0 -#define ZVFHMIN_BITMASK (1ULL << 51) -#define ZVKB_GROUPID 0 -#define ZVKB_BITMASK (1ULL << 52) -#define ZVKG_GROUPID 0 -#define ZVKG_BITMASK (1ULL << 53) -#define ZVKNED_GROUPID 0 -#define ZVKNED_BITMASK (1ULL << 54) -#define ZVKNHA_GROUPID 0 -#define ZVKNHA_BITMASK (1ULL << 55) -#define ZVKNHB_GROUPID 0 -#define ZVKNHB_BITMASK (1ULL << 56) -#define ZVKSED_GROUPID 0 -#define ZVKSED_BITMASK (1ULL << 57) -#define ZVKSH_GROUPID 0 -#define ZVKSH_BITMASK (1ULL << 58) -#define ZVKT_GROUPID 0 -#define ZVKT_BITMASK (1ULL << 59) - -#if defined(__linux__) - -static long syscall_impl_5_args(long number, long arg1, long arg2, long arg3, - long arg4, long arg5) { - register long a7 __asm__("a7") = number; - register long a0 __asm__("a0") = arg1; - register long a1 __asm__("a1") = arg2; - register long a2 __asm__("a2") = arg3; - register long a3 __asm__("a3") = arg4; - register long a4 __asm__("a4") = arg5; - __asm__ __volatile__("ecall\n\t" - : "=r"(a0) - : "r"(a7), "r"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4) - : "memory"); - return a0; -} - -#define RISCV_HWPROBE_KEY_MVENDORID 0 -#define RISCV_HWPROBE_KEY_MARCHID 1 -#define RISCV_HWPROBE_KEY_MIMPID 2 -#define RISCV_HWPROBE_KEY_BASE_BEHAVIOR 3 -#define RISCV_HWPROBE_BASE_BEHAVIOR_IMA (1ULL << 0) -#define RISCV_HWPROBE_KEY_IMA_EXT_0 4 -#define RISCV_HWPROBE_IMA_FD (1ULL << 0) -#define RISCV_HWPROBE_IMA_C (1ULL << 1) -#define RISCV_HWPROBE_IMA_V (1ULL << 2) -#define RISCV_HWPROBE_EXT_ZBA (1ULL << 3) -#define RISCV_HWPROBE_EXT_ZBB (1ULL << 4) -#define RISCV_HWPROBE_EXT_ZBS (1ULL << 5) -#define RISCV_HWPROBE_EXT_ZICBOZ (1ULL << 6) -#define RISCV_HWPROBE_EXT_ZBC (1ULL << 7) -#define RISCV_HWPROBE_EXT_ZBKB (1ULL << 8) -#define RISCV_HWPROBE_EXT_ZBKC (1ULL << 9) -#define RISCV_HWPROBE_EXT_ZBKX (1ULL << 10) -#define RISCV_HWPROBE_EXT_ZKND (1ULL << 11) -#define RISCV_HWPROBE_EXT_ZKNE (1ULL << 12) -#define RISCV_HWPROBE_EXT_ZKNH (1ULL << 13) -#define RISCV_HWPROBE_EXT_ZKSED (1ULL << 14) -#define RISCV_HWPROBE_EXT_ZKSH (1ULL << 15) -#define RISCV_HWPROBE_EXT_ZKT (1ULL << 16) -#define RISCV_HWPROBE_EXT_ZVBB (1ULL << 17) -#define RISCV_HWPROBE_EXT_ZVBC (1ULL << 18) -#define RISCV_HWPROBE_EXT_ZVKB (1ULL << 19) -#define RISCV_HWPROBE_EXT_ZVKG (1ULL << 20) -#define RISCV_HWPROBE_EXT_ZVKNED (1ULL << 21) -#define RISCV_HWPROBE_EXT_ZVKNHA (1ULL << 22) -#define RISCV_HWPROBE_EXT_ZVKNHB (1ULL << 23) -#define RISCV_HWPROBE_EXT_ZVKSED (1ULL << 24) -#define RISCV_HWPROBE_EXT_ZVKSH (1ULL << 25) -#define RISCV_HWPROBE_EXT_ZVKT (1ULL << 26) -#define RISCV_HWPROBE_EXT_ZFH (1ULL << 27) -#define RISCV_HWPROBE_EXT_ZFHMIN (1ULL << 28) -#define RISCV_HWPROBE_EXT_ZIHINTNTL (1ULL << 29) -#define RISCV_HWPROBE_EXT_ZVFH (1ULL << 30) -#define RISCV_HWPROBE_EXT_ZVFHMIN (1ULL << 31) -#define RISCV_HWPROBE_EXT_ZFA (1ULL << 32) -#define RISCV_HWPROBE_EXT_ZTSO (1ULL << 33) -#define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34) -#define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35) -#define RISCV_HWPROBE_EXT_ZIHINTPAUSE (1ULL << 36) -#define RISCV_HWPROBE_KEY_CPUPERF_0 5 -#define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) -#define RISCV_HWPROBE_MISALIGNED_EMULATED (1ULL << 0) -#define RISCV_HWPROBE_MISALIGNED_SLOW (2 << 0) -#define RISCV_HWPROBE_MISALIGNED_FAST (3 << 0) -#define RISCV_HWPROBE_MISALIGNED_UNSUPPORTED (4 << 0) -#define RISCV_HWPROBE_MISALIGNED_MASK (7 << 0) -#define RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE 6 -/* Increase RISCV_HWPROBE_MAX_KEY when adding items. */ - -struct riscv_hwprobe { - long long key; - unsigned long long value; -}; - -#define __NR_riscv_hwprobe 258 -static long initHwProbe(struct riscv_hwprobe *Hwprobes, int len) { - return syscall_impl_5_args(__NR_riscv_hwprobe, (long)Hwprobes, len, 0, 0, 0); -} - -#define SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(EXTNAME) \ - SET_SINGLE_IMAEXT_RISCV_FEATURE(RISCV_HWPROBE_EXT_##EXTNAME, EXTNAME) - -#define SET_SINGLE_IMAEXT_RISCV_FEATURE(HWPROBE_BITMASK, EXT) \ - SET_SINGLE_RISCV_FEATURE(IMAEXT0Value &HWPROBE_BITMASK, EXT) - -#define SET_SINGLE_RISCV_FEATURE(COND, EXT) \ - if (COND) { \ - SET_RISCV_FEATURE(EXT); \ - } - -#define SET_RISCV_FEATURE(EXT) features[EXT##_GROUPID] |= EXT##_BITMASK - -static void initRISCVFeature(struct riscv_hwprobe Hwprobes[]) { - - // Note: If a hwprobe key is unknown to the kernel, its key field - // will be cleared to -1, and its value set to 0. - // This unsets all extension bitmask bits. - - // Init vendor extension - __riscv_vendor_feature_bits.length = 0; - __riscv_vendor_feature_bits.vendorID = Hwprobes[2].value; - - // Init standard extension - // TODO: Maybe Extension implied generate from tablegen? - __riscv_feature_bits.length = RISCV_FEATURE_BITS_LENGTH; - - unsigned long long features[RISCV_FEATURE_BITS_LENGTH]; - int i; - - for (i = 0; i < RISCV_FEATURE_BITS_LENGTH; i++) - features[i] = 0; - - // Check RISCV_HWPROBE_KEY_BASE_BEHAVIOR - unsigned long long BaseValue = Hwprobes[0].value; - if (BaseValue & RISCV_HWPROBE_BASE_BEHAVIOR_IMA) { - SET_RISCV_FEATURE(I); - SET_RISCV_FEATURE(M); - SET_RISCV_FEATURE(A); - } - - // Check RISCV_HWPROBE_KEY_IMA_EXT_0 - unsigned long long IMAEXT0Value = Hwprobes[1].value; - if (IMAEXT0Value & RISCV_HWPROBE_IMA_FD) { - SET_RISCV_FEATURE(F); - SET_RISCV_FEATURE(D); - } - - SET_SINGLE_IMAEXT_RISCV_FEATURE(RISCV_HWPROBE_IMA_C, C); - SET_SINGLE_IMAEXT_RISCV_FEATURE(RISCV_HWPROBE_IMA_V, V); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZBA); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZBB); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZBS); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZICBOZ); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZBC); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZBKB); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZBKC); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZBKX); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZKND); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZKNE); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZKNH); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZKSED); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZKSH); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZKT); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZVBB); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZVBC); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZVKB); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZVKG); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZVKNED); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZVKNHA); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZVKNHB); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZVKSED); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZVKSH); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZVKT); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZFH); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZFHMIN); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZIHINTNTL); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZIHINTPAUSE); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZVFH); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZVFHMIN); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZFA); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZTSO); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZACAS); - SET_RISCV_HWPROBE_EXT_SINGLE_RISCV_FEATURE(ZICOND); - - for (i = 0; i < RISCV_FEATURE_BITS_LENGTH; i++) - __riscv_feature_bits.features[i] = features[i]; -} - -#endif // defined(__linux__) - -static int FeaturesBitCached = 0; - -void __init_riscv_feature_bits() { - - if (FeaturesBitCached) - return; - -#if defined(__linux__) - struct riscv_hwprobe Hwprobes[] = { - {RISCV_HWPROBE_KEY_BASE_BEHAVIOR, 0}, - {RISCV_HWPROBE_KEY_IMA_EXT_0, 0}, - {RISCV_HWPROBE_KEY_MVENDORID, 0}, - }; - if (initHwProbe(Hwprobes, sizeof(Hwprobes) / sizeof(Hwprobes[0]))) - return; - - initRISCVFeature(Hwprobes); -#endif // defined(__linux__) - - FeaturesBitCached = 1; -} diff --git a/compiler-rt/lib/builtins/trampoline_setup.c b/compiler-rt/lib/builtins/trampoline_setup.c index 844eb27944142..830e25e4c0303 100644 --- a/compiler-rt/lib/builtins/trampoline_setup.c +++ b/compiler-rt/lib/builtins/trampoline_setup.c @@ -41,3 +41,45 @@ COMPILER_RT_ABI void __trampoline_setup(uint32_t *trampOnStack, __clear_cache(trampOnStack, &trampOnStack[10]); } #endif // __powerpc__ && !defined(__powerpc64__) + +// The AArch64 compiler generates calls to __trampoline_setup() when creating +// trampoline functions on the stack for use with nested functions. +// This function creates a custom 36-byte trampoline function on the stack +// which loads x18 with a pointer to the outer function's locals +// and then jumps to the target nested function. +// Note: x18 is a reserved platform register on Windows and macOS. + +#if defined(__aarch64__) && defined(__ELF__) +COMPILER_RT_ABI void __trampoline_setup(uint32_t *trampOnStack, + int trampSizeAllocated, + const void *realFunc, void *localsPtr) { + // This should never happen, but if compiler did not allocate + // enough space on stack for the trampoline, abort. + if (trampSizeAllocated < 36) + compilerrt_abort(); + + // create trampoline + // Load realFunc into x17. mov/movk 16 bits at a time. + trampOnStack[0] = + 0xd2800000u | ((((uint64_t)realFunc >> 0) & 0xffffu) << 5) | 0x11; + trampOnStack[1] = + 0xf2a00000u | ((((uint64_t)realFunc >> 16) & 0xffffu) << 5) | 0x11; + trampOnStack[2] = + 0xf2c00000u | ((((uint64_t)realFunc >> 32) & 0xffffu) << 5) | 0x11; + trampOnStack[3] = + 0xf2e00000u | ((((uint64_t)realFunc >> 48) & 0xffffu) << 5) | 0x11; + // Load localsPtr into x18 + trampOnStack[4] = + 0xd2800000u | ((((uint64_t)localsPtr >> 0) & 0xffffu) << 5) | 0x12; + trampOnStack[5] = + 0xf2a00000u | ((((uint64_t)localsPtr >> 16) & 0xffffu) << 5) | 0x12; + trampOnStack[6] = + 0xf2c00000u | ((((uint64_t)localsPtr >> 32) & 0xffffu) << 5) | 0x12; + trampOnStack[7] = + 0xf2e00000u | ((((uint64_t)localsPtr >> 48) & 0xffffu) << 5) | 0x12; + trampOnStack[8] = 0xd61f0220; // br x17 + + // Clear instruction cache. + __clear_cache(trampOnStack, &trampOnStack[9]); +} +#endif // defined(__aarch64__) && !defined(__APPLE__) && !defined(_WIN64) diff --git a/compiler-rt/lib/interception/interception_linux.h b/compiler-rt/lib/interception/interception_linux.h index 433a3d9bd7fa7..2e01ff44578c3 100644 --- a/compiler-rt/lib/interception/interception_linux.h +++ b/compiler-rt/lib/interception/interception_linux.h @@ -28,12 +28,14 @@ bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real, uptr func, uptr trampoline); } // namespace __interception -#define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func) \ - ::__interception::InterceptFunction( \ - #func, \ - (::__interception::uptr *)&REAL(func), \ - (::__interception::uptr)&(func), \ - (::__interception::uptr)&TRAMPOLINE(func)) +// Cast func to type of REAL(func) before casting to uptr in case it is an +// overloaded function, which is the case for some glibc functions when +// _FORTIFY_SOURCE is used. This disambiguates which overload to use. +#define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func) \ + ::__interception::InterceptFunction( \ + #func, (::__interception::uptr *)&REAL(func), \ + (::__interception::uptr)(decltype(REAL(func)))&(func), \ + (::__interception::uptr) &TRAMPOLINE(func)) // dlvsym is a GNU extension supported by some other platforms. #if SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD @@ -41,7 +43,7 @@ bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real, ::__interception::InterceptFunction( \ #func, symver, \ (::__interception::uptr *)&REAL(func), \ - (::__interception::uptr)&(func), \ + (::__interception::uptr)(decltype(REAL(func)))&(func), \ (::__interception::uptr)&TRAMPOLINE(func)) #else #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \ diff --git a/compiler-rt/lib/nsan/nsan_interceptors.cpp b/compiler-rt/lib/nsan/nsan_interceptors.cpp index 544b44f53cc42..852524bd37332 100644 --- a/compiler-rt/lib/nsan/nsan_interceptors.cpp +++ b/compiler-rt/lib/nsan/nsan_interceptors.cpp @@ -21,10 +21,6 @@ #include -#if SANITIZER_LINUX -extern "C" int mallopt(int param, int value); -#endif - using namespace __sanitizer; using __nsan::nsan_init_is_running; using __nsan::nsan_initialized; @@ -209,12 +205,6 @@ void __nsan::InitializeInterceptors() { static bool initialized = false; CHECK(!initialized); - // Instruct libc malloc to consume less memory. -#if SANITIZER_LINUX - mallopt(1, 0); // M_MXFAST - mallopt(-3, 32 * 1024); // M_MMAP_THRESHOLD -#endif - InitializeMallocInterceptors(); INTERCEPT_FUNCTION(memset); diff --git a/compiler-rt/lib/profile/InstrProfiling.h b/compiler-rt/lib/profile/InstrProfiling.h index d424a22c212c3..6906d52eacaf1 100644 --- a/compiler-rt/lib/profile/InstrProfiling.h +++ b/compiler-rt/lib/profile/InstrProfiling.h @@ -49,7 +49,6 @@ typedef struct ValueProfNode { #include "profile/InstrProfData.inc" } ValueProfNode; -typedef void *IntPtrT; typedef struct COMPILER_RT_ALIGNAS(INSTR_PROF_DATA_ALIGNMENT) VTableProfData { #define INSTR_PROF_VTABLE_DATA(Type, LLVMType, Name, Initializer) Type Name; #include "profile/InstrProfData.inc" diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp index 4d5423ec629d2..b63040446e53c 100644 --- a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp +++ b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp @@ -21,6 +21,18 @@ #include "rtsan/rtsan_context.h" #if SANITIZER_APPLE + +#if TARGET_OS_MAC +// On MacOS OSSpinLockLock is deprecated and no longer present in the headers, +// but the symbol still exists on the system. Forward declare here so we +// don't get compilation errors. +#include +extern "C" { +typedef int32_t OSSpinLock; +void OSSpinLockLock(volatile OSSpinLock *__lock); +} +#endif + #include #include #endif diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h index 294e330c4d561..eebfb00aad7ac 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h @@ -194,7 +194,16 @@ typedef u64 OFF64_T; #ifdef __SIZE_TYPE__ typedef __SIZE_TYPE__ usize; #else +// Since we use this for operator new, usize must match the real size_t, but on +// 32-bit Windows the definition of uptr does not actually match uintptr_t or +// size_t because we are working around typedef mismatches for the (S)SIZE_T +// types used in interception.h. +// Until the definition of uptr has been fixed we have to special case Win32. +# if SANITIZER_WINDOWS && SANITIZER_WORDSIZE == 32 +typedef unsigned int usize; +# else typedef uptr usize; +# endif #endif typedef u64 tid_t; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp index 483a1042a6238..648df0c4e5a76 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp @@ -33,11 +33,15 @@ // For mips64, syscall(__NR_stat) fills the buffer in the 'struct kernel_stat' // format. Struct kernel_stat is defined as 'struct stat' in asm/stat.h. To // access stat from asm/stat.h, without conflicting with definition in -// sys/stat.h, we use this trick. -# if SANITIZER_MIPS64 +// sys/stat.h, we use this trick. sparc64 is similar, using +// syscall(__NR_stat64) and struct kernel_stat64. +# if SANITIZER_LINUX && (SANITIZER_MIPS64 || SANITIZER_SPARC64) # include # include # define stat kernel_stat +# if SANITIZER_SPARC64 +# define stat64 kernel_stat64 +# endif # if SANITIZER_GO # undef st_atime # undef st_mtime @@ -48,6 +52,7 @@ # endif # include # undef stat +# undef stat64 # endif # include @@ -220,7 +225,7 @@ uptr internal_mmap(void *addr, uptr length, int prot, int flags, int fd, // mmap2 specifies file offset in 4096-byte units. CHECK(IsAligned(offset, 4096)); return internal_syscall(SYSCALL(mmap2), addr, length, prot, flags, fd, - offset / 4096); + (OFF_T)(offset / 4096)); # endif } # endif // !SANITIZER_S390 @@ -285,8 +290,7 @@ uptr internal_ftruncate(fd_t fd, uptr size) { return res; } -# if (!SANITIZER_LINUX_USES_64BIT_SYSCALLS || SANITIZER_SPARC) && \ - SANITIZER_LINUX +# if !SANITIZER_LINUX_USES_64BIT_SYSCALLS && SANITIZER_LINUX static void stat64_to_stat(struct stat64 *in, struct stat *out) { internal_memset(out, 0, sizeof(*out)); out->st_dev = in->st_dev; @@ -327,7 +331,12 @@ static void statx_to_stat(struct statx *in, struct stat *out) { } # endif -# if SANITIZER_MIPS64 +# if SANITIZER_MIPS64 || SANITIZER_SPARC64 +# if SANITIZER_MIPS64 +typedef struct kernel_stat kstat_t; +# else +typedef struct kernel_stat64 kstat_t; +# endif // Undefine compatibility macros from // so that they would not clash with the kernel_stat // st_[a|m|c]time fields @@ -345,7 +354,7 @@ static void statx_to_stat(struct statx *in, struct stat *out) { # undef st_mtime_nsec # undef st_ctime_nsec # endif -static void kernel_stat_to_stat(struct kernel_stat *in, struct stat *out) { +static void kernel_stat_to_stat(kstat_t *in, struct stat *out) { internal_memset(out, 0, sizeof(*out)); out->st_dev = in->st_dev; out->st_ino = in->st_ino; @@ -391,6 +400,12 @@ uptr internal_stat(const char *path, void *buf) { !SANITIZER_SPARC return internal_syscall(SYSCALL(newfstatat), AT_FDCWD, (uptr)path, (uptr)buf, 0); +# elif SANITIZER_SPARC64 + kstat_t buf64; + int res = internal_syscall(SYSCALL(fstatat64), AT_FDCWD, (uptr)path, + (uptr)&buf64, 0); + kernel_stat_to_stat(&buf64, (struct stat *)buf); + return res; # else struct stat64 buf64; int res = internal_syscall(SYSCALL(fstatat64), AT_FDCWD, (uptr)path, @@ -423,6 +438,12 @@ uptr internal_lstat(const char *path, void *buf) { !SANITIZER_SPARC return internal_syscall(SYSCALL(newfstatat), AT_FDCWD, (uptr)path, (uptr)buf, AT_SYMLINK_NOFOLLOW); +# elif SANITIZER_SPARC64 + kstat_t buf64; + int res = internal_syscall(SYSCALL(fstatat64), AT_FDCWD, (uptr)path, + (uptr)&buf64, AT_SYMLINK_NOFOLLOW); + kernel_stat_to_stat(&buf64, (struct stat *)buf); + return res; # else struct stat64 buf64; int res = internal_syscall(SYSCALL(fstatat64), AT_FDCWD, (uptr)path, @@ -442,10 +463,16 @@ uptr internal_fstat(fd_t fd, void *buf) { # if SANITIZER_FREEBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS # if SANITIZER_MIPS64 // For mips64, fstat syscall fills buffer in the format of kernel_stat - struct kernel_stat kbuf; + kstat_t kbuf; int res = internal_syscall(SYSCALL(fstat), fd, &kbuf); kernel_stat_to_stat(&kbuf, (struct stat *)buf); return res; +# elif SANITIZER_LINUX && SANITIZER_SPARC64 + // For sparc64, fstat64 syscall fills buffer in the format of kernel_stat64 + kstat_t kbuf; + int res = internal_syscall(SYSCALL(fstat64), fd, &kbuf); + kernel_stat_to_stat(&kbuf, (struct stat *)buf); + return res; # elif SANITIZER_LINUX && defined(__loongarch__) struct statx bufx; int res = internal_syscall(SYSCALL(statx), fd, "", AT_EMPTY_PATH, @@ -826,10 +853,16 @@ uptr internal_sigaltstack(const void *ss, void *oss) { return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss); } +extern "C" pid_t __fork(void); + int internal_fork() { # if SANITIZER_LINUX # if SANITIZER_S390 return internal_syscall(SYSCALL(clone), 0, SIGCHLD); +# elif SANITIZER_SPARC + // The clone syscall interface on SPARC differs massively from the rest, + // so fall back to __fork. + return __fork(); # else return internal_syscall(SYSCALL(clone), SIGCHLD, 0); # endif @@ -2242,25 +2275,25 @@ void SignalContext::DumpAllRegisters(void *context) { # elif SANITIZER_FREEBSD # if defined(__x86_64__) Report("Register values:\n"); - Printf("rax = 0x%016llx ", ucontext->uc_mcontext.mc_rax); - Printf("rbx = 0x%016llx ", ucontext->uc_mcontext.mc_rbx); - Printf("rcx = 0x%016llx ", ucontext->uc_mcontext.mc_rcx); - Printf("rdx = 0x%016llx ", ucontext->uc_mcontext.mc_rdx); + Printf("rax = 0x%016lx ", ucontext->uc_mcontext.mc_rax); + Printf("rbx = 0x%016lx ", ucontext->uc_mcontext.mc_rbx); + Printf("rcx = 0x%016lx ", ucontext->uc_mcontext.mc_rcx); + Printf("rdx = 0x%016lx ", ucontext->uc_mcontext.mc_rdx); Printf("\n"); - Printf("rdi = 0x%016llx ", ucontext->uc_mcontext.mc_rdi); - Printf("rsi = 0x%016llx ", ucontext->uc_mcontext.mc_rsi); - Printf("rbp = 0x%016llx ", ucontext->uc_mcontext.mc_rbp); - Printf("rsp = 0x%016llx ", ucontext->uc_mcontext.mc_rsp); + Printf("rdi = 0x%016lx ", ucontext->uc_mcontext.mc_rdi); + Printf("rsi = 0x%016lx ", ucontext->uc_mcontext.mc_rsi); + Printf("rbp = 0x%016lx ", ucontext->uc_mcontext.mc_rbp); + Printf("rsp = 0x%016lx ", ucontext->uc_mcontext.mc_rsp); Printf("\n"); - Printf(" r8 = 0x%016llx ", ucontext->uc_mcontext.mc_r8); - Printf(" r9 = 0x%016llx ", ucontext->uc_mcontext.mc_r9); - Printf("r10 = 0x%016llx ", ucontext->uc_mcontext.mc_r10); - Printf("r11 = 0x%016llx ", ucontext->uc_mcontext.mc_r11); + Printf(" r8 = 0x%016lx ", ucontext->uc_mcontext.mc_r8); + Printf(" r9 = 0x%016lx ", ucontext->uc_mcontext.mc_r9); + Printf("r10 = 0x%016lx ", ucontext->uc_mcontext.mc_r10); + Printf("r11 = 0x%016lx ", ucontext->uc_mcontext.mc_r11); Printf("\n"); - Printf("r12 = 0x%016llx ", ucontext->uc_mcontext.mc_r12); - Printf("r13 = 0x%016llx ", ucontext->uc_mcontext.mc_r13); - Printf("r14 = 0x%016llx ", ucontext->uc_mcontext.mc_r14); - Printf("r15 = 0x%016llx ", ucontext->uc_mcontext.mc_r15); + Printf("r12 = 0x%016lx ", ucontext->uc_mcontext.mc_r12); + Printf("r13 = 0x%016lx ", ucontext->uc_mcontext.mc_r13); + Printf("r14 = 0x%016lx ", ucontext->uc_mcontext.mc_r14); + Printf("r15 = 0x%016lx ", ucontext->uc_mcontext.mc_r15); Printf("\n"); # elif defined(__i386__) Report("Register values:\n"); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_ptrauth.h b/compiler-rt/lib/sanitizer_common/sanitizer_ptrauth.h index 5200354694851..265a9925a15a0 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_ptrauth.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_ptrauth.h @@ -9,31 +9,33 @@ #ifndef SANITIZER_PTRAUTH_H #define SANITIZER_PTRAUTH_H -#if __has_feature(ptrauth_calls) -#include +#if __has_feature(ptrauth_intrinsics) +# include #elif defined(__ARM_FEATURE_PAC_DEFAULT) && !defined(__APPLE__) -inline unsigned long ptrauth_strip(void* __value, unsigned int __key) { - // On the stack the link register is protected with Pointer - // Authentication Code when compiled with -mbranch-protection. - // Let's stripping the PAC unconditionally because xpaclri is in - // the NOP space so will do nothing when it is not enabled or not available. - unsigned long ret; - asm volatile( - "mov x30, %1\n\t" - "hint #7\n\t" // xpaclri - "mov %0, x30\n\t" - : "=r"(ret) - : "r"(__value) - : "x30"); - return ret; -} -#define ptrauth_auth_data(__value, __old_key, __old_data) __value -#define ptrauth_string_discriminator(__string) ((int)0) +// On the stack the link register is protected with Pointer +// Authentication Code when compiled with -mbranch-protection. +// Let's stripping the PAC unconditionally because xpaclri is in +// the NOP space so will do nothing when it is not enabled or not available. +# define ptrauth_strip(__value, __key) \ + ({ \ + __typeof(__value) ret; \ + asm volatile( \ + "mov x30, %1\n\t" \ + "hint #7\n\t" \ + "mov %0, x30\n\t" \ + "mov x30, xzr\n\t" \ + : "=r"(ret) \ + : "r"(__value) \ + : "x30"); \ + ret; \ + }) +# define ptrauth_auth_data(__value, __old_key, __old_data) __value +# define ptrauth_string_discriminator(__string) ((int)0) #else // Copied from -#define ptrauth_strip(__value, __key) __value -#define ptrauth_auth_data(__value, __old_key, __old_data) __value -#define ptrauth_string_discriminator(__string) ((int)0) +# define ptrauth_strip(__value, __key) __value +# define ptrauth_auth_data(__value, __old_key, __old_data) __value +# define ptrauth_string_discriminator(__string) ((int)0) #endif #define STRIP_PAC_PC(pc) ((uptr)ptrauth_strip(pc, 0)) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp index a2000798a3907..74f435287af3c 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp @@ -58,17 +58,16 @@ void BufferedStackTrace::UnwindFast(uptr pc, uptr bp, uptr stack_top, // Avoid infinite loop when frame == frame[0] by using frame > prev_frame. while (IsValidFrame(bp, stack_top, bottom) && IsAligned(bp, sizeof(uhwptr)) && size < max_depth) { - uhwptr pc1 = ((uhwptr *)bp)[15]; + // %o7 contains the address of the call instruction and not the + // return address, so we need to compensate. + uhwptr pc1 = GetNextInstructionPc(((uhwptr *)bp)[15]); // Let's assume that any pointer in the 0th page is invalid and // stop unwinding here. If we're adding support for a platform // where this isn't true, we need to reconsider this check. if (pc1 < kPageSize) break; - if (pc1 != pc) { - // %o7 contains the address of the call instruction and not the - // return address, so we need to compensate. - trace_buffer[size++] = GetNextInstructionPc((uptr)pc1); - } + if (pc1 != pc) + trace_buffer[size++] = pc1; bottom = bp; bp = (uptr)((uhwptr *)bp)[14] + STACK_BIAS; } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_unwind_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_unwind_win.cpp index afcd01dae0b7a..6fc18396ca63b 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_unwind_win.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_unwind_win.cpp @@ -70,10 +70,17 @@ void BufferedStackTrace::UnwindSlow(uptr pc, void *context, u32 max_depth) { stack_frame.AddrStack.Offset = ctx.Rsp; # endif # else +# if SANITIZER_ARM + int machine_type = IMAGE_FILE_MACHINE_ARM; + stack_frame.AddrPC.Offset = ctx.Pc; + stack_frame.AddrFrame.Offset = ctx.R11; + stack_frame.AddrStack.Offset = ctx.Sp; +# else int machine_type = IMAGE_FILE_MACHINE_I386; stack_frame.AddrPC.Offset = ctx.Eip; stack_frame.AddrFrame.Offset = ctx.Ebp; stack_frame.AddrStack.Offset = ctx.Esp; +# endif # endif stack_frame.AddrPC.Mode = AddrModeFlat; stack_frame.AddrFrame.Mode = AddrModeFlat; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp index 995f00eddc38a..8a80d54751364 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp @@ -992,8 +992,13 @@ void SignalContext::InitPcSpBp() { sp = (uptr)context_record->Rsp; # endif # else +# if SANITIZER_ARM + bp = (uptr)context_record->R11; + sp = (uptr)context_record->Sp; +# else bp = (uptr)context_record->Ebp; sp = (uptr)context_record->Esp; +# endif # endif } diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cpp index 1a1ccce82d259..601897a64f051 100644 --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cpp +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cpp @@ -28,12 +28,13 @@ using namespace __sanitizer; -#if SANITIZER_SOLARIS && defined(__sparcv9) +#if defined(__sparcv9) // FIXME: These tests probably fail because Solaris/sparcv9 uses the full -// 64-bit address space. Needs more investigation -#define SKIP_ON_SOLARIS_SPARCV9(x) DISABLED_##x +// 64-bit address space. Same on Linux/sparc64, so probably a general SPARC +// issue. Needs more investigation +# define SKIP_ON_SPARCV9(x) DISABLED_##x #else -#define SKIP_ON_SOLARIS_SPARCV9(x) x +# define SKIP_ON_SPARCV9(x) x #endif // On 64-bit systems with small virtual address spaces (e.g. 39-bit) we can't @@ -781,7 +782,7 @@ TEST(SanitizerCommon, CombinedAllocator64VeryCompact) { } #endif -TEST(SanitizerCommon, SKIP_ON_SOLARIS_SPARCV9(CombinedAllocator32Compact)) { +TEST(SanitizerCommon, SKIP_ON_SPARCV9(CombinedAllocator32Compact)) { TestCombinedAllocator(); } @@ -1028,7 +1029,7 @@ TEST(SanitizerCommon, SizeClassAllocator64DynamicPremappedIteration) { #endif #endif -TEST(SanitizerCommon, SKIP_ON_SOLARIS_SPARCV9(SizeClassAllocator32Iteration)) { +TEST(SanitizerCommon, SKIP_ON_SPARCV9(SizeClassAllocator32Iteration)) { TestSizeClassAllocatorIteration(); } diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_ioctl_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_ioctl_test.cpp index 8da09f693c2b8..8500d3aa91fec 100644 --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_ioctl_test.cpp +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_ioctl_test.cpp @@ -77,7 +77,8 @@ TEST(SanitizerIoctl, Fixup) { // Test decoding KVM ioctl numbers. TEST(SanitizerIoctl, KVM_GET_MP_STATE) { ioctl_desc desc; - unsigned int desc_value = SANITIZER_MIPS ? 0x4004ae98U : 0x8004ae98U; + unsigned int desc_value = + SANITIZER_MIPS || SANITIZER_SPARC ? 0x4004ae98U : 0x8004ae98U; bool res = ioctl_decode(desc_value, &desc); EXPECT_TRUE(res); EXPECT_EQ(ioctl_desc::WRITE, desc.type); @@ -86,7 +87,8 @@ TEST(SanitizerIoctl, KVM_GET_MP_STATE) { TEST(SanitizerIoctl, KVM_GET_LAPIC) { ioctl_desc desc; - unsigned int desc_value = SANITIZER_MIPS ? 0x4400ae8eU : 0x8400ae8eU; + unsigned int desc_value = + SANITIZER_MIPS || SANITIZER_SPARC ? 0x4400ae8eU : 0x8400ae8eU; bool res = ioctl_decode(desc_value, &desc); EXPECT_TRUE(res); EXPECT_EQ(ioctl_desc::WRITE, desc.type); diff --git a/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp b/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp index 468a8fcd603f0..15788574dd995 100644 --- a/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp +++ b/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp @@ -207,7 +207,7 @@ struct VtablePrefix { std::type_info *TypeInfo; }; VtablePrefix *getVtablePrefix(void *Vtable) { - Vtable = ptrauth_auth_data(Vtable, ptrauth_key_cxx_vtable_pointer, 0); + Vtable = ptrauth_strip(Vtable, ptrauth_key_cxx_vtable_pointer); VtablePrefix *Vptr = reinterpret_cast(Vtable); VtablePrefix *Prefix = Vptr - 1; if (!IsAccessibleMemoryRange((uptr)Prefix, sizeof(VtablePrefix))) diff --git a/compiler-rt/test/asan/TestCases/Linux/printf-fortify-5.c b/compiler-rt/test/asan/TestCases/Linux/printf-fortify-5.c index c7522e4029ea1..86cf4ab0c9a22 100644 --- a/compiler-rt/test/asan/TestCases/Linux/printf-fortify-5.c +++ b/compiler-rt/test/asan/TestCases/Linux/printf-fortify-5.c @@ -1,7 +1,8 @@ // RUN: %clang -fPIC -shared -O2 -D_FORTIFY_SOURCE=2 -D_DSO %s -o %t.so // RUN: %clang_asan -o %t %t.so %s // RUN: not %run %t 2>&1 | FileCheck %s -// REQUIRES: glibc-2.27 +/// Incompatible with pass_object_info style fortified source since glibc 2.40. +// REQUIRES: glibc-2.27 && !glibc-2.40 #ifdef _DSO #include #include diff --git a/compiler-rt/test/asan/Unit/lit.site.cfg.py.in b/compiler-rt/test/asan/Unit/lit.site.cfg.py.in index 638e1dedfc1d2..ac652b53dcb9d 100644 --- a/compiler-rt/test/asan/Unit/lit.site.cfg.py.in +++ b/compiler-rt/test/asan/Unit/lit.site.cfg.py.in @@ -53,7 +53,7 @@ config.test_source_root = config.test_exec_root # host triple as the trailing path component. The value is incorrect for i386 # tests on x86_64 hosts and vice versa. Adjust config.compiler_rt_libdir # accordingly. -if config.enable_per_target_runtime_dir and config.target_arch != config.host_arch: +if config.enable_per_target_runtime_dir: if config.target_arch == 'i386': config.compiler_rt_libdir = re.sub(r'/x86_64(?=-[^/]+$)', '/i386', config.compiler_rt_libdir) elif config.target_arch == 'x86_64': diff --git a/compiler-rt/test/builtins/Unit/trampoline_setup_test.c b/compiler-rt/test/builtins/Unit/trampoline_setup_test.c index da115fe764271..d51d35acaa02f 100644 --- a/compiler-rt/test/builtins/Unit/trampoline_setup_test.c +++ b/compiler-rt/test/builtins/Unit/trampoline_setup_test.c @@ -7,7 +7,7 @@ /* * Tests nested functions - * The ppc compiler generates a call to __trampoline_setup + * The ppc and aarch64 compilers generates a call to __trampoline_setup * The i386 and x86_64 compilers generate a call to ___enable_execute_stack */ diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py index 70bf43e2fac59..0690c3a18efdb 100644 --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -674,7 +674,16 @@ def add_glibc_versions(ver_string): ver = LooseVersion(ver_string) any_glibc = False - for required in ["2.19", "2.27", "2.30", "2.33", "2.34", "2.37", "2.38"]: + for required in [ + "2.19", + "2.27", + "2.30", + "2.33", + "2.34", + "2.37", + "2.38", + "2.40", + ]: if ver >= LooseVersion(required): config.available_features.add("glibc-" + required) any_glibc = True diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_line.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_line.cpp index 208ece3e05af4..f1afd859c207a 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_line.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_line.cpp @@ -20,7 +20,8 @@ int main(int argc, char **argv) { // CHECK1: SUMMARY: [[SAN]]: SEGV {{.*}}signal_line.cpp:[[@LINE-2]]:[[TAB]] in main if (n == 2) - *((volatile int *)0x1) = __LINE__; + // Allow for strict-alignment targets that require natural alignment. + *((volatile int *)0x8) = __LINE__; // CHECK2: #{{[0-9]+ .*}}main {{.*}}signal_line.cpp:[[@LINE-1]]:[[TAB:[0-9]+]] // CHECK2: SUMMARY: [[SAN]]: SEGV {{.*}}signal_line.cpp:[[@LINE-2]]:[[TAB]] in main } diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp index 035a5a8df77ae..638be63397dc6 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp @@ -62,14 +62,14 @@ void test_sigwait() { int res; res = fork_and_signal(s); fprintf(stderr, "fork_and_signal with SIGUSR1,2: %d\n", res); - // CHECK: died with sig 10 + // CHECK: died with sig {{10|30}} // CHECK: fork_and_signal with SIGUSR1,2: 0 // test sigandset... s should only have SIGUSR2 now s = sigset_and(s, mkset(1, SIGUSR2)); res = fork_and_signal(s); fprintf(stderr, "fork_and_signal with SIGUSR2: %d\n", res); - // CHECK: died with sig 12 + // CHECK: died with sig {{12|31}} // CHECK: fork_and_signal with SIGUSR2: 0 } diff --git a/dir.common.props b/dir.common.props new file mode 100644 index 0000000000000..ba2d7e7b7dc28 --- /dev/null +++ b/dir.common.props @@ -0,0 +1,92 @@ + + + + + $(__BuildArch) + x64 + x64 + + $(__BuildType) + Debug + Debug + Release + Checked + + $(__BuildOS) + Windows_NT + Linux + OSX + FreeBSD + + + <__BuildOS>$(BuildOS) + <__BuildArch>$(BuildArch) + + $(BuildType) + $(BuildArch) + + $(BuildOS).$(BuildArch).$(BuildType) + + + + + + + <__ProjectDir Condition="'$(__ProjectDir)'==''">$(MSBuildThisFileDirectory) + $(__ProjectDir)\ + $(ProjectDir)\..\..\ + $(MSBuildThisFileDirectory) + + $(RootRepoDir)artifacts\obj\llvm\$(MSBuildProjectName)\ + + $(__SourceDir)\ + $(ProjectDir)src\ + + $(__RootBinDir)\ + $(RootRepoDir)artifacts\ + + $(__BinDir)\ + $(RootBinDir)bin\llvm\$(PlatformConfigPathPart)\ + + <_LLVMSourceDir Condition="'$(_LLVMSourceDir)'==''">$(MSBuildThisFileDirectory)/llvm + <_LLVMBuildDir Condition="'$(_LLVMBuildDir)'==''">$(MSBuildThisFileDirectory)/artifacts/obj/BuildRoot-$(TargetArchitecture) + <_LLVMInstallDir Condition="'$(_LLVMInstallDir)'==''">$(MSBuildThisFileDirectory)/artifacts/obj/InstallRoot-$(TargetArchitecture) + + <_LibCxxSourceDir Condition="'$(_LibCxxSourceDir)'==''">$(MSBuildThisFileDirectory)/runtimes + <_LibCxxBuildDir Condition="'$(_LibCxxBuildDir)'==''">$(MSBuildThisFileDirectory)/artifacts/obj/libcxx/BuildRoot-$(TargetArchitecture) + <_LibCxxInstallDir Condition="'$(_LibCxxInstallDir)'==''">$(MSBuildThisFileDirectory)/artifacts/obj/libcxx/InstallRoot-$(TargetArchitecture) + + + + + + 1.0.0 + $([System.IO.File]::ReadAllText('$(_LLVMBuildDir)\version.txt')) + $(LLVMVersion) + $(LLVMVersion.SubString(0, $(LLVMVersion.IndexOf('.')))) + + + false + $(PackageVersion) + + preview8 + + + + + true + + + + + true + true + true + true + true + + true + + + + diff --git a/eng/Build.props b/eng/Build.props new file mode 100644 index 0000000000000..a884f3c0863de --- /dev/null +++ b/eng/Build.props @@ -0,0 +1,6 @@ + + + + + + diff --git a/eng/Publishing.props b/eng/Publishing.props new file mode 100644 index 0000000000000..10bc8c8684de3 --- /dev/null +++ b/eng/Publishing.props @@ -0,0 +1,6 @@ + + + + 3 + + diff --git a/eng/Tools.props b/eng/Tools.props new file mode 100644 index 0000000000000..112543dc80edb --- /dev/null +++ b/eng/Tools.props @@ -0,0 +1,11 @@ + + + false + + + + + + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml new file mode 100644 index 0000000000000..5b8657c4f14c9 --- /dev/null +++ b/eng/Version.Details.xml @@ -0,0 +1,15 @@ + + + + + + + https://github.com/dotnet/arcade + 8adf115288fa51feaa30d063b946478054c7f7b4 + + + https://github.com/dotnet/arcade + 8adf115288fa51feaa30d063b946478054c7f7b4 + + + diff --git a/eng/Versions.props b/eng/Versions.props new file mode 100644 index 0000000000000..04acef4a482aa --- /dev/null +++ b/eng/Versions.props @@ -0,0 +1,11 @@ + + + + 1.0.0 + alpha + 1 + + + 11.0.0-beta.25612.6 + + diff --git a/eng/azure-pipelines-codeql.yml b/eng/azure-pipelines-codeql.yml new file mode 100644 index 0000000000000..2d5754793b2a0 --- /dev/null +++ b/eng/azure-pipelines-codeql.yml @@ -0,0 +1,125 @@ +trigger: + none + +schedules: + - cron: 0 0 */7 * * + displayName: Periodic CodeQL run + branches: + include: + - dotnet/main-19.x + always: true + +variables: + - template: /eng/common-variables.yml + - template: /eng/common/templates/variables/pool-providers.yml + - name: Codeql.Enabled + value: True + - name: Codeql.Language + value: cpp,python + - name: Codeql.Cadence + value: 0 + - name: Codeql.TSAEnabled + value: True + - name: Codeql.BuildIdentifier + value: $(System.JobDisplayName) + +stages: +- stage: Build + jobs: + - template: /eng/common/templates/jobs/jobs.yml + parameters: + jobs: + + ############ LINUX BUILD ############ + - job: Build_Linux + displayName: Linux + timeoutInMinutes: 720 + variables: + - _BuildConfig: Release + strategy: + matrix: + x64: + assetManifestOS: linux + assetManifestPlatform: x64 + imagename: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64 + rootfs: /crossrootfs/x64 + ExtraArgs: -p:LibsRoot=/crossrootfs/x64/usr/lib/x86_64-linux-gnu + ClangTargetArg: /p:ClangTarget=x86_64-linux-gnu + ClangBinDirArg: /p:ClangBinDir=/usr/local/bin + archflag: --arch x64 + pool: + name: NetCore1ESPool-Internal-XL + demands: ImageOverride -equals build.ubuntu.2204.amd64 + container: + image: $(imagename) + steps: + - bash: | + set -ex + git clean -ffdx + git reset --hard HEAD + displayName: 'Clean up working directory' + + - bash: | + mkdir which-shim + echo '#!/bin/sh' > which-shim/which + echo 'command -v "$@"' >> which-shim/which + chmod +x which-shim/which + echo "##vso[task.prependpath]$PWD/which-shim" + displayName: 'Add a which shim for CodeQL' + + - task: CodeQL3000Init@0 + displayName: Initialize CodeQL (manually-injected) + + - bash: | + echo 'print("Hello world")' > hello.py + python3 hello.py + displayName: 'Run python helloworld' + + - bash: | + ./build.sh --ci --restore --build --pack $(archflag) --configuration $(_BuildConfig) $(_InternalBuildArgs) $(ClangBinDirArg) $(ClangTargetArg) $(ExtraArgs) /p:BuildJitToolsOnly=true + displayName: 'Build and package' + env: + ROOTFS_DIR: $(rootfs) + + - task: CodeQL3000Finalize@0 + displayName: Finalize CodeQL (manually-injected) + + ############ WINDOWS BUILD ############ + - job: Build_Windows + condition: false # TODO: this times out, need to investigate why + displayName: Windows + timeoutInMinutes: 720 + strategy: + matrix: + # Release + x64_release: + _BuildConfig: Release + assetManifestOS: win + assetManifestPlatform: x64 + LLVMTableGenArg: /p:LLVMTableGenPath=$(Build.SourcesDirectory)\artifacts\obj\BuildRoot-x64\bin\llvm-tblgen.exe + ClangTableGenArg: /p:ClangTableGenPath=$(Build.SourcesDirectory)\artifacts\obj\BuildRoot-x64\bin\clang-tblgen.exe + archflag: -arch x64 + pool: + name: NetCore1ESPool-Internal-XL + demands: ImageOverride -equals windows.vs2022.amd64 + steps: + - checkout: self + clean: true + fetchDepth: 2 + + - script: | + git clean -ffdx + git reset --hard HEAD + displayName: 'Clean up working directory' + + - task: CodeQL3000Init@0 + displayName: Initialize CodeQL (manually-injected) + + - powershell: eng\build.ps1 -ci -restore -build -arch x64 -configuration $(_BuildConfig) $(_InternalBuildArgs) /p:BuildLLVMTableGenOnly=true + displayName: 'Build host llvm-tblgen for cross-compiling' + + - powershell: eng\build.ps1 -ci -restore -build -pack $(archflag) -configuration $(_BuildConfig) $(_InternalBuildArgs) $(LLVMTableGenArg) $(ClangTableGenArg) + displayName: 'Build and package' + + - task: CodeQL3000Finalize@0 + displayName: Finalize CodeQL (manually-injected) diff --git a/eng/azure-pipelines-public.yml b/eng/azure-pipelines-public.yml new file mode 100644 index 0000000000000..a4621bcd86193 --- /dev/null +++ b/eng/azure-pipelines-public.yml @@ -0,0 +1,216 @@ +trigger: + batch: true + branches: + include: + - dotnet/main* + - dotnet/release/* + +pr: + branches: + include: + - dotnet/main* + - dotnet/release/* + +variables: +- template: /eng/common-variables.yml +- template: /eng/common/templates/variables/pool-providers.yml +# disable CodeQL here, we have a separate pipeline for it +- name: Codeql.Enabled + value: false + +stages: +- stage: build + displayName: Build + jobs: + - template: /eng/common/templates/jobs/jobs.yml + parameters: + enablePublishBuildArtifacts: true + enablePublishBuildAssets: true + enablePublishUsingPipelines: true + enableSourceBuild: true + sourceBuildParameters: + platforms: + - name: 'AlmaLinux_8_Portable' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:almalinux-8-source-build' + jobProperties: + timeoutInMinutes: 600 + jobs: + + ############ LINUX BUILD ############ + - job: Build_Linux + displayName: Linux + timeoutInMinutes: 600 + variables: + - _BuildConfig: Release + strategy: + matrix: + x64: + assetManifestOS: linux + assetManifestPlatform: x64 + imagename: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64 + rootfs: /crossrootfs/x64 + ExtraArgs: -p:LibsRoot=/crossrootfs/x64/usr/lib/x86_64-linux-gnu + ClangTargetArg: /p:ClangTarget=x86_64-linux-gnu + ClangBinDirArg: /p:ClangBinDir=/usr/local/bin + archflag: --arch x64 + arm64: + assetManifestOS: linux + assetManifestPlatform: arm64 + imagename: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64 + rootfs: /crossrootfs/arm64 + ExtraArgs: -p:LibsRoot=/crossrootfs/arm64/usr/lib/aarch64-linux-gnu + ClangTargetArg: /p:ClangTarget=aarch64-linux-gnu + ClangBinDirArg: /p:ClangBinDir=/usr/local/bin + archflag: --arch arm64 + arm: + assetManifestOS: linux + assetManifestPlatform: arm + imagename: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm + rootfs: /crossrootfs/arm + ExtraArgs: -p:LibsRoot=/crossrootfs/arm/usr/lib/arm-linux-gnueabihf + ClangTargetArg: /p:ClangTarget=arm-linux-gnueabihf + ClangBinDirArg: /p:ClangBinDir=/usr/local/bin + archflag: --arch arm + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals build.ubuntu.2204.amd64.open + container: + image: $(imagename) + steps: + - bash: | + set -ex + git clean -ffdx + git reset --hard HEAD + displayName: 'Clean up working directory' + + - bash: | + ./build.sh --ci --restore --build --pack $(archflag) --configuration $(_BuildConfig) $(_InternalBuildArgs) $(ClangBinDirArg) $(ClangTargetArg) $(ExtraArgs) + displayName: 'Build and package' + env: + ROOTFS_DIR: $(rootfs) + + ############ LINUX MUSL BUILD ############ + - job: Build_Linux_musl + displayName: Linux_musl + timeoutInMinutes: 600 + variables: + - _BuildConfig: Release + strategy: + matrix: + x64: + assetManifestOS: linux-musl + assetManifestPlatform: x64 + imagename: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64-alpine + rootfs: /crossrootfs/x64 + ExtraArgs: -p:LibsRoot=/crossrootfs/x64/lib + ClangTargetArg: /p:ClangTarget=x86_64-alpine-linux-musl + ClangBinDirArg: /p:ClangBinDir=/usr/local/bin + archflag: --arch x64 + arm64: + assetManifestOS: linux-musl + assetManifestPlatform: arm64 + imagename: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64-alpine + rootfs: /crossrootfs/arm64 + ExtraArgs: -p:LibsRoot=/crossrootfs/arm64/lib + ClangTargetArg: /p:ClangTarget=aarch64-alpine-linux-musl + ClangBinDirArg: /p:ClangBinDir=/usr/local/bin + archflag: --arch arm64 + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals build.ubuntu.2204.amd64.open + container: + image: $(imagename) + steps: + - bash: | + set -ex + git clean -ffdx + git reset --hard HEAD + displayName: 'Clean up working directory' + + - bash: | + ./build.sh --ci --restore --build --pack $(archflag) --configuration $(_BuildConfig) $(_InternalBuildArgs) /p:OutputRid=linux-musl-$(assetManifestPlatform) $(ClangBinDirArg) $(ClangTargetArg) $(ExtraArgs) + displayName: 'Build and package' + env: + ROOTFS_DIR: $(rootfs) + + ############ MACOS BUILD ############ + - job: Build_macOS + displayName: macOS + timeoutInMinutes: 600 + variables: + - _BuildConfig: Release + strategy: + matrix: + x64: + assetManifestOS: osx + assetManifestPlatform: x64 + clangTargetArg: /p:ClangTarget=x86_64-apple-darwin + archflag: --arch x64 + arm64: + assetManifestOS: osx + assetManifestPlatform: arm64 + clangTargetArg: /p:ClangTarget=aarch64-apple-darwin + archflag: --arch arm64 + pool: + vmImage: macos-14 + steps: + - bash: | + set -ex + git clean -ffdx + git reset --hard HEAD + displayName: 'Clean up working directory' + + - bash: | + ./build.sh --ci --restore --build --pack $(archflag) --configuration $(_BuildConfig) $(ClangTargetArg) $(_InternalBuildArgs) + displayName: 'Build and package' + + ############ WINDOWS BUILD ############ + - job: Build_Windows + displayName: Windows + timeoutInMinutes: 600 + strategy: + matrix: + # Release + x64_release: + _BuildConfig: Release + assetManifestOS: win + assetManifestPlatform: x64 + LLVMTableGenArg: /p:NativeTablegenDir=$(Build.SourcesDirectory)\artifacts\obj\BuildRoot-x64\bin + archflag: -arch x64 + arm64_release: + _BuildConfig: Release + assetManifestOS: win + assetManifestPlatform: arm64 + LLVMTableGenArg: /p:NativeTablegenDir=$(Build.SourcesDirectory)\artifacts\obj\BuildRoot-x64\bin + archflag: -arch arm64 + # Debug + x64_debug: + _BuildConfig: Debug + assetManifestOS: win + assetManifestPlatform: x64 + LLVMTableGenArg: /p:NativeTablegenDir=$(Build.SourcesDirectory)\artifacts\obj\BuildRoot-x64\bin + archflag: -arch x64 + arm64_debug: + _BuildConfig: Debug + assetManifestOS: win + assetManifestPlatform: arm64 + LLVMTableGenArg: /p:NativeTablegenDir=$(Build.SourcesDirectory)\artifacts\obj\BuildRoot-x64\bin + archflag: -arch arm64 + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals windows.vs2022.amd64.open + steps: + - checkout: self + clean: true + fetchDepth: 2 + + - script: | + git clean -ffdx + git reset --hard HEAD + displayName: 'Clean up working directory' + + - powershell: eng\build.ps1 -ci -restore -build -arch x64 -configuration $(_BuildConfig) $(_InternalBuildArgs) /p:BuildLLVMTableGenOnly=true + displayName: 'Build host llvm-tblgen for cross-compiling' + + - powershell: eng\build.ps1 -ci -restore -build -pack $(archflag) -configuration $(_BuildConfig) $(_InternalBuildArgs) $(LLVMTableGenArg) + displayName: 'Build and package' diff --git a/eng/azure-pipelines.yml b/eng/azure-pipelines.yml new file mode 100644 index 0000000000000..f20f81c993ac1 --- /dev/null +++ b/eng/azure-pipelines.yml @@ -0,0 +1,230 @@ +trigger: + batch: true + branches: + include: + - dotnet/main* + - dotnet/release/* + +pr: none + +variables: +- template: /eng/common-variables.yml@self +- template: /eng/common/templates-official/variables/pool-providers.yml@self + +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +parameters: +- name: linuxBuilds + type: object + default: + - arch: x64 + assetManifestOS: linux + imagename: mariner2crossamd64 + rootfs: /crossrootfs/x64 + ExtraArgs: -p:LibsRoot=/crossrootfs/x64/usr/lib/x86_64-linux-gnu + ClangTargetArg: /p:ClangTarget=x86_64-linux-gnu + ClangBinDirArg: /p:ClangBinDir=/usr/local/bin + - arch: arm64 + assetManifestOS: linux + imagename: mariner2crossarm64 + rootfs: /crossrootfs/arm64 + ExtraArgs: -p:LibsRoot=/crossrootfs/arm64/usr/lib/aarch64-linux-gnu + ClangTargetArg: /p:ClangTarget=aarch64-linux-gnu + ClangBinDirArg: /p:ClangBinDir=/usr/local/bin + - arch: arm + assetManifestOS: linux + imagename: mariner2crossarm + rootfs: /crossrootfs/arm + ExtraArgs: -p:LibsRoot=/crossrootfs/arm/usr/lib/arm-linux-gnueabihf + ClangTargetArg: /p:ClangTarget=arm-linux-gnueabihf + ClangBinDirArg: /p:ClangBinDir=/usr/local/bin + - arch: x64 + assetManifestOS: linux-musl + imagename: mariner2crossamd64alpine + rootfs: /crossrootfs/x64 + ExtraArgs: -p:LibsRoot=/crossrootfs/x64/lib -p:OutputRid=linux-musl-x64 + ClangTargetArg: /p:ClangTarget=x86_64-alpine-linux-musl + ClangBinDirArg: /p:ClangBinDir=/usr/local/bin + - arch: arm64 + assetManifestOS: linux-musl + imagename: mariner2crossarm64alpine + rootfs: /crossrootfs/arm64 + ExtraArgs: -p:LibsRoot=/crossrootfs/arm64/lib -p:OutputRid=linux-musl-arm64 + ClangTargetArg: /p:ClangTarget=aarch64-alpine-linux-musl + ClangBinDirArg: /p:ClangBinDir=/usr/local/bin +- name: macBuilds + type: object + default: + - arch: x64 + ClangTargetArg: /p:ClangTarget=x86_64-apple-darwin + - arch: arm64 + ClangTargetArg: /p:ClangTarget=aarch64-apple-darwin +- name: windowsBuilds + type: object + default: + - arch: x64 + BuildConfig: Release + - arch: arm64 + BuildConfig: Release + - arch: x64 + BuildConfig: Debug + - arch: arm64 + BuildConfig: Debug + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + sdl: + policheck: + enabled: true + exclusionsFile: $(Build.SourcesDirectory)\.config\PoliCheckExclusions.xml + tsa: + enabled: true + codeql: + runSourceLanguagesInSourceAnalysis: true + sourceAnalysisPool: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022 + os: windows + credscan: + suppressionsFile: $(Build.SourcesDirectory)/.config/CredScanSuppressions.json + containers: + mariner2crossamd64: + image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64 + mariner2crossarm64: + image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64 + mariner2crossarm: + image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm + mariner2crossamd64alpine: + image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-amd64-alpine + mariner2crossarm64alpine: + image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64-alpine + stages: + - stage: build + displayName: Build + jobs: + - template: /eng/common/templates-official/jobs/jobs.yml@self + parameters: + enablePublishBuildArtifacts: true + enablePublishBuildAssets: true + enablePublishUsingPipelines: true + jobs: + + ############ LINUX BUILD ############ + - ${{ each buildjob in parameters.linuxBuilds }}: + - job: Build_${{ replace(buildjob.assetManifestOS, '-', '_') }}_${{ buildjob.arch }} + displayName: ${{ buildjob.assetManifestOS }} ${{ buildjob.arch }} + timeoutInMinutes: 600 + variables: + - _BuildConfig: Release + pool: + name: $(DncEngInternalBuildPool) + image: 1es-ubuntu-2204 + os: linux + container: ${{ buildjob.imagename }} + templateContext: + sdl: + codeql: + compiled: + enabled: false + justificationForDisabling: CodeQL times out on Windows even after 10 hours timeout and we have a separate pipeline for CodeQL + steps: + - bash: | + set -ex + git clean -ffdx + git reset --hard HEAD + displayName: 'Clean up working directory' + + - bash: | + ./build.sh --ci --restore --build --pack --arch ${{ buildjob.arch }} --configuration $(_BuildConfig) $(_InternalBuildArgs) ${{ buildjob.ClangBinDirArg }} ${{ buildjob.ClangTargetArg }} ${{ buildjob.ExtraArgs }} + displayName: 'Build and package' + env: + ROOTFS_DIR: ${{ buildjob.rootfs }} + + - bash: | + ./eng/common/build.sh --ci --restore --publish --configuration $(_BuildConfig) $(_InternalBuildArgs) /p:AssetManifestOS=${{ buildjob.assetManifestOS }} /p:PlatformName=${{ buildjob.arch }} --projects $(Build.SourcesDirectory)/llvm.proj + displayName: Publish packages + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + + ############ MACOS BUILD ############ + - ${{ each buildjob in parameters.macBuilds }}: + - job: Build_macOS_${{ buildjob.arch }} + displayName: macOS ${{ buildjob.arch }} + timeoutInMinutes: 600 + variables: + - _BuildConfig: Release + pool: + name: Azure Pipelines + image: macos-14 + os: macOS + templateContext: + sdl: + codeql: + compiled: + enabled: false + justificationForDisabling: CodeQL times out on Windows even after 10 hours timeout and we have a separate pipeline for CodeQL + steps: + - bash: | + set -ex + git clean -ffdx + git reset --hard HEAD + displayName: 'Clean up working directory' + + - bash: | + ./build.sh --ci --restore --build --pack --arch ${{ buildjob.arch }} --configuration $(_BuildConfig) ${{ buildjob.ClangTargetArg }} $(_InternalBuildArgs) + displayName: 'Build and package' + + - bash: | + ./eng/common/build.sh --ci --restore --publish --configuration $(_BuildConfig) $(_InternalBuildArgs) /p:AssetManifestOS=osx /p:PlatformName=${{ buildjob.arch }} --projects $(Build.SourcesDirectory)/llvm.proj + displayName: Publish packages + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + + ############ WINDOWS BUILD ############ + - ${{ each buildjob in parameters.windowsBuilds }}: + - job: Build_Windows_${{ buildjob.arch }}_${{ buildjob.BuildConfig }} + displayName: Windows ${{ buildjob.arch }} ${{ buildjob.BuildConfig }} + timeoutInMinutes: 600 + variables: + - _BuildConfig: ${{ buildjob.BuildConfig }} + pool: + name: $(DncEngInternalBuildPool) + image: windows.vs2022.amd64 + os: windows + templateContext: + sdl: + codeql: + compiled: + enabled: false + justificationForDisabling: CodeQL times out on Windows even after 10 hours timeout and we have a separate pipeline for CodeQL + steps: + - checkout: self + clean: true + fetchDepth: 2 + + - script: | + git clean -ffdx + git reset --hard HEAD + displayName: 'Clean up working directory' + + - powershell: eng\build.ps1 -ci -restore -build -arch x64 -configuration $(_BuildConfig) $(_InternalBuildArgs) /p:BuildLLVMTableGenOnly=true + displayName: 'Build host llvm-tblgen for cross-compiling' + + - powershell: eng\build.ps1 -ci -restore -build -pack -arch ${{ buildjob.arch }} -configuration $(_BuildConfig) $(_InternalBuildArgs) /p:NativeTablegenDir=$(Build.SourcesDirectory)\artifacts\obj\BuildRoot-x64\bin + displayName: 'Build and package' + + - powershell: eng\common\build.ps1 -ci -restore -publish -configuration $(_BuildConfig) $(_InternalBuildArgs) /p:AssetManifestOS=$(_BuildConfig)-win /p:PlatformName=${{ buildjob.arch }} -projects $(Build.SourcesDirectory)\llvm.proj + displayName: Publish packages + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + + ############ POST BUILD ARCADE LOGIC ############ + - template: /eng/common/templates-official/post-build/post-build.yml@self + parameters: + enableSourceLinkValidation: false + enableSigningValidation: false + enableSymbolValidation: false + enableNugetValidation: true diff --git a/eng/build.ps1 b/eng/build.ps1 new file mode 100644 index 0000000000000..bc12cebbdcbd1 --- /dev/null +++ b/eng/build.ps1 @@ -0,0 +1,132 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [switch][Alias('h')]$help, + [switch][Alias('b')]$build, + [switch][Alias('t')]$test, + [switch]$buildtests, + [string][Alias('c')]$configuration = "Debug", + [string][Alias('f')]$framework, + [string]$vs, + [string]$os, + [switch]$allconfigurations, + [switch]$coverage, + [string]$testscope, + [string]$arch, + [string]$runtimeConfiguration, + [string]$librariesConfiguration, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties +) + +function Get-Help() { + Write-Host "Common settings:" + Write-Host " -os Build operating system: Windows_NT or Unix" + Write-Host " -arch Build platform: x86, x64, arm or arm64" + Write-Host " -configuration Build configuration: Debug or Release (short: -c)" + Write-Host " -verbosity MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" + Write-Host " -binaryLog Output binary log (short: -bl)" + Write-Host " -help Print help and exit (short: -h)" + Write-Host "" + + Write-Host "Actions (defaults to -restore -build):" + Write-Host " -restore Restore dependencies (short: -r)" + Write-Host " -build Build all source projects (short: -b)" + Write-Host " -buildtests Build all test projects" + Write-Host " -rebuild Rebuild all source projects" + Write-Host " -test Run all unit tests (short: -t)" + Write-Host " -pack Package build outputs into NuGet packages" + Write-Host " -sign Sign build outputs" + Write-Host " -publish Publish artifacts (e.g. symbols)" + Write-Host " -clean Clean the solution" + Write-Host "" + + Write-Host "Libraries settings:" + Write-Host " -vs Open the solution with VS for Test Explorer support. Path or solution name (ie -vs Microsoft.CSharp)" + Write-Host " -framework Build framework: netcoreapp5.0 or net472 (short: -f)" + Write-Host " -coverage Collect code coverage when testing" + Write-Host " -testscope Scope tests, allowed values: innerloop, outerloop, all" + Write-Host " -allconfigurations Build packages for all build configurations" + Write-Host "" + + Write-Host "Command-line arguments not listed above are passed thru to msbuild." + Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -con for configuration, -t for test, etc.)." +} + +if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) { + Get-Help + exit 0 +} + +# VS Test Explorer support for libraries +if ($vs) { + . $PSScriptRoot\common\tools.ps1 + + # Microsoft.DotNet.CoreSetup.sln is special - hosting tests are currently meant to run on the + # bootstrapped .NET Core, not on the live-built runtime. + if ([System.IO.Path]::GetFileName($vs) -ieq "Microsoft.DotNet.CoreSetup.sln") { + if (-Not (Test-Path $vs)) { + $vs = Join-Path "$PSScriptRoot\..\src\installer" $vs + } + + # This tells .NET Core to use the bootstrapped runtime to run the tests + $env:DOTNET_ROOT=InitializeDotNetCli -install:$false + } + else { + if (-Not (Test-Path $vs)) { + $vs = Join-Path "$PSScriptRoot\..\src\libraries" $vs | Join-Path -ChildPath "$vs.sln" + } + + $archTestHost = if ($arch) { $arch } else { "x64" } + + # This tells .NET Core to use the same dotnet.exe that build scripts use + $env:DOTNET_ROOT="$PSScriptRoot\..\artifacts\bin\testhost\netcoreapp5.0-Windows_NT-$configuration-$archTestHost"; + $env:DEVPATH="$PSScriptRoot\..\artifacts\bin\testhost\net472-Windows_NT-$configuration-$archTestHost"; + } + + # This tells MSBuild to load the SDK from the directory of the bootstrapped SDK + $env:DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=InitializeDotNetCli -install:$false + + # This tells .NET Core not to go looking for .NET Core in other places + $env:DOTNET_MULTILEVEL_LOOKUP=0; + + # Put our local dotnet.exe on PATH first so Visual Studio knows which one to use + $env:PATH=($env:DOTNET_ROOT + ";" + $env:PATH); + + # Launch Visual Studio with the locally defined environment variables + ."$vs" + + exit 0 +} + +# Check if an action is passed in +$actions = "r","restore","b","build","buildtests","rebuild","t","test","pack","sign","publish","clean" +$actionPassedIn = @(Compare-Object -ReferenceObject @($PSBoundParameters.Keys) -DifferenceObject $actions -ExcludeDifferent -IncludeEqual).Length -ne 0 +if ($null -ne $properties -and $actionPassedIn -ne $true) { + $actionPassedIn = @(Compare-Object -ReferenceObject $properties -DifferenceObject $actions.ForEach({ "-" + $_ }) -ExcludeDifferent -IncludeEqual).Length -ne 0 +} + +if (!$actionPassedIn) { + $arguments = "-restore -build" +} + +$possibleDirToBuild = if($properties.Length -gt 0) { $properties[0]; } else { $null } + +foreach ($argument in $PSBoundParameters.Keys) +{ + switch($argument) + { + "build" { $arguments += " -build" } + "buildtests" { if ($build -eq $true) { $arguments += " /p:BuildTests=true" } else { $arguments += " -build /p:BuildTests=only" } } + "test" { $arguments += " -test" } + "configuration" { $configuration = (Get-Culture).TextInfo.ToTitleCase($($PSBoundParameters[$argument])); $arguments += " /p:ConfigurationGroup=$configuration -configuration $configuration" } + "runtimeConfiguration" { $arguments += " /p:RuntimeConfiguration=$((Get-Culture).TextInfo.ToTitleCase($($PSBoundParameters[$argument])))" } + "framework" { $arguments += " /p:BuildTargetFramework=$($PSBoundParameters[$argument].ToLowerInvariant())" } + "os" { $arguments += " /p:OSGroup=$($PSBoundParameters[$argument])" } + "allconfigurations" { $arguments += " /p:BuildAllConfigurations=true" } + "arch" { $arguments += " /p:ArchGroup=$($PSBoundParameters[$argument]) /p:TargetArchitecture=$($PSBoundParameters[$argument])" } + "properties" { $arguments += " " + $properties } + default { $arguments += " /p:$argument=$($PSBoundParameters[$argument])" } + } +} + +Invoke-Expression "& `"$PSScriptRoot/common/build.ps1`" $arguments" +exit $lastExitCode diff --git a/eng/build.sh b/eng/build.sh new file mode 100755 index 0000000000000..becb206742183 --- /dev/null +++ b/eng/build.sh @@ -0,0 +1,170 @@ +#!/usr/bin/env bash + +set -ue + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +usage() +{ + echo "Common settings:" + echo " --os Build operating system: Windows_NT or Unix" + echo " --arch Build platform: x86, x64, arm or arm64" + echo " --configuration Build configuration: Debug or Release (short: -c)" + echo " --verbosity MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" + echo " --binaryLog Output binary log (short: -bl)" + echo " --cross Optional argument to signify cross compilation" + echo " --help Print help and exit (short: -h)" + echo "" + + echo "Actions (defaults to --restore --build):" + echo " --restore Restore dependencies (short: -r)" + echo " --build Build all source projects (short: -b)" + echo " --buildtests Build all test projects" + echo " --rebuild Rebuild all source projects" + echo " --test Run all unit tests (short: -t)" + echo " --pack Package build outputs into NuGet packages" + echo " --sign Sign build outputs" + echo " --publish Publish artifacts (e.g. symbols)" + echo " --clean Clean the solution" + echo "" + + echo "Libraries settings:" + echo " --framework Build framework: netcoreapp or net472 (short: -f)" + echo " --coverage Collect code coverage when testing" + echo " --testscope Test scope, allowed values: innerloop, outerloop, all" + echo " --allconfigurations Build packages for all build configurations" + echo "" + + echo "Native build settings:" + echo " --clang Optional argument to build using clang in PATH (default)" + echo " --clangx.y Optional argument to build using clang version x.y" + echo " --cmakeargs User-settable additional arguments passed to CMake." + echo " --gcc Optional argument to build using gcc in PATH (default)" + echo " --gccx.y Optional argument to build using gcc version x.y" + + echo "Command line arguments starting with '/p:' are passed through to MSBuild." + echo "Arguments can also be passed in with a single hyphen." +} + +arguments='' +cmakeargs='' +extraargs='' +build=false +buildtests=false +checkedPossibleDirectoryToBuild=false + +# Check if an action is passed in +declare -a actions=("r" "restore" "b" "build" "buildtests" "rebuild" "t" "test" "pack" "sign" "publish" "clean") +actInt=($(comm -12 <(printf '%s\n' "${actions[@]/#/-}" | sort) <(printf '%s\n' "${@/#--/-}" | sort))) + +while [[ $# > 0 ]]; do + opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" + case "$opt" in + -help|-h) + usage + exit 0 + ;; + -arch) + arguments="$arguments /p:ArchGroup=$2 /p:TargetArchitecture=$2" + shift 2 + ;; + -configuration|-c) + val="$(tr '[:lower:]' '[:upper:]' <<< ${2:0:1})${2:1}" + arguments="$arguments /p:ConfigurationGroup=$val -configuration $val" + shift 2 + ;; + -framework|-f) + val="$(echo "$2" | awk '{print tolower($0)}')" + arguments="$arguments /p:BuildTargetFramework=$val" + shift 2 + ;; + -os) + arguments="$arguments /p:OSGroup=$2" + shift 2 + ;; + -allconfigurations) + arguments="$arguments /p:BuildAllConfigurations=true" + shift 1 + ;; + -build) + build=true + arguments="$arguments -build" + shift 1 + ;; + -buildtests) + buildtests=true + shift 1 + ;; + -testscope) + arguments="$arguments /p:TestScope=$2" + shift 2 + ;; + -coverage) + arguments="$arguments /p:Coverage=true" + shift 1 + ;; + -stripsymbols) + arguments="$arguments /p:BuildNativeStripSymbols=true" + shift 1 + ;; + -runtimeconfiguration) + val="$(tr '[:lower:]' '[:upper:]' <<< ${2:0:1})${2:1}" + arguments="$arguments /p:RuntimeConfiguration=$val" + shift 2 + ;; + -librariesconfiguration) + arguments="$arguments /p:LibrariesConfiguration=$2" + shift 2 + ;; + -cross) + arguments="$arguments /p:CrossBuild=True" + shift 1 + ;; + -clang*) + arguments="$arguments /p:Compiler=$opt" + shift 1 + ;; + -cmakeargs) + cmakeargs="${cmakeargs} ${opt} $2" + shift 2 + ;; + -gcc*) + arguments="$arguments /p:Compiler=$opt" + shift 1 + ;; + *) + ea=$1 + + extraargs="$extraargs $ea" + shift 1 + ;; + esac +done + +if [[ "$buildtests" == true ]]; then + if [[ "$build" == true ]]; then + arguments="$arguments /p:BuildTests=true" + else + arguments="$arguments -build /p:BuildTests=only" + fi +fi + +if [ ${#actInt[@]} -eq 0 ]; then + arguments="-restore -build $arguments" +fi + +# URL-encode space (%20) to avoid quoting issues until the msbuild call in /eng/common/tools.sh. +# In *proj files (XML docs), URL-encoded string are rendered in their decoded form. +cmakeargs="${cmakeargs// /%20}" +arguments="$arguments /p:CMakeArgs=\"$cmakeargs\" $extraargs" +"$scriptroot/common/build.sh" $arguments diff --git a/eng/common-variables.yml b/eng/common-variables.yml new file mode 100644 index 0000000000000..6409fe766dab6 --- /dev/null +++ b/eng/common-variables.yml @@ -0,0 +1,27 @@ + +variables: + # Cannot use key:value syntax in root defined variables + - name: _TeamName + value: DotNetCore + - name: _DotNetArtifactsCategory + value: .NETCore + - name: _DotNetValidationArtifactsCategory + value: .NETCore + - name: HelixApiAccessToken + value: '' + - name: _InternalBuildArgs + value: '' + + - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - name: _SignType + value: real + # Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT + # DotNet-HelixApi-Access provides: HelixApiAccessToken + - group: Publish-Build-Assets + - group: DotNet-VSTS-Bot + - group: DotNet-HelixApi-Access + - name: _InternalBuildArgs + value: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName) + /p:DotNetPublishUsingPipelines=true + /p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory) + /p:OfficialBuildId=$(BUILD.BUILDNUMBER) diff --git a/eng/common/BuildConfiguration/build-configuration.json b/eng/common/BuildConfiguration/build-configuration.json new file mode 100644 index 0000000000000..3d1cc89894c94 --- /dev/null +++ b/eng/common/BuildConfiguration/build-configuration.json @@ -0,0 +1,4 @@ +{ + "RetryCountLimit": 1, + "RetryByAnyError": false +} diff --git a/eng/common/CIBuild.cmd b/eng/common/CIBuild.cmd new file mode 100644 index 0000000000000..ac1f72bf94e05 --- /dev/null +++ b/eng/common/CIBuild.cmd @@ -0,0 +1,2 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*" diff --git a/eng/common/PSScriptAnalyzerSettings.psd1 b/eng/common/PSScriptAnalyzerSettings.psd1 new file mode 100644 index 0000000000000..4c1ea7c98ea4d --- /dev/null +++ b/eng/common/PSScriptAnalyzerSettings.psd1 @@ -0,0 +1,11 @@ +@{ + IncludeRules=@('PSAvoidUsingCmdletAliases', + 'PSAvoidUsingWMICmdlet', + 'PSAvoidUsingPositionalParameters', + 'PSAvoidUsingInvokeExpression', + 'PSUseDeclaredVarsMoreThanAssignments', + 'PSUseCmdletCorrectly', + 'PSStandardDSCFunctionsInResource', + 'PSUseIdenticalMandatoryParametersForDSC', + 'PSUseIdenticalParametersForDSC') +} \ No newline at end of file diff --git a/eng/common/README.md b/eng/common/README.md new file mode 100644 index 0000000000000..ff49c371527a0 --- /dev/null +++ b/eng/common/README.md @@ -0,0 +1,28 @@ +# Don't touch this folder + + uuuuuuuuuuuuuuuuuuuu + u" uuuuuuuuuuuuuuuuuu "u + u" u$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u + $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ + $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ + $ $$$" ... "$... ...$" ... "$$$ ... "$$$ $ + $ $$$u `"$$$$$$$ $$$ $$$$$ $$ $$$ $$$ $ + $ $$$$$$uu "$$$$ $$$ $$$$$ $$ """ u$$$ $ + $ $$$""$$$ $$$$ $$$u "$$$" u$$ $$$$$$$$ $ + $ $$$$....,$$$$$..$$$$$....,$$$$..$$$$$$$$ $ + $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ + "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$" u" + "u """""""""""""""""" u" + """""""""""""""""""" + +!!! Changes made in this directory are subject to being overwritten by automation !!! + +The files in this directory are shared by all Arcade repos and managed by automation. If you need to make changes to these files, open an issue or submit a pull request to https://github.com/dotnet/arcade first. diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 new file mode 100644 index 0000000000000..fc8d618014e0d --- /dev/null +++ b/eng/common/SetupNugetSources.ps1 @@ -0,0 +1,176 @@ +# This script adds internal feeds required to build commits that depend on internal package sources. For instance, +# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables +# disabled internal Maestro (darc-int*) feeds. +# +# Optionally, this script also adds a credential entry for each of the internal feeds if supplied. +# +# See example call for this script below. +# +# - task: PowerShell@2 +# displayName: Setup internal Feeds Credentials +# condition: eq(variables['Agent.OS'], 'Windows_NT') +# inputs: +# filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 +# arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $Env:Token +# env: +# Token: $(dn-bot-dnceng-artifact-feeds-rw) +# +# Note that the NuGetAuthenticate task should be called after SetupNugetSources. +# This ensures that: +# - Appropriate creds are set for the added internal feeds (if not supplied to the scrupt) +# - The credential provider is installed. +# +# This logic is also abstracted into enable-internal-sources.yml. + +[CmdletBinding()] +param ( + [Parameter(Mandatory = $true)][string]$ConfigFile, + $Password +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + +. $PSScriptRoot\tools.ps1 + +# Adds or enables the package source with the given name +function AddOrEnablePackageSource($sources, $disabledPackageSources, $SourceName, $SourceEndPoint, $creds, $Username, $pwd) { + if ($disabledPackageSources -eq $null -or -not (EnableInternalPackageSource -DisabledPackageSources $disabledPackageSources -Creds $creds -PackageSourceName $SourceName)) { + AddPackageSource -Sources $sources -SourceName $SourceName -SourceEndPoint $SourceEndPoint -Creds $creds -Username $userName -pwd $Password + } +} + +# Add source entry to PackageSources +function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $pwd) { + $packageSource = $sources.SelectSingleNode("add[@key='$SourceName']") + + if ($packageSource -eq $null) + { + Write-Host "Adding package source $SourceName" + + $packageSource = $doc.CreateElement("add") + $packageSource.SetAttribute("key", $SourceName) + $packageSource.SetAttribute("value", $SourceEndPoint) + $sources.AppendChild($packageSource) | Out-Null + } + else { + Write-Host "Package source $SourceName already present and enabled." + } + + AddCredential -Creds $creds -Source $SourceName -Username $Username -pwd $pwd +} + +# Add a credential node for the specified source +function AddCredential($creds, $source, $username, $pwd) { + # If no cred supplied, don't do anything. + if (!$pwd) { + return; + } + + Write-Host "Inserting credential for feed: " $source + + # Looks for credential configuration for the given SourceName. Create it if none is found. + $sourceElement = $creds.SelectSingleNode($Source) + if ($sourceElement -eq $null) + { + $sourceElement = $doc.CreateElement($Source) + $creds.AppendChild($sourceElement) | Out-Null + } + + # Add the node to the credential if none is found. + $usernameElement = $sourceElement.SelectSingleNode("add[@key='Username']") + if ($usernameElement -eq $null) + { + $usernameElement = $doc.CreateElement("add") + $usernameElement.SetAttribute("key", "Username") + $sourceElement.AppendChild($usernameElement) | Out-Null + } + $usernameElement.SetAttribute("value", $Username) + + # Add the to the credential if none is found. + # Add it as a clear text because there is no support for encrypted ones in non-windows .Net SDKs. + # -> https://github.com/NuGet/Home/issues/5526 + $passwordElement = $sourceElement.SelectSingleNode("add[@key='ClearTextPassword']") + if ($passwordElement -eq $null) + { + $passwordElement = $doc.CreateElement("add") + $passwordElement.SetAttribute("key", "ClearTextPassword") + $sourceElement.AppendChild($passwordElement) | Out-Null + } + + $passwordElement.SetAttribute("value", $pwd) +} + +# Enable all darc-int package sources. +function EnableMaestroInternalPackageSources($DisabledPackageSources, $Creds) { + $maestroInternalSources = $DisabledPackageSources.SelectNodes("add[contains(@key,'darc-int')]") + ForEach ($DisabledPackageSource in $maestroInternalSources) { + EnableInternalPackageSource -DisabledPackageSources $DisabledPackageSources -Creds $Creds -PackageSourceName $DisabledPackageSource.key + } +} + +# Enables an internal package source by name, if found. Returns true if the package source was found and enabled, false otherwise. +function EnableInternalPackageSource($DisabledPackageSources, $Creds, $PackageSourceName) { + $DisabledPackageSource = $DisabledPackageSources.SelectSingleNode("add[@key='$PackageSourceName']") + if ($DisabledPackageSource) { + Write-Host "Enabling internal source '$($DisabledPackageSource.key)'." + + # Due to https://github.com/NuGet/Home/issues/10291, we must actually remove the disabled entries + $DisabledPackageSources.RemoveChild($DisabledPackageSource) + + AddCredential -Creds $creds -Source $DisabledPackageSource.Key -Username $userName -pwd $Password + return $true + } + return $false +} + +if (!(Test-Path $ConfigFile -PathType Leaf)) { + Write-PipelineTelemetryError -Category 'Build' -Message "Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile" + ExitWithExitCode 1 +} + +# Load NuGet.config +$doc = New-Object System.Xml.XmlDocument +$filename = (Get-Item $ConfigFile).FullName +$doc.Load($filename) + +# Get reference to - fail if none exist +$sources = $doc.DocumentElement.SelectSingleNode("packageSources") +if ($sources -eq $null) { + Write-PipelineTelemetryError -Category 'Build' -Message "Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. NuGet config file must contain a packageSources section: $ConfigFile" + ExitWithExitCode 1 +} + +$creds = $null +$feedSuffix = "v3/index.json" +if ($Password) { + $feedSuffix = "v2" + # Looks for a node. Create it if none is found. + $creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials") + if ($creds -eq $null) { + $creds = $doc.CreateElement("packageSourceCredentials") + $doc.DocumentElement.AppendChild($creds) | Out-Null + } +} + +$userName = "dn-bot" + +# Check for disabledPackageSources; we'll enable any darc-int ones we find there +$disabledSources = $doc.DocumentElement.SelectSingleNode("disabledPackageSources") +if ($disabledSources -ne $null) { + Write-Host "Checking for any darc-int disabled package sources in the disabledPackageSources node" + EnableMaestroInternalPackageSources -DisabledPackageSources $disabledSources -Creds $creds +} +$dotnetVersions = @('5','6','7','8','9','10') + +foreach ($dotnetVersion in $dotnetVersions) { + $feedPrefix = "dotnet" + $dotnetVersion; + $dotnetSource = $sources.SelectSingleNode("add[@key='$feedPrefix']") + if ($dotnetSource -ne $null) { + AddOrEnablePackageSource -Sources $sources -DisabledPackageSources $disabledSources -SourceName "$feedPrefix-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal/nuget/$feedSuffix" -Creds $creds -Username $userName -pwd $Password + AddOrEnablePackageSource -Sources $sources -DisabledPackageSources $disabledSources -SourceName "$feedPrefix-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal-transport/nuget/$feedSuffix" -Creds $creds -Username $userName -pwd $Password + } +} + +$doc.Save($filename) diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh new file mode 100644 index 0000000000000..b97cc536379df --- /dev/null +++ b/eng/common/SetupNugetSources.sh @@ -0,0 +1,196 @@ +#!/usr/bin/env bash + +# This script adds internal feeds required to build commits that depend on internal package sources. For instance, +# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables +# disabled internal Maestro (darc-int*) feeds. +# +# Optionally, this script also adds a credential entry for each of the internal feeds if supplied. +# +# See example call for this script below. +# +# - task: Bash@3 +# displayName: Setup Internal Feeds +# inputs: +# filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh +# arguments: $(System.DefaultWorkingDirectory)/NuGet.config +# condition: ne(variables['Agent.OS'], 'Windows_NT') +# - task: NuGetAuthenticate@1 +# +# Note that the NuGetAuthenticate task should be called after SetupNugetSources. +# This ensures that: +# - Appropriate creds are set for the added internal feeds (if not supplied to the scrupt) +# - The credential provider is installed. +# +# This logic is also abstracted into enable-internal-sources.yml. + +ConfigFile=$1 +CredToken=$2 +NL='\n' +TB=' ' + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. "$scriptroot/tools.sh" + +if [ ! -f "$ConfigFile" ]; then + Write-PipelineTelemetryError -Category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile" + ExitWithExitCode 1 +fi + +if [[ `uname -s` == "Darwin" ]]; then + NL=$'\\\n' + TB='' +fi + +# Enables an internal package source by name, if found. Returns 0 if found and enabled, 1 if not found. +EnableInternalPackageSource() { + local PackageSourceName="$1" + + # Check if disabledPackageSources section exists + grep -i "" "$ConfigFile" > /dev/null + if [ "$?" != "0" ]; then + return 1 # No disabled sources section + fi + + # Check if this source name is disabled + grep -i " /dev/null + if [ "$?" == "0" ]; then + echo "Enabling internal source '$PackageSourceName'." + # Remove the disabled entry (including any surrounding comments or whitespace on the same line) + sed -i.bak "//d" "$ConfigFile" + + # Add the source name to PackageSources for credential handling + PackageSources+=("$PackageSourceName") + return 0 # Found and enabled + fi + + return 1 # Not found in disabled sources +} + +# Add source entry to PackageSources +AddPackageSource() { + local SourceName="$1" + local SourceEndPoint="$2" + + # Check if source already exists + grep -i " /dev/null + if [ "$?" == "0" ]; then + echo "Package source $SourceName already present and enabled." + PackageSources+=("$SourceName") + return + fi + + echo "Adding package source $SourceName" + PackageSourcesNodeFooter="" + PackageSourceTemplate="${TB}" + + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" "$ConfigFile" + PackageSources+=("$SourceName") +} + +# Adds or enables the package source with the given name +AddOrEnablePackageSource() { + local SourceName="$1" + local SourceEndPoint="$2" + + # Try to enable if disabled, if not found then add new source + EnableInternalPackageSource "$SourceName" + if [ "$?" != "0" ]; then + AddPackageSource "$SourceName" "$SourceEndPoint" + fi +} + +# Enable all darc-int package sources +EnableMaestroInternalPackageSources() { + # Check if disabledPackageSources section exists + grep -i "" "$ConfigFile" > /dev/null + if [ "$?" != "0" ]; then + return # No disabled sources section + fi + + # Find all darc-int disabled sources + local DisabledDarcIntSources=() + DisabledDarcIntSources+=$(grep -oh '"darc-int-[^"]*" value="true"' "$ConfigFile" | tr -d '"') + + for DisabledSourceName in ${DisabledDarcIntSources[@]} ; do + if [[ $DisabledSourceName == darc-int* ]]; then + EnableInternalPackageSource "$DisabledSourceName" + fi + done +} + +# Ensure there is a ... section. +grep -i "" $ConfigFile +if [ "$?" != "0" ]; then + Write-PipelineTelemetryError -Category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. NuGet config file must contain a packageSources section: $ConfigFile" + ExitWithExitCode 1 +fi + +PackageSources=() + +# Set feed suffix based on whether credentials are provided +FeedSuffix="v3/index.json" +if [ -n "$CredToken" ]; then + FeedSuffix="v2" + + # Ensure there is a ... section. + grep -i "" $ConfigFile + if [ "$?" != "0" ]; then + echo "Adding ... section." + + PackageSourcesNodeFooter="" + PackageSourceCredentialsTemplate="${TB}${NL}${TB}" + + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" $ConfigFile + fi +fi + +# Check for disabledPackageSources; we'll enable any darc-int ones we find there +grep -i "" $ConfigFile > /dev/null +if [ "$?" == "0" ]; then + echo "Checking for any darc-int disabled package sources in the disabledPackageSources node" + EnableMaestroInternalPackageSources +fi + +DotNetVersions=('5' '6' '7' '8' '9' '10') + +for DotNetVersion in ${DotNetVersions[@]} ; do + FeedPrefix="dotnet${DotNetVersion}"; + grep -i " /dev/null + if [ "$?" == "0" ]; then + AddOrEnablePackageSource "$FeedPrefix-internal" "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$FeedPrefix-internal/nuget/$FeedSuffix" + AddOrEnablePackageSource "$FeedPrefix-internal-transport" "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$FeedPrefix-internal-transport/nuget/$FeedSuffix" + fi +done + +# I want things split line by line +PrevIFS=$IFS +IFS=$'\n' +PackageSources+="$IFS" +PackageSources+=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"') +IFS=$PrevIFS + +if [ "$CredToken" ]; then + for FeedName in ${PackageSources[@]} ; do + # Check if there is no existing credential for this FeedName + grep -i "<$FeedName>" $ConfigFile + if [ "$?" != "0" ]; then + echo " Inserting credential for feed: $FeedName" + + PackageSourceCredentialsNodeFooter="" + NewCredential="${TB}${TB}<$FeedName>${NL}${TB}${NL}${TB}${TB}${NL}${TB}${TB}" + + sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" $ConfigFile + fi + done +fi diff --git a/eng/common/build.cmd b/eng/common/build.cmd new file mode 100644 index 0000000000000..99daf368abae7 --- /dev/null +++ b/eng/common/build.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0build.ps1""" %*" +exit /b %ErrorLevel% diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 new file mode 100644 index 0000000000000..8cfee107e7a35 --- /dev/null +++ b/eng/common/build.ps1 @@ -0,0 +1,178 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string][Alias('c')]$configuration = "Debug", + [string]$platform = $null, + [string] $projects, + [string][Alias('v')]$verbosity = "minimal", + [string] $msbuildEngine = $null, + [bool] $warnAsError = $true, + [bool] $nodeReuse = $true, + [switch] $buildCheck = $false, + [switch][Alias('r')]$restore, + [switch] $deployDeps, + [switch][Alias('b')]$build, + [switch] $rebuild, + [switch] $deploy, + [switch][Alias('t')]$test, + [switch] $integrationTest, + [switch] $performanceTest, + [switch] $sign, + [switch] $pack, + [switch] $publish, + [switch] $clean, + [switch][Alias('pb')]$productBuild, + [switch]$fromVMR, + [switch][Alias('bl')]$binaryLog, + [switch][Alias('nobl')]$excludeCIBinarylog, + [switch] $ci, + [switch] $prepareMachine, + [string] $runtimeSourceFeed = '', + [string] $runtimeSourceFeedKey = '', + [switch] $excludePrereleaseVS, + [switch] $nativeToolsOnMachine, + [switch] $help, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties +) + +# Unset 'Platform' environment variable to avoid unwanted collision in InstallDotNetCore.targets file +# some computer has this env var defined (e.g. Some HP) +if($env:Platform) { + $env:Platform="" +} +function Print-Usage() { + Write-Host "Common settings:" + Write-Host " -configuration Build configuration: 'Debug' or 'Release' (short: -c)" + Write-Host " -platform Platform configuration: 'x86', 'x64' or any valid Platform value to pass to msbuild" + Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" + Write-Host " -binaryLog Output binary log (short: -bl)" + Write-Host " -help Print help and exit" + Write-Host "" + + Write-Host "Actions:" + Write-Host " -restore Restore dependencies (short: -r)" + Write-Host " -build Build solution (short: -b)" + Write-Host " -rebuild Rebuild solution" + Write-Host " -deploy Deploy built VSIXes" + Write-Host " -deployDeps Deploy dependencies (e.g. VSIXes for integration tests)" + Write-Host " -test Run all unit tests in the solution (short: -t)" + Write-Host " -integrationTest Run all integration tests in the solution" + Write-Host " -performanceTest Run all performance tests in the solution" + Write-Host " -pack Package build outputs into NuGet packages and Willow components" + Write-Host " -sign Sign build outputs" + Write-Host " -publish Publish artifacts (e.g. symbols)" + Write-Host " -clean Clean the solution" + Write-Host " -productBuild Build the solution in the way it will be built in the full .NET product (VMR) build (short: -pb)" + Write-Host "" + + Write-Host "Advanced settings:" + Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" + Write-Host " -ci Set when running on CI server" + Write-Host " -excludeCIBinarylog Don't output binary log (short: -nobl)" + Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" + Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" + Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." + Write-Host " -excludePrereleaseVS Set to exclude build engines in prerelease versions of Visual Studio" + Write-Host " -nativeToolsOnMachine Sets the native tools on machine environment variable (indicating that the script should use native tools on machine)" + Write-Host " -nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" + Write-Host " -buildCheck Sets /check msbuild parameter" + Write-Host " -fromVMR Set when building from within the VMR" + Write-Host "" + + Write-Host "Command line arguments not listed above are passed thru to msbuild." + Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)." +} + +. $PSScriptRoot\tools.ps1 + +function InitializeCustomToolset { + if (-not $restore) { + return + } + + $script = Join-Path $EngRoot 'restore-toolset.ps1' + + if (Test-Path $script) { + . $script + } +} + +function Build { + $toolsetBuildProj = InitializeToolset + InitializeCustomToolset + + $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'Build.binlog') } else { '' } + $platformArg = if ($platform) { "/p:Platform=$platform" } else { '' } + $check = if ($buildCheck) { '/check' } else { '' } + + if ($projects) { + # Re-assign properties to a new variable because PowerShell doesn't let us append properties directly for unclear reasons. + # Explicitly set the type as string[] because otherwise PowerShell would make this char[] if $properties is empty. + [string[]] $msbuildArgs = $properties + + # Resolve relative project paths into full paths + $projects = ($projects.Split(';').ForEach({Resolve-Path $_}) -join ';') + + $msbuildArgs += "/p:Projects=$projects" + $properties = $msbuildArgs + } + + MSBuild $toolsetBuildProj ` + $bl ` + $platformArg ` + $check ` + /p:Configuration=$configuration ` + /p:RepoRoot=$RepoRoot ` + /p:Restore=$restore ` + /p:DeployDeps=$deployDeps ` + /p:Build=$build ` + /p:Rebuild=$rebuild ` + /p:Deploy=$deploy ` + /p:Test=$test ` + /p:Pack=$pack ` + /p:DotNetBuild=$productBuild ` + /p:DotNetBuildFromVMR=$fromVMR ` + /p:IntegrationTest=$integrationTest ` + /p:PerformanceTest=$performanceTest ` + /p:Sign=$sign ` + /p:Publish=$publish ` + /p:RestoreStaticGraphEnableBinaryLogger=$binaryLog ` + @properties +} + +try { + if ($clean) { + if (Test-Path $ArtifactsDir) { + Remove-Item -Recurse -Force $ArtifactsDir + Write-Host 'Artifacts directory deleted.' + } + exit 0 + } + + if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) { + Print-Usage + exit 0 + } + + if ($ci) { + if (-not $excludeCIBinarylog) { + $binaryLog = $true + } + $nodeReuse = $false + } + + if ($nativeToolsOnMachine) { + $env:NativeToolsOnMachine = $true + } + if ($restore) { + InitializeNativeTools + } + + Build +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ + ExitWithExitCode 1 +} + +ExitWithExitCode 0 diff --git a/eng/common/build.sh b/eng/common/build.sh new file mode 100755 index 0000000000000..ec3e80d189ea3 --- /dev/null +++ b/eng/common/build.sh @@ -0,0 +1,277 @@ +#!/usr/bin/env bash + +# Stop script if unbound variable found (use ${var:-} if intentional) +set -u + +# Stop script if command returns non-zero exit code. +# Prevents hidden errors caused by missing error code propagation. +set -e + +usage() +{ + echo "Common settings:" + echo " --configuration Build configuration: 'Debug' or 'Release' (short: -c)" + echo " --verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" + echo " --binaryLog Create MSBuild binary log (short: -bl)" + echo " --help Print help and exit (short: -h)" + echo "" + + echo "Actions:" + echo " --restore Restore dependencies (short: -r)" + echo " --build Build solution (short: -b)" + echo " --sourceBuild Source-build the solution (short: -sb)" + echo " Will additionally trigger the following actions: --restore, --build, --pack" + echo " If --configuration is not set explicitly, will also set it to 'Release'" + echo " --productBuild Build the solution in the way it will be built in the full .NET product (VMR) build (short: -pb)" + echo " Will additionally trigger the following actions: --restore, --build, --pack" + echo " If --configuration is not set explicitly, will also set it to 'Release'" + echo " --rebuild Rebuild solution" + echo " --test Run all unit tests in the solution (short: -t)" + echo " --integrationTest Run all integration tests in the solution" + echo " --performanceTest Run all performance tests in the solution" + echo " --pack Package build outputs into NuGet packages and Willow components" + echo " --sign Sign build outputs" + echo " --publish Publish artifacts (e.g. symbols)" + echo " --clean Clean the solution" + echo "" + + echo "Advanced settings:" + echo " --projects Project or solution file(s) to build" + echo " --ci Set when running on CI server" + echo " --excludeCIBinarylog Don't output binary log (short: -nobl)" + echo " --prepareMachine Prepare machine for CI run, clean up processes after build" + echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" + echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" + echo " --buildCheck Sets /check msbuild parameter" + echo " --fromVMR Set when building from within the VMR" + echo "" + echo "Command line arguments not listed above are passed thru to msbuild." + echo "Arguments can also be passed in with a single hyphen." +} + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +restore=false +build=false +source_build=false +product_build=false +from_vmr=false +rebuild=false +test=false +integration_test=false +performance_test=false +pack=false +publish=false +sign=false +public=false +ci=false +clean=false + +warn_as_error=true +node_reuse=true +build_check=false +binary_log=false +exclude_ci_binary_log=false +pipelines_log=false + +projects='' +configuration='' +prepare_machine=false +verbosity='minimal' +runtime_source_feed='' +runtime_source_feed_key='' + +properties=() +while [[ $# -gt 0 ]]; do + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + -help|-h) + usage + exit 0 + ;; + -clean) + clean=true + ;; + -configuration|-c) + configuration=$2 + shift + ;; + -verbosity|-v) + verbosity=$2 + shift + ;; + -binarylog|-bl) + binary_log=true + ;; + -excludecibinarylog|-nobl) + exclude_ci_binary_log=true + ;; + -pipelineslog|-pl) + pipelines_log=true + ;; + -restore|-r) + restore=true + ;; + -build|-b) + build=true + ;; + -rebuild) + rebuild=true + ;; + -pack) + pack=true + ;; + -sourcebuild|-source-build|-sb) + build=true + source_build=true + product_build=true + restore=true + pack=true + ;; + -productbuild|-product-build|-pb) + build=true + product_build=true + restore=true + pack=true + ;; + -fromvmr|-from-vmr) + from_vmr=true + ;; + -test|-t) + test=true + ;; + -integrationtest) + integration_test=true + ;; + -performancetest) + performance_test=true + ;; + -sign) + sign=true + ;; + -publish) + publish=true + ;; + -preparemachine) + prepare_machine=true + ;; + -projects) + projects=$2 + shift + ;; + -ci) + ci=true + ;; + -warnaserror) + warn_as_error=$2 + shift + ;; + -nodereuse) + node_reuse=$2 + shift + ;; + -buildcheck) + build_check=true + ;; + -runtimesourcefeed) + runtime_source_feed=$2 + shift + ;; + -runtimesourcefeedkey) + runtime_source_feed_key=$2 + shift + ;; + *) + properties+=("$1") + ;; + esac + + shift +done + +if [[ -z "$configuration" ]]; then + if [[ "$source_build" = true ]]; then configuration="Release"; else configuration="Debug"; fi +fi + +if [[ "$ci" == true ]]; then + pipelines_log=true + node_reuse=false + if [[ "$exclude_ci_binary_log" == false ]]; then + binary_log=true + fi +fi + +. "$scriptroot/tools.sh" + +function InitializeCustomToolset { + local script="$eng_root/restore-toolset.sh" + + if [[ -a "$script" ]]; then + . "$script" + fi +} + +function Build { + InitializeToolset + InitializeCustomToolset + + if [[ ! -z "$projects" ]]; then + properties+=("/p:Projects=$projects") + fi + + local bl="" + if [[ "$binary_log" == true ]]; then + bl="/bl:\"$log_dir/Build.binlog\"" + fi + + local check="" + if [[ "$build_check" == true ]]; then + check="/check" + fi + + MSBuild $_InitializeToolset \ + $bl \ + $check \ + /p:Configuration=$configuration \ + /p:RepoRoot="$repo_root" \ + /p:Restore=$restore \ + /p:Build=$build \ + /p:DotNetBuild=$product_build \ + /p:DotNetBuildSourceOnly=$source_build \ + /p:DotNetBuildFromVMR=$from_vmr \ + /p:Rebuild=$rebuild \ + /p:Test=$test \ + /p:Pack=$pack \ + /p:IntegrationTest=$integration_test \ + /p:PerformanceTest=$performance_test \ + /p:Sign=$sign \ + /p:Publish=$publish \ + /p:RestoreStaticGraphEnableBinaryLogger=$binary_log \ + ${properties[@]+"${properties[@]}"} + + ExitWithExitCode 0 +} + +if [[ "$clean" == true ]]; then + if [ -d "$artifacts_dir" ]; then + rm -rf $artifacts_dir + echo "Artifacts directory deleted." + fi + exit 0 +fi + +if [[ "$restore" == true ]]; then + InitializeNativeTools +fi + +Build diff --git a/eng/common/cibuild.sh b/eng/common/cibuild.sh new file mode 100755 index 0000000000000..66e3b0ac61c36 --- /dev/null +++ b/eng/common/cibuild.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where + # the symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. "$scriptroot/build.sh" --restore --build --test --pack --publish --ci $@ diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml new file mode 100644 index 0000000000000..748c4f07a64d6 --- /dev/null +++ b/eng/common/core-templates/job/job.yml @@ -0,0 +1,235 @@ +parameters: +# Job schema parameters - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + cancelTimeoutInMinutes: '' + condition: '' + container: '' + continueOnError: false + dependsOn: '' + displayName: '' + pool: '' + steps: [] + strategy: '' + timeoutInMinutes: '' + variables: [] + workspace: '' + templateContext: {} + +# Job base template specific parameters + # See schema documentation - https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/TemplateSchema.md + # publishing defaults + artifacts: '' + enableMicrobuild: false + enablePreviewMicrobuild: false + microbuildPluginVersion: 'latest' + enableMicrobuildForMacAndLinux: false + microbuildUseESRP: true + enablePublishBuildArtifacts: false + enablePublishBuildAssets: false + enablePublishTestResults: false + enableBuildRetry: false + mergeTestResults: false + testRunTitle: '' + testResultsFormat: '' + name: '' + componentGovernanceSteps: [] + preSteps: [] + artifactPublishSteps: [] + runAsPublic: false + +# 1es specific parameters + is1ESPipeline: '' + +jobs: +- job: ${{ parameters.name }} + + ${{ if ne(parameters.cancelTimeoutInMinutes, '') }}: + cancelTimeoutInMinutes: ${{ parameters.cancelTimeoutInMinutes }} + + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} + + ${{ if ne(parameters.container, '') }}: + container: ${{ parameters.container }} + + ${{ if ne(parameters.continueOnError, '') }}: + continueOnError: ${{ parameters.continueOnError }} + + ${{ if ne(parameters.dependsOn, '') }}: + dependsOn: ${{ parameters.dependsOn }} + + ${{ if ne(parameters.displayName, '') }}: + displayName: ${{ parameters.displayName }} + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + + ${{ if ne(parameters.strategy, '') }}: + strategy: ${{ parameters.strategy }} + + ${{ if ne(parameters.timeoutInMinutes, '') }}: + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + + ${{ if ne(parameters.templateContext, '') }}: + templateContext: ${{ parameters.templateContext }} + + variables: + - name: AllowPtrToDetectTestRunRetryFiles + value: true + - ${{ if ne(parameters.enableTelemetry, 'false') }}: + - name: DOTNET_CLI_TELEMETRY_PROFILE + value: '$(Build.Repository.Uri)' + # Retry signature validation up to three times, waiting 2 seconds between attempts. + # See https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu3028#retry-untrusted-root-failures + - name: NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY + value: 3,2000 + - ${{ each variable in parameters.variables }}: + # handle name-value variable syntax + # example: + # - name: [key] + # value: [value] + - ${{ if ne(variable.name, '') }}: + - name: ${{ variable.name }} + value: ${{ variable.value }} + + # handle variable groups + - ${{ if ne(variable.group, '') }}: + - group: ${{ variable.group }} + + # handle template variable syntax + # example: + # - template: path/to/template.yml + # parameters: + # [key]: [value] + - ${{ if ne(variable.template, '') }}: + - template: ${{ variable.template }} + ${{ if ne(variable.parameters, '') }}: + parameters: ${{ variable.parameters }} + + # handle key-value variable syntax. + # example: + # - [key]: [value] + - ${{ if and(eq(variable.name, ''), eq(variable.group, ''), eq(variable.template, '')) }}: + - ${{ each pair in variable }}: + - name: ${{ pair.key }} + value: ${{ pair.value }} + + # DotNet-HelixApi-Access provides 'HelixApiAccessToken' for internal builds + - ${{ if and(eq(parameters.enableTelemetry, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - group: DotNet-HelixApi-Access + + ${{ if ne(parameters.workspace, '') }}: + workspace: ${{ parameters.workspace }} + + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if ne(parameters.preSteps, '') }}: + - ${{ each preStep in parameters.preSteps }}: + - ${{ preStep }} + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - template: /eng/common/core-templates/steps/install-microbuild.yml + parameters: + enableMicrobuild: ${{ parameters.enableMicrobuild }} + enablePreviewMicrobuild: ${{ parameters.enablePreviewMicrobuild }} + microbuildPluginVersion: ${{ parameters.microbuildPluginVersion }} + enableMicrobuildForMacAndLinux: ${{ parameters.enableMicrobuildForMacAndLinux }} + microbuildUseESRP: ${{ parameters.microbuildUseESRP }} + continueOnError: ${{ parameters.continueOnError }} + + - ${{ if and(eq(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'internal')) }}: + - task: NuGetAuthenticate@1 + + - ${{ if and(ne(parameters.artifacts.download, 'false'), ne(parameters.artifacts.download, '')) }}: + - task: DownloadPipelineArtifact@2 + inputs: + buildType: current + artifactName: ${{ coalesce(parameters.artifacts.download.name, 'Artifacts_$(Agent.OS)_$(_BuildConfig)') }} + targetPath: ${{ coalesce(parameters.artifacts.download.path, 'artifacts') }} + itemPattern: ${{ coalesce(parameters.artifacts.download.pattern, '**') }} + + - ${{ each step in parameters.steps }}: + - ${{ step }} + + - ${{ each step in parameters.componentGovernanceSteps }}: + - ${{ step }} + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - template: /eng/common/core-templates/steps/cleanup-microbuild.yml + parameters: + enableMicrobuild: ${{ parameters.enableMicrobuild }} + enablePreviewMicrobuild: ${{ parameters.enablePreviewMicrobuild }} + microbuildPluginVersion: ${{ parameters.microbuildPluginVersion }} + enableMicrobuildForMacAndLinux: ${{ parameters.enableMicrobuildForMacAndLinux }} + continueOnError: ${{ parameters.continueOnError }} + + # Publish test results + - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'xunit')) }}: + - task: PublishTestResults@2 + displayName: Publish XUnit Test Results + inputs: + testResultsFormat: 'xUnit' + testResultsFiles: '*.xml' + searchFolder: '$(System.DefaultWorkingDirectory)/artifacts/TestResults/$(_BuildConfig)' + testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-xunit + mergeTestResults: ${{ parameters.mergeTestResults }} + continueOnError: true + condition: always() + - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'vstest')) }}: + - task: PublishTestResults@2 + displayName: Publish TRX Test Results + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '*.trx' + searchFolder: '$(System.DefaultWorkingDirectory)/artifacts/TestResults/$(_BuildConfig)' + testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-trx + mergeTestResults: ${{ parameters.mergeTestResults }} + continueOnError: true + condition: always() + + # gather artifacts + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: + - task: CopyFiles@2 + displayName: Gather binaries for publish to artifacts + inputs: + SourceFolder: 'artifacts/bin' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/bin' + - task: CopyFiles@2 + displayName: Gather packages for publish to artifacts + inputs: + SourceFolder: 'artifacts/packages' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/packages' + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: + - task: CopyFiles@2 + displayName: Gather logs for publish to artifacts + inputs: + SourceFolder: 'artifacts/log' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/log' + continueOnError: true + condition: always() + + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - task: CopyFiles@2 + displayName: Gather logs for publish to artifacts + inputs: + SourceFolder: 'artifacts/log/$(_BuildConfig)' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + continueOnError: true + condition: always() + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - task: CopyFiles@2 + displayName: Gather buildconfiguration for build retry + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)/eng/common/BuildConfiguration' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/eng/common/BuildConfiguration' + continueOnError: true + condition: always() + - ${{ each step in parameters.artifactPublishSteps }}: + - ${{ step }} diff --git a/eng/common/core-templates/job/onelocbuild.yml b/eng/common/core-templates/job/onelocbuild.yml new file mode 100644 index 0000000000000..c5788829a872e --- /dev/null +++ b/eng/common/core-templates/job/onelocbuild.yml @@ -0,0 +1,118 @@ +parameters: + # Optional: dependencies of the job + dependsOn: '' + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: '' + + CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex + GithubPat: $(BotAccount-dotnet-bot-repo-PAT) + + SourcesDirectory: $(System.DefaultWorkingDirectory) + CreatePr: true + AutoCompletePr: false + ReusePr: true + UseLfLineEndings: true + UseCheckedInLocProjectJson: false + SkipLocProjectJsonGeneration: false + LanguageSet: VS_Main_Languages + LclSource: lclFilesInRepo + LclPackageId: '' + RepoType: gitHub + GitHubOrg: dotnet + MirrorRepo: '' + MirrorBranch: main + condition: '' + JobNameSuffix: '' + is1ESPipeline: '' +jobs: +- job: OneLocBuild${{ parameters.JobNameSuffix }} + + dependsOn: ${{ parameters.dependsOn }} + + displayName: OneLocBuild${{ parameters.JobNameSuffix }} + + variables: + - group: OneLocBuildVariables # Contains the CeapexPat and GithubPat + - name: _GenerateLocProjectArguments + value: -SourcesDirectory ${{ parameters.SourcesDirectory }} + -LanguageSet "${{ parameters.LanguageSet }}" + -CreateNeutralXlfs + - ${{ if eq(parameters.UseCheckedInLocProjectJson, 'true') }}: + - name: _GenerateLocProjectArguments + value: ${{ variables._GenerateLocProjectArguments }} -UseCheckedInLocProjectJson + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + ${{ if eq(parameters.pool, '') }}: + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022 + os: windows + + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if ne(parameters.SkipLocProjectJsonGeneration, 'true') }}: + - task: Powershell@2 + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/generate-locproject.ps1 + arguments: $(_GenerateLocProjectArguments) + displayName: Generate LocProject.json + condition: ${{ parameters.condition }} + + - task: OneLocBuild@2 + displayName: OneLocBuild + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + inputs: + locProj: eng/Localize/LocProject.json + outDir: $(Build.ArtifactStagingDirectory) + lclSource: ${{ parameters.LclSource }} + lclPackageId: ${{ parameters.LclPackageId }} + isCreatePrSelected: ${{ parameters.CreatePr }} + isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }} + ${{ if eq(parameters.CreatePr, true) }}: + isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }} + isShouldReusePrSelected: ${{ parameters.ReusePr }} + packageSourceAuth: patAuth + patVariable: ${{ parameters.CeapexPat }} + ${{ if eq(parameters.RepoType, 'gitHub') }}: + repoType: ${{ parameters.RepoType }} + gitHubPatVariable: "${{ parameters.GithubPat }}" + ${{ if ne(parameters.MirrorRepo, '') }}: + isMirrorRepoSelected: true + gitHubOrganization: ${{ parameters.GitHubOrg }} + mirrorRepo: ${{ parameters.MirrorRepo }} + mirrorBranch: ${{ parameters.MirrorBranch }} + condition: ${{ parameters.condition }} + + # Copy the locProject.json to the root of the Loc directory, then publish a pipeline artifact + - task: CopyFiles@2 + displayName: Copy LocProject.json + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)/eng/Localize/' + Contents: 'LocProject.json' + TargetFolder: '$(Build.ArtifactStagingDirectory)/loc' + condition: ${{ parameters.condition }} + + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + targetPath: '$(Build.ArtifactStagingDirectory)/loc' + artifactName: 'Loc' + displayName: 'Publish Localization Files' + condition: ${{ parameters.condition }} diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml new file mode 100644 index 0000000000000..8b5c635fe807e --- /dev/null +++ b/eng/common/core-templates/job/publish-build-assets.yml @@ -0,0 +1,221 @@ +parameters: + configuration: 'Debug' + + # Optional: condition for the job to run + condition: '' + + # Optional: 'true' if future jobs should run even if this job fails + continueOnError: false + + # Optional: dependencies of the job + dependsOn: '' + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: {} + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + + # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing + publishAssetsImmediately: false + + artifactsPublishingAdditionalParameters: '' + + signingValidationAdditionalParameters: '' + + is1ESPipeline: '' + + # Optional: 🌤️ or not the build has assets it wants to publish to BAR + isAssetlessBuild: false + + # Optional, publishing version + publishingVersion: 3 + + # Optional: A minimatch pattern for the asset manifests to publish to BAR + assetManifestsPattern: '*/manifests/**/*.xml' + + repositoryAlias: self + + officialBuildId: '' + +jobs: +- job: Asset_Registry_Publish + + dependsOn: ${{ parameters.dependsOn }} + timeoutInMinutes: 150 + + ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: + displayName: Publish Assets + ${{ else }}: + displayName: Publish to Build Asset Registry + + variables: + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - group: Publish-Build-Assets + - group: AzureDevOps-Artifact-Feeds-Pats + - name: runCodesignValidationInjection + value: false + # unconditional - needed for logs publishing (redactor tool version) + - template: /eng/common/core-templates/post-build/common-variables.yml + - name: OfficialBuildId + ${{ if ne(parameters.officialBuildId, '') }}: + value: ${{ parameters.officialBuildId }} + ${{ else }}: + value: $(Build.BuildNumber) + + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Publishing-Internal + image: windows.vs2019.amd64 + os: windows + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - checkout: ${{ parameters.repositoryAlias }} + fetchDepth: 3 + clean: true + + - ${{ if eq(parameters.isAssetlessBuild, 'false') }}: + - ${{ if eq(parameters.publishingVersion, 3) }}: + - task: DownloadPipelineArtifact@2 + displayName: Download Asset Manifests + inputs: + artifactName: AssetManifests + targetPath: '$(Build.StagingDirectory)/AssetManifests' + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + - ${{ if eq(parameters.publishingVersion, 4) }}: + - task: DownloadPipelineArtifact@2 + displayName: Download V4 asset manifests + inputs: + itemPattern: '*/manifests/**/*.xml' + targetPath: '$(Build.StagingDirectory)/AllAssetManifests' + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + - task: CopyFiles@2 + displayName: Copy V4 asset manifests to AssetManifests + inputs: + SourceFolder: '$(Build.StagingDirectory)/AllAssetManifests' + Contents: ${{ parameters.assetManifestsPattern }} + TargetFolder: '$(Build.StagingDirectory)/AssetManifests' + flattenFolders: true + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + + - task: NuGetAuthenticate@1 + + # Populate internal runtime variables. + - template: /eng/common/templates/steps/enable-internal-sources.yml + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + parameters: + legacyCredential: $(dn-bot-dnceng-artifact-feeds-rw) + + - template: /eng/common/templates/steps/enable-internal-runtimes.yml + + - task: AzureCLI@2 + displayName: Publish Build Assets + inputs: + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(System.DefaultWorkingDirectory)/eng/common/sdk-task.ps1 + arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet + /p:ManifestsPath='$(Build.StagingDirectory)/AssetManifests' + /p:IsAssetlessBuild=${{ parameters.isAssetlessBuild }} + /p:MaestroApiEndpoint=https://maestro.dot.net + /p:OfficialBuildId=$(OfficialBuildId) + -runtimeSourceFeed https://ci.dot.net/internal + -runtimeSourceFeedKey '$(dotnetbuilds-internal-container-read-token-base64)' + + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + + - task: powershell@2 + displayName: Create ReleaseConfigs Artifact + inputs: + targetType: inline + script: | + New-Item -Path "$(Build.StagingDirectory)/ReleaseConfigs" -ItemType Directory -Force + $filePath = "$(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt" + Add-Content -Path $filePath -Value $(BARBuildId) + Add-Content -Path $filePath -Value "$(DefaultChannels)" + Add-Content -Path $filePath -Value $(IsStableBuild) + + $symbolExclusionfile = "$(System.DefaultWorkingDirectory)/eng/SymbolPublishingExclusionsFile.txt" + if (Test-Path -Path $symbolExclusionfile) + { + Write-Host "SymbolExclusionFile exists" + Copy-Item -Path $symbolExclusionfile -Destination "$(Build.StagingDirectory)/ReleaseConfigs" + } + + - ${{ if eq(parameters.publishingVersion, 4) }}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + targetPath: '$(Build.ArtifactStagingDirectory)/MergedManifest.xml' + artifactName: AssetManifests + displayName: 'Publish Merged Manifest' + retryCountOnTaskFailure: 10 # for any logs being locked + sbomEnabled: false # we don't need SBOM for logs + + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish ReleaseConfigs Artifact + pathToPublish: '$(Build.StagingDirectory)/ReleaseConfigs' + publishLocation: Container + artifactName: ReleaseConfigs + + - ${{ if or(eq(parameters.publishAssetsImmediately, 'true'), eq(parameters.isAssetlessBuild, 'true')) }}: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + # Darc is targeting 8.0, so make sure it's installed + - task: UseDotNet@2 + inputs: + version: 8.0.x + + - task: AzureCLI@2 + displayName: Publish Using Darc + inputs: + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(System.DefaultWorkingDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: > + -BuildId $(BARBuildId) + -PublishingInfraVersion 3 + -AzdoToken '$(System.AccessToken)' + -WaitPublishingFinish true + -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' + -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' + -SkipAssetsPublishing '${{ parameters.isAssetlessBuild }}' + -runtimeSourceFeed https://ci.dot.net/internal + -runtimeSourceFeedKey '$(dotnetbuilds-internal-container-read-token-base64)' + + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - template: /eng/common/core-templates/steps/publish-logs.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + JobLabel: 'Publish_Artifacts_Logs' diff --git a/eng/common/core-templates/job/source-build.yml b/eng/common/core-templates/job/source-build.yml new file mode 100644 index 0000000000000..9d820f9742117 --- /dev/null +++ b/eng/common/core-templates/job/source-build.yml @@ -0,0 +1,96 @@ +parameters: + # This template adds arcade-powered source-build to CI. The template produces a server job with a + # default ID 'Source_Build_Complete' to put in a dependency list if necessary. + + # Specifies the prefix for source-build jobs added to pipeline. Use this if disambiguation needed. + jobNamePrefix: 'Source_Build' + + # Defines the platform on which to run the job. By default, a linux-x64 machine, suitable for + # managed-only repositories. This is an object with these properties: + # + # name: '' + # The name of the job. This is included in the job ID. + # targetRID: '' + # The name of the target RID to use, instead of the one auto-detected by Arcade. + # portableBuild: false + # Enables non-portable mode. This means a more specific RID (e.g. fedora.32-x64 rather than + # linux-x64), and compiling against distro-provided packages rather than portable ones. The + # default is portable mode. + # skipPublishValidation: false + # Disables publishing validation. By default, a check is performed to ensure no packages are + # published by source-build. + # container: '' + # A container to use. Runs in docker. + # pool: {} + # A pool to use. Runs directly on an agent. + # buildScript: '' + # Specifies the build script to invoke to perform the build in the repo. The default + # './build.sh' should work for typical Arcade repositories, but this is customizable for + # difficult situations. + # buildArguments: '' + # Specifies additional build arguments to pass to the build script. + # jobProperties: {} + # A list of job properties to inject at the top level, for potential extensibility beyond + # container and pool. + platform: {} + + is1ESPipeline: '' + + # If set to true and running on a non-public project, + # Internal nuget and blob storage locations will be enabled. + # This is not enabled by default because many repositories do not need internal sources + # and do not need to have the required service connections approved in the pipeline. + enableInternalSources: false + +jobs: +- job: ${{ parameters.jobNamePrefix }}_${{ parameters.platform.name }} + displayName: Source-Build (${{ parameters.platform.name }}) + + ${{ each property in parameters.platform.jobProperties }}: + ${{ property.key }}: ${{ property.value }} + + ${{ if ne(parameters.platform.container, '') }}: + container: ${{ parameters.platform.container }} + + ${{ if eq(parameters.platform.pool, '') }}: + # The default VM host AzDO pool. This should be capable of running Docker containers: almost all + # source-build builds run in Docker, including the default managed platform. + # /eng/common/core-templates/variables/pool-providers.yml can't be used here (some customers declare variables already), so duplicate its logic + ${{ if eq(parameters.is1ESPipeline, 'true') }}: + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore-Svc-Public' ), False, 'NetCore-Public')] + demands: ImageOverride -equals build.ubuntu.2204.amd64 + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore1ESPool-Svc-Internal'), False, 'NetCore1ESPool-Internal')] + image: 1es-azurelinux-3 + os: linux + ${{ else }}: + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore-Svc-Public' ), False, 'NetCore-Public')] + demands: ImageOverride -equals Build.Ubuntu.2204.Amd64.Open + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore1ESPool-Svc-Internal'), False, 'NetCore1ESPool-Internal')] + demands: ImageOverride -equals Build.Ubuntu.2204.Amd64 + ${{ if ne(parameters.platform.pool, '') }}: + pool: ${{ parameters.platform.pool }} + + workspace: + clean: all + + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if eq(parameters.enableInternalSources, true) }}: + - template: /eng/common/core-templates/steps/enable-internal-sources.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + - template: /eng/common/core-templates/steps/enable-internal-runtimes.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + - template: /eng/common/core-templates/steps/source-build.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + platform: ${{ parameters.platform }} diff --git a/eng/common/core-templates/job/source-index-stage1.yml b/eng/common/core-templates/job/source-index-stage1.yml new file mode 100644 index 0000000000000..76baf5c27258f --- /dev/null +++ b/eng/common/core-templates/job/source-index-stage1.yml @@ -0,0 +1,44 @@ +parameters: + runAsPublic: false + sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" + preSteps: [] + binlogPath: artifacts/log/Debug/Build.binlog + condition: eq(variables['Build.SourceBranch'], 'refs/heads/main') + dependsOn: '' + pool: '' + is1ESPipeline: '' + +jobs: +- job: SourceIndexStage1 + dependsOn: ${{ parameters.dependsOn }} + condition: ${{ parameters.condition }} + variables: + - name: BinlogPath + value: ${{ parameters.binlogPath }} + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + ${{ if eq(parameters.pool, '') }}: + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: $(DncEngPublicBuildPool) + image: windows.vs2026preview.scout.amd64.open + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: $(DncEngInternalBuildPool) + image: windows.vs2026preview.scout.amd64 + + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ each preStep in parameters.preSteps }}: + - ${{ preStep }} + - script: ${{ parameters.sourceIndexBuildCommand }} + displayName: Build Repository + + - template: /eng/common/core-templates/steps/source-index-stage1-publish.yml + parameters: + binLogPath: ${{ parameters.binLogPath }} diff --git a/eng/common/core-templates/jobs/codeql-build.yml b/eng/common/core-templates/jobs/codeql-build.yml new file mode 100644 index 0000000000000..dbc14ac580a27 --- /dev/null +++ b/eng/common/core-templates/jobs/codeql-build.yml @@ -0,0 +1,32 @@ +parameters: + # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md + continueOnError: false + # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + jobs: [] + # Optional: if specified, restore and use this version of Guardian instead of the default. + overrideGuardianVersion: '' + is1ESPipeline: '' + +jobs: +- template: /eng/common/core-templates/jobs/jobs.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + enableMicrobuild: false + enablePublishBuildArtifacts: false + enablePublishTestResults: false + enablePublishBuildAssets: false + enableTelemetry: true + + variables: + - group: Publish-Build-Assets + # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in + # sync with the packages.config file. + - name: DefaultGuardianVersion + value: 0.109.0 + - name: GuardianPackagesConfigFile + value: $(System.DefaultWorkingDirectory)\eng\common\sdl\packages.config + - name: GuardianVersion + value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} + + jobs: ${{ parameters.jobs }} + diff --git a/eng/common/core-templates/jobs/jobs.yml b/eng/common/core-templates/jobs/jobs.yml new file mode 100644 index 0000000000000..01ada74766514 --- /dev/null +++ b/eng/common/core-templates/jobs/jobs.yml @@ -0,0 +1,120 @@ +parameters: + # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md + continueOnError: false + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: Enable running the source-build jobs to build repo from source + enableSourceBuild: false + + # Optional: Parameters for source-build template. + # See /eng/common/core-templates/jobs/source-build.yml for options + sourceBuildParameters: [] + + graphFileGeneration: + # Optional: Enable generating the graph files at the end of the build + enabled: false + # Optional: Include toolset dependencies in the generated graph files + includeToolset: false + + # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + jobs: [] + + # Optional: Override automatically derived dependsOn value for "publish build assets" job + publishBuildAssetsDependsOn: '' + + # Optional: Publish the assets as soon as the publish to BAR stage is complete, rather doing so in a separate stage. + publishAssetsImmediately: false + + # Optional: 🌤️ or not the build has assets it wants to publish to BAR + isAssetlessBuild: false + + # Optional: If using publishAssetsImmediately and additional parameters are needed, can be used to send along additional parameters (normally sent to post-build.yml) + artifactsPublishingAdditionalParameters: '' + signingValidationAdditionalParameters: '' + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + + enableSourceIndex: false + sourceIndexParams: {} + + artifacts: {} + is1ESPipeline: '' + repositoryAlias: self + officialBuildId: '' + +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + +jobs: +- ${{ each job in parameters.jobs }}: + - ${{ if eq(parameters.is1ESPipeline, 'true') }}: + - template: /eng/common/templates-official/job/job.yml + parameters: + # pass along parameters + ${{ each parameter in parameters }}: + ${{ if ne(parameter.key, 'jobs') }}: + ${{ parameter.key }}: ${{ parameter.value }} + + # pass along job properties + ${{ each property in job }}: + ${{ if ne(property.key, 'job') }}: + ${{ property.key }}: ${{ property.value }} + + name: ${{ job.job }} + + - ${{ else }}: + - template: /eng/common/templates/job/job.yml + parameters: + # pass along parameters + ${{ each parameter in parameters }}: + ${{ if ne(parameter.key, 'jobs') }}: + ${{ parameter.key }}: ${{ parameter.value }} + + # pass along job properties + ${{ each property in job }}: + ${{ if ne(property.key, 'job') }}: + ${{ property.key }}: ${{ property.value }} + + name: ${{ job.job }} + +- ${{ if eq(parameters.enableSourceBuild, true) }}: + - template: /eng/common/core-templates/jobs/source-build.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + ${{ each parameter in parameters.sourceBuildParameters }}: + ${{ parameter.key }}: ${{ parameter.value }} + +- ${{ if eq(parameters.enableSourceIndex, 'true') }}: + - template: ../job/source-index-stage1.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + runAsPublic: ${{ parameters.runAsPublic }} + ${{ each parameter in parameters.sourceIndexParams }}: + ${{ parameter.key }}: ${{ parameter.value }} + +- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if or(eq(parameters.enablePublishBuildAssets, true), eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, ''), eq(parameters.isAssetlessBuild, true)) }}: + - template: ../job/publish-build-assets.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + continueOnError: ${{ parameters.continueOnError }} + dependsOn: + - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.publishBuildAssetsDependsOn }}: + - ${{ job.job }} + - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.jobs }}: + - ${{ job.job }} + + runAsPublic: ${{ parameters.runAsPublic }} + publishAssetsImmediately: ${{ or(parameters.publishAssetsImmediately, parameters.isAssetlessBuild) }} + isAssetlessBuild: ${{ parameters.isAssetlessBuild }} + enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + signingValidationAdditionalParameters: ${{ parameters.signingValidationAdditionalParameters }} + repositoryAlias: ${{ parameters.repositoryAlias }} + officialBuildId: ${{ parameters.officialBuildId }} diff --git a/eng/common/core-templates/jobs/source-build.yml b/eng/common/core-templates/jobs/source-build.yml new file mode 100644 index 0000000000000..d92860cba2087 --- /dev/null +++ b/eng/common/core-templates/jobs/source-build.yml @@ -0,0 +1,42 @@ +parameters: + # This template adds arcade-powered source-build to CI. A job is created for each platform, as + # well as an optional server job that completes when all platform jobs complete. + + # See /eng/common/core-templates/job/source-build.yml + jobNamePrefix: 'Source_Build' + + # This is the default platform provided by Arcade, intended for use by a managed-only repo. + defaultManagedPlatform: + name: 'Managed' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream-10-amd64' + + # Defines the platforms on which to run build jobs. One job is created for each platform, and the + # object in this array is sent to the job template as 'platform'. If no platforms are specified, + # one job runs on 'defaultManagedPlatform'. + platforms: [] + + is1ESPipeline: '' + + # If set to true and running on a non-public project, + # Internal nuget and blob storage locations will be enabled. + # This is not enabled by default because many repositories do not need internal sources + # and do not need to have the required service connections approved in the pipeline. + enableInternalSources: false + +jobs: + +- ${{ each platform in parameters.platforms }}: + - template: /eng/common/core-templates/job/source-build.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + jobNamePrefix: ${{ parameters.jobNamePrefix }} + platform: ${{ platform }} + enableInternalSources: ${{ parameters.enableInternalSources }} + +- ${{ if eq(length(parameters.platforms), 0) }}: + - template: /eng/common/core-templates/job/source-build.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + jobNamePrefix: ${{ parameters.jobNamePrefix }} + platform: ${{ parameters.defaultManagedPlatform }} + enableInternalSources: ${{ parameters.enableInternalSources }} diff --git a/eng/common/core-templates/post-build/common-variables.yml b/eng/common/core-templates/post-build/common-variables.yml new file mode 100644 index 0000000000000..d5627a994ae58 --- /dev/null +++ b/eng/common/core-templates/post-build/common-variables.yml @@ -0,0 +1,22 @@ +variables: + - group: Publish-Build-Assets + + # Whether the build is internal or not + - name: IsInternalBuild + value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} + + # Default Maestro++ API Endpoint and API Version + - name: MaestroApiEndPoint + value: "https://maestro.dot.net" + - name: MaestroApiVersion + value: "2020-02-20" + + - name: SourceLinkCLIVersion + value: 3.0.0 + - name: SymbolToolVersion + value: 1.0.1 + - name: BinlogToolVersion + value: 1.0.11 + + - name: runCodesignValidationInjection + value: false diff --git a/eng/common/core-templates/post-build/post-build.yml b/eng/common/core-templates/post-build/post-build.yml new file mode 100644 index 0000000000000..06864cd1feb8e --- /dev/null +++ b/eng/common/core-templates/post-build/post-build.yml @@ -0,0 +1,338 @@ +parameters: +# Which publishing infra should be used. THIS SHOULD MATCH THE VERSION ON THE BUILD MANIFEST. +# Publishing V1 is no longer supported +# Publishing V2 is no longer supported +# Publishing V3 is the default +- name: publishingInfraVersion + displayName: Which version of publishing should be used to promote the build definition? + type: number + default: 3 + values: + - 3 + +- name: BARBuildId + displayName: BAR Build Id + type: number + default: 0 + +- name: PromoteToChannelIds + displayName: Channel to promote BARBuildId to + type: string + default: '' + +- name: enableSourceLinkValidation + displayName: Enable SourceLink validation + type: boolean + default: false + +- name: enableSigningValidation + displayName: Enable signing validation + type: boolean + default: true + +- name: enableSymbolValidation + displayName: Enable symbol validation + type: boolean + default: false + +- name: enableNugetValidation + displayName: Enable NuGet validation + type: boolean + default: true + +- name: publishInstallersAndChecksums + displayName: Publish installers and checksums + type: boolean + default: true + +- name: requireDefaultChannels + displayName: Fail the build if there are no default channel(s) registrations for the current build + type: boolean + default: false + +- name: SDLValidationParameters + type: object + default: + enable: false + publishGdn: false + continueOnError: false + params: '' + artifactNames: '' + downloadArtifacts: true + +- name: isAssetlessBuild + type: boolean + displayName: Is Assetless Build + default: false + +# These parameters let the user customize the call to sdk-task.ps1 for publishing +# symbols & general artifacts as well as for signing validation +- name: symbolPublishingAdditionalParameters + displayName: Symbol publishing additional parameters + type: string + default: '' + +- name: artifactsPublishingAdditionalParameters + displayName: Artifact publishing additional parameters + type: string + default: '' + +- name: signingValidationAdditionalParameters + displayName: Signing validation additional parameters + type: string + default: '' + +# Which stages should finish execution before post-build stages start +- name: validateDependsOn + type: object + default: + - build + +- name: publishDependsOn + type: object + default: + - Validate + +# Optional: Call asset publishing rather than running in a separate stage +- name: publishAssetsImmediately + type: boolean + default: false + +- name: is1ESPipeline + type: boolean + default: false + +stages: +- ${{ if or(eq( parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: + - stage: Validate + dependsOn: ${{ parameters.validateDependsOn }} + displayName: Validate Build Assets + variables: + - template: /eng/common/core-templates/post-build/common-variables.yml + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + jobs: + - job: + displayName: NuGet Validation + condition: and(succeededOrFailed(), eq( ${{ parameters.enableNugetValidation }}, 'true')) + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: + name: $(DncEngInternalBuildPool) + image: windows.vs2026preview.scout.amd64 + os: windows + ${{ else }}: + name: $(DncEngInternalBuildPool) + demands: ImageOverride -equals windows.vs2026preview.scout.amd64 + + steps: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/post-build/nuget-validation.ps1 + arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ + + - job: + displayName: Signing Validation + condition: and( eq( ${{ parameters.enableSigningValidation }}, 'true'), ne( variables['PostBuildSign'], 'true')) + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022 + os: windows + ${{ else }}: + name: $(DncEngInternalBuildPool) + demands: ImageOverride -equals windows.vs2026preview.scout.amd64 + steps: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true + + # This is necessary whenever we want to publish/restore to an AzDO private feed + # Since sdk-task.ps1 tries to restore packages we need to do this authentication here + # otherwise it'll complain about accessing a private feed. + - task: NuGetAuthenticate@1 + displayName: 'Authenticate to AzDO Feeds' + + # Signing validation will optionally work with the buildmanifest file which is downloaded from + # Azure DevOps above. + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task SigningValidation -restore -msbuildEngine vs + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' + /p:SignCheckExclusionsFile='$(System.DefaultWorkingDirectory)/eng/SignCheckExclusionsFile.txt' + ${{ parameters.signingValidationAdditionalParameters }} + + - template: /eng/common/core-templates/steps/publish-logs.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + StageLabel: 'Validation' + JobLabel: 'Signing' + BinlogToolVersion: $(BinlogToolVersion) + + - job: + displayName: SourceLink Validation + condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022 + os: windows + ${{ else }}: + name: $(DncEngInternalBuildPool) + demands: ImageOverride -equals windows.vs2026preview.scout.amd64 + steps: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: BlobArtifacts + checkDownloadedFiles: true + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/post-build/sourcelink-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -ExtractPath $(Agent.BuildDirectory)/Extract/ + -GHRepoName $(Build.Repository.Name) + -GHCommit $(Build.SourceVersion) + -SourcelinkCliVersion $(SourceLinkCLIVersion) + continueOnError: true + +- ${{ if ne(parameters.publishAssetsImmediately, 'true') }}: + - stage: publish_using_darc + ${{ if or(eq(parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: + dependsOn: ${{ parameters.publishDependsOn }} + ${{ else }}: + dependsOn: ${{ parameters.validateDependsOn }} + displayName: Publish using Darc + variables: + - template: /eng/common/core-templates/post-build/common-variables.yml + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + jobs: + - job: + displayName: Publish Using Darc + timeoutInMinutes: 120 + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: + name: NetCore1ESPool-Publishing-Internal + image: windows.vs2019.amd64 + os: windows + ${{ else }}: + name: NetCore1ESPool-Publishing-Internal + demands: ImageOverride -equals windows.vs2019.amd64 + steps: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: NuGetAuthenticate@1 + + # Populate internal runtime variables. + - template: /eng/common/templates/steps/enable-internal-sources.yml + parameters: + legacyCredential: $(dn-bot-dnceng-artifact-feeds-rw) + + - template: /eng/common/templates/steps/enable-internal-runtimes.yml + + - task: UseDotNet@2 + inputs: + version: 8.0.x + + - task: AzureCLI@2 + displayName: Publish Using Darc + inputs: + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(System.DefaultWorkingDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: > + -BuildId $(BARBuildId) + -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} + -AzdoToken '$(System.AccessToken)' + -WaitPublishingFinish true + -RequireDefaultChannels ${{ parameters.requireDefaultChannels }} + -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' + -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' + -SkipAssetsPublishing '${{ parameters.isAssetlessBuild }}' + -runtimeSourceFeed https://ci.dot.net/internal + -runtimeSourceFeedKey '$(dotnetbuilds-internal-container-read-token-base64)' diff --git a/eng/common/core-templates/post-build/setup-maestro-vars.yml b/eng/common/core-templates/post-build/setup-maestro-vars.yml new file mode 100644 index 0000000000000..a7abd58c4bb60 --- /dev/null +++ b/eng/common/core-templates/post-build/setup-maestro-vars.yml @@ -0,0 +1,74 @@ +parameters: + BARBuildId: '' + PromoteToChannelIds: '' + is1ESPipeline: '' + +steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if eq(coalesce(parameters.PromoteToChannelIds, 0), 0) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Release Configs + inputs: + buildType: current + artifactName: ReleaseConfigs + checkDownloadedFiles: true + + - task: AzureCLI@2 + name: setReleaseVars + displayName: Set Release Configs Vars + inputs: + azureSubscription: "Darc: Maestro Production" + scriptType: pscore + scriptLocation: inlineScript + inlineScript: | + try { + if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { + $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt + + $BarId = $Content | Select -Index 0 + $Channels = $Content | Select -Index 1 + $IsStableBuild = $Content | Select -Index 2 + + $AzureDevOpsProject = $Env:System_TeamProject + $AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId + $AzureDevOpsBuildId = $Env:Build_BuildId + } + else { + . $(System.DefaultWorkingDirectory)\eng\common\tools.ps1 + $darc = Get-Darc + $buildInfo = & $darc get-build ` + --id ${{ parameters.BARBuildId }} ` + --extended ` + --output-format json ` + --ci ` + | convertFrom-Json + + $BarId = ${{ parameters.BARBuildId }} + $Channels = $Env:PromoteToMaestroChannels -split "," + $Channels = $Channels -join "][" + $Channels = "[$Channels]" + + $IsStableBuild = $buildInfo.stable + $AzureDevOpsProject = $buildInfo.azureDevOpsProject + $AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId + $AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId + } + + Write-Host "##vso[task.setvariable variable=BARBuildId]$BarId" + Write-Host "##vso[task.setvariable variable=TargetChannels]$Channels" + Write-Host "##vso[task.setvariable variable=IsStableBuild]$IsStableBuild" + + Write-Host "##vso[task.setvariable variable=AzDOProjectName]$AzureDevOpsProject" + Write-Host "##vso[task.setvariable variable=AzDOPipelineId]$AzureDevOpsBuildDefinitionId" + Write-Host "##vso[task.setvariable variable=AzDOBuildId]$AzureDevOpsBuildId" + } + catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + exit 1 + } + env: + PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} diff --git a/eng/common/core-templates/steps/cleanup-microbuild.yml b/eng/common/core-templates/steps/cleanup-microbuild.yml new file mode 100644 index 0000000000000..c0fdcd3379d73 --- /dev/null +++ b/eng/common/core-templates/steps/cleanup-microbuild.yml @@ -0,0 +1,28 @@ +parameters: + # Enable cleanup tasks for MicroBuild + enableMicrobuild: false + # Enable cleanup tasks for MicroBuild on Mac and Linux + # Will be ignored if 'enableMicrobuild' is false or 'Agent.Os' is 'Windows_NT' + enableMicrobuildForMacAndLinux: false + continueOnError: false + +steps: + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - task: MicroBuildCleanup@1 + displayName: Execute Microbuild cleanup tasks + condition: and( + always(), + or( + and( + eq(variables['Agent.Os'], 'Windows_NT'), + in(variables['_SignType'], 'real', 'test') + ), + and( + ${{ eq(parameters.enableMicrobuildForMacAndLinux, true) }}, + ne(variables['Agent.Os'], 'Windows_NT'), + eq(variables['_SignType'], 'real') + ) + )) + continueOnError: ${{ parameters.continueOnError }} + env: + TeamName: $(_TeamName) diff --git a/eng/common/core-templates/steps/component-governance.yml b/eng/common/core-templates/steps/component-governance.yml new file mode 100644 index 0000000000000..cf0649aa95653 --- /dev/null +++ b/eng/common/core-templates/steps/component-governance.yml @@ -0,0 +1,16 @@ +parameters: + disableComponentGovernance: false + componentGovernanceIgnoreDirectories: '' + is1ESPipeline: false + displayName: 'Component Detection' + +steps: +- ${{ if eq(parameters.disableComponentGovernance, 'true') }}: + - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" + displayName: Set skipComponentGovernanceDetection variable +- ${{ if ne(parameters.disableComponentGovernance, 'true') }}: + - task: ComponentGovernanceComponentDetection@0 + continueOnError: true + displayName: ${{ parameters.displayName }} + inputs: + ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} diff --git a/eng/common/core-templates/steps/enable-internal-runtimes.yml b/eng/common/core-templates/steps/enable-internal-runtimes.yml new file mode 100644 index 0000000000000..6bdbf62ac500f --- /dev/null +++ b/eng/common/core-templates/steps/enable-internal-runtimes.yml @@ -0,0 +1,32 @@ +# Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64' +# variable with the base64-encoded SAS token, by default + +parameters: +- name: federatedServiceConnection + type: string + default: 'dotnetbuilds-internal-read' +- name: outputVariableName + type: string + default: 'dotnetbuilds-internal-container-read-token-base64' +- name: expiryInHours + type: number + default: 1 +- name: base64Encode + type: boolean + default: true +- name: is1ESPipeline + type: boolean + default: false + +steps: +- ${{ if ne(variables['System.TeamProject'], 'public') }}: + - template: /eng/common/core-templates/steps/get-delegation-sas.yml + parameters: + federatedServiceConnection: ${{ parameters.federatedServiceConnection }} + outputVariableName: ${{ parameters.outputVariableName }} + expiryInHours: ${{ parameters.expiryInHours }} + base64Encode: ${{ parameters.base64Encode }} + storageAccount: dotnetbuilds + container: internal + permissions: rl + is1ESPipeline: ${{ parameters.is1ESPipeline }} \ No newline at end of file diff --git a/eng/common/core-templates/steps/enable-internal-sources.yml b/eng/common/core-templates/steps/enable-internal-sources.yml new file mode 100644 index 0000000000000..4085512b69091 --- /dev/null +++ b/eng/common/core-templates/steps/enable-internal-sources.yml @@ -0,0 +1,47 @@ +parameters: +# This is the Azure federated service connection that we log into to get an access token. +- name: nugetFederatedServiceConnection + type: string + default: 'dnceng-artifacts-feeds-read' +- name: is1ESPipeline + type: boolean + default: false +# Legacy parameters to allow for PAT usage +- name: legacyCredential + type: string + default: '' + +steps: +- ${{ if ne(variables['System.TeamProject'], 'public') }}: + - ${{ if ne(parameters.legacyCredential, '') }}: + - task: PowerShell@2 + displayName: Setup Internal Feeds + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $Env:Token + env: + Token: ${{ parameters.legacyCredential }} + # If running on dnceng (internal project), just use the default behavior for NuGetAuthenticate. + # If running on DevDiv, NuGetAuthenticate is not really an option. It's scoped to a single feed, and we have many feeds that + # may be added. Instead, we'll use the traditional approach (add cred to nuget.config), but use an account token. + - ${{ else }}: + - ${{ if eq(variables['System.TeamProject'], 'internal') }}: + - task: PowerShell@2 + displayName: Setup Internal Feeds + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config + - ${{ else }}: + - template: /eng/common/templates/steps/get-federated-access-token.yml + parameters: + federatedServiceConnection: ${{ parameters.nugetFederatedServiceConnection }} + outputVariableName: 'dnceng-artifacts-feeds-read-access-token' + - task: PowerShell@2 + displayName: Setup Internal Feeds + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $(dnceng-artifacts-feeds-read-access-token) + # This is required in certain scenarios to install the ADO credential provider. + # It installed by default in some msbuild invocations (e.g. VS msbuild), but needs to be installed for others + # (e.g. dotnet msbuild). + - task: NuGetAuthenticate@1 diff --git a/eng/common/core-templates/steps/generate-sbom.yml b/eng/common/core-templates/steps/generate-sbom.yml new file mode 100644 index 0000000000000..003f7eae0fa5c --- /dev/null +++ b/eng/common/core-templates/steps/generate-sbom.yml @@ -0,0 +1,54 @@ +# BuildDropPath - The root folder of the drop directory for which the manifest file will be generated. +# PackageName - The name of the package this SBOM represents. +# PackageVersion - The version of the package this SBOM represents. +# ManifestDirPath - The path of the directory where the generated manifest files will be placed +# IgnoreDirectories - Directories to ignore for SBOM generation. This will be passed through to the CG component detector. + +parameters: + PackageVersion: 11.0.0 + BuildDropPath: '$(System.DefaultWorkingDirectory)/artifacts' + PackageName: '.NET' + ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom + IgnoreDirectories: '' + sbomContinueOnError: true + is1ESPipeline: false + # disable publishArtifacts if some other step is publishing the artifacts (like job.yml). + publishArtifacts: true + +steps: +- task: PowerShell@2 + displayName: Prep for SBOM generation in (Non-linux) + condition: or(eq(variables['Agent.Os'], 'Windows_NT'), eq(variables['Agent.Os'], 'Darwin')) + inputs: + filePath: ./eng/common/generate-sbom-prep.ps1 + arguments: ${{parameters.manifestDirPath}} + +# Chmodding is a workaround for https://github.com/dotnet/arcade/issues/8461 +- script: | + chmod +x ./eng/common/generate-sbom-prep.sh + ./eng/common/generate-sbom-prep.sh ${{parameters.manifestDirPath}} + displayName: Prep for SBOM generation in (Linux) + condition: eq(variables['Agent.Os'], 'Linux') + continueOnError: ${{ parameters.sbomContinueOnError }} + +- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 + displayName: 'Generate SBOM manifest' + continueOnError: ${{ parameters.sbomContinueOnError }} + inputs: + PackageName: ${{ parameters.packageName }} + BuildDropPath: ${{ parameters.buildDropPath }} + PackageVersion: ${{ parameters.packageVersion }} + ManifestDirPath: ${{ parameters.manifestDirPath }}/$(ARTIFACT_NAME) + ${{ if ne(parameters.IgnoreDirectories, '') }}: + AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}' + +- ${{ if eq(parameters.publishArtifacts, 'true')}}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish SBOM manifest + continueOnError: ${{parameters.sbomContinueOnError}} + targetPath: '${{ parameters.manifestDirPath }}' + artifactName: $(ARTIFACT_NAME) + diff --git a/eng/common/core-templates/steps/get-delegation-sas.yml b/eng/common/core-templates/steps/get-delegation-sas.yml new file mode 100644 index 0000000000000..d2901470a7f0b --- /dev/null +++ b/eng/common/core-templates/steps/get-delegation-sas.yml @@ -0,0 +1,46 @@ +parameters: +- name: federatedServiceConnection + type: string +- name: outputVariableName + type: string +- name: expiryInHours + type: number + default: 1 +- name: base64Encode + type: boolean + default: false +- name: storageAccount + type: string +- name: container + type: string +- name: permissions + type: string + default: 'rl' +- name: is1ESPipeline + type: boolean + default: false + +steps: +- task: AzureCLI@2 + displayName: 'Generate delegation SAS Token for ${{ parameters.storageAccount }}/${{ parameters.container }}' + inputs: + azureSubscription: ${{ parameters.federatedServiceConnection }} + scriptType: 'pscore' + scriptLocation: 'inlineScript' + inlineScript: | + # Calculate the expiration of the SAS token and convert to UTC + $expiry = (Get-Date).AddHours(${{ parameters.expiryInHours }}).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") + + $sas = az storage container generate-sas --account-name ${{ parameters.storageAccount }} --name ${{ parameters.container }} --permissions ${{ parameters.permissions }} --expiry $expiry --auth-mode login --as-user -o tsv + + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to generate SAS token." + exit 1 + } + + if ('${{ parameters.base64Encode }}' -eq 'true') { + $sas = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($sas)) + } + + Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" + Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true]$sas" diff --git a/eng/common/core-templates/steps/get-federated-access-token.yml b/eng/common/core-templates/steps/get-federated-access-token.yml new file mode 100644 index 0000000000000..3a4d4410c4829 --- /dev/null +++ b/eng/common/core-templates/steps/get-federated-access-token.yml @@ -0,0 +1,42 @@ +parameters: +- name: federatedServiceConnection + type: string +- name: outputVariableName + type: string +- name: is1ESPipeline + type: boolean +- name: stepName + type: string + default: 'getFederatedAccessToken' +- name: condition + type: string + default: '' +# Resource to get a token for. Common values include: +# - '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps +# - 'https://storage.azure.com/' for storage +# Defaults to Azure DevOps +- name: resource + type: string + default: '499b84ac-1321-427f-aa17-267ca6975798' +- name: isStepOutputVariable + type: boolean + default: false + +steps: +- task: AzureCLI@2 + displayName: 'Getting federated access token for feeds' + name: ${{ parameters.stepName }} + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} + inputs: + azureSubscription: ${{ parameters.federatedServiceConnection }} + scriptType: 'pscore' + scriptLocation: 'inlineScript' + inlineScript: | + $accessToken = az account get-access-token --query accessToken --resource ${{ parameters.resource }} --output tsv + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to get access token for resource '${{ parameters.resource }}'" + exit 1 + } + Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" + Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true;isOutput=${{ parameters.isStepOutputVariable }}]$accessToken" \ No newline at end of file diff --git a/eng/common/core-templates/steps/install-microbuild-impl.yml b/eng/common/core-templates/steps/install-microbuild-impl.yml new file mode 100644 index 0000000000000..b9e0143ee92ad --- /dev/null +++ b/eng/common/core-templates/steps/install-microbuild-impl.yml @@ -0,0 +1,34 @@ +parameters: + - name: microbuildTaskInputs + type: object + default: {} + + - name: microbuildEnv + type: object + default: {} + + - name: enablePreviewMicrobuild + type: boolean + default: false + + - name: condition + type: string + + - name: continueOnError + type: boolean + +steps: +- ${{ if eq(parameters.enablePreviewMicrobuild, 'true') }}: + - task: MicroBuildSigningPluginPreview@4 + displayName: Install Preview MicroBuild plugin + inputs: ${{ parameters.microbuildTaskInputs }} + env: ${{ parameters.microbuildEnv }} + continueOnError: ${{ parameters.continueOnError }} + condition: ${{ parameters.condition }} +- ${{ else }}: + - task: MicroBuildSigningPlugin@4 + displayName: Install MicroBuild plugin + inputs: ${{ parameters.microbuildTaskInputs }} + env: ${{ parameters.microbuildEnv }} + continueOnError: ${{ parameters.continueOnError }} + condition: ${{ parameters.condition }} diff --git a/eng/common/core-templates/steps/install-microbuild.yml b/eng/common/core-templates/steps/install-microbuild.yml new file mode 100644 index 0000000000000..4f4b56ed2a6bb --- /dev/null +++ b/eng/common/core-templates/steps/install-microbuild.yml @@ -0,0 +1,118 @@ +parameters: + # Enable install tasks for MicroBuild + enableMicrobuild: false + # Enable install tasks for MicroBuild on Mac and Linux + # Will be ignored if 'enableMicrobuild' is false or 'Agent.Os' is 'Windows_NT' + enableMicrobuildForMacAndLinux: false + # Enable preview version of MB signing plugin + enablePreviewMicrobuild: false + # Determines whether the ESRP service connection information should be passed to the signing plugin. + # This overlaps with _SignType to some degree. We only need the service connection for real signing. + # It's important that the service connection not be passed to the MicroBuildSigningPlugin task in this place. + # Doing so will cause the service connection to be authorized for the pipeline, which isn't allowed and won't work for non-prod. + # Unfortunately, _SignType can't be used to exclude the use of the service connection in non-real sign scenarios. The + # variable is not available in template expression. _SignType has a very large proliferation across .NET, so replacing it is tough. + microbuildUseESRP: true + # Microbuild installation directory + microBuildOutputFolder: $(Agent.TempDirectory)/MicroBuild + # Microbuild version + microbuildPluginVersion: 'latest' + + continueOnError: false + +steps: + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - ${{ if eq(parameters.enableMicrobuildForMacAndLinux, 'true') }}: + # Needed to download the MicroBuild plugin nupkgs on Mac and Linux when nuget.exe is unavailable + - task: UseDotNet@2 + displayName: Install .NET 8.0 SDK for MicroBuild Plugin + inputs: + packageType: sdk + version: 8.0.x + installationPath: ${{ parameters.microBuildOutputFolder }}/.dotnet-microbuild + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + + - script: | + set -euo pipefail + + # UseDotNet@2 prepends the dotnet executable path to the PATH variable, so we can call dotnet directly + version=$(dotnet --version) + cat << 'EOF' > ${{ parameters.microBuildOutputFolder }}/global.json + { + "sdk": { + "version": "$version", + "paths": [ + "${{ parameters.microBuildOutputFolder }}/.dotnet-microbuild" + ], + "errorMessage": "The .NET SDK version $version is required to install the MicroBuild signing plugin." + } + } + EOF + displayName: 'Add global.json to MicroBuild Installation path' + workingDirectory: ${{ parameters.microBuildOutputFolder }} + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + + - script: | + REM Check if ESRP is disabled while SignType is real + if /I "${{ parameters.microbuildUseESRP }}"=="false" if /I "$(_SignType)"=="real" ( + echo Error: ESRP must be enabled when SignType is real. + exit /b 1 + ) + displayName: 'Validate ESRP usage (Windows)' + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) + - script: | + # Check if ESRP is disabled while SignType is real + if [ "${{ parameters.microbuildUseESRP }}" = "false" ] && [ "$(_SignType)" = "real" ]; then + echo "Error: ESRP must be enabled when SignType is real." + exit 1 + fi + displayName: 'Validate ESRP usage (Non-Windows)' + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + + # Two different MB install steps. This is due to not being able to use the agent OS during + # YAML expansion, and Windows vs. Linux/Mac uses different service connections. However, + # we can avoid including the MB install step if not enabled at all. This avoids a bunch of + # extra pipeline authorizations, since most pipelines do not sign on non-Windows. + - template: /eng/common/core-templates/steps/install-microbuild-impl.yml@self + parameters: + enablePreviewMicrobuild: ${{ parameters.enablePreviewMicrobuild }} + microbuildTaskInputs: + signType: $(_SignType) + zipSources: false + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + version: ${{ parameters.microbuildPluginVersion }} + ${{ if eq(parameters.microbuildUseESRP, true) }}: + ConnectedServiceName: 'MicroBuild Signing Task (DevDiv)' + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + ConnectedPMEServiceName: 6cc74545-d7b9-4050-9dfa-ebefcc8961ea + ${{ else }}: + ConnectedPMEServiceName: 248d384a-b39b-46e3-8ad5-c2c210d5e7ca + microbuildEnv: + TeamName: $(_TeamName) + MicroBuildOutputFolderOverride: ${{ parameters.microBuildOutputFolder }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT'), in(variables['_SignType'], 'real', 'test')) + + - ${{ if eq(parameters.enableMicrobuildForMacAndLinux, true) }}: + - template: /eng/common/core-templates/steps/install-microbuild-impl.yml@self + parameters: + enablePreviewMicrobuild: ${{ parameters.enablePreviewMicrobuild }} + microbuildTaskInputs: + signType: $(_SignType) + zipSources: false + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + version: ${{ parameters.microbuildPluginVersion }} + workingDirectory: ${{ parameters.microBuildOutputFolder }} + ${{ if eq(parameters.microbuildUseESRP, true) }}: + ConnectedServiceName: 'MicroBuild Signing Task (DevDiv)' + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + ConnectedPMEServiceName: beb8cb23-b303-4c95-ab26-9e44bc958d39 + ${{ else }}: + ConnectedPMEServiceName: c24de2a5-cc7a-493d-95e4-8e5ff5cad2bc + microbuildEnv: + TeamName: $(_TeamName) + MicroBuildOutputFolderOverride: ${{ parameters.microBuildOutputFolder }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'), eq(variables['_SignType'], 'real')) diff --git a/eng/common/core-templates/steps/publish-build-artifacts.yml b/eng/common/core-templates/steps/publish-build-artifacts.yml new file mode 100644 index 0000000000000..f24ce346684e6 --- /dev/null +++ b/eng/common/core-templates/steps/publish-build-artifacts.yml @@ -0,0 +1,20 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: false +- name: args + type: object + default: {} +steps: +- ${{ if ne(parameters.is1ESPipeline, true) }}: + - template: /eng/common/templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + ${{ each parameter in parameters.args }}: + ${{ parameter.key }}: ${{ parameter.value }} +- ${{ else }}: + - template: /eng/common/templates-official/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + ${{ each parameter in parameters.args }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/core-templates/steps/publish-logs.yml b/eng/common/core-templates/steps/publish-logs.yml new file mode 100644 index 0000000000000..5a927b4c7bcbf --- /dev/null +++ b/eng/common/core-templates/steps/publish-logs.yml @@ -0,0 +1,63 @@ +parameters: + StageLabel: '' + JobLabel: '' + CustomSensitiveDataList: '' + # A default - in case value from eng/common/core-templates/post-build/common-variables.yml is not passed + BinlogToolVersion: '1.0.11' + is1ESPipeline: false + +steps: +- task: Powershell@2 + displayName: Prepare Binlogs to Upload + inputs: + targetType: inline + script: | + New-Item -ItemType Directory $(System.DefaultWorkingDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ + Move-Item -Path $(System.DefaultWorkingDirectory)/artifacts/log/Debug/* $(System.DefaultWorkingDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ + continueOnError: true + condition: always() + +- task: PowerShell@2 + displayName: Redact Logs + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/post-build/redact-logs.ps1 + # For now this needs to have explicit list of all sensitive data. Taken from eng/publishing/v3/publish.yml + # Sensitive data can as well be added to $(System.DefaultWorkingDirectory)/eng/BinlogSecretsRedactionFile.txt' + # If the file exists - sensitive data for redaction will be sourced from it + # (single entry per line, lines starting with '# ' are considered comments and skipped) + arguments: -InputPath '$(System.DefaultWorkingDirectory)/PostBuildLogs' + -BinlogToolVersion '${{parameters.BinlogToolVersion}}' + -TokensFilePath '$(System.DefaultWorkingDirectory)/eng/BinlogSecretsRedactionFile.txt' + -runtimeSourceFeed https://ci.dot.net/internal + -runtimeSourceFeedKey '$(dotnetbuilds-internal-container-read-token-base64)' + '$(publishing-dnceng-devdiv-code-r-build-re)' + '$(MaestroAccessToken)' + '$(dn-bot-all-orgs-artifact-feeds-rw)' + '$(akams-client-id)' + '$(microsoft-symbol-server-pat)' + '$(symweb-symbol-server-pat)' + '$(dnceng-symbol-server-pat)' + '$(dn-bot-all-orgs-build-rw-code-rw)' + '$(System.AccessToken)' + ${{parameters.CustomSensitiveDataList}} + continueOnError: true + condition: always() + +- task: CopyFiles@2 + displayName: Gather post build logs + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)/PostBuildLogs' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/PostBuildLogs' + condition: always() + +- template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish Logs + pathToPublish: '$(Build.ArtifactStagingDirectory)/PostBuildLogs' + publishLocation: Container + artifactName: PostBuildLogs + continueOnError: true + condition: always() diff --git a/eng/common/core-templates/steps/publish-pipeline-artifacts.yml b/eng/common/core-templates/steps/publish-pipeline-artifacts.yml new file mode 100644 index 0000000000000..2efec04dc2c16 --- /dev/null +++ b/eng/common/core-templates/steps/publish-pipeline-artifacts.yml @@ -0,0 +1,20 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: false + +- name: args + type: object + default: {} + +steps: +- ${{ if ne(parameters.is1ESPipeline, true) }}: + - template: /eng/common/templates/steps/publish-pipeline-artifacts.yml + parameters: + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} +- ${{ else }}: + - template: /eng/common/templates-official/steps/publish-pipeline-artifacts.yml + parameters: + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/core-templates/steps/retain-build.yml b/eng/common/core-templates/steps/retain-build.yml new file mode 100644 index 0000000000000..83d97a26a01ff --- /dev/null +++ b/eng/common/core-templates/steps/retain-build.yml @@ -0,0 +1,28 @@ +parameters: + # Optional azure devops PAT with build execute permissions for the build's organization, + # only needed if the build that should be retained ran on a different organization than + # the pipeline where this template is executing from + Token: '' + # Optional BuildId to retain, defaults to the current running build + BuildId: '' + # Azure devops Organization URI for the build in the https://dev.azure.com/ format. + # Defaults to the organization the current pipeline is running on + AzdoOrgUri: '$(System.CollectionUri)' + # Azure devops project for the build. Defaults to the project the current pipeline is running on + AzdoProject: '$(System.TeamProject)' + +steps: + - task: powershell@2 + inputs: + targetType: 'filePath' + filePath: eng/common/retain-build.ps1 + pwsh: true + arguments: > + -AzdoOrgUri: ${{parameters.AzdoOrgUri}} + -AzdoProject ${{parameters.AzdoProject}} + -Token ${{coalesce(parameters.Token, '$env:SYSTEM_ACCESSTOKEN') }} + -BuildId ${{coalesce(parameters.BuildId, '$env:BUILD_ID')}} + displayName: Enable permanent build retention + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + BUILD_ID: $(Build.BuildId) \ No newline at end of file diff --git a/eng/common/core-templates/steps/send-to-helix.yml b/eng/common/core-templates/steps/send-to-helix.yml new file mode 100644 index 0000000000000..68fa739c4ab21 --- /dev/null +++ b/eng/common/core-templates/steps/send-to-helix.yml @@ -0,0 +1,93 @@ +# Please remember to update the documentation if you make changes to these parameters! +parameters: + HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ + HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' + HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number + HelixTargetQueues: '' # required -- semicolon-delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues + HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group + HelixProjectPath: 'eng/common/helixpublish.proj' # optional -- path to the project file to build relative to BUILD_SOURCESDIRECTORY + HelixProjectArguments: '' # optional -- arguments passed to the build command + HelixConfiguration: '' # optional -- additional property attached to a job + HelixPreCommands: '' # optional -- commands to run before Helix work item execution + HelixPostCommands: '' # optional -- commands to run after Helix work item execution + WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects + WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects + WorkItemTimeout: '' # optional -- a timeout in TimeSpan.Parse-ready value (e.g. 00:02:00) for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects + CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload + XUnitProjects: '' # optional -- semicolon-delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true + XUnitWorkItemTimeout: '' # optional -- the workitem timeout in seconds for all workitems created from the xUnit projects specified by XUnitProjects + XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects + XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner + XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects + IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion + DotNetCliPackageType: '' # optional -- either 'sdk', 'runtime' or 'aspnetcore-runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json + DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json + WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." + IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set + HelixBaseUri: 'https://helix.dot.net/' # optional -- sets the Helix API base URI (allows targeting https://helix.int-dot.net ) + Creator: '' # optional -- if the build is external, use this to specify who is sending the job + DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO + condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() + continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false + +steps: + - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY/${{ parameters.HelixProjectPath }} /restore /p:TreatWarningsAsErrors=false ${{ parameters.HelixProjectArguments }} /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' + displayName: ${{ parameters.DisplayNamePrefix }} (Windows) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/${{ parameters.HelixProjectPath }} /restore /p:TreatWarningsAsErrors=false ${{ parameters.HelixProjectArguments }} /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog + displayName: ${{ parameters.DisplayNamePrefix }} (Unix) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml new file mode 100644 index 0000000000000..acf16ed34963f --- /dev/null +++ b/eng/common/core-templates/steps/source-build.yml @@ -0,0 +1,65 @@ +parameters: + # This template adds arcade-powered source-build to CI. + + # This is a 'steps' template, and is intended for advanced scenarios where the existing build + # infra has a careful build methodology that must be followed. For example, a repo + # (dotnet/runtime) might choose to clone the GitHub repo only once and store it as a pipeline + # artifact for all subsequent jobs to use, to reduce dependence on a strong network connection to + # GitHub. Using this steps template leaves room for that infra to be included. + + # Defines the platform on which to run the steps. See 'eng/common/core-templates/job/source-build.yml' + # for details. The entire object is described in the 'job' template for simplicity, even though + # the usage of the properties on this object is split between the 'job' and 'steps' templates. + platform: {} + is1ESPipeline: false + +steps: +# Build. Keep it self-contained for simple reusability. (No source-build-specific job variables.) +- script: | + set -x + df -h + + # If building on the internal project, the internal storage variable may be available (usually only if needed) + # In that case, add variables to allow the download of internal runtimes if the specified versions are not found + # in the default public locations. + internalRuntimeDownloadArgs= + if [ '$(dotnetbuilds-internal-container-read-token-base64)' != '$''(dotnetbuilds-internal-container-read-token-base64)' ]; then + internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://ci.dot.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://ci.dot.net/internal --runtimesourcefeedkey $(dotnetbuilds-internal-container-read-token-base64)' + fi + + buildConfig=Release + # Check if AzDO substitutes in a build config from a variable, and use it if so. + if [ '$(_BuildConfig)' != '$''(_BuildConfig)' ]; then + buildConfig='$(_BuildConfig)' + fi + + targetRidArgs= + if [ '${{ parameters.platform.targetRID }}' != '' ]; then + targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' + fi + + portableBuildArgs= + if [ '${{ parameters.platform.portableBuild }}' != '' ]; then + portableBuildArgs='/p:PortableBuild=${{ parameters.platform.portableBuild }}' + fi + + ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ + --configuration $buildConfig \ + --restore --build --pack -bl \ + --source-build \ + ${{ parameters.platform.buildArguments }} \ + $internalRuntimeDownloadArgs \ + $targetRidArgs \ + $portableBuildArgs \ + displayName: Build + +- template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish BuildLogs + targetPath: artifacts/log/${{ coalesce(variables._BuildConfig, 'Release') }} + artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt) + continueOnError: true + condition: succeededOrFailed() + sbomEnabled: false # we don't need SBOM for logs diff --git a/eng/common/core-templates/steps/source-index-stage1-publish.yml b/eng/common/core-templates/steps/source-index-stage1-publish.yml new file mode 100644 index 0000000000000..ac019e2d03371 --- /dev/null +++ b/eng/common/core-templates/steps/source-index-stage1-publish.yml @@ -0,0 +1,35 @@ +parameters: + sourceIndexUploadPackageVersion: 2.0.0-20250906.1 + sourceIndexProcessBinlogPackageVersion: 1.0.1-20250906.1 + sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json + binlogPath: artifacts/log/Debug/Build.binlog + +steps: +- task: UseDotNet@2 + displayName: "Source Index: Use .NET 9 SDK" + inputs: + packageType: sdk + version: 9.0.x + installationPath: $(Agent.TempDirectory)/dotnet + workingDirectory: $(Agent.TempDirectory) + +- script: | + $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version ${{parameters.sourceIndexProcessBinlogPackageVersion}} --source ${{parameters.SourceIndexPackageSource}} --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version ${{parameters.sourceIndexUploadPackageVersion}} --source ${{parameters.SourceIndexPackageSource}} --tool-path $(Agent.TempDirectory)/.source-index/tools + displayName: "Source Index: Download netsourceindex Tools" + # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. + workingDirectory: $(Agent.TempDirectory) + +- script: $(Agent.TempDirectory)/.source-index/tools/BinLogToSln -i ${{parameters.BinlogPath}} -r $(System.DefaultWorkingDirectory) -n $(Build.Repository.Name) -o .source-index/stage1output + displayName: "Source Index: Process Binlog into indexable sln" + +- ${{ if and(ne(parameters.runAsPublic, 'true'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: AzureCLI@2 + displayName: "Source Index: Upload Source Index stage1 artifacts to Azure" + inputs: + azureSubscription: 'SourceDotNet Stage1 Publish' + addSpnToEnvironment: true + scriptType: 'ps' + scriptLocation: 'inlineScript' + inlineScript: | + $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) -s netsourceindexstage1 -b stage1 diff --git a/eng/common/core-templates/variables/pool-providers.yml b/eng/common/core-templates/variables/pool-providers.yml new file mode 100644 index 0000000000000..41053d382a2e1 --- /dev/null +++ b/eng/common/core-templates/variables/pool-providers.yml @@ -0,0 +1,8 @@ +parameters: + is1ESPipeline: false + +variables: + - ${{ if eq(parameters.is1ESPipeline, 'true') }}: + - template: /eng/common/templates-official/variables/pool-providers.yml + - ${{ else }}: + - template: /eng/common/templates/variables/pool-providers.yml \ No newline at end of file diff --git a/eng/common/cross/arm/tizen/tizen.patch b/eng/common/cross/arm/tizen/tizen.patch new file mode 100644 index 0000000000000..fb12ade7250ae --- /dev/null +++ b/eng/common/cross/arm/tizen/tizen.patch @@ -0,0 +1,9 @@ +diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so +--- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf32-littlearm) +-GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux-armhf.so.3 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-armhf.so.3 ) ) diff --git a/eng/common/cross/arm64/tizen/tizen.patch b/eng/common/cross/arm64/tizen/tizen.patch new file mode 100644 index 0000000000000..2cebc547382e3 --- /dev/null +++ b/eng/common/cross/arm64/tizen/tizen.patch @@ -0,0 +1,9 @@ +diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so +--- a/usr/lib64/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib64/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf64-littleaarch64) +-GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib64/ld-linux-aarch64.so.1 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-aarch64.so.1 ) ) diff --git a/eng/common/cross/armel/tizen/tizen.patch b/eng/common/cross/armel/tizen/tizen.patch new file mode 100644 index 0000000000000..ca7c7c1ff751f --- /dev/null +++ b/eng/common/cross/armel/tizen/tizen.patch @@ -0,0 +1,9 @@ +diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so +--- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf32-littlearm) +-GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.3 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux.so.3 ) ) diff --git a/eng/common/cross/build-android-rootfs.sh b/eng/common/cross/build-android-rootfs.sh new file mode 100755 index 0000000000000..fbd8d80848a6c --- /dev/null +++ b/eng/common/cross/build-android-rootfs.sh @@ -0,0 +1,146 @@ +#!/usr/bin/env bash +set -e +__NDK_Version=r21 + +usage() +{ + echo "Creates a toolchain and sysroot used for cross-compiling for Android." + echo + echo "Usage: $0 [BuildArch] [ApiLevel] [--ndk NDKVersion]" + echo + echo "BuildArch is the target architecture of Android. Currently only arm64 is supported." + echo "ApiLevel is the target Android API level. API levels usually match to Android releases. See https://source.android.com/source/build-numbers.html" + echo "NDKVersion is the version of Android NDK. The default is r21. See https://developer.android.com/ndk/downloads/revision_history" + echo + echo "By default, the toolchain and sysroot will be generated in cross/android-rootfs/toolchain/[BuildArch]. You can change this behavior" + echo "by setting the TOOLCHAIN_DIR environment variable" + echo + echo "By default, the NDK will be downloaded into the cross/android-rootfs/android-ndk-$__NDK_Version directory. If you already have an NDK installation," + echo "you can set the NDK_DIR environment variable to have this script use that installation of the NDK." + echo "By default, this script will generate a file, android_platform, in the root of the ROOTFS_DIR directory that contains the RID for the supported and tested Android build: android.28-arm64. This file is to replace '/etc/os-release', which is not available for Android." + exit 1 +} + +__ApiLevel=28 # The minimum platform for arm64 is API level 21 but the minimum version that support glob(3) is 28. See $ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/glob.h +__BuildArch=arm64 +__AndroidArch=aarch64 +__AndroidToolchain=aarch64-linux-android + +while :; do + if [[ "$#" -le 0 ]]; then + break + fi + + i=$1 + + lowerI="$(echo $i | tr "[:upper:]" "[:lower:]")" + case $lowerI in + -?|-h|--help) + usage + exit 1 + ;; + arm64) + __BuildArch=arm64 + __AndroidArch=aarch64 + __AndroidToolchain=aarch64-linux-android + ;; + arm) + __BuildArch=arm + __AndroidArch=arm + __AndroidToolchain=arm-linux-androideabi + ;; + --ndk) + shift + __NDK_Version=$1 + ;; + *[0-9]) + __ApiLevel=$i + ;; + *) + __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i" + ;; + esac + shift +done + +if [[ "$__NDK_Version" == "r21" ]] || [[ "$__NDK_Version" == "r22" ]]; then + __NDK_File_Arch_Spec=-x86_64 + __SysRoot=sysroot +else + __NDK_File_Arch_Spec= + __SysRoot=toolchains/llvm/prebuilt/linux-x86_64/sysroot +fi + +# Obtain the location of the bash script to figure out where the root of the repo is. +__ScriptBaseDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +__CrossDir="$__ScriptBaseDir/../../../.tools/android-rootfs" + +if [[ ! -f "$__CrossDir" ]]; then + mkdir -p "$__CrossDir" +fi + +# Resolve absolute path to avoid `../` in build logs +__CrossDir="$( cd "$__CrossDir" && pwd )" + +__NDK_Dir="$__CrossDir/android-ndk-$__NDK_Version" +__lldb_Dir="$__CrossDir/lldb" +__ToolchainDir="$__CrossDir/android-ndk-$__NDK_Version" + +if [[ -n "$TOOLCHAIN_DIR" ]]; then + __ToolchainDir=$TOOLCHAIN_DIR +fi + +if [[ -n "$NDK_DIR" ]]; then + __NDK_Dir=$NDK_DIR +fi + +echo "Target API level: $__ApiLevel" +echo "Target architecture: $__BuildArch" +echo "NDK version: $__NDK_Version" +echo "NDK location: $__NDK_Dir" +echo "Target Toolchain location: $__ToolchainDir" + +# Download the NDK if required +if [ ! -d $__NDK_Dir ]; then + echo Downloading the NDK into $__NDK_Dir + mkdir -p $__NDK_Dir + wget -q --progress=bar:force:noscroll --show-progress https://dl.google.com/android/repository/android-ndk-$__NDK_Version-linux$__NDK_File_Arch_Spec.zip -O $__CrossDir/android-ndk-$__NDK_Version-linux.zip + unzip -q $__CrossDir/android-ndk-$__NDK_Version-linux.zip -d $__CrossDir +fi + +if [ ! -d $__lldb_Dir ]; then + mkdir -p $__lldb_Dir + echo Downloading LLDB into $__lldb_Dir + wget -q --progress=bar:force:noscroll --show-progress https://dl.google.com/android/repository/lldb-2.3.3614996-linux-x86_64.zip -O $__CrossDir/lldb-2.3.3614996-linux-x86_64.zip + unzip -q $__CrossDir/lldb-2.3.3614996-linux-x86_64.zip -d $__lldb_Dir +fi + +echo "Download dependencies..." +__TmpDir=$__CrossDir/tmp/$__BuildArch/ +mkdir -p "$__TmpDir" + +# combined dependencies for coreclr, installer and libraries +__AndroidPackages="libicu" +__AndroidPackages+=" libandroid-glob" +__AndroidPackages+=" liblzma" +__AndroidPackages+=" krb5" +__AndroidPackages+=" openssl" + +for path in $(wget -qO- https://packages.termux.dev/termux-main-21/dists/stable/main/binary-$__AndroidArch/Packages |\ + grep -A15 "Package: \(${__AndroidPackages// /\\|}\)" | grep -v "static\|tool" | grep Filename); do + + if [[ "$path" != "Filename:" ]]; then + echo "Working on: $path" + wget -qO- https://packages.termux.dev/termux-main-21/$path | dpkg -x - "$__TmpDir" + fi +done + +cp -R "$__TmpDir/data/data/com.termux/files/usr/"* "$__ToolchainDir/$__SysRoot/usr/" + +# Generate platform file for build.sh script to assign to __DistroRid +echo "Generating platform file..." +echo "RID=android.${__ApiLevel}-${__BuildArch}" > $__ToolchainDir/$__SysRoot/android_platform + +echo "Now to build coreclr, libraries and host; run:" +echo ROOTFS_DIR=$(realpath $__ToolchainDir/$__SysRoot) ./build.sh clr+libs+host --cross --arch $__BuildArch diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh new file mode 100755 index 0000000000000..8abfb71f72752 --- /dev/null +++ b/eng/common/cross/build-rootfs.sh @@ -0,0 +1,835 @@ +#!/usr/bin/env bash + +set -e + +usage() +{ + echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [llvmx[.y]] [--skipunmount] --rootfsdir ]" + echo "BuildArch can be: arm(default), arm64, armel, armv6, loongarch64, ppc64le, riscv64, s390x, x64, x86" + echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine" + echo " for alpine can be specified with version: alpineX.YY or alpineedge" + echo " for FreeBSD can be: freebsd13, freebsd14" + echo " for illumos can be: illumos" + echo " for Haiku can be: haiku." + echo "lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine and FreeBSD" + echo "llvmx[.y] - optional, LLVM version for LLVM related packages." + echo "--skipunmount - optional, will skip the unmount of rootfs folder." + echo "--skipsigcheck - optional, will skip package signature checks (allowing untrusted packages)." + echo "--skipemulation - optional, will skip qemu and debootstrap requirement when building environment for debian based systems." + echo "--use-mirror - optional, use mirror URL to fetch resources, when available." + echo "--jobs N - optional, restrict to N jobs." + exit 1 +} + +__CodeName=xenial +__CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +__BuildArch=arm +__AlpineArch=armv7 +__FreeBSDArch=arm +__FreeBSDMachineArch=armv7 +__IllumosArch=arm7 +__HaikuArch=arm +__QEMUArch=arm +__UbuntuArch=armhf +__UbuntuRepo= +__UbuntuSuites="updates security backports" +__LLDB_Package="liblldb-3.9-dev" +__SkipUnmount=0 + +# base development support +__UbuntuPackages="build-essential" + +__AlpinePackages="alpine-base" +__AlpinePackages+=" build-base" +__AlpinePackages+=" linux-headers" +__AlpinePackages+=" lldb-dev" +__AlpinePackages+=" python3" +__AlpinePackages+=" libedit" + +# symlinks fixer +__UbuntuPackages+=" symlinks" + +# runtime dependencies +__UbuntuPackages+=" libicu-dev" +__UbuntuPackages+=" liblttng-ust-dev" +__UbuntuPackages+=" libunwind8-dev" + +__AlpinePackages+=" gettext-dev" +__AlpinePackages+=" icu-dev" +__AlpinePackages+=" libunwind-dev" +__AlpinePackages+=" lttng-ust-dev" +__AlpinePackages+=" compiler-rt" + +# runtime libraries' dependencies +__UbuntuPackages+=" libcurl4-openssl-dev" +__UbuntuPackages+=" libkrb5-dev" +__UbuntuPackages+=" libssl-dev" +__UbuntuPackages+=" zlib1g-dev" +__UbuntuPackages+=" libbrotli-dev" + +__AlpinePackages+=" curl-dev" +__AlpinePackages+=" krb5-dev" +__AlpinePackages+=" openssl-dev" +__AlpinePackages+=" zlib-dev" + +__FreeBSDBase="13.4-RELEASE" +__FreeBSDPkg="1.21.3" +__FreeBSDABI="13" +__FreeBSDPackages="libunwind" +__FreeBSDPackages+=" icu" +__FreeBSDPackages+=" libinotify" +__FreeBSDPackages+=" openssl" +__FreeBSDPackages+=" krb5" +__FreeBSDPackages+=" terminfo-db" + +__IllumosPackages="icu" +__IllumosPackages+=" mit-krb5" +__IllumosPackages+=" openssl" +__IllumosPackages+=" zlib" + +__HaikuPackages="gcc_syslibs" +__HaikuPackages+=" gcc_syslibs_devel" +__HaikuPackages+=" gmp" +__HaikuPackages+=" gmp_devel" +__HaikuPackages+=" icu[0-9]+" +__HaikuPackages+=" icu[0-9]*_devel" +__HaikuPackages+=" krb5" +__HaikuPackages+=" krb5_devel" +__HaikuPackages+=" libiconv" +__HaikuPackages+=" libiconv_devel" +__HaikuPackages+=" llvm[0-9]*_libunwind" +__HaikuPackages+=" llvm[0-9]*_libunwind_devel" +__HaikuPackages+=" mpfr" +__HaikuPackages+=" mpfr_devel" +__HaikuPackages+=" openssl3" +__HaikuPackages+=" openssl3_devel" +__HaikuPackages+=" zlib" +__HaikuPackages+=" zlib_devel" + +# ML.NET dependencies +__UbuntuPackages+=" libomp5" +__UbuntuPackages+=" libomp-dev" + +# Taken from https://github.com/alpinelinux/alpine-chroot-install/blob/6d08f12a8a70dd9b9dc7d997c88aa7789cc03c42/alpine-chroot-install#L85-L133 +__AlpineKeys=' +4a6a0840:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1yHJxQgsHQREclQu4Ohe\nqxTxd1tHcNnvnQTu/UrTky8wWvgXT+jpveroeWWnzmsYlDI93eLI2ORakxb3gA2O\nQ0Ry4ws8vhaxLQGC74uQR5+/yYrLuTKydFzuPaS1dK19qJPXB8GMdmFOijnXX4SA\njixuHLe1WW7kZVtjL7nufvpXkWBGjsfrvskdNA/5MfxAeBbqPgaq0QMEfxMAn6/R\nL5kNepi/Vr4S39Xvf2DzWkTLEK8pcnjNkt9/aafhWqFVW7m3HCAII6h/qlQNQKSo\nGuH34Q8GsFG30izUENV9avY7hSLq7nggsvknlNBZtFUcmGoQrtx3FmyYsIC8/R+B\nywIDAQAB +5243ef4b:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvNijDxJ8kloskKQpJdx+\nmTMVFFUGDoDCbulnhZMJoKNkSuZOzBoFC94omYPtxnIcBdWBGnrm6ncbKRlR+6oy\nDO0W7c44uHKCFGFqBhDasdI4RCYP+fcIX/lyMh6MLbOxqS22TwSLhCVjTyJeeH7K\naA7vqk+QSsF4TGbYzQDDpg7+6aAcNzg6InNePaywA6hbT0JXbxnDWsB+2/LLSF2G\nmnhJlJrWB1WGjkz23ONIWk85W4S0XB/ewDefd4Ly/zyIciastA7Zqnh7p3Ody6Q0\nsS2MJzo7p3os1smGjUF158s6m/JbVh4DN6YIsxwl2OjDOz9R0OycfJSDaBVIGZzg\ncQIDAQAB +524d27bb:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr8s1q88XpuJWLCZALdKj\nlN8wg2ePB2T9aIcaxryYE/Jkmtu+ZQ5zKq6BT3y/udt5jAsMrhHTwroOjIsF9DeG\ne8Y3vjz+Hh4L8a7hZDaw8jy3CPag47L7nsZFwQOIo2Cl1SnzUc6/owoyjRU7ab0p\niWG5HK8IfiybRbZxnEbNAfT4R53hyI6z5FhyXGS2Ld8zCoU/R4E1P0CUuXKEN4p0\n64dyeUoOLXEWHjgKiU1mElIQj3k/IF02W89gDj285YgwqA49deLUM7QOd53QLnx+\nxrIrPv3A+eyXMFgexNwCKQU9ZdmWa00MjjHlegSGK8Y2NPnRoXhzqSP9T9i2HiXL\nVQIDAQAB +5261cecb:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwlzMkl7b5PBdfMzGdCT0\ncGloRr5xGgVmsdq5EtJvFkFAiN8Ac9MCFy/vAFmS8/7ZaGOXoCDWbYVLTLOO2qtX\nyHRl+7fJVh2N6qrDDFPmdgCi8NaE+3rITWXGrrQ1spJ0B6HIzTDNEjRKnD4xyg4j\ng01FMcJTU6E+V2JBY45CKN9dWr1JDM/nei/Pf0byBJlMp/mSSfjodykmz4Oe13xB\nCa1WTwgFykKYthoLGYrmo+LKIGpMoeEbY1kuUe04UiDe47l6Oggwnl+8XD1MeRWY\nsWgj8sF4dTcSfCMavK4zHRFFQbGp/YFJ/Ww6U9lA3Vq0wyEI6MCMQnoSMFwrbgZw\nwwIDAQAB +58199dcc:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3v8/ye/V/t5xf4JiXLXa\nhWFRozsnmn3hobON20GdmkrzKzO/eUqPOKTpg2GtvBhK30fu5oY5uN2ORiv2Y2ht\neLiZ9HVz3XP8Fm9frha60B7KNu66FO5P2o3i+E+DWTPqqPcCG6t4Znk2BypILcit\nwiPKTsgbBQR2qo/cO01eLLdt6oOzAaF94NH0656kvRewdo6HG4urbO46tCAizvCR\nCA7KGFMyad8WdKkTjxh8YLDLoOCtoZmXmQAiwfRe9pKXRH/XXGop8SYptLqyVVQ+\ntegOD9wRs2tOlgcLx4F/uMzHN7uoho6okBPiifRX+Pf38Vx+ozXh056tjmdZkCaV\naQIDAQAB +58cbb476:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoSPnuAGKtRIS5fEgYPXD\n8pSGvKAmIv3A08LBViDUe+YwhilSHbYXUEAcSH1KZvOo1WT1x2FNEPBEFEFU1Eyc\n+qGzbA03UFgBNvArurHQ5Z/GngGqE7IarSQFSoqewYRtFSfp+TL9CUNBvM0rT7vz\n2eMu3/wWG+CBmb92lkmyWwC1WSWFKO3x8w+Br2IFWvAZqHRt8oiG5QtYvcZL6jym\nY8T6sgdDlj+Y+wWaLHs9Fc+7vBuyK9C4O1ORdMPW15qVSl4Lc2Wu1QVwRiKnmA+c\nDsH/m7kDNRHM7TjWnuj+nrBOKAHzYquiu5iB3Qmx+0gwnrSVf27Arc3ozUmmJbLj\nzQIDAQAB +58e4f17d:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvBxJN9ErBgdRcPr5g4hV\nqyUSGZEKuvQliq2Z9SRHLh2J43+EdB6A+yzVvLnzcHVpBJ+BZ9RV30EM9guck9sh\nr+bryZcRHyjG2wiIEoduxF2a8KeWeQH7QlpwGhuobo1+gA8L0AGImiA6UP3LOirl\nI0G2+iaKZowME8/tydww4jx5vG132JCOScMjTalRsYZYJcjFbebQQolpqRaGB4iG\nWqhytWQGWuKiB1A22wjmIYf3t96l1Mp+FmM2URPxD1gk/BIBnX7ew+2gWppXOK9j\n1BJpo0/HaX5XoZ/uMqISAAtgHZAqq+g3IUPouxTphgYQRTRYpz2COw3NF43VYQrR\nbQIDAQAB +60ac2099:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwR4uJVtJOnOFGchnMW5Y\nj5/waBdG1u5BTMlH+iQMcV5+VgWhmpZHJCBz3ocD+0IGk2I68S5TDOHec/GSC0lv\n6R9o6F7h429GmgPgVKQsc8mPTPtbjJMuLLs4xKc+viCplXc0Nc0ZoHmCH4da6fCV\ntdpHQjVe6F9zjdquZ4RjV6R6JTiN9v924dGMAkbW/xXmamtz51FzondKC52Gh8Mo\n/oA0/T0KsCMCi7tb4QNQUYrf+Xcha9uus4ww1kWNZyfXJB87a2kORLiWMfs2IBBJ\nTmZ2Fnk0JnHDb8Oknxd9PvJPT0mvyT8DA+KIAPqNvOjUXP4bnjEHJcoCP9S5HkGC\nIQIDAQAB +6165ee59:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAutQkua2CAig4VFSJ7v54\nALyu/J1WB3oni7qwCZD3veURw7HxpNAj9hR+S5N/pNeZgubQvJWyaPuQDm7PTs1+\ntFGiYNfAsiibX6Rv0wci3M+z2XEVAeR9Vzg6v4qoofDyoTbovn2LztaNEjTkB+oK\ntlvpNhg1zhou0jDVYFniEXvzjckxswHVb8cT0OMTKHALyLPrPOJzVtM9C1ew2Nnc\n3848xLiApMu3NBk0JqfcS3Bo5Y2b1FRVBvdt+2gFoKZix1MnZdAEZ8xQzL/a0YS5\nHd0wj5+EEKHfOd3A75uPa/WQmA+o0cBFfrzm69QDcSJSwGpzWrD1ScH3AK8nWvoj\nv7e9gukK/9yl1b4fQQ00vttwJPSgm9EnfPHLAtgXkRloI27H6/PuLoNvSAMQwuCD\nhQRlyGLPBETKkHeodfLoULjhDi1K2gKJTMhtbnUcAA7nEphkMhPWkBpgFdrH+5z4\nLxy+3ek0cqcI7K68EtrffU8jtUj9LFTUC8dERaIBs7NgQ/LfDbDfGh9g6qVj1hZl\nk9aaIPTm/xsi8v3u+0qaq7KzIBc9s59JOoA8TlpOaYdVgSQhHHLBaahOuAigH+VI\nisbC9vmqsThF2QdDtQt37keuqoda2E6sL7PUvIyVXDRfwX7uMDjlzTxHTymvq2Ck\nhtBqojBnThmjJQFgZXocHG8CAwEAAQ== +61666e3f:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAlEyxkHggKCXC2Wf5Mzx4\nnZLFZvU2bgcA3exfNPO/g1YunKfQY+Jg4fr6tJUUTZ3XZUrhmLNWvpvSwDS19ZmC\nIXOu0+V94aNgnhMsk9rr59I8qcbsQGIBoHzuAl8NzZCgdbEXkiY90w1skUw8J57z\nqCsMBydAueMXuWqF5nGtYbi5vHwK42PffpiZ7G5Kjwn8nYMW5IZdL6ZnMEVJUWC9\nI4waeKg0yskczYDmZUEAtrn3laX9677ToCpiKrvmZYjlGl0BaGp3cxggP2xaDbUq\nqfFxWNgvUAb3pXD09JM6Mt6HSIJaFc9vQbrKB9KT515y763j5CC2KUsilszKi3mB\nHYe5PoebdjS7D1Oh+tRqfegU2IImzSwW3iwA7PJvefFuc/kNIijfS/gH/cAqAK6z\nbhdOtE/zc7TtqW2Wn5Y03jIZdtm12CxSxwgtCF1NPyEWyIxAQUX9ACb3M0FAZ61n\nfpPrvwTaIIxxZ01L3IzPLpbc44x/DhJIEU+iDt6IMTrHOphD9MCG4631eIdB0H1b\n6zbNX1CXTsafqHRFV9XmYYIeOMggmd90s3xIbEujA6HKNP/gwzO6CDJ+nHFDEqoF\nSkxRdTkEqjTjVKieURW7Swv7zpfu5PrsrrkyGnsRrBJJzXlm2FOOxnbI2iSL1B5F\nrO5kbUxFeZUIDq+7Yv4kLWcCAwEAAQ== +616a9724:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnC+bR4bHf/L6QdU4puhQ\ngl1MHePszRC38bzvVFDUJsmCaMCL2suCs2A2yxAgGb9pu9AJYLAmxQC4mM3jNqhg\n/E7yuaBbek3O02zN/ctvflJ250wZCy+z0ZGIp1ak6pu1j14IwHokl9j36zNfGtfv\nADVOcdpWITFFlPqwq1qt/H3UsKVmtiF3BNWWTeUEQwKvlU8ymxgS99yn0+4OPyNT\nL3EUeS+NQJtDS01unau0t7LnjUXn+XIneWny8bIYOQCuVR6s/gpIGuhBaUqwaJOw\n7jkJZYF2Ij7uPb4b5/R3vX2FfxxqEHqssFSg8FFUNTZz3qNZs0CRVyfA972g9WkJ\nhPfn31pQYil4QGRibCMIeU27YAEjXoqfJKEPh4UWMQsQLrEfdGfb8VgwrPbniGfU\nL3jKJR3VAafL9330iawzVQDlIlwGl6u77gEXMl9K0pfazunYhAp+BMP+9ot5ckK+\nosmrqj11qMESsAj083GeFdfV3pXEIwUytaB0AKEht9DbqUfiE/oeZ/LAXgySMtVC\nsbC4ESmgVeY2xSBIJdDyUap7FR49GGrw0W49NUv9gRgQtGGaNVQQO9oGL2PBC41P\niWF9GLoX30HIz1P8PF/cZvicSSPkQf2Z6TV+t0ebdGNS5DjapdnCrq8m9Z0pyKsQ\nuxAL2a7zX8l5i1CZh1ycUGsCAwEAAQ== +616abc23:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0MfCDrhODRCIxR9Dep1s\neXafh5CE5BrF4WbCgCsevyPIdvTeyIaW4vmO3bbG4VzhogDZju+R3IQYFuhoXP5v\nY+zYJGnwrgz3r5wYAvPnLEs1+dtDKYOgJXQj+wLJBW1mzRDL8FoRXOe5iRmn1EFS\nwZ1DoUvyu7/J5r0itKicZp3QKED6YoilXed+1vnS4Sk0mzN4smuMR9eO1mMCqNp9\n9KTfRDHTbakIHwasECCXCp50uXdoW6ig/xUAFanpm9LtK6jctNDbXDhQmgvAaLXZ\nLvFqoaYJ/CvWkyYCgL6qxvMvVmPoRv7OPcyni4xR/WgWa0MSaEWjgPx3+yj9fiMA\n1S02pFWFDOr5OUF/O4YhFJvUCOtVsUPPfA/Lj6faL0h5QI9mQhy5Zb9TTaS9jB6p\nLw7u0dJlrjFedk8KTJdFCcaGYHP6kNPnOxMylcB/5WcztXZVQD5WpCicGNBxCGMm\nW64SgrV7M07gQfL/32QLsdqPUf0i8hoVD8wfQ3EpbQzv6Fk1Cn90bZqZafg8XWGY\nwddhkXk7egrr23Djv37V2okjzdqoyLBYBxMz63qQzFoAVv5VoY2NDTbXYUYytOvG\nGJ1afYDRVWrExCech1mX5ZVUB1br6WM+psFLJFoBFl6mDmiYt0vMYBddKISsvwLl\nIJQkzDwtXzT2cSjoj3T5QekCAwEAAQ== +616ac3bc:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvaaoSLab+IluixwKV5Od\n0gib2YurjPatGIbn5Ov2DLUFYiebj2oJINXJSwUOO+4WcuHFEqiL/1rya+k5hLZt\nhnPL1tn6QD4rESznvGSasRCQNT2vS/oyZbTYJRyAtFkEYLlq0t3S3xBxxHWuvIf0\nqVxVNYpQWyM3N9RIeYBR/euXKJXileSHk/uq1I5wTC0XBIHWcthczGN0m9wBEiWS\n0m3cnPk4q0Ea8mUJ91Rqob19qETz6VbSPYYpZk3qOycjKosuwcuzoMpwU8KRiMFd\n5LHtX0Hx85ghGsWDVtS0c0+aJa4lOMGvJCAOvDfqvODv7gKlCXUpgumGpLdTmaZ8\n1RwqspAe3IqBcdKTqRD4m2mSg23nVx2FAY3cjFvZQtfooT7q1ItRV5RgH6FhQSl7\n+6YIMJ1Bf8AAlLdRLpg+doOUGcEn+pkDiHFgI8ylH1LKyFKw+eXaAml/7DaWZk1d\ndqggwhXOhc/UUZFQuQQ8A8zpA13PcbC05XxN2hyP93tCEtyynMLVPtrRwDnHxFKa\nqKzs3rMDXPSXRn3ZZTdKH3069ApkEjQdpcwUh+EmJ1Ve/5cdtzT6kKWCjKBFZP/s\n91MlRrX2BTRdHaU5QJkUheUtakwxuHrdah2F94lRmsnQlpPr2YseJu6sIE+Dnx4M\nCfhdVbQL2w54R645nlnohu8CAwEAAQ== +616adfeb:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAq0BFD1D4lIxQcsqEpQzU\npNCYM3aP1V/fxxVdT4DWvSI53JHTwHQamKdMWtEXetWVbP5zSROniYKFXd/xrD9X\n0jiGHey3lEtylXRIPxe5s+wXoCmNLcJVnvTcDtwx/ne2NLHxp76lyc25At+6RgE6\nADjLVuoD7M4IFDkAsd8UQ8zM0Dww9SylIk/wgV3ZkifecvgUQRagrNUdUjR56EBZ\nraQrev4hhzOgwelT0kXCu3snbUuNY/lU53CoTzfBJ5UfEJ5pMw1ij6X0r5S9IVsy\nKLWH1hiO0NzU2c8ViUYCly4Fe9xMTFc6u2dy/dxf6FwERfGzETQxqZvSfrRX+GLj\n/QZAXiPg5178hT/m0Y3z5IGenIC/80Z9NCi+byF1WuJlzKjDcF/TU72zk0+PNM/H\nKuppf3JT4DyjiVzNC5YoWJT2QRMS9KLP5iKCSThwVceEEg5HfhQBRT9M6KIcFLSs\nmFjx9kNEEmc1E8hl5IR3+3Ry8G5/bTIIruz14jgeY9u5jhL8Vyyvo41jgt9sLHR1\n/J1TxKfkgksYev7PoX6/ZzJ1ksWKZY5NFoDXTNYUgzFUTOoEaOg3BAQKadb3Qbbq\nXIrxmPBdgrn9QI7NCgfnAY3Tb4EEjs3ON/BNyEhUENcXOH6I1NbcuBQ7g9P73kE4\nVORdoc8MdJ5eoKBpO8Ww8HECAwEAAQ== +616ae350:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAyduVzi1mWm+lYo2Tqt/0\nXkCIWrDNP1QBMVPrE0/ZlU2bCGSoo2Z9FHQKz/mTyMRlhNqTfhJ5qU3U9XlyGOPJ\npiM+b91g26pnpXJ2Q2kOypSgOMOPA4cQ42PkHBEqhuzssfj9t7x47ppS94bboh46\nxLSDRff/NAbtwTpvhStV3URYkxFG++cKGGa5MPXBrxIp+iZf9GnuxVdST5PGiVGP\nODL/b69sPJQNbJHVquqUTOh5Ry8uuD2WZuXfKf7/C0jC/ie9m2+0CttNu9tMciGM\nEyKG1/Xhk5iIWO43m4SrrT2WkFlcZ1z2JSf9Pjm4C2+HovYpihwwdM/OdP8Xmsnr\nDzVB4YvQiW+IHBjStHVuyiZWc+JsgEPJzisNY0Wyc/kNyNtqVKpX6dRhMLanLmy+\nf53cCSI05KPQAcGj6tdL+D60uKDkt+FsDa0BTAobZ31OsFVid0vCXtsbplNhW1IF\nHwsGXBTVcfXg44RLyL8Lk/2dQxDHNHzAUslJXzPxaHBLmt++2COa2EI1iWlvtznk\nOk9WP8SOAIj+xdqoiHcC4j72BOVVgiITIJNHrbppZCq6qPR+fgXmXa+sDcGh30m6\n9Wpbr28kLMSHiENCWTdsFij+NQTd5S47H7XTROHnalYDuF1RpS+DpQidT5tUimaT\nJZDr++FjKrnnijbyNF8b98UCAwEAAQ== +616db30d:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnpUpyWDWjlUk3smlWeA0\nlIMW+oJ38t92CRLHH3IqRhyECBRW0d0aRGtq7TY8PmxjjvBZrxTNDpJT6KUk4LRm\na6A6IuAI7QnNK8SJqM0DLzlpygd7GJf8ZL9SoHSH+gFsYF67Cpooz/YDqWrlN7Vw\ntO00s0B+eXy+PCXYU7VSfuWFGK8TGEv6HfGMALLjhqMManyvfp8hz3ubN1rK3c8C\nUS/ilRh1qckdbtPvoDPhSbTDmfU1g/EfRSIEXBrIMLg9ka/XB9PvWRrekrppnQzP\nhP9YE3x/wbFc5QqQWiRCYyQl/rgIMOXvIxhkfe8H5n1Et4VAorkpEAXdsfN8KSVv\nLSMazVlLp9GYq5SUpqYX3KnxdWBgN7BJoZ4sltsTpHQ/34SXWfu3UmyUveWj7wp0\nx9hwsPirVI00EEea9AbP7NM2rAyu6ukcm4m6ATd2DZJIViq2es6m60AE6SMCmrQF\nwmk4H/kdQgeAELVfGOm2VyJ3z69fQuywz7xu27S6zTKi05Qlnohxol4wVb6OB7qG\nLPRtK9ObgzRo/OPumyXqlzAi/Yvyd1ZQk8labZps3e16bQp8+pVPiumWioMFJDWV\nGZjCmyMSU8V6MB6njbgLHoyg2LCukCAeSjbPGGGYhnKLm1AKSoJh3IpZuqcKCk5C\n8CM1S15HxV78s9dFntEqIokCAwEAAQ== +66ba20fe:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtfB12w4ZgqsXWZDfUAV/\n6Y4aHUKIu3q4SXrNZ7CXF9nXoAVYrS7NAxJdAodsY3vPCN0g5O8DFXR+390LdOuQ\n+HsGKCc1k5tX5ZXld37EZNTNSbR0k+NKhd9h6X3u6wqPOx7SIKxwAQR8qeeFq4pP\nrt9GAGlxtuYgzIIcKJPwE0dZlcBCg+GnptCUZXp/38BP1eYC+xTXSL6Muq1etYfg\nodXdb7Yl+2h1IHuOwo5rjgY5kpY7GcAs8AjGk3lDD/av60OTYccknH0NCVSmPoXK\nvrxDBOn0LQRNBLcAfnTKgHrzy0Q5h4TNkkyTgxkoQw5ObDk9nnabTxql732yy9BY\ns+hM9+dSFO1HKeVXreYSA2n1ndF18YAvAumzgyqzB7I4pMHXq1kC/8bONMJxwSkS\nYm6CoXKyavp7RqGMyeVpRC7tV+blkrrUml0BwNkxE+XnwDRB3xDV6hqgWe0XrifD\nYTfvd9ScZQP83ip0r4IKlq4GMv/R5shcCRJSkSZ6QSGshH40JYSoiwJf5FHbj9ND\n7do0UAqebWo4yNx63j/wb2ULorW3AClv0BCFSdPsIrCStiGdpgJDBR2P2NZOCob3\nG9uMj+wJD6JJg2nWqNJxkANXX37Qf8plgzssrhrgOvB0fjjS7GYhfkfmZTJ0wPOw\nA8+KzFseBh4UFGgue78KwgkCAwEAAQ== +' +__Keyring= +__KeyringFile="/usr/share/keyrings/ubuntu-archive-keyring.gpg" +__SkipSigCheck=0 +__SkipEmulation=0 +__UseMirror=0 + +__UnprocessedBuildArgs= +while :; do + if [[ "$#" -le 0 ]]; then + break + fi + + lowerI="$(echo "$1" | tr "[:upper:]" "[:lower:]")" + case $lowerI in + -\?|-h|--help) + usage + ;; + arm) + __BuildArch=arm + __UbuntuArch=armhf + __AlpineArch=armv7 + __QEMUArch=arm + ;; + arm64) + __BuildArch=arm64 + __UbuntuArch=arm64 + __AlpineArch=aarch64 + __QEMUArch=aarch64 + __FreeBSDArch=arm64 + __FreeBSDMachineArch=aarch64 + ;; + armel) + __BuildArch=armel + __UbuntuArch=armel + __UbuntuRepo="http://archive.debian.org/debian/" + __CodeName=buster + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + __LLDB_Package="liblldb-6.0-dev" + __UbuntuPackages="${__UbuntuPackages// libomp-dev/}" + __UbuntuPackages="${__UbuntuPackages// libomp5/}" + __UbuntuSuites= + ;; + armv6) + __BuildArch=armv6 + __UbuntuArch=armhf + __QEMUArch=arm + __UbuntuRepo="http://raspbian.raspberrypi.org/raspbian/" + __CodeName=buster + __KeyringFile="/usr/share/keyrings/raspbian-archive-keyring.gpg" + __LLDB_Package="liblldb-6.0-dev" + __UbuntuSuites= + + if [[ -e "$__KeyringFile" ]]; then + __Keyring="--keyring $__KeyringFile" + fi + ;; + loongarch64) + __BuildArch=loongarch64 + __AlpineArch=loongarch64 + __QEMUArch=loongarch64 + __UbuntuArch=loong64 + __UbuntuSuites=unreleased + __LLDB_Package="liblldb-19-dev" + + if [[ "$__CodeName" == "sid" ]]; then + __UbuntuRepo="http://ftp.ports.debian.org/debian-ports/" + fi + ;; + riscv64) + __BuildArch=riscv64 + __AlpineArch=riscv64 + __AlpinePackages="${__AlpinePackages// lldb-dev/}" + __QEMUArch=riscv64 + __UbuntuArch=riscv64 + __UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}" + unset __LLDB_Package + ;; + ppc64le) + __BuildArch=ppc64le + __AlpineArch=ppc64le + __QEMUArch=ppc64le + __UbuntuArch=ppc64el + __UbuntuRepo="http://ports.ubuntu.com/ubuntu-ports/" + __UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}" + __UbuntuPackages="${__UbuntuPackages// libomp-dev/}" + __UbuntuPackages="${__UbuntuPackages// libomp5/}" + unset __LLDB_Package + ;; + s390x) + __BuildArch=s390x + __AlpineArch=s390x + __QEMUArch=s390x + __UbuntuArch=s390x + __UbuntuRepo="http://ports.ubuntu.com/ubuntu-ports/" + __UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}" + __UbuntuPackages="${__UbuntuPackages// libomp-dev/}" + __UbuntuPackages="${__UbuntuPackages// libomp5/}" + unset __LLDB_Package + ;; + x64) + __BuildArch=x64 + __AlpineArch=x86_64 + __UbuntuArch=amd64 + __FreeBSDArch=amd64 + __FreeBSDMachineArch=amd64 + __illumosArch=x86_64 + __HaikuArch=x86_64 + __UbuntuRepo="http://archive.ubuntu.com/ubuntu/" + ;; + x86) + __BuildArch=x86 + __UbuntuArch=i386 + __AlpineArch=x86 + __UbuntuRepo="http://archive.ubuntu.com/ubuntu/" + ;; + lldb*) + version="$(echo "$lowerI" | tr -d '[:alpha:]-=')" + majorVersion="${version%%.*}" + + [ -z "${version##*.*}" ] && minorVersion="${version#*.}" + if [ -z "$minorVersion" ]; then + minorVersion=0 + fi + + # for versions > 6.0, lldb has dropped the minor version + if [ "$majorVersion" -le 6 ]; then + version="$majorVersion.$minorVersion" + else + version="$majorVersion" + fi + + __LLDB_Package="liblldb-${version}-dev" + ;; + no-lldb) + unset __LLDB_Package + ;; + llvm*) + version="$(echo "$lowerI" | tr -d '[:alpha:]-=')" + __LLVM_MajorVersion="${version%%.*}" + + [ -z "${version##*.*}" ] && __LLVM_MinorVersion="${version#*.}" + if [ -z "$__LLVM_MinorVersion" ]; then + __LLVM_MinorVersion=0 + fi + + # for versions > 6.0, lldb has dropped the minor version + if [ "$__LLVM_MajorVersion" -gt 6 ]; then + __LLVM_MinorVersion= + fi + + ;; + xenial) # Ubuntu 16.04 + __CodeName=xenial + ;; + bionic) # Ubuntu 18.04 + __CodeName=bionic + ;; + focal) # Ubuntu 20.04 + __CodeName=focal + ;; + jammy) # Ubuntu 22.04 + __CodeName=jammy + ;; + noble) # Ubuntu 24.04 + __CodeName=noble + if [[ -z "$__LLDB_Package" ]]; then + __LLDB_Package="liblldb-19-dev" + fi + ;; + stretch) # Debian 9 + __CodeName=stretch + __LLDB_Package="liblldb-6.0-dev" + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.debian.org/debian/" + fi + ;; + buster) # Debian 10 + __CodeName=buster + __LLDB_Package="liblldb-6.0-dev" + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://archive.debian.org/debian/" + fi + ;; + bullseye) # Debian 11 + __CodeName=bullseye + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.debian.org/debian/" + fi + ;; + bookworm) # Debian 12 + __CodeName=bookworm + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.debian.org/debian/" + fi + ;; + sid) # Debian sid + __CodeName=sid + __UbuntuSuites= + + # Debian-Ports architectures need different values + case "$__UbuntuArch" in + amd64|arm64|armel|armhf|i386|mips64el|ppc64el|riscv64|s390x) + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.debian.org/debian/" + fi + ;; + *) + __KeyringFile="/usr/share/keyrings/debian-ports-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.ports.debian.org/debian-ports/" + fi + ;; + esac + + if [[ -e "$__KeyringFile" ]]; then + __Keyring="--keyring $__KeyringFile" + fi + ;; + tizen) + __CodeName= + __UbuntuRepo= + __Tizen=tizen + ;; + alpine*) + __CodeName=alpine + __UbuntuRepo= + + if [[ "$lowerI" == "alpineedge" ]]; then + __AlpineVersion=edge + else + version="$(echo "$lowerI" | tr -d '[:alpha:]-=')" + __AlpineMajorVersion="${version%%.*}" + __AlpineMinorVersion="${version#*.}" + __AlpineVersion="$__AlpineMajorVersion.$__AlpineMinorVersion" + fi + ;; + freebsd13) + __CodeName=freebsd + __SkipUnmount=1 + ;; + freebsd14) + __CodeName=freebsd + __FreeBSDBase="14.2-RELEASE" + __FreeBSDABI="14" + __SkipUnmount=1 + ;; + illumos) + __CodeName=illumos + __SkipUnmount=1 + ;; + haiku) + __CodeName=haiku + __SkipUnmount=1 + ;; + --skipunmount) + __SkipUnmount=1 + ;; + --skipsigcheck) + __SkipSigCheck=1 + ;; + --skipemulation) + __SkipEmulation=1 + ;; + --rootfsdir|-rootfsdir) + shift + __RootfsDir="$1" + ;; + --use-mirror) + __UseMirror=1 + ;; + --use-jobs) + shift + MAXJOBS=$1 + ;; + *) + __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1" + ;; + esac + + shift +done + +case "$__AlpineVersion" in + 3.14) __AlpinePackages+=" llvm11-libs" ;; + 3.15) __AlpinePackages+=" llvm12-libs" ;; + 3.16) __AlpinePackages+=" llvm13-libs" ;; + 3.17) __AlpinePackages+=" llvm15-libs" ;; + edge) __AlpineLlvmLibsLookup=1 ;; + *) + if [[ "$__AlpineArch" =~ s390x|ppc64le ]]; then + __AlpineVersion=3.15 # minimum version that supports lldb-dev + __AlpinePackages+=" llvm12-libs" + elif [[ "$__AlpineArch" == "x86" ]]; then + __AlpineVersion=3.17 # minimum version that supports lldb-dev + __AlpinePackages+=" llvm15-libs" + elif [[ "$__AlpineArch" == "riscv64" || "$__AlpineArch" == "loongarch64" ]]; then + __AlpineVersion=3.21 # minimum version that supports lldb-dev + __AlpinePackages+=" llvm19-libs" + elif [[ -n "$__AlpineMajorVersion" ]]; then + # use whichever alpine version is provided and select the latest toolchain libs + __AlpineLlvmLibsLookup=1 + else + __AlpineVersion=3.13 # 3.13 to maximize compatibility + __AlpinePackages+=" llvm10-libs" + fi +esac + +if [[ "$__AlpineVersion" =~ 3\.1[345] ]]; then + # compiler-rt--static was merged in compiler-rt package in alpine 3.16 + # for older versions, we need compiler-rt--static, so replace the name + __AlpinePackages="${__AlpinePackages/compiler-rt/compiler-rt-static}" +fi + +__UbuntuPackages+=" ${__LLDB_Package:-}" + +if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ports.ubuntu.com/" +fi + +if [[ -n "$__LLVM_MajorVersion" ]]; then + __UbuntuPackages+=" libclang-common-${__LLVM_MajorVersion}${__LLVM_MinorVersion:+.$__LLVM_MinorVersion}-dev" +fi + +if [[ -z "$__RootfsDir" && -n "$ROOTFS_DIR" ]]; then + __RootfsDir="$ROOTFS_DIR" +fi + +if [[ -z "$__RootfsDir" ]]; then + __RootfsDir="$__CrossDir/../../../.tools/rootfs/$__BuildArch" +fi + +if [[ -d "$__RootfsDir" ]]; then + if [[ "$__SkipUnmount" == "0" ]]; then + umount "$__RootfsDir"/* || true + fi + rm -rf "$__RootfsDir" +fi + +mkdir -p "$__RootfsDir" +__RootfsDir="$( cd "$__RootfsDir" && pwd )" + +__hasWget= +ensureDownloadTool() +{ + if command -v wget &> /dev/null; then + __hasWget=1 + elif command -v curl &> /dev/null; then + __hasWget=0 + else + >&2 echo "ERROR: either wget or curl is required by this script." + exit 1 + fi +} + +if [[ "$__CodeName" == "alpine" ]]; then + __ApkToolsVersion=2.12.11 + __ApkToolsDir="$(mktemp -d)" + __ApkKeysDir="$(mktemp -d)" + arch="$(uname -m)" + + ensureDownloadTool + + if [[ "$__hasWget" == 1 ]]; then + wget -P "$__ApkToolsDir" "https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v$__ApkToolsVersion/$arch/apk.static" + else + curl -SLO --create-dirs --output-dir "$__ApkToolsDir" "https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v$__ApkToolsVersion/$arch/apk.static" + fi + if [[ "$arch" == "x86_64" ]]; then + __ApkToolsSHA512SUM="53e57b49230da07ef44ee0765b9592580308c407a8d4da7125550957bb72cb59638e04f8892a18b584451c8d841d1c7cb0f0ab680cc323a3015776affaa3be33" + elif [[ "$arch" == "aarch64" ]]; then + __ApkToolsSHA512SUM="9e2b37ecb2b56c05dad23d379be84fd494c14bd730b620d0d576bda760588e1f2f59a7fcb2f2080577e0085f23a0ca8eadd993b4e61c2ab29549fdb71969afd0" + else + echo "WARNING: add missing hash for your host architecture. To find the value, use: 'find /tmp -name apk.static -exec sha512sum {} \;'" + fi + echo "$__ApkToolsSHA512SUM $__ApkToolsDir/apk.static" | sha512sum -c + chmod +x "$__ApkToolsDir/apk.static" + + if [[ "$__AlpineVersion" == "edge" ]]; then + version=edge + else + version="v$__AlpineVersion" + fi + + for line in $__AlpineKeys; do + id="${line%%:*}" + content="${line#*:}" + + echo -e "-----BEGIN PUBLIC KEY-----\n$content\n-----END PUBLIC KEY-----" > "$__ApkKeysDir/alpine-devel@lists.alpinelinux.org-$id.rsa.pub" + done + + if [[ "$__SkipSigCheck" == "1" ]]; then + __ApkSignatureArg="--allow-untrusted" + else + __ApkSignatureArg="--keys-dir $__ApkKeysDir" + fi + + if [[ "$__SkipEmulation" == "1" ]]; then + __NoEmulationArg="--no-scripts" + fi + + # initialize DB + # shellcheck disable=SC2086 + "$__ApkToolsDir/apk.static" \ + -X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \ + -X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \ + -U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" --initdb add + + if [[ "$__AlpineLlvmLibsLookup" == 1 ]]; then + # shellcheck disable=SC2086 + __AlpinePackages+=" $("$__ApkToolsDir/apk.static" \ + -X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \ + -X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \ + -U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" \ + search 'llvm*-libs' | grep -E '^llvm' | sort | tail -1 | sed 's/-[^-]*//2g')" + fi + + # install all packages in one go + # shellcheck disable=SC2086 + "$__ApkToolsDir/apk.static" \ + -X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \ + -X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \ + -U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" $__NoEmulationArg \ + add $__AlpinePackages + + rm -r "$__ApkToolsDir" +elif [[ "$__CodeName" == "freebsd" ]]; then + mkdir -p "$__RootfsDir"/usr/local/etc + JOBS=${MAXJOBS:="$(getconf _NPROCESSORS_ONLN)"} + + ensureDownloadTool + + if [[ "$__hasWget" == 1 ]]; then + wget -O- "https://download.freebsd.org/ftp/releases/${__FreeBSDArch}/${__FreeBSDMachineArch}/${__FreeBSDBase}/base.txz" | tar -C "$__RootfsDir" -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version + else + curl -SL "https://download.freebsd.org/ftp/releases/${__FreeBSDArch}/${__FreeBSDMachineArch}/${__FreeBSDBase}/base.txz" | tar -C "$__RootfsDir" -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version + fi + echo "ABI = \"FreeBSD:${__FreeBSDABI}:${__FreeBSDMachineArch}\"; FINGERPRINTS = \"${__RootfsDir}/usr/share/keys\"; REPOS_DIR = [\"${__RootfsDir}/etc/pkg\"]; REPO_AUTOUPDATE = NO; RUN_SCRIPTS = NO;" > "${__RootfsDir}"/usr/local/etc/pkg.conf + echo "FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly\", mirror_type: \"srv\", signature_type: \"fingerprints\", fingerprints: \"/usr/share/keys/pkg\", enabled: yes }" > "${__RootfsDir}"/etc/pkg/FreeBSD.conf + mkdir -p "$__RootfsDir"/tmp + # get and build package manager + if [[ "$__hasWget" == 1 ]]; then + wget -O- "https://github.com/freebsd/pkg/archive/${__FreeBSDPkg}.tar.gz" | tar -C "$__RootfsDir"/tmp -zxf - + else + curl -SL "https://github.com/freebsd/pkg/archive/${__FreeBSDPkg}.tar.gz" | tar -C "$__RootfsDir"/tmp -zxf - + fi + cd "$__RootfsDir/tmp/pkg-${__FreeBSDPkg}" + # needed for install to succeed + mkdir -p "$__RootfsDir"/host/etc + ./autogen.sh && ./configure --prefix="$__RootfsDir"/host && make -j "$JOBS" && make install + rm -rf "$__RootfsDir/tmp/pkg-${__FreeBSDPkg}" + # install packages we need. + INSTALL_AS_USER=$(whoami) "$__RootfsDir"/host/sbin/pkg -r "$__RootfsDir" -C "$__RootfsDir"/usr/local/etc/pkg.conf update + # shellcheck disable=SC2086 + INSTALL_AS_USER=$(whoami) "$__RootfsDir"/host/sbin/pkg -r "$__RootfsDir" -C "$__RootfsDir"/usr/local/etc/pkg.conf install --yes $__FreeBSDPackages +elif [[ "$__CodeName" == "illumos" ]]; then + mkdir "$__RootfsDir/tmp" + pushd "$__RootfsDir/tmp" + JOBS=${MAXJOBS:="$(getconf _NPROCESSORS_ONLN)"} + + ensureDownloadTool + + echo "Downloading sysroot." + if [[ "$__hasWget" == 1 ]]; then + wget -O- https://github.com/illumos/sysroot/releases/download/20181213-de6af22ae73b-v1/illumos-sysroot-i386-20181213-de6af22ae73b-v1.tar.gz | tar -C "$__RootfsDir" -xzf - + else + curl -SL https://github.com/illumos/sysroot/releases/download/20181213-de6af22ae73b-v1/illumos-sysroot-i386-20181213-de6af22ae73b-v1.tar.gz | tar -C "$__RootfsDir" -xzf - + fi + echo "Building binutils. Please wait.." + if [[ "$__hasWget" == 1 ]]; then + wget -O- https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz | tar -xJf - + else + curl -SL https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz | tar -xJf - + fi + mkdir build-binutils && cd build-binutils + ../binutils-2.42/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.11" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" + make -j "$JOBS" && make install && cd .. + echo "Building gcc. Please wait.." + if [[ "$__hasWget" == 1 ]]; then + wget -O- https://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz | tar -xJf - + else + curl -SL https://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz | tar -xJf - + fi + CFLAGS="-fPIC" + CXXFLAGS="-fPIC" + CXXFLAGS_FOR_TARGET="-fPIC" + CFLAGS_FOR_TARGET="-fPIC" + export CFLAGS CXXFLAGS CXXFLAGS_FOR_TARGET CFLAGS_FOR_TARGET + mkdir build-gcc && cd build-gcc + ../gcc-13.3.0/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.11" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" --with-gnu-as \ + --with-gnu-ld --disable-nls --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libcilkrts --disable-libada --disable-libsanitizer \ + --disable-libquadmath-support --disable-shared --enable-tls + make -j "$JOBS" && make install && cd .. + BaseUrl=https://pkgsrc.smartos.org + if [[ "$__UseMirror" == 1 ]]; then + BaseUrl=https://pkgsrc.smartos.skylime.net + fi + BaseUrl="$BaseUrl/packages/SmartOS/2019Q4/${__illumosArch}/All" + echo "Downloading manifest" + if [[ "$__hasWget" == 1 ]]; then + wget "$BaseUrl" + else + curl -SLO "$BaseUrl" + fi + echo "Downloading dependencies." + read -ra array <<<"$__IllumosPackages" + for package in "${array[@]}"; do + echo "Installing '$package'" + # find last occurrence of package in listing and extract its name + package="$(sed -En '/.*href="('"$package"'-[0-9].*).tgz".*/h;$!d;g;s//\1/p' All)" + echo "Resolved name '$package'" + if [[ "$__hasWget" == 1 ]]; then + wget "$BaseUrl"/"$package".tgz + else + curl -SLO "$BaseUrl"/"$package".tgz + fi + ar -x "$package".tgz + tar --skip-old-files -xzf "$package".tmp.tg* -C "$__RootfsDir" 2>/dev/null + done + echo "Cleaning up temporary files." + popd + rm -rf "$__RootfsDir"/{tmp,+*} + mkdir -p "$__RootfsDir"/usr/include/net + mkdir -p "$__RootfsDir"/usr/include/netpacket + if [[ "$__hasWget" == 1 ]]; then + wget -P "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/bpf.h + wget -P "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/dlt.h + wget -P "$__RootfsDir"/usr/include/netpacket https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/inet/sockmods/netpacket/packet.h + wget -P "$__RootfsDir"/usr/include/sys https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/sys/sdt.h + else + curl -SLO --create-dirs --output-dir "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/bpf.h + curl -SLO --create-dirs --output-dir "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/dlt.h + curl -SLO --create-dirs --output-dir "$__RootfsDir"/usr/include/netpacket https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/inet/sockmods/netpacket/packet.h + curl -SLO --create-dirs --output-dir "$__RootfsDir"/usr/include/sys https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/sys/sdt.h + fi +elif [[ "$__CodeName" == "haiku" ]]; then + JOBS=${MAXJOBS:="$(getconf _NPROCESSORS_ONLN)"} + + echo "Building Haiku sysroot for $__HaikuArch" + mkdir -p "$__RootfsDir/tmp" + pushd "$__RootfsDir/tmp" + + mkdir "$__RootfsDir/tmp/download" + + ensureDownloadTool + + echo "Downloading Haiku package tools" + git clone https://github.com/haiku/haiku-toolchains-ubuntu --depth 1 "$__RootfsDir/tmp/script" + if [[ "$__hasWget" == 1 ]]; then + wget -O "$__RootfsDir/tmp/download/hosttools.zip" "$("$__RootfsDir/tmp/script/fetch.sh" --hosttools)" + else + curl -SLo "$__RootfsDir/tmp/download/hosttools.zip" "$("$__RootfsDir/tmp/script/fetch.sh" --hosttools)" + fi + + unzip -o "$__RootfsDir/tmp/download/hosttools.zip" -d "$__RootfsDir/tmp/bin" + + HaikuBaseUrl="https://eu.hpkg.haiku-os.org/haiku/master/$__HaikuArch/current" + HaikuPortsBaseUrl="https://eu.hpkg.haiku-os.org/haikuports/master/$__HaikuArch/current" + + echo "Downloading HaikuPorts package repository index..." + if [[ "$__hasWget" == 1 ]]; then + wget -P "$__RootfsDir/tmp/download" "$HaikuPortsBaseUrl/repo" + else + curl -SLO --create-dirs --output-dir "$__RootfsDir/tmp/download" "$HaikuPortsBaseUrl/repo" + fi + + echo "Downloading Haiku packages" + read -ra array <<<"$__HaikuPackages" + for package in "${array[@]}"; do + echo "Downloading $package..." + hpkgFilename="$(LD_LIBRARY_PATH="$__RootfsDir/tmp/bin" "$__RootfsDir/tmp/bin/package_repo" list -f "$__RootfsDir/tmp/download/repo" | + grep -E "${package}-" | sort -V | tail -n 1 | xargs)" + if [ -z "$hpkgFilename" ]; then + >&2 echo "ERROR: package $package missing." + exit 1 + fi + echo "Resolved filename: $hpkgFilename..." + hpkgDownloadUrl="$HaikuPortsBaseUrl/packages/$hpkgFilename" + if [[ "$__hasWget" == 1 ]]; then + wget -P "$__RootfsDir/tmp/download" "$hpkgDownloadUrl" + else + curl -SLO --create-dirs --output-dir "$__RootfsDir/tmp/download" "$hpkgDownloadUrl" + fi + done + for package in haiku haiku_devel; do + echo "Downloading $package..." + if [[ "$__hasWget" == 1 ]]; then + hpkgVersion="$(wget -qO- "$HaikuBaseUrl" | sed -n 's/^.*version: "\([^"]*\)".*$/\1/p')" + wget -P "$__RootfsDir/tmp/download" "$HaikuBaseUrl/packages/$package-$hpkgVersion-1-$__HaikuArch.hpkg" + else + hpkgVersion="$(curl -sSL "$HaikuBaseUrl" | sed -n 's/^.*version: "\([^"]*\)".*$/\1/p')" + curl -SLO --create-dirs --output-dir "$__RootfsDir/tmp/download" "$HaikuBaseUrl/packages/$package-$hpkgVersion-1-$__HaikuArch.hpkg" + fi + done + + # Set up the sysroot + echo "Setting up sysroot and extracting required packages" + mkdir -p "$__RootfsDir/boot/system" + for file in "$__RootfsDir/tmp/download/"*.hpkg; do + echo "Extracting $file..." + LD_LIBRARY_PATH="$__RootfsDir/tmp/bin" "$__RootfsDir/tmp/bin/package" extract -C "$__RootfsDir/boot/system" "$file" + done + + # Download buildtools + echo "Downloading Haiku buildtools" + if [[ "$__hasWget" == 1 ]]; then + wget -O "$__RootfsDir/tmp/download/buildtools.zip" "$("$__RootfsDir/tmp/script/fetch.sh" --buildtools --arch=$__HaikuArch)" + else + curl -SLo "$__RootfsDir/tmp/download/buildtools.zip" "$("$__RootfsDir/tmp/script/fetch.sh" --buildtools --arch=$__HaikuArch)" + fi + unzip -o "$__RootfsDir/tmp/download/buildtools.zip" -d "$__RootfsDir" + + # Cleaning up temporary files + echo "Cleaning up temporary files" + popd + rm -rf "$__RootfsDir/tmp" +elif [[ -n "$__CodeName" ]]; then + __Suites="$__CodeName $(for suite in $__UbuntuSuites; do echo -n "$__CodeName-$suite "; done)" + + if [[ "$__SkipEmulation" == "1" ]]; then + if [[ -z "$AR" ]]; then + if command -v ar &>/dev/null; then + AR="$(command -v ar)" + elif command -v llvm-ar &>/dev/null; then + AR="$(command -v llvm-ar)" + else + echo "Unable to find ar or llvm-ar on PATH, add them to PATH or set AR environment variable pointing to the available AR tool" + exit 1 + fi + fi + + PYTHON=${PYTHON_EXECUTABLE:-python3} + + # shellcheck disable=SC2086,SC2046 + echo running "$PYTHON" "$__CrossDir/install-debs.py" --arch "$__UbuntuArch" --mirror "$__UbuntuRepo" --rootfsdir "$__RootfsDir" --artool "$AR" \ + $(for suite in $__Suites; do echo -n "--suite $suite "; done) \ + $__UbuntuPackages + + # shellcheck disable=SC2086,SC2046 + "$PYTHON" "$__CrossDir/install-debs.py" --arch "$__UbuntuArch" --mirror "$__UbuntuRepo" --rootfsdir "$__RootfsDir" --artool "$AR" \ + $(for suite in $__Suites; do echo -n "--suite $suite "; done) \ + $__UbuntuPackages + + exit 0 + fi + + __UpdateOptions= + if [[ "$__SkipSigCheck" == "0" ]]; then + __Keyring="$__Keyring --force-check-gpg" + else + __Keyring= + __UpdateOptions="--allow-unauthenticated --allow-insecure-repositories" + fi + + # shellcheck disable=SC2086 + echo running debootstrap "--variant=minbase" $__Keyring --arch "$__UbuntuArch" "$__CodeName" "$__RootfsDir" "$__UbuntuRepo" + + # shellcheck disable=SC2086 + if ! debootstrap "--variant=minbase" $__Keyring --arch "$__UbuntuArch" "$__CodeName" "$__RootfsDir" "$__UbuntuRepo"; then + echo "debootstrap failed! dumping debootstrap.log" + cat "$__RootfsDir/debootstrap/debootstrap.log" + exit 1 + fi + + rm -rf "$__RootfsDir"/etc/apt/*.{sources,list} "$__RootfsDir"/etc/apt/sources.list.d + mkdir -p "$__RootfsDir/etc/apt/sources.list.d/" + + # shellcheck disable=SC2086 + cat > "$__RootfsDir/etc/apt/sources.list.d/$__CodeName.sources" < token2) - (token1 < token2) + else: + return -1 if isinstance(token1, str) else 1 + + return len(tokens1) - len(tokens2) + +def compare_debian_versions(version1, version2): + """Compare two Debian package versions.""" + epoch1, upstream1, revision1 = parse_debian_version(version1) + epoch2, upstream2, revision2 = parse_debian_version(version2) + + if epoch1 != epoch2: + return epoch1 - epoch2 + + result = compare_upstream_version(upstream1, upstream2) + if result != 0: + return result + + return compare_upstream_version(revision1, revision2) + +def resolve_dependencies(packages, aliases, desired_packages): + """Recursively resolves dependencies for the desired packages.""" + resolved = [] + to_process = deque(desired_packages) + + while to_process: + current = to_process.popleft() + resolved_package = current if current in packages else aliases.get(current, [None])[0] + + if not resolved_package: + print(f"Error: Package '{current}' was not found in the available packages.") + sys.exit(1) + + if resolved_package not in resolved: + resolved.append(resolved_package) + + deps = packages.get(resolved_package, {}).get("Depends", "") + if deps: + deps = [dep.split(' ')[0] for dep in deps.split(', ') if dep] + for dep in deps: + if dep not in resolved and dep not in to_process and dep in packages: + to_process.append(dep) + + return resolved + +def parse_package_index(content): + """Parses the Packages.gz file and returns package information.""" + packages = {} + aliases = {} + entries = re.split(r'\n\n+', content) + + for entry in entries: + fields = dict(re.findall(r'^(\S+): (.+)$', entry, re.MULTILINE)) + if "Package" in fields: + package_name = fields["Package"] + version = fields.get("Version") + filename = fields.get("Filename") + depends = fields.get("Depends") + provides = fields.get("Provides", None) + + # Only update if package_name is not in packages or if the new version is higher + if package_name not in packages or compare_debian_versions(version, packages[package_name]["Version"]) > 0: + packages[package_name] = { + "Version": version, + "Filename": filename, + "Depends": depends + } + + # Update aliases if package provides any alternatives + if provides: + provides_list = [x.strip() for x in provides.split(",")] + for alias in provides_list: + # Strip version specifiers + alias_name = re.sub(r'\s*\(=.*\)', '', alias) + if alias_name not in aliases: + aliases[alias_name] = [] + if package_name not in aliases[alias_name]: + aliases[alias_name].append(package_name) + + return packages, aliases + +def install_packages(mirror, packages_info, aliases, tmp_dir, extract_dir, ar_tool, desired_packages): + """Downloads .deb files and extracts them.""" + resolved_packages = resolve_dependencies(packages_info, aliases, desired_packages) + print(f"Resolved packages (including dependencies): {resolved_packages}") + + packages_to_download = {} + + for pkg in resolved_packages: + if pkg in packages_info: + packages_to_download[pkg] = packages_info[pkg] + + if pkg in aliases: + for alias in aliases[pkg]: + if alias in packages_info: + packages_to_download[alias] = packages_info[alias] + + asyncio.run(download_deb_files_parallel(mirror, packages_to_download, tmp_dir)) + + package_to_deb_file_map = {} + for pkg in resolved_packages: + pkg_info = packages_info.get(pkg) + if pkg_info: + deb_filename = pkg_info.get("Filename") + if deb_filename: + deb_file_path = os.path.join(tmp_dir, os.path.basename(deb_filename)) + package_to_deb_file_map[pkg] = deb_file_path + + for pkg in reversed(resolved_packages): + deb_file = package_to_deb_file_map.get(pkg) + if deb_file and os.path.exists(deb_file): + extract_deb_file(deb_file, tmp_dir, extract_dir, ar_tool) + + print("All done!") + +def extract_deb_file(deb_file, tmp_dir, extract_dir, ar_tool): + """Extract .deb file contents""" + + os.makedirs(extract_dir, exist_ok=True) + + with tempfile.TemporaryDirectory(dir=tmp_dir) as tmp_subdir: + result = subprocess.run(f"{ar_tool} t {os.path.abspath(deb_file)}", cwd=tmp_subdir, check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + tar_filename = None + for line in result.stdout.decode().splitlines(): + if line.startswith("data.tar"): + tar_filename = line.strip() + break + + if not tar_filename: + raise FileNotFoundError(f"Could not find 'data.tar.*' in {deb_file}.") + + tar_file_path = os.path.join(tmp_subdir, tar_filename) + print(f"Extracting {tar_filename} from {deb_file}..") + + subprocess.run(f"{ar_tool} p {os.path.abspath(deb_file)} {tar_filename} > {tar_file_path}", check=True, shell=True) + + file_extension = os.path.splitext(tar_file_path)[1].lower() + + if file_extension == ".xz": + mode = "r:xz" + elif file_extension == ".gz": + mode = "r:gz" + elif file_extension == ".zst": + # zstd is not supported by standard library yet + decompressed_tar_path = tar_file_path.replace(".zst", "") + with open(tar_file_path, "rb") as zst_file, open(decompressed_tar_path, "wb") as decompressed_file: + dctx = zstandard.ZstdDecompressor() + dctx.copy_stream(zst_file, decompressed_file) + + tar_file_path = decompressed_tar_path + mode = "r" + else: + raise ValueError(f"Unsupported compression format: {file_extension}") + + with tarfile.open(tar_file_path, mode) as tar: + tar.extractall(path=extract_dir, filter='fully_trusted') + +def finalize_setup(rootfsdir): + lib_dir = os.path.join(rootfsdir, 'lib') + usr_lib_dir = os.path.join(rootfsdir, 'usr', 'lib') + + if os.path.exists(lib_dir): + if os.path.islink(lib_dir): + os.remove(lib_dir) + else: + os.makedirs(usr_lib_dir, exist_ok=True) + + for item in os.listdir(lib_dir): + src = os.path.join(lib_dir, item) + dest = os.path.join(usr_lib_dir, item) + + if os.path.isdir(src): + shutil.copytree(src, dest, dirs_exist_ok=True) + else: + shutil.copy2(src, dest) + + shutil.rmtree(lib_dir) + + os.symlink(usr_lib_dir, lib_dir) + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Generate rootfs for .NET runtime on Debian-like OS") + parser.add_argument("--distro", required=False, help="Distro name (e.g., debian, ubuntu, etc.)") + parser.add_argument("--arch", required=True, help="Architecture (e.g., amd64, loong64, etc.)") + parser.add_argument("--rootfsdir", required=True, help="Destination directory.") + parser.add_argument('--suite', required=True, action='append', help='Specify one or more repository suites to collect index data.') + parser.add_argument("--mirror", required=False, help="Mirror (e.g., http://ftp.debian.org/debian-ports etc.)") + parser.add_argument("--artool", required=False, default="ar", help="ar tool to extract debs (e.g., ar, llvm-ar etc.)") + parser.add_argument("packages", nargs="+", help="List of package names to be installed.") + + args = parser.parse_args() + + if args.mirror is None: + if args.distro == "ubuntu": + args.mirror = "http://archive.ubuntu.com/ubuntu" if args.arch in ["amd64", "i386"] else "http://ports.ubuntu.com/ubuntu-ports" + elif args.distro == "debian": + args.mirror = "http://ftp.debian.org/debian-ports" + else: + raise Exception("Unsupported distro") + + DESIRED_PACKAGES = args.packages + [ # base packages + "dpkg", + "busybox", + "libc-bin", + "base-files", + "base-passwd", + "debianutils" + ] + + print(f"Creating rootfs. rootfsdir: {args.rootfsdir}, distro: {args.distro}, arch: {args.arch}, suites: {args.suite}, mirror: {args.mirror}") + + package_index_content = asyncio.run(download_package_index_parallel(args.mirror, args.arch, args.suite)) + + packages_info, aliases = parse_package_index(package_index_content) + + with tempfile.TemporaryDirectory() as tmp_dir: + install_packages(args.mirror, packages_info, aliases, tmp_dir, args.rootfsdir, args.artool, DESIRED_PACKAGES) + + finalize_setup(args.rootfsdir) diff --git a/eng/common/cross/riscv64/tizen/tizen.patch b/eng/common/cross/riscv64/tizen/tizen.patch new file mode 100644 index 0000000000000..eb6d1c07470bf --- /dev/null +++ b/eng/common/cross/riscv64/tizen/tizen.patch @@ -0,0 +1,9 @@ +diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so +--- a/usr/lib64/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib64/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf64-littleriscv) +-GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib64/ld-linux-riscv64-lp64d.so.1 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-riscv64-lp64d.so.1 ) ) diff --git a/eng/common/cross/tizen-build-rootfs.sh b/eng/common/cross/tizen-build-rootfs.sh new file mode 100644 index 0000000000000..ba31c93285f63 --- /dev/null +++ b/eng/common/cross/tizen-build-rootfs.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +set -e + +ARCH=$1 +LINK_ARCH=$ARCH + +case "$ARCH" in + arm) + TIZEN_ARCH="armv7hl" + ;; + armel) + TIZEN_ARCH="armv7l" + LINK_ARCH="arm" + ;; + arm64) + TIZEN_ARCH="aarch64" + ;; + x86) + TIZEN_ARCH="i686" + ;; + x64) + TIZEN_ARCH="x86_64" + LINK_ARCH="x86" + ;; + riscv64) + TIZEN_ARCH="riscv64" + LINK_ARCH="riscv" + ;; + *) + echo "Unsupported architecture for tizen: $ARCH" + exit 1 +esac + +__CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +__TIZEN_CROSSDIR="$__CrossDir/${ARCH}/tizen" + +if [[ -z "$ROOTFS_DIR" ]]; then + echo "ROOTFS_DIR is not defined." + exit 1; +fi + +TIZEN_TMP_DIR=$ROOTFS_DIR/tizen_tmp +mkdir -p $TIZEN_TMP_DIR + +# Download files +echo ">>Start downloading files" +VERBOSE=1 $__CrossDir/tizen-fetch.sh $TIZEN_TMP_DIR $TIZEN_ARCH +echo "<>Start constructing Tizen rootfs" +TIZEN_RPM_FILES=`ls $TIZEN_TMP_DIR/*.rpm` +cd $ROOTFS_DIR +for f in $TIZEN_RPM_FILES; do + rpm2cpio $f | cpio -idm --quiet +done +echo "<>Start configuring Tizen rootfs" +ln -sfn asm-${LINK_ARCH} ./usr/include/asm +patch -p1 < $__TIZEN_CROSSDIR/tizen.patch +if [[ "$TIZEN_ARCH" == "riscv64" ]]; then + echo "Fixing broken symlinks in $PWD" + rm ./usr/lib64/libresolv.so + ln -s ../../lib64/libresolv.so.2 ./usr/lib64/libresolv.so + rm ./usr/lib64/libpthread.so + ln -s ../../lib64/libpthread.so.0 ./usr/lib64/libpthread.so + rm ./usr/lib64/libdl.so + ln -s ../../lib64/libdl.so.2 ./usr/lib64/libdl.so + rm ./usr/lib64/libutil.so + ln -s ../../lib64/libutil.so.1 ./usr/lib64/libutil.so + rm ./usr/lib64/libm.so + ln -s ../../lib64/libm.so.6 ./usr/lib64/libm.so + rm ./usr/lib64/librt.so + ln -s ../../lib64/librt.so.1 ./usr/lib64/librt.so + rm ./lib/ld-linux-riscv64-lp64d.so.1 + ln -s ../lib64/ld-linux-riscv64-lp64d.so.1 ./lib/ld-linux-riscv64-lp64d.so.1 +fi +echo "</dev/null; then + VERBOSE=0 +fi + +Log() +{ + if [ $VERBOSE -ge 1 ]; then + echo ${@:2} + fi +} + +Inform() +{ + Log 1 -e "\x1B[0;34m$@\x1B[m" +} + +Debug() +{ + Log 2 -e "\x1B[0;32m$@\x1B[m" +} + +Error() +{ + >&2 Log 0 -e "\x1B[0;31m$@\x1B[m" +} + +Fetch() +{ + URL=$1 + FILE=$2 + PROGRESS=$3 + if [ $VERBOSE -ge 1 ] && [ $PROGRESS ]; then + CURL_OPT="--progress-bar" + else + CURL_OPT="--silent" + fi + curl $CURL_OPT $URL > $FILE +} + +hash curl 2> /dev/null || { Error "Require 'curl' Aborting."; exit 1; } +hash xmllint 2> /dev/null || { Error "Require 'xmllint' Aborting."; exit 1; } +hash sha256sum 2> /dev/null || { Error "Require 'sha256sum' Aborting."; exit 1; } + +TMPDIR=$1 +if [ ! -d $TMPDIR ]; then + TMPDIR=./tizen_tmp + Debug "Create temporary directory : $TMPDIR" + mkdir -p $TMPDIR +fi + +TIZEN_ARCH=$2 + +TIZEN_URL=http://download.tizen.org/snapshots/TIZEN/Tizen +BUILD_XML=build.xml +REPOMD_XML=repomd.xml +PRIMARY_XML=primary.xml +TARGET_URL="http://__not_initialized" + +Xpath_get() +{ + XPATH_RESULT='' + XPATH=$1 + XML_FILE=$2 + RESULT=$(xmllint --xpath $XPATH $XML_FILE) + if [[ -z ${RESULT// } ]]; then + Error "Can not find target from $XML_FILE" + Debug "Xpath = $XPATH" + exit 1 + fi + XPATH_RESULT=$RESULT +} + +fetch_tizen_pkgs_init() +{ + TARGET=$1 + PROFILE=$2 + Debug "Initialize TARGET=$TARGET, PROFILE=$PROFILE" + + TMP_PKG_DIR=$TMPDIR/tizen_${PROFILE}_pkgs + if [ -d $TMP_PKG_DIR ]; then rm -rf $TMP_PKG_DIR; fi + mkdir -p $TMP_PKG_DIR + + PKG_URL=$TIZEN_URL/$PROFILE/latest + + BUILD_XML_URL=$PKG_URL/$BUILD_XML + TMP_BUILD=$TMP_PKG_DIR/$BUILD_XML + TMP_REPOMD=$TMP_PKG_DIR/$REPOMD_XML + TMP_PRIMARY=$TMP_PKG_DIR/$PRIMARY_XML + TMP_PRIMARYGZ=${TMP_PRIMARY}.gz + + Fetch $BUILD_XML_URL $TMP_BUILD + + Debug "fetch $BUILD_XML_URL to $TMP_BUILD" + + TARGET_XPATH="//build/buildtargets/buildtarget[@name=\"$TARGET\"]/repo[@type=\"binary\"]/text()" + Xpath_get $TARGET_XPATH $TMP_BUILD + TARGET_PATH=$XPATH_RESULT + TARGET_URL=$PKG_URL/$TARGET_PATH + + REPOMD_URL=$TARGET_URL/repodata/repomd.xml + PRIMARY_XPATH='string(//*[local-name()="data"][@type="primary"]/*[local-name()="location"]/@href)' + + Fetch $REPOMD_URL $TMP_REPOMD + + Debug "fetch $REPOMD_URL to $TMP_REPOMD" + + Xpath_get $PRIMARY_XPATH $TMP_REPOMD + PRIMARY_XML_PATH=$XPATH_RESULT + PRIMARY_URL=$TARGET_URL/$PRIMARY_XML_PATH + + Fetch $PRIMARY_URL $TMP_PRIMARYGZ + + Debug "fetch $PRIMARY_URL to $TMP_PRIMARYGZ" + + gunzip $TMP_PRIMARYGZ + + Debug "unzip $TMP_PRIMARYGZ to $TMP_PRIMARY" +} + +fetch_tizen_pkgs() +{ + ARCH=$1 + PACKAGE_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="location"]/@href)' + + PACKAGE_CHECKSUM_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="checksum"]/text())' + + for pkg in ${@:2} + do + Inform "Fetching... $pkg" + XPATH=${PACKAGE_XPATH_TPL/_PKG_/$pkg} + XPATH=${XPATH/_ARCH_/$ARCH} + Xpath_get $XPATH $TMP_PRIMARY + PKG_PATH=$XPATH_RESULT + + XPATH=${PACKAGE_CHECKSUM_XPATH_TPL/_PKG_/$pkg} + XPATH=${XPATH/_ARCH_/$ARCH} + Xpath_get $XPATH $TMP_PRIMARY + CHECKSUM=$XPATH_RESULT + + PKG_URL=$TARGET_URL/$PKG_PATH + PKG_FILE=$(basename $PKG_PATH) + PKG_PATH=$TMPDIR/$PKG_FILE + + Debug "Download $PKG_URL to $PKG_PATH" + Fetch $PKG_URL $PKG_PATH true + + echo "$CHECKSUM $PKG_PATH" | sha256sum -c - > /dev/null + if [ $? -ne 0 ]; then + Error "Fail to fetch $PKG_URL to $PKG_PATH" + Debug "Checksum = $CHECKSUM" + exit 1 + fi + done +} + +BASE="Tizen-Base" +UNIFIED="Tizen-Unified" + +Inform "Initialize ${TIZEN_ARCH} base" +fetch_tizen_pkgs_init standard $BASE +Inform "fetch common packages" +fetch_tizen_pkgs ${TIZEN_ARCH} gcc gcc-devel-static glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils +Inform "fetch coreclr packages" +fetch_tizen_pkgs ${TIZEN_ARCH} libgcc libstdc++ libstdc++-devel libunwind libunwind-devel lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu +if [ "$TIZEN_ARCH" != "riscv64" ]; then + fetch_tizen_pkgs ${TIZEN_ARCH} lldb lldb-devel +fi +Inform "fetch corefx packages" +fetch_tizen_pkgs ${TIZEN_ARCH} libcom_err libcom_err-devel zlib zlib-devel libopenssl11 libopenssl1.1-devel krb5 krb5-devel + +Inform "Initialize standard unified" +fetch_tizen_pkgs_init standard $UNIFIED +Inform "fetch corefx packages" +fetch_tizen_pkgs ${TIZEN_ARCH} gssdp gssdp-devel tizen-release + diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake new file mode 100644 index 0000000000000..0ff85cf0367ee --- /dev/null +++ b/eng/common/cross/toolchain.cmake @@ -0,0 +1,387 @@ +set(CROSS_ROOTFS $ENV{ROOTFS_DIR}) + +# reset platform variables (e.g. cmake 3.25 sets LINUX=1) +unset(LINUX) +unset(FREEBSD) +unset(ILLUMOS) +unset(ANDROID) +unset(TIZEN) +unset(HAIKU) + +set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH}) +if(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version) + set(CMAKE_SYSTEM_NAME FreeBSD) + set(FREEBSD 1) +elseif(EXISTS ${CROSS_ROOTFS}/usr/platform/i86pc) + set(CMAKE_SYSTEM_NAME SunOS) + set(ILLUMOS 1) +elseif(EXISTS ${CROSS_ROOTFS}/boot/system/develop/headers/config/HaikuConfig.h) + set(CMAKE_SYSTEM_NAME Haiku) + set(HAIKU 1) +else() + set(CMAKE_SYSTEM_NAME Linux) + set(LINUX 1) +endif() +set(CMAKE_SYSTEM_VERSION 1) + +if(EXISTS ${CROSS_ROOTFS}/etc/tizen-release) + set(TIZEN 1) +elseif(EXISTS ${CROSS_ROOTFS}/android_platform) + set(ANDROID 1) +endif() + +if(TARGET_ARCH_NAME STREQUAL "arm") + set(CMAKE_SYSTEM_PROCESSOR armv7l) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv7-alpine-linux-musleabihf) + set(TOOLCHAIN "armv7-alpine-linux-musleabihf") + elseif(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf) + set(TOOLCHAIN "armv6-alpine-linux-musleabihf") + else() + set(TOOLCHAIN "arm-linux-gnueabihf") + endif() + if(TIZEN) + set(TIZEN_TOOLCHAIN "armv7hl-tizen-linux-gnueabihf") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "arm64") + set(CMAKE_SYSTEM_PROCESSOR aarch64) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl) + set(TOOLCHAIN "aarch64-alpine-linux-musl") + elseif(LINUX) + set(TOOLCHAIN "aarch64-linux-gnu") + if(TIZEN) + set(TIZEN_TOOLCHAIN "aarch64-tizen-linux-gnu") + endif() + elseif(FREEBSD) + set(triple "aarch64-unknown-freebsd12") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "armel") + set(CMAKE_SYSTEM_PROCESSOR armv7l) + set(TOOLCHAIN "arm-linux-gnueabi") + if(TIZEN) + set(TIZEN_TOOLCHAIN "armv7l-tizen-linux-gnueabi") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "armv6") + set(CMAKE_SYSTEM_PROCESSOR armv6l) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf) + set(TOOLCHAIN "armv6-alpine-linux-musleabihf") + else() + set(TOOLCHAIN "arm-linux-gnueabihf") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "loongarch64") + set(CMAKE_SYSTEM_PROCESSOR "loongarch64") + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/loongarch64-alpine-linux-musl) + set(TOOLCHAIN "loongarch64-alpine-linux-musl") + else() + set(TOOLCHAIN "loongarch64-linux-gnu") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "ppc64le") + set(CMAKE_SYSTEM_PROCESSOR ppc64le) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/powerpc64le-alpine-linux-musl) + set(TOOLCHAIN "powerpc64le-alpine-linux-musl") + else() + set(TOOLCHAIN "powerpc64le-linux-gnu") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "riscv64") + set(CMAKE_SYSTEM_PROCESSOR riscv64) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/riscv64-alpine-linux-musl) + set(TOOLCHAIN "riscv64-alpine-linux-musl") + else() + set(TOOLCHAIN "riscv64-linux-gnu") + if(TIZEN) + set(TIZEN_TOOLCHAIN "riscv64-tizen-linux-gnu") + endif() + endif() +elseif(TARGET_ARCH_NAME STREQUAL "s390x") + set(CMAKE_SYSTEM_PROCESSOR s390x) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/s390x-alpine-linux-musl) + set(TOOLCHAIN "s390x-alpine-linux-musl") + else() + set(TOOLCHAIN "s390x-linux-gnu") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "x64") + set(CMAKE_SYSTEM_PROCESSOR x86_64) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/x86_64-alpine-linux-musl) + set(TOOLCHAIN "x86_64-alpine-linux-musl") + elseif(LINUX) + set(TOOLCHAIN "x86_64-linux-gnu") + if(TIZEN) + set(TIZEN_TOOLCHAIN "x86_64-tizen-linux-gnu") + endif() + elseif(FREEBSD) + set(triple "x86_64-unknown-freebsd12") + elseif(ILLUMOS) + set(TOOLCHAIN "x86_64-illumos") + elseif(HAIKU) + set(TOOLCHAIN "x86_64-unknown-haiku") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "x86") + set(CMAKE_SYSTEM_PROCESSOR i686) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) + set(TOOLCHAIN "i586-alpine-linux-musl") + else() + set(TOOLCHAIN "i686-linux-gnu") + endif() + if(TIZEN) + set(TIZEN_TOOLCHAIN "i586-tizen-linux-gnu") + endif() +else() + message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm, arm64, armel, armv6, loongarch64, ppc64le, riscv64, s390x, x64 and x86 are supported!") +endif() + +if(DEFINED ENV{TOOLCHAIN}) + set(TOOLCHAIN $ENV{TOOLCHAIN}) +endif() + +# Specify include paths +if(TIZEN) + function(find_toolchain_dir prefix) + # Dynamically find the version subdirectory + file(GLOB DIRECTORIES "${prefix}/*") + list(GET DIRECTORIES 0 FIRST_MATCH) + get_filename_component(TOOLCHAIN_VERSION ${FIRST_MATCH} NAME) + + set(TIZEN_TOOLCHAIN_PATH "${prefix}/${TOOLCHAIN_VERSION}" PARENT_SCOPE) + endfunction() + + if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") + find_toolchain_dir("${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + else() + find_toolchain_dir("${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + endif() + + message(STATUS "TIZEN_TOOLCHAIN_PATH set to: ${TIZEN_TOOLCHAIN_PATH}") + + include_directories(SYSTEM ${TIZEN_TOOLCHAIN_PATH}/include/c++) + include_directories(SYSTEM ${TIZEN_TOOLCHAIN_PATH}/include/c++/${TIZEN_TOOLCHAIN}) +endif() + +function(locate_toolchain_exec exec var) + set(TOOLSET_PREFIX ${TOOLCHAIN}-) + string(TOUPPER ${exec} EXEC_UPPERCASE) + if(NOT "$ENV{CLR_${EXEC_UPPERCASE}}" STREQUAL "") + set(${var} "$ENV{CLR_${EXEC_UPPERCASE}}" PARENT_SCOPE) + return() + endif() + + find_program(EXEC_LOCATION_${exec} + NAMES + "${TOOLSET_PREFIX}${exec}${CLR_CMAKE_COMPILER_FILE_NAME_VERSION}" + "${TOOLSET_PREFIX}${exec}") + + if (EXEC_LOCATION_${exec} STREQUAL "EXEC_LOCATION_${exec}-NOTFOUND") + message(FATAL_ERROR "Unable to find toolchain executable. Name: ${exec}, Prefix: ${TOOLSET_PREFIX}.") + endif() + set(${var} ${EXEC_LOCATION_${exec}} PARENT_SCOPE) +endfunction() + +if(ANDROID) + if(TARGET_ARCH_NAME STREQUAL "arm") + set(ANDROID_ABI armeabi-v7a) + elseif(TARGET_ARCH_NAME STREQUAL "arm64") + set(ANDROID_ABI arm64-v8a) + endif() + + # extract platform number required by the NDK's toolchain + file(READ "${CROSS_ROOTFS}/android_platform" RID_FILE_CONTENTS) + string(REPLACE "RID=" "" ANDROID_RID "${RID_FILE_CONTENTS}") + string(REGEX REPLACE ".*\\.([0-9]+)-.*" "\\1" ANDROID_PLATFORM "${ANDROID_RID}") + + set(ANDROID_TOOLCHAIN clang) + set(FEATURE_EVENT_TRACE 0) # disable event trace as there is no lttng-ust package in termux repository + set(CMAKE_SYSTEM_LIBRARY_PATH "${CROSS_ROOTFS}/usr/lib") + set(CMAKE_SYSTEM_INCLUDE_PATH "${CROSS_ROOTFS}/usr/include") + + # include official NDK toolchain script + include(${CROSS_ROOTFS}/../build/cmake/android.toolchain.cmake) +elseif(FREEBSD) + # we cross-compile by instructing clang + set(CMAKE_C_COMPILER_TARGET ${triple}) + set(CMAKE_CXX_COMPILER_TARGET ${triple}) + set(CMAKE_ASM_COMPILER_TARGET ${triple}) + set(CMAKE_SYSROOT "${CROSS_ROOTFS}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fuse-ld=lld") +elseif(ILLUMOS) + set(CMAKE_SYSROOT "${CROSS_ROOTFS}") + set(CMAKE_SYSTEM_PREFIX_PATH "${CROSS_ROOTFS}") + set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lssp") + set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lssp") + + include_directories(SYSTEM ${CROSS_ROOTFS}/include) + + locate_toolchain_exec(gcc CMAKE_C_COMPILER) + locate_toolchain_exec(g++ CMAKE_CXX_COMPILER) +elseif(HAIKU) + set(CMAKE_SYSROOT "${CROSS_ROOTFS}") + set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};${CROSS_ROOTFS}/cross-tools-x86_64/bin") + set(CMAKE_SYSTEM_PREFIX_PATH "${CROSS_ROOTFS}") + set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lssp") + set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lssp") + + locate_toolchain_exec(gcc CMAKE_C_COMPILER) + locate_toolchain_exec(g++ CMAKE_CXX_COMPILER) + + # let CMake set up the correct search paths + include(Platform/Haiku) +else() + set(CMAKE_SYSROOT "${CROSS_ROOTFS}") + + set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr") + set(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr") + set(CMAKE_ASM_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr") +endif() + +# Specify link flags + +function(add_toolchain_linker_flag Flag) + set(Config "${ARGV1}") + set(CONFIG_SUFFIX "") + if (NOT Config STREQUAL "") + set(CONFIG_SUFFIX "_${Config}") + endif() + set("CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}_INIT" "${CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}_INIT} ${Flag}" PARENT_SCOPE) + set("CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}_INIT" "${CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}_INIT} ${Flag}" PARENT_SCOPE) +endfunction() + +if(LINUX) + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/lib/${TOOLCHAIN}") + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}") +endif() + +if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") + if(TIZEN) + add_toolchain_linker_flag("-B${TIZEN_TOOLCHAIN_PATH}") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib") + add_toolchain_linker_flag("-L${TIZEN_TOOLCHAIN_PATH}") + endif() +elseif(TARGET_ARCH_NAME MATCHES "^(arm64|x64|riscv64)$") + if(TIZEN) + add_toolchain_linker_flag("-B${TIZEN_TOOLCHAIN_PATH}") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib64") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib64") + add_toolchain_linker_flag("-L${TIZEN_TOOLCHAIN_PATH}") + + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/lib64") + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64") + add_toolchain_linker_flag("-Wl,--rpath-link=${TIZEN_TOOLCHAIN_PATH}") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "s390x") + add_toolchain_linker_flag("--target=${TOOLCHAIN}") +elseif(TARGET_ARCH_NAME STREQUAL "x86") + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) + add_toolchain_linker_flag("--target=${TOOLCHAIN}") + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN}") + endif() + add_toolchain_linker_flag(-m32) + if(TIZEN) + add_toolchain_linker_flag("-B${TIZEN_TOOLCHAIN_PATH}") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib") + add_toolchain_linker_flag("-L${TIZEN_TOOLCHAIN_PATH}") + endif() +elseif(ILLUMOS) + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib/amd64") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/amd64/lib") +elseif(HAIKU) + add_toolchain_linker_flag("-lnetwork") + add_toolchain_linker_flag("-lroot") +endif() + +# Specify compile options + +if((TARGET_ARCH_NAME MATCHES "^(arm|arm64|armel|armv6|loongarch64|ppc64le|riscv64|s390x|x64|x86)$" AND NOT ANDROID AND NOT FREEBSD) OR ILLUMOS OR HAIKU) + set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN}) + set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN}) + set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN}) +endif() + +if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") + add_compile_options(-mthumb) + if (NOT DEFINED CLR_ARM_FPU_TYPE) + set (CLR_ARM_FPU_TYPE vfpv3) + endif (NOT DEFINED CLR_ARM_FPU_TYPE) + + add_compile_options (-mfpu=${CLR_ARM_FPU_TYPE}) + if (NOT DEFINED CLR_ARM_FPU_CAPABILITY) + set (CLR_ARM_FPU_CAPABILITY 0x7) + endif (NOT DEFINED CLR_ARM_FPU_CAPABILITY) + + add_definitions (-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY}) + + # persist variables across multiple try_compile passes + list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CLR_ARM_FPU_TYPE CLR_ARM_FPU_CAPABILITY) + + if(TARGET_ARCH_NAME STREQUAL "armel") + add_compile_options(-mfloat-abi=softfp) + endif() +elseif(TARGET_ARCH_NAME STREQUAL "s390x") + add_compile_options("--target=${TOOLCHAIN}") +elseif(TARGET_ARCH_NAME STREQUAL "x86") + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) + add_compile_options(--target=${TOOLCHAIN}) + endif() + add_compile_options(-m32) + add_compile_options(-Wno-error=unused-command-line-argument) +endif() + +if(TIZEN) + if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64|x86)$") + add_compile_options(-Wno-deprecated-declarations) # compile-time option + add_compile_options(-D__extern_always_inline=inline) # compile-time option + endif() +endif() + +# Set LLDB include and library paths for builds that need lldb. +if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") + if(TARGET_ARCH_NAME STREQUAL "x86") + set(LLVM_CROSS_DIR "$ENV{LLVM_CROSS_HOME}") + else() # arm/armel case + set(LLVM_CROSS_DIR "$ENV{LLVM_ARM_HOME}") + endif() + if(LLVM_CROSS_DIR) + set(WITH_LLDB_LIBS "${LLVM_CROSS_DIR}/lib/" CACHE STRING "") + set(WITH_LLDB_INCLUDES "${LLVM_CROSS_DIR}/include" CACHE STRING "") + set(LLDB_H "${WITH_LLDB_INCLUDES}" CACHE STRING "") + set(LLDB "${LLVM_CROSS_DIR}/lib/liblldb.so" CACHE STRING "") + else() + if(TARGET_ARCH_NAME STREQUAL "x86") + set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/i386-linux-gnu" CACHE STRING "") + set(CHECK_LLVM_DIR "${CROSS_ROOTFS}/usr/lib/llvm-3.8/include") + if(EXISTS "${CHECK_LLVM_DIR}" AND IS_DIRECTORY "${CHECK_LLVM_DIR}") + set(WITH_LLDB_INCLUDES "${CHECK_LLVM_DIR}") + else() + set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include") + endif() + else() # arm/armel case + set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}" CACHE STRING "") + set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include" CACHE STRING "") + endif() + endif() +endif() + +# Set C++ standard library options if specified +set(CLR_CMAKE_CXX_STANDARD_LIBRARY "" CACHE STRING "Standard library flavor to link against. Only supported with the Clang compiler.") +if (CLR_CMAKE_CXX_STANDARD_LIBRARY) + add_compile_options($<$:--stdlib=${CLR_CMAKE_CXX_STANDARD_LIBRARY}>) + add_link_options($<$:--stdlib=${CLR_CMAKE_CXX_STANDARD_LIBRARY}>) +endif() + +option(CLR_CMAKE_CXX_STANDARD_LIBRARY_STATIC "Statically link against the C++ standard library" OFF) +if(CLR_CMAKE_CXX_STANDARD_LIBRARY_STATIC) + add_link_options($<$:-static-libstdc++>) +endif() + +set(CLR_CMAKE_CXX_ABI_LIBRARY "" CACHE STRING "C++ ABI implementation library to link against. Only supported with the Clang compiler.") +if (CLR_CMAKE_CXX_ABI_LIBRARY) + # The user may specify the ABI library with the 'lib' prefix, like 'libstdc++'. Strip the prefix here so the linker finds the right library. + string(REGEX REPLACE "^lib(.+)" "\\1" CLR_CMAKE_CXX_ABI_LIBRARY ${CLR_CMAKE_CXX_ABI_LIBRARY}) + # We need to specify this as a linker-backend option as Clang will filter this option out when linking to libc++. + add_link_options("LINKER:-l${CLR_CMAKE_CXX_ABI_LIBRARY}") +endif() + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/eng/common/cross/x64/tizen/tizen.patch b/eng/common/cross/x64/tizen/tizen.patch new file mode 100644 index 0000000000000..56fbc881095b3 --- /dev/null +++ b/eng/common/cross/x64/tizen/tizen.patch @@ -0,0 +1,9 @@ +diff -u -r a/usr/lib64/libc.so b/usr/lib64/libc.so +--- a/usr/lib64/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib64/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf64-x86-64) +-GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-x86-64.so.2 ) ) diff --git a/eng/common/cross/x86/tizen/tizen.patch b/eng/common/cross/x86/tizen/tizen.patch new file mode 100644 index 0000000000000..f4fe8838ad668 --- /dev/null +++ b/eng/common/cross/x86/tizen/tizen.patch @@ -0,0 +1,9 @@ +diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so +--- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf32-i386) +-GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.2 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux.so.2 ) ) diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 new file mode 100644 index 0000000000000..e337431056354 --- /dev/null +++ b/eng/common/darc-init.ps1 @@ -0,0 +1,47 @@ +param ( + $darcVersion = $null, + $versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20', + $verbosity = 'minimal', + $toolpath = $null +) + +. $PSScriptRoot\tools.ps1 + +function InstallDarcCli ($darcVersion, $toolpath) { + $darcCliPackageName = 'microsoft.dotnet.darc' + + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + $toolList = & "$dotnet" tool list -g + + if ($toolList -like "*$darcCliPackageName*") { + & "$dotnet" tool uninstall $darcCliPackageName -g + } + + # If the user didn't explicitly specify the darc version, + # query the Maestro API for the correct version of darc to install. + if (-not $darcVersion) { + $darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content + } + + $arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + + Write-Host "Installing Darc CLI version $darcVersion..." + Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' + if (-not $toolpath) { + Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g" + & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g + }else { + Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity --tool-path '$toolpath'" + & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath" + } +} + +try { + InstallDarcCli $darcVersion $toolpath +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'Darc' -Message $_ + ExitWithExitCode 1 +} \ No newline at end of file diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh new file mode 100755 index 0000000000000..9f5ad6b763b5d --- /dev/null +++ b/eng/common/darc-init.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +darcVersion='' +versionEndpoint='https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20' +verbosity='minimal' + +while [[ $# -gt 0 ]]; do + opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + --darcversion) + darcVersion=$2 + shift + ;; + --versionendpoint) + versionEndpoint=$2 + shift + ;; + --verbosity) + verbosity=$2 + shift + ;; + --toolpath) + toolpath=$2 + shift + ;; + *) + echo "Invalid argument: $1" + usage + exit 1 + ;; + esac + + shift +done + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. "$scriptroot/tools.sh" + +if [ -z "$darcVersion" ]; then + darcVersion=$(curl -X GET "$versionEndpoint" -H "accept: text/plain") +fi + +function InstallDarcCli { + local darc_cli_package_name="microsoft.dotnet.darc" + + InitializeDotNetCli true + local dotnet_root=$_InitializeDotNetCli + + if [ -z "$toolpath" ]; then + local tool_list=$($dotnet_root/dotnet tool list -g) + if [[ $tool_list = *$darc_cli_package_name* ]]; then + echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name -g) + fi + else + local tool_list=$($dotnet_root/dotnet tool list --tool-path "$toolpath") + if [[ $tool_list = *$darc_cli_package_name* ]]; then + echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name --tool-path "$toolpath") + fi + fi + + local arcadeServicesSource="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" + + echo "Installing Darc CLI version $darcVersion..." + echo "You may need to restart your command shell if this is the first dotnet tool you have installed." + if [ -z "$toolpath" ]; then + echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g) + else + echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath") + fi +} + +InstallDarcCli diff --git a/eng/common/dotnet-install.cmd b/eng/common/dotnet-install.cmd new file mode 100644 index 0000000000000..b1c2642e76f72 --- /dev/null +++ b/eng/common/dotnet-install.cmd @@ -0,0 +1,2 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0dotnet-install.ps1""" %*" \ No newline at end of file diff --git a/eng/common/dotnet-install.ps1 b/eng/common/dotnet-install.ps1 new file mode 100644 index 0000000000000..811f0f717f736 --- /dev/null +++ b/eng/common/dotnet-install.ps1 @@ -0,0 +1,28 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string] $verbosity = 'minimal', + [string] $architecture = '', + [string] $version = 'Latest', + [string] $runtime = 'dotnet', + [string] $RuntimeSourceFeed = '', + [string] $RuntimeSourceFeedKey = '' +) + +. $PSScriptRoot\tools.ps1 + +$dotnetRoot = Join-Path $RepoRoot '.dotnet' + +$installdir = $dotnetRoot +try { + if ($architecture -and $architecture.Trim() -eq 'x86') { + $installdir = Join-Path $installdir 'x86' + } + InstallDotNet $installdir $version $architecture $runtime $true -RuntimeSourceFeed $RuntimeSourceFeed -RuntimeSourceFeedKey $RuntimeSourceFeedKey +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ + ExitWithExitCode 1 +} + +ExitWithExitCode 0 diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh new file mode 100755 index 0000000000000..61f302bb67756 --- /dev/null +++ b/eng/common/dotnet-install.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. "$scriptroot/tools.sh" + +version='Latest' +architecture='' +runtime='dotnet' +runtimeSourceFeed='' +runtimeSourceFeedKey='' +while [[ $# -gt 0 ]]; do + opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + -version|-v) + shift + version="$1" + ;; + -architecture|-a) + shift + architecture="$1" + ;; + -runtime|-r) + shift + runtime="$1" + ;; + -runtimesourcefeed) + shift + runtimeSourceFeed="$1" + ;; + -runtimesourcefeedkey) + shift + runtimeSourceFeedKey="$1" + ;; + *) + Write-PipelineTelemetryError -Category 'Build' -Message "Invalid argument: $1" + exit 1 + ;; + esac + shift +done + +# Use uname to determine what the CPU is, see https://en.wikipedia.org/wiki/Uname#Examples +cpuname=$(uname -m) +case $cpuname in + arm64|aarch64) + buildarch=arm64 + if [ "$(getconf LONG_BIT)" -lt 64 ]; then + # This is 32-bit OS running on 64-bit CPU (for example Raspberry Pi OS) + buildarch=arm + fi + ;; + loongarch64) + buildarch=loongarch64 + ;; + amd64|x86_64) + buildarch=x64 + ;; + armv*l) + buildarch=arm + ;; + i[3-6]86) + buildarch=x86 + ;; + riscv64) + buildarch=riscv64 + ;; + *) + echo "Unknown CPU $cpuname detected, treating it as x64" + buildarch=x64 + ;; +esac + +dotnetRoot="${repo_root}.dotnet" +if [[ $architecture != "" ]] && [[ $architecture != $buildarch ]]; then + dotnetRoot="$dotnetRoot/$architecture" +fi + +InstallDotNet "$dotnetRoot" $version "$architecture" $runtime true $runtimeSourceFeed $runtimeSourceFeedKey || { + local exit_code=$? + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2 + ExitWithExitCode $exit_code +} + +ExitWithExitCode 0 diff --git a/eng/common/dotnet.cmd b/eng/common/dotnet.cmd new file mode 100644 index 0000000000000..527fa4bb38fb7 --- /dev/null +++ b/eng/common/dotnet.cmd @@ -0,0 +1,7 @@ +@echo off + +:: This script is used to install the .NET SDK. +:: It will also invoke the SDK with any provided arguments. + +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0dotnet.ps1""" %*" +exit /b %ErrorLevel% diff --git a/eng/common/dotnet.ps1 b/eng/common/dotnet.ps1 new file mode 100644 index 0000000000000..45e5676c9ebd0 --- /dev/null +++ b/eng/common/dotnet.ps1 @@ -0,0 +1,11 @@ +# This script is used to install the .NET SDK. +# It will also invoke the SDK with any provided arguments. + +. $PSScriptRoot\tools.ps1 +$dotnetRoot = InitializeDotNetCli -install:$true + +# Invoke acquired SDK with args if they are provided +if ($args.count -gt 0) { + $env:DOTNET_NOLOGO=1 + & "$dotnetRoot\dotnet.exe" $args +} diff --git a/eng/common/dotnet.sh b/eng/common/dotnet.sh new file mode 100644 index 0000000000000..f6d24871c1d47 --- /dev/null +++ b/eng/common/dotnet.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# This script is used to install the .NET SDK. +# It will also invoke the SDK with any provided arguments. + +source="${BASH_SOURCE[0]}" +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +source $scriptroot/tools.sh +InitializeDotNetCli true # install + +# Invoke acquired SDK with args if they are provided +if [[ $# -gt 0 ]]; then + __dotnetDir=${_InitializeDotNetCli} + dotnetPath=${__dotnetDir}/dotnet + ${dotnetPath} "$@" +fi diff --git a/eng/common/enable-cross-org-publishing.ps1 b/eng/common/enable-cross-org-publishing.ps1 new file mode 100644 index 0000000000000..da09da4f1fc44 --- /dev/null +++ b/eng/common/enable-cross-org-publishing.ps1 @@ -0,0 +1,13 @@ +param( + [string] $token +) + + +. $PSScriptRoot\pipeline-logging-functions.ps1 + +# Write-PipelineSetVariable will no-op if a variable named $ci is not defined +# Since this script is only ever called in AzDO builds, just universally set it +$ci = $true + +Write-PipelineSetVariable -Name 'VSS_NUGET_ACCESSTOKEN' -Value $token -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'VSS_NUGET_URI_PREFIXES' -Value 'https://dnceng.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/dnceng/;https://devdiv.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/devdiv/' -IsMultiJobVariable $false diff --git a/eng/common/generate-locproject.ps1 b/eng/common/generate-locproject.ps1 new file mode 100644 index 0000000000000..fa1cdc2b30076 --- /dev/null +++ b/eng/common/generate-locproject.ps1 @@ -0,0 +1,226 @@ +Param( + [Parameter(Mandatory=$true)][string] $SourcesDirectory, # Directory where source files live; if using a Localize directory it should live in here + [string] $LanguageSet = 'VS_Main_Languages', # Language set to be used in the LocProject.json + [switch] $UseCheckedInLocProjectJson, # When set, generates a LocProject.json and compares it to one that already exists in the repo; otherwise just generates one + [switch] $CreateNeutralXlfs # Creates neutral xlf files. Only set to false when running locally +) + +# Generates LocProject.json files for the OneLocBuild task. OneLocBuildTask is described here: +# https://ceapex.visualstudio.com/CEINTL/_wiki/wikis/CEINTL.wiki/107/Localization-with-OneLocBuild-Task + +Set-StrictMode -Version 2.0 +$ErrorActionPreference = "Stop" +. $PSScriptRoot\pipeline-logging-functions.ps1 + +$exclusionsFilePath = "$SourcesDirectory\eng\Localize\LocExclusions.json" +$exclusions = @{ Exclusions = @() } +if (Test-Path -Path $exclusionsFilePath) +{ + $exclusions = Get-Content "$exclusionsFilePath" | ConvertFrom-Json +} + +Push-Location "$SourcesDirectory" # push location for Resolve-Path -Relative to work + +# Template files +$jsonFiles = @() +$jsonTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\.template\.config\\localize\\.+\.en\.json" } # .NET templating pattern +$jsonTemplateFiles | ForEach-Object { + $null = $_.Name -Match "(.+)\.[\w-]+\.json" # matches '[filename].[langcode].json + + $destinationFile = "$($_.Directory.FullName)\$($Matches.1).json" + $jsonFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru +} + +$jsonWinformsTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\\strings\.json" } # current winforms pattern + +$wxlFilesV3 = @() +$wxlFilesV5 = @() +$wxlFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\\.+\.wxl" -And -Not( $_.Directory.Name -Match "\d{4}" ) } # localized files live in four digit lang ID directories; this excludes them +if (-not $wxlFiles) { + $wxlEnFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\\1033\\.+\.wxl" } # pick up en files (1033 = en) specifically so we can copy them to use as the neutral xlf files + if ($wxlEnFiles) { + $wxlFiles = @() + $wxlEnFiles | ForEach-Object { + $destinationFile = "$($_.Directory.Parent.FullName)\$($_.Name)" + $content = Get-Content $_.FullName -Raw + + # Split files on schema to select different parser settings in the generated project. + if ($content -like "*http://wixtoolset.org/schemas/v4/wxl*") + { + $wxlFilesV5 += Copy-Item $_.FullName -Destination $destinationFile -PassThru + } + elseif ($content -like "*http://schemas.microsoft.com/wix/2006/localization*") + { + $wxlFilesV3 += Copy-Item $_.FullName -Destination $destinationFile -PassThru + } + } + } +} + +$macosHtmlEnFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\.lproj\\.+\.html$" } # add installer HTML files +$macosHtmlFiles = @() +if ($macosHtmlEnFiles) { + $macosHtmlEnFiles | ForEach-Object { + $destinationFile = "$($_.Directory.Parent.FullName)\$($_.Name)" + $macosHtmlFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru + } +} + +$xlfFiles = @() + +$allXlfFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory\*\*.xlf" +$langXlfFiles = @() +if ($allXlfFiles) { + $null = $allXlfFiles[0].FullName -Match "\.([\w-]+)\.xlf" # matches '[langcode].xlf' + $firstLangCode = $Matches.1 + $langXlfFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory\*\*.$firstLangCode.xlf" +} +$langXlfFiles | ForEach-Object { + $null = $_.Name -Match "(.+)\.[\w-]+\.xlf" # matches '[filename].[langcode].xlf + + $destinationFile = "$($_.Directory.FullName)\$($Matches.1).xlf" + $xlfFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru +} + +$locFiles = $jsonFiles + $jsonWinformsTemplateFiles + $xlfFiles + +$locJson = @{ + Projects = @( + @{ + LanguageSet = $LanguageSet + LocItems = @( + $locFiles | ForEach-Object { + $outputPath = "$(($_.DirectoryName | Resolve-Path -Relative) + "\")" + $continue = $true + foreach ($exclusion in $exclusions.Exclusions) { + if ($_.FullName.Contains($exclusion)) + { + $continue = $false + } + } + $sourceFile = ($_.FullName | Resolve-Path -Relative) + if (!$CreateNeutralXlfs -and $_.Extension -eq '.xlf') { + Remove-Item -Path $sourceFile + } + if ($continue) + { + if ($_.Directory.Name -eq 'en' -and $_.Extension -eq '.json') { + return @{ + SourceFile = $sourceFile + CopyOption = "LangIDOnPath" + OutputPath = "$($_.Directory.Parent.FullName | Resolve-Path -Relative)\" + } + } else { + return @{ + SourceFile = $sourceFile + CopyOption = "LangIDOnName" + OutputPath = $outputPath + } + } + } + } + ) + }, + @{ + LanguageSet = $LanguageSet + CloneLanguageSet = "WiX_CloneLanguages" + LssFiles = @( "wxl_loc.lss" ) + LocItems = @( + $wxlFilesV3 | ForEach-Object { + $outputPath = "$($_.Directory.FullName | Resolve-Path -Relative)\" + $continue = $true + foreach ($exclusion in $exclusions.Exclusions) { + if ($_.FullName.Contains($exclusion)) { + $continue = $false + } + } + $sourceFile = ($_.FullName | Resolve-Path -Relative) + if ($continue) + { + return @{ + SourceFile = $sourceFile + CopyOption = "LangIDOnPath" + OutputPath = $outputPath + } + } + } + ) + }, + @{ + LanguageSet = $LanguageSet + CloneLanguageSet = "WiX_CloneLanguages" + LssFiles = @( "P210WxlSchemaV4.lss" ) + LocItems = @( + $wxlFilesV5 | ForEach-Object { + $outputPath = "$($_.Directory.FullName | Resolve-Path -Relative)\" + $continue = $true + foreach ($exclusion in $exclusions.Exclusions) { + if ($_.FullName.Contains($exclusion)) { + $continue = $false + } + } + $sourceFile = ($_.FullName | Resolve-Path -Relative) + if ($continue) + { + return @{ + SourceFile = $sourceFile + CopyOption = "LangIDOnPath" + OutputPath = $outputPath + } + } + } + ) + }, + @{ + LanguageSet = $LanguageSet + CloneLanguageSet = "VS_macOS_CloneLanguages" + LssFiles = @( ".\eng\common\loc\P22DotNetHtmlLocalization.lss" ) + LocItems = @( + $macosHtmlFiles | ForEach-Object { + $outputPath = "$($_.Directory.FullName | Resolve-Path -Relative)\" + $continue = $true + foreach ($exclusion in $exclusions.Exclusions) { + if ($_.FullName.Contains($exclusion)) { + $continue = $false + } + } + $sourceFile = ($_.FullName | Resolve-Path -Relative) + $lciFile = $sourceFile + ".lci" + if ($continue) { + $result = @{ + SourceFile = $sourceFile + CopyOption = "LangIDOnPath" + OutputPath = $outputPath + } + if (Test-Path $lciFile -PathType Leaf) { + $result["LciFile"] = $lciFile + } + return $result + } + } + ) + } + ) +} + +$json = ConvertTo-Json $locJson -Depth 5 +Write-Host "LocProject.json generated:`n`n$json`n`n" +Pop-Location + +if (!$UseCheckedInLocProjectJson) { + New-Item "$SourcesDirectory\eng\Localize\LocProject.json" -Force # Need this to make sure the Localize directory is created + Set-Content "$SourcesDirectory\eng\Localize\LocProject.json" $json +} +else { + New-Item "$SourcesDirectory\eng\Localize\LocProject-generated.json" -Force # Need this to make sure the Localize directory is created + Set-Content "$SourcesDirectory\eng\Localize\LocProject-generated.json" $json + + if ((Get-FileHash "$SourcesDirectory\eng\Localize\LocProject-generated.json").Hash -ne (Get-FileHash "$SourcesDirectory\eng\Localize\LocProject.json").Hash) { + Write-PipelineTelemetryError -Category "OneLocBuild" -Message "Existing LocProject.json differs from generated LocProject.json. Download LocProject-generated.json and compare them." + + exit 1 + } + else { + Write-Host "Generated LocProject.json and current LocProject.json are identical." + } +} diff --git a/eng/common/generate-sbom-prep.ps1 b/eng/common/generate-sbom-prep.ps1 new file mode 100644 index 0000000000000..a0c7d792a76fb --- /dev/null +++ b/eng/common/generate-sbom-prep.ps1 @@ -0,0 +1,29 @@ +Param( + [Parameter(Mandatory=$true)][string] $ManifestDirPath # Manifest directory where sbom will be placed +) + +. $PSScriptRoot\pipeline-logging-functions.ps1 + +# Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly +# with their own overwriting ours. So we create it as a sub directory of the requested manifest path. +$ArtifactName = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" +$SafeArtifactName = $ArtifactName -replace '["/:<>\\|?@*"() ]', '_' +$SbomGenerationDir = Join-Path $ManifestDirPath $SafeArtifactName + +Write-Host "Artifact name before : $ArtifactName" +Write-Host "Artifact name after : $SafeArtifactName" + +Write-Host "Creating dir $ManifestDirPath" + +# create directory for sbom manifest to be placed +if (!(Test-Path -path $SbomGenerationDir)) +{ + New-Item -ItemType Directory -path $SbomGenerationDir + Write-Host "Successfully created directory $SbomGenerationDir" +} +else{ + Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." +} + +Write-Host "Updating artifact name" +Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$SafeArtifactName" diff --git a/eng/common/generate-sbom-prep.sh b/eng/common/generate-sbom-prep.sh new file mode 100644 index 0000000000000..b8ecca72bbf50 --- /dev/null +++ b/eng/common/generate-sbom-prep.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +. $scriptroot/pipeline-logging-functions.sh + + +# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts. +artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM" +safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}" +manifest_dir=$1 + +# Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly +# with their own overwriting ours. So we create it as a sub directory of the requested manifest path. +sbom_generation_dir="$manifest_dir/$safe_artifact_name" + +if [ ! -d "$sbom_generation_dir" ] ; then + mkdir -p "$sbom_generation_dir" + echo "Sbom directory created." $sbom_generation_dir +else + Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." +fi + +echo "Artifact name before : "$artifact_name +echo "Artifact name after : "$safe_artifact_name +export ARTIFACT_NAME=$safe_artifact_name +echo "##vso[task.setvariable variable=ARTIFACT_NAME]$safe_artifact_name" + +exit 0 diff --git a/eng/common/helixpublish.proj b/eng/common/helixpublish.proj new file mode 100644 index 0000000000000..c1323bf412105 --- /dev/null +++ b/eng/common/helixpublish.proj @@ -0,0 +1,27 @@ + + + + + msbuild + + + + + %(Identity) + + + + + + $(WorkItemDirectory) + $(WorkItemCommand) + $(WorkItemTimeout) + + + + + + + + + diff --git a/eng/common/init-tools-native.cmd b/eng/common/init-tools-native.cmd new file mode 100644 index 0000000000000..438cd548c452c --- /dev/null +++ b/eng/common/init-tools-native.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -NoProfile -NoLogo -ExecutionPolicy ByPass -command "& """%~dp0init-tools-native.ps1""" %*" +exit /b %ErrorLevel% \ No newline at end of file diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 new file mode 100644 index 0000000000000..27ccdb9ecc951 --- /dev/null +++ b/eng/common/init-tools-native.ps1 @@ -0,0 +1,203 @@ +<# +.SYNOPSIS +Entry point script for installing native tools + +.DESCRIPTION +Reads $RepoRoot\global.json file to determine native assets to install +and executes installers for those tools + +.PARAMETER BaseUri +Base file directory or Url from which to acquire tool archives + +.PARAMETER InstallDirectory +Directory to install native toolset. This is a command-line override for the default +Install directory precedence order: +- InstallDirectory command-line override +- NETCOREENG_INSTALL_DIRECTORY environment variable +- (default) %USERPROFILE%/.netcoreeng/native + +.PARAMETER Clean +Switch specifying to not install anything, but cleanup native asset folders + +.PARAMETER Force +Clean and then install tools + +.PARAMETER DownloadRetries +Total number of retry attempts + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds + +.PARAMETER GlobalJsonFile +File path to global.json file + +.PARAMETER PathPromotion +Optional switch to enable either promote native tools specified in the global.json to the path (in Azure Pipelines) +or break the build if a native tool is not found on the path (on a local dev machine) + +.NOTES +#> +[CmdletBinding(PositionalBinding=$false)] +Param ( + [string] $BaseUri = 'https://netcorenativeassets.blob.core.windows.net/resource-packages/external', + [string] $InstallDirectory, + [switch] $Clean = $False, + [switch] $Force = $False, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30, + [string] $GlobalJsonFile, + [switch] $PathPromotion +) + +if (!$GlobalJsonFile) { + $GlobalJsonFile = Join-Path (Get-Item $PSScriptRoot).Parent.Parent.FullName 'global.json' +} + +Set-StrictMode -version 2.0 +$ErrorActionPreference='Stop' + +. $PSScriptRoot\pipeline-logging-functions.ps1 +Import-Module -Name (Join-Path $PSScriptRoot 'native\CommonLibrary.psm1') + +try { + # Define verbose switch if undefined + $Verbose = $VerbosePreference -Eq 'Continue' + + $EngCommonBaseDir = Join-Path $PSScriptRoot 'native\' + $NativeBaseDir = $InstallDirectory + if (!$NativeBaseDir) { + $NativeBaseDir = CommonLibrary\Get-NativeInstallDirectory + } + $Env:CommonLibrary_NativeInstallDir = $NativeBaseDir + $InstallBin = Join-Path $NativeBaseDir 'bin' + $InstallerPath = Join-Path $EngCommonBaseDir 'install-tool.ps1' + + # Process tools list + Write-Host "Processing $GlobalJsonFile" + If (-Not (Test-Path $GlobalJsonFile)) { + Write-Host "Unable to find '$GlobalJsonFile'" + exit 0 + } + $NativeTools = Get-Content($GlobalJsonFile) -Raw | + ConvertFrom-Json | + Select-Object -Expand 'native-tools' -ErrorAction SilentlyContinue + if ($NativeTools) { + if ($PathPromotion -eq $True) { + $ArcadeToolsDirectory = "$env:SYSTEMDRIVE\arcade-tools" + if (Test-Path $ArcadeToolsDirectory) { # if this directory exists, we should use native tools on machine + $NativeTools.PSObject.Properties | ForEach-Object { + $ToolName = $_.Name + $ToolVersion = $_.Value + $InstalledTools = @{} + + if ((Get-Command "$ToolName" -ErrorAction SilentlyContinue) -eq $null) { + if ($ToolVersion -eq "latest") { + $ToolVersion = "" + } + $ToolDirectories = (Get-ChildItem -Path "$ArcadeToolsDirectory" -Filter "$ToolName-$ToolVersion*" | Sort-Object -Descending) + if ($ToolDirectories -eq $null) { + Write-Error "Unable to find directory for $ToolName $ToolVersion; please make sure the tool is installed on this image." + exit 1 + } + $ToolDirectory = $ToolDirectories[0] + $BinPathFile = "$($ToolDirectory.FullName)\binpath.txt" + if (-not (Test-Path -Path "$BinPathFile")) { + Write-Error "Unable to find binpath.txt in '$($ToolDirectory.FullName)' ($ToolName $ToolVersion); artifact is either installed incorrectly or is not a bootstrappable tool." + exit 1 + } + $BinPath = Get-Content "$BinPathFile" + $ToolPath = Convert-Path -Path $BinPath + Write-Host "Adding $ToolName to the path ($ToolPath)..." + Write-Host "##vso[task.prependpath]$ToolPath" + $env:PATH = "$ToolPath;$env:PATH" + $InstalledTools += @{ $ToolName = $ToolDirectory.FullName } + } + } + return $InstalledTools + } else { + $NativeTools.PSObject.Properties | ForEach-Object { + $ToolName = $_.Name + $ToolVersion = $_.Value + + if ((Get-Command "$ToolName" -ErrorAction SilentlyContinue) -eq $null) { + Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message "$ToolName not found on path. Please install $ToolName $ToolVersion before proceeding." + Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message "If this is running on a build machine, the arcade-tools directory was not found, which means there's an error with the image." + } + } + exit 0 + } + } else { + $NativeTools.PSObject.Properties | ForEach-Object { + $ToolName = $_.Name + $ToolVersion = $_.Value + $LocalInstallerArguments = @{ ToolName = "$ToolName" } + $LocalInstallerArguments += @{ InstallPath = "$InstallBin" } + $LocalInstallerArguments += @{ BaseUri = "$BaseUri" } + $LocalInstallerArguments += @{ CommonLibraryDirectory = "$EngCommonBaseDir" } + $LocalInstallerArguments += @{ Version = "$ToolVersion" } + + if ($Verbose) { + $LocalInstallerArguments += @{ Verbose = $True } + } + if (Get-Variable 'Force' -ErrorAction 'SilentlyContinue') { + if($Force) { + $LocalInstallerArguments += @{ Force = $True } + } + } + if ($Clean) { + $LocalInstallerArguments += @{ Clean = $True } + } + + Write-Verbose "Installing $ToolName version $ToolVersion" + Write-Verbose "Executing '$InstallerPath $($LocalInstallerArguments.Keys.ForEach({"-$_ '$($LocalInstallerArguments.$_)'"}) -join ' ')'" + & $InstallerPath @LocalInstallerArguments + if ($LASTEXITCODE -Ne "0") { + $errMsg = "$ToolName installation failed" + if ((Get-Variable 'DoNotAbortNativeToolsInstallationOnFailure' -ErrorAction 'SilentlyContinue') -and $DoNotAbortNativeToolsInstallationOnFailure) { + $showNativeToolsWarning = $true + if ((Get-Variable 'DoNotDisplayNativeToolsInstallationWarnings' -ErrorAction 'SilentlyContinue') -and $DoNotDisplayNativeToolsInstallationWarnings) { + $showNativeToolsWarning = $false + } + if ($showNativeToolsWarning) { + Write-Warning $errMsg + } + $toolInstallationFailure = $true + } else { + # We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482 + Write-Host $errMsg + exit 1 + } + } + } + + if ((Get-Variable 'toolInstallationFailure' -ErrorAction 'SilentlyContinue') -and $toolInstallationFailure) { + # We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482 + Write-Host 'Native tools bootstrap failed' + exit 1 + } + } + } + else { + Write-Host 'No native tools defined in global.json' + exit 0 + } + + if ($Clean) { + exit 0 + } + if (Test-Path $InstallBin) { + Write-Host 'Native tools are available from ' (Convert-Path -Path $InstallBin) + Write-Host "##vso[task.prependpath]$(Convert-Path -Path $InstallBin)" + return $InstallBin + } + elseif (-not ($PathPromotion)) { + Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message 'Native tools install directory does not exist, installation failed' + exit 1 + } + exit 0 +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh new file mode 100755 index 0000000000000..3e6a8d6acf2f5 --- /dev/null +++ b/eng/common/init-tools-native.sh @@ -0,0 +1,238 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +base_uri='https://netcorenativeassets.blob.core.windows.net/resource-packages/external' +install_directory='' +clean=false +force=false +download_retries=5 +retry_wait_time_seconds=30 +global_json_file="$(dirname "$(dirname "${scriptroot}")")/global.json" +declare -a native_assets + +. $scriptroot/pipeline-logging-functions.sh +. $scriptroot/native/common-library.sh + +while (($# > 0)); do + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" + case $lowerI in + --baseuri) + base_uri=$2 + shift 2 + ;; + --installdirectory) + install_directory=$2 + shift 2 + ;; + --clean) + clean=true + shift 1 + ;; + --force) + force=true + shift 1 + ;; + --donotabortonfailure) + donotabortonfailure=true + shift 1 + ;; + --donotdisplaywarnings) + donotdisplaywarnings=true + shift 1 + ;; + --downloadretries) + download_retries=$2 + shift 2 + ;; + --retrywaittimeseconds) + retry_wait_time_seconds=$2 + shift 2 + ;; + --help) + echo "Common settings:" + echo " --installdirectory Directory to install native toolset." + echo " This is a command-line override for the default" + echo " Install directory precedence order:" + echo " - InstallDirectory command-line override" + echo " - NETCOREENG_INSTALL_DIRECTORY environment variable" + echo " - (default) %USERPROFILE%/.netcoreeng/native" + echo "" + echo " --clean Switch specifying not to install anything, but cleanup native asset folders" + echo " --donotabortonfailure Switch specifiying whether to abort native tools installation on failure" + echo " --donotdisplaywarnings Switch specifiying whether to display warnings during native tools installation on failure" + echo " --force Clean and then install tools" + echo " --help Print help and exit" + echo "" + echo "Advanced settings:" + echo " --baseuri Base URI for where to download native tools from" + echo " --downloadretries Number of times a download should be attempted" + echo " --retrywaittimeseconds Wait time between download attempts" + echo "" + exit 0 + ;; + esac +done + +function ReadGlobalJsonNativeTools { + # happy path: we have a proper JSON parsing tool `jq(1)` in PATH! + if command -v jq &> /dev/null; then + + # jq: read each key/value pair under "native-tools" entry and emit: + # KEY="" VALUE="" + # followed by a null byte. + # + # bash: read line with null byte delimeter and push to array (for later `eval`uation). + + while IFS= read -rd '' line; do + native_assets+=("$line") + done < <(jq -r '. | + select(has("native-tools")) | + ."native-tools" | + keys[] as $k | + @sh "KEY=\($k) VALUE=\(.[$k])\u0000"' "$global_json_file") + + return + fi + + # Warning: falling back to manually parsing JSON, which is not recommended. + + # Following routine matches the output and escaping logic of jq(1)'s @sh formatter used above. + # It has been tested with several weird strings with escaped characters in entries (key and value) + # and results were compared with the output of jq(1) in binary representation using xxd(1); + # just before the assignment to 'native_assets' array (above and below). + + # try to capture the section under "native-tools". + if [[ ! "$(cat "$global_json_file")" =~ \"native-tools\"[[:space:]\:\{]*([^\}]+) ]]; then + return + fi + + section="${BASH_REMATCH[1]}" + + parseStarted=0 + possibleEnd=0 + escaping=0 + escaped=0 + isKey=1 + + for (( i=0; i<${#section}; i++ )); do + char="${section:$i:1}" + if ! ((parseStarted)) && [[ "$char" =~ [[:space:],:] ]]; then continue; fi + + if ! ((escaping)) && [[ "$char" == "\\" ]]; then + escaping=1 + elif ((escaping)) && ! ((escaped)); then + escaped=1 + fi + + if ! ((parseStarted)) && [[ "$char" == "\"" ]]; then + parseStarted=1 + possibleEnd=0 + elif [[ "$char" == "'" ]]; then + token="$token'\\\''" + possibleEnd=0 + elif ((escaping)) || [[ "$char" != "\"" ]]; then + token="$token$char" + possibleEnd=1 + fi + + if ((possibleEnd)) && ! ((escaping)) && [[ "$char" == "\"" ]]; then + # Use printf to unescape token to match jq(1)'s @sh formatting rules. + # do not use 'token="$(printf "$token")"' syntax, as $() eats the trailing linefeed. + printf -v token "'$token'" + + if ((isKey)); then + KEY="$token" + isKey=0 + else + line="KEY=$KEY VALUE=$token" + native_assets+=("$line") + isKey=1 + fi + + # reset for next token + parseStarted=0 + token= + elif ((escaping)) && ((escaped)); then + escaping=0 + escaped=0 + fi + done +} + +native_base_dir=$install_directory +if [[ -z $install_directory ]]; then + native_base_dir=$(GetNativeInstallDirectory) +fi + +install_bin="${native_base_dir}/bin" +installed_any=false + +ReadGlobalJsonNativeTools + +if [[ ${#native_assets[@]} -eq 0 ]]; then + echo "No native tools defined in global.json" + exit 0; +else + native_installer_dir="$scriptroot/native" + for index in "${!native_assets[@]}"; do + eval "${native_assets["$index"]}" + + installer_path="$native_installer_dir/install-$KEY.sh" + installer_command="$installer_path" + installer_command+=" --baseuri $base_uri" + installer_command+=" --installpath $install_bin" + installer_command+=" --version $VALUE" + echo $installer_command + + if [[ $force = true ]]; then + installer_command+=" --force" + fi + + if [[ $clean = true ]]; then + installer_command+=" --clean" + fi + + if [[ -a $installer_path ]]; then + $installer_command + if [[ $? != 0 ]]; then + if [[ $donotabortonfailure = true ]]; then + if [[ $donotdisplaywarnings != true ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed" + fi + else + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed" + exit 1 + fi + else + $installed_any = true + fi + else + if [[ $donotabortonfailure == true ]]; then + if [[ $donotdisplaywarnings != true ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed: no install script" + fi + else + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed: no install script" + exit 1 + fi + fi + done +fi + +if [[ $clean = true ]]; then + exit 0 +fi + +if [[ -d $install_bin ]]; then + echo "Native tools are available from $install_bin" + echo "##vso[task.prependpath]$install_bin" +else + if [[ $installed_any = true ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Native tools install directory does not exist, installation failed" + exit 1 + fi +fi + +exit 0 diff --git a/eng/common/internal-feed-operations.ps1 b/eng/common/internal-feed-operations.ps1 new file mode 100644 index 0000000000000..c282d3ae403a0 --- /dev/null +++ b/eng/common/internal-feed-operations.ps1 @@ -0,0 +1,132 @@ +param( + [Parameter(Mandatory=$true)][string] $Operation, + [string] $AuthToken, + [string] $CommitSha, + [string] $RepoName, + [switch] $IsFeedPrivate +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 +. $PSScriptRoot\tools.ps1 + +# Sets VSS_NUGET_EXTERNAL_FEED_ENDPOINTS based on the "darc-int-*" feeds defined in NuGet.config. This is needed +# in build agents by CredProvider to authenticate the restore requests to internal feeds as specified in +# https://github.com/microsoft/artifacts-credprovider/blob/0f53327cd12fd893d8627d7b08a2171bf5852a41/README.md#environment-variables. This should ONLY be called from identified +# internal builds +function SetupCredProvider { + param( + [string] $AuthToken + ) + + # Install the Cred Provider NuGet plugin + Write-Host 'Setting up Cred Provider NuGet plugin in the agent...' + Write-Host "Getting 'installcredprovider.ps1' from 'https://github.com/microsoft/artifacts-credprovider'..." + + $url = 'https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.ps1' + + Write-Host "Writing the contents of 'installcredprovider.ps1' locally..." + Invoke-WebRequest $url -UseBasicParsing -OutFile installcredprovider.ps1 + + Write-Host 'Installing plugin...' + .\installcredprovider.ps1 -Force + + Write-Host "Deleting local copy of 'installcredprovider.ps1'..." + Remove-Item .\installcredprovider.ps1 + + if (-Not("$env:USERPROFILE\.nuget\plugins\netcore")) { + Write-PipelineTelemetryError -Category 'Arcade' -Message 'CredProvider plugin was not installed correctly!' + ExitWithExitCode 1 + } + else { + Write-Host 'CredProvider plugin was installed correctly!' + } + + # Then, we set the 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' environment variable to restore from the stable + # feeds successfully + + $nugetConfigPath = Join-Path $RepoRoot "NuGet.config" + + if (-Not (Test-Path -Path $nugetConfigPath)) { + Write-PipelineTelemetryError -Category 'Build' -Message 'NuGet.config file not found in repo root!' + ExitWithExitCode 1 + } + + $endpoints = New-Object System.Collections.ArrayList + $nugetConfigPackageSources = Select-Xml -Path $nugetConfigPath -XPath "//packageSources/add[contains(@key, 'darc-int-')]/@value" | foreach{$_.Node.Value} + + if (($nugetConfigPackageSources | Measure-Object).Count -gt 0 ) { + foreach ($stableRestoreResource in $nugetConfigPackageSources) { + $trimmedResource = ([string]$stableRestoreResource).Trim() + [void]$endpoints.Add(@{endpoint="$trimmedResource"; password="$AuthToken"}) + } + } + + if (($endpoints | Measure-Object).Count -gt 0) { + $endpointCredentials = @{endpointCredentials=$endpoints} | ConvertTo-Json -Compress + + # Create the environment variables the AzDo way + Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $endpointCredentials -Properties @{ + 'variable' = 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' + 'issecret' = 'false' + } + + # We don't want sessions cached since we will be updating the endpoints quite frequently + Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data 'False' -Properties @{ + 'variable' = 'NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED' + 'issecret' = 'false' + } + } + else + { + Write-Host 'No internal endpoints found in NuGet.config' + } +} + +#Workaround for https://github.com/microsoft/msbuild/issues/4430 +function InstallDotNetSdkAndRestoreArcade { + $dotnetTempDir = Join-Path $RepoRoot "dotnet" + $dotnetSdkVersion="2.1.507" # After experimentation we know this version works when restoring the SDK (compared to 3.0.*) + $dotnet = "$dotnetTempDir\dotnet.exe" + $restoreProjPath = "$PSScriptRoot\restore.proj" + + Write-Host "Installing dotnet SDK version $dotnetSdkVersion to restore Arcade SDK..." + InstallDotNetSdk "$dotnetTempDir" "$dotnetSdkVersion" + + '' | Out-File "$restoreProjPath" + + & $dotnet restore $restoreProjPath + + Write-Host 'Arcade SDK restored!' + + if (Test-Path -Path $restoreProjPath) { + Remove-Item $restoreProjPath + } + + if (Test-Path -Path $dotnetTempDir) { + Remove-Item $dotnetTempDir -Recurse + } +} + +try { + Push-Location $PSScriptRoot + + if ($Operation -like 'setup') { + SetupCredProvider $AuthToken + } + elseif ($Operation -like 'install-restore') { + InstallDotNetSdkAndRestoreArcade + } + else { + Write-PipelineTelemetryError -Category 'Arcade' -Message "Unknown operation '$Operation'!" + ExitWithExitCode 1 + } +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'Arcade' -Message $_ + ExitWithExitCode 1 +} +finally { + Pop-Location +} diff --git a/eng/common/internal-feed-operations.sh b/eng/common/internal-feed-operations.sh new file mode 100755 index 0000000000000..6299e7effd4c0 --- /dev/null +++ b/eng/common/internal-feed-operations.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +set -e + +# Sets VSS_NUGET_EXTERNAL_FEED_ENDPOINTS based on the "darc-int-*" feeds defined in NuGet.config. This is needed +# in build agents by CredProvider to authenticate the restore requests to internal feeds as specified in +# https://github.com/microsoft/artifacts-credprovider/blob/0f53327cd12fd893d8627d7b08a2171bf5852a41/README.md#environment-variables. +# This should ONLY be called from identified internal builds +function SetupCredProvider { + local authToken=$1 + + # Install the Cred Provider NuGet plugin + echo "Setting up Cred Provider NuGet plugin in the agent..."... + echo "Getting 'installcredprovider.ps1' from 'https://github.com/microsoft/artifacts-credprovider'..." + + local url="https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh" + + echo "Writing the contents of 'installcredprovider.ps1' locally..." + local installcredproviderPath="installcredprovider.sh" + if command -v curl > /dev/null; then + curl $url > "$installcredproviderPath" + else + wget -q -O "$installcredproviderPath" "$url" + fi + + echo "Installing plugin..." + . "$installcredproviderPath" + + echo "Deleting local copy of 'installcredprovider.sh'..." + rm installcredprovider.sh + + if [ ! -d "$HOME/.nuget/plugins" ]; then + Write-PipelineTelemetryError -category 'Build' 'CredProvider plugin was not installed correctly!' + ExitWithExitCode 1 + else + echo "CredProvider plugin was installed correctly!" + fi + + # Then, we set the 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' environment variable to restore from the stable + # feeds successfully + + local nugetConfigPath="{$repo_root}NuGet.config" + + if [ ! "$nugetConfigPath" ]; then + Write-PipelineTelemetryError -category 'Build' "NuGet.config file not found in repo's root!" + ExitWithExitCode 1 + fi + + local endpoints='[' + local nugetConfigPackageValues=`cat "$nugetConfigPath" | grep "key=\"darc-int-"` + local pattern="value=\"(.*)\"" + + for value in $nugetConfigPackageValues + do + if [[ $value =~ $pattern ]]; then + local endpoint="${BASH_REMATCH[1]}" + endpoints+="{\"endpoint\": \"$endpoint\", \"password\": \"$authToken\"}," + fi + done + + endpoints=${endpoints%?} + endpoints+=']' + + if [ ${#endpoints} -gt 2 ]; then + local endpointCredentials="{\"endpointCredentials\": "$endpoints"}" + + echo "##vso[task.setvariable variable=VSS_NUGET_EXTERNAL_FEED_ENDPOINTS]$endpointCredentials" + echo "##vso[task.setvariable variable=NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED]False" + else + echo "No internal endpoints found in NuGet.config" + fi +} + +# Workaround for https://github.com/microsoft/msbuild/issues/4430 +function InstallDotNetSdkAndRestoreArcade { + local dotnetTempDir="$repo_root/dotnet" + local dotnetSdkVersion="2.1.507" # After experimentation we know this version works when restoring the SDK (compared to 3.0.*) + local restoreProjPath="$repo_root/eng/common/restore.proj" + + echo "Installing dotnet SDK version $dotnetSdkVersion to restore Arcade SDK..." + echo "" > "$restoreProjPath" + + InstallDotNetSdk "$dotnetTempDir" "$dotnetSdkVersion" + + local res=`$dotnetTempDir/dotnet restore $restoreProjPath` + echo "Arcade SDK restored!" + + # Cleanup + if [ "$restoreProjPath" ]; then + rm "$restoreProjPath" + fi + + if [ "$dotnetTempDir" ]; then + rm -r $dotnetTempDir + fi +} + +source="${BASH_SOURCE[0]}" +operation='' +authToken='' +repoName='' + +while [[ $# -gt 0 ]]; do + opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + --operation) + operation=$2 + shift + ;; + --authtoken) + authToken=$2 + shift + ;; + *) + echo "Invalid argument: $1" + usage + exit 1 + ;; + esac + + shift +done + +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. "$scriptroot/tools.sh" + +if [ "$operation" = "setup" ]; then + SetupCredProvider $authToken +elif [ "$operation" = "install-restore" ]; then + InstallDotNetSdkAndRestoreArcade +else + echo "Unknown operation '$operation'!" +fi diff --git a/eng/common/internal/Directory.Build.props b/eng/common/internal/Directory.Build.props new file mode 100644 index 0000000000000..f1d041c33da51 --- /dev/null +++ b/eng/common/internal/Directory.Build.props @@ -0,0 +1,11 @@ + + + + + false + false + + + + + diff --git a/eng/common/internal/NuGet.config b/eng/common/internal/NuGet.config new file mode 100644 index 0000000000000..f70261ed689bc --- /dev/null +++ b/eng/common/internal/NuGet.config @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj new file mode 100644 index 0000000000000..feaa6d20812d8 --- /dev/null +++ b/eng/common/internal/Tools.csproj @@ -0,0 +1,22 @@ + + + + + net472 + false + false + + + + + + + + + + + + + + + diff --git a/eng/common/loc/P22DotNetHtmlLocalization.lss b/eng/common/loc/P22DotNetHtmlLocalization.lss new file mode 100644 index 0000000000000..5d892d619398f --- /dev/null +++ b/eng/common/loc/P22DotNetHtmlLocalization.lss @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eng/common/msbuild.ps1 b/eng/common/msbuild.ps1 new file mode 100644 index 0000000000000..f041e5ddd9589 --- /dev/null +++ b/eng/common/msbuild.ps1 @@ -0,0 +1,28 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string] $verbosity = 'minimal', + [bool] $warnAsError = $true, + [bool] $nodeReuse = $true, + [switch] $ci, + [switch] $prepareMachine, + [switch] $excludePrereleaseVS, + [string] $msbuildEngine = $null, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$extraArgs +) + +. $PSScriptRoot\tools.ps1 + +try { + if ($ci) { + $nodeReuse = $false + } + + MSBuild @extraArgs +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'Build' -Message $_ + ExitWithExitCode 1 +} + +ExitWithExitCode 0 \ No newline at end of file diff --git a/eng/common/msbuild.sh b/eng/common/msbuild.sh new file mode 100755 index 0000000000000..20d3dad543520 --- /dev/null +++ b/eng/common/msbuild.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +verbosity='minimal' +warn_as_error=true +node_reuse=true +prepare_machine=false +extra_args='' + +while (($# > 0)); do + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" + case $lowerI in + --verbosity) + verbosity=$2 + shift 2 + ;; + --warnaserror) + warn_as_error=$2 + shift 2 + ;; + --nodereuse) + node_reuse=$2 + shift 2 + ;; + --ci) + ci=true + shift 1 + ;; + --preparemachine) + prepare_machine=true + shift 1 + ;; + *) + extra_args="$extra_args $1" + shift 1 + ;; + esac +done + +. "$scriptroot/tools.sh" + +if [[ "$ci" == true ]]; then + node_reuse=false +fi + +MSBuild $extra_args +ExitWithExitCode 0 diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 new file mode 100644 index 0000000000000..f71f6af6cdbc5 --- /dev/null +++ b/eng/common/native/CommonLibrary.psm1 @@ -0,0 +1,401 @@ +<# +.SYNOPSIS +Helper module to install an archive to a directory + +.DESCRIPTION +Helper module to download and extract an archive to a specified directory + +.PARAMETER Uri +Uri of artifact to download + +.PARAMETER InstallDirectory +Directory to extract artifact contents to + +.PARAMETER Force +Force download / extraction if file or contents already exist. Default = False + +.PARAMETER DownloadRetries +Total number of retry attempts. Default = 5 + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds. Default = 30 + +.NOTES +Returns False if download or extraction fail, True otherwise +#> +function DownloadAndExtract { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $Uri, + [Parameter(Mandatory=$True)] + [string] $InstallDirectory, + [switch] $Force = $False, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30 + ) + # Define verbose switch if undefined + $Verbose = $VerbosePreference -Eq "Continue" + + $TempToolPath = CommonLibrary\Get-TempPathFilename -Path $Uri + + # Download native tool + $DownloadStatus = CommonLibrary\Get-File -Uri $Uri ` + -Path $TempToolPath ` + -DownloadRetries $DownloadRetries ` + -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` + -Force:$Force ` + -Verbose:$Verbose + + if ($DownloadStatus -Eq $False) { + Write-Error "Download failed from $Uri" + return $False + } + + # Extract native tool + $UnzipStatus = CommonLibrary\Expand-Zip -ZipPath $TempToolPath ` + -OutputDirectory $InstallDirectory ` + -Force:$Force ` + -Verbose:$Verbose + + if ($UnzipStatus -Eq $False) { + # Retry Download one more time with Force=true + $DownloadRetryStatus = CommonLibrary\Get-File -Uri $Uri ` + -Path $TempToolPath ` + -DownloadRetries 1 ` + -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` + -Force:$True ` + -Verbose:$Verbose + + if ($DownloadRetryStatus -Eq $False) { + Write-Error "Last attempt of download failed as well" + return $False + } + + # Retry unzip again one more time with Force=true + $UnzipRetryStatus = CommonLibrary\Expand-Zip -ZipPath $TempToolPath ` + -OutputDirectory $InstallDirectory ` + -Force:$True ` + -Verbose:$Verbose + if ($UnzipRetryStatus -Eq $False) + { + Write-Error "Last attempt of unzip failed as well" + # Clean up partial zips and extracts + if (Test-Path $TempToolPath) { + Remove-Item $TempToolPath -Force + } + if (Test-Path $InstallDirectory) { + Remove-Item $InstallDirectory -Force -Recurse + } + return $False + } + } + + return $True +} + +<# +.SYNOPSIS +Download a file, retry on failure + +.DESCRIPTION +Download specified file and retry if attempt fails + +.PARAMETER Uri +Uri of file to download. If Uri is a local path, the file will be copied instead of downloaded + +.PARAMETER Path +Path to download or copy uri file to + +.PARAMETER Force +Overwrite existing file if present. Default = False + +.PARAMETER DownloadRetries +Total number of retry attempts. Default = 5 + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds Default = 30 + +#> +function Get-File { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $Uri, + [Parameter(Mandatory=$True)] + [string] $Path, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30, + [switch] $Force = $False + ) + $Attempt = 0 + + if ($Force) { + if (Test-Path $Path) { + Remove-Item $Path -Force + } + } + if (Test-Path $Path) { + Write-Host "File '$Path' already exists, skipping download" + return $True + } + + $DownloadDirectory = Split-Path -ErrorAction Ignore -Path "$Path" -Parent + if (-Not (Test-Path $DownloadDirectory)) { + New-Item -path $DownloadDirectory -force -itemType "Directory" | Out-Null + } + + $TempPath = "$Path.tmp" + if (Test-Path -IsValid -Path $Uri) { + Write-Verbose "'$Uri' is a file path, copying temporarily to '$TempPath'" + Copy-Item -Path $Uri -Destination $TempPath + Write-Verbose "Moving temporary file to '$Path'" + Move-Item -Path $TempPath -Destination $Path + return $? + } + else { + Write-Verbose "Downloading $Uri" + # Don't display the console progress UI - it's a huge perf hit + $ProgressPreference = 'SilentlyContinue' + while($Attempt -Lt $DownloadRetries) + { + try { + Invoke-WebRequest -UseBasicParsing -Uri $Uri -OutFile $TempPath + Write-Verbose "Downloaded to temporary location '$TempPath'" + Move-Item -Path $TempPath -Destination $Path + Write-Verbose "Moved temporary file to '$Path'" + return $True + } + catch { + $Attempt++ + if ($Attempt -Lt $DownloadRetries) { + $AttemptsLeft = $DownloadRetries - $Attempt + Write-Warning "Download failed, $AttemptsLeft attempts remaining, will retry in $RetryWaitTimeInSeconds seconds" + Start-Sleep -Seconds $RetryWaitTimeInSeconds + } + else { + Write-Error $_ + Write-Error $_.Exception + } + } + } + } + + return $False +} + +<# +.SYNOPSIS +Generate a shim for a native tool + +.DESCRIPTION +Creates a wrapper script (shim) that passes arguments forward to native tool assembly + +.PARAMETER ShimName +The name of the shim + +.PARAMETER ShimDirectory +The directory where shims are stored + +.PARAMETER ToolFilePath +Path to file that shim forwards to + +.PARAMETER Force +Replace shim if already present. Default = False + +.NOTES +Returns $True if generating shim succeeds, $False otherwise +#> +function New-ScriptShim { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $ShimName, + [Parameter(Mandatory=$True)] + [string] $ShimDirectory, + [Parameter(Mandatory=$True)] + [string] $ToolFilePath, + [Parameter(Mandatory=$True)] + [string] $BaseUri, + [switch] $Force + ) + try { + Write-Verbose "Generating '$ShimName' shim" + + if (-Not (Test-Path $ToolFilePath)){ + Write-Error "Specified tool file path '$ToolFilePath' does not exist" + return $False + } + + # WinShimmer is a small .NET Framework program that creates .exe shims to bootstrapped programs + # Many of the checks for installed programs expect a .exe extension for Windows tools, rather + # than a .bat or .cmd file. + # Source: https://github.com/dotnet/arcade/tree/master/src/WinShimmer + if (-Not (Test-Path "$ShimDirectory\WinShimmer\winshimmer.exe")) { + $InstallStatus = DownloadAndExtract -Uri "$BaseUri/windows/winshimmer/WinShimmer.zip" ` + -InstallDirectory $ShimDirectory\WinShimmer ` + -Force:$Force ` + -DownloadRetries 2 ` + -RetryWaitTimeInSeconds 5 ` + -Verbose:$Verbose + } + + if ((Test-Path (Join-Path $ShimDirectory "$ShimName.exe"))) { + Write-Host "$ShimName.exe already exists; replacing..." + Remove-Item (Join-Path $ShimDirectory "$ShimName.exe") + } + + & "$ShimDirectory\WinShimmer\winshimmer.exe" $ShimName $ToolFilePath $ShimDirectory + return $True + } + catch { + Write-Host $_ + Write-Host $_.Exception + return $False + } +} + +<# +.SYNOPSIS +Returns the machine architecture of the host machine + +.NOTES +Returns 'x64' on 64 bit machines + Returns 'x86' on 32 bit machines +#> +function Get-MachineArchitecture { + $ProcessorArchitecture = $Env:PROCESSOR_ARCHITECTURE + $ProcessorArchitectureW6432 = $Env:PROCESSOR_ARCHITEW6432 + if($ProcessorArchitecture -Eq "X86") + { + if(($ProcessorArchitectureW6432 -Eq "") -Or + ($ProcessorArchitectureW6432 -Eq "X86")) { + return "x86" + } + $ProcessorArchitecture = $ProcessorArchitectureW6432 + } + if (($ProcessorArchitecture -Eq "AMD64") -Or + ($ProcessorArchitecture -Eq "IA64") -Or + ($ProcessorArchitecture -Eq "ARM64") -Or + ($ProcessorArchitecture -Eq "LOONGARCH64") -Or + ($ProcessorArchitecture -Eq "RISCV64")) { + return "x64" + } + return "x86" +} + +<# +.SYNOPSIS +Get the name of a temporary folder under the native install directory +#> +function Get-TempDirectory { + return Join-Path (Get-NativeInstallDirectory) "temp/" +} + +function Get-TempPathFilename { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $Path + ) + $TempDir = CommonLibrary\Get-TempDirectory + $TempFilename = Split-Path $Path -leaf + $TempPath = Join-Path $TempDir $TempFilename + return $TempPath +} + +<# +.SYNOPSIS +Returns the base directory to use for native tool installation + +.NOTES +Returns the value of the NETCOREENG_INSTALL_DIRECTORY if that environment variable +is set, or otherwise returns an install directory under the %USERPROFILE% +#> +function Get-NativeInstallDirectory { + $InstallDir = $Env:NETCOREENG_INSTALL_DIRECTORY + if (!$InstallDir) { + $InstallDir = Join-Path $Env:USERPROFILE ".netcoreeng/native/" + } + return $InstallDir +} + +<# +.SYNOPSIS +Unzip an archive + +.DESCRIPTION +Powershell module to unzip an archive to a specified directory + +.PARAMETER ZipPath (Required) +Path to archive to unzip + +.PARAMETER OutputDirectory (Required) +Output directory for archive contents + +.PARAMETER Force +Overwrite output directory contents if they already exist + +.NOTES +- Returns True and does not perform an extraction if output directory already exists but Overwrite is not True. +- Returns True if unzip operation is successful +- Returns False if Overwrite is True and it is unable to remove contents of OutputDirectory +- Returns False if unable to extract zip archive +#> +function Expand-Zip { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $ZipPath, + [Parameter(Mandatory=$True)] + [string] $OutputDirectory, + [switch] $Force + ) + + Write-Verbose "Extracting '$ZipPath' to '$OutputDirectory'" + try { + if ((Test-Path $OutputDirectory) -And (-Not $Force)) { + Write-Host "Directory '$OutputDirectory' already exists, skipping extract" + return $True + } + if (Test-Path $OutputDirectory) { + Write-Verbose "'Force' is 'True', but '$OutputDirectory' exists, removing directory" + Remove-Item $OutputDirectory -Force -Recurse + if ($? -Eq $False) { + Write-Error "Unable to remove '$OutputDirectory'" + return $False + } + } + + $TempOutputDirectory = Join-Path "$(Split-Path -Parent $OutputDirectory)" "$(Split-Path -Leaf $OutputDirectory).tmp" + if (Test-Path $TempOutputDirectory) { + Remove-Item $TempOutputDirectory -Force -Recurse + } + New-Item -Path $TempOutputDirectory -Force -ItemType "Directory" | Out-Null + + Add-Type -assembly "system.io.compression.filesystem" + [io.compression.zipfile]::ExtractToDirectory("$ZipPath", "$TempOutputDirectory") + if ($? -Eq $False) { + Write-Error "Unable to extract '$ZipPath'" + return $False + } + + Move-Item -Path $TempOutputDirectory -Destination $OutputDirectory + } + catch { + Write-Host $_ + Write-Host $_.Exception + + return $False + } + return $True +} + +export-modulemember -function DownloadAndExtract +export-modulemember -function Expand-Zip +export-modulemember -function Get-File +export-modulemember -function Get-MachineArchitecture +export-modulemember -function Get-NativeInstallDirectory +export-modulemember -function Get-TempDirectory +export-modulemember -function Get-TempPathFilename +export-modulemember -function New-ScriptShim diff --git a/eng/common/native/common-library.sh b/eng/common/native/common-library.sh new file mode 100755 index 0000000000000..080c2c283ae46 --- /dev/null +++ b/eng/common/native/common-library.sh @@ -0,0 +1,172 @@ +#!/usr/bin/env bash + +function GetNativeInstallDirectory { + local install_dir + + if [[ -z $NETCOREENG_INSTALL_DIRECTORY ]]; then + install_dir=$HOME/.netcoreeng/native/ + else + install_dir=$NETCOREENG_INSTALL_DIRECTORY + fi + + echo $install_dir + return 0 +} + +function GetTempDirectory { + + echo $(GetNativeInstallDirectory)temp/ + return 0 +} + +function ExpandZip { + local zip_path=$1 + local output_directory=$2 + local force=${3:-false} + + echo "Extracting $zip_path to $output_directory" + if [[ -d $output_directory ]] && [[ $force = false ]]; then + echo "Directory '$output_directory' already exists, skipping extract" + return 0 + fi + + if [[ -d $output_directory ]]; then + echo "'Force flag enabled, but '$output_directory' exists. Removing directory" + rm -rf $output_directory + if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Unable to remove '$output_directory'" + return 1 + fi + fi + + echo "Creating directory: '$output_directory'" + mkdir -p $output_directory + + echo "Extracting archive" + tar -xf $zip_path -C $output_directory + if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Unable to extract '$zip_path'" + return 1 + fi + + return 0 +} + +function GetCurrentOS { + local unameOut="$(uname -s)" + case $unameOut in + Linux*) echo "Linux";; + Darwin*) echo "MacOS";; + esac + return 0 +} + +function GetFile { + local uri=$1 + local path=$2 + local force=${3:-false} + local download_retries=${4:-5} + local retry_wait_time_seconds=${5:-30} + + if [[ -f $path ]]; then + if [[ $force = false ]]; then + echo "File '$path' already exists. Skipping download" + return 0 + else + rm -rf $path + fi + fi + + if [[ -f $uri ]]; then + echo "'$uri' is a file path, copying file to '$path'" + cp $uri $path + return $? + fi + + echo "Downloading $uri" + # Use curl if available, otherwise use wget + if command -v curl > /dev/null; then + curl "$uri" -sSL --retry $download_retries --retry-delay $retry_wait_time_seconds --create-dirs -o "$path" --fail + else + wget -q -O "$path" "$uri" --tries="$download_retries" + fi + + return $? +} + +function GetTempPathFileName { + local path=$1 + + local temp_dir=$(GetTempDirectory) + local temp_file_name=$(basename $path) + echo $temp_dir$temp_file_name + return 0 +} + +function DownloadAndExtract { + local uri=$1 + local installDir=$2 + local force=${3:-false} + local download_retries=${4:-5} + local retry_wait_time_seconds=${5:-30} + + local temp_tool_path=$(GetTempPathFileName $uri) + + echo "downloading to: $temp_tool_path" + + # Download file + GetFile "$uri" "$temp_tool_path" $force $download_retries $retry_wait_time_seconds + if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Failed to download '$uri' to '$temp_tool_path'." + return 1 + fi + + # Extract File + echo "extracting from $temp_tool_path to $installDir" + ExpandZip "$temp_tool_path" "$installDir" $force $download_retries $retry_wait_time_seconds + if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Failed to extract '$temp_tool_path' to '$installDir'." + return 1 + fi + + return 0 +} + +function NewScriptShim { + local shimpath=$1 + local tool_file_path=$2 + local force=${3:-false} + + echo "Generating '$shimpath' shim" + if [[ -f $shimpath ]]; then + if [[ $force = false ]]; then + echo "File '$shimpath' already exists." >&2 + return 1 + else + rm -rf $shimpath + fi + fi + + if [[ ! -f $tool_file_path ]]; then + # try to see if the path is lower cased + tool_file_path="$(echo $tool_file_path | tr "[:upper:]" "[:lower:]")" + if [[ ! -f $tool_file_path ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Specified tool file path:'$tool_file_path' does not exist" + return 1 + fi + fi + + local shim_contents=$'#!/usr/bin/env bash\n' + shim_contents+="SHIMARGS="$'$1\n' + shim_contents+="$tool_file_path"$' $SHIMARGS\n' + + # Write shim file + echo "$shim_contents" > $shimpath + + chmod +x $shimpath + + echo "Finished generating shim '$shimpath'" + + return $? +} + diff --git a/eng/common/native/init-compiler.sh b/eng/common/native/init-compiler.sh new file mode 100644 index 0000000000000..9a0e1f2b4567b --- /dev/null +++ b/eng/common/native/init-compiler.sh @@ -0,0 +1,146 @@ +#!/bin/sh +# +# This file detects the C/C++ compiler and exports it to the CC/CXX environment variables +# +# NOTE: some scripts source this file and rely on stdout being empty, make sure +# to not output *anything* here, unless it is an error message that fails the +# build. + +if [ -z "$build_arch" ] || [ -z "$compiler" ]; then + echo "Usage..." + echo "build_arch= compiler= init-compiler.sh" + echo "Specify the target architecture." + echo "Specify the name of compiler (clang or gcc)." + exit 1 +fi + +case "$compiler" in + clang*|-clang*|--clang*) + # clangx.y or clang-x.y + version="$(echo "$compiler" | tr -d '[:alpha:]-=')" + majorVersion="${version%%.*}" + + # LLVM based on v18 released in early 2024, with two releases per year + maxVersion="$((18 + ((($(date +%Y) - 2024) * 12 + $(date +%-m) - 3) / 6)))" + compiler=clang + ;; + + gcc*|-gcc*|--gcc*) + # gccx.y or gcc-x.y + version="$(echo "$compiler" | tr -d '[:alpha:]-=')" + majorVersion="${version%%.*}" + + # GCC based on v14 released in early 2024, with one release per year + maxVersion="$((14 + ((($(date +%Y) - 2024) * 12 + $(date +%-m) - 3) / 12)))" + compiler=gcc + ;; +esac + +cxxCompiler="$compiler++" + +# clear the existing CC and CXX from environment +CC= +CXX= +LDFLAGS= + +if [ "$compiler" = "gcc" ]; then cxxCompiler="g++"; fi + +check_version_exists() { + desired_version=-1 + + # Set up the environment to be used for building with the desired compiler. + if command -v "$compiler-$1" > /dev/null; then + desired_version="-$1" + elif command -v "$compiler$1" > /dev/null; then + desired_version="$1" + fi + + echo "$desired_version" +} + +__baseOS="$(uname)" +set_compiler_version_from_CC() { + if [ "$__baseOS" = "Darwin" ]; then + # On Darwin, the versions from -version/-dumpversion refer to Xcode + # versions, not llvm versions, so we can't rely on them. + return + fi + + version="$("$CC" -dumpversion)" + if [ -z "$version" ]; then + echo "Error: $CC -dumpversion didn't provide a version" + exit 1 + fi + + # gcc and clang often display 3 part versions. However, gcc can show only 1 part in some environments. + IFS=. read -r majorVersion _ < /dev/null; then + echo "Error: No compatible version of $compiler was found within the range of $minVersion to $maxVersion. Please upgrade your toolchain or specify the compiler explicitly using CLR_CC and CLR_CXX environment variables." + exit 1 + fi + + CC="$(command -v "$compiler" 2> /dev/null)" + CXX="$(command -v "$cxxCompiler" 2> /dev/null)" + set_compiler_version_from_CC + fi + else + desired_version="$(check_version_exists "$majorVersion")" + if [ "$desired_version" = "-1" ]; then + echo "Error: Could not find specific version of $compiler: $majorVersion." + exit 1 + fi + fi + + if [ -z "$CC" ]; then + CC="$(command -v "$compiler$desired_version" 2> /dev/null)" + CXX="$(command -v "$cxxCompiler$desired_version" 2> /dev/null)" + if [ -z "$CXX" ]; then CXX="$(command -v "$cxxCompiler" 2> /dev/null)"; fi + set_compiler_version_from_CC + fi +else + if [ ! -f "$CLR_CC" ]; then + echo "Error: CLR_CC is set but path '$CLR_CC' does not exist" + exit 1 + fi + CC="$CLR_CC" + CXX="$CLR_CXX" + set_compiler_version_from_CC +fi + +if [ -z "$CC" ]; then + echo "Error: Unable to find $compiler." + exit 1 +fi + +if [ "$__baseOS" != "Darwin" ]; then + # On Darwin, we always want to use the Apple linker. + + # Only lld version >= 9 can be considered stable. lld supports s390x starting from 18.0. + if [ "$compiler" = "clang" ] && [ -n "$majorVersion" ] && [ "$majorVersion" -ge 9 ] && { [ "$build_arch" != "s390x" ] || [ "$majorVersion" -ge 18 ]; }; then + if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then + LDFLAGS="-fuse-ld=lld" + fi + fi +fi + +SCAN_BUILD_COMMAND="$(command -v "scan-build$desired_version" 2> /dev/null)" + +export CC CXX LDFLAGS SCAN_BUILD_COMMAND diff --git a/eng/common/native/init-distro-rid.sh b/eng/common/native/init-distro-rid.sh new file mode 100644 index 0000000000000..83ea7aab0e081 --- /dev/null +++ b/eng/common/native/init-distro-rid.sh @@ -0,0 +1,110 @@ +#!/bin/sh + +# getNonPortableDistroRid +# +# Input: +# targetOs: (str) +# targetArch: (str) +# rootfsDir: (str) +# +# Return: +# non-portable rid +getNonPortableDistroRid() +{ + targetOs="$1" + targetArch="$2" + rootfsDir="$3" + nonPortableRid="" + + if [ "$targetOs" = "linux" ]; then + # shellcheck disable=SC1091 + if [ -e "${rootfsDir}/etc/os-release" ]; then + . "${rootfsDir}/etc/os-release" + if echo "${VERSION_ID:-}" | grep -qE '^([[:digit:]]|\.)+$'; then + nonPortableRid="${ID}.${VERSION_ID}-${targetArch}" + else + # Rolling release distros either do not set VERSION_ID, set it as blank or + # set it to non-version looking string (such as TEMPLATE_VERSION_ID on ArchLinux); + # so omit it here to be consistent with everything else. + nonPortableRid="${ID}-${targetArch}" + fi + elif [ -e "${rootfsDir}/android_platform" ]; then + # shellcheck disable=SC1091 + . "${rootfsDir}/android_platform" + nonPortableRid="$RID" + fi + fi + + if [ "$targetOs" = "freebsd" ]; then + # $rootfsDir can be empty. freebsd-version is a shell script and should always work. + __freebsd_major_version=$("$rootfsDir"/bin/freebsd-version | cut -d'.' -f1) + nonPortableRid="freebsd.$__freebsd_major_version-${targetArch}" + elif command -v getprop >/dev/null && getprop ro.product.system.model | grep -qi android; then + __android_sdk_version=$(getprop ro.build.version.sdk) + nonPortableRid="android.$__android_sdk_version-${targetArch}" + elif [ "$targetOs" = "illumos" ]; then + __uname_version=$(uname -v) + nonPortableRid="illumos-${targetArch}" + elif [ "$targetOs" = "solaris" ]; then + __uname_version=$(uname -v) + __solaris_major_version=$(echo "$__uname_version" | cut -d'.' -f1) + nonPortableRid="solaris.$__solaris_major_version-${targetArch}" + elif [ "$targetOs" = "haiku" ]; then + __uname_release="$(uname -r)" + nonPortableRid=haiku.r"$__uname_release"-"$targetArch" + fi + + echo "$nonPortableRid" | tr '[:upper:]' '[:lower:]' +} + +# initDistroRidGlobal +# +# Input: +# os: (str) +# arch: (str) +# rootfsDir?: (nullable:string) +# +# Return: +# None +# +# Notes: +# It is important to note that the function does not return anything, but it +# exports the following variables on success: +# __DistroRid : Non-portable rid of the target platform. +# __PortableTargetOS : OS-part of the portable rid that corresponds to the target platform. +initDistroRidGlobal() +{ + targetOs="$1" + targetArch="$2" + rootfsDir="" + if [ $# -ge 3 ]; then + rootfsDir="$3" + fi + + if [ -n "${rootfsDir}" ]; then + # We may have a cross build. Check for the existence of the rootfsDir + if [ ! -e "${rootfsDir}" ]; then + echo "Error: rootfsDir has been passed, but the location is not valid." + exit 1 + fi + fi + + __DistroRid=$(getNonPortableDistroRid "${targetOs}" "${targetArch}" "${rootfsDir}") + + if [ -z "${__PortableTargetOS:-}" ]; then + __PortableTargetOS="$targetOs" + + STRINGS="$(command -v strings || true)" + if [ -z "$STRINGS" ]; then + STRINGS="$(command -v llvm-strings || true)" + fi + + # Check for musl-based distros (e.g. Alpine Linux, Void Linux). + if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl || + ( [ -n "$STRINGS" ] && "$STRINGS" "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl ); then + __PortableTargetOS="linux-musl" + fi + fi + + export __DistroRid __PortableTargetOS +} diff --git a/eng/common/native/init-os-and-arch.sh b/eng/common/native/init-os-and-arch.sh new file mode 100644 index 0000000000000..38921d4338f74 --- /dev/null +++ b/eng/common/native/init-os-and-arch.sh @@ -0,0 +1,85 @@ +#!/bin/sh + +# Use uname to determine what the OS is. +OSName=$(uname -s | tr '[:upper:]' '[:lower:]') + +if command -v getprop && getprop ro.product.system.model 2>&1 | grep -qi android; then + OSName="android" +fi + +case "$OSName" in +freebsd|linux|netbsd|openbsd|sunos|android|haiku) + os="$OSName" ;; +darwin) + os=osx ;; +*) + echo "Unsupported OS $OSName detected!" + exit 1 ;; +esac + +# On Solaris, `uname -m` is discouraged, see https://docs.oracle.com/cd/E36784_01/html/E36870/uname-1.html +# and `uname -p` returns processor type (e.g. i386 on amd64). +# The appropriate tool to determine CPU is isainfo(1) https://docs.oracle.com/cd/E36784_01/html/E36870/isainfo-1.html. +if [ "$os" = "sunos" ]; then + if uname -o 2>&1 | grep -q illumos; then + os="illumos" + else + os="solaris" + fi + CPUName=$(isainfo -n) +else + # For the rest of the operating systems, use uname(1) to determine what the CPU is. + CPUName=$(uname -m) +fi + +case "$CPUName" in + arm64|aarch64) + arch=arm64 + if [ "$(getconf LONG_BIT)" -lt 64 ]; then + # This is 32-bit OS running on 64-bit CPU (for example Raspberry Pi OS) + arch=arm + fi + ;; + + loongarch64) + arch=loongarch64 + ;; + + riscv64) + arch=riscv64 + ;; + + amd64|x86_64) + arch=x64 + ;; + + armv7l|armv8l) + # shellcheck disable=SC1091 + if (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then + arch=armel + else + arch=arm + fi + ;; + + armv6l) + arch=armv6 + ;; + + i[3-6]86) + echo "Unsupported CPU $CPUName detected, build might not succeed!" + arch=x86 + ;; + + s390x) + arch=s390x + ;; + + ppc64le) + arch=ppc64le + ;; + *) + echo "Unknown CPU $CPUName detected!" + exit 1 + ;; +esac diff --git a/eng/common/native/install-cmake-test.sh b/eng/common/native/install-cmake-test.sh new file mode 100755 index 0000000000000..8a5e7cf0db5a9 --- /dev/null +++ b/eng/common/native/install-cmake-test.sh @@ -0,0 +1,117 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. $scriptroot/common-library.sh + +base_uri= +install_path= +version= +clean=false +force=false +download_retries=5 +retry_wait_time_seconds=30 + +while (($# > 0)); do + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" + case $lowerI in + --baseuri) + base_uri=$2 + shift 2 + ;; + --installpath) + install_path=$2 + shift 2 + ;; + --version) + version=$2 + shift 2 + ;; + --clean) + clean=true + shift 1 + ;; + --force) + force=true + shift 1 + ;; + --downloadretries) + download_retries=$2 + shift 2 + ;; + --retrywaittimeseconds) + retry_wait_time_seconds=$2 + shift 2 + ;; + --help) + echo "Common settings:" + echo " --baseuri Base file directory or Url wrom which to acquire tool archives" + echo " --installpath Base directory to install native tool to" + echo " --clean Don't install the tool, just clean up the current install of the tool" + echo " --force Force install of tools even if they previously exist" + echo " --help Print help and exit" + echo "" + echo "Advanced settings:" + echo " --downloadretries Total number of retry attempts" + echo " --retrywaittimeseconds Wait time between retry attempts in seconds" + echo "" + exit 0 + ;; + esac +done + +tool_name="cmake-test" +tool_os=$(GetCurrentOS) +tool_folder="$(echo $tool_os | tr "[:upper:]" "[:lower:]")" +tool_arch="x86_64" +tool_name_moniker="$tool_name-$version-$tool_os-$tool_arch" +tool_install_directory="$install_path/$tool_name/$version" +tool_file_path="$tool_install_directory/$tool_name_moniker/bin/$tool_name" +shim_path="$install_path/$tool_name.sh" +uri="${base_uri}/$tool_folder/$tool_name/$tool_name_moniker.tar.gz" + +# Clean up tool and installers +if [[ $clean = true ]]; then + echo "Cleaning $tool_install_directory" + if [[ -d $tool_install_directory ]]; then + rm -rf $tool_install_directory + fi + + echo "Cleaning $shim_path" + if [[ -f $shim_path ]]; then + rm -rf $shim_path + fi + + tool_temp_path=$(GetTempPathFileName $uri) + echo "Cleaning $tool_temp_path" + if [[ -f $tool_temp_path ]]; then + rm -rf $tool_temp_path + fi + + exit 0 +fi + +# Install tool +if [[ -f $tool_file_path ]] && [[ $force = false ]]; then + echo "$tool_name ($version) already exists, skipping install" + exit 0 +fi + +DownloadAndExtract $uri $tool_install_directory $force $download_retries $retry_wait_time_seconds + +if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' 'Installation failed' + exit 1 +fi + +# Generate Shim +# Always rewrite shims so that we are referencing the expected version +NewScriptShim $shim_path $tool_file_path true + +if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' 'Shim generation failed' + exit 1 +fi + +exit 0 diff --git a/eng/common/native/install-cmake.sh b/eng/common/native/install-cmake.sh new file mode 100755 index 0000000000000..de496beebc5ac --- /dev/null +++ b/eng/common/native/install-cmake.sh @@ -0,0 +1,117 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. $scriptroot/common-library.sh + +base_uri= +install_path= +version= +clean=false +force=false +download_retries=5 +retry_wait_time_seconds=30 + +while (($# > 0)); do + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" + case $lowerI in + --baseuri) + base_uri=$2 + shift 2 + ;; + --installpath) + install_path=$2 + shift 2 + ;; + --version) + version=$2 + shift 2 + ;; + --clean) + clean=true + shift 1 + ;; + --force) + force=true + shift 1 + ;; + --downloadretries) + download_retries=$2 + shift 2 + ;; + --retrywaittimeseconds) + retry_wait_time_seconds=$2 + shift 2 + ;; + --help) + echo "Common settings:" + echo " --baseuri Base file directory or Url wrom which to acquire tool archives" + echo " --installpath Base directory to install native tool to" + echo " --clean Don't install the tool, just clean up the current install of the tool" + echo " --force Force install of tools even if they previously exist" + echo " --help Print help and exit" + echo "" + echo "Advanced settings:" + echo " --downloadretries Total number of retry attempts" + echo " --retrywaittimeseconds Wait time between retry attempts in seconds" + echo "" + exit 0 + ;; + esac +done + +tool_name="cmake" +tool_os=$(GetCurrentOS) +tool_folder="$(echo $tool_os | tr "[:upper:]" "[:lower:]")" +tool_arch="x86_64" +tool_name_moniker="$tool_name-$version-$tool_os-$tool_arch" +tool_install_directory="$install_path/$tool_name/$version" +tool_file_path="$tool_install_directory/$tool_name_moniker/bin/$tool_name" +shim_path="$install_path/$tool_name.sh" +uri="${base_uri}/$tool_folder/$tool_name/$tool_name_moniker.tar.gz" + +# Clean up tool and installers +if [[ $clean = true ]]; then + echo "Cleaning $tool_install_directory" + if [[ -d $tool_install_directory ]]; then + rm -rf $tool_install_directory + fi + + echo "Cleaning $shim_path" + if [[ -f $shim_path ]]; then + rm -rf $shim_path + fi + + tool_temp_path=$(GetTempPathFileName $uri) + echo "Cleaning $tool_temp_path" + if [[ -f $tool_temp_path ]]; then + rm -rf $tool_temp_path + fi + + exit 0 +fi + +# Install tool +if [[ -f $tool_file_path ]] && [[ $force = false ]]; then + echo "$tool_name ($version) already exists, skipping install" + exit 0 +fi + +DownloadAndExtract $uri $tool_install_directory $force $download_retries $retry_wait_time_seconds + +if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' 'Installation failed' + exit 1 +fi + +# Generate Shim +# Always rewrite shims so that we are referencing the expected version +NewScriptShim $shim_path $tool_file_path true + +if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' 'Shim generation failed' + exit 1 +fi + +exit 0 diff --git a/eng/common/native/install-dependencies.sh b/eng/common/native/install-dependencies.sh new file mode 100644 index 0000000000000..64b87d0bcc3ce --- /dev/null +++ b/eng/common/native/install-dependencies.sh @@ -0,0 +1,64 @@ +#!/bin/sh + +set -e + +# This is a simple script primarily used for CI to install necessary dependencies +# +# Usage: +# +# ./install-dependencies.sh + +os="$(echo "$1" | tr "[:upper:]" "[:lower:]")" + +if [ -z "$os" ]; then + . "$(dirname "$0")"/init-os-and-arch.sh +fi + +case "$os" in + linux) + if [ -e /etc/os-release ]; then + . /etc/os-release + fi + + if [ "$ID" = "debian" ] || [ "$ID_LIKE" = "debian" ]; then + apt update + + apt install -y build-essential gettext locales cmake llvm clang lld lldb liblldb-dev libunwind8-dev libicu-dev liblttng-ust-dev \ + libssl-dev libkrb5-dev pigz cpio + + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 + elif [ "$ID" = "fedora" ] || [ "$ID" = "rhel" ] || [ "$ID" = "azurelinux" ] || [ "$ID" = "centos"]; then + pkg_mgr="$(command -v tdnf 2>/dev/null || command -v dnf)" + $pkg_mgr install -y cmake llvm lld lldb clang python curl libicu-devel openssl-devel krb5-devel lttng-ust-devel pigz cpio + elif [ "$ID" = "amzn" ]; then + dnf install -y cmake llvm lld lldb clang python libicu-devel openssl-devel krb5-devel lttng-ust-devel pigz cpio + elif [ "$ID" = "alpine" ]; then + apk add build-base cmake bash curl clang llvm-dev lld lldb krb5-dev lttng-ust-dev icu-dev openssl-dev pigz cpio + else + echo "Unsupported distro. distro: $ID" + exit 1 + fi + ;; + + osx|maccatalyst|ios|iossimulator|tvos|tvossimulator) + echo "Installed xcode version: $(xcode-select -p)" + + export HOMEBREW_NO_INSTALL_CLEANUP=1 + export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 + # Skip brew update for now, see https://github.com/actions/setup-python/issues/577 + # brew update --preinstall + brew bundle --no-upgrade --file=- < +[CmdletBinding(PositionalBinding=$false)] +Param ( + [Parameter(Mandatory=$True)] + [string] $ToolName, + [Parameter(Mandatory=$True)] + [string] $InstallPath, + [Parameter(Mandatory=$True)] + [string] $BaseUri, + [Parameter(Mandatory=$True)] + [string] $Version, + [string] $CommonLibraryDirectory = $PSScriptRoot, + [switch] $Force = $False, + [switch] $Clean = $False, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30 +) + +. $PSScriptRoot\..\pipeline-logging-functions.ps1 + +# Import common library modules +Import-Module -Name (Join-Path $CommonLibraryDirectory "CommonLibrary.psm1") + +try { + # Define verbose switch if undefined + $Verbose = $VerbosePreference -Eq "Continue" + + $Arch = CommonLibrary\Get-MachineArchitecture + $ToolOs = "win64" + if($Arch -Eq "x32") { + $ToolOs = "win32" + } + $ToolNameMoniker = "$ToolName-$Version-$ToolOs-$Arch" + $ToolInstallDirectory = Join-Path $InstallPath "$ToolName\$Version\" + $Uri = "$BaseUri/windows/$ToolName/$ToolNameMoniker.zip" + $ShimPath = Join-Path $InstallPath "$ToolName.exe" + + if ($Clean) { + Write-Host "Cleaning $ToolInstallDirectory" + if (Test-Path $ToolInstallDirectory) { + Remove-Item $ToolInstallDirectory -Force -Recurse + } + Write-Host "Cleaning $ShimPath" + if (Test-Path $ShimPath) { + Remove-Item $ShimPath -Force + } + $ToolTempPath = CommonLibrary\Get-TempPathFilename -Path $Uri + Write-Host "Cleaning $ToolTempPath" + if (Test-Path $ToolTempPath) { + Remove-Item $ToolTempPath -Force + } + exit 0 + } + + # Install tool + if ((Test-Path $ToolInstallDirectory) -And (-Not $Force)) { + Write-Verbose "$ToolName ($Version) already exists, skipping install" + } + else { + $InstallStatus = CommonLibrary\DownloadAndExtract -Uri $Uri ` + -InstallDirectory $ToolInstallDirectory ` + -Force:$Force ` + -DownloadRetries $DownloadRetries ` + -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` + -Verbose:$Verbose + + if ($InstallStatus -Eq $False) { + Write-PipelineTelemetryError "Installation failed" -Category "NativeToolsetBootstrapping" + exit 1 + } + } + + $ToolFilePath = Get-ChildItem $ToolInstallDirectory -Recurse -Filter "$ToolName.exe" | % { $_.FullName } + if (@($ToolFilePath).Length -Gt 1) { + Write-Error "There are multiple copies of $ToolName in $($ToolInstallDirectory): `n$(@($ToolFilePath | out-string))" + exit 1 + } elseif (@($ToolFilePath).Length -Lt 1) { + Write-Host "$ToolName was not found in $ToolInstallDirectory." + exit 1 + } + + # Generate shim + # Always rewrite shims so that we are referencing the expected version + $GenerateShimStatus = CommonLibrary\New-ScriptShim -ShimName $ToolName ` + -ShimDirectory $InstallPath ` + -ToolFilePath "$ToolFilePath" ` + -BaseUri $BaseUri ` + -Force:$Force ` + -Verbose:$Verbose + + if ($GenerateShimStatus -Eq $False) { + Write-PipelineTelemetryError "Generate shim failed" -Category "NativeToolsetBootstrapping" + return 1 + } + + exit 0 +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category "NativeToolsetBootstrapping" -Message $_ + exit 1 +} diff --git a/eng/common/pipeline-logging-functions.ps1 b/eng/common/pipeline-logging-functions.ps1 new file mode 100644 index 0000000000000..8e422c561e4bd --- /dev/null +++ b/eng/common/pipeline-logging-functions.ps1 @@ -0,0 +1,260 @@ +# Source for this file was taken from https://github.com/microsoft/azure-pipelines-task-lib/blob/11c9439d4af17e6475d9fe058e6b2e03914d17e6/powershell/VstsTaskSdk/LoggingCommandFunctions.ps1 and modified. + +# NOTE: You should not be calling these method directly as they are likely to change. Instead you should be calling the Write-Pipeline* functions defined in tools.ps1 + +$script:loggingCommandPrefix = '##vso[' +$script:loggingCommandEscapeMappings = @( # TODO: WHAT ABOUT "="? WHAT ABOUT "%"? + New-Object psobject -Property @{ Token = ';' ; Replacement = '%3B' } + New-Object psobject -Property @{ Token = "`r" ; Replacement = '%0D' } + New-Object psobject -Property @{ Token = "`n" ; Replacement = '%0A' } + New-Object psobject -Property @{ Token = "]" ; Replacement = '%5D' } +) +# TODO: BUG: Escape % ??? +# TODO: Add test to verify don't need to escape "=". + +# Specify "-Force" to force pipeline formatted output even if "$ci" is false or not set +function Write-PipelineTelemetryError { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string]$Category, + [Parameter(Mandatory = $true)] + [string]$Message, + [Parameter(Mandatory = $false)] + [string]$Type = 'error', + [string]$ErrCode, + [string]$SourcePath, + [string]$LineNumber, + [string]$ColumnNumber, + [switch]$AsOutput, + [switch]$Force) + + $PSBoundParameters.Remove('Category') | Out-Null + + if ($Force -Or ((Test-Path variable:ci) -And $ci)) { + $Message = "(NETCORE_ENGINEERING_TELEMETRY=$Category) $Message" + } + $PSBoundParameters.Remove('Message') | Out-Null + $PSBoundParameters.Add('Message', $Message) + Write-PipelineTaskError @PSBoundParameters +} + +# Specify "-Force" to force pipeline formatted output even if "$ci" is false or not set +function Write-PipelineTaskError { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string]$Message, + [Parameter(Mandatory = $false)] + [string]$Type = 'error', + [string]$ErrCode, + [string]$SourcePath, + [string]$LineNumber, + [string]$ColumnNumber, + [switch]$AsOutput, + [switch]$Force + ) + + if (!$Force -And (-Not (Test-Path variable:ci) -Or !$ci)) { + if ($Type -eq 'error') { + Write-Host $Message -ForegroundColor Red + return + } + elseif ($Type -eq 'warning') { + Write-Host $Message -ForegroundColor Yellow + return + } + } + + if (($Type -ne 'error') -and ($Type -ne 'warning')) { + Write-Host $Message + return + } + $PSBoundParameters.Remove('Force') | Out-Null + if (-not $PSBoundParameters.ContainsKey('Type')) { + $PSBoundParameters.Add('Type', 'error') + } + Write-LogIssue @PSBoundParameters +} + +function Write-PipelineSetVariable { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string]$Name, + [string]$Value, + [switch]$Secret, + [switch]$AsOutput, + [bool]$IsMultiJobVariable = $true) + + if ((Test-Path variable:ci) -And $ci) { + Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ + 'variable' = $Name + 'isSecret' = $Secret + 'isOutput' = $IsMultiJobVariable + } -AsOutput:$AsOutput + } +} + +function Write-PipelinePrependPath { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string]$Path, + [switch]$AsOutput) + + if ((Test-Path variable:ci) -And $ci) { + Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput + } +} + +function Write-PipelineSetResult { + [CmdletBinding()] + param( + [ValidateSet("Succeeded", "SucceededWithIssues", "Failed", "Cancelled", "Skipped")] + [Parameter(Mandatory = $true)] + [string]$Result, + [string]$Message) + if ((Test-Path variable:ci) -And $ci) { + Write-LoggingCommand -Area 'task' -Event 'complete' -Data $Message -Properties @{ + 'result' = $Result + } + } +} + +<######################################## +# Private functions. +########################################> +function Format-LoggingCommandData { + [CmdletBinding()] + param([string]$Value, [switch]$Reverse) + + if (!$Value) { + return '' + } + + if (!$Reverse) { + foreach ($mapping in $script:loggingCommandEscapeMappings) { + $Value = $Value.Replace($mapping.Token, $mapping.Replacement) + } + } + else { + for ($i = $script:loggingCommandEscapeMappings.Length - 1 ; $i -ge 0 ; $i--) { + $mapping = $script:loggingCommandEscapeMappings[$i] + $Value = $Value.Replace($mapping.Replacement, $mapping.Token) + } + } + + return $Value +} + +function Format-LoggingCommand { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string]$Area, + [Parameter(Mandatory = $true)] + [string]$Event, + [string]$Data, + [hashtable]$Properties) + + # Append the preamble. + [System.Text.StringBuilder]$sb = New-Object -TypeName System.Text.StringBuilder + $null = $sb.Append($script:loggingCommandPrefix).Append($Area).Append('.').Append($Event) + + # Append the properties. + if ($Properties) { + $first = $true + foreach ($key in $Properties.Keys) { + [string]$value = Format-LoggingCommandData $Properties[$key] + if ($value) { + if ($first) { + $null = $sb.Append(' ') + $first = $false + } + else { + $null = $sb.Append(';') + } + + $null = $sb.Append("$key=$value") + } + } + } + + # Append the tail and output the value. + $Data = Format-LoggingCommandData $Data + $sb.Append(']').Append($Data).ToString() +} + +function Write-LoggingCommand { + [CmdletBinding(DefaultParameterSetName = 'Parameters')] + param( + [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] + [string]$Area, + [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] + [string]$Event, + [Parameter(ParameterSetName = 'Parameters')] + [string]$Data, + [Parameter(ParameterSetName = 'Parameters')] + [hashtable]$Properties, + [Parameter(Mandatory = $true, ParameterSetName = 'Object')] + $Command, + [switch]$AsOutput) + + if ($PSCmdlet.ParameterSetName -eq 'Object') { + Write-LoggingCommand -Area $Command.Area -Event $Command.Event -Data $Command.Data -Properties $Command.Properties -AsOutput:$AsOutput + return + } + + $command = Format-LoggingCommand -Area $Area -Event $Event -Data $Data -Properties $Properties + if ($AsOutput) { + $command + } + else { + Write-Host $command + } +} + +function Write-LogIssue { + [CmdletBinding()] + param( + [ValidateSet('warning', 'error')] + [Parameter(Mandatory = $true)] + [string]$Type, + [string]$Message, + [string]$ErrCode, + [string]$SourcePath, + [string]$LineNumber, + [string]$ColumnNumber, + [switch]$AsOutput) + + $command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{ + 'type' = $Type + 'code' = $ErrCode + 'sourcepath' = $SourcePath + 'linenumber' = $LineNumber + 'columnnumber' = $ColumnNumber + } + if ($AsOutput) { + return $command + } + + if ($Type -eq 'error') { + $foregroundColor = $host.PrivateData.ErrorForegroundColor + $backgroundColor = $host.PrivateData.ErrorBackgroundColor + if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { + $foregroundColor = [System.ConsoleColor]::Red + $backgroundColor = [System.ConsoleColor]::Black + } + } + else { + $foregroundColor = $host.PrivateData.WarningForegroundColor + $backgroundColor = $host.PrivateData.WarningBackgroundColor + if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { + $foregroundColor = [System.ConsoleColor]::Yellow + $backgroundColor = [System.ConsoleColor]::Black + } + } + + Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor +} diff --git a/eng/common/pipeline-logging-functions.sh b/eng/common/pipeline-logging-functions.sh new file mode 100755 index 0000000000000..6a0b2255e9118 --- /dev/null +++ b/eng/common/pipeline-logging-functions.sh @@ -0,0 +1,206 @@ +#!/usr/bin/env bash + +function Write-PipelineTelemetryError { + local telemetry_category='' + local force=false + local function_args=() + local message='' + while [[ $# -gt 0 ]]; do + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + -category|-c) + telemetry_category=$2 + shift + ;; + -force|-f) + force=true + ;; + -*) + function_args+=("$1 $2") + shift + ;; + *) + message=$* + ;; + esac + shift + done + + if [[ $force != true ]] && [[ "$ci" != true ]]; then + echo "$message" >&2 + return + fi + + if [[ $force == true ]]; then + function_args+=("-force") + fi + message="(NETCORE_ENGINEERING_TELEMETRY=$telemetry_category) $message" + function_args+=("$message") + Write-PipelineTaskError ${function_args[@]} +} + +function Write-PipelineTaskError { + local message_type="error" + local sourcepath='' + local linenumber='' + local columnnumber='' + local error_code='' + local force=false + + while [[ $# -gt 0 ]]; do + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + -type|-t) + message_type=$2 + shift + ;; + -sourcepath|-s) + sourcepath=$2 + shift + ;; + -linenumber|-ln) + linenumber=$2 + shift + ;; + -columnnumber|-cn) + columnnumber=$2 + shift + ;; + -errcode|-e) + error_code=$2 + shift + ;; + -force|-f) + force=true + ;; + *) + break + ;; + esac + + shift + done + + if [[ $force != true ]] && [[ "$ci" != true ]]; then + echo "$@" >&2 + return + fi + + local message="##vso[task.logissue" + + message="$message type=$message_type" + + if [ -n "$sourcepath" ]; then + message="$message;sourcepath=$sourcepath" + fi + + if [ -n "$linenumber" ]; then + message="$message;linenumber=$linenumber" + fi + + if [ -n "$columnnumber" ]; then + message="$message;columnnumber=$columnnumber" + fi + + if [ -n "$error_code" ]; then + message="$message;code=$error_code" + fi + + message="$message]$*" + echo "$message" +} + +function Write-PipelineSetVariable { + if [[ "$ci" != true ]]; then + return + fi + + local name='' + local value='' + local secret=false + local as_output=false + local is_multi_job_variable=true + + while [[ $# -gt 0 ]]; do + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + -name|-n) + name=$2 + shift + ;; + -value|-v) + value=$2 + shift + ;; + -secret|-s) + secret=true + ;; + -as_output|-a) + as_output=true + ;; + -is_multi_job_variable|-i) + is_multi_job_variable=$2 + shift + ;; + esac + shift + done + + value=${value/;/%3B} + value=${value/\\r/%0D} + value=${value/\\n/%0A} + value=${value/]/%5D} + + local message="##vso[task.setvariable variable=$name;isSecret=$secret;isOutput=$is_multi_job_variable]$value" + + if [[ "$as_output" == true ]]; then + $message + else + echo "$message" + fi +} + +function Write-PipelinePrependPath { + local prepend_path='' + + while [[ $# -gt 0 ]]; do + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + -path|-p) + prepend_path=$2 + shift + ;; + esac + shift + done + + export PATH="$prepend_path:$PATH" + + if [[ "$ci" == true ]]; then + echo "##vso[task.prependpath]$prepend_path" + fi +} + +function Write-PipelineSetResult { + local result='' + local message='' + + while [[ $# -gt 0 ]]; do + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + -result|-r) + result=$2 + shift + ;; + -message|-m) + message=$2 + shift + ;; + esac + shift + done + + if [[ "$ci" == true ]]; then + echo "##vso[task.complete result=$result;]$message" + fi +} diff --git a/eng/common/post-build/check-channel-consistency.ps1 b/eng/common/post-build/check-channel-consistency.ps1 new file mode 100644 index 0000000000000..61208d2d13514 --- /dev/null +++ b/eng/common/post-build/check-channel-consistency.ps1 @@ -0,0 +1,48 @@ +param( + [Parameter(Mandatory=$true)][string] $PromoteToChannels, # List of channels that the build should be promoted to + [Parameter(Mandatory=$true)][array] $AvailableChannelIds # List of channel IDs available in the YAML implementation +) + +try { + $ErrorActionPreference = 'Stop' + Set-StrictMode -Version 2.0 + + # `tools.ps1` checks $ci to perform some actions. Since the post-build + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + $disableConfigureToolsetImport = $true + . $PSScriptRoot\..\tools.ps1 + + if ($PromoteToChannels -eq "") { + Write-PipelineTaskError -Type 'warning' -Message "This build won't publish assets as it's not configured to any Maestro channel. If that wasn't intended use Darc to configure a default channel using add-default-channel for this branch or to promote it to a channel using add-build-to-channel. See https://github.com/dotnet/arcade/blob/main/Documentation/Darc.md#assigning-an-individual-build-to-a-channel for more info." + ExitWithExitCode 0 + } + + # Check that every channel that Maestro told to promote the build to + # is available in YAML + $PromoteToChannelsIds = $PromoteToChannels -split "\D" | Where-Object { $_ } + + $hasErrors = $false + + foreach ($id in $PromoteToChannelsIds) { + if (($id -ne 0) -and ($id -notin $AvailableChannelIds)) { + Write-PipelineTaskError -Message "Channel $id is not present in the post-build YAML configuration! This is an error scenario. Please contact @dnceng." + $hasErrors = $true + } + } + + # The `Write-PipelineTaskError` doesn't error the script and we might report several errors + # in the previous lines. The check below makes sure that we return an error state from the + # script if we reported any validation error + if ($hasErrors) { + ExitWithExitCode 1 + } + + Write-Host 'done.' +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Category 'CheckChannelConsistency' -Message "There was an error while trying to check consistency of Maestro default channels for the build and post-build YAML configuration." + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/nuget-validation.ps1 b/eng/common/post-build/nuget-validation.ps1 new file mode 100644 index 0000000000000..e5de00c89836b --- /dev/null +++ b/eng/common/post-build/nuget-validation.ps1 @@ -0,0 +1,22 @@ +# This script validates NuGet package metadata information using this +# tool: https://github.com/NuGet/NuGetGallery/tree/jver-verify/src/VerifyMicrosoftPackage + +param( + [Parameter(Mandatory=$true)][string] $PackagesPath # Path to where the packages to be validated are +) + +# `tools.ps1` checks $ci to perform some actions. Since the post-build +# scripts don't necessarily execute in the same agent that run the +# build.ps1/sh script this variable isn't automatically set. +$ci = $true +$disableConfigureToolsetImport = $true +. $PSScriptRoot\..\tools.ps1 + +try { + & $PSScriptRoot\nuget-verification.ps1 ${PackagesPath}\*.nupkg +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'NuGetValidation' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/nuget-verification.ps1 b/eng/common/post-build/nuget-verification.ps1 new file mode 100644 index 0000000000000..eea88e653c911 --- /dev/null +++ b/eng/common/post-build/nuget-verification.ps1 @@ -0,0 +1,121 @@ +<# +.SYNOPSIS + Verifies that Microsoft NuGet packages have proper metadata. +.DESCRIPTION + Downloads a verification tool and runs metadata validation on the provided NuGet packages. This script writes an + error if any of the provided packages fail validation. All arguments provided to this PowerShell script that do not + match PowerShell parameters are passed on to the verification tool downloaded during the execution of this script. +.PARAMETER NuGetExePath + The path to the nuget.exe binary to use. If not provided, nuget.exe will be downloaded into the -DownloadPath + directory. +.PARAMETER PackageSource + The package source to use to download the verification tool. If not provided, nuget.org will be used. +.PARAMETER DownloadPath + The directory path to download the verification tool and nuget.exe to. If not provided, + %TEMP%\NuGet.VerifyNuGetPackage will be used. +.PARAMETER args + Arguments that will be passed to the verification tool. +.EXAMPLE + PS> .\verify.ps1 *.nupkg + Verifies the metadata of all .nupkg files in the currect working directory. +.EXAMPLE + PS> .\verify.ps1 --help + Displays the help text of the downloaded verifiction tool. +.LINK + https://github.com/NuGet/NuGetGallery/blob/master/src/VerifyMicrosoftPackage/README.md +#> + +# This script was copied from https://github.com/NuGet/NuGetGallery/blob/3e25ad135146676bcab0050a516939d9958bfa5d/src/VerifyMicrosoftPackage/verify.ps1 + +[CmdletBinding(PositionalBinding = $false)] +param( + [string]$NuGetExePath, + [string]$PackageSource = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json", + [string]$DownloadPath, + [Parameter(ValueFromRemainingArguments = $true)] + [string[]]$args +) + +# The URL to download nuget.exe. +$nugetExeUrl = "https://dist.nuget.org/win-x86-commandline/v4.9.4/nuget.exe" + +# The package ID of the verification tool. +$packageId = "NuGet.VerifyMicrosoftPackage" + +# The location that nuget.exe and the verification tool will be downloaded to. +if (!$DownloadPath) { + $DownloadPath = (Join-Path $env:TEMP "NuGet.VerifyMicrosoftPackage") +} + +$fence = New-Object -TypeName string -ArgumentList '=', 80 + +# Create the download directory, if it doesn't already exist. +if (!(Test-Path $DownloadPath)) { + New-Item -ItemType Directory $DownloadPath | Out-Null +} +Write-Host "Using download path: $DownloadPath" + +if ($NuGetExePath) { + $nuget = $NuGetExePath +} else { + $downloadedNuGetExe = Join-Path $DownloadPath "nuget.exe" + + # Download nuget.exe, if it doesn't already exist. + if (!(Test-Path $downloadedNuGetExe)) { + Write-Host "Downloading nuget.exe from $nugetExeUrl..." + $ProgressPreference = 'SilentlyContinue' + try { + Invoke-WebRequest $nugetExeUrl -UseBasicParsing -OutFile $downloadedNuGetExe + $ProgressPreference = 'Continue' + } catch { + $ProgressPreference = 'Continue' + Write-Error $_ + Write-Error "nuget.exe failed to download." + exit + } + } + + $nuget = $downloadedNuGetExe +} + +Write-Host "Using nuget.exe path: $nuget" +Write-Host " " + +# Download the latest version of the verification tool. +Write-Host "Downloading the latest version of $packageId from $packageSource..." +Write-Host $fence +& $nuget install $packageId ` + -Prerelease ` + -OutputDirectory $DownloadPath ` + -Source $PackageSource +Write-Host $fence +Write-Host " " + +if ($LASTEXITCODE -ne 0) { + Write-Error "nuget.exe failed to fetch the verify tool." + exit +} + +# Find the most recently downloaded tool +Write-Host "Finding the most recently downloaded verification tool." +$verifyProbePath = Join-Path $DownloadPath "$packageId.*" +$verifyPath = Get-ChildItem -Path $verifyProbePath -Directory ` + | Sort-Object -Property LastWriteTime -Descending ` + | Select-Object -First 1 +$verify = Join-Path $verifyPath "tools\NuGet.VerifyMicrosoftPackage.exe" +Write-Host "Using verification tool: $verify" +Write-Host " " + +# Execute the verification tool. +Write-Host "Executing the verify tool..." +Write-Host $fence +& $verify $args +Write-Host $fence +Write-Host " " + +# Respond to the exit code. +if ($LASTEXITCODE -ne 0) { + Write-Error "The verify tool found some problems." +} else { + Write-Output "The verify tool succeeded." +} diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 new file mode 100644 index 0000000000000..48e55598bdd29 --- /dev/null +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -0,0 +1,71 @@ +param( + [Parameter(Mandatory=$true)][int] $BuildId, + [Parameter(Mandatory=$true)][int] $PublishingInfraVersion, + [Parameter(Mandatory=$true)][string] $AzdoToken, + [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', + [Parameter(Mandatory=$true)][string] $WaitPublishingFinish, + [Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters, + [Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters, + [Parameter(Mandatory=$false)][string] $RequireDefaultChannels, + [Parameter(Mandatory=$false)][string] $SkipAssetsPublishing, + [Parameter(Mandatory=$false)][string] $runtimeSourceFeed, + [Parameter(Mandatory=$false)][string] $runtimeSourceFeedKey +) + +try { + # `tools.ps1` checks $ci to perform some actions. Since the post-build + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + $disableConfigureToolsetImport = $true + . $PSScriptRoot\..\tools.ps1 + + $darc = Get-Darc + + $optionalParams = [System.Collections.ArrayList]::new() + + if ("" -ne $ArtifactsPublishingAdditionalParameters) { + $optionalParams.Add("--artifact-publishing-parameters") | Out-Null + $optionalParams.Add($ArtifactsPublishingAdditionalParameters) | Out-Null + } + + if ("" -ne $SymbolPublishingAdditionalParameters) { + $optionalParams.Add("--symbol-publishing-parameters") | Out-Null + $optionalParams.Add($SymbolPublishingAdditionalParameters) | Out-Null + } + + if ("false" -eq $WaitPublishingFinish) { + $optionalParams.Add("--no-wait") | Out-Null + } + + if ("true" -eq $RequireDefaultChannels) { + $optionalParams.Add("--default-channels-required") | Out-Null + } + + if ("true" -eq $SkipAssetsPublishing) { + $optionalParams.Add("--skip-assets-publishing") | Out-Null + } + + & $darc add-build-to-channel ` + --id $buildId ` + --publishing-infra-version $PublishingInfraVersion ` + --default-channels ` + --source-branch main ` + --azdev-pat "$AzdoToken" ` + --bar-uri "$MaestroApiEndPoint" ` + --ci ` + --verbose ` + @optionalParams + + if ($LastExitCode -ne 0) { + Write-Host "Problems using Darc to promote build ${buildId} to default channels. Stopping execution..." + exit 1 + } + + Write-Host 'done.' +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Category 'PromoteBuild' -Message "There was an error while trying to publish build '$BuildId' to default channels." + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/redact-logs.ps1 b/eng/common/post-build/redact-logs.ps1 new file mode 100644 index 0000000000000..fc0218a013d16 --- /dev/null +++ b/eng/common/post-build/redact-logs.ps1 @@ -0,0 +1,91 @@ +[CmdletBinding(PositionalBinding=$False)] +param( + [Parameter(Mandatory=$true, Position=0)][string] $InputPath, + [Parameter(Mandatory=$true)][string] $BinlogToolVersion, + [Parameter(Mandatory=$false)][string] $DotnetPath, + [Parameter(Mandatory=$false)][string] $PackageFeed = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json', + # File with strings to redact - separated by newlines. + # For comments start the line with '# ' - such lines are ignored + [Parameter(Mandatory=$false)][string] $TokensFilePath, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$TokensToRedact, + [Parameter(Mandatory=$false)][string] $runtimeSourceFeed, + [Parameter(Mandatory=$false)][string] $runtimeSourceFeedKey +) + +try { + $ErrorActionPreference = 'Stop' + Set-StrictMode -Version 2.0 + + # `tools.ps1` checks $ci to perform some actions. Since the post-build + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + $disableConfigureToolsetImport = $true + . $PSScriptRoot\..\tools.ps1 + + $packageName = 'binlogtool' + + $dotnet = $DotnetPath + + if (!$dotnet) { + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + } + + $toolList = & "$dotnet" tool list -g + + if ($toolList -like "*$packageName*") { + & "$dotnet" tool uninstall $packageName -g + } + + $toolPath = "$PSScriptRoot\..\..\..\.tools" + $verbosity = 'minimal' + + New-Item -ItemType Directory -Force -Path $toolPath + + Push-Location -Path $toolPath + + try { + Write-Host "Installing Binlog redactor CLI..." + Write-Host "'$dotnet' new tool-manifest" + & "$dotnet" new tool-manifest + Write-Host "'$dotnet' tool install $packageName --local --add-source '$PackageFeed' -v $verbosity --version $BinlogToolVersion" + & "$dotnet" tool install $packageName --local --add-source "$PackageFeed" -v $verbosity --version $BinlogToolVersion + + if (Test-Path $TokensFilePath) { + Write-Host "Adding additional sensitive data for redaction from file: " $TokensFilePath + $TokensToRedact += Get-Content -Path $TokensFilePath | Foreach {$_.Trim()} | Where { $_ -notmatch "^# " } + } + + $optionalParams = [System.Collections.ArrayList]::new() + + Foreach ($p in $TokensToRedact) + { + if($p -match '^\$\(.*\)$') + { + Write-Host ("Ignoring token {0} as it is probably unexpanded AzDO variable" -f $p) + } + elseif($p) + { + $optionalParams.Add("-p:" + $p) | Out-Null + } + } + + & $dotnet binlogtool redact --input:$InputPath --recurse --in-place ` + @optionalParams + + if ($LastExitCode -ne 0) { + Write-PipelineTelemetryError -Category 'Redactor' -Type 'warning' -Message "Problems using Redactor tool (exit code: $LastExitCode). But ignoring them now." + } + } + finally { + Pop-Location + } + + Write-Host 'done.' +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Category 'Redactor' -Message "There was an error while trying to redact logs. Error: $_" + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 new file mode 100644 index 0000000000000..1976ef70fb850 --- /dev/null +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -0,0 +1,327 @@ +param( + [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where Symbols.NuGet packages to be checked are stored + [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation + [Parameter(Mandatory=$false)][string] $GHRepoName, # GitHub name of the repo including the Org. E.g., dotnet/arcade + [Parameter(Mandatory=$false)][string] $GHCommit, # GitHub commit SHA used to build the packages + [Parameter(Mandatory=$true)][string] $SourcelinkCliVersion # Version of SourceLink CLI to use +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +# `tools.ps1` checks $ci to perform some actions. Since the post-build +# scripts don't necessarily execute in the same agent that run the +# build.ps1/sh script this variable isn't automatically set. +$ci = $true +$disableConfigureToolsetImport = $true +. $PSScriptRoot\..\tools.ps1 + +# Cache/HashMap (File -> Exist flag) used to consult whether a file exist +# in the repository at a specific commit point. This is populated by inserting +# all files present in the repo at a specific commit point. +$global:RepoFiles = @{} + +# Maximum number of jobs to run in parallel +$MaxParallelJobs = 16 + +$MaxRetries = 5 +$RetryWaitTimeInSeconds = 30 + +# Wait time between check for system load +$SecondsBetweenLoadChecks = 10 + +if (!$InputPath -or !(Test-Path $InputPath)){ + Write-Host "No files to validate." + ExitWithExitCode 0 +} + +$ValidatePackage = { + param( + [string] $PackagePath # Full path to a Symbols.NuGet package + ) + + . $using:PSScriptRoot\..\tools.ps1 + + # Ensure input file exist + if (!(Test-Path $PackagePath)) { + Write-Host "Input file does not exist: $PackagePath" + return [pscustomobject]@{ + result = 1 + packagePath = $PackagePath + } + } + + # Extensions for which we'll look for SourceLink information + # For now we'll only care about Portable & Embedded PDBs + $RelevantExtensions = @('.dll', '.exe', '.pdb') + + Write-Host -NoNewLine 'Validating ' ([System.IO.Path]::GetFileName($PackagePath)) '...' + + $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) + $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId + $FailedFiles = 0 + + Add-Type -AssemblyName System.IO.Compression.FileSystem + + [System.IO.Directory]::CreateDirectory($ExtractPath) | Out-Null + + try { + $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) + + $zip.Entries | + Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | + ForEach-Object { + $FileName = $_.FullName + $Extension = [System.IO.Path]::GetExtension($_.Name) + $FakeName = -Join((New-Guid), $Extension) + $TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName + + # We ignore resource DLLs + if ($FileName.EndsWith('.resources.dll')) { + return [pscustomobject]@{ + result = 0 + packagePath = $PackagePath + } + } + + [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) + + $ValidateFile = { + param( + [string] $FullPath, # Full path to the module that has to be checked + [string] $RealPath, + [ref] $FailedFiles + ) + + $sourcelinkExe = "$env:USERPROFILE\.dotnet\tools" + $sourcelinkExe = Resolve-Path "$sourcelinkExe\sourcelink.exe" + $SourceLinkInfos = & $sourcelinkExe print-urls $FullPath | Out-String + + if ($LASTEXITCODE -eq 0 -and -not ([string]::IsNullOrEmpty($SourceLinkInfos))) { + $NumFailedLinks = 0 + + # We only care about Http addresses + $Matches = (Select-String '(http[s]?)(:\/\/)([^\s,]+)' -Input $SourceLinkInfos -AllMatches).Matches + + if ($Matches.Count -ne 0) { + $Matches.Value | + ForEach-Object { + $Link = $_ + $CommitUrl = "https://raw.githubusercontent.com/${using:GHRepoName}/${using:GHCommit}/" + + $FilePath = $Link.Replace($CommitUrl, "") + $Status = 200 + $Cache = $using:RepoFiles + + $attempts = 0 + + while ($attempts -lt $using:MaxRetries) { + if ( !($Cache.ContainsKey($FilePath)) ) { + try { + $Uri = $Link -as [System.URI] + + if ($Link -match "submodules") { + # Skip submodule links until sourcelink properly handles submodules + $Status = 200 + } + elseif ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match 'github' -or $Uri.Host -match 'githubusercontent')) { + # Only GitHub links are valid + $Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode + } + else { + # If it's not a github link, we want to break out of the loop and not retry. + $Status = 0 + $attempts = $using:MaxRetries + } + } + catch { + Write-Host $_ + $Status = 0 + } + } + + if ($Status -ne 200) { + $attempts++ + + if ($attempts -lt $using:MaxRetries) + { + $attemptsLeft = $using:MaxRetries - $attempts + Write-Warning "Download failed, $attemptsLeft attempts remaining, will retry in $using:RetryWaitTimeInSeconds seconds" + Start-Sleep -Seconds $using:RetryWaitTimeInSeconds + } + else { + if ($NumFailedLinks -eq 0) { + if ($FailedFiles.Value -eq 0) { + Write-Host + } + + Write-Host "`tFile $RealPath has broken links:" + } + + Write-Host "`t`tFailed to retrieve $Link" + + $NumFailedLinks++ + } + } + else { + break + } + } + } + } + + if ($NumFailedLinks -ne 0) { + $FailedFiles.value++ + $global:LASTEXITCODE = 1 + } + } + } + + &$ValidateFile $TargetFile $FileName ([ref]$FailedFiles) + } + } + catch { + Write-Host $_ + } + finally { + $zip.Dispose() + } + + if ($FailedFiles -eq 0) { + Write-Host 'Passed.' + return [pscustomobject]@{ + result = 0 + packagePath = $PackagePath + } + } + else { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "$PackagePath has broken SourceLink links." + return [pscustomobject]@{ + result = 1 + packagePath = $PackagePath + } + } +} + +function CheckJobResult( + $result, + $packagePath, + [ref]$ValidationFailures, + [switch]$logErrors) { + if ($result -ne '0') { + if ($logErrors) { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "$packagePath has broken SourceLink links." + } + $ValidationFailures.Value++ + } +} + +function ValidateSourceLinkLinks { + if ($GHRepoName -ne '' -and !($GHRepoName -Match '^[^\s\/]+/[^\s\/]+$')) { + if (!($GHRepoName -Match '^[^\s-]+-[^\s]+$')) { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "GHRepoName should be in the format / or -. '$GHRepoName'" + ExitWithExitCode 1 + } + else { + $GHRepoName = $GHRepoName -replace '^([^\s-]+)-([^\s]+)$', '$1/$2'; + } + } + + if ($GHCommit -ne '' -and !($GHCommit -Match '^[0-9a-fA-F]{40}$')) { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "GHCommit should be a 40 chars hexadecimal string. '$GHCommit'" + ExitWithExitCode 1 + } + + if ($GHRepoName -ne '' -and $GHCommit -ne '') { + $RepoTreeURL = -Join('http://api.github.com/repos/', $GHRepoName, '/git/trees/', $GHCommit, '?recursive=1') + $CodeExtensions = @('.cs', '.vb', '.fs', '.fsi', '.fsx', '.fsscript') + + try { + # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash + $Data = Invoke-WebRequest $RepoTreeURL -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty tree + + foreach ($file in $Data) { + $Extension = [System.IO.Path]::GetExtension($file.path) + + if ($CodeExtensions.Contains($Extension)) { + $RepoFiles[$file.path] = 1 + } + } + } + catch { + Write-Host "Problems downloading the list of files from the repo. Url used: $RepoTreeURL . Execution will proceed without caching." + } + } + elseif ($GHRepoName -ne '' -or $GHCommit -ne '') { + Write-Host 'For using the http caching mechanism both GHRepoName and GHCommit should be informed.' + } + + if (Test-Path $ExtractPath) { + Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue + } + + $ValidationFailures = 0 + + # Process each NuGet package in parallel + Get-ChildItem "$InputPath\*.symbols.nupkg" | + ForEach-Object { + Write-Host "Starting $($_.FullName)" + Start-Job -ScriptBlock $ValidatePackage -ArgumentList $_.FullName | Out-Null + $NumJobs = @(Get-Job -State 'Running').Count + + while ($NumJobs -ge $MaxParallelJobs) { + Write-Host "There are $NumJobs validation jobs running right now. Waiting $SecondsBetweenLoadChecks seconds to check again." + sleep $SecondsBetweenLoadChecks + $NumJobs = @(Get-Job -State 'Running').Count + } + + foreach ($Job in @(Get-Job -State 'Completed')) { + $jobResult = Wait-Job -Id $Job.Id | Receive-Job + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$ValidationFailures) -LogErrors + Remove-Job -Id $Job.Id + } + } + + foreach ($Job in @(Get-Job)) { + $jobResult = Wait-Job -Id $Job.Id | Receive-Job + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$ValidationFailures) + Remove-Job -Id $Job.Id + } + if ($ValidationFailures -gt 0) { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "$ValidationFailures package(s) failed validation." + ExitWithExitCode 1 + } +} + +function InstallSourcelinkCli { + $sourcelinkCliPackageName = 'sourcelink' + + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + $toolList = & "$dotnet" tool list --global + + if (($toolList -like "*$sourcelinkCliPackageName*") -and ($toolList -like "*$sourcelinkCliVersion*")) { + Write-Host "SourceLink CLI version $sourcelinkCliVersion is already installed." + } + else { + Write-Host "Installing SourceLink CLI version $sourcelinkCliVersion..." + Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' + & "$dotnet" tool install $sourcelinkCliPackageName --version $sourcelinkCliVersion --verbosity "minimal" --global + } +} + +try { + InstallSourcelinkCli + + foreach ($Job in @(Get-Job)) { + Remove-Job -Id $Job.Id + } + + ValidateSourceLinkLinks +} +catch { + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'SourceLink' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1 new file mode 100644 index 0000000000000..7146e593ffae8 --- /dev/null +++ b/eng/common/post-build/symbols-validation.ps1 @@ -0,0 +1,337 @@ +param( + [Parameter(Mandatory = $true)][string] $InputPath, # Full path to directory where NuGet packages to be checked are stored + [Parameter(Mandatory = $true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation + [Parameter(Mandatory = $true)][string] $DotnetSymbolVersion, # Version of dotnet symbol to use + [Parameter(Mandatory = $false)][switch] $CheckForWindowsPdbs, # If we should check for the existence of windows pdbs in addition to portable PDBs + [Parameter(Mandatory = $false)][switch] $ContinueOnError, # If we should keep checking symbols after an error + [Parameter(Mandatory = $false)][switch] $Clean, # Clean extracted symbols directory after checking symbols + [Parameter(Mandatory = $false)][string] $SymbolExclusionFile # Exclude the symbols in the file from publishing to symbol server +) + +. $PSScriptRoot\..\tools.ps1 +# Maximum number of jobs to run in parallel +$MaxParallelJobs = 16 + +# Max number of retries +$MaxRetry = 5 + +# Wait time between check for system load +$SecondsBetweenLoadChecks = 10 + +# Set error codes +Set-Variable -Name "ERROR_BADEXTRACT" -Option Constant -Value -1 +Set-Variable -Name "ERROR_FILEDOESNOTEXIST" -Option Constant -Value -2 + +$WindowsPdbVerificationParam = "" +if ($CheckForWindowsPdbs) { + $WindowsPdbVerificationParam = "--windows-pdbs" +} + +$ExclusionSet = New-Object System.Collections.Generic.HashSet[string]; + +if (!$InputPath -or !(Test-Path $InputPath)){ + Write-Host "No symbols to validate." + ExitWithExitCode 0 +} + +#Check if the path exists +if ($SymbolExclusionFile -and (Test-Path $SymbolExclusionFile)){ + [string[]]$Exclusions = Get-Content "$SymbolExclusionFile" + $Exclusions | foreach { if($_ -and $_.Trim()){$ExclusionSet.Add($_)} } +} +else{ + Write-Host "Symbol Exclusion file does not exists. No symbols to exclude." +} + +$CountMissingSymbols = { + param( + [string] $PackagePath, # Path to a NuGet package + [string] $WindowsPdbVerificationParam # If we should check for the existence of windows pdbs in addition to portable PDBs + ) + + Add-Type -AssemblyName System.IO.Compression.FileSystem + + Write-Host "Validating $PackagePath " + + # Ensure input file exist + if (!(Test-Path $PackagePath)) { + Write-PipelineTaskError "Input file does not exist: $PackagePath" + return [pscustomobject]@{ + result = $using:ERROR_FILEDOESNOTEXIST + packagePath = $PackagePath + } + } + + # Extensions for which we'll look for symbols + $RelevantExtensions = @('.dll', '.exe', '.so', '.dylib') + + # How many files are missing symbol information + $MissingSymbols = 0 + + $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) + $PackageGuid = New-Guid + $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageGuid + $SymbolsPath = Join-Path -Path $ExtractPath -ChildPath 'Symbols' + + try { + [System.IO.Compression.ZipFile]::ExtractToDirectory($PackagePath, $ExtractPath) + } + catch { + Write-Host "Something went wrong extracting $PackagePath" + Write-Host $_ + return [pscustomobject]@{ + result = $using:ERROR_BADEXTRACT + packagePath = $PackagePath + } + } + + Get-ChildItem -Recurse $ExtractPath | + Where-Object { $RelevantExtensions -contains $_.Extension } | + ForEach-Object { + $FileName = $_.FullName + if ($FileName -Match '\\ref\\') { + Write-Host "`t Ignoring reference assembly file " $FileName + return + } + + $FirstMatchingSymbolDescriptionOrDefault = { + param( + [string] $FullPath, # Full path to the module that has to be checked + [string] $TargetServerParam, # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols + [string] $WindowsPdbVerificationParam, # Parameter to pass to potential check for windows-pdbs. + [string] $SymbolsPath + ) + + $FileName = [System.IO.Path]::GetFileName($FullPath) + $Extension = [System.IO.Path]::GetExtension($FullPath) + + # Those below are potential symbol files that the `dotnet symbol` might + # return. Which one will be returned depend on the type of file we are + # checking and which type of file was uploaded. + + # The file itself is returned + $SymbolPath = $SymbolsPath + '\' + $FileName + + # PDB file for the module + $PdbPath = $SymbolPath.Replace($Extension, '.pdb') + + # PDB file for R2R module (created by crossgen) + $NGenPdb = $SymbolPath.Replace($Extension, '.ni.pdb') + + # DBG file for a .so library + $SODbg = $SymbolPath.Replace($Extension, '.so.dbg') + + # DWARF file for a .dylib + $DylibDwarf = $SymbolPath.Replace($Extension, '.dylib.dwarf') + + $dotnetSymbolExe = "$env:USERPROFILE\.dotnet\tools" + $dotnetSymbolExe = Resolve-Path "$dotnetSymbolExe\dotnet-symbol.exe" + + $totalRetries = 0 + + while ($totalRetries -lt $using:MaxRetry) { + + # Save the output and get diagnostic output + $output = & $dotnetSymbolExe --symbols --modules $WindowsPdbVerificationParam $TargetServerParam $FullPath -o $SymbolsPath --diagnostics | Out-String + + if ((Test-Path $PdbPath) -and (Test-path $SymbolPath)) { + return 'Module and PDB for Module' + } + elseif ((Test-Path $NGenPdb) -and (Test-Path $PdbPath) -and (Test-Path $SymbolPath)) { + return 'Dll, PDB and NGen PDB' + } + elseif ((Test-Path $SODbg) -and (Test-Path $SymbolPath)) { + return 'So and DBG for SO' + } + elseif ((Test-Path $DylibDwarf) -and (Test-Path $SymbolPath)) { + return 'Dylib and Dwarf for Dylib' + } + elseif (Test-Path $SymbolPath) { + return 'Module' + } + else + { + $totalRetries++ + } + } + + return $null + } + + $FileRelativePath = $FileName.Replace("$ExtractPath\", "") + if (($($using:ExclusionSet) -ne $null) -and ($($using:ExclusionSet).Contains($FileRelativePath) -or ($($using:ExclusionSet).Contains($FileRelativePath.Replace("\", "/"))))){ + Write-Host "Skipping $FileName from symbol validation" + } + + else { + $FileGuid = New-Guid + $ExpandedSymbolsPath = Join-Path -Path $SymbolsPath -ChildPath $FileGuid + + $SymbolsOnMSDL = & $FirstMatchingSymbolDescriptionOrDefault ` + -FullPath $FileName ` + -TargetServerParam '--microsoft-symbol-server' ` + -SymbolsPath "$ExpandedSymbolsPath-msdl" ` + -WindowsPdbVerificationParam $WindowsPdbVerificationParam + $SymbolsOnSymWeb = & $FirstMatchingSymbolDescriptionOrDefault ` + -FullPath $FileName ` + -TargetServerParam '--internal-server' ` + -SymbolsPath "$ExpandedSymbolsPath-symweb" ` + -WindowsPdbVerificationParam $WindowsPdbVerificationParam + + Write-Host -NoNewLine "`t Checking file " $FileName "... " + + if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null) { + Write-Host "Symbols found on MSDL ($SymbolsOnMSDL) and SymWeb ($SymbolsOnSymWeb)" + } + else { + $MissingSymbols++ + + if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null) { + Write-Host 'No symbols found on MSDL or SymWeb!' + } + else { + if ($SymbolsOnMSDL -eq $null) { + Write-Host 'No symbols found on MSDL!' + } + else { + Write-Host 'No symbols found on SymWeb!' + } + } + } + } + } + + if ($using:Clean) { + Remove-Item $ExtractPath -Recurse -Force + } + + Pop-Location + + return [pscustomobject]@{ + result = $MissingSymbols + packagePath = $PackagePath + } +} + +function CheckJobResult( + $result, + $packagePath, + [ref]$DupedSymbols, + [ref]$TotalFailures) { + if ($result -eq $ERROR_BADEXTRACT) { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "$packagePath has duplicated symbol files" + $DupedSymbols.Value++ + } + elseif ($result -eq $ERROR_FILEDOESNOTEXIST) { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "$packagePath does not exist" + $TotalFailures.Value++ + } + elseif ($result -gt '0') { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Missing symbols for $result modules in the package $packagePath" + $TotalFailures.Value++ + } + else { + Write-Host "All symbols verified for package $packagePath" + } +} + +function CheckSymbolsAvailable { + if (Test-Path $ExtractPath) { + Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue + } + + $TotalPackages = 0 + $TotalFailures = 0 + $DupedSymbols = 0 + + Get-ChildItem "$InputPath\*.nupkg" | + ForEach-Object { + $FileName = $_.Name + $FullName = $_.FullName + + # These packages from Arcade-Services include some native libraries that + # our current symbol uploader can't handle. Below is a workaround until + # we get issue: https://github.com/dotnet/arcade/issues/2457 sorted. + if ($FileName -Match 'Microsoft\.DotNet\.Darc\.') { + Write-Host "Ignoring Arcade-services file: $FileName" + Write-Host + return + } + elseif ($FileName -Match 'Microsoft\.DotNet\.Maestro\.Tasks\.') { + Write-Host "Ignoring Arcade-services file: $FileName" + Write-Host + return + } + + $TotalPackages++ + + Start-Job -ScriptBlock $CountMissingSymbols -ArgumentList @($FullName,$WindowsPdbVerificationParam) | Out-Null + + $NumJobs = @(Get-Job -State 'Running').Count + + while ($NumJobs -ge $MaxParallelJobs) { + Write-Host "There are $NumJobs validation jobs running right now. Waiting $SecondsBetweenLoadChecks seconds to check again." + sleep $SecondsBetweenLoadChecks + $NumJobs = @(Get-Job -State 'Running').Count + } + + foreach ($Job in @(Get-Job -State 'Completed')) { + $jobResult = Wait-Job -Id $Job.Id | Receive-Job + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$DupedSymbols) ([ref]$TotalFailures) + Remove-Job -Id $Job.Id + } + Write-Host + } + + foreach ($Job in @(Get-Job)) { + $jobResult = Wait-Job -Id $Job.Id | Receive-Job + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$DupedSymbols) ([ref]$TotalFailures) + } + + if ($TotalFailures -gt 0 -or $DupedSymbols -gt 0) { + if ($TotalFailures -gt 0) { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Symbols missing for $TotalFailures/$TotalPackages packages" + } + + if ($DupedSymbols -gt 0) { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "$DupedSymbols/$TotalPackages packages had duplicated symbol files and could not be extracted" + } + + ExitWithExitCode 1 + } + else { + Write-Host "All symbols validated!" + } +} + +function InstallDotnetSymbol { + $dotnetSymbolPackageName = 'dotnet-symbol' + + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + $toolList = & "$dotnet" tool list --global + + if (($toolList -like "*$dotnetSymbolPackageName*") -and ($toolList -like "*$dotnetSymbolVersion*")) { + Write-Host "dotnet-symbol version $dotnetSymbolVersion is already installed." + } + else { + Write-Host "Installing dotnet-symbol version $dotnetSymbolVersion..." + Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' + & "$dotnet" tool install $dotnetSymbolPackageName --version $dotnetSymbolVersion --verbosity "minimal" --global + } +} + +try { + InstallDotnetSymbol + + foreach ($Job in @(Get-Job)) { + Remove-Job -Id $Job.Id + } + + CheckSymbolsAvailable +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/retain-build.ps1 b/eng/common/retain-build.ps1 new file mode 100644 index 0000000000000..e7ba975adeb6b --- /dev/null +++ b/eng/common/retain-build.ps1 @@ -0,0 +1,45 @@ + +Param( +[Parameter(Mandatory=$true)][int] $buildId, +[Parameter(Mandatory=$true)][string] $azdoOrgUri, +[Parameter(Mandatory=$true)][string] $azdoProject, +[Parameter(Mandatory=$true)][string] $token +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +function Get-AzDOHeaders( + [string] $token) +{ + $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":${token}")) + $headers = @{"Authorization"="Basic $base64AuthInfo"} + return $headers +} + +function Update-BuildRetention( + [string] $azdoOrgUri, + [string] $azdoProject, + [int] $buildId, + [string] $token) +{ + $headers = Get-AzDOHeaders -token $token + $requestBody = "{ + `"keepForever`": `"true`" + }" + + $requestUri = "${azdoOrgUri}/${azdoProject}/_apis/build/builds/${buildId}?api-version=6.0" + write-Host "Attempting to retain build using the following URI: ${requestUri} ..." + + try { + Invoke-RestMethod -Uri $requestUri -Method Patch -Body $requestBody -Header $headers -contentType "application/json" + Write-Host "Updated retention settings for build ${buildId}." + } + catch { + Write-Error "Failed to update retention settings for build: $_.Exception.Response.StatusDescription" + exit 1 + } +} + +Update-BuildRetention -azdoOrgUri $azdoOrgUri -azdoProject $azdoProject -buildId $buildId -token $token +exit 0 diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 new file mode 100644 index 0000000000000..b64b66a6275bb --- /dev/null +++ b/eng/common/sdk-task.ps1 @@ -0,0 +1,103 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string] $configuration = 'Debug', + [string] $task, + [string] $verbosity = 'minimal', + [string] $msbuildEngine = $null, + [switch] $restore, + [switch] $prepareMachine, + [switch][Alias('nobl')]$excludeCIBinaryLog, + [switch]$noWarnAsError, + [switch] $help, + [string] $runtimeSourceFeed = '', + [string] $runtimeSourceFeedKey = '', + [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties +) + +$ci = $true +$binaryLog = if ($excludeCIBinaryLog) { $false } else { $true } +$warnAsError = if ($noWarnAsError) { $false } else { $true } + +. $PSScriptRoot\tools.ps1 + +function Print-Usage() { + Write-Host "Common settings:" + Write-Host " -task Name of Arcade task (name of a project in SdkTasks directory of the Arcade SDK package)" + Write-Host " -restore Restore dependencies" + Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]" + Write-Host " -help Print help and exit" + Write-Host "" + + Write-Host "Advanced settings:" + Write-Host " -prepareMachine Prepare machine for CI run" + Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." + Write-Host " -excludeCIBinaryLog When running on CI, allow no binary log (short: -nobl)" + Write-Host "" + Write-Host "Command line arguments not listed above are passed thru to msbuild." +} + +function Build([string]$target) { + $logSuffix = if ($target -eq 'Execute') { '' } else { ".$target" } + $log = Join-Path $LogDir "$task$logSuffix.binlog" + $binaryLogArg = if ($binaryLog) { "/bl:$log" } else { "" } + $outputPath = Join-Path $ToolsetDir "$task\" + + MSBuild $taskProject ` + $binaryLogArg ` + /t:$target ` + /p:Configuration=$configuration ` + /p:RepoRoot=$RepoRoot ` + /p:BaseIntermediateOutputPath=$outputPath ` + /v:$verbosity ` + @properties +} + +try { + if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) { + Print-Usage + exit 0 + } + + if ($task -eq "") { + Write-PipelineTelemetryError -Category 'Build' -Message "Missing required parameter '-task '" + Print-Usage + ExitWithExitCode 1 + } + + if( $msbuildEngine -eq "vs") { + # Ensure desktop MSBuild is available for sdk tasks. + if( -not ($GlobalJson.tools.PSObject.Properties.Name -contains "vs" )) { + $GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty + } + if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) { + $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "18.0.0" -MemberType NoteProperty + } + if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") { + $xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true + } + if ($xcopyMSBuildToolsFolder -eq $null) { + throw 'Unable to get xcopy downloadable version of msbuild' + } + + $global:_MSBuildExe = "$($xcopyMSBuildToolsFolder)\MSBuild\Current\Bin\MSBuild.exe" + } + + $taskProject = GetSdkTaskProject $task + if (!(Test-Path $taskProject)) { + Write-PipelineTelemetryError -Category 'Build' -Message "Unknown task: $task" + ExitWithExitCode 1 + } + + if ($restore) { + Build 'Restore' + } + + Build 'Execute' +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'Build' -Message $_ + ExitWithExitCode 1 +} + +ExitWithExitCode 0 diff --git a/eng/common/sdk-task.sh b/eng/common/sdk-task.sh new file mode 100644 index 0000000000000..3270f83fa9a76 --- /dev/null +++ b/eng/common/sdk-task.sh @@ -0,0 +1,121 @@ +#!/usr/bin/env bash + +show_usage() { + echo "Common settings:" + echo " --task Name of Arcade task (name of a project in SdkTasks directory of the Arcade SDK package)" + echo " --restore Restore dependencies" + echo " --verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]" + echo " --help Print help and exit" + echo "" + + echo "Advanced settings:" + echo " --excludeCIBinarylog Don't output binary log (short: -nobl)" + echo " --noWarnAsError Do not warn as error" + echo "" + echo "Command line arguments not listed above are passed thru to msbuild." +} + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +Build() { + local target=$1 + local log_suffix="" + [[ "$target" != "Execute" ]] && log_suffix=".$target" + local log="$log_dir/$task$log_suffix.binlog" + local binaryLogArg="" + [[ $binary_log == true ]] && binaryLogArg="/bl:$log" + local output_path="$toolset_dir/$task/" + + MSBuild "$taskProject" \ + $binaryLogArg \ + /t:"$target" \ + /p:Configuration="$configuration" \ + /p:RepoRoot="$repo_root" \ + /p:BaseIntermediateOutputPath="$output_path" \ + /v:"$verbosity" \ + $properties +} + +binary_log=true +configuration="Debug" +verbosity="minimal" +exclude_ci_binary_log=false +restore=false +help=false +properties='' +warnAsError=true + +while (($# > 0)); do + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" + case $lowerI in + --task) + task=$2 + shift 2 + ;; + --restore) + restore=true + shift 1 + ;; + --verbosity) + verbosity=$2 + shift 2 + ;; + --excludecibinarylog|--nobl) + binary_log=false + exclude_ci_binary_log=true + shift 1 + ;; + --noWarnAsError) + warnAsError=false + shift 1 + ;; + --help) + help=true + shift 1 + ;; + *) + properties="$properties $1" + shift 1 + ;; + esac +done + +ci=true + +if $help; then + show_usage + exit 0 +fi + +. "$scriptroot/tools.sh" +InitializeToolset + +if [[ -z "$task" ]]; then + Write-PipelineTelemetryError -Category 'Task' -Name 'MissingTask' -Message "Missing required parameter '-task '" + ExitWithExitCode 1 +fi + +taskProject=$(GetSdkTaskProject "$task") +if [[ ! -e "$taskProject" ]]; then + Write-PipelineTelemetryError -Category 'Task' -Name 'UnknownTask' -Message "Unknown task: $task" + ExitWithExitCode 1 +fi + +if $restore; then + Build "Restore" +fi + +Build "Execute" + + +ExitWithExitCode 0 diff --git a/eng/common/sdl/NuGet.config b/eng/common/sdl/NuGet.config new file mode 100644 index 0000000000000..3849bdb3cf51e --- /dev/null +++ b/eng/common/sdl/NuGet.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/eng/common/sdl/configure-sdl-tool.ps1 b/eng/common/sdl/configure-sdl-tool.ps1 new file mode 100644 index 0000000000000..27f5a4115fc74 --- /dev/null +++ b/eng/common/sdl/configure-sdl-tool.ps1 @@ -0,0 +1,130 @@ +Param( + [string] $GuardianCliLocation, + [string] $WorkingDirectory, + [string] $TargetDirectory, + [string] $GdnFolder, + # The list of Guardian tools to configure. For each object in the array: + # - If the item is a [hashtable], it must contain these entries: + # - Name = The tool name as Guardian knows it. + # - Scenario = (Optional) Scenario-specific name for this configuration entry. It must be unique + # among all tool entries with the same Name. + # - Args = (Optional) Array of Guardian tool configuration args, like '@("Target > C:\temp")' + # - If the item is a [string] $v, it is treated as '@{ Name="$v" }' + [object[]] $ToolsList, + [string] $GuardianLoggerLevel='Standard', + # Optional: Additional params to add to any tool using CredScan. + [string[]] $CrScanAdditionalRunConfigParams, + # Optional: Additional params to add to any tool using PoliCheck. + [string[]] $PoliCheckAdditionalRunConfigParams, + # Optional: Additional params to add to any tool using CodeQL/Semmle. + [string[]] $CodeQLAdditionalRunConfigParams, + # Optional: Additional params to add to any tool using Binskim. + [string[]] $BinskimAdditionalRunConfigParams +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 +$disableConfigureToolsetImport = $true +$global:LASTEXITCODE = 0 + +try { + # `tools.ps1` checks $ci to perform some actions. Since the SDL + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + . $PSScriptRoot\..\tools.ps1 + + # Normalize tools list: all in [hashtable] form with defined values for each key. + $ToolsList = $ToolsList | + ForEach-Object { + if ($_ -is [string]) { + $_ = @{ Name = $_ } + } + + if (-not ($_['Scenario'])) { $_.Scenario = "" } + if (-not ($_['Args'])) { $_.Args = @() } + $_ + } + + Write-Host "List of tools to configure:" + $ToolsList | ForEach-Object { $_ | Out-String | Write-Host } + + # We store config files in the r directory of .gdn + $gdnConfigPath = Join-Path $GdnFolder 'r' + $ValidPath = Test-Path $GuardianCliLocation + + if ($ValidPath -eq $False) + { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Invalid Guardian CLI Location." + ExitWithExitCode 1 + } + + foreach ($tool in $ToolsList) { + # Put together the name and scenario to make a unique key. + $toolConfigName = $tool.Name + if ($tool.Scenario) { + $toolConfigName += "_" + $tool.Scenario + } + + Write-Host "=== Configuring $toolConfigName..." + + $gdnConfigFile = Join-Path $gdnConfigPath "$toolConfigName-configure.gdnconfig" + + # For some tools, add default and automatic args. + switch -Exact ($tool.Name) { + 'credscan' { + if ($targetDirectory) { + $tool.Args += "`"TargetDirectory < $TargetDirectory`"" + } + $tool.Args += "`"OutputType < pre`"" + $tool.Args += $CrScanAdditionalRunConfigParams + } + 'policheck' { + if ($targetDirectory) { + $tool.Args += "`"Target < $TargetDirectory`"" + } + $tool.Args += $PoliCheckAdditionalRunConfigParams + } + {$_ -in 'semmle', 'codeql'} { + if ($targetDirectory) { + $tool.Args += "`"SourceCodeDirectory < $TargetDirectory`"" + } + $tool.Args += $CodeQLAdditionalRunConfigParams + } + 'binskim' { + if ($targetDirectory) { + # Binskim crashes due to specific PDBs. GitHub issue: https://github.com/microsoft/binskim/issues/924. + # We are excluding all `_.pdb` files from the scan. + $tool.Args += "`"Target < $TargetDirectory\**;-:file|$TargetDirectory\**\_.pdb`"" + } + $tool.Args += $BinskimAdditionalRunConfigParams + } + } + + # Create variable pointing to the args array directly so we can use splat syntax later. + $toolArgs = $tool.Args + + # Configure the tool. If args array is provided or the current tool has some default arguments + # defined, add "--args" and splat each element on the end. Arg format is "{Arg id} < {Value}", + # one per parameter. Doc page for "guardian configure": + # https://dev.azure.com/securitytools/SecurityIntegration/_wiki/wikis/Guardian/1395/configure + Exec-BlockVerbosely { + & $GuardianCliLocation configure ` + --working-directory $WorkingDirectory ` + --tool $tool.Name ` + --output-path $gdnConfigFile ` + --logger-level $GuardianLoggerLevel ` + --noninteractive ` + --force ` + $(if ($toolArgs) { "--args" }) @toolArgs + Exit-IfNZEC "Sdl" + } + + Write-Host "Created '$toolConfigName' configuration file: $gdnConfigFile" + } +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 new file mode 100644 index 0000000000000..4715d75e974d3 --- /dev/null +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -0,0 +1,167 @@ +Param( + [string] $GuardianPackageName, # Required: the name of guardian CLI package (not needed if GuardianCliLocation is specified) + [string] $NugetPackageDirectory, # Required: directory where NuGet packages are installed (not needed if GuardianCliLocation is specified) + [string] $GuardianCliLocation, # Optional: Direct location of Guardian CLI executable if GuardianPackageName & NugetPackageDirectory are not specified + [string] $Repository=$env:BUILD_REPOSITORY_NAME, # Required: the name of the repository (e.g. dotnet/arcade) + [string] $BranchName=$env:BUILD_SOURCEBRANCH, # Optional: name of branch or version of gdn settings; defaults to master + [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, # Required: the directory where source files are located + [string] $ArtifactsDirectory = (Join-Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY ('artifacts')), # Required: the directory where build artifacts are located + [string] $AzureDevOpsAccessToken, # Required: access token for dnceng; should be provided via KeyVault + + # Optional: list of SDL tools to run on source code. See 'configure-sdl-tool.ps1' for tools list + # format. + [object[]] $SourceToolsList, + # Optional: list of SDL tools to run on built artifacts. See 'configure-sdl-tool.ps1' for tools + # list format. + [object[]] $ArtifactToolsList, + # Optional: list of SDL tools to run without automatically specifying a target directory. See + # 'configure-sdl-tool.ps1' for tools list format. + [object[]] $CustomToolsList, + + [bool] $TsaPublish=$False, # Optional: true will publish results to TSA; only set to true after onboarding to TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaBranchName=$env:BUILD_SOURCEBRANCH, # Optional: required for TSA publish; defaults to $(Build.SourceBranchName); TSA is the automated framework used to upload test results as bugs. + [string] $TsaRepositoryName=$env:BUILD_REPOSITORY_NAME, # Optional: TSA repository name; will be generated automatically if not submitted; TSA is the automated framework used to upload test results as bugs. + [string] $BuildNumber=$env:BUILD_BUILDNUMBER, # Optional: required for TSA publish; defaults to $(Build.BuildNumber) + [bool] $UpdateBaseline=$False, # Optional: if true, will update the baseline in the repository; should only be run after fixing any issues which need to be fixed + [bool] $TsaOnboard=$False, # Optional: if true, will onboard the repository to TSA; should only be run once; TSA is the automated framework used to upload test results as bugs. + [string] $TsaInstanceUrl, # Optional: only needed if TsaOnboard or TsaPublish is true; the instance-url registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaCodebaseName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the codebase registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaProjectName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the project registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaNotificationEmail, # Optional: only needed if TsaOnboard is true; the email(s) which will receive notifications of TSA bug filings (e.g. alias@microsoft.com); TSA is the automated framework used to upload test results as bugs. + [string] $TsaCodebaseAdmin, # Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs. + [string] $TsaBugAreaPath, # Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. + [string] $TsaIterationPath, # Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. + [string] $GuardianLoggerLevel='Standard', # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error + [string[]] $CrScanAdditionalRunConfigParams, # Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1") + [string[]] $PoliCheckAdditionalRunConfigParams, # Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1") + [string[]] $CodeQLAdditionalRunConfigParams, # Optional: Additional Params to custom build a Semmle/CodeQL run config in the format @("xyz < abc","sdf < 1") + [string[]] $BinskimAdditionalRunConfigParams, # Optional: Additional Params to custom build a Binskim run config in the format @("xyz < abc","sdf < 1") + [bool] $BreakOnFailure=$False # Optional: Fail the build if there were errors during the run +) + +try { + $ErrorActionPreference = 'Stop' + Set-StrictMode -Version 2.0 + $disableConfigureToolsetImport = $true + $global:LASTEXITCODE = 0 + + # `tools.ps1` checks $ci to perform some actions. Since the SDL + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + . $PSScriptRoot\..\tools.ps1 + + #Replace repo names to the format of org/repo + if (!($Repository.contains('/'))) { + $RepoName = $Repository -replace '(.*?)-(.*)', '$1/$2'; + } + else{ + $RepoName = $Repository; + } + + if ($GuardianPackageName) { + $guardianCliLocation = Join-Path $NugetPackageDirectory (Join-Path $GuardianPackageName (Join-Path 'tools' 'guardian.cmd')) + } else { + $guardianCliLocation = $GuardianCliLocation + } + + $workingDirectory = (Split-Path $SourceDirectory -Parent) + $ValidPath = Test-Path $guardianCliLocation + + if ($ValidPath -eq $False) + { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message 'Invalid Guardian CLI Location.' + ExitWithExitCode 1 + } + + Exec-BlockVerbosely { + & $(Join-Path $PSScriptRoot 'init-sdl.ps1') -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $workingDirectory -AzureDevOpsAccessToken $AzureDevOpsAccessToken -GuardianLoggerLevel $GuardianLoggerLevel + } + $gdnFolder = Join-Path $workingDirectory '.gdn' + + if ($TsaOnboard) { + if ($TsaCodebaseName -and $TsaNotificationEmail -and $TsaCodebaseAdmin -and $TsaBugAreaPath) { + Exec-BlockVerbosely { + & $guardianCliLocation tsa-onboard --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $workingDirectory --logger-level $GuardianLoggerLevel + } + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian tsa-onboard failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + } else { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message 'Could not onboard to TSA -- not all required values ($TsaCodebaseName, $TsaNotificationEmail, $TsaCodebaseAdmin, $TsaBugAreaPath) were specified.' + ExitWithExitCode 1 + } + } + + # Configure a list of tools with a default target directory. Populates the ".gdn/r" directory. + function Configure-ToolsList([object[]] $tools, [string] $targetDirectory) { + if ($tools -and $tools.Count -gt 0) { + Exec-BlockVerbosely { + & $(Join-Path $PSScriptRoot 'configure-sdl-tool.ps1') ` + -GuardianCliLocation $guardianCliLocation ` + -WorkingDirectory $workingDirectory ` + -TargetDirectory $targetDirectory ` + -GdnFolder $gdnFolder ` + -ToolsList $tools ` + -AzureDevOpsAccessToken $AzureDevOpsAccessToken ` + -GuardianLoggerLevel $GuardianLoggerLevel ` + -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams ` + -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams ` + -CodeQLAdditionalRunConfigParams $CodeQLAdditionalRunConfigParams ` + -BinskimAdditionalRunConfigParams $BinskimAdditionalRunConfigParams + if ($BreakOnFailure) { + Exit-IfNZEC "Sdl" + } + } + } + } + + # Configure Artifact and Source tools with default Target directories. + Configure-ToolsList $ArtifactToolsList $ArtifactsDirectory + Configure-ToolsList $SourceToolsList $SourceDirectory + # Configure custom tools with no default Target directory. + Configure-ToolsList $CustomToolsList $null + + # At this point, all tools are configured in the ".gdn" directory. Run them all in a single call. + # (If we used "run" multiple times, each run would overwrite data from earlier runs.) + Exec-BlockVerbosely { + & $(Join-Path $PSScriptRoot 'run-sdl.ps1') ` + -GuardianCliLocation $guardianCliLocation ` + -WorkingDirectory $SourceDirectory ` + -UpdateBaseline $UpdateBaseline ` + -GdnFolder $gdnFolder + } + + if ($TsaPublish) { + if ($TsaBranchName -and $BuildNumber) { + if (-not $TsaRepositoryName) { + $TsaRepositoryName = "$($Repository)-$($BranchName)" + } + Exec-BlockVerbosely { + & $guardianCliLocation tsa-publish --all-tools --repository-name "$TsaRepositoryName" --branch-name "$TsaBranchName" --build-number "$BuildNumber" --onboard $True --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $workingDirectory --logger-level $GuardianLoggerLevel + } + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian tsa-publish failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + } else { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message 'Could not publish to TSA -- not all required values ($TsaBranchName, $BuildNumber) were specified.' + ExitWithExitCode 1 + } + } + + if ($BreakOnFailure) { + Write-Host "Failing the build in case of breaking results..." + Exec-BlockVerbosely { + & $guardianCliLocation break --working-directory $workingDirectory --logger-level $GuardianLoggerLevel + } + } else { + Write-Host "Letting the build pass even if there were breaking results..." + } +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + exit 1 +} diff --git a/eng/common/sdl/extract-artifact-archives.ps1 b/eng/common/sdl/extract-artifact-archives.ps1 new file mode 100644 index 0000000000000..68da4fbf25717 --- /dev/null +++ b/eng/common/sdl/extract-artifact-archives.ps1 @@ -0,0 +1,63 @@ +# This script looks for each archive file in a directory and extracts it into the target directory. +# For example, the file "$InputPath/bin.tar.gz" extracts to "$ExtractPath/bin.tar.gz.extracted/**". +# Uses the "tar" utility added to Windows 10 / Windows 2019 that supports tar.gz and zip. +param( + # Full path to directory where archives are stored. + [Parameter(Mandatory=$true)][string] $InputPath, + # Full path to directory to extract archives into. May be the same as $InputPath. + [Parameter(Mandatory=$true)][string] $ExtractPath +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +$disableConfigureToolsetImport = $true + +try { + # `tools.ps1` checks $ci to perform some actions. Since the SDL + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + . $PSScriptRoot\..\tools.ps1 + + Measure-Command { + $jobs = @() + + # Find archive files for non-Windows and Windows builds. + $archiveFiles = @( + Get-ChildItem (Join-Path $InputPath "*.tar.gz") + Get-ChildItem (Join-Path $InputPath "*.zip") + ) + + foreach ($targzFile in $archiveFiles) { + $jobs += Start-Job -ScriptBlock { + $file = $using:targzFile + $fileName = [System.IO.Path]::GetFileName($file) + $extractDir = Join-Path $using:ExtractPath "$fileName.extracted" + + New-Item $extractDir -ItemType Directory -Force | Out-Null + + Write-Host "Extracting '$file' to '$extractDir'..." + + # Pipe errors to stdout to prevent PowerShell detecting them and quitting the job early. + # This type of quit skips the catch, so we wouldn't be able to tell which file triggered the + # error. Save output so it can be stored in the exception string along with context. + $output = tar -xf $file -C $extractDir 2>&1 + # Handle NZEC manually rather than using Exit-IfNZEC: we are in a background job, so we + # don't have access to the outer scope. + if ($LASTEXITCODE -ne 0) { + throw "Error extracting '$file': non-zero exit code ($LASTEXITCODE). Output: '$output'" + } + + Write-Host "Extracted to $extractDir" + } + } + + Receive-Job $jobs -Wait + } +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/sdl/extract-artifact-packages.ps1 b/eng/common/sdl/extract-artifact-packages.ps1 new file mode 100644 index 0000000000000..f031ed5b25e9f --- /dev/null +++ b/eng/common/sdl/extract-artifact-packages.ps1 @@ -0,0 +1,82 @@ +param( + [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where artifact packages are stored + [Parameter(Mandatory=$true)][string] $ExtractPath # Full path to directory where the packages will be extracted +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +$disableConfigureToolsetImport = $true + +function ExtractArtifacts { + if (!(Test-Path $InputPath)) { + Write-Host "Input Path does not exist: $InputPath" + ExitWithExitCode 0 + } + $Jobs = @() + Get-ChildItem "$InputPath\*.nupkg" | + ForEach-Object { + $Jobs += Start-Job -ScriptBlock $ExtractPackage -ArgumentList $_.FullName + } + + foreach ($Job in $Jobs) { + Wait-Job -Id $Job.Id | Receive-Job + } +} + +try { + # `tools.ps1` checks $ci to perform some actions. Since the SDL + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + . $PSScriptRoot\..\tools.ps1 + + $ExtractPackage = { + param( + [string] $PackagePath # Full path to a NuGet package + ) + + if (!(Test-Path $PackagePath)) { + Write-PipelineTelemetryError -Category 'Build' -Message "Input file does not exist: $PackagePath" + ExitWithExitCode 1 + } + + $RelevantExtensions = @('.dll', '.exe', '.pdb') + Write-Host -NoNewLine 'Extracting ' ([System.IO.Path]::GetFileName($PackagePath)) '...' + + $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) + $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId + + Add-Type -AssemblyName System.IO.Compression.FileSystem + + [System.IO.Directory]::CreateDirectory($ExtractPath); + + try { + $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) + + $zip.Entries | + Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | + ForEach-Object { + $TargetPath = Join-Path -Path $ExtractPath -ChildPath (Split-Path -Path $_.FullName) + [System.IO.Directory]::CreateDirectory($TargetPath); + + $TargetFile = Join-Path -Path $ExtractPath -ChildPath $_.FullName + [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile) + } + } + catch { + Write-Host $_ + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 + } + finally { + $zip.Dispose() + } + } + Measure-Command { ExtractArtifacts } +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1 new file mode 100644 index 0000000000000..3ac1d92b37006 --- /dev/null +++ b/eng/common/sdl/init-sdl.ps1 @@ -0,0 +1,55 @@ +Param( + [string] $GuardianCliLocation, + [string] $Repository, + [string] $BranchName='master', + [string] $WorkingDirectory, + [string] $AzureDevOpsAccessToken, + [string] $GuardianLoggerLevel='Standard' +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 +$disableConfigureToolsetImport = $true +$global:LASTEXITCODE = 0 + +# `tools.ps1` checks $ci to perform some actions. Since the SDL +# scripts don't necessarily execute in the same agent that run the +# build.ps1/sh script this variable isn't automatically set. +$ci = $true +. $PSScriptRoot\..\tools.ps1 + +# Don't display the console progress UI - it's a huge perf hit +$ProgressPreference = 'SilentlyContinue' + +# Construct basic auth from AzDO access token; construct URI to the repository's gdn folder stored in that repository; construct location of zip file +$encodedPat = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$AzureDevOpsAccessToken")) +$escapedRepository = [Uri]::EscapeDataString("/$Repository/$BranchName/.gdn") +$uri = "https://dev.azure.com/dnceng/internal/_apis/git/repositories/sdl-tool-cfg/Items?path=$escapedRepository&versionDescriptor[versionOptions]=0&`$format=zip&api-version=5.0" +$zipFile = "$WorkingDirectory/gdn.zip" + +Add-Type -AssemblyName System.IO.Compression.FileSystem +$gdnFolder = (Join-Path $WorkingDirectory '.gdn') + +try { + # if the folder does not exist, we'll do a guardian init and push it to the remote repository + Write-Host 'Initializing Guardian...' + Write-Host "$GuardianCliLocation init --working-directory $WorkingDirectory --logger-level $GuardianLoggerLevel" + & $GuardianCliLocation init --working-directory $WorkingDirectory --logger-level $GuardianLoggerLevel + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Build' -Message "Guardian init failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + # We create the mainbaseline so it can be edited later + Write-Host "$GuardianCliLocation baseline --working-directory $WorkingDirectory --name mainbaseline" + & $GuardianCliLocation baseline --working-directory $WorkingDirectory --name mainbaseline + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Build' -Message "Guardian baseline failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + ExitWithExitCode 0 +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config new file mode 100644 index 0000000000000..e5f543ea68c27 --- /dev/null +++ b/eng/common/sdl/packages.config @@ -0,0 +1,4 @@ + + + + diff --git a/eng/common/sdl/run-sdl.ps1 b/eng/common/sdl/run-sdl.ps1 new file mode 100644 index 0000000000000..2eac8c78f103d --- /dev/null +++ b/eng/common/sdl/run-sdl.ps1 @@ -0,0 +1,49 @@ +Param( + [string] $GuardianCliLocation, + [string] $WorkingDirectory, + [string] $GdnFolder, + [string] $UpdateBaseline, + [string] $GuardianLoggerLevel='Standard' +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 +$disableConfigureToolsetImport = $true +$global:LASTEXITCODE = 0 + +try { + # `tools.ps1` checks $ci to perform some actions. Since the SDL + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + . $PSScriptRoot\..\tools.ps1 + + # We store config files in the r directory of .gdn + $gdnConfigPath = Join-Path $GdnFolder 'r' + $ValidPath = Test-Path $GuardianCliLocation + + if ($ValidPath -eq $False) + { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Invalid Guardian CLI Location." + ExitWithExitCode 1 + } + + $gdnConfigFiles = Get-ChildItem $gdnConfigPath -Recurse -Include '*.gdnconfig' + Write-Host "Discovered Guardian config files:" + $gdnConfigFiles | Out-String | Write-Host + + Exec-BlockVerbosely { + & $GuardianCliLocation run ` + --working-directory $WorkingDirectory ` + --baseline mainbaseline ` + --update-baseline $UpdateBaseline ` + --logger-level $GuardianLoggerLevel ` + --config @gdnConfigFiles + Exit-IfNZEC "Sdl" + } +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/sdl/sdl.ps1 b/eng/common/sdl/sdl.ps1 new file mode 100644 index 0000000000000..648c5068d7d60 --- /dev/null +++ b/eng/common/sdl/sdl.ps1 @@ -0,0 +1,38 @@ + +function Install-Gdn { + param( + [Parameter(Mandatory=$true)] + [string]$Path, + + # If omitted, install the latest version of Guardian, otherwise install that specific version. + [string]$Version + ) + + $ErrorActionPreference = 'Stop' + Set-StrictMode -Version 2.0 + $disableConfigureToolsetImport = $true + $global:LASTEXITCODE = 0 + + # `tools.ps1` checks $ci to perform some actions. Since the SDL + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + . $PSScriptRoot\..\tools.ps1 + + $argumentList = @("install", "Microsoft.Guardian.Cli", "-Source https://securitytools.pkgs.visualstudio.com/_packaging/Guardian/nuget/v3/index.json", "-OutputDirectory $Path", "-NonInteractive", "-NoCache") + + if ($Version) { + $argumentList += "-Version $Version" + } + + Start-Process nuget -Verbose -ArgumentList $argumentList -NoNewWindow -Wait + + $gdnCliPath = Get-ChildItem -Filter guardian.cmd -Recurse -Path $Path + + if (!$gdnCliPath) + { + Write-PipelineTelemetryError -Category 'Sdl' -Message 'Failure installing Guardian' + } + + return $gdnCliPath.FullName +} \ No newline at end of file diff --git a/eng/common/sdl/trim-assets-version.ps1 b/eng/common/sdl/trim-assets-version.ps1 new file mode 100644 index 0000000000000..0daa2a9e94628 --- /dev/null +++ b/eng/common/sdl/trim-assets-version.ps1 @@ -0,0 +1,75 @@ +<# +.SYNOPSIS +Install and run the 'Microsoft.DotNet.VersionTools.Cli' tool with the 'trim-artifacts-version' command to trim the version from the NuGet assets file name. + +.PARAMETER InputPath +Full path to directory where artifact packages are stored + +.PARAMETER Recursive +Search for NuGet packages recursively + +#> + +Param( + [string] $InputPath, + [bool] $Recursive = $true +) + +$CliToolName = "Microsoft.DotNet.VersionTools.Cli" + +function Install-VersionTools-Cli { + param( + [Parameter(Mandatory=$true)][string]$Version + ) + + Write-Host "Installing the package '$CliToolName' with a version of '$version' ..." + $feed = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" + + $argumentList = @("tool", "install", "--local", "$CliToolName", "--add-source $feed", "--no-cache", "--version $Version", "--create-manifest-if-needed") + Start-Process "$dotnet" -Verbose -ArgumentList $argumentList -NoNewWindow -Wait +} + +# ------------------------------------------------------------------- + +if (!(Test-Path $InputPath)) { + Write-Host "Input Path '$InputPath' does not exist" + ExitWithExitCode 1 +} + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +$disableConfigureToolsetImport = $true +$global:LASTEXITCODE = 0 + +# `tools.ps1` checks $ci to perform some actions. Since the SDL +# scripts don't necessarily execute in the same agent that run the +# build.ps1/sh script this variable isn't automatically set. +$ci = $true +. $PSScriptRoot\..\tools.ps1 + +try { + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + + $toolsetVersion = Read-ArcadeSdkVersion + Install-VersionTools-Cli -Version $toolsetVersion + + $cliToolFound = (& "$dotnet" tool list --local | Where-Object {$_.Split(' ')[0] -eq $CliToolName}) + if ($null -eq $cliToolFound) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "The '$CliToolName' tool is not installed." + ExitWithExitCode 1 + } + + Exec-BlockVerbosely { + & "$dotnet" $CliToolName trim-assets-version ` + --assets-path $InputPath ` + --recursive $Recursive + Exit-IfNZEC "Sdl" + } +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/template-guidance.md b/eng/common/template-guidance.md new file mode 100644 index 0000000000000..4bf4cf41bd7c7 --- /dev/null +++ b/eng/common/template-guidance.md @@ -0,0 +1,133 @@ +# Overview + +Arcade provides templates for public (`/templates`) and 1ES pipeline templates (`/templates-official`) scenarios. Pipelines which are required to be managed by 1ES pipeline templates should reference `/templates-offical`, all other pipelines may reference `/templates`. + +## How to use + +Basic guidance is: + +- 1ES Pipeline Template or 1ES Microbuild template runs should reference `eng/common/templates-official`. Any internal production-graded pipeline should use these templates. + +- All other runs should reference `eng/common/templates`. + +See [azure-pipelines.yml](../../azure-pipelines.yml) (templates-official example) or [azure-pipelines-pr.yml](../../azure-pipelines-pr.yml) (templates example) for examples. + +#### The `templateIs1ESManaged` parameter + +The `templateIs1ESManaged` is available on most templates and affects which of the variants is used for nested templates. See [Development Notes](#development-notes) below for more information on the `templateIs1ESManaged1 parameter. + +- For templates under `job/`, `jobs/`, `steps`, or `post-build/`, this parameter must be explicitly set. + +## Multiple outputs + +1ES pipeline templates impose a policy where every publish artifact execution results in additional security scans being injected into your pipeline. When using `templates-official/jobs/jobs.yml`, Arcade reduces the number of additional security injections by gathering all publishing outputs into the [Build.ArtifactStagingDirectory](https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#build-variables-devops-services), and utilizing the [outputParentDirectory](https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/outputs#multiple-outputs) feature of 1ES pipeline templates. When implementing your pipeline, if you ensure publish artifacts are located in the `$(Build.ArtifactStagingDirectory)`, and utilize the 1ES provided template context, then you can reduce the number of security scans for your pipeline. + +Example: +``` yaml +# azure-pipelines.yml +extends: + template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate + parameters: + stages: + - stage: build + jobs: + - template: /eng/common/templates-official/jobs/jobs.yml@self + parameters: + # 1ES makes use of outputs to reduce security task injection overhead + templateContext: + outputs: + - output: pipelineArtifact + displayName: 'Publish logs from source' + continueOnError: true + condition: always() + targetPath: $(Build.ArtifactStagingDirectory)/artifacts/log + artifactName: Logs + jobs: + - job: Windows + steps: + - script: echo "friendly neighborhood" > artifacts/marvel/spiderman.txt + # copy build outputs to artifact staging directory for publishing + - task: CopyFiles@2 + displayName: Gather build output + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)/artifacts/marvel' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/marvel' +``` + +Note: Multiple outputs are ONLY applicable to 1ES PT publishing (only usable when referencing `templates-official`). + +## Development notes + +**Folder / file structure** + +``` text +eng\common\ + [templates || templates-official]\ + job\ + job.yml (shim + artifact publishing logic) + onelocbuild.yml (shim) + publish-build-assets.yml (shim) + source-build.yml (shim) + source-index-stage1.yml (shim) + jobs\ + codeql-build.yml (shim) + jobs.yml (shim) + source-build.yml (shim) + post-build\ + post-build.yml (shim) + common-variabls.yml (shim) + setup-maestro-vars.yml (shim) + steps\ + publish-build-artifacts.yml (logic) + publish-pipeline-artifacts.yml (logic) + component-governance.yml (shim) + generate-sbom.yml (shim) + publish-logs.yml (shim) + retain-build.yml (shim) + send-to-helix.yml (shim) + source-build.yml (shim) + variables\ + pool-providers.yml (logic + redirect) # templates/variables/pool-providers.yml will redirect to templates-official/variables/pool-providers.yml if you are running in the internal project + sdl-variables.yml (logic) + core-templates\ + job\ + job.yml (logic) + onelocbuild.yml (logic) + publish-build-assets.yml (logic) + source-build.yml (logic) + source-index-stage1.yml (logic) + jobs\ + codeql-build.yml (logic) + jobs.yml (logic) + source-build.yml (logic) + post-build\ + common-variabls.yml (logic) + post-build.yml (logic) + setup-maestro-vars.yml (logic) + steps\ + component-governance.yml (logic) + generate-sbom.yml (logic) + publish-build-artifacts.yml (redirect) + publish-logs.yml (logic) + publish-pipeline-artifacts.yml (redirect) + retain-build.yml (logic) + send-to-helix.yml (logic) + source-build.yml (logic) + variables\ + pool-providers.yml (redirect) +``` + +In the table above, a file is designated as "shim", "logic", or "redirect". + +- shim - represents a yaml file which is an intermediate step between pipeline logic and .Net Core Engineering's templates (`core-templates`) and defines the `is1ESPipeline` parameter value. + +- logic - represents actual base template logic. + +- redirect- represents a file in `core-templates` which redirects to the "logic" file in either `templates` or `templates-official`. + +Logic for Arcade's templates live **primarily** in the `core-templates` folder. The exceptions to the location of the logic files are around artifact publishing, which is handled differently between 1es pipeline templates and standard templates. `templates` and `templates-official` provide shim entry points which redirect to `core-templates` while also defining the `is1ESPipeline` parameter. If a shim is referenced in `templates`, then `is1ESPipeline` is set to `false`. If a shim is referenced in `templates-official`, then `is1ESPipeline` is set to `true`. + +Within `templates` and `templates-official`, the templates at the "stages", and "jobs" / "job" level have been replaced with shims. Templates at the "steps" and "variables" level are typically too granular to be replaced with shims and instead persist logic which is directly applicable to either scenario. + +Within `core-templates`, there are a handful of places where logic is dependent on which shim entry point was used. In those places, we redirect back to the respective logic file in `templates` or `templates-official`. diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml new file mode 100644 index 0000000000000..92a0664f5647d --- /dev/null +++ b/eng/common/templates-official/job/job.yml @@ -0,0 +1,83 @@ +parameters: +# Sbom related params + enableSbom: true + runAsPublic: false + PackageVersion: 9.0.0 + BuildDropPath: '$(System.DefaultWorkingDirectory)/artifacts' + +jobs: +- template: /eng/common/core-templates/job/job.yml + parameters: + is1ESPipeline: true + + componentGovernanceSteps: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - template: /eng/common/templates/steps/generate-sbom.yml + parameters: + PackageVersion: ${{ parameters.packageVersion }} + BuildDropPath: ${{ parameters.buildDropPath }} + ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom + publishArtifacts: false + + # publish artifacts + # for 1ES managed templates, use the templateContext.output to handle multiple outputs. + templateContext: + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: + - output: buildArtifacts + displayName: Publish pipeline artifacts + PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts' + ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} + condition: always() + retryCountOnTaskFailure: 10 # for any logs being locked + continueOnError: true + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: + - output: pipelineArtifact + targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' + artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)_Attempt$(System.JobAttempt)') }} + displayName: 'Publish logs' + continueOnError: true + condition: always() + retryCountOnTaskFailure: 10 # for any logs being locked + sbomEnabled: false # we don't need SBOM for logs + + - ${{ if eq(parameters.enablePublishBuildArtifacts, true) }}: + - output: buildArtifacts + displayName: Publish Logs + PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + publishLocation: Container + ArtifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)_Attempt$(System.JobAttempt)' ) }} + continueOnError: true + condition: always() + sbomEnabled: false # we don't need SBOM for logs + + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - output: pipelineArtifact + targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/eng/common/BuildConfiguration' + artifactName: 'BuildConfiguration' + displayName: 'Publish build retry configuration' + continueOnError: true + sbomEnabled: false # we don't need SBOM for BuildConfiguration + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - output: pipelineArtifact + displayName: Publish SBOM manifest + continueOnError: true + targetPath: $(Build.ArtifactStagingDirectory)/sbom + artifactName: $(ARTIFACT_NAME) + + # add any outputs provided via root yaml + - ${{ if ne(parameters.templateContext.outputs, '') }}: + - ${{ each output in parameters.templateContext.outputs }}: + - ${{ output }} + + # add any remaining templateContext properties + ${{ each context in parameters.templateContext }}: + ${{ if and(ne(context.key, 'outputParentDirectory'), ne(context.key, 'outputs')) }}: + ${{ context.key }}: ${{ context.value }} + + ${{ each parameter in parameters }}: + ${{ if and(ne(parameter.key, 'templateContext'), ne(parameter.key, 'is1ESPipeline')) }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/job/onelocbuild.yml b/eng/common/templates-official/job/onelocbuild.yml new file mode 100644 index 0000000000000..0f0c514b912df --- /dev/null +++ b/eng/common/templates-official/job/onelocbuild.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/onelocbuild.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/job/publish-build-assets.yml b/eng/common/templates-official/job/publish-build-assets.yml new file mode 100644 index 0000000000000..d667a70e8de74 --- /dev/null +++ b/eng/common/templates-official/job/publish-build-assets.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/publish-build-assets.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/job/source-build.yml b/eng/common/templates-official/job/source-build.yml new file mode 100644 index 0000000000000..1a480034b678e --- /dev/null +++ b/eng/common/templates-official/job/source-build.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/source-build.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/job/source-index-stage1.yml b/eng/common/templates-official/job/source-index-stage1.yml new file mode 100644 index 0000000000000..6d5ead316f92b --- /dev/null +++ b/eng/common/templates-official/job/source-index-stage1.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/source-index-stage1.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/jobs/codeql-build.yml b/eng/common/templates-official/jobs/codeql-build.yml new file mode 100644 index 0000000000000..a726322ecfe01 --- /dev/null +++ b/eng/common/templates-official/jobs/codeql-build.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/jobs/codeql-build.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/jobs/jobs.yml b/eng/common/templates-official/jobs/jobs.yml new file mode 100644 index 0000000000000..007deddaea0f5 --- /dev/null +++ b/eng/common/templates-official/jobs/jobs.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/jobs/jobs.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/jobs/source-build.yml b/eng/common/templates-official/jobs/source-build.yml new file mode 100644 index 0000000000000..483e7b611f346 --- /dev/null +++ b/eng/common/templates-official/jobs/source-build.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/jobs/source-build.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/post-build/common-variables.yml b/eng/common/templates-official/post-build/common-variables.yml new file mode 100644 index 0000000000000..c32fc49233f8f --- /dev/null +++ b/eng/common/templates-official/post-build/common-variables.yml @@ -0,0 +1,8 @@ +variables: +- template: /eng/common/core-templates/post-build/common-variables.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/post-build/post-build.yml b/eng/common/templates-official/post-build/post-build.yml new file mode 100644 index 0000000000000..2364c0fd4a527 --- /dev/null +++ b/eng/common/templates-official/post-build/post-build.yml @@ -0,0 +1,8 @@ +stages: +- template: /eng/common/core-templates/post-build/post-build.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/post-build/setup-maestro-vars.yml b/eng/common/templates-official/post-build/setup-maestro-vars.yml new file mode 100644 index 0000000000000..024397d878645 --- /dev/null +++ b/eng/common/templates-official/post-build/setup-maestro-vars.yml @@ -0,0 +1,8 @@ +steps: +- template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/steps/component-governance.yml b/eng/common/templates-official/steps/component-governance.yml new file mode 100644 index 0000000000000..30bb3985ca2bf --- /dev/null +++ b/eng/common/templates-official/steps/component-governance.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/component-governance.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/enable-internal-runtimes.yml b/eng/common/templates-official/steps/enable-internal-runtimes.yml new file mode 100644 index 0000000000000..f9dd238c6cd54 --- /dev/null +++ b/eng/common/templates-official/steps/enable-internal-runtimes.yml @@ -0,0 +1,9 @@ +# Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64' +# variable with the base64-encoded SAS token, by default +steps: +- template: /eng/common/core-templates/steps/enable-internal-runtimes.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/enable-internal-sources.yml b/eng/common/templates-official/steps/enable-internal-sources.yml new file mode 100644 index 0000000000000..e6d57182284df --- /dev/null +++ b/eng/common/templates-official/steps/enable-internal-sources.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/enable-internal-sources.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/steps/generate-sbom.yml b/eng/common/templates-official/steps/generate-sbom.yml new file mode 100644 index 0000000000000..9a89a4706d94e --- /dev/null +++ b/eng/common/templates-official/steps/generate-sbom.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/generate-sbom.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/get-delegation-sas.yml b/eng/common/templates-official/steps/get-delegation-sas.yml new file mode 100644 index 0000000000000..c5a9c1f8275c5 --- /dev/null +++ b/eng/common/templates-official/steps/get-delegation-sas.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/get-delegation-sas.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/get-federated-access-token.yml b/eng/common/templates-official/steps/get-federated-access-token.yml new file mode 100644 index 0000000000000..c8dcf6b813920 --- /dev/null +++ b/eng/common/templates-official/steps/get-federated-access-token.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/get-federated-access-token.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/steps/publish-build-artifacts.yml b/eng/common/templates-official/steps/publish-build-artifacts.yml new file mode 100644 index 0000000000000..fcf6637b2ebcc --- /dev/null +++ b/eng/common/templates-official/steps/publish-build-artifacts.yml @@ -0,0 +1,46 @@ +parameters: +- name: displayName + type: string + default: 'Publish to Build Artifact' + +- name: condition + type: string + default: succeeded() + +- name: artifactName + type: string + +- name: pathToPublish + type: string + +- name: continueOnError + type: boolean + default: false + +- name: publishLocation + type: string + default: 'Container' + +- name: is1ESPipeline + type: boolean + default: true + +- name: retryCountOnTaskFailure + type: string + default: 10 + +steps: +- ${{ if ne(parameters.is1ESPipeline, true) }}: + - 'eng/common/templates-official cannot be referenced from a non-1ES managed template': error +- task: 1ES.PublishBuildArtifacts@1 + displayName: ${{ parameters.displayName }} + condition: ${{ parameters.condition }} + ${{ if parameters.continueOnError }}: + continueOnError: ${{ parameters.continueOnError }} + inputs: + PublishLocation: ${{ parameters.publishLocation }} + PathtoPublish: ${{ parameters.pathToPublish }} + ${{ if parameters.artifactName }}: + ArtifactName: ${{ parameters.artifactName }} + ${{ if parameters.retryCountOnTaskFailure }}: + retryCountOnTaskFailure: ${{ parameters.retryCountOnTaskFailure }} diff --git a/eng/common/templates-official/steps/publish-logs.yml b/eng/common/templates-official/steps/publish-logs.yml new file mode 100644 index 0000000000000..579fd531e94c3 --- /dev/null +++ b/eng/common/templates-official/steps/publish-logs.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/publish-logs.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/publish-pipeline-artifacts.yml b/eng/common/templates-official/steps/publish-pipeline-artifacts.yml new file mode 100644 index 0000000000000..172f9f0fdc970 --- /dev/null +++ b/eng/common/templates-official/steps/publish-pipeline-artifacts.yml @@ -0,0 +1,28 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: true + +- name: args + type: object + default: {} + +steps: +- ${{ if ne(parameters.is1ESPipeline, true) }}: + - 'eng/common/templates-official cannot be referenced from a non-1ES managed template': error +- task: 1ES.PublishPipelineArtifact@1 + displayName: ${{ coalesce(parameters.args.displayName, 'Publish to Build Artifact') }} + ${{ if parameters.args.condition }}: + condition: ${{ parameters.args.condition }} + ${{ else }}: + condition: succeeded() + ${{ if parameters.args.continueOnError }}: + continueOnError: ${{ parameters.args.continueOnError }} + inputs: + targetPath: ${{ parameters.args.targetPath }} + ${{ if parameters.args.artifactName }}: + artifactName: ${{ parameters.args.artifactName }} + ${{ if parameters.args.properties }}: + properties: ${{ parameters.args.properties }} + ${{ if parameters.args.sbomEnabled }}: + sbomEnabled: ${{ parameters.args.sbomEnabled }} diff --git a/eng/common/templates-official/steps/retain-build.yml b/eng/common/templates-official/steps/retain-build.yml new file mode 100644 index 0000000000000..5594551508a3c --- /dev/null +++ b/eng/common/templates-official/steps/retain-build.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/retain-build.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/send-to-helix.yml b/eng/common/templates-official/steps/send-to-helix.yml new file mode 100644 index 0000000000000..6500f21bf845c --- /dev/null +++ b/eng/common/templates-official/steps/send-to-helix.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/send-to-helix.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/source-build.yml b/eng/common/templates-official/steps/source-build.yml new file mode 100644 index 0000000000000..8f92c49e7b06f --- /dev/null +++ b/eng/common/templates-official/steps/source-build.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/source-build.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/source-index-stage1-publish.yml b/eng/common/templates-official/steps/source-index-stage1-publish.yml new file mode 100644 index 0000000000000..9b8b80942b5c3 --- /dev/null +++ b/eng/common/templates-official/steps/source-index-stage1-publish.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/source-index-stage1-publish.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/variables/pool-providers.yml b/eng/common/templates-official/variables/pool-providers.yml new file mode 100644 index 0000000000000..1f308b24efc43 --- /dev/null +++ b/eng/common/templates-official/variables/pool-providers.yml @@ -0,0 +1,45 @@ +# Select a pool provider based off branch name. Anything with branch name containing 'release' must go into an -Svc pool, +# otherwise it should go into the "normal" pools. This separates out the queueing and billing of released branches. + +# Motivation: +# Once a given branch of a repository's output has been officially "shipped" once, it is then considered to be COGS +# (Cost of goods sold) and should be moved to a servicing pool provider. This allows both separation of queueing +# (allowing release builds and main PR builds to not intefere with each other) and billing (required for COGS. +# Additionally, the pool provider name itself may be subject to change when the .NET Core Engineering Services +# team needs to move resources around and create new and potentially differently-named pools. Using this template +# file from an Arcade-ified repo helps guard against both having to update one's release/* branches and renaming. + +# How to use: +# This yaml assumes your shipped product branches use the naming convention "release/..." (which many do). +# If we find alternate naming conventions in broad usage it can be added to the condition below. +# +# First, import the template in an arcade-ified repo to pick up the variables, e.g.: +# +# variables: +# - template: /eng/common/templates-official/variables/pool-providers.yml +# +# ... then anywhere specifying the pool provider use the runtime variables, +# $(DncEngInternalBuildPool) +# +# pool: +# name: $(DncEngInternalBuildPool) +# image: 1es-windows-2022 + +variables: + # Coalesce the target and source branches so we know when a PR targets a release branch + # If these variables are somehow missing, fall back to main (tends to have more capacity) + + # Any new -Svc alternative pools should have variables added here to allow for splitting work + + - name: DncEngInternalBuildPool + value: $[ + replace( + replace( + eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), + True, + 'NetCore1ESPool-Svc-Internal' + ), + False, + 'NetCore1ESPool-Internal' + ) + ] \ No newline at end of file diff --git a/eng/common/templates-official/variables/sdl-variables.yml b/eng/common/templates-official/variables/sdl-variables.yml new file mode 100644 index 0000000000000..f1311bbb1b33d --- /dev/null +++ b/eng/common/templates-official/variables/sdl-variables.yml @@ -0,0 +1,7 @@ +variables: +# The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in +# sync with the packages.config file. +- name: DefaultGuardianVersion + value: 0.109.0 +- name: GuardianPackagesConfigFile + value: $(System.DefaultWorkingDirectory)\eng\common\sdl\packages.config \ No newline at end of file diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml new file mode 100644 index 0000000000000..238fa0818f7b2 --- /dev/null +++ b/eng/common/templates/job/job.yml @@ -0,0 +1,84 @@ +parameters: + enablePublishBuildArtifacts: false + disableComponentGovernance: '' + componentGovernanceIgnoreDirectories: '' +# Sbom related params + enableSbom: true + runAsPublic: false + PackageVersion: 9.0.0 + BuildDropPath: '$(System.DefaultWorkingDirectory)/artifacts' + +jobs: +- template: /eng/common/core-templates/job/job.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ if and(ne(parameter.key, 'steps'), ne(parameter.key, 'is1ESPipeline')) }}: + ${{ parameter.key }}: ${{ parameter.value }} + + steps: + - ${{ each step in parameters.steps }}: + - ${{ step }} + + componentGovernanceSteps: + - template: /eng/common/templates/steps/component-governance.yml + parameters: + ${{ if eq(parameters.disableComponentGovernance, '') }}: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: + disableComponentGovernance: false + ${{ else }}: + disableComponentGovernance: true + ${{ else }}: + disableComponentGovernance: ${{ parameters.disableComponentGovernance }} + componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} + + artifactPublishSteps: + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: false + args: + displayName: Publish pipeline artifacts + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts' + publishLocation: Container + artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} + continueOnError: true + condition: always() + retryCountOnTaskFailure: 10 # for any logs being locked + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: false + args: + targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' + artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} + displayName: 'Publish logs' + continueOnError: true + condition: always() + retryCountOnTaskFailure: 10 # for any logs being locked + sbomEnabled: false # we don't need SBOM for logs + + - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: false + args: + displayName: Publish Logs + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + publishLocation: Container + artifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)_Attempt$(System.JobAttempt)' ) }} + continueOnError: true + condition: always() + + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: false + args: + targetPath: '$(System.DefaultWorkingDirectory)\eng\common\BuildConfiguration' + artifactName: 'BuildConfiguration' + displayName: 'Publish build retry configuration' + continueOnError: true + sbomEnabled: false # we don't need SBOM for BuildConfiguration diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml new file mode 100644 index 0000000000000..ff829dc4c700c --- /dev/null +++ b/eng/common/templates/job/onelocbuild.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/onelocbuild.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml new file mode 100644 index 0000000000000..ab2edec2adb54 --- /dev/null +++ b/eng/common/templates/job/publish-build-assets.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/publish-build-assets.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/job/source-build.yml b/eng/common/templates/job/source-build.yml new file mode 100644 index 0000000000000..e44d47b1d760c --- /dev/null +++ b/eng/common/templates/job/source-build.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/source-build.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml new file mode 100644 index 0000000000000..89f3291593cb7 --- /dev/null +++ b/eng/common/templates/job/source-index-stage1.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/source-index-stage1.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/jobs/codeql-build.yml b/eng/common/templates/jobs/codeql-build.yml new file mode 100644 index 0000000000000..517f24d6a52ce --- /dev/null +++ b/eng/common/templates/jobs/codeql-build.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/jobs/codeql-build.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml new file mode 100644 index 0000000000000..388e9037b3e60 --- /dev/null +++ b/eng/common/templates/jobs/jobs.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/jobs/jobs.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/jobs/source-build.yml b/eng/common/templates/jobs/source-build.yml new file mode 100644 index 0000000000000..818d4c326dbbf --- /dev/null +++ b/eng/common/templates/jobs/source-build.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/jobs/source-build.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml new file mode 100644 index 0000000000000..7fa105875592c --- /dev/null +++ b/eng/common/templates/post-build/common-variables.yml @@ -0,0 +1,8 @@ +variables: +- template: /eng/common/core-templates/post-build/common-variables.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml new file mode 100644 index 0000000000000..53ede714bdd20 --- /dev/null +++ b/eng/common/templates/post-build/post-build.yml @@ -0,0 +1,8 @@ +stages: +- template: /eng/common/core-templates/post-build/post-build.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml new file mode 100644 index 0000000000000..a79fab5b441e8 --- /dev/null +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -0,0 +1,8 @@ +steps: +- template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/steps/component-governance.yml b/eng/common/templates/steps/component-governance.yml new file mode 100644 index 0000000000000..c12a5f8d21d76 --- /dev/null +++ b/eng/common/templates/steps/component-governance.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/component-governance.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/enable-internal-runtimes.yml b/eng/common/templates/steps/enable-internal-runtimes.yml new file mode 100644 index 0000000000000..b21a8038cc1cb --- /dev/null +++ b/eng/common/templates/steps/enable-internal-runtimes.yml @@ -0,0 +1,10 @@ +# Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64' +# variable with the base64-encoded SAS token, by default + +steps: +- template: /eng/common/core-templates/steps/enable-internal-runtimes.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/enable-internal-sources.yml b/eng/common/templates/steps/enable-internal-sources.yml new file mode 100644 index 0000000000000..5f87e9abb8aaa --- /dev/null +++ b/eng/common/templates/steps/enable-internal-sources.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/enable-internal-sources.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/steps/generate-sbom.yml b/eng/common/templates/steps/generate-sbom.yml new file mode 100644 index 0000000000000..26dc00a2e0f31 --- /dev/null +++ b/eng/common/templates/steps/generate-sbom.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/generate-sbom.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/get-delegation-sas.yml b/eng/common/templates/steps/get-delegation-sas.yml new file mode 100644 index 0000000000000..83760c9798e36 --- /dev/null +++ b/eng/common/templates/steps/get-delegation-sas.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/get-delegation-sas.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/get-federated-access-token.yml b/eng/common/templates/steps/get-federated-access-token.yml new file mode 100644 index 0000000000000..31e151d9d9e79 --- /dev/null +++ b/eng/common/templates/steps/get-federated-access-token.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/get-federated-access-token.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/steps/publish-build-artifacts.yml b/eng/common/templates/steps/publish-build-artifacts.yml new file mode 100644 index 0000000000000..605e602e94d13 --- /dev/null +++ b/eng/common/templates/steps/publish-build-artifacts.yml @@ -0,0 +1,46 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: false + +- name: displayName + type: string + default: 'Publish to Build Artifact' + +- name: condition + type: string + default: succeeded() + +- name: artifactName + type: string + +- name: pathToPublish + type: string + +- name: continueOnError + type: boolean + default: false + +- name: publishLocation + type: string + default: 'Container' + +- name: retryCountOnTaskFailure + type: string + default: 10 + +steps: +- ${{ if eq(parameters.is1ESPipeline, true) }}: + - 'eng/common/templates cannot be referenced from a 1ES managed template': error +- task: PublishBuildArtifacts@1 + displayName: ${{ parameters.displayName }} + condition: ${{ parameters.condition }} + ${{ if parameters.continueOnError }}: + continueOnError: ${{ parameters.continueOnError }} + inputs: + PublishLocation: ${{ parameters.publishLocation }} + PathtoPublish: ${{ parameters.pathToPublish }} + ${{ if parameters.artifactName }}: + ArtifactName: ${{ parameters.artifactName }} + ${{ if parameters.retryCountOnTaskFailure }}: + retryCountOnTaskFailure: ${{ parameters.retryCountOnTaskFailure }} diff --git a/eng/common/templates/steps/publish-logs.yml b/eng/common/templates/steps/publish-logs.yml new file mode 100644 index 0000000000000..4ea86bd882355 --- /dev/null +++ b/eng/common/templates/steps/publish-logs.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/publish-logs.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/publish-pipeline-artifacts.yml b/eng/common/templates/steps/publish-pipeline-artifacts.yml new file mode 100644 index 0000000000000..5dd698b212fc6 --- /dev/null +++ b/eng/common/templates/steps/publish-pipeline-artifacts.yml @@ -0,0 +1,34 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: false + +- name: args + type: object + default: {} + +steps: +- ${{ if eq(parameters.is1ESPipeline, true) }}: + - 'eng/common/templates cannot be referenced from a 1ES managed template': error +- task: PublishPipelineArtifact@1 + displayName: ${{ coalesce(parameters.args.displayName, 'Publish to Build Artifact') }} + ${{ if parameters.args.condition }}: + condition: ${{ parameters.args.condition }} + ${{ else }}: + condition: succeeded() + ${{ if parameters.args.continueOnError }}: + continueOnError: ${{ parameters.args.continueOnError }} + inputs: + targetPath: ${{ parameters.args.targetPath }} + ${{ if parameters.args.artifactName }}: + artifactName: ${{ parameters.args.artifactName }} + ${{ if parameters.args.publishLocation }}: + publishLocation: ${{ parameters.args.publishLocation }} + ${{ if parameters.args.fileSharePath }}: + fileSharePath: ${{ parameters.args.fileSharePath }} + ${{ if parameters.args.Parallel }}: + parallel: ${{ parameters.args.Parallel }} + ${{ if parameters.args.parallelCount }}: + parallelCount: ${{ parameters.args.parallelCount }} + ${{ if parameters.args.properties }}: + properties: ${{ parameters.args.properties }} \ No newline at end of file diff --git a/eng/common/templates/steps/retain-build.yml b/eng/common/templates/steps/retain-build.yml new file mode 100644 index 0000000000000..8e841ace3d293 --- /dev/null +++ b/eng/common/templates/steps/retain-build.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/retain-build.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml new file mode 100644 index 0000000000000..39f99fc2762d0 --- /dev/null +++ b/eng/common/templates/steps/send-to-helix.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/send-to-helix.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml new file mode 100644 index 0000000000000..23c1d6f4e9f8d --- /dev/null +++ b/eng/common/templates/steps/source-build.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/source-build.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/source-index-stage1-publish.yml b/eng/common/templates/steps/source-index-stage1-publish.yml new file mode 100644 index 0000000000000..182cec33a7bb7 --- /dev/null +++ b/eng/common/templates/steps/source-index-stage1-publish.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/source-index-stage1-publish.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/vmr-sync.yml b/eng/common/templates/steps/vmr-sync.yml new file mode 100644 index 0000000000000..599afb6186b8f --- /dev/null +++ b/eng/common/templates/steps/vmr-sync.yml @@ -0,0 +1,207 @@ +### These steps synchronize new code from product repositories into the VMR (https://github.com/dotnet/dotnet). +### They initialize the darc CLI and pull the new updates. +### Changes are applied locally onto the already cloned VMR (located in $vmrPath). + +parameters: +- name: targetRef + displayName: Target revision in dotnet/ to synchronize + type: string + default: $(Build.SourceVersion) + +- name: vmrPath + displayName: Path where the dotnet/dotnet is checked out to + type: string + default: $(Agent.BuildDirectory)/vmr + +- name: additionalSyncs + displayName: Optional list of package names whose repo's source will also be synchronized in the local VMR, e.g. NuGet.Protocol + type: object + default: [] + +steps: +- checkout: vmr + displayName: Clone dotnet/dotnet + path: vmr + clean: true + +- checkout: self + displayName: Clone $(Build.Repository.Name) + path: repo + fetchDepth: 0 + +# This step is needed so that when we get a detached HEAD / shallow clone, +# we still pull the commit into the temporary repo clone to use it during the sync. +# Also unshallow the clone so that forwardflow command would work. +- script: | + git branch repo-head + git rev-parse HEAD + displayName: Label PR commit + workingDirectory: $(Agent.BuildDirectory)/repo + +- script: | + vmr_sha=$(grep -oP '(?<=Sha=")[^"]*' $(Agent.BuildDirectory)/repo/eng/Version.Details.xml) + echo "##vso[task.setvariable variable=vmr_sha]$vmr_sha" + displayName: Obtain the vmr sha from Version.Details.xml (Unix) + condition: ne(variables['Agent.OS'], 'Windows_NT') + workingDirectory: $(Agent.BuildDirectory)/repo + +- powershell: | + [xml]$xml = Get-Content -Path $(Agent.BuildDirectory)/repo/eng/Version.Details.xml + $vmr_sha = $xml.SelectSingleNode("//Source").Sha + Write-Output "##vso[task.setvariable variable=vmr_sha]$vmr_sha" + displayName: Obtain the vmr sha from Version.Details.xml (Windows) + condition: eq(variables['Agent.OS'], 'Windows_NT') + workingDirectory: $(Agent.BuildDirectory)/repo + +- script: | + git fetch --all + git checkout $(vmr_sha) + displayName: Checkout VMR at correct sha for repo flow + workingDirectory: ${{ parameters.vmrPath }} + +- script: | + git config --global user.name "dotnet-maestro[bot]" + git config --global user.email "dotnet-maestro[bot]@users.noreply.github.com" + displayName: Set git author to dotnet-maestro[bot] + workingDirectory: ${{ parameters.vmrPath }} + +- script: | + ./eng/common/vmr-sync.sh \ + --vmr ${{ parameters.vmrPath }} \ + --tmp $(Agent.TempDirectory) \ + --azdev-pat '$(dn-bot-all-orgs-code-r)' \ + --ci \ + --debug + + if [ "$?" -ne 0 ]; then + echo "##vso[task.logissue type=error]Failed to synchronize the VMR" + exit 1 + fi + displayName: Sync repo into VMR (Unix) + condition: ne(variables['Agent.OS'], 'Windows_NT') + workingDirectory: $(Agent.BuildDirectory)/repo + +- script: | + git config --global diff.astextplain.textconv echo + git config --system core.longpaths true + displayName: Configure Windows git (longpaths, astextplain) + condition: eq(variables['Agent.OS'], 'Windows_NT') + +- powershell: | + ./eng/common/vmr-sync.ps1 ` + -vmr ${{ parameters.vmrPath }} ` + -tmp $(Agent.TempDirectory) ` + -azdevPat '$(dn-bot-all-orgs-code-r)' ` + -ci ` + -debugOutput + + if ($LASTEXITCODE -ne 0) { + echo "##vso[task.logissue type=error]Failed to synchronize the VMR" + exit 1 + } + displayName: Sync repo into VMR (Windows) + condition: eq(variables['Agent.OS'], 'Windows_NT') + workingDirectory: $(Agent.BuildDirectory)/repo + +- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + - task: CopyFiles@2 + displayName: Collect failed patches + condition: failed() + inputs: + SourceFolder: '$(Agent.TempDirectory)' + Contents: '*.patch' + TargetFolder: '$(Build.ArtifactStagingDirectory)/FailedPatches' + + - publish: '$(Build.ArtifactStagingDirectory)/FailedPatches' + artifact: $(System.JobDisplayName)_FailedPatches + displayName: Upload failed patches + condition: failed() + +- ${{ each assetName in parameters.additionalSyncs }}: + # The vmr-sync script ends up staging files in the local VMR so we have to commit those + - script: + git commit --allow-empty -am "Forward-flow $(Build.Repository.Name)" + displayName: Commit local VMR changes + workingDirectory: ${{ parameters.vmrPath }} + + - script: | + set -ex + + echo "Searching for details of asset ${{ assetName }}..." + + # Use darc to get dependencies information + dependencies=$(./.dotnet/dotnet darc get-dependencies --name '${{ assetName }}' --ci) + + # Extract repository URL and commit hash + repository=$(echo "$dependencies" | grep 'Repo:' | sed 's/Repo:[[:space:]]*//' | head -1) + + if [ -z "$repository" ]; then + echo "##vso[task.logissue type=error]Asset ${{ assetName }} not found in the dependency list" + exit 1 + fi + + commit=$(echo "$dependencies" | grep 'Commit:' | sed 's/Commit:[[:space:]]*//' | head -1) + + echo "Updating the VMR from $repository / $commit..." + cd .. + git clone $repository ${{ assetName }} + cd ${{ assetName }} + git checkout $commit + git branch "sync/$commit" + + ./eng/common/vmr-sync.sh \ + --vmr ${{ parameters.vmrPath }} \ + --tmp $(Agent.TempDirectory) \ + --azdev-pat '$(dn-bot-all-orgs-code-r)' \ + --ci \ + --debug + + if [ "$?" -ne 0 ]; then + echo "##vso[task.logissue type=error]Failed to synchronize the VMR" + exit 1 + fi + displayName: Sync ${{ assetName }} into (Unix) + condition: ne(variables['Agent.OS'], 'Windows_NT') + workingDirectory: $(Agent.BuildDirectory)/repo + + - powershell: | + $ErrorActionPreference = 'Stop' + + Write-Host "Searching for details of asset ${{ assetName }}..." + + $dependencies = .\.dotnet\dotnet darc get-dependencies --name '${{ assetName }}' --ci + + $repository = $dependencies | Select-String -Pattern 'Repo:\s+([^\s]+)' | Select-Object -First 1 + $repository -match 'Repo:\s+([^\s]+)' | Out-Null + $repository = $matches[1] + + if ($repository -eq $null) { + Write-Error "Asset ${{ assetName }} not found in the dependency list" + exit 1 + } + + $commit = $dependencies | Select-String -Pattern 'Commit:\s+([^\s]+)' | Select-Object -First 1 + $commit -match 'Commit:\s+([^\s]+)' | Out-Null + $commit = $matches[1] + + Write-Host "Updating the VMR from $repository / $commit..." + cd .. + git clone $repository ${{ assetName }} + cd ${{ assetName }} + git checkout $commit + git branch "sync/$commit" + + .\eng\common\vmr-sync.ps1 ` + -vmr ${{ parameters.vmrPath }} ` + -tmp $(Agent.TempDirectory) ` + -azdevPat '$(dn-bot-all-orgs-code-r)' ` + -ci ` + -debugOutput + + if ($LASTEXITCODE -ne 0) { + echo "##vso[task.logissue type=error]Failed to synchronize the VMR" + exit 1 + } + displayName: Sync ${{ assetName }} into (Windows) + condition: ne(variables['Agent.OS'], 'Windows_NT') + workingDirectory: $(Agent.BuildDirectory)/repo diff --git a/eng/common/templates/variables/pool-providers.yml b/eng/common/templates/variables/pool-providers.yml new file mode 100644 index 0000000000000..e0b19c14a073c --- /dev/null +++ b/eng/common/templates/variables/pool-providers.yml @@ -0,0 +1,59 @@ +# Select a pool provider based off branch name. Anything with branch name containing 'release' must go into an -Svc pool, +# otherwise it should go into the "normal" pools. This separates out the queueing and billing of released branches. + +# Motivation: +# Once a given branch of a repository's output has been officially "shipped" once, it is then considered to be COGS +# (Cost of goods sold) and should be moved to a servicing pool provider. This allows both separation of queueing +# (allowing release builds and main PR builds to not intefere with each other) and billing (required for COGS. +# Additionally, the pool provider name itself may be subject to change when the .NET Core Engineering Services +# team needs to move resources around and create new and potentially differently-named pools. Using this template +# file from an Arcade-ified repo helps guard against both having to update one's release/* branches and renaming. + +# How to use: +# This yaml assumes your shipped product branches use the naming convention "release/..." (which many do). +# If we find alternate naming conventions in broad usage it can be added to the condition below. +# +# First, import the template in an arcade-ified repo to pick up the variables, e.g.: +# +# variables: +# - template: /eng/common/templates/variables/pool-providers.yml +# +# ... then anywhere specifying the pool provider use the runtime variables, +# $(DncEngInternalBuildPool) and $ (DncEngPublicBuildPool), e.g.: +# +# pool: +# name: $(DncEngInternalBuildPool) +# demands: ImageOverride -equals windows.vs2019.amd64 +variables: + - ${{ if eq(variables['System.TeamProject'], 'internal') }}: + - template: /eng/common/templates-official/variables/pool-providers.yml + - ${{ else }}: + # Coalesce the target and source branches so we know when a PR targets a release branch + # If these variables are somehow missing, fall back to main (tends to have more capacity) + + # Any new -Svc alternative pools should have variables added here to allow for splitting work + - name: DncEngPublicBuildPool + value: $[ + replace( + replace( + eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), + True, + 'NetCore-Svc-Public' + ), + False, + 'NetCore-Public' + ) + ] + + - name: DncEngInternalBuildPool + value: $[ + replace( + replace( + eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), + True, + 'NetCore1ESPool-Svc-Internal' + ), + False, + 'NetCore1ESPool-Internal' + ) + ] diff --git a/eng/common/templates/vmr-build-pr.yml b/eng/common/templates/vmr-build-pr.yml new file mode 100644 index 0000000000000..ce3c29a62faf3 --- /dev/null +++ b/eng/common/templates/vmr-build-pr.yml @@ -0,0 +1,42 @@ +# This pipeline is used for running the VMR verification of the PR changes in repo-level PRs. +# +# It will run a full set of verification jobs defined in: +# https://github.com/dotnet/dotnet/blob/10060d128e3f470e77265f8490f5e4f72dae738e/eng/pipelines/templates/stages/vmr-build.yml#L27-L38 +# +# For repos that do not need to run the full set, you would do the following: +# +# 1. Copy this YML file to a repo-specific location, i.e. outside of eng/common. +# +# 2. Add `verifications` parameter to VMR template reference +# +# Examples: +# - For source-build stage 1 verification, add the following: +# verifications: [ "source-build-stage1" ] +# +# - For Windows only verifications, add the following: +# verifications: [ "unified-build-windows-x64", "unified-build-windows-x86" ] + +trigger: none +pr: none + +variables: +- template: /eng/common/templates/variables/pool-providers.yml@self + +- name: skipComponentGovernanceDetection # we run CG on internal builds only + value: true + +- name: Codeql.Enabled # we run CodeQL on internal builds only + value: false + +resources: + repositories: + - repository: vmr + type: github + name: dotnet/dotnet + endpoint: dotnet + +stages: +- template: /eng/pipelines/templates/stages/vmr-build.yml@vmr + parameters: + isBuiltFromVmr: false + scope: lite diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 new file mode 100644 index 0000000000000..f6bde26837940 --- /dev/null +++ b/eng/common/tools.ps1 @@ -0,0 +1,960 @@ +# Initialize variables if they aren't already defined. +# These may be defined as parameters of the importing script, or set after importing this script. + +# CI mode - set to true on CI server for PR validation build or official build. +[bool]$ci = if (Test-Path variable:ci) { $ci } else { $false } + +# Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. +[string]$configuration = if (Test-Path variable:configuration) { $configuration } else { 'Debug' } + +# Set to true to opt out of outputting binary log while running in CI +[bool]$excludeCIBinarylog = if (Test-Path variable:excludeCIBinarylog) { $excludeCIBinarylog } else { $false } + +# Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. +[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci -and !$excludeCIBinarylog } + +# Set to true to use the pipelines logger which will enable Azure logging output. +# https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md +# This flag is meant as a temporary opt-opt for the feature while validate it across +# our consumers. It will be deleted in the future. +[bool]$pipelinesLog = if (Test-Path variable:pipelinesLog) { $pipelinesLog } else { $ci } + +# Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes). +[bool]$prepareMachine = if (Test-Path variable:prepareMachine) { $prepareMachine } else { $false } + +# True to restore toolsets and dependencies. +[bool]$restore = if (Test-Path variable:restore) { $restore } else { $true } + +# Adjusts msbuild verbosity level. +[string]$verbosity = if (Test-Path variable:verbosity) { $verbosity } else { 'minimal' } + +# Set to true to reuse msbuild nodes. Recommended to not reuse on CI. +[bool]$nodeReuse = if (Test-Path variable:nodeReuse) { $nodeReuse } else { !$ci } + +# Configures warning treatment in msbuild. +[bool]$warnAsError = if (Test-Path variable:warnAsError) { $warnAsError } else { $true } + +# Specifies which msbuild engine to use for build: 'vs', 'dotnet' or unspecified (determined based on presence of tools.vs in global.json). +[string]$msbuildEngine = if (Test-Path variable:msbuildEngine) { $msbuildEngine } else { $null } + +# True to attempt using .NET Core already that meets requirements specified in global.json +# installed on the machine instead of downloading one. +[bool]$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true } + +# Enable repos to use a particular version of the on-line dotnet-install scripts. +# default URL: https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.ps1 +[string]$dotnetInstallScriptVersion = if (Test-Path variable:dotnetInstallScriptVersion) { $dotnetInstallScriptVersion } else { 'v1' } + +# True to use global NuGet cache instead of restoring packages to repository-local directory. +[bool]$useGlobalNuGetCache = if (Test-Path variable:useGlobalNuGetCache) { $useGlobalNuGetCache } else { !$ci } + +# True to exclude prerelease versions Visual Studio during build +[bool]$excludePrereleaseVS = if (Test-Path variable:excludePrereleaseVS) { $excludePrereleaseVS } else { $false } + +# An array of names of processes to stop on script exit if prepareMachine is true. +$processesToStopOnExit = if (Test-Path variable:processesToStopOnExit) { $processesToStopOnExit } else { @('msbuild', 'dotnet', 'vbcscompiler') } + +$disableConfigureToolsetImport = if (Test-Path variable:disableConfigureToolsetImport) { $disableConfigureToolsetImport } else { $null } + +set-strictmode -version 2.0 +$ErrorActionPreference = 'Stop' +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + +# If specifies, provides an alternate path for getting .NET Core SDKs and Runtimes. This script will still try public sources first. +[string]$runtimeSourceFeed = if (Test-Path variable:runtimeSourceFeed) { $runtimeSourceFeed } else { $null } +# Base-64 encoded SAS token that has permission to storage container described by $runtimeSourceFeed +[string]$runtimeSourceFeedKey = if (Test-Path variable:runtimeSourceFeedKey) { $runtimeSourceFeedKey } else { $null } + +# True when the build is running within the VMR. +[bool]$fromVMR = if (Test-Path variable:fromVMR) { $fromVMR } else { $false } + +function Create-Directory ([string[]] $path) { + New-Item -Path $path -Force -ItemType 'Directory' | Out-Null +} + +function Unzip([string]$zipfile, [string]$outpath) { + Add-Type -AssemblyName System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) +} + +# This will exec a process using the console and return it's exit code. +# This will not throw when the process fails. +# Returns process exit code. +function Exec-Process([string]$command, [string]$commandArgs) { + $startInfo = New-Object System.Diagnostics.ProcessStartInfo + $startInfo.FileName = $command + $startInfo.Arguments = $commandArgs + $startInfo.UseShellExecute = $false + $startInfo.WorkingDirectory = Get-Location + + $process = New-Object System.Diagnostics.Process + $process.StartInfo = $startInfo + $process.Start() | Out-Null + + $finished = $false + try { + while (-not $process.WaitForExit(100)) { + # Non-blocking loop done to allow ctr-c interrupts + } + + $finished = $true + return $global:LASTEXITCODE = $process.ExitCode + } + finally { + # If we didn't finish then an error occurred or the user hit ctrl-c. Either + # way kill the process + if (-not $finished) { + $process.Kill() + } + } +} + +# Take the given block, print it, print what the block probably references from the current set of +# variables using low-effort string matching, then run the block. +# +# This is intended to replace the pattern of manually copy-pasting a command, wrapping it in quotes, +# and printing it using "Write-Host". The copy-paste method is more readable in build logs, but less +# maintainable and less reliable. It is easy to make a mistake and modify the command without +# properly updating the "Write-Host" line, resulting in misleading build logs. The probability of +# this mistake makes the pattern hard to trust when it shows up in build logs. Finding the bug in +# existing source code can also be difficult, because the strings are not aligned to each other and +# the line may be 300+ columns long. +# +# By removing the need to maintain two copies of the command, Exec-BlockVerbosely avoids the issues. +# +# In Bash (or any posix-like shell), "set -x" prints usable verbose output automatically. +# "Set-PSDebug" appears to be similar at first glance, but unfortunately, it isn't very useful: it +# doesn't print any info about the variables being used by the command, which is normally the +# interesting part to diagnose. +function Exec-BlockVerbosely([scriptblock] $block) { + Write-Host "--- Running script block:" + $blockString = $block.ToString().Trim() + Write-Host $blockString + + Write-Host "--- List of variables that might be used:" + # For each variable x in the environment, check the block for a reference to x via simple "$x" or + # "@x" syntax. This doesn't detect other ways to reference variables ("${x}" nor "$variable:x", + # among others). It only catches what this function was originally written for: simple + # command-line commands. + $variableTable = Get-Variable | + Where-Object { + $blockString.Contains("`$$($_.Name)") -or $blockString.Contains("@$($_.Name)") + } | + Format-Table -AutoSize -HideTableHeaders -Wrap | + Out-String + Write-Host $variableTable.Trim() + + Write-Host "--- Executing:" + & $block + Write-Host "--- Done running script block!" +} + +# createSdkLocationFile parameter enables a file being generated under the toolset directory +# which writes the sdk's location into. This is only necessary for cmd --> powershell invocations +# as dot sourcing isn't possible. +function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { + if (Test-Path variable:global:_DotNetInstallDir) { + return $global:_DotNetInstallDir + } + + # Disable first run since we do not need all ASP.NET packages restored. + $env:DOTNET_NOLOGO=1 + + # Disable telemetry on CI. + if ($ci) { + $env:DOTNET_CLI_TELEMETRY_OPTOUT=1 + } + + # Find the first path on %PATH% that contains the dotnet.exe + if ($useInstalledDotNetCli -and (-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -eq $null)) { + $dotnetExecutable = GetExecutableFileName 'dotnet' + $dotnetCmd = Get-Command $dotnetExecutable -ErrorAction SilentlyContinue + + if ($dotnetCmd -ne $null) { + $env:DOTNET_INSTALL_DIR = Split-Path $dotnetCmd.Path -Parent + } + } + + $dotnetSdkVersion = $GlobalJson.tools.dotnet + + # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, + # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. + if ((-not $globalJsonHasRuntimes) -and (-not [string]::IsNullOrEmpty($env:DOTNET_INSTALL_DIR)) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) { + $dotnetRoot = $env:DOTNET_INSTALL_DIR + } else { + $dotnetRoot = Join-Path $RepoRoot '.dotnet' + + if (-not (Test-Path(Join-Path $dotnetRoot "sdk\$dotnetSdkVersion"))) { + if ($install) { + InstallDotNetSdk $dotnetRoot $dotnetSdkVersion + } else { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unable to find dotnet with SDK version '$dotnetSdkVersion'" + ExitWithExitCode 1 + } + } + + $env:DOTNET_INSTALL_DIR = $dotnetRoot + } + + # Creates a temporary file under the toolset dir. + # The following code block is protecting against concurrent access so that this function can + # be called in parallel. + if ($createSdkLocationFile) { + do { + $sdkCacheFileTemp = Join-Path $ToolsetDir $([System.IO.Path]::GetRandomFileName()) + } + until (!(Test-Path $sdkCacheFileTemp)) + Set-Content -Path $sdkCacheFileTemp -Value $dotnetRoot + + try { + Move-Item -Force $sdkCacheFileTemp (Join-Path $ToolsetDir 'sdk.txt') + } catch { + # Somebody beat us + Remove-Item -Path $sdkCacheFileTemp + } + } + + # Add dotnet to PATH. This prevents any bare invocation of dotnet in custom + # build steps from using anything other than what we've downloaded. + # It also ensures that VS msbuild will use the downloaded sdk targets. + $env:PATH = "$dotnetRoot;$env:PATH" + + # Make Sure that our bootstrapped dotnet cli is available in future steps of the Azure Pipelines build + Write-PipelinePrependPath -Path $dotnetRoot + + Write-PipelineSetVariable -Name 'DOTNET_NOLOGO' -Value '1' + + return $global:_DotNetInstallDir = $dotnetRoot +} + +function Retry($downloadBlock, $maxRetries = 5) { + $retries = 1 + + while($true) { + try { + & $downloadBlock + break + } + catch { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ + } + + if (++$retries -le $maxRetries) { + $delayInSeconds = [math]::Pow(2, $retries) - 1 # Exponential backoff + Write-Host "Retrying. Waiting for $delayInSeconds seconds before next attempt ($retries of $maxRetries)." + Start-Sleep -Seconds $delayInSeconds + } + else { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unable to download file in $maxRetries attempts." + break + } + } +} + +function GetDotNetInstallScript([string] $dotnetRoot) { + $installScript = Join-Path $dotnetRoot 'dotnet-install.ps1' + $shouldDownload = $false + + if (!(Test-Path $installScript)) { + $shouldDownload = $true + } else { + # Check if the script is older than 30 days + $fileAge = (Get-Date) - (Get-Item $installScript).LastWriteTime + if ($fileAge.Days -gt 30) { + Write-Host "Existing install script is too old, re-downloading..." + $shouldDownload = $true + } + } + + if ($shouldDownload) { + Create-Directory $dotnetRoot + $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit + $uri = "https://builds.dotnet.microsoft.com/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.ps1" + + Retry({ + Write-Host "GET $uri" + Invoke-WebRequest $uri -UseBasicParsing -OutFile $installScript + }) + } + + return $installScript +} + +function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $architecture = '', [switch] $noPath) { + InstallDotNet $dotnetRoot $version $architecture '' $false $runtimeSourceFeed $runtimeSourceFeedKey -noPath:$noPath +} + +function InstallDotNet([string] $dotnetRoot, + [string] $version, + [string] $architecture = '', + [string] $runtime = '', + [bool] $skipNonVersionedFiles = $false, + [string] $runtimeSourceFeed = '', + [string] $runtimeSourceFeedKey = '', + [switch] $noPath) { + + $dotnetVersionLabel = "'sdk v$version'" + + if ($runtime -ne '' -and $runtime -ne 'sdk') { + $runtimePath = $dotnetRoot + $runtimePath = $runtimePath + "\shared" + if ($runtime -eq "dotnet") { $runtimePath = $runtimePath + "\Microsoft.NETCore.App" } + if ($runtime -eq "aspnetcore") { $runtimePath = $runtimePath + "\Microsoft.AspNetCore.App" } + if ($runtime -eq "windowsdesktop") { $runtimePath = $runtimePath + "\Microsoft.WindowsDesktop.App" } + $runtimePath = $runtimePath + "\" + $version + + $dotnetVersionLabel = "runtime toolset '$runtime/$architecture v$version'" + + if (Test-Path $runtimePath) { + Write-Host " Runtime toolset '$runtime/$architecture v$version' already installed." + $installSuccess = $true + Exit + } + } + + $installScript = GetDotNetInstallScript $dotnetRoot + $installParameters = @{ + Version = $version + InstallDir = $dotnetRoot + } + + if ($architecture) { $installParameters.Architecture = $architecture } + if ($runtime) { $installParameters.Runtime = $runtime } + if ($skipNonVersionedFiles) { $installParameters.SkipNonVersionedFiles = $skipNonVersionedFiles } + if ($noPath) { $installParameters.NoPath = $True } + + $variations = @() + $variations += @($installParameters) + + $dotnetBuilds = $installParameters.Clone() + $dotnetbuilds.AzureFeed = "https://ci.dot.net/public" + $variations += @($dotnetBuilds) + + if ($runtimeSourceFeed) { + $runtimeSource = $installParameters.Clone() + $runtimeSource.AzureFeed = $runtimeSourceFeed + if ($runtimeSourceFeedKey) { + $decodedBytes = [System.Convert]::FromBase64String($runtimeSourceFeedKey) + $decodedString = [System.Text.Encoding]::UTF8.GetString($decodedBytes) + $runtimeSource.FeedCredential = $decodedString + } + $variations += @($runtimeSource) + } + + $installSuccess = $false + foreach ($variation in $variations) { + if ($variation | Get-Member AzureFeed) { + $location = $variation.AzureFeed + } else { + $location = "public location"; + } + Write-Host " Attempting to install $dotnetVersionLabel from $location." + try { + & $installScript @variation + $installSuccess = $true + break + } + catch { + Write-Host " Failed to install $dotnetVersionLabel from $location." + } + } + if (-not $installSuccess) { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install $dotnetVersionLabel from any of the specified locations." + ExitWithExitCode 1 + } +} + +# +# Locates Visual Studio MSBuild installation. +# The preference order for MSBuild to use is as follows: +# +# 1. MSBuild from an active VS command prompt +# 2. MSBuild from a compatible VS installation +# 3. MSBuild from the xcopy tool package +# +# Returns full path to msbuild.exe. +# Throws on failure. +# +function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = $null) { + if (-not (IsWindowsPlatform)) { + throw "Cannot initialize Visual Studio on non-Windows" + } + + if (Test-Path variable:global:_MSBuildExe) { + return $global:_MSBuildExe + } + + # Minimum VS version to require. + $vsMinVersionReqdStr = '17.7' + $vsMinVersionReqd = [Version]::new($vsMinVersionReqdStr) + + # If the version of msbuild is going to be xcopied, + # use this version. Version matches a package here: + # https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/Microsoft.DotNet.Arcade.MSBuild.Xcopy/versions/18.0.0 + $defaultXCopyMSBuildVersion = '18.0.0' + + if (!$vsRequirements) { + if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { + $vsRequirements = $GlobalJson.tools.vs + } + else { + $vsRequirements = New-Object PSObject -Property @{ version = $vsMinVersionReqdStr } + } + } + $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { $vsMinVersionReqdStr } + $vsMinVersion = [Version]::new($vsMinVersionStr) + + # Try msbuild command available in the environment. + if ($env:VSINSTALLDIR -ne $null) { + $msbuildCmd = Get-Command 'msbuild.exe' -ErrorAction SilentlyContinue + if ($msbuildCmd -ne $null) { + # Workaround for https://github.com/dotnet/roslyn/issues/35793 + # Due to this issue $msbuildCmd.Version returns 0.0.0.0 for msbuild.exe 16.2+ + $msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split([char[]]@('-', '+'))[0]) + + if ($msbuildVersion -ge $vsMinVersion) { + return $global:_MSBuildExe = $msbuildCmd.Path + } + + # Report error - the developer environment is initialized with incompatible VS version. + throw "Developer Command Prompt for VS $($env:VisualStudioVersion) is not recent enough. Please upgrade to $vsMinVersionStr or build from a plain CMD window" + } + } + + # Locate Visual Studio installation or download x-copy msbuild. + $vsInfo = LocateVisualStudio $vsRequirements + if ($vsInfo -ne $null -and $env:ForceUseXCopyMSBuild -eq $null) { + # Ensure vsInstallDir has a trailing slash + $vsInstallDir = Join-Path $vsInfo.installationPath "\" + $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] + + InitializeVisualStudioEnvironmentVariables $vsInstallDir $vsMajorVersion + } else { + if (Get-Member -InputObject $GlobalJson.tools -Name 'xcopy-msbuild') { + $xcopyMSBuildVersion = $GlobalJson.tools.'xcopy-msbuild' + $vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0] + } else { + #if vs version provided in global.json is incompatible (too low) then use the default version for xcopy msbuild download + if($vsMinVersion -lt $vsMinVersionReqd){ + Write-Host "Using xcopy-msbuild version of $defaultXCopyMSBuildVersion since VS version $vsMinVersionStr provided in global.json is not compatible" + $xcopyMSBuildVersion = $defaultXCopyMSBuildVersion + $vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0] + } + else{ + # If the VS version IS compatible, look for an xcopy msbuild package + # with a version matching VS. + # Note: If this version does not exist, then an explicit version of xcopy msbuild + # can be specified in global.json. This will be required for pre-release versions of msbuild. + $vsMajorVersion = $vsMinVersion.Major + $vsMinorVersion = $vsMinVersion.Minor + $xcopyMSBuildVersion = "$vsMajorVersion.$vsMinorVersion.0" + } + } + + $vsInstallDir = $null + if ($xcopyMSBuildVersion.Trim() -ine "none") { + $vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install + if ($vsInstallDir -eq $null) { + throw "Could not xcopy msbuild. Please check that package 'Microsoft.DotNet.Arcade.MSBuild.Xcopy @ $xcopyMSBuildVersion' exists on feed 'dotnet-eng'." + } + } + if ($vsInstallDir -eq $null) { + throw 'Unable to find Visual Studio that has required version and components installed' + } + } + + $msbuildVersionDir = if ([int]$vsMajorVersion -lt 16) { "$vsMajorVersion.0" } else { "Current" } + + $local:BinFolder = Join-Path $vsInstallDir "MSBuild\$msbuildVersionDir\Bin" + $local:Prefer64bit = if (Get-Member -InputObject $vsRequirements -Name 'Prefer64bit') { $vsRequirements.Prefer64bit } else { $false } + if ($local:Prefer64bit -and (Test-Path(Join-Path $local:BinFolder "amd64"))) { + $global:_MSBuildExe = Join-Path $local:BinFolder "amd64\msbuild.exe" + } else { + $global:_MSBuildExe = Join-Path $local:BinFolder "msbuild.exe" + } + + return $global:_MSBuildExe +} + +function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [string] $vsMajorVersion) { + $env:VSINSTALLDIR = $vsInstallDir + Set-Item "env:VS$($vsMajorVersion)0COMNTOOLS" (Join-Path $vsInstallDir "Common7\Tools\") + + $vsSdkInstallDir = Join-Path $vsInstallDir "VSSDK\" + if (Test-Path $vsSdkInstallDir) { + Set-Item "env:VSSDK$($vsMajorVersion)0Install" $vsSdkInstallDir + $env:VSSDKInstall = $vsSdkInstallDir + } +} + +function InstallXCopyMSBuild([string]$packageVersion) { + return InitializeXCopyMSBuild $packageVersion -install $true +} + +function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { + $packageName = 'Microsoft.DotNet.Arcade.MSBuild.Xcopy' + $packageDir = Join-Path $ToolsDir "msbuild\$packageVersion" + $packagePath = Join-Path $packageDir "$packageName.$packageVersion.nupkg" + + if (!(Test-Path $packageDir)) { + if (!$install) { + return $null + } + + Create-Directory $packageDir + + Write-Host "Downloading $packageName $packageVersion" + $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit + Retry({ + Invoke-WebRequest "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/flat2/$packageName/$packageVersion/$packageName.$packageVersion.nupkg" -UseBasicParsing -OutFile $packagePath + }) + + if (!(Test-Path $packagePath)) { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "See https://dev.azure.com/dnceng/internal/_wiki/wikis/DNCEng%20Services%20Wiki/1074/Updating-Microsoft.DotNet.Arcade.MSBuild.Xcopy-WAS-RoslynTools.MSBuild-(xcopy-msbuild)-generation?anchor=troubleshooting for help troubleshooting issues with XCopy MSBuild" + throw + } + Unzip $packagePath $packageDir + } + + return Join-Path $packageDir 'tools' +} + +# +# Locates Visual Studio instance that meets the minimal requirements specified by tools.vs object in global.json. +# +# The following properties of tools.vs are recognized: +# "version": "{major}.{minor}" +# Two part minimal VS version, e.g. "15.9", "16.0", etc. +# "components": ["componentId1", "componentId2", ...] +# Array of ids of workload components that must be available in the VS instance. +# See e.g. https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-enterprise?view=vs-2017 +# +# Returns JSON describing the located VS instance (same format as returned by vswhere), +# or $null if no instance meeting the requirements is found on the machine. +# +function LocateVisualStudio([object]$vsRequirements = $null){ + if (-not (IsWindowsPlatform)) { + throw "Cannot run vswhere on non-Windows platforms." + } + + if (Get-Member -InputObject $GlobalJson.tools -Name 'vswhere') { + $vswhereVersion = $GlobalJson.tools.vswhere + } else { + # keep this in sync with the VSWhereVersion in DefaultVersions.props + $vswhereVersion = '3.1.7' + } + + $vsWhereDir = Join-Path $ToolsDir "vswhere\$vswhereVersion" + $vsWhereExe = Join-Path $vsWhereDir 'vswhere.exe' + + if (!(Test-Path $vsWhereExe)) { + Create-Directory $vsWhereDir + Write-Host "Downloading vswhere $vswhereVersion" + $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit + Retry({ + Invoke-WebRequest "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/vswhere/$vswhereVersion/vswhere.exe" -UseBasicParsing -OutFile $vswhereExe + }) + } + + if (!$vsRequirements) { + if (Get-Member -InputObject $GlobalJson.tools -Name 'vs' -ErrorAction SilentlyContinue) { + $vsRequirements = $GlobalJson.tools.vs + } else { + $vsRequirements = $null + } + } + + $args = @('-latest', '-format', 'json', '-requires', 'Microsoft.Component.MSBuild', '-products', '*') + + if (!$excludePrereleaseVS) { + $args += '-prerelease' + } + + if ($vsRequirements -and (Get-Member -InputObject $vsRequirements -Name 'version' -ErrorAction SilentlyContinue)) { + $args += '-version' + $args += $vsRequirements.version + } + + if ($vsRequirements -and (Get-Member -InputObject $vsRequirements -Name 'components' -ErrorAction SilentlyContinue)) { + foreach ($component in $vsRequirements.components) { + $args += '-requires' + $args += $component + } + } + + $vsInfo =& $vsWhereExe $args | ConvertFrom-Json + + if ($lastExitCode -ne 0) { + return $null + } + + # use first matching instance + return $vsInfo[0] +} + +function InitializeBuildTool() { + if (Test-Path variable:global:_BuildTool) { + # If the requested msbuild parameters do not match, clear the cached variables. + if($global:_BuildTool.Contains('ExcludePrereleaseVS') -and $global:_BuildTool.ExcludePrereleaseVS -ne $excludePrereleaseVS) { + Remove-Item variable:global:_BuildTool + Remove-Item variable:global:_MSBuildExe + } else { + return $global:_BuildTool + } + } + + if (-not $msbuildEngine) { + $msbuildEngine = GetDefaultMSBuildEngine + } + + # Initialize dotnet cli if listed in 'tools' + $dotnetRoot = $null + if (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') { + $dotnetRoot = InitializeDotNetCli -install:$restore + } + + if ($msbuildEngine -eq 'dotnet') { + if (!$dotnetRoot) { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "/global.json must specify 'tools.dotnet'." + ExitWithExitCode 1 + } + $dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet') + + $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net' } + } elseif ($msbuildEngine -eq "vs") { + try { + $msbuildPath = InitializeVisualStudioMSBuild -install:$restore + } catch { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ + ExitWithExitCode 1 + } + + $buildTool = @{ Path = $msbuildPath; Command = ""; Tool = "vs"; Framework = "netframework"; ExcludePrereleaseVS = $excludePrereleaseVS } + } else { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unexpected value of -msbuildEngine: '$msbuildEngine'." + ExitWithExitCode 1 + } + + return $global:_BuildTool = $buildTool +} + +function GetDefaultMSBuildEngine() { + # Presence of tools.vs indicates the repo needs to build using VS msbuild on Windows. + if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { + return 'vs' + } + + if (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') { + return 'dotnet' + } + + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." + ExitWithExitCode 1 +} + +function GetNuGetPackageCachePath() { + if ($env:NUGET_PACKAGES -eq $null) { + # Use local cache on CI to ensure deterministic build. + # Avoid using the http cache as workaround for https://github.com/NuGet/Home/issues/3116 + # use global cache in dev builds to avoid cost of downloading packages. + # For directory normalization, see also: https://github.com/NuGet/Home/issues/7968 + if ($useGlobalNuGetCache) { + $env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\' + } else { + $env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages\' + } + } + + return $env:NUGET_PACKAGES +} + +# Returns a full path to an Arcade SDK task project file. +function GetSdkTaskProject([string]$taskName) { + return Join-Path (Split-Path (InitializeToolset) -Parent) "SdkTasks\$taskName.proj" +} + +function InitializeNativeTools() { + if (-Not (Test-Path variable:DisableNativeToolsetInstalls) -And (Get-Member -InputObject $GlobalJson -Name "native-tools")) { + $nativeArgs= @{} + if ($ci) { + $nativeArgs = @{ + InstallDirectory = "$ToolsDir" + } + } + if ($env:NativeToolsOnMachine) { + Write-Host "Variable NativeToolsOnMachine detected, enabling native tool path promotion..." + $nativeArgs += @{ PathPromotion = $true } + } + & "$PSScriptRoot/init-tools-native.ps1" @nativeArgs + } +} + +function Read-ArcadeSdkVersion() { + return $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' +} + +function InitializeToolset() { + # For Unified Build/Source-build support, check whether the environment variable is + # set. If it is, then use this as the toolset build project. + if ($env:_InitializeToolset -ne $null) { + return $global:_InitializeToolset = $env:_InitializeToolset + } + + if (Test-Path variable:global:_InitializeToolset) { + return $global:_InitializeToolset + } + + $nugetCache = GetNuGetPackageCachePath + + $toolsetVersion = Read-ArcadeSdkVersion + $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" + + if (Test-Path $toolsetLocationFile) { + $path = Get-Content $toolsetLocationFile -TotalCount 1 + if (Test-Path $path) { + return $global:_InitializeToolset = $path + } + } + + if (-not $restore) { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Toolset version $toolsetVersion has not been restored." + ExitWithExitCode 1 + } + + $buildTool = InitializeBuildTool + + $proj = Join-Path $ToolsetDir 'restore.proj' + $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'ToolsetRestore.binlog') } else { '' } + + '' | Set-Content $proj + + MSBuild-Core $proj $bl /t:__WriteToolsetLocation /clp:ErrorsOnly`;NoSummary /p:__ToolsetLocationOutputFile=$toolsetLocationFile + + $path = Get-Content $toolsetLocationFile -Encoding UTF8 -TotalCount 1 + if (!(Test-Path $path)) { + throw "Invalid toolset path: $path" + } + + return $global:_InitializeToolset = $path +} + +function ExitWithExitCode([int] $exitCode) { + if ($ci -and $prepareMachine) { + Stop-Processes + } + exit $exitCode +} + +# Check if $LASTEXITCODE is a nonzero exit code (NZEC). If so, print a Azure Pipeline error for +# diagnostics, then exit the script with the $LASTEXITCODE. +function Exit-IfNZEC([string] $category = "General") { + Write-Host "Exit code $LASTEXITCODE" + if ($LASTEXITCODE -ne 0) { + $message = "Last command failed with exit code $LASTEXITCODE." + Write-PipelineTelemetryError -Force -Category $category -Message $message + ExitWithExitCode $LASTEXITCODE + } +} + +function Stop-Processes() { + Write-Host 'Killing running build processes...' + foreach ($processName in $processesToStopOnExit) { + Get-Process -Name $processName -ErrorAction SilentlyContinue | Stop-Process + } +} + +# +# Executes msbuild (or 'dotnet msbuild') with arguments passed to the function. +# The arguments are automatically quoted. +# Terminates the script if the build fails. +# +function MSBuild() { + if ($pipelinesLog) { + $buildTool = InitializeBuildTool + + if ($ci -and $buildTool.Tool -eq 'dotnet') { + $env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS = 20 + $env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS = 20 + Write-PipelineSetVariable -Name 'NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS' -Value '20' + Write-PipelineSetVariable -Name 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS' -Value '20' + } + + Enable-Nuget-EnhancedRetry + + $toolsetBuildProject = InitializeToolset + $basePath = Split-Path -parent $toolsetBuildProject + $selectedPath = Join-Path $basePath (Join-Path $buildTool.Framework 'Microsoft.DotNet.ArcadeLogging.dll') + + if (-not $selectedPath) { + Write-PipelineTelemetryError -Category 'Build' -Message "Unable to find arcade sdk logger assembly: $selectedPath" + ExitWithExitCode 1 + } + + $args += "/logger:$selectedPath" + } + + MSBuild-Core @args +} + +# +# Executes msbuild (or 'dotnet msbuild') with arguments passed to the function. +# The arguments are automatically quoted. +# Terminates the script if the build fails. +# +function MSBuild-Core() { + if ($ci) { + if (!$binaryLog -and !$excludeCIBinarylog) { + Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build, or explicitly opted-out from with the -excludeCIBinarylog switch.' + ExitWithExitCode 1 + } + + if ($nodeReuse) { + Write-PipelineTelemetryError -Category 'Build' -Message 'Node reuse must be disabled in CI build.' + ExitWithExitCode 1 + } + } + + Enable-Nuget-EnhancedRetry + + $buildTool = InitializeBuildTool + + $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" + + if ($warnAsError) { + $cmdArgs += ' /warnaserror /p:TreatWarningsAsErrors=true' + } + else { + $cmdArgs += ' /p:TreatWarningsAsErrors=false' + } + + foreach ($arg in $args) { + if ($null -ne $arg -and $arg.Trim() -ne "") { + if ($arg.EndsWith('\')) { + $arg = $arg + "\" + } + $cmdArgs += " `"$arg`"" + } + } + + # Be sure quote the path in case there are spaces in the dotnet installation location. + $env:ARCADE_BUILD_TOOL_COMMAND = "`"$($buildTool.Path)`" $cmdArgs" + + $exitCode = Exec-Process $buildTool.Path $cmdArgs + + if ($exitCode -ne 0) { + # We should not Write-PipelineTaskError here because that message shows up in the build summary + # The build already logged an error, that's the reason it failed. Producing an error here only adds noise. + Write-Host "Build failed with exit code $exitCode. Check errors above." -ForegroundColor Red + + $buildLog = GetMSBuildBinaryLogCommandLineArgument $args + if ($null -ne $buildLog) { + Write-Host "See log: $buildLog" -ForegroundColor DarkGray + } + + # When running on Azure Pipelines, override the returned exit code to avoid double logging. + # Skip this when the build is a child of the VMR build. + if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$fromVMR) { + Write-PipelineSetResult -Result "Failed" -Message "msbuild execution failed." + # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error + # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error + ExitWithExitCode 0 + } else { + ExitWithExitCode $exitCode + } + } +} + +function GetMSBuildBinaryLogCommandLineArgument($arguments) { + foreach ($argument in $arguments) { + if ($argument -ne $null) { + $arg = $argument.Trim() + if ($arg.StartsWith('/bl:', "OrdinalIgnoreCase")) { + return $arg.Substring('/bl:'.Length) + } + + if ($arg.StartsWith('/binaryLogger:', 'OrdinalIgnoreCase')) { + return $arg.Substring('/binaryLogger:'.Length) + } + } + } + + return $null +} + +function GetExecutableFileName($baseName) { + if (IsWindowsPlatform) { + return "$baseName.exe" + } + else { + return $baseName + } +} + +function IsWindowsPlatform() { + return [environment]::OSVersion.Platform -eq [PlatformID]::Win32NT +} + +function Get-Darc($version) { + $darcPath = "$TempDir\darc\$([guid]::NewGuid())" + if ($version -ne $null) { + & $PSScriptRoot\darc-init.ps1 -toolpath $darcPath -darcVersion $version | Out-Host + } else { + & $PSScriptRoot\darc-init.ps1 -toolpath $darcPath | Out-Host + } + return "$darcPath\darc.exe" +} + +. $PSScriptRoot\pipeline-logging-functions.ps1 + +$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..\') +$EngRoot = Resolve-Path (Join-Path $PSScriptRoot '..') +$ArtifactsDir = Join-Path $RepoRoot 'artifacts' +$ToolsetDir = Join-Path $ArtifactsDir 'toolset' +$ToolsDir = Join-Path $RepoRoot '.tools' +$LogDir = Join-Path (Join-Path $ArtifactsDir 'log') $configuration +$TempDir = Join-Path (Join-Path $ArtifactsDir 'tmp') $configuration +$GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot 'global.json') | ConvertFrom-Json +# true if global.json contains a "runtimes" section +$globalJsonHasRuntimes = if ($GlobalJson.tools.PSObject.Properties.Name -Match 'runtimes') { $true } else { $false } + +Create-Directory $ToolsetDir +Create-Directory $TempDir +Create-Directory $LogDir + +Write-PipelineSetVariable -Name 'Artifacts' -Value $ArtifactsDir +Write-PipelineSetVariable -Name 'Artifacts.Toolset' -Value $ToolsetDir +Write-PipelineSetVariable -Name 'Artifacts.Log' -Value $LogDir +Write-PipelineSetVariable -Name 'TEMP' -Value $TempDir +Write-PipelineSetVariable -Name 'TMP' -Value $TempDir + +# Import custom tools configuration, if present in the repo. +# Note: Import in global scope so that the script set top-level variables without qualification. +if (!$disableConfigureToolsetImport) { + $configureToolsetScript = Join-Path $EngRoot 'configure-toolset.ps1' + if (Test-Path $configureToolsetScript) { + . $configureToolsetScript + if ((Test-Path variable:failOnConfigureToolsetError) -And $failOnConfigureToolsetError) { + if ((Test-Path variable:LastExitCode) -And ($LastExitCode -ne 0)) { + Write-PipelineTelemetryError -Category 'Build' -Message 'configure-toolset.ps1 returned a non-zero exit code' + ExitWithExitCode $LastExitCode + } + } + } +} + +# +# If $ci flag is set, turn on (and log that we did) special environment variables for improved Nuget client retry logic. +# +function Enable-Nuget-EnhancedRetry() { + if ($ci) { + Write-Host "Setting NUGET enhanced retry environment variables" + $env:NUGET_ENABLE_ENHANCED_HTTP_RETRY = 'true' + $env:NUGET_ENHANCED_MAX_NETWORK_TRY_COUNT = 6 + $env:NUGET_ENHANCED_NETWORK_RETRY_DELAY_MILLISECONDS = 1000 + $env:NUGET_RETRY_HTTP_429 = 'true' + Write-PipelineSetVariable -Name 'NUGET_ENABLE_ENHANCED_HTTP_RETRY' -Value 'true' + Write-PipelineSetVariable -Name 'NUGET_ENHANCED_MAX_NETWORK_TRY_COUNT' -Value '6' + Write-PipelineSetVariable -Name 'NUGET_ENHANCED_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000' + Write-PipelineSetVariable -Name 'NUGET_RETRY_HTTP_429' -Value 'true' + } +} diff --git a/eng/common/tools.sh b/eng/common/tools.sh new file mode 100755 index 0000000000000..6c121300ac7da --- /dev/null +++ b/eng/common/tools.sh @@ -0,0 +1,600 @@ +#!/usr/bin/env bash + +# Initialize variables if they aren't already defined. + +# CI mode - set to true on CI server for PR validation build or official build. +ci=${ci:-false} + +# Build mode +source_build=${source_build:-false} + +# Set to true to use the pipelines logger which will enable Azure logging output. +# https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md +# This flag is meant as a temporary opt-opt for the feature while validate it across +# our consumers. It will be deleted in the future. +if [[ "$ci" == true ]]; then + pipelines_log=${pipelines_log:-true} +else + pipelines_log=${pipelines_log:-false} +fi + +# Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. +configuration=${configuration:-'Debug'} + +# Set to true to opt out of outputting binary log while running in CI +exclude_ci_binary_log=${exclude_ci_binary_log:-false} + +if [[ "$ci" == true && "$exclude_ci_binary_log" == false ]]; then + binary_log_default=true +else + binary_log_default=false +fi + +# Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. +binary_log=${binary_log:-$binary_log_default} + +# Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes). +prepare_machine=${prepare_machine:-false} + +# True to restore toolsets and dependencies. +restore=${restore:-true} + +# Adjusts msbuild verbosity level. +verbosity=${verbosity:-'minimal'} + +# Set to true to reuse msbuild nodes. Recommended to not reuse on CI. +if [[ "$ci" == true ]]; then + node_reuse=${node_reuse:-false} +else + node_reuse=${node_reuse:-true} +fi + +# Configures warning treatment in msbuild. +warn_as_error=${warn_as_error:-true} + +# True to attempt using .NET Core already that meets requirements specified in global.json +# installed on the machine instead of downloading one. +use_installed_dotnet_cli=${use_installed_dotnet_cli:-true} + +# Enable repos to use a particular version of the on-line dotnet-install scripts. +# default URL: https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh +dotnetInstallScriptVersion=${dotnetInstallScriptVersion:-'v1'} + +# True to use global NuGet cache instead of restoring packages to repository-local directory. +# Keep in sync with NuGetPackageroot in Arcade SDK's RepositoryLayout.props. +if [[ "$ci" == true || "$source_build" == true ]]; then + use_global_nuget_cache=${use_global_nuget_cache:-false} +else + use_global_nuget_cache=${use_global_nuget_cache:-true} +fi + +# Used when restoring .NET SDK from alternative feeds +runtime_source_feed=${runtime_source_feed:-''} +runtime_source_feed_key=${runtime_source_feed_key:-''} + +# True when the build is running within the VMR. +from_vmr=${from_vmr:-false} + +# Resolve any symlinks in the given path. +function ResolvePath { + local path=$1 + + while [[ -h $path ]]; do + local dir="$( cd -P "$( dirname "$path" )" && pwd )" + path="$(readlink "$path")" + + # if $path was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $path != /* ]] && path="$dir/$path" + done + + # return value + _ResolvePath="$path" +} + +# ReadVersionFromJson [json key] +function ReadGlobalVersion { + local key=$1 + + if command -v jq &> /dev/null; then + _ReadGlobalVersion="$(jq -r ".[] | select(has(\"$key\")) | .\"$key\"" "$global_json_file")" + elif [[ "$(cat "$global_json_file")" =~ \"$key\"[[:space:]\:]*\"([^\"]+) ]]; then + _ReadGlobalVersion=${BASH_REMATCH[1]} + fi + + if [[ -z "$_ReadGlobalVersion" ]]; then + Write-PipelineTelemetryError -category 'Build' "Error: Cannot find \"$key\" in $global_json_file" + ExitWithExitCode 1 + fi +} + +function InitializeDotNetCli { + if [[ -n "${_InitializeDotNetCli:-}" ]]; then + return + fi + + local install=$1 + + # Disable first run since we want to control all package sources + export DOTNET_NOLOGO=1 + + # Disable telemetry on CI + if [[ $ci == true ]]; then + export DOTNET_CLI_TELEMETRY_OPTOUT=1 + fi + + # LTTNG is the logging infrastructure used by Core CLR. Need this variable set + # so it doesn't output warnings to the console. + export LTTNG_HOME="$HOME" + + # Find the first path on $PATH that contains the dotnet.exe + if [[ "$use_installed_dotnet_cli" == true && $global_json_has_runtimes == false && -z "${DOTNET_INSTALL_DIR:-}" ]]; then + local dotnet_path=`command -v dotnet` + if [[ -n "$dotnet_path" ]]; then + ResolvePath "$dotnet_path" + export DOTNET_INSTALL_DIR=`dirname "$_ResolvePath"` + fi + fi + + ReadGlobalVersion "dotnet" + local dotnet_sdk_version=$_ReadGlobalVersion + local dotnet_root="" + + # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, + # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. + if [[ $global_json_has_runtimes == false && -n "${DOTNET_INSTALL_DIR:-}" && -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then + dotnet_root="$DOTNET_INSTALL_DIR" + else + dotnet_root="${repo_root}.dotnet" + + export DOTNET_INSTALL_DIR="$dotnet_root" + + if [[ ! -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then + if [[ "$install" == true ]]; then + InstallDotNetSdk "$dotnet_root" "$dotnet_sdk_version" + else + Write-PipelineTelemetryError -category 'InitializeToolset' "Unable to find dotnet with SDK version '$dotnet_sdk_version'" + ExitWithExitCode 1 + fi + fi + fi + + # Add dotnet to PATH. This prevents any bare invocation of dotnet in custom + # build steps from using anything other than what we've downloaded. + Write-PipelinePrependPath -path "$dotnet_root" + + Write-PipelineSetVariable -name "DOTNET_NOLOGO" -value "1" + + # return value + _InitializeDotNetCli="$dotnet_root" +} + +function InstallDotNetSdk { + local root=$1 + local version=$2 + local architecture="unset" + if [[ $# -ge 3 ]]; then + architecture=$3 + fi + InstallDotNet "$root" "$version" $architecture 'sdk' 'true' $runtime_source_feed $runtime_source_feed_key +} + +function InstallDotNet { + local root=$1 + local version=$2 + local runtime=$4 + + local dotnetVersionLabel="'$runtime v$version'" + if [[ -n "${4:-}" ]] && [ "$4" != 'sdk' ]; then + runtimePath="$root" + runtimePath="$runtimePath/shared" + case "$runtime" in + dotnet) + runtimePath="$runtimePath/Microsoft.NETCore.App" + ;; + aspnetcore) + runtimePath="$runtimePath/Microsoft.AspNetCore.App" + ;; + windowsdesktop) + runtimePath="$runtimePath/Microsoft.WindowsDesktop.App" + ;; + *) + ;; + esac + runtimePath="$runtimePath/$version" + + dotnetVersionLabel="runtime toolset '$runtime/$architecture v$version'" + + if [ -d "$runtimePath" ]; then + echo " Runtime toolset '$runtime/$architecture v$version' already installed." + local installSuccess=1 + return + fi + fi + + GetDotNetInstallScript "$root" + local install_script=$_GetDotNetInstallScript + + local installParameters=(--version $version --install-dir "$root") + + if [[ -n "${3:-}" ]] && [ "$3" != 'unset' ]; then + installParameters+=(--architecture $3) + fi + if [[ -n "${4:-}" ]] && [ "$4" != 'sdk' ]; then + installParameters+=(--runtime $4) + fi + if [[ "$#" -ge "5" ]] && [[ "$5" != 'false' ]]; then + installParameters+=(--skip-non-versioned-files) + fi + + local variations=() # list of variable names with parameter arrays in them + + local public_location=("${installParameters[@]}") + variations+=(public_location) + + local dotnetbuilds=("${installParameters[@]}" --azure-feed "https://ci.dot.net/public") + variations+=(dotnetbuilds) + + if [[ -n "${6:-}" ]]; then + variations+=(private_feed) + local private_feed=("${installParameters[@]}" --azure-feed $6) + if [[ -n "${7:-}" ]]; then + # The 'base64' binary on alpine uses '-d' and doesn't support '--decode' + # '-d'. To work around this, do a simple detection and switch the parameter + # accordingly. + decodeArg="--decode" + if base64 --help 2>&1 | grep -q "BusyBox"; then + decodeArg="-d" + fi + decodedFeedKey=`echo $7 | base64 $decodeArg` + private_feed+=(--feed-credential $decodedFeedKey) + fi + fi + + local installSuccess=0 + for variationName in "${variations[@]}"; do + local name="$variationName[@]" + local variation=("${!name}") + echo " Attempting to install $dotnetVersionLabel from $variationName." + bash "$install_script" "${variation[@]}" && installSuccess=1 + if [[ "$installSuccess" -eq 1 ]]; then + break + fi + + echo " Failed to install $dotnetVersionLabel from $variationName." + done + + if [[ "$installSuccess" -eq 0 ]]; then + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install $dotnetVersionLabel from any of the specified locations." + ExitWithExitCode 1 + fi +} + +function with_retries { + local maxRetries=5 + local retries=1 + echo "Trying to run '$@' for maximum of $maxRetries attempts." + while [[ $((retries++)) -le $maxRetries ]]; do + "$@" + + if [[ $? == 0 ]]; then + echo "Ran '$@' successfully." + return 0 + fi + + timeout=$((3**$retries-1)) + echo "Failed to execute '$@'. Waiting $timeout seconds before next attempt ($retries out of $maxRetries)." 1>&2 + sleep $timeout + done + + echo "Failed to execute '$@' for $maxRetries times." 1>&2 + + return 1 +} + +function GetDotNetInstallScript { + local root=$1 + local install_script="$root/dotnet-install.sh" + local install_script_url="https://builds.dotnet.microsoft.com/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh" + local timestamp_file="$root/.dotnet-install.timestamp" + local should_download=false + + if [[ ! -a "$install_script" ]]; then + should_download=true + elif [[ -f "$timestamp_file" ]]; then + # Check if the script is older than 30 days using timestamp file + local download_time=$(cat "$timestamp_file" 2>/dev/null || echo "0") + local current_time=$(date +%s) + local age_seconds=$((current_time - download_time)) + + # 30 days = 30 * 24 * 60 * 60 = 2592000 seconds + if [[ $age_seconds -gt 2592000 ]]; then + echo "Existing install script is too old, re-downloading..." + should_download=true + fi + else + # No timestamp file exists, assume script is old and re-download + echo "No timestamp found for existing install script, re-downloading..." + should_download=true + fi + + if [[ "$should_download" == true ]]; then + mkdir -p "$root" + + echo "Downloading '$install_script_url'" + + # Use curl if available, otherwise use wget + if command -v curl > /dev/null; then + # first, try directly, if this fails we will retry with verbose logging + curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || { + if command -v openssl &> /dev/null; then + echo "Curl failed; dumping some information about dotnet.microsoft.com for later investigation" + echo | openssl s_client -showcerts -servername dotnet.microsoft.com -connect dotnet.microsoft.com:443 || true + fi + echo "Will now retry the same URL with verbose logging." + with_retries curl "$install_script_url" -sSL --verbose --retry 10 --create-dirs -o "$install_script" || { + local exit_code=$? + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." + ExitWithExitCode $exit_code + } + } + else + with_retries wget -v -O "$install_script" "$install_script_url" || { + local exit_code=$? + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." + ExitWithExitCode $exit_code + } + fi + + # Create timestamp file to track download time in seconds from epoch + date +%s > "$timestamp_file" + fi + # return value + _GetDotNetInstallScript="$install_script" +} + +function InitializeBuildTool { + if [[ -n "${_InitializeBuildTool:-}" ]]; then + return + fi + + InitializeDotNetCli $restore + + # return values + _InitializeBuildTool="$_InitializeDotNetCli/dotnet" + _InitializeBuildToolCommand="msbuild" +} + +function GetNuGetPackageCachePath { + if [[ -z ${NUGET_PACKAGES:-} ]]; then + if [[ "$use_global_nuget_cache" == true ]]; then + export NUGET_PACKAGES="$HOME/.nuget/packages/" + else + export NUGET_PACKAGES="$repo_root/.packages/" + fi + fi + + # return value + _GetNuGetPackageCachePath=$NUGET_PACKAGES +} + +function InitializeNativeTools() { + if [[ -n "${DisableNativeToolsetInstalls:-}" ]]; then + return + fi + if grep -Fq "native-tools" $global_json_file + then + local nativeArgs="" + if [[ "$ci" == true ]]; then + nativeArgs="--installDirectory $tools_dir" + fi + "$_script_dir/init-tools-native.sh" $nativeArgs + fi +} + +function InitializeToolset { + if [[ -n "${_InitializeToolset:-}" ]]; then + return + fi + + GetNuGetPackageCachePath + + ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk" + + local toolset_version=$_ReadGlobalVersion + local toolset_location_file="$toolset_dir/$toolset_version.txt" + + if [[ -a "$toolset_location_file" ]]; then + local path=`cat "$toolset_location_file"` + if [[ -a "$path" ]]; then + # return value + _InitializeToolset="$path" + return + fi + fi + + if [[ "$restore" != true ]]; then + Write-PipelineTelemetryError -category 'InitializeToolset' "Toolset version $toolset_version has not been restored." + ExitWithExitCode 2 + fi + + local proj="$toolset_dir/restore.proj" + + local bl="" + if [[ "$binary_log" == true ]]; then + bl="/bl:$log_dir/ToolsetRestore.binlog" + fi + + echo '' > "$proj" + MSBuild-Core "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file" + + local toolset_build_proj=`cat "$toolset_location_file"` + + if [[ ! -a "$toolset_build_proj" ]]; then + Write-PipelineTelemetryError -category 'Build' "Invalid toolset path: $toolset_build_proj" + ExitWithExitCode 3 + fi + + # return value + _InitializeToolset="$toolset_build_proj" +} + +function ExitWithExitCode { + if [[ "$ci" == true && "$prepare_machine" == true ]]; then + StopProcesses + fi + exit $1 +} + +function StopProcesses { + echo "Killing running build processes..." + pkill -9 "dotnet" || true + pkill -9 "vbcscompiler" || true + return 0 +} + +function MSBuild { + local args=( "$@" ) + if [[ "$pipelines_log" == true ]]; then + InitializeBuildTool + InitializeToolset + + if [[ "$ci" == true ]]; then + export NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20 + export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 + Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20" + Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20" + fi + + local toolset_dir="${_InitializeToolset%/*}" + local selectedPath="$toolset_dir/net/Microsoft.DotNet.ArcadeLogging.dll" + + if [[ -z "$selectedPath" ]]; then + Write-PipelineTelemetryError -category 'Build' "Unable to find arcade sdk logger assembly: $selectedPath" + ExitWithExitCode 1 + fi + + args+=( "-logger:$selectedPath" ) + fi + + MSBuild-Core "${args[@]}" +} + +function MSBuild-Core { + if [[ "$ci" == true ]]; then + if [[ "$binary_log" != true && "$exclude_ci_binary_log" != true ]]; then + Write-PipelineTelemetryError -category 'Build' "Binary log must be enabled in CI build, or explicitly opted-out from with the -noBinaryLog switch." + ExitWithExitCode 1 + fi + + if [[ "$node_reuse" == true ]]; then + Write-PipelineTelemetryError -category 'Build' "Node reuse must be disabled in CI build." + ExitWithExitCode 1 + fi + fi + + InitializeBuildTool + + local warnaserror_switch="" + if [[ $warn_as_error == true ]]; then + warnaserror_switch="/warnaserror" + fi + + function RunBuildTool { + export ARCADE_BUILD_TOOL_COMMAND="$_InitializeBuildTool $@" + + "$_InitializeBuildTool" "$@" || { + local exit_code=$? + # We should not Write-PipelineTaskError here because that message shows up in the build summary + # The build already logged an error, that's the reason it failed. Producing an error here only adds noise. + echo "Build failed with exit code $exit_code. Check errors above." + + # When running on Azure Pipelines, override the returned exit code to avoid double logging. + # Skip this when the build is a child of the VMR build. + if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$from_vmr" != true ]]; then + Write-PipelineSetResult -result "Failed" -message "msbuild execution failed." + # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error + # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error + ExitWithExitCode 0 + else + ExitWithExitCode $exit_code + fi + } + } + + RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" +} + +function GetDarc { + darc_path="$temp_dir/darc" + version="$1" + + if [[ -n "$version" ]]; then + version="--darcversion $version" + fi + + "$eng_root/common/darc-init.sh" --toolpath "$darc_path" $version + darc_tool="$darc_path/darc" +} + +# Returns a full path to an Arcade SDK task project file. +function GetSdkTaskProject { + taskName=$1 + echo "$(dirname $_InitializeToolset)/SdkTasks/$taskName.proj" +} + +ResolvePath "${BASH_SOURCE[0]}" +_script_dir=`dirname "$_ResolvePath"` + +. "$_script_dir/pipeline-logging-functions.sh" + +eng_root=`cd -P "$_script_dir/.." && pwd` +repo_root=`cd -P "$_script_dir/../.." && pwd` +repo_root="${repo_root}/" +artifacts_dir="${repo_root}artifacts" +toolset_dir="$artifacts_dir/toolset" +tools_dir="${repo_root}.tools" +log_dir="$artifacts_dir/log/$configuration" +temp_dir="$artifacts_dir/tmp/$configuration" + +global_json_file="${repo_root}global.json" +# determine if global.json contains a "runtimes" entry +global_json_has_runtimes=false +if command -v jq &> /dev/null; then + if jq -e '.tools | has("runtimes")' "$global_json_file" &> /dev/null; then + global_json_has_runtimes=true + fi +elif [[ "$(cat "$global_json_file")" =~ \"runtimes\"[[:space:]\:]*\{ ]]; then + global_json_has_runtimes=true +fi + +# HOME may not be defined in some scenarios, but it is required by NuGet +if [[ -z $HOME ]]; then + export HOME="${repo_root}artifacts/.home/" + mkdir -p "$HOME" +fi + +mkdir -p "$toolset_dir" +mkdir -p "$temp_dir" +mkdir -p "$log_dir" + +Write-PipelineSetVariable -name "Artifacts" -value "$artifacts_dir" +Write-PipelineSetVariable -name "Artifacts.Toolset" -value "$toolset_dir" +Write-PipelineSetVariable -name "Artifacts.Log" -value "$log_dir" +Write-PipelineSetVariable -name "Temp" -value "$temp_dir" +Write-PipelineSetVariable -name "TMP" -value "$temp_dir" + +# Import custom tools configuration, if present in the repo. +if [ -z "${disable_configure_toolset_import:-}" ]; then + configure_toolset_script="$eng_root/configure-toolset.sh" + if [[ -a "$configure_toolset_script" ]]; then + . "$configure_toolset_script" + fi +fi + +# TODO: https://github.com/dotnet/arcade/issues/1468 +# Temporary workaround to avoid breaking change. +# Remove once repos are updated. +if [[ -n "${useInstalledDotNetCli:-}" ]]; then + use_installed_dotnet_cli="$useInstalledDotNetCli" +fi diff --git a/eng/common/vmr-sync.ps1 b/eng/common/vmr-sync.ps1 new file mode 100644 index 0000000000000..97302f3205be9 --- /dev/null +++ b/eng/common/vmr-sync.ps1 @@ -0,0 +1,138 @@ +<# +.SYNOPSIS + +This script is used for synchronizing the current repository into a local VMR. +It pulls the current repository's code into the specified VMR directory for local testing or +Source-Build validation. + +.DESCRIPTION + +The tooling used for synchronization will clone the VMR repository into a temporary folder if +it does not already exist. These clones can be reused in future synchronizations, so it is +recommended to dedicate a folder for this to speed up re-runs. + +.EXAMPLE + Synchronize current repository into a local VMR: + ./vmr-sync.ps1 -vmrDir "$HOME/repos/dotnet" -tmpDir "$HOME/repos/tmp" + +.PARAMETER tmpDir +Required. Path to the temporary folder where repositories will be cloned + +.PARAMETER vmrBranch +Optional. Branch of the 'dotnet/dotnet' repo to synchronize. The VMR will be checked out to this branch + +.PARAMETER azdevPat +Optional. Azure DevOps PAT to use for cloning private repositories. + +.PARAMETER vmrDir +Optional. Path to the dotnet/dotnet repository. When null, gets cloned to the temporary folder + +.PARAMETER debugOutput +Optional. Enables debug logging in the darc vmr command. + +.PARAMETER ci +Optional. Denotes that the script is running in a CI environment. +#> +param ( + [Parameter(Mandatory=$true, HelpMessage="Path to the temporary folder where repositories will be cloned")] + [string][Alias('t', 'tmp')]$tmpDir, + [string][Alias('b', 'branch')]$vmrBranch, + [string]$remote, + [string]$azdevPat, + [string][Alias('v', 'vmr')]$vmrDir, + [switch]$ci, + [switch]$debugOutput +) + +function Fail { + Write-Host "> $($args[0])" -ForegroundColor 'Red' +} + +function Highlight { + Write-Host "> $($args[0])" -ForegroundColor 'Cyan' +} + +$verbosity = 'verbose' +if ($debugOutput) { + $verbosity = 'debug' +} +# Validation + +if (-not $tmpDir) { + Fail "Missing -tmpDir argument. Please specify the path to the temporary folder where the repositories will be cloned" + exit 1 +} + +# Sanitize the input + +if (-not $vmrDir) { + $vmrDir = Join-Path $tmpDir 'dotnet' +} + +if (-not (Test-Path -Path $tmpDir -PathType Container)) { + New-Item -ItemType Directory -Path $tmpDir | Out-Null +} + +# Prepare the VMR + +if (-not (Test-Path -Path $vmrDir -PathType Container)) { + Highlight "Cloning 'dotnet/dotnet' into $vmrDir.." + git clone https://github.com/dotnet/dotnet $vmrDir + + if ($vmrBranch) { + git -C $vmrDir switch -c $vmrBranch + } +} +else { + if ((git -C $vmrDir diff --quiet) -eq $false) { + Fail "There are changes in the working tree of $vmrDir. Please commit or stash your changes" + exit 1 + } + + if ($vmrBranch) { + Highlight "Preparing $vmrDir" + git -C $vmrDir checkout $vmrBranch + git -C $vmrDir pull + } +} + +Set-StrictMode -Version Latest + +# Prepare darc + +Highlight 'Installing .NET, preparing the tooling..' +. .\eng\common\tools.ps1 +$dotnetRoot = InitializeDotNetCli -install:$true +$darc = Get-Darc +$dotnet = "$dotnetRoot\dotnet.exe" + +Highlight "Starting the synchronization of VMR.." + +# Synchronize the VMR +$darcArgs = ( + "vmr", "forwardflow", + "--tmp", $tmpDir, + "--$verbosity", + $vmrDir +) + +if ($ci) { + $darcArgs += ("--ci") +} + +if ($azdevPat) { + $darcArgs += ("--azdev-pat", $azdevPat) +} + +& "$darc" $darcArgs + +if ($LASTEXITCODE -eq 0) { + Highlight "Synchronization succeeded" +} +else { + Fail "Synchronization of repo to VMR failed!" + Fail "'$vmrDir' is left in its last state (re-run of this script will reset it)." + Fail "Please inspect the logs which contain path to the failing patch file (use -debugOutput to get all the details)." + Fail "Once you make changes to the conflicting VMR patch, commit it locally and re-run this script." + exit 1 +} diff --git a/eng/common/vmr-sync.sh b/eng/common/vmr-sync.sh new file mode 100644 index 0000000000000..44239e331c0cc --- /dev/null +++ b/eng/common/vmr-sync.sh @@ -0,0 +1,207 @@ +#!/bin/bash + +### This script is used for synchronizing the current repository into a local VMR. +### It pulls the current repository's code into the specified VMR directory for local testing or +### Source-Build validation. +### +### The tooling used for synchronization will clone the VMR repository into a temporary folder if +### it does not already exist. These clones can be reused in future synchronizations, so it is +### recommended to dedicate a folder for this to speed up re-runs. +### +### USAGE: +### Synchronize current repository into a local VMR: +### ./vmr-sync.sh --tmp "$HOME/repos/tmp" "$HOME/repos/dotnet" +### +### Options: +### -t, --tmp, --tmp-dir PATH +### Required. Path to the temporary folder where repositories will be cloned +### +### -b, --branch, --vmr-branch BRANCH_NAME +### Optional. Branch of the 'dotnet/dotnet' repo to synchronize. The VMR will be checked out to this branch +### +### --debug +### Optional. Turns on the most verbose logging for the VMR tooling +### +### --remote name:URI +### Optional. Additional remote to use during the synchronization +### This can be used to synchronize to a commit from a fork of the repository +### Example: 'runtime:https://github.com/yourfork/runtime' +### +### --azdev-pat +### Optional. Azure DevOps PAT to use for cloning private repositories. +### +### -v, --vmr, --vmr-dir PATH +### Optional. Path to the dotnet/dotnet repository. When null, gets cloned to the temporary folder + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +function print_help () { + sed -n '/^### /,/^$/p' "$source" | cut -b 5- +} + +COLOR_RED=$(tput setaf 1 2>/dev/null || true) +COLOR_CYAN=$(tput setaf 6 2>/dev/null || true) +COLOR_CLEAR=$(tput sgr0 2>/dev/null || true) +COLOR_RESET=uniquesearchablestring +FAILURE_PREFIX='> ' + +function fail () { + echo "${COLOR_RED}$FAILURE_PREFIX${1//${COLOR_RESET}/${COLOR_RED}}${COLOR_CLEAR}" >&2 +} + +function highlight () { + echo "${COLOR_CYAN}$FAILURE_PREFIX${1//${COLOR_RESET}/${COLOR_CYAN}}${COLOR_CLEAR}" +} + +tmp_dir='' +vmr_dir='' +vmr_branch='' +additional_remotes='' +verbosity=verbose +azdev_pat='' +ci=false + +while [[ $# -gt 0 ]]; do + opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + -t|--tmp|--tmp-dir) + tmp_dir=$2 + shift + ;; + -v|--vmr|--vmr-dir) + vmr_dir=$2 + shift + ;; + -b|--branch|--vmr-branch) + vmr_branch=$2 + shift + ;; + --remote) + additional_remotes="$additional_remotes $2" + shift + ;; + --azdev-pat) + azdev_pat=$2 + shift + ;; + --ci) + ci=true + ;; + -d|--debug) + verbosity=debug + ;; + -h|--help) + print_help + exit 0 + ;; + *) + fail "Invalid argument: $1" + print_help + exit 1 + ;; + esac + + shift +done + +# Validation + +if [[ -z "$tmp_dir" ]]; then + fail "Missing --tmp-dir argument. Please specify the path to the temporary folder where the repositories will be cloned" + exit 1 +fi + +# Sanitize the input + +if [[ -z "$vmr_dir" ]]; then + vmr_dir="$tmp_dir/dotnet" +fi + +if [[ ! -d "$tmp_dir" ]]; then + mkdir -p "$tmp_dir" +fi + +if [[ "$verbosity" == "debug" ]]; then + set -x +fi + +# Prepare the VMR + +if [[ ! -d "$vmr_dir" ]]; then + highlight "Cloning 'dotnet/dotnet' into $vmr_dir.." + git clone https://github.com/dotnet/dotnet "$vmr_dir" + + if [[ -n "$vmr_branch" ]]; then + git -C "$vmr_dir" switch -c "$vmr_branch" + fi +else + if ! git -C "$vmr_dir" diff --quiet; then + fail "There are changes in the working tree of $vmr_dir. Please commit or stash your changes" + exit 1 + fi + + if [[ -n "$vmr_branch" ]]; then + highlight "Preparing $vmr_dir" + git -C "$vmr_dir" checkout "$vmr_branch" + git -C "$vmr_dir" pull + fi +fi + +set -e + +# Prepare darc + +highlight 'Installing .NET, preparing the tooling..' +source "./eng/common/tools.sh" +InitializeDotNetCli true +GetDarc +dotnetDir=$( cd ./.dotnet/; pwd -P ) +dotnet=$dotnetDir/dotnet + +highlight "Starting the synchronization of VMR.." +set +e + +if [[ -n "$additional_remotes" ]]; then + additional_remotes="--additional-remotes $additional_remotes" +fi + +if [[ -n "$azdev_pat" ]]; then + azdev_pat="--azdev-pat $azdev_pat" +fi + +ci_arg='' +if [[ "$ci" == "true" ]]; then + ci_arg="--ci" +fi + +# Synchronize the VMR + +export DOTNET_ROOT="$dotnetDir" + +"$darc_tool" vmr forwardflow \ + --tmp "$tmp_dir" \ + $azdev_pat \ + --$verbosity \ + $ci_arg \ + $additional_remotes \ + "$vmr_dir" + +if [[ $? == 0 ]]; then + highlight "Synchronization succeeded" +else + fail "Synchronization of repo to VMR failed!" + fail "'$vmr_dir' is left in its last state (re-run of this script will reset it)." + fail "Please inspect the logs which contain path to the failing patch file (use --debug to get all the details)." + fail "Once you make changes to the conflicting VMR patch, commit it locally and re-run this script." + exit 1 +fi diff --git a/es-metadata.yml b/es-metadata.yml new file mode 100644 index 0000000000000..d673c5a5ed346 --- /dev/null +++ b/es-metadata.yml @@ -0,0 +1,8 @@ +schemaVersion: 0.0.1 +isProduction: true +accountableOwners: + service: 188124fe-9943-469c-b4bc-959d6f2ceda4 +routing: + defaultAreaPath: + org: devdiv + path: DevDiv\NET Runtime\WebAssembly diff --git a/flang/docs/InternalProcedureTrampolines.md b/flang/docs/InternalProcedureTrampolines.md index ef02f1d737c82..41f6155332a47 100644 --- a/flang/docs/InternalProcedureTrampolines.md +++ b/flang/docs/InternalProcedureTrampolines.md @@ -239,7 +239,7 @@ automatically deallocated at the end of `host()` invocation. Unfortunately, this requires the program stack to be writeable and executable at the same time, which might be a security concern. -> NOTE: LLVM's AArch64 backend supports `nest` attribute, but it does not seem to support trampoline intrinsics. +> NOTE: LLVM's AArch64 backend supports `nest` attribute, but it requires the compiler-rt runtime selected via the `-rtlib=compiler-rt` flag. ## Alternative implementation(s) diff --git a/flang/include/flang/Lower/ConvertVariable.h b/flang/include/flang/Lower/ConvertVariable.h index 515f4695951b4..de394a39e112e 100644 --- a/flang/include/flang/Lower/ConvertVariable.h +++ b/flang/include/flang/Lower/ConvertVariable.h @@ -62,6 +62,14 @@ using AggregateStoreMap = llvm::DenseMap; void instantiateVariable(AbstractConverter &, const pft::Variable &var, SymMap &symMap, AggregateStoreMap &storeMap); +/// Does this variable have a default initialization? +bool hasDefaultInitialization(const Fortran::semantics::Symbol &sym); + +/// Call default initialization runtime routine to initialize \p var. +void defaultInitializeAtRuntime(Fortran::lower::AbstractConverter &converter, + const Fortran::semantics::Symbol &sym, + Fortran::lower::SymMap &symMap); + /// Create a fir::GlobalOp given a module variable definition. This is intended /// to be used when lowering a module definition, not when lowering variables /// used from a module. For used variables instantiateVariable must directly be diff --git a/flang/lib/Lower/ConvertVariable.cpp b/flang/lib/Lower/ConvertVariable.cpp index 47ad48fb322cc..4fcfa0b126e04 100644 --- a/flang/lib/Lower/ConvertVariable.cpp +++ b/flang/lib/Lower/ConvertVariable.cpp @@ -72,7 +72,8 @@ static mlir::Value genScalarValue(Fortran::lower::AbstractConverter &converter, } /// Does this variable have a default initialization? -static bool hasDefaultInitialization(const Fortran::semantics::Symbol &sym) { +bool Fortran::lower::hasDefaultInitialization( + const Fortran::semantics::Symbol &sym) { if (sym.has() && sym.size()) if (!Fortran::semantics::IsAllocatableOrPointer(sym)) if (const Fortran::semantics::DeclTypeSpec *declTypeSpec = sym.GetType()) @@ -353,7 +354,7 @@ static mlir::Value genComponentDefaultInit( // global constructor since this has no runtime cost. componentValue = fir::factory::createUnallocatedBox( builder, loc, componentTy, std::nullopt); - } else if (hasDefaultInitialization(component)) { + } else if (Fortran::lower::hasDefaultInitialization(component)) { // Component type has default initialization. componentValue = genDefaultInitializerValue(converter, loc, component, componentTy, stmtCtx); @@ -556,7 +557,7 @@ static fir::GlobalOp defineGlobal(Fortran::lower::AbstractConverter &converter, builder.createConvert(loc, symTy, fir::getBase(initVal)); builder.create(loc, castTo); }); - } else if (hasDefaultInitialization(sym)) { + } else if (Fortran::lower::hasDefaultInitialization(sym)) { Fortran::lower::createGlobalInitialization( builder, global, [&](fir::FirOpBuilder &builder) { Fortran::lower::StatementContext stmtCtx( @@ -752,17 +753,15 @@ mustBeDefaultInitializedAtRuntime(const Fortran::lower::pft::Variable &var) { return true; // Local variables (including function results), and intent(out) dummies must // be default initialized at runtime if their type has default initialization. - return hasDefaultInitialization(sym); + return Fortran::lower::hasDefaultInitialization(sym); } /// Call default initialization runtime routine to initialize \p var. -static void -defaultInitializeAtRuntime(Fortran::lower::AbstractConverter &converter, - const Fortran::lower::pft::Variable &var, - Fortran::lower::SymMap &symMap) { +void Fortran::lower::defaultInitializeAtRuntime( + Fortran::lower::AbstractConverter &converter, + const Fortran::semantics::Symbol &sym, Fortran::lower::SymMap &symMap) { fir::FirOpBuilder &builder = converter.getFirOpBuilder(); mlir::Location loc = converter.getCurrentLocation(); - const Fortran::semantics::Symbol &sym = var.getSymbol(); fir::ExtendedValue exv = converter.getSymbolExtendedValue(sym, &symMap); if (Fortran::semantics::IsOptional(sym)) { // 15.5.2.12 point 3, absent optional dummies are not initialized. @@ -927,7 +926,8 @@ static void instantiateLocal(Fortran::lower::AbstractConverter &converter, if (needDummyIntentoutFinalization(var)) finalizeAtRuntime(converter, var, symMap); if (mustBeDefaultInitializedAtRuntime(var)) - defaultInitializeAtRuntime(converter, var, symMap); + Fortran::lower::defaultInitializeAtRuntime(converter, var.getSymbol(), + symMap); if (Fortran::semantics::NeedCUDAAlloc(var.getSymbol())) { auto *builder = &converter.getFirOpBuilder(); mlir::Location loc = converter.getCurrentLocation(); @@ -1168,7 +1168,8 @@ static void instantiateAlias(Fortran::lower::AbstractConverter &converter, // do not try optimizing this to single default initializations of // the equivalenced storages. Keep lowering simple. if (mustBeDefaultInitializedAtRuntime(var)) - defaultInitializeAtRuntime(converter, var, symMap); + Fortran::lower::defaultInitializeAtRuntime(converter, var.getSymbol(), + symMap); } //===--------------------------------------------------------------===// diff --git a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp index 7e76a81e0df92..a340b62eb7b66 100644 --- a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp +++ b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp @@ -13,6 +13,7 @@ #include "DataSharingProcessor.h" #include "Utils.h" +#include "flang/Lower/ConvertVariable.h" #include "flang/Lower/PFTBuilder.h" #include "flang/Lower/SymbolMap.h" #include "flang/Optimizer/Builder/HLFIRTools.h" @@ -117,6 +118,11 @@ void DataSharingProcessor::cloneSymbol(const semantics::Symbol *sym) { bool success = converter.createHostAssociateVarClone(*sym); (void)success; assert(success && "Privatization failed due to existing binding"); + + bool isFirstPrivate = sym->test(semantics::Symbol::Flag::OmpFirstPrivate); + if (!isFirstPrivate && + Fortran::lower::hasDefaultInitialization(sym->GetUltimate())) + Fortran::lower::defaultInitializeAtRuntime(converter, *sym, *symTable); } void DataSharingProcessor::copyFirstPrivateSymbol( diff --git a/flang/lib/Optimizer/Builder/FIRBuilder.cpp b/flang/lib/Optimizer/Builder/FIRBuilder.cpp index 2961df96b3cab..fbe79d0e45e5a 100644 --- a/flang/lib/Optimizer/Builder/FIRBuilder.cpp +++ b/flang/lib/Optimizer/Builder/FIRBuilder.cpp @@ -1541,21 +1541,44 @@ mlir::Value fir::factory::genMaxWithZero(fir::FirOpBuilder &builder, zero); } +static std::pair +genCPtrOrCFunptrFieldIndex(fir::FirOpBuilder &builder, mlir::Location loc, + mlir::Type cptrTy) { + auto recTy = mlir::cast(cptrTy); + assert(recTy.getTypeList().size() == 1); + auto addrFieldName = recTy.getTypeList()[0].first; + mlir::Type addrFieldTy = recTy.getTypeList()[0].second; + auto fieldIndexType = fir::FieldType::get(cptrTy.getContext()); + mlir::Value addrFieldIndex = builder.create( + loc, fieldIndexType, addrFieldName, recTy, + /*typeParams=*/mlir::ValueRange{}); + return {addrFieldIndex, addrFieldTy}; +} + mlir::Value fir::factory::genCPtrOrCFunptrAddr(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value cPtr, mlir::Type ty) { - assert(mlir::isa(ty)); - auto recTy = mlir::dyn_cast(ty); - assert(recTy.getTypeList().size() == 1); - auto fieldName = recTy.getTypeList()[0].first; - mlir::Type fieldTy = recTy.getTypeList()[0].second; - auto fieldIndexType = fir::FieldType::get(ty.getContext()); - mlir::Value field = - builder.create(loc, fieldIndexType, fieldName, recTy, - /*typeParams=*/mlir::ValueRange{}); - return builder.create(loc, builder.getRefType(fieldTy), - cPtr, field); + auto [addrFieldIndex, addrFieldTy] = + genCPtrOrCFunptrFieldIndex(builder, loc, ty); + return builder.create(loc, builder.getRefType(addrFieldTy), + cPtr, addrFieldIndex); +} + +mlir::Value fir::factory::genCPtrOrCFunptrValue(fir::FirOpBuilder &builder, + mlir::Location loc, + mlir::Value cPtr) { + mlir::Type cPtrTy = fir::unwrapRefType(cPtr.getType()); + if (fir::isa_ref_type(cPtr.getType())) { + mlir::Value cPtrAddr = + fir::factory::genCPtrOrCFunptrAddr(builder, loc, cPtr, cPtrTy); + return builder.create(loc, cPtrAddr); + } + auto [addrFieldIndex, addrFieldTy] = + genCPtrOrCFunptrFieldIndex(builder, loc, cPtrTy); + auto arrayAttr = + builder.getArrayAttr({builder.getIntegerAttr(builder.getIndexType(), 0)}); + return builder.create(loc, addrFieldTy, cPtr, arrayAttr); } fir::BoxValue fir::factory::createBoxValue(fir::FirOpBuilder &builder, @@ -1596,15 +1619,6 @@ fir::BoxValue fir::factory::createBoxValue(fir::FirOpBuilder &builder, return fir::BoxValue(box, lbounds, explicitTypeParams); } -mlir::Value fir::factory::genCPtrOrCFunptrValue(fir::FirOpBuilder &builder, - mlir::Location loc, - mlir::Value cPtr) { - mlir::Type cPtrTy = fir::unwrapRefType(cPtr.getType()); - mlir::Value cPtrAddr = - fir::factory::genCPtrOrCFunptrAddr(builder, loc, cPtr, cPtrTy); - return builder.create(loc, cPtrAddr); -} - mlir::Value fir::factory::createNullBoxProc(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Type boxType) { diff --git a/flang/lib/Optimizer/Transforms/AbstractResult.cpp b/flang/lib/Optimizer/Transforms/AbstractResult.cpp index 3906aa553cb34..ff37310224e85 100644 --- a/flang/lib/Optimizer/Transforms/AbstractResult.cpp +++ b/flang/lib/Optimizer/Transforms/AbstractResult.cpp @@ -59,14 +59,16 @@ static mlir::FunctionType getNewFunctionType(mlir::FunctionType funcTy, /*resultTypes=*/{}); } +static mlir::Type getVoidPtrType(mlir::MLIRContext *context) { + return fir::ReferenceType::get(mlir::NoneType::get(context)); +} + /// This is for function result types that are of type C_PTR from ISO_C_BINDING. /// Follow the ABI for interoperability with C. static mlir::FunctionType getCPtrFunctionType(mlir::FunctionType funcTy) { - auto resultType = funcTy.getResult(0); - assert(fir::isa_builtin_cptr_type(resultType)); - llvm::SmallVector outputTypes; - auto recTy = mlir::dyn_cast(resultType); - outputTypes.emplace_back(recTy.getTypeList()[0].second); + assert(fir::isa_builtin_cptr_type(funcTy.getResult(0))); + llvm::SmallVector outputTypes{ + getVoidPtrType(funcTy.getContext())}; return mlir::FunctionType::get(funcTy.getContext(), funcTy.getInputs(), outputTypes); } @@ -109,15 +111,11 @@ class CallConversion : public mlir::OpRewritePattern { saveResult.getTypeparams()); llvm::SmallVector newResultTypes; - // TODO: This should be generalized for derived types, and it is - // architecture and OS dependent. bool isResultBuiltinCPtr = fir::isa_builtin_cptr_type(result.getType()); - Op newOp; - if (isResultBuiltinCPtr) { - auto recTy = mlir::dyn_cast(result.getType()); - newResultTypes.emplace_back(recTy.getTypeList()[0].second); - } + if (isResultBuiltinCPtr) + newResultTypes.emplace_back(getVoidPtrType(result.getContext())); + Op newOp; // fir::CallOp specific handling. if constexpr (std::is_same_v) { if (op.getCallee()) { @@ -175,7 +173,7 @@ class CallConversion : public mlir::OpRewritePattern { FirOpBuilder builder(rewriter, module); mlir::Value saveAddr = fir::factory::genCPtrOrCFunptrAddr( builder, loc, save, result.getType()); - rewriter.create(loc, newOp->getResult(0), saveAddr); + builder.createStoreWithConvert(loc, newOp->getResult(0), saveAddr); } op->dropAllReferences(); rewriter.eraseOp(op); @@ -210,42 +208,52 @@ class ReturnOpConversion : public mlir::OpRewritePattern { mlir::PatternRewriter &rewriter) const override { auto loc = ret.getLoc(); rewriter.setInsertionPoint(ret); - auto returnedValue = ret.getOperand(0); - bool replacedStorage = false; - if (auto *op = returnedValue.getDefiningOp()) - if (auto load = mlir::dyn_cast(op)) { - auto resultStorage = load.getMemref(); - // The result alloca may be behind a fir.declare, if any. - if (auto declare = mlir::dyn_cast_or_null( - resultStorage.getDefiningOp())) - resultStorage = declare.getMemref(); - // TODO: This should be generalized for derived types, and it is - // architecture and OS dependent. - if (fir::isa_builtin_cptr_type(returnedValue.getType())) { - rewriter.eraseOp(load); - auto module = ret->getParentOfType(); - FirOpBuilder builder(rewriter, module); - mlir::Value retAddr = fir::factory::genCPtrOrCFunptrAddr( - builder, loc, resultStorage, returnedValue.getType()); - mlir::Value retValue = rewriter.create( - loc, fir::unwrapRefType(retAddr.getType()), retAddr); - rewriter.replaceOpWithNewOp( - ret, mlir::ValueRange{retValue}); - return mlir::success(); - } - resultStorage.replaceAllUsesWith(newArg); - replacedStorage = true; - if (auto *alloc = resultStorage.getDefiningOp()) - if (alloc->use_empty()) - rewriter.eraseOp(alloc); + mlir::Value resultValue = ret.getOperand(0); + fir::LoadOp resultLoad; + mlir::Value resultStorage; + // Identify result local storage. + if (auto load = resultValue.getDefiningOp()) { + resultLoad = load; + resultStorage = load.getMemref(); + // The result alloca may be behind a fir.declare, if any. + if (auto declare = resultStorage.getDefiningOp()) + resultStorage = declare.getMemref(); + } + // Replace old local storage with new storage argument, unless + // the derived type is C_PTR/C_FUN_PTR, in which case the return + // type is updated to return void* (no new argument is passed). + if (fir::isa_builtin_cptr_type(resultValue.getType())) { + auto module = ret->getParentOfType(); + FirOpBuilder builder(rewriter, module); + mlir::Value cptr = resultValue; + if (resultLoad) { + // Replace whole derived type load by component load. + cptr = resultLoad.getMemref(); + rewriter.setInsertionPoint(resultLoad); } - // The result storage may have been optimized out by a memory to - // register pass, this is possible for fir.box results, or fir.record - // with no length parameters. Simply store the result in the result storage. - // at the return point. - if (!replacedStorage) - rewriter.create(loc, returnedValue, newArg); - rewriter.replaceOpWithNewOp(ret); + mlir::Value newResultValue = + fir::factory::genCPtrOrCFunptrValue(builder, loc, cptr); + newResultValue = builder.createConvert( + loc, getVoidPtrType(ret.getContext()), newResultValue); + rewriter.setInsertionPoint(ret); + rewriter.replaceOpWithNewOp( + ret, mlir::ValueRange{newResultValue}); + } else if (resultStorage) { + resultStorage.replaceAllUsesWith(newArg); + rewriter.replaceOpWithNewOp(ret); + } else { + // The result storage may have been optimized out by a memory to + // register pass, this is possible for fir.box results, or fir.record + // with no length parameters. Simply store the result in the result + // storage. at the return point. + rewriter.create(loc, resultValue, newArg); + rewriter.replaceOpWithNewOp(ret); + } + // Delete result old local storage if unused. + if (resultStorage) + if (auto alloc = resultStorage.getDefiningOp()) + if (alloc->use_empty()) + rewriter.eraseOp(alloc); return mlir::success(); } @@ -263,8 +271,6 @@ class AddrOfOpConversion : public mlir::OpRewritePattern { mlir::PatternRewriter &rewriter) const override { auto oldFuncTy = mlir::cast(addrOf.getType()); mlir::FunctionType newFuncTy; - // TODO: This should be generalized for derived types, and it is - // architecture and OS dependent. if (oldFuncTy.getNumResults() != 0 && fir::isa_builtin_cptr_type(oldFuncTy.getResult(0))) newFuncTy = getCPtrFunctionType(oldFuncTy); @@ -298,8 +304,6 @@ class AbstractResultOpt // Convert function type itself if it has an abstract result. auto funcTy = mlir::cast(func.getFunctionType()); if (hasAbstractResult(funcTy)) { - // TODO: This should be generalized for derived types, and it is - // architecture and OS dependent. if (fir::isa_builtin_cptr_type(funcTy.getResult(0))) { func.setType(getCPtrFunctionType(funcTy)); patterns.insert(context, mlir::Value{}); diff --git a/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp b/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp index 685a8645fa2fc..8751a3b2c322f 100644 --- a/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp +++ b/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp @@ -66,6 +66,9 @@ class AddDebugInfoPass : public fir::impl::AddDebugInfoBase { void handleGlobalOp(fir::GlobalOp glocalOp, mlir::LLVM::DIFileAttr fileAttr, mlir::LLVM::DIScopeAttr scope, mlir::SymbolTable *symbolTable); + void handleFuncOp(mlir::func::FuncOp funcOp, mlir::LLVM::DIFileAttr fileAttr, + mlir::LLVM::DICompileUnitAttr cuAttr, + mlir::SymbolTable *symbolTable); }; static uint32_t getLineFromLoc(mlir::Location loc) { @@ -204,11 +207,112 @@ void AddDebugInfoPass::handleGlobalOp(fir::GlobalOp globalOp, globalOp->setLoc(builder.getFusedLoc({globalOp->getLoc()}, gvAttr)); } +void AddDebugInfoPass::handleFuncOp(mlir::func::FuncOp funcOp, + mlir::LLVM::DIFileAttr fileAttr, + mlir::LLVM::DICompileUnitAttr cuAttr, + mlir::SymbolTable *symbolTable) { + mlir::Location l = funcOp->getLoc(); + // If fused location has already been created then nothing to do + // Otherwise, create a fused location. + if (debugInfoIsAlreadySet(l)) + return; + + mlir::ModuleOp module = getOperation(); + mlir::MLIRContext *context = &getContext(); + mlir::OpBuilder builder(context); + llvm::StringRef fileName(fileAttr.getName()); + llvm::StringRef filePath(fileAttr.getDirectory()); + unsigned int CC = (funcOp.getName() == fir::NameUniquer::doProgramEntry()) + ? llvm::dwarf::getCallingConvention("DW_CC_program") + : llvm::dwarf::getCallingConvention("DW_CC_normal"); + + if (auto funcLoc = mlir::dyn_cast(l)) { + fileName = llvm::sys::path::filename(funcLoc.getFilename().getValue()); + filePath = llvm::sys::path::parent_path(funcLoc.getFilename().getValue()); + } + + mlir::StringAttr fullName = mlir::StringAttr::get(context, funcOp.getName()); + mlir::Attribute attr = funcOp->getAttr(fir::getInternalFuncNameAttrName()); + mlir::StringAttr funcName = + (attr) ? mlir::cast(attr) + : mlir::StringAttr::get(context, funcOp.getName()); + + auto result = fir::NameUniquer::deconstruct(funcName); + funcName = mlir::StringAttr::get(context, result.second.name); + + llvm::SmallVector types; + fir::DebugTypeGenerator typeGen(module); + for (auto resTy : funcOp.getResultTypes()) { + auto tyAttr = typeGen.convertType(resTy, fileAttr, cuAttr, funcOp.getLoc()); + types.push_back(tyAttr); + } + for (auto inTy : funcOp.getArgumentTypes()) { + auto tyAttr = typeGen.convertType(fir::unwrapRefType(inTy), fileAttr, + cuAttr, funcOp.getLoc()); + types.push_back(tyAttr); + } + + mlir::LLVM::DISubroutineTypeAttr subTypeAttr = + mlir::LLVM::DISubroutineTypeAttr::get(context, CC, types); + mlir::LLVM::DIFileAttr funcFileAttr = + mlir::LLVM::DIFileAttr::get(context, fileName, filePath); + + // Only definitions need a distinct identifier and a compilation unit. + mlir::DistinctAttr id; + mlir::LLVM::DIScopeAttr Scope = fileAttr; + mlir::LLVM::DICompileUnitAttr compilationUnit; + mlir::LLVM::DISubprogramFlags subprogramFlags = + mlir::LLVM::DISubprogramFlags{}; + if (isOptimized) + subprogramFlags = mlir::LLVM::DISubprogramFlags::Optimized; + if (!funcOp.isExternal()) { + id = mlir::DistinctAttr::create(mlir::UnitAttr::get(context)); + compilationUnit = cuAttr; + subprogramFlags = + subprogramFlags | mlir::LLVM::DISubprogramFlags::Definition; + } + unsigned line = getLineFromLoc(l); + if (fir::isInternalProcedure(funcOp)) { + // For contained functions, the scope is the parent subroutine. + mlir::SymbolRefAttr sym = mlir::cast( + funcOp->getAttr(fir::getHostSymbolAttrName())); + if (sym) { + if (auto func = + symbolTable->lookup(sym.getLeafReference())) { + // Make sure that parent is processed. + handleFuncOp(func, fileAttr, cuAttr, symbolTable); + if (auto fusedLoc = + mlir::dyn_cast_if_present(func.getLoc())) { + if (auto spAttr = + mlir::dyn_cast_if_present( + fusedLoc.getMetadata())) + Scope = spAttr; + } + } + } + } else if (!result.second.modules.empty()) { + Scope = getOrCreateModuleAttr(result.second.modules[0], fileAttr, cuAttr, + line - 1, false); + } + + auto spAttr = mlir::LLVM::DISubprogramAttr::get( + context, id, compilationUnit, Scope, funcName, fullName, funcFileAttr, + line, line, subprogramFlags, subTypeAttr); + funcOp->setLoc(builder.getFusedLoc({funcOp->getLoc()}, spAttr)); + + // Don't process variables if user asked for line tables only. + if (debugLevel == mlir::LLVM::DIEmissionKind::LineTablesOnly) + return; + + funcOp.walk([&](fir::cg::XDeclareOp declOp) { + handleDeclareOp(declOp, fileAttr, spAttr, typeGen, symbolTable); + }); +} + void AddDebugInfoPass::runOnOperation() { mlir::ModuleOp module = getOperation(); mlir::MLIRContext *context = &getContext(); mlir::SymbolTable symbolTable(module); - mlir::OpBuilder builder(context); llvm::StringRef fileName; std::string filePath; // We need 2 type of file paths here. @@ -245,80 +349,7 @@ void AddDebugInfoPass::runOnOperation() { isOptimized, debugLevel); module.walk([&](mlir::func::FuncOp funcOp) { - mlir::Location l = funcOp->getLoc(); - // If fused location has already been created then nothing to do - // Otherwise, create a fused location. - if (debugInfoIsAlreadySet(l)) - return; - - unsigned int CC = (funcOp.getName() == fir::NameUniquer::doProgramEntry()) - ? llvm::dwarf::getCallingConvention("DW_CC_program") - : llvm::dwarf::getCallingConvention("DW_CC_normal"); - - if (auto funcLoc = mlir::dyn_cast(l)) { - fileName = llvm::sys::path::filename(funcLoc.getFilename().getValue()); - filePath = llvm::sys::path::parent_path(funcLoc.getFilename().getValue()); - } - - mlir::StringAttr fullName = - mlir::StringAttr::get(context, funcOp.getName()); - mlir::Attribute attr = funcOp->getAttr(fir::getInternalFuncNameAttrName()); - mlir::StringAttr funcName = - (attr) ? mlir::cast(attr) - : mlir::StringAttr::get(context, funcOp.getName()); - - auto result = fir::NameUniquer::deconstruct(funcName); - funcName = mlir::StringAttr::get(context, result.second.name); - - llvm::SmallVector types; - fir::DebugTypeGenerator typeGen(module); - for (auto resTy : funcOp.getResultTypes()) { - auto tyAttr = - typeGen.convertType(resTy, fileAttr, cuAttr, funcOp.getLoc()); - types.push_back(tyAttr); - } - for (auto inTy : funcOp.getArgumentTypes()) { - auto tyAttr = typeGen.convertType(fir::unwrapRefType(inTy), fileAttr, - cuAttr, funcOp.getLoc()); - types.push_back(tyAttr); - } - - mlir::LLVM::DISubroutineTypeAttr subTypeAttr = - mlir::LLVM::DISubroutineTypeAttr::get(context, CC, types); - mlir::LLVM::DIFileAttr funcFileAttr = - mlir::LLVM::DIFileAttr::get(context, fileName, filePath); - - // Only definitions need a distinct identifier and a compilation unit. - mlir::DistinctAttr id; - mlir::LLVM::DIScopeAttr Scope = fileAttr; - mlir::LLVM::DICompileUnitAttr compilationUnit; - mlir::LLVM::DISubprogramFlags subprogramFlags = - mlir::LLVM::DISubprogramFlags{}; - if (isOptimized) - subprogramFlags = mlir::LLVM::DISubprogramFlags::Optimized; - if (!funcOp.isExternal()) { - id = mlir::DistinctAttr::create(mlir::UnitAttr::get(context)); - compilationUnit = cuAttr; - subprogramFlags = - subprogramFlags | mlir::LLVM::DISubprogramFlags::Definition; - } - unsigned line = getLineFromLoc(l); - if (!result.second.modules.empty()) - Scope = getOrCreateModuleAttr(result.second.modules[0], fileAttr, cuAttr, - line - 1, false); - - auto spAttr = mlir::LLVM::DISubprogramAttr::get( - context, id, compilationUnit, Scope, funcName, fullName, funcFileAttr, - line, line, subprogramFlags, subTypeAttr); - funcOp->setLoc(builder.getFusedLoc({funcOp->getLoc()}, spAttr)); - - // Don't process variables if user asked for line tables only. - if (debugLevel == mlir::LLVM::DIEmissionKind::LineTablesOnly) - return; - - funcOp.walk([&](fir::cg::XDeclareOp declOp) { - handleDeclareOp(declOp, fileAttr, spAttr, typeGen, &symbolTable); - }); + handleFuncOp(funcOp, fileAttr, cuAttr, &symbolTable); }); // Process any global which was not processed through DeclareOp. if (debugLevel == mlir::LLVM::DIEmissionKind::Full) { diff --git a/flang/test/Driver/Inputs/config-1.cfg b/flang/test/Driver/Inputs/config-1.cfg new file mode 100644 index 0000000000000..824e128a42b63 --- /dev/null +++ b/flang/test/Driver/Inputs/config-1.cfg @@ -0,0 +1 @@ +-flto diff --git a/flang/test/Driver/Inputs/config-2.cfg b/flang/test/Driver/Inputs/config-2.cfg new file mode 100644 index 0000000000000..4e8d01b668e83 --- /dev/null +++ b/flang/test/Driver/Inputs/config-2.cfg @@ -0,0 +1 @@ +-fno-signed-zeros diff --git a/flang/test/Driver/Inputs/config-2a.cfg b/flang/test/Driver/Inputs/config-2a.cfg new file mode 100644 index 0000000000000..cd2916c98afe2 --- /dev/null +++ b/flang/test/Driver/Inputs/config-2a.cfg @@ -0,0 +1 @@ +-fopenmp diff --git a/flang/test/Driver/Inputs/config-6.cfg b/flang/test/Driver/Inputs/config-6.cfg new file mode 100644 index 0000000000000..81e9830f63be4 --- /dev/null +++ b/flang/test/Driver/Inputs/config-6.cfg @@ -0,0 +1 @@ +-fstack-arrays diff --git a/flang/test/Driver/Inputs/config/config-4.cfg b/flang/test/Driver/Inputs/config/config-4.cfg new file mode 100644 index 0000000000000..d15a7108d4e21 --- /dev/null +++ b/flang/test/Driver/Inputs/config/config-4.cfg @@ -0,0 +1 @@ +-O3 diff --git a/flang/test/Driver/Inputs/config2/config-4.cfg b/flang/test/Driver/Inputs/config2/config-4.cfg new file mode 100644 index 0000000000000..9d1c3e38c8680 --- /dev/null +++ b/flang/test/Driver/Inputs/config2/config-4.cfg @@ -0,0 +1 @@ +-ffp-contract=fast diff --git a/flang/test/Driver/config-file.f90 b/flang/test/Driver/config-file.f90 new file mode 100644 index 0000000000000..70316dd971f36 --- /dev/null +++ b/flang/test/Driver/config-file.f90 @@ -0,0 +1,63 @@ +!--- Config file (full path) in output of -### +! +! RUN: %flang --config-system-dir=%S/Inputs/config --config-user-dir=%S/Inputs/config2 -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-DIRS +! CHECK-DIRS: System configuration file directory: {{.*}}/Inputs/config +! CHECK-DIRS: User configuration file directory: {{.*}}/Inputs/config2 +! +!--- Config file (full path) in output of -### +! +! RUN: %flang --config %S/Inputs/config-1.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-HHH +! RUN: %flang --config=%S/Inputs/config-1.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-HHH +! CHECK-HHH: Configuration file: {{.*}}Inputs{{.}}config-1.cfg +! CHECK-HHH: -flto +! +! +!--- Config file (full path) in output of -v +! +! RUN: %flang --config %S/Inputs/config-1.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-V +! CHECK-V: Configuration file: {{.*}}Inputs{{.}}config-1.cfg +! CHECK-V: -flto +! +!--- Config file in output of -### +! +! RUN: %flang --config-system-dir=%S/Inputs --config-user-dir= --config config-1.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-HHH2 +! CHECK-HHH2: Configuration file: {{.*}}Inputs{{.}}config-1.cfg +! CHECK-HHH2: -flto +! +!--- Config file in output of -v +! +! RUN: %flang --config-system-dir=%S/Inputs --config-user-dir= --config config-1.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-V2 +! CHECK-V2: Configuration file: {{.*}}Inputs{{.}}config-1.cfg +! CHECK-V2: -flto +! +!--- Nested config files +! +! RUN: %flang --config-system-dir=%S/Inputs --config-user-dir= --config config-2.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NESTED +! CHECK-NESTED: Configuration file: {{.*}}Inputs{{.}}config-2.cfg +! CHECK-NESTED: -fno-signed-zeros +! +! RUN: %flang --config-system-dir=%S/Inputs --config-user-dir=%S/Inputs/config --config config-6.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NESTED2 +! CHECK-NESTED2: Configuration file: {{.*}}Inputs{{.}}config-6.cfg +! CHECK-NESTED2: -fstack-arrays +! +! +! RUN: %flang --config %S/Inputs/config-2a.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NESTEDa +! CHECK-NESTEDa: Configuration file: {{.*}}Inputs{{.}}config-2a.cfg +! CHECK-NESTEDa: -fopenmp +! +! RUN: %flang --config-system-dir=%S/Inputs --config-user-dir= --config config-2a.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NESTED2a +! CHECK-NESTED2a: Configuration file: {{.*}}Inputs{{.}}config-2a.cfg +! CHECK-NESTED2a: -fopenmp +! +!--- User directory is searched first. +! +! RUN: %flang --config-system-dir=%S/Inputs/config --config-user-dir=%S/Inputs/config2 --config config-4.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-PRECEDENCE +! CHECK-PRECEDENCE: Configuration file: {{.*}}Inputs{{.}}config2{{.}}config-4.cfg +! CHECK-PRECEDENCE: -ffp-contract=fast +! +!--- Multiple configuration files can be specified. +! RUN: %flang --config-system-dir=%S/Inputs/config --config-user-dir= --config config-4.cfg --config %S/Inputs/config2/config-4.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-TWO-CONFIGS +! CHECK-TWO-CONFIGS: Configuration file: {{.*}}Inputs{{.}}config{{.}}config-4.cfg +! CHECK-TWO-CONFIGS-NEXT: Configuration file: {{.*}}Inputs{{.}}config2{{.}}config-4.cfg +! CHECK-TWO-CONFIGS: -ffp-contract=fast +! CHECK-TWO-CONFIGS: -O3 diff --git a/flang/test/Fir/abstract-results.fir b/flang/test/Fir/abstract-results.fir index 82f1cd33073fd..93e63dc657f0c 100644 --- a/flang/test/Fir/abstract-results.fir +++ b/flang/test/Fir/abstract-results.fir @@ -87,8 +87,8 @@ func.func @boxfunc_callee() -> !fir.box> { // FUNC-BOX: return } -// FUNC-REF-LABEL: func @retcptr() -> i64 -// FUNC-BOX-LABEL: func @retcptr() -> i64 +// FUNC-REF-LABEL: func @retcptr() -> !fir.ref +// FUNC-BOX-LABEL: func @retcptr() -> !fir.ref func.func @retcptr() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}> { %0 = fir.alloca !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}> {bindc_name = "rec", uniq_name = "_QFrecErec"} %1 = fir.load %0 : !fir.ref> @@ -98,12 +98,14 @@ func.func @retcptr() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__addres // FUNC-REF: %[[FIELD:.*]] = fir.field_index __address, !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}> // FUNC-REF: %[[ADDR:.*]] = fir.coordinate_of %[[ALLOC]], %[[FIELD]] : (!fir.ref>, !fir.field) -> !fir.ref // FUNC-REF: %[[VAL:.*]] = fir.load %[[ADDR]] : !fir.ref - // FUNC-REF: return %[[VAL]] : i64 + // FUNC-REF: %[[CAST:.*]] = fir.convert %[[VAL]] : (i64) -> !fir.ref + // FUNC-REF: return %[[CAST]] : !fir.ref // FUNC-BOX: %[[ALLOC:.*]] = fir.alloca !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}> {bindc_name = "rec", uniq_name = "_QFrecErec"} // FUNC-BOX: %[[FIELD:.*]] = fir.field_index __address, !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}> // FUNC-BOX: %[[ADDR:.*]] = fir.coordinate_of %[[ALLOC]], %[[FIELD]] : (!fir.ref>, !fir.field) -> !fir.ref // FUNC-BOX: %[[VAL:.*]] = fir.load %[[ADDR]] : !fir.ref - // FUNC-BOX: return %[[VAL]] : i64 + // FUNC-BOX: %[[CAST:.*]] = fir.convert %[[VAL]] : (i64) -> !fir.ref + // FUNC-BOX: return %[[CAST]] : !fir.ref } // FUNC-REF-LABEL: func private @arrayfunc_callee_declare( @@ -311,8 +313,8 @@ func.func @test_address_of() { } -// FUNC-REF-LABEL: func.func private @returns_null() -> i64 -// FUNC-BOX-LABEL: func.func private @returns_null() -> i64 +// FUNC-REF-LABEL: func.func private @returns_null() -> !fir.ref +// FUNC-BOX-LABEL: func.func private @returns_null() -> !fir.ref func.func private @returns_null() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}> // FUNC-REF-LABEL: func @test_address_of_cptr @@ -323,12 +325,12 @@ func.func @test_address_of_cptr() { fir.call @_QMtest_c_func_modPsubr(%1) : (() -> ()) -> () return - // FUNC-REF: %[[VAL_0:.*]] = fir.address_of(@returns_null) : () -> i64 - // FUNC-REF: %[[VAL_1:.*]] = fir.convert %[[VAL_0]] : (() -> i64) -> (() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) + // FUNC-REF: %[[VAL_0:.*]] = fir.address_of(@returns_null) : () -> !fir.ref + // FUNC-REF: %[[VAL_1:.*]] = fir.convert %[[VAL_0]] : (() -> !fir.ref) -> (() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) // FUNC-REF: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) -> (() -> ()) // FUNC-REF: fir.call @_QMtest_c_func_modPsubr(%[[VAL_2]]) : (() -> ()) -> () - // FUNC-BOX: %[[VAL_0:.*]] = fir.address_of(@returns_null) : () -> i64 - // FUNC-BOX: %[[VAL_1:.*]] = fir.convert %[[VAL_0]] : (() -> i64) -> (() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) + // FUNC-BOX: %[[VAL_0:.*]] = fir.address_of(@returns_null) : () -> !fir.ref + // FUNC-BOX: %[[VAL_1:.*]] = fir.convert %[[VAL_0]] : (() -> !fir.ref) -> (() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) // FUNC-BOX: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) -> (() -> ()) // FUNC-BOX: fir.call @_QMtest_c_func_modPsubr(%[[VAL_2]]) : (() -> ()) -> () } @@ -380,18 +382,20 @@ func.func @test_indirect_calls_return_cptr(%arg0: () -> ()) { // FUNC-REF: %[[VAL_0:.*]] = fir.alloca !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}> {bindc_name = ".result"} // FUNC-REF: %[[VAL_1:.*]] = fir.convert %[[ARG0]] : (() -> ()) -> (() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) - // FUNC-REF: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) -> (() -> i64) - // FUNC-REF: %[[VAL_3:.*]] = fir.call %[[VAL_2]]() : () -> i64 + // FUNC-REF: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) -> (() -> !fir.ref) + // FUNC-REF: %[[VAL_3:.*]] = fir.call %[[VAL_2]]() : () -> !fir.ref // FUNC-REF: %[[VAL_4:.*]] = fir.field_index __address, !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}> // FUNC-REF: %[[VAL_5:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_4]] : (!fir.ref>, !fir.field) -> !fir.ref - // FUNC-REF: fir.store %[[VAL_3]] to %[[VAL_5]] : !fir.ref + // FUNC-REF: %[[CAST:.*]] = fir.convert %[[VAL_3]] : (!fir.ref) -> i64 + // FUNC-REF: fir.store %[[CAST]] to %[[VAL_5]] : !fir.ref // FUNC-BOX: %[[VAL_0:.*]] = fir.alloca !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}> {bindc_name = ".result"} // FUNC-BOX: %[[VAL_1:.*]] = fir.convert %[[ARG0]] : (() -> ()) -> (() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) - // FUNC-BOX: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) -> (() -> i64) - // FUNC-BOX: %[[VAL_3:.*]] = fir.call %[[VAL_2]]() : () -> i64 + // FUNC-BOX: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (() -> !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>) -> (() -> !fir.ref) + // FUNC-BOX: %[[VAL_3:.*]] = fir.call %[[VAL_2]]() : () -> !fir.ref // FUNC-BOX: %[[VAL_4:.*]] = fir.field_index __address, !fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}> // FUNC-BOX: %[[VAL_5:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_4]] : (!fir.ref>, !fir.field) -> !fir.ref - // FUNC-BOX: fir.store %[[VAL_3]] to %[[VAL_5]] : !fir.ref + // FUNC-BOX: %[[CAST:.*]] = fir.convert %[[VAL_3]] : (!fir.ref) -> i64 + // FUNC-BOX: fir.store %[[CAST]] to %[[VAL_5]] : !fir.ref } // ----------------------- Test GlobalOp rewrite ------------------------ diff --git a/flang/test/Lower/OpenMP/private-derived-type.f90 b/flang/test/Lower/OpenMP/private-derived-type.f90 new file mode 100644 index 0000000000000..230484f20c11d --- /dev/null +++ b/flang/test/Lower/OpenMP/private-derived-type.f90 @@ -0,0 +1,47 @@ +! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s | FileCheck %s +! RUN: bbc -emit-hlfir -fopenmp -o - %s | FileCheck %s + +subroutine s4 + type y3 + integer,allocatable::x + end type y3 + type(y3)::v + !$omp parallel + !$omp do private(v) + do i=1,10 + v%x=1 + end do + !$omp end do + !$omp end parallel +end subroutine s4 + + +! CHECK-LABEL: func.func @_QPs4() { +! Example of how the lowering for regular derived type variables: +! CHECK: %[[VAL_8:.*]] = fir.alloca !fir.type<_QFs4Ty3{x:!fir.box>}> {bindc_name = "v", uniq_name = "_QFs4Ev"} +! CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_8]] {uniq_name = "_QFs4Ev"} : (!fir.ref>}>>) -> (!fir.ref>}>>, !fir.ref>}>>) +! CHECK: %[[VAL_10:.*]] = fir.embox %[[VAL_9]]#1 : (!fir.ref>}>>) -> !fir.box>}>> +! CHECK: %[[VAL_11:.*]] = fir.address_of +! CHECK: %[[VAL_12:.*]] = arith.constant 4 : i32 +! CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_10]] : (!fir.box>}>>) -> !fir.box +! CHECK: %[[VAL_14:.*]] = fir.convert %[[VAL_11]] : (!fir.ref>) -> !fir.ref +! CHECK: %[[VAL_15:.*]] = fir.call @_FortranAInitialize(%[[VAL_13]], %[[VAL_14]], %[[VAL_12]]) fastmath : (!fir.box, !fir.ref, i32) -> none +! CHECK: omp.parallel { +! CHECK: %[[VAL_23:.*]] = fir.alloca !fir.type<_QFs4Ty3{x:!fir.box>}> {bindc_name = "v", pinned, uniq_name = "_QFs4Ev"} +! CHECK: %[[VAL_24:.*]]:2 = hlfir.declare %[[VAL_23]] {uniq_name = "_QFs4Ev"} : (!fir.ref>}>>) -> (!fir.ref>}>>, !fir.ref>}>>) +! CHECK: %[[VAL_25:.*]] = fir.embox %[[VAL_24]]#1 : (!fir.ref>}>>) -> !fir.box>}>> +! CHECK: %[[VAL_26:.*]] = fir.address_of +! CHECK: %[[VAL_27:.*]] = arith.constant 4 : i32 +! CHECK: %[[VAL_28:.*]] = fir.convert %[[VAL_25]] : (!fir.box>}>>) -> !fir.box +! CHECK: %[[VAL_29:.*]] = fir.convert %[[VAL_26]] : (!fir.ref>) -> !fir.ref +! Check we do call FortranAInitialize on the derived type +! CHECK: %[[VAL_30:.*]] = fir.call @_FortranAInitialize(%[[VAL_28]], %[[VAL_29]], %[[VAL_27]]) fastmath : (!fir.box, !fir.ref, i32) -> none +! CHECK: omp.wsloop { +! CHECK: omp.terminator +! CHECK: } +! CHECK: %[[VAL_39:.*]] = fir.embox %[[VAL_9]]#1 : (!fir.ref>}>>) -> !fir.box>}>> +! CHECK: %[[VAL_40:.*]] = fir.convert %[[VAL_39]] : (!fir.box>}>>) -> !fir.box +! Check the derived type is destroyed +! CHECK: %[[VAL_41:.*]] = fir.call @_FortranADestroy(%[[VAL_40]]) fastmath : (!fir.box) -> none +! CHECK: return +! CHECK: } diff --git a/flang/test/Transforms/debug-96314.fir b/flang/test/Transforms/debug-96314.fir new file mode 100644 index 0000000000000..e2d0f24a1105c --- /dev/null +++ b/flang/test/Transforms/debug-96314.fir @@ -0,0 +1,26 @@ +// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s -o - | FileCheck %s + +module attributes {dlti.dl_spec = #dlti.dl_spec<>} { + func.func @_QMhelperPmod_sub(%arg0: !fir.ref {fir.bindc_name = "a"} ) { + return + } loc(#loc1) + func.func private @_QMhelperFmod_subPchild1(%arg0: !fir.ref {fir.bindc_name = "b"} ) attributes {fir.host_symbol = @_QMhelperPmod_sub, llvm.linkage = #llvm.linkage} { + return + } loc(#loc2) + func.func @global_sub_(%arg0: !fir.ref {fir.bindc_name = "n"} ) attributes {fir.internal_name = "_QPglobal_sub"} { + return + } loc(#loc3) + func.func private @_QFglobal_subPchild2(%arg0: !fir.ref {fir.bindc_name = "c"}) attributes {fir.host_symbol = @global_sub_, llvm.linkage = #llvm.linkage} { + return + } loc(#loc4) +} + +#loc1 = loc("test.f90":5:1) +#loc2 = loc("test.f90":15:1) +#loc3 = loc("test.f90":25:1) +#loc4 = loc("test.f90":35:1) + +// CHECK-DAG: #[[SP1:.*]] = #llvm.di_subprogram<{{.*}}name = "mod_sub"{{.*}}> +// CHECK-DAG: #llvm.di_subprogram<{{.*}}scope = #[[SP1]], name = "child1"{{.*}}> +// CHECK-DAG: #[[SP2:.*]] = #llvm.di_subprogram<{{.*}}linkageName = "global_sub_"{{.*}}> +// CHECK-DAG: #llvm.di_subprogram<{{.*}}scope = #[[SP2]], name = "child2"{{.*}}> diff --git a/global.json b/global.json new file mode 100644 index 0000000000000..d2da1b796d935 --- /dev/null +++ b/global.json @@ -0,0 +1,19 @@ +{ + "sdk": { + "version": "10.0.100", + "allowPrerelease": true, + "rollForward": "major", + "paths": [ + ".dotnet", + "$host$" + ], + "errorMessage": "The required .NET SDK wasn't found. Please run ./eng/common/dotnet.cmd/sh to install it." + }, + "tools": { + "dotnet": "10.0.100" + }, + "msbuild-sdks": { + "Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.25612.6", + "Microsoft.Build.Traversal": "3.4.0" + } +} diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake index 97d1c7262d24d..7a1c45a814eb6 100644 --- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake +++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake @@ -104,16 +104,7 @@ function(_get_common_compile_options output_var flags) list(APPEND compile_options "-ffixed-point") endif() - # Builtin recognition causes issues when trying to implement the builtin - # functions themselves. The GPU backends do not use libcalls so we disable - # the known problematic ones. This allows inlining during LTO linking. - if(LIBC_TARGET_OS_IS_GPU) - set(libc_builtins bcmp strlen memmem bzero memcmp memcpy memmem memmove - memset strcmp strstr) - foreach(builtin ${libc_builtins}) - list(APPEND compile_options "-fno-builtin-${builtin}") - endforeach() - else() + if(NOT LIBC_TARGET_OS_IS_GPU) list(APPEND compile_options "-fno-builtin") endif() diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake index 2d3db38ecd8a3..68b5ed1ed51c0 100644 --- a/libc/cmake/modules/LLVMLibCObjectRules.cmake +++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake @@ -279,6 +279,17 @@ function(create_entrypoint_object fq_target_name) add_dependencies(${fq_target_name} ${full_deps_list}) target_link_libraries(${fq_target_name} ${full_deps_list}) + # Builtin recognition causes issues when trying to implement the builtin + # functions themselves. The GPU backends do not use libcalls so we disable the + # known problematic ones on the entrypoints that implement them. + if(LIBC_TARGET_OS_IS_GPU) + set(libc_builtins bcmp strlen memmem bzero memcmp memcpy memmem memmove + memset strcmp strstr) + if(${ADD_ENTRYPOINT_OBJ_NAME} IN_LIST libc_builtins) + target_compile_options(${fq_target_name} PRIVATE -fno-builtin-${ADD_ENTRYPOINT_OBJ_NAME}) + endif() + endif() + set_target_properties( ${fq_target_name} PROPERTIES diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake index 18adbee0bc7ad..96eb065c4a672 100644 --- a/libc/cmake/modules/LLVMLibCTestRules.cmake +++ b/libc/cmake/modules/LLVMLibCTestRules.cmake @@ -651,7 +651,6 @@ function(add_libc_hermetic test_name) target_link_options(${fq_build_target_name} PRIVATE ${LIBC_COMPILE_OPTIONS_DEFAULT} -Wno-multi-gpu -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE} -flto - "-Wl,-asdfasdfasdf" "-Wl,-mllvm,-amdgpu-lower-global-ctor-dtor=0" -nostdlib -static "-Wl,-mllvm,-amdhsa-code-object-version=${LIBC_GPU_CODE_OBJECT_VERSION}") elseif(LIBC_TARGET_ARCHITECTURE_IS_NVPTX) diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt index 42909cec55890..fa878d8999227 100644 --- a/libc/config/gpu/entrypoints.txt +++ b/libc/config/gpu/entrypoints.txt @@ -1,13 +1,3 @@ -if(LIBC_TARGET_ARCHITECTURE_IS_AMDGPU) - set(extra_entrypoints - # stdio.h entrypoints - libc.src.stdio.snprintf - libc.src.stdio.sprintf - libc.src.stdio.vsnprintf - libc.src.stdio.vsprintf - ) -endif() - set(TARGET_LIBC_ENTRYPOINTS # assert.h entrypoints libc.src.assert.__assert_fail @@ -186,13 +176,16 @@ set(TARGET_LIBC_ENTRYPOINTS libc.src.errno.errno # stdio.h entrypoints - ${extra_entrypoints} libc.src.stdio.clearerr libc.src.stdio.fclose libc.src.stdio.printf libc.src.stdio.vprintf libc.src.stdio.fprintf libc.src.stdio.vfprintf + libc.src.stdio.snprintf + libc.src.stdio.sprintf + libc.src.stdio.vsnprintf + libc.src.stdio.vsprintf libc.src.stdio.feof libc.src.stdio.ferror libc.src.stdio.fflush diff --git a/libc/utils/buildbot/Dockerfile b/libc/utils/buildbot/Dockerfile deleted file mode 100644 index 8c497be6db0cc..0000000000000 --- a/libc/utils/buildbot/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -FROM debian:10 - -# Installing dependencies. -RUN dpkg --add-architecture i386 -RUN apt-get update && apt-get install -y build-essential clang subversion git \ - vim zip libstdc++6:i386 file binutils-dev binutils-gold cmake python-pip \ - ninja-build python3 -RUN python -m pip install buildbot-worker==2.8.4 - -# Temporary dependencies for AOR tests. -RUN apt-get install -y libmpfr-dev libmpc-dev - -# Change linker to gold. -RUN update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20 - -# Create and switch to buildbot user. -RUN useradd buildbot --create-home -USER buildbot - -WORKDIR /home/buildbot - -# Use clang as the compiler. -ENV CC=/usr/bin/clang -ENV CXX=/usr/bin/clang++ - -ENV WORKER_NAME="libc-x86_64-debian" - -# Set up buildbot host and maintainer info. -RUN mkdir -p "${WORKER_NAME}/info/" -RUN bash -c "(uname -a ; \ - gcc --version | head -n1 ; ld --version \ - | head -n1 ; cmake --version | head -n1 ) > ${WORKER_NAME}/info/host" -RUN echo "Paula Toth " > "${WORKER_NAME}/info/admin" - -ADD --chown=buildbot:buildbot run.sh . -ENTRYPOINT ["./run.sh"] diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index 332816b15260a..674082c7d1787 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -71,12 +71,16 @@ if (NOT "${LIBCXX_HARDENING_MODE}" IN_LIST LIBCXX_SUPPORTED_HARDENING_MODES) "Unsupported hardening mode: '${LIBCXX_HARDENING_MODE}'. Supported values are ${LIBCXX_SUPPORTED_HARDENING_MODES}.") endif() set(LIBCXX_ASSERTION_HANDLER_FILE - "${CMAKE_CURRENT_SOURCE_DIR}/vendor/llvm/default_assertion_handler.in" + "vendor/llvm/default_assertion_handler.in" CACHE STRING "Specify the path to a header that contains a custom implementation of the assertion handler that gets invoked when a hardening assertion fails. If provided, this header will be included by the library, replacing the - default assertion handler.") + default assertion handler. If this is specified as a relative path, it + is assumed to be relative to '/libcxx'.") +if (NOT IS_ABSOLUTE "${LIBCXX_ASSERTION_HANDLER_FILE}") + set(LIBCXX_ASSERTION_HANDLER_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${LIBCXX_ASSERTION_HANDLER_FILE}") +endif() option(LIBCXX_ENABLE_RANDOM_DEVICE "Whether to include support for std::random_device in the library. Disabling this can be useful when building the library for platforms that don't have diff --git a/libcxx/cmake/config-ix.cmake b/libcxx/cmake/config-ix.cmake index 998819604de28..2582e65c1406a 100644 --- a/libcxx/cmake/config-ix.cmake +++ b/libcxx/cmake/config-ix.cmake @@ -129,5 +129,6 @@ elseif(PICOLIBC) else() check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB) check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB) - check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB) + set(LIBCXX_HAS_SYSTEM_LIB NO) + set(LIBCXX_HAS_ATOMIC_LIB NO) endif() diff --git a/libcxx/docs/BuildingLibcxx.rst b/libcxx/docs/BuildingLibcxx.rst index 66bb19bb5b2cd..5c224689e0f9f 100644 --- a/libcxx/docs/BuildingLibcxx.rst +++ b/libcxx/docs/BuildingLibcxx.rst @@ -406,7 +406,8 @@ libc++ Feature Options Specify the path to a header that contains a custom implementation of the assertion handler that gets invoked when a hardening assertion fails. If provided, this header will be included by the library, replacing the - default assertion handler. + default assertion handler. If this is specified as a relative path, it + is assumed to be relative to ``/libcxx``. libc++ ABI Feature Options diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst index 262da3f8937d2..a1506e115fe70 100644 --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -290,7 +290,7 @@ Status ---------------------------------------------------------- ----------------- ``__cpp_lib_syncbuf`` ``201803L`` ---------------------------------------------------------- ----------------- - ``__cpp_lib_three_way_comparison`` ``201711L`` + ``__cpp_lib_three_way_comparison`` ``201907L`` ---------------------------------------------------------- ----------------- ``__cpp_lib_to_address`` ``201711L`` ---------------------------------------------------------- ----------------- diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst index 439f552db59a8..92896f6b0d11e 100644 --- a/libcxx/docs/ReleaseNotes/19.rst +++ b/libcxx/docs/ReleaseNotes/19.rst @@ -35,10 +35,25 @@ see the `releases page `_. What's New in Libc++ 19.0.0? ============================== +The main focus of the libc++ team has been to implement new C++20, C++23, +and C++26 features. + +Experimental support for the time zone database has progressed. + +Work on the ranges support has progressed. See +:ref:`ranges-status` for the current status. + +Work on the experimental C++17 Parallel STL has progressed. See +:ref:`pstl-status` for the current status. + +Work on the C++17 mathematical special functions has started. See +:ref:`special-math-status` for the current status. + Implemented Papers ------------------ - P1132R8 - ``out_ptr`` - a scalable output pointer abstraction +- P1614R2 - The Mothership has Landed - P2637R3 - Member ``visit`` - P2652R2 - Disallow User Specialization of ``allocator_traits`` - P2819R2 - Add ``tuple`` protocol to ``complex`` @@ -59,14 +74,21 @@ Implemented Papers - P0019R8 - ``std::atomic_ref`` - P2389R2 - Alias template ``dims`` for the ``extents`` of ``mdspan`` - P1223R5 - ``ranges::find_last()``, ``ranges::find_last_if()``, and ``ranges::find_last_if_not()`` +- P2602R2 - Poison Pills are Too Toxic +- P1981R0 - Rename ``leap`` to ``leap_second`` +- P1982R0 - Rename ``link`` to ``time_zone_link`` + Improvements and New Features ----------------------------- - The performance of growing ``std::vector`` has been improved for trivially relocatable types. -- A lot of types are considered trivially relocatable now, including ``vector`` and ``string``. -- The performance of ``ranges::fill`` and ``ranges::fill_n`` has been improved for ``vector::iterator``\s, + +- A lot of types are considered trivially relocatable now, including ``std::vector`` and ``std::string``. + +- The performance of ``std::ranges::fill`` and ``std::ranges::fill_n`` has been improved for ``std::vector::iterator``\s, resulting in a performance increase of up to 1400x. + - The ``std::mismatch`` algorithm has been optimized for integral types, which can lead up to 40x performance improvements. @@ -74,7 +96,7 @@ Improvements and New Features up to 100x. - The ``std::set_intersection`` and ``std::ranges::set_intersection`` algorithms have been optimized to fast-forward over - contiguous ranges of non-matching values, reducing the number of comparisons from linear to + contiguous ranges of non-matching values, reducing the number of comparisons from linear to logarithmic growth with the number of elements in best-case scenarios. - The ``_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM`` macro has been added to make the declarations in ```` available. @@ -101,15 +123,18 @@ Improvements and New Features Note: bounded iterators currently are not supported for ``vector``. +- In C++23 and C++26 the number of transitive includes in several headers has been reduced, improving the compilation speed. + + Deprecations and Removals ------------------------- -- The C++20 synchronization library (````, ````, ``atomic::wait``, etc.) has been deprecated +- The C++20 synchronization library (````, ````, ``std::atomic::wait``, etc.) has been deprecated in language modes prior to C++20. If you are using these features prior to C++20, please update to ``-std=c++20``. In LLVM 20, the C++20 synchronization library will be removed entirely in language modes prior to C++20. - ``_LIBCPP_DISABLE_NODISCARD_EXT`` has been removed. ``[[nodiscard]]`` applications are now unconditional. - This decision is based on LEWGs discussion on `P3122 ` and `P3162 ` + This decision is based on LEWGs discussion on `P3122 `_ and `P3162 `_ to not use ``[[nodiscard]]`` in the standard. - The ``LIBCXX_ENABLE_ASSERTIONS`` CMake variable that was used to enable the safe mode has been deprecated and setting @@ -151,10 +176,11 @@ Deprecations and Removals - libc++ no longer supports ``std::allocator`` and containers of ``const``-qualified element type, such as ``std::vector`` and ``std::list``. This used to be supported as an undocumented extension. If you were using ``std::vector``, replace it with ``std::vector`` instead. The - ``_LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST`` macro can be defined to temporarily re-enable this extension as - folks transition their code. This macro will be honored for one released and ignored starting in LLVM 20. + ``_LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST`` macro can be defined + to temporarily re-enable this extension to make it easier to update user code. + This macro will be honored for one released and ignored starting in LLVM 20. To assist with the clean-up process, consider running your code through Clang Tidy, with - `std-allocator-const ` + `std-allocator-const `_ enabled. - When configuring libc++ with localization or threads disabled, the library no longer emits an error when @@ -187,6 +213,9 @@ LLVM 20 ``_LIBCPP_ENABLE_REMOVED_WEEKDAY_RELATIONAL_OPERATORS`` macro that was used to re-enable this extension will be ignored in LLVM 20. +- The ``_LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST`` macro will no longer have an effect. + + LLVM 21 ~~~~~~~ @@ -197,6 +226,7 @@ LLVM 21 If you are using C++03 in your project, you should consider moving to a newer version of the Standard to get the most out of libc++. + ABI Affecting Changes --------------------- @@ -211,7 +241,7 @@ Build System Changes - The ``LIBCXX_EXECUTOR`` and ``LIBCXXABI_EXECUTOR`` CMake variables have been removed. Please set ``LIBCXX_TEST_PARAMS`` to ``executor=<...>`` instead. -- The Cmake variable ``LIBCXX_ENABLE_CLANG_TIDY`` has been removed. The build system has been changed +- The CMake variable ``LIBCXX_ENABLE_CLANG_TIDY`` has been removed. The build system has been changed to automatically detect the presence of ``clang-tidy`` and the required ``Clang`` libraries. - The CMake options ``LIBCXX_INSTALL_MODULES`` now defaults to ``ON``. diff --git a/libcxx/docs/ReleaseNotes/20.rst b/libcxx/docs/ReleaseNotes/20.rst index fb677b1667ddc..f959c8829277e 100644 --- a/libcxx/docs/ReleaseNotes/20.rst +++ b/libcxx/docs/ReleaseNotes/20.rst @@ -59,16 +59,28 @@ Deprecations and Removals ``_LIBCPP_ENABLE_REMOVED_WEEKDAY_RELATIONAL_OPERATORS`` macro that was used to re-enable this extension will be ignored in LLVM 20. +- TODO: The ``_LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST`` macro will no longer have an effect. Upcoming Deprecations and Removals ---------------------------------- -LLVM 21 +LLVM 20 ~~~~~~~ - TODO +LLVM 21 +~~~~~~~ + +- The status of the C++03 implementation will be frozen after the LLVM 21 release. This means that starting in LLVM 22, non-critical bug fixes may not be back-ported + to C++03, including LWG issues. C++03 is a legacy platform, where most projects are no longer actively maintained. To + reduce the amount of fixes required to keep such legacy projects compiling with up-to-date toolchains, libc++ will aim to freeze the status of the headers in C++03 mode to avoid unintended breaking changes. + See https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc for more details. + + If you are using C++03 in your project, you should consider moving to a newer version of the Standard to get the most out of libc++. + + ABI Affecting Changes --------------------- diff --git a/libcxx/docs/Status/Cxx20.rst b/libcxx/docs/Status/Cxx20.rst index c00d6fb237286..b76e30fbb3712 100644 --- a/libcxx/docs/Status/Cxx20.rst +++ b/libcxx/docs/Status/Cxx20.rst @@ -48,6 +48,7 @@ Paper Status .. [#note-P0883.1] P0883: shared_ptr and floating-point changes weren't applied as they themselves aren't implemented yet. .. [#note-P0883.2] P0883: ``ATOMIC_FLAG_INIT`` was marked deprecated in version 14.0, but was undeprecated with the implementation of LWG3659 in version 15.0. .. [#note-P0660] P0660: The paper is implemented but the features are experimental and can be enabled via ``-fexperimental-library``. + .. [#note-P1614] P1614: ``std::strong_order(long double, long double)`` is partly implemented. .. [#note-P0355] P0355: The implementation status is: * ``Calendars`` mostly done in Clang 7 diff --git a/libcxx/docs/Status/Cxx20Issues.csv b/libcxx/docs/Status/Cxx20Issues.csv index 1a40a4472a405..8a431c922a2d9 100644 --- a/libcxx/docs/Status/Cxx20Issues.csv +++ b/libcxx/docs/Status/Cxx20Issues.csv @@ -264,7 +264,7 @@ "`3349 `__","Missing ``__cpp_lib_constexpr_complex``\ for P0415R1","Prague","|Complete|","16.0" "`3350 `__","Simplify return type of ``lexicographical_compare_three_way``\ ","Prague","|Complete|","17.0","|spaceship|" "`3351 `__","``ranges::enable_safe_range``\ should not be constrained","Prague","|Complete|","15.0","|ranges|" -"`3352 `__","``strong_equality``\ isn't a thing","Prague","|Nothing To Do|","","|spaceship|" +"`3352 `__","``strong_equality``\ isn't a thing","Prague","|Complete|","19.0","|spaceship|" "`3354 `__","``has_strong_structural_equality``\ has a meaningless definition","Prague","|Nothing To Do|","","|spaceship|" "`3355 `__","The memory algorithms should support move-only input iterators introduced by P1207","Prague","|Complete|","15.0","|ranges|" "`3356 `__","``__cpp_lib_nothrow_convertible``\ should be ``__cpp_lib_is_nothrow_convertible``\ ","Prague","|Complete|","12.0" diff --git a/libcxx/docs/Status/Cxx20Papers.csv b/libcxx/docs/Status/Cxx20Papers.csv index 34fc5586f74d9..4015d7ad48b06 100644 --- a/libcxx/docs/Status/Cxx20Papers.csv +++ b/libcxx/docs/Status/Cxx20Papers.csv @@ -123,7 +123,7 @@ "`P1522R1 `__","LWG","Iterator Difference Type and Integer Overflow","Cologne","|Complete|","15.0","|ranges|" "`P1523R1 `__","LWG","Views and Size Types","Cologne","|Complete|","15.0","|ranges|" "`P1612R1 `__","LWG","Relocate Endian's Specification","Cologne","|Complete|","10.0" -"`P1614R2 `__","LWG","The Mothership has Landed","Cologne","|In Progress|","" +"`P1614R2 `__","LWG","The Mothership has Landed","Cologne","|Complete| [#note-P1614]_","19.0" "`P1638R1 `__","LWG","basic_istream_view::iterator should not be copyable","Cologne","|Complete|","16.0","|ranges|" "`P1643R1 `__","LWG","Add wait/notify to atomic_ref","Cologne","|Complete|","19.0" "`P1644R0 `__","LWG","Add wait/notify to atomic","Cologne","","" diff --git a/libcxx/docs/Status/SpaceshipPapers.csv b/libcxx/docs/Status/SpaceshipPapers.csv index 39e1f968c1754..1ab64a9caf86a 100644 --- a/libcxx/docs/Status/SpaceshipPapers.csv +++ b/libcxx/docs/Status/SpaceshipPapers.csv @@ -1,5 +1,5 @@ "Number","Name","Status","First released version" -`P1614R2 `_,The Mothership has Landed,|In Progress|, +`P1614R2 `_,The Mothership has Landed,|Complete|,19.0 `P2404R3 `_,"Relaxing ``equality_comparable_with``'s, ``totally_ordered_with``'s, and ``three_way_comparable_with``'s common reference requirements to support move-only types",, `LWG3330 `_,Include ```` from most library headers,"|Complete|","13.0" `LWG3347 `_,"``std::pair`` now requires ``T`` and ``U`` to be *less-than-comparable*",|Nothing To Do|, diff --git a/libcxx/docs/Status/SpaceshipProjects.csv b/libcxx/docs/Status/SpaceshipProjects.csv index e1cf2044cfd78..4dc43cdbbd08f 100644 --- a/libcxx/docs/Status/SpaceshipProjects.csv +++ b/libcxx/docs/Status/SpaceshipProjects.csv @@ -83,7 +83,7 @@ Section,Description,Dependencies,Assignee,Complete "| `[string.view.synop] `_ | `[string.view.comparison] `_",| `basic_string_view `_,None,Mark de Wever,|Complete| - `5.7 Clause 22: Containers library `_,,,, -| `[container.requirements.general] `_,|,None,Unassigned,|Not Started| +| `[container.requirements.general] `_,|,None,Mark de Wever,|Complete| | `[array.syn] `_ (`general `_),| `array `_,[expos.only.func],"| Adrian Vogelsgesang | Hristo Hristov",|Complete| | `[deque.syn] `_ (`general `_),| `deque `_,[expos.only.func],Hristo Hristov,|Complete| diff --git a/libcxx/docs/Status/SpecialMath.rst b/libcxx/docs/Status/SpecialMath.rst index fcc9f03e3ae64..46e5c97cdaab2 100644 --- a/libcxx/docs/Status/SpecialMath.rst +++ b/libcxx/docs/Status/SpecialMath.rst @@ -1,4 +1,4 @@ -.. special-math-status: +.. _special-math-status: ====================================================== libc++ Mathematical Special Functions Status (P0226R1) diff --git a/libcxx/include/__algorithm/three_way_comp_ref_type.h b/libcxx/include/__algorithm/three_way_comp_ref_type.h index 70c5818976f07..5702a1fee0826 100644 --- a/libcxx/include/__algorithm/three_way_comp_ref_type.h +++ b/libcxx/include/__algorithm/three_way_comp_ref_type.h @@ -9,6 +9,7 @@ #ifndef _LIBCPP___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H #define _LIBCPP___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H +#include <__assert> #include <__compare/ordering.h> #include <__config> #include <__utility/declval.h> diff --git a/libcxx/include/__atomic/atomic_ref.h b/libcxx/include/__atomic/atomic_ref.h index 156f1961151c1..b0180a37ab500 100644 --- a/libcxx/include/__atomic/atomic_ref.h +++ b/libcxx/include/__atomic/atomic_ref.h @@ -42,13 +42,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 -template -struct __atomic_ref_base { -protected: - _Tp* __ptr_; +// These types are required to make __atomic_is_always_lock_free work across GCC and Clang. +// The purpose of this trick is to make sure that we provide an object with the correct alignment +// to __atomic_is_always_lock_free, since that answer depends on the alignment. +template +struct __alignment_checker_type { + alignas(_Alignment) char __data; +}; - _LIBCPP_HIDE_FROM_ABI __atomic_ref_base(_Tp& __obj) : __ptr_(std::addressof(__obj)) {} +template +struct __get_aligner_instance { + static constexpr __alignment_checker_type<_Alignment> __instance{}; +}; +template +struct __atomic_ref_base { private: _LIBCPP_HIDE_FROM_ABI static _Tp* __clear_padding(_Tp& __val) noexcept { _Tp* __ptr = std::addressof(__val); @@ -95,17 +103,21 @@ struct __atomic_ref_base { friend struct __atomic_waitable_traits<__atomic_ref_base<_Tp>>; + // require types that are 1, 2, 4, 8, or 16 bytes in length to be aligned to at least their size to be potentially + // used lock-free + static constexpr size_t __min_alignment = (sizeof(_Tp) & (sizeof(_Tp) - 1)) || (sizeof(_Tp) > 16) ? 0 : sizeof(_Tp); + public: using value_type = _Tp; - static constexpr size_t required_alignment = alignof(_Tp); + static constexpr size_t required_alignment = alignof(_Tp) > __min_alignment ? alignof(_Tp) : __min_alignment; // The __atomic_always_lock_free builtin takes into account the alignment of the pointer if provided, // so we create a fake pointer with a suitable alignment when querying it. Note that we are guaranteed // that the pointer is going to be aligned properly at runtime because that is a (checked) precondition // of atomic_ref's constructor. static constexpr bool is_always_lock_free = - __atomic_always_lock_free(sizeof(_Tp), reinterpret_cast(-required_alignment)); + __atomic_always_lock_free(sizeof(_Tp), &__get_aligner_instance::__instance); _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const noexcept { return __atomic_is_lock_free(sizeof(_Tp), __ptr_); } @@ -205,6 +217,12 @@ struct __atomic_ref_base { } _LIBCPP_HIDE_FROM_ABI void notify_one() const noexcept { std::__atomic_notify_one(*this); } _LIBCPP_HIDE_FROM_ABI void notify_all() const noexcept { std::__atomic_notify_all(*this); } + +protected: + typedef _Tp _Aligned_Tp __attribute__((aligned(required_alignment))); + _Aligned_Tp* __ptr_; + + _LIBCPP_HIDE_FROM_ABI __atomic_ref_base(_Tp& __obj) : __ptr_(std::addressof(__obj)) {} }; template diff --git a/libcxx/include/__bit/rotate.h b/libcxx/include/__bit/rotate.h index d848056c3350d..90e430e9d0425 100644 --- a/libcxx/include/__bit/rotate.h +++ b/libcxx/include/__bit/rotate.h @@ -20,24 +20,37 @@ _LIBCPP_BEGIN_NAMESPACE_STD +// Writing two full functions for rotl and rotr makes it easier for the compiler +// to optimize the code. On x86 this function becomes the ROL instruction and +// the rotr function becomes the ROR instruction. template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __rotr(_Tp __t, int __cnt) _NOEXCEPT { - static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotr requires an unsigned integer type"); - const unsigned int __dig = numeric_limits<_Tp>::digits; - if ((__cnt % __dig) == 0) - return __t; +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __rotl(_Tp __x, int __s) _NOEXCEPT { + static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotl requires an unsigned integer type"); + const int __N = numeric_limits<_Tp>::digits; + int __r = __s % __N; + + if (__r == 0) + return __x; - if (__cnt < 0) { - __cnt *= -1; - return (__t << (__cnt % __dig)) | (__t >> (__dig - (__cnt % __dig))); // rotr with negative __cnt is similar to rotl - } + if (__r > 0) + return (__x << __r) | (__x >> (__N - __r)); - return (__t >> (__cnt % __dig)) | (__t << (__dig - (__cnt % __dig))); + return (__x >> -__r) | (__x << (__N + __r)); } template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __rotl(_Tp __t, int __cnt) _NOEXCEPT { - return std::__rotr(__t, -__cnt); +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __rotr(_Tp __x, int __s) _NOEXCEPT { + static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotr requires an unsigned integer type"); + const int __N = numeric_limits<_Tp>::digits; + int __r = __s % __N; + + if (__r == 0) + return __x; + + if (__r > 0) + return (__x >> __r) | (__x << (__N - __r)); + + return (__x << -__r) | (__x >> (__N + __r)); } #if _LIBCPP_STD_VER >= 20 diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference index 606069d98be72..22637d4397412 100644 --- a/libcxx/include/__bit_reference +++ b/libcxx/include/__bit_reference @@ -16,6 +16,7 @@ #include <__bit/countr.h> #include <__bit/invert_if.h> #include <__bit/popcount.h> +#include <__compare/ordering.h> #include <__config> #include <__fwd/bit_reference.h> #include <__iterator/iterator_traits.h> @@ -913,6 +914,7 @@ public: return __x.__seg_ == __y.__seg_ && __x.__ctz_ == __y.__ctz_; } +#if _LIBCPP_STD_VER <= 17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 friend bool operator!=(const __bit_iterator& __x, const __bit_iterator& __y) { return !(__x == __y); @@ -937,6 +939,18 @@ public: operator>=(const __bit_iterator& __x, const __bit_iterator& __y) { return !(__x < __y); } +#else // _LIBCPP_STD_VER <= 17 + _LIBCPP_HIDE_FROM_ABI constexpr friend strong_ordering + operator<=>(const __bit_iterator& __x, const __bit_iterator& __y) { + if (__x.__seg_ < __y.__seg_) + return strong_ordering::less; + + if (__x.__seg_ == __y.__seg_) + return __x.__ctz_ <=> __y.__ctz_; + + return strong_ordering::greater; + } +#endif // _LIBCPP_STD_VER <= 17 private: _LIBCPP_HIDE_FROM_ABI diff --git a/libcxx/include/__config b/libcxx/include/__config index 108f700823cbf..661af5be3c225 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -27,7 +27,7 @@ // _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM. // Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is // defined to XXYYZZ. -# define _LIBCPP_VERSION 190000 +# define _LIBCPP_VERSION 190100 # define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y # define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y) diff --git a/libcxx/include/__iterator/bounded_iter.h b/libcxx/include/__iterator/bounded_iter.h index ce0823b8c97e4..8a81c9ffbfc3f 100644 --- a/libcxx/include/__iterator/bounded_iter.h +++ b/libcxx/include/__iterator/bounded_iter.h @@ -11,6 +11,8 @@ #define _LIBCPP___ITERATOR_BOUNDED_ITER_H #include <__assert> +#include <__compare/ordering.h> +#include <__compare/three_way_comparable.h> #include <__config> #include <__iterator/iterator_traits.h> #include <__memory/pointer_traits.h> @@ -201,10 +203,15 @@ struct __bounded_iter { operator==(__bounded_iter const& __x, __bounded_iter const& __y) _NOEXCEPT { return __x.__current_ == __y.__current_; } + +#if _LIBCPP_STD_VER <= 17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR friend bool operator!=(__bounded_iter const& __x, __bounded_iter const& __y) _NOEXCEPT { return __x.__current_ != __y.__current_; } +#endif + + // TODO(mordante) disable these overloads in the LLVM 20 release. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR friend bool operator<(__bounded_iter const& __x, __bounded_iter const& __y) _NOEXCEPT { return __x.__current_ < __y.__current_; @@ -222,6 +229,23 @@ struct __bounded_iter { return __x.__current_ >= __y.__current_; } +#if _LIBCPP_STD_VER >= 20 + _LIBCPP_HIDE_FROM_ABI constexpr friend strong_ordering + operator<=>(__bounded_iter const& __x, __bounded_iter const& __y) noexcept { + if constexpr (three_way_comparable<_Iterator, strong_ordering>) { + return __x.__current_ <=> __y.__current_; + } else { + if (__x.__current_ < __y.__current_) + return strong_ordering::less; + + if (__x.__current_ == __y.__current_) + return strong_ordering::equal; + + return strong_ordering::greater; + } + } +#endif // _LIBCPP_STD_VER >= 20 + private: template friend struct pointer_traits; diff --git a/libcxx/include/__iterator/wrap_iter.h b/libcxx/include/__iterator/wrap_iter.h index 252d13b26c9e2..56183c0ee794d 100644 --- a/libcxx/include/__iterator/wrap_iter.h +++ b/libcxx/include/__iterator/wrap_iter.h @@ -10,6 +10,8 @@ #ifndef _LIBCPP___ITERATOR_WRAP_ITER_H #define _LIBCPP___ITERATOR_WRAP_ITER_H +#include <__compare/ordering.h> +#include <__compare/three_way_comparable.h> #include <__config> #include <__iterator/iterator_traits.h> #include <__memory/addressof.h> @@ -131,6 +133,7 @@ operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC return __x.base() < __y.base(); } +#if _LIBCPP_STD_VER <= 17 template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { @@ -142,7 +145,9 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { return !(__x == __y); } +#endif +// TODO(mordante) disable these overloads in the LLVM 20 release. template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { @@ -179,6 +184,24 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX return !(__y < __x); } +#if _LIBCPP_STD_VER >= 20 +template +_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering +operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept { + if constexpr (three_way_comparable_with<_Iter1, _Iter2, strong_ordering>) { + return __x.base() <=> __y.base(); + } else { + if (__x.base() < __y.base()) + return strong_ordering::less; + + if (__x.base() == __y.base()) + return strong_ordering::equal; + + return strong_ordering::greater; + } +} +#endif // _LIBCPP_STD_VER >= 20 + template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 #ifndef _LIBCPP_CXX03_LANG diff --git a/libcxx/include/__math/hypot.h b/libcxx/include/__math/hypot.h index 1bf193a9ab7ee..b992163711010 100644 --- a/libcxx/include/__math/hypot.h +++ b/libcxx/include/__math/hypot.h @@ -9,16 +9,25 @@ #ifndef _LIBCPP___MATH_HYPOT_H #define _LIBCPP___MATH_HYPOT_H +#include <__algorithm/max.h> #include <__config> +#include <__math/abs.h> +#include <__math/exponential_functions.h> +#include <__math/roots.h> #include <__type_traits/enable_if.h> #include <__type_traits/is_arithmetic.h> #include <__type_traits/is_same.h> #include <__type_traits/promote.h> +#include <__utility/pair.h> +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD namespace __math { @@ -41,8 +50,60 @@ inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type hypot(_A1 __x, _ return __math::hypot((__result_type)__x, (__result_type)__y); } +#if _LIBCPP_STD_VER >= 17 +// Computes the three-dimensional hypotenuse: `std::hypot(x,y,z)`. +// The naive implementation might over-/underflow which is why this implementation is more involved: +// If the square of an argument might run into issues, we scale the arguments appropriately. +// See https://github.com/llvm/llvm-project/issues/92782 for a detailed discussion and summary. +template +_LIBCPP_HIDE_FROM_ABI _Real __hypot(_Real __x, _Real __y, _Real __z) { + // Factors needed to determine if over-/underflow might happen + constexpr int __exp = std::numeric_limits<_Real>::max_exponent / 2; + const _Real __overflow_threshold = __math::ldexp(_Real(1), __exp); + const _Real __overflow_scale = __math::ldexp(_Real(1), -(__exp + 20)); + + // Scale arguments depending on their size + const _Real __max_abs = std::max(__math::fabs(__x), std::max(__math::fabs(__y), __math::fabs(__z))); + _Real __scale; + if (__max_abs > __overflow_threshold) { // x*x + y*y + z*z might overflow + __scale = __overflow_scale; + } else if (__max_abs < 1 / __overflow_threshold) { // x*x + y*y + z*z might underflow + __scale = 1 / __overflow_scale; + } else { + __scale = 1; + } + __x *= __scale; + __y *= __scale; + __z *= __scale; + + // Compute hypot of scaled arguments and undo scaling + return __math::sqrt(__x * __x + __y * __y + __z * __z) / __scale; +} + +inline _LIBCPP_HIDE_FROM_ABI float hypot(float __x, float __y, float __z) { return __math::__hypot(__x, __y, __z); } + +inline _LIBCPP_HIDE_FROM_ABI double hypot(double __x, double __y, double __z) { return __math::__hypot(__x, __y, __z); } + +inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y, long double __z) { + return __math::__hypot(__x, __y, __z); +} + +template && is_arithmetic_v<_A2> && is_arithmetic_v<_A3>, int> = 0 > +_LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2, _A3>::type hypot(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT { + using __result_type = typename __promote<_A1, _A2, _A3>::type; + static_assert(!( + std::is_same_v<_A1, __result_type> && std::is_same_v<_A2, __result_type> && std::is_same_v<_A3, __result_type>)); + return __math::__hypot( + static_cast<__result_type>(__x), static_cast<__result_type>(__y), static_cast<__result_type>(__z)); +} +#endif + } // namespace __math _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS #endif // _LIBCPP___MATH_HYPOT_H diff --git a/libcxx/include/__memory/inout_ptr.h b/libcxx/include/__memory/inout_ptr.h index 72e1a21ad6867..e5f3ac5d027e8 100644 --- a/libcxx/include/__memory/inout_ptr.h +++ b/libcxx/include/__memory/inout_ptr.h @@ -63,17 +63,17 @@ class _LIBCPP_TEMPLATE_VIS inout_ptr_t { } } - using _SP = __pointer_of_or_t<_Smart, _Pointer>; + using _SmartPtr = __pointer_of_or_t<_Smart, _Pointer>; if constexpr (is_pointer_v<_Smart>) { - std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); }, + std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); }, std::move(__a_)); } else if constexpr (__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>) { - std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); }, + std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); }, std::move(__a_)); } else { - static_assert(is_constructible_v<_Smart, _SP, _Args...>, + static_assert(is_constructible_v<_Smart, _SmartPtr, _Args...>, "The smart pointer must be constructible from arguments of types _Smart, _Pointer, _Args..."); - std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); }, + std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); }, std::move(__a_)); } } diff --git a/libcxx/include/__memory/out_ptr.h b/libcxx/include/__memory/out_ptr.h index 95aa2029c9231..fd99110790cc8 100644 --- a/libcxx/include/__memory/out_ptr.h +++ b/libcxx/include/__memory/out_ptr.h @@ -58,14 +58,14 @@ class _LIBCPP_TEMPLATE_VIS out_ptr_t { return; } - using _SP = __pointer_of_or_t<_Smart, _Pointer>; + using _SmartPtr = __pointer_of_or_t<_Smart, _Pointer>; if constexpr (__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>) { - std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); }, + std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); }, std::move(__a_)); } else { - static_assert(is_constructible_v<_Smart, _SP, _Args...>, + static_assert(is_constructible_v<_Smart, _SmartPtr, _Args...>, "The smart pointer must be constructible from arguments of types _Smart, _Pointer, _Args..."); - std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); }, + std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); }, std::move(__a_)); } } diff --git a/libcxx/include/__type_traits/remove_cv.h b/libcxx/include/__type_traits/remove_cv.h index 50e9f3e8aa78d..c4bf612794bd5 100644 --- a/libcxx/include/__type_traits/remove_cv.h +++ b/libcxx/include/__type_traits/remove_cv.h @@ -10,6 +10,8 @@ #define _LIBCPP___TYPE_TRAITS_REMOVE_CV_H #include <__config> +#include <__type_traits/remove_const.h> +#include <__type_traits/remove_volatile.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -17,18 +19,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD +#if __has_builtin(__remove_cv) && !defined(_LIBCPP_COMPILER_GCC) template struct remove_cv { using type _LIBCPP_NODEBUG = __remove_cv(_Tp); }; -#if defined(_LIBCPP_COMPILER_GCC) template -using __remove_cv_t = typename remove_cv<_Tp>::type; +using __remove_cv_t = __remove_cv(_Tp); #else template -using __remove_cv_t = __remove_cv(_Tp); -#endif +struct _LIBCPP_TEMPLATE_VIS remove_cv { + typedef __remove_volatile_t<__remove_const_t<_Tp> > type; +}; + +template +using __remove_cv_t = __remove_volatile_t<__remove_const_t<_Tp> >; +#endif // __has_builtin(__remove_cv) #if _LIBCPP_STD_VER >= 14 template diff --git a/libcxx/include/__type_traits/remove_cvref.h b/libcxx/include/__type_traits/remove_cvref.h index 55f894dbd1d81..e8e8745ab0960 100644 --- a/libcxx/include/__type_traits/remove_cvref.h +++ b/libcxx/include/__type_traits/remove_cvref.h @@ -20,26 +20,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if defined(_LIBCPP_COMPILER_GCC) +#if __has_builtin(__remove_cvref) && !defined(_LIBCPP_COMPILER_GCC) template -struct __remove_cvref_gcc { - using type = __remove_cvref(_Tp); -}; - -template -using __remove_cvref_t _LIBCPP_NODEBUG = typename __remove_cvref_gcc<_Tp>::type; +using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp); #else template -using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp); +using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >; #endif // __has_builtin(__remove_cvref) template -using __is_same_uncvref = _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> >; +struct __is_same_uncvref : _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> > {}; #if _LIBCPP_STD_VER >= 20 template struct remove_cvref { - using type _LIBCPP_NODEBUG = __remove_cvref(_Tp); + using type _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>; }; template diff --git a/libcxx/include/chrono b/libcxx/include/chrono index 990c415ec2e97..7bec5e5a26ef4 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -1015,8 +1015,8 @@ constexpr chrono::year operator ""y(unsigned lo # include # if !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include +# include # endif -# include #endif #endif // _LIBCPP_CHRONO diff --git a/libcxx/include/cmath b/libcxx/include/cmath index 3c22604a683c3..6480c4678ce33 100644 --- a/libcxx/include/cmath +++ b/libcxx/include/cmath @@ -313,6 +313,7 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept */ #include <__config> +#include <__math/hypot.h> #include <__type_traits/enable_if.h> #include <__type_traits/is_arithmetic.h> #include <__type_traits/is_constant_evaluated.h> @@ -553,30 +554,6 @@ using ::scalbnl _LIBCPP_USING_IF_EXISTS; using ::tgammal _LIBCPP_USING_IF_EXISTS; using ::truncl _LIBCPP_USING_IF_EXISTS; -#if _LIBCPP_STD_VER >= 17 -inline _LIBCPP_HIDE_FROM_ABI float hypot(float __x, float __y, float __z) { - return sqrt(__x * __x + __y * __y + __z * __z); -} -inline _LIBCPP_HIDE_FROM_ABI double hypot(double __x, double __y, double __z) { - return sqrt(__x * __x + __y * __y + __z * __z); -} -inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y, long double __z) { - return sqrt(__x * __x + __y * __y + __z * __z); -} - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value, - __promote<_A1, _A2, _A3> >::type -hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT { - typedef typename __promote<_A1, _A2, _A3>::type __result_type; - static_assert( - !(is_same<_A1, __result_type>::value && is_same<_A2, __result_type>::value && is_same<_A3, __result_type>::value), - ""); - return std::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); -} -#endif - template ::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT { #if __has_builtin(__builtin_isnan) diff --git a/libcxx/include/complex b/libcxx/include/complex index 22271acaf7358..e6534025de57e 100644 --- a/libcxx/include/complex +++ b/libcxx/include/complex @@ -421,7 +421,8 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f) : __re_(__re), __im_(__im) {} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(__from_builtin_tag, _Complex float __v) + template ::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit complex(_Tag, _Complex float __v) : __re_(__real__ __v), __im_(__imag__ __v) {} _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR complex(const complex& __c); @@ -517,7 +518,8 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0) : __re_(__re), __im_(__im) {} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(__from_builtin_tag, _Complex double __v) + template ::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit complex(_Tag, _Complex double __v) : __re_(__real__ __v), __im_(__imag__ __v) {} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex& __c); @@ -617,7 +619,8 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L) : __re_(__re), __im_(__im) {} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(__from_builtin_tag, _Complex long double __v) + template ::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit complex(_Tag, _Complex long double __v) : __re_(__real__ __v), __im_(__imag__ __v) {} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(const complex& __c); diff --git a/libcxx/include/deque b/libcxx/include/deque index 4fc994a6e229b..e73135a8647b9 100644 --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -376,10 +376,13 @@ public: return __x.__ptr_ == __y.__ptr_; } +#if _LIBCPP_STD_VER <= 17 _LIBCPP_HIDE_FROM_ABI friend bool operator!=(const __deque_iterator& __x, const __deque_iterator& __y) { return !(__x == __y); } +#endif + // TODO(mordante) disable these overloads in the LLVM 20 release. _LIBCPP_HIDE_FROM_ABI friend bool operator<(const __deque_iterator& __x, const __deque_iterator& __y) { return __x.__m_iter_ < __y.__m_iter_ || (__x.__m_iter_ == __y.__m_iter_ && __x.__ptr_ < __y.__ptr_); } @@ -396,6 +399,29 @@ public: return !(__x < __y); } +#if _LIBCPP_STD_VER >= 20 + _LIBCPP_HIDE_FROM_ABI friend strong_ordering operator<=>(const __deque_iterator& __x, const __deque_iterator& __y) { + if (__x.__m_iter_ < __y.__m_iter_) + return strong_ordering::less; + + if (__x.__m_iter_ == __y.__m_iter_) { + if constexpr (three_way_comparable) { + return __x.__ptr_ <=> __y.__ptr_; + } else { + if (__x.__ptr_ < __y.__ptr_) + return strong_ordering::less; + + if (__x.__ptr_ == __y.__ptr_) + return strong_ordering::equal; + + return strong_ordering::greater; + } + } + + return strong_ordering::greater; + } +#endif // _LIBCPP_STD_VER >= 20 + private: _LIBCPP_HIDE_FROM_ABI explicit __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT : __m_iter_(__m), @@ -2530,8 +2556,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const deque<_Tp, _Allocator>& __x, template _LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp> operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { - return std::lexicographical_compare_three_way( - __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); + return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way); } #endif // _LIBCPP_STD_VER <= 17 diff --git a/libcxx/include/format b/libcxx/include/format index c3f2b45f0f730..a88b3ef8528e2 100644 --- a/libcxx/include/format +++ b/libcxx/include/format @@ -237,21 +237,21 @@ namespace std { # include # include # include -# include # include # include +# include # include # include +# include +# include # include # include # include # include -#endif -#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 -# include -# include -# include +# if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# include +# endif #endif #endif // _LIBCPP_FORMAT diff --git a/libcxx/include/locale b/libcxx/include/locale index dbec23a2c936d..573910a85bef5 100644 --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -232,6 +232,10 @@ template class messages_byname; # include <__locale_dir/locale_base_api/bsd_locale_fallbacks.h> # endif +# if defined(__APPLE__) || defined(__FreeBSD__) +# include +# endif + # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header # endif diff --git a/libcxx/include/optional b/libcxx/include/optional index f9cbcbfa595d1..41d7515a2b689 100644 --- a/libcxx/include/optional +++ b/libcxx/include/optional @@ -301,7 +301,7 @@ struct __optional_destruct_base<_Tp, false> { # if _LIBCPP_STD_VER >= 23 template - _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base( + _LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_destruct_base( __optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args) : __val_(std::invoke(std::forward<_Fp>(__f), std::forward<_Args>(__args)...)), __engaged_(true) {} # endif @@ -707,8 +707,11 @@ public: } # if _LIBCPP_STD_VER >= 23 - template - _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args) + template ::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Tag, _Fp&& __f, _Args&&... __args) : __base(__optional_construct_from_invoke_tag{}, std::forward<_Fp>(__f), std::forward<_Args>(__args)...) {} # endif diff --git a/libcxx/include/span b/libcxx/include/span index 60d76d830f0f3..da631cdc3f90e 100644 --- a/libcxx/include/span +++ b/libcxx/include/span @@ -206,10 +206,10 @@ struct __is_std_span> : true_type {}; template concept __span_compatible_range = + !__is_std_span>::value && // ranges::contiguous_range<_Range> && // ranges::sized_range<_Range> && // (ranges::borrowed_range<_Range> || is_const_v<_ElementType>) && // - !__is_std_span>::value && // !__is_std_array>::value && // !is_array_v> && // is_convertible_v> (*)[], _ElementType (*)[]>; diff --git a/libcxx/include/string b/libcxx/include/string index ba86a32090825..9fa979e3a5178 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -3358,23 +3358,34 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target __p = __get_long_pointer(); } else { if (__target_capacity > __cap) { + // Extend + // - called from reserve should propagate the exception thrown. auto __allocation = std::__allocate_at_least(__alloc(), __target_capacity + 1); __new_data = __allocation.ptr; __target_capacity = __allocation.count - 1; } else { + // Shrink + // - called from shrink_to_fit should not throw. + // - called from reserve may throw but is not required to. #ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif // _LIBCPP_HAS_NO_EXCEPTIONS auto __allocation = std::__allocate_at_least(__alloc(), __target_capacity + 1); + + // The Standard mandates shrink_to_fit() does not increase the capacity. + // With equal capacity keep the existing buffer. This avoids extra work + // due to swapping the elements. + if (__allocation.count - 1 > __target_capacity) { + __alloc_traits::deallocate(__alloc(), __allocation.ptr, __allocation.count); + __annotate_new(__sz); // Undoes the __annotate_delete() + return; + } __new_data = __allocation.ptr; __target_capacity = __allocation.count - 1; #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { return; } -#else // _LIBCPP_HAS_NO_EXCEPTIONS - if (__new_data == nullptr) - return; #endif // _LIBCPP_HAS_NO_EXCEPTIONS } __begin_lifetime(__new_data, __target_capacity + 1); diff --git a/libcxx/include/typeinfo b/libcxx/include/typeinfo index d1c0de3c1bfdd..2727cad02fa99 100644 --- a/libcxx/include/typeinfo +++ b/libcxx/include/typeinfo @@ -275,13 +275,14 @@ struct __type_info_implementations { __impl; }; -# if defined(__arm64__) && __has_cpp_attribute(clang::ptrauth_vtable_pointer) -# if __has_feature(ptrauth_type_info_discriminated_vtable_pointer) +# if __has_cpp_attribute(_Clang::__ptrauth_vtable_pointer__) +# if __has_feature(ptrauth_type_info_vtable_pointer_discrimination) # define _LIBCPP_TYPE_INFO_VTABLE_POINTER_AUTH \ - [[clang::ptrauth_vtable_pointer(process_independent, address_discrimination, type_discrimination)]] + [[_Clang::__ptrauth_vtable_pointer__(process_independent, address_discrimination, type_discrimination)]] # else # define _LIBCPP_TYPE_INFO_VTABLE_POINTER_AUTH \ - [[clang::ptrauth_vtable_pointer(process_independent, no_address_discrimination, no_extra_discrimination)]] + [[_Clang::__ptrauth_vtable_pointer__( \ + process_independent, no_address_discrimination, no_extra_discrimination)]] # endif # else # define _LIBCPP_TYPE_INFO_VTABLE_POINTER_AUTH diff --git a/libcxx/include/version b/libcxx/include/version index 40548098a92d6..fe64343eafbc9 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -238,7 +238,7 @@ __cpp_lib_string_view 202403L __cpp_lib_syncbuf 201803L __cpp_lib_text_encoding 202306L -__cpp_lib_three_way_comparison 201711L +__cpp_lib_three_way_comparison 201907L __cpp_lib_to_address 201711L __cpp_lib_to_array 201907L __cpp_lib_to_chars 202306L @@ -446,7 +446,7 @@ __cpp_lib_void_t 201411L # if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM) # define __cpp_lib_syncbuf 201803L # endif -# define __cpp_lib_three_way_comparison 201711L +# define __cpp_lib_three_way_comparison 201907L # define __cpp_lib_to_address 201711L # define __cpp_lib_to_array 201907L # define __cpp_lib_type_identity 201806L diff --git a/libcxx/src/include/overridable_function.h b/libcxx/src/include/overridable_function.h index e71e4f104b290..c7639f56eee26 100644 --- a/libcxx/src/include/overridable_function.h +++ b/libcxx/src/include/overridable_function.h @@ -13,7 +13,7 @@ #include <__config> #include -#if defined(__arm64e__) && __has_feature(ptrauth_calls) +#if __has_feature(ptrauth_calls) # include #endif @@ -83,13 +83,13 @@ _LIBCPP_HIDE_FROM_ABI bool __is_function_overridden(_Ret (*__fptr)(_Args...)) no uintptr_t __end = reinterpret_cast(&__lcxx_override_end); uintptr_t __ptr = reinterpret_cast(__fptr); -#if defined(__arm64e__) && __has_feature(ptrauth_calls) +# if __has_feature(ptrauth_calls) // We must pass a void* to ptrauth_strip since it only accepts a pointer type. Also, in particular, // we must NOT pass a function pointer, otherwise we will strip the function pointer, and then attempt // to authenticate and re-sign it when casting it to a uintptr_t again, which will fail because we just // stripped the function pointer. See rdar://122927845. __ptr = reinterpret_cast(ptrauth_strip(reinterpret_cast(__ptr), ptrauth_key_function_pointer)); -#endif +# endif // Finally, the function was overridden if it falls outside of the section's bounds. return __ptr < __start || __ptr > __end; diff --git a/libcxx/test/libcxx/iterators/bounded_iter/comparison.pass.cpp b/libcxx/test/libcxx/iterators/bounded_iter/comparison.pass.cpp index 9c5df5da55b9c..cef2157469c8f 100644 --- a/libcxx/test/libcxx/iterators/bounded_iter/comparison.pass.cpp +++ b/libcxx/test/libcxx/iterators/bounded_iter/comparison.pass.cpp @@ -11,6 +11,7 @@ // // Comparison operators +#include #include <__iterator/bounded_iter.h> #include "test_iterators.h" @@ -59,6 +60,12 @@ TEST_CONSTEXPR_CXX14 bool tests() { assert(iter1 >= iter1); } +#if TEST_STD_VER >= 20 + // P1614 + std::same_as decltype(auto) r1 = iter1 <=> iter2; + assert(r1 == std::strong_ordering::less); +#endif + return true; } @@ -69,8 +76,11 @@ int main(int, char**) { #endif #if TEST_STD_VER > 17 - tests >(); - static_assert(tests >(), ""); + tests>(); + static_assert(tests>()); + + tests>(); + static_assert(tests>()); #endif return 0; diff --git a/libcxx/test/libcxx/system_reserved_names.gen.py b/libcxx/test/libcxx/system_reserved_names.gen.py index 0d935a18addee..956a8d1abe3c3 100644 --- a/libcxx/test/libcxx/system_reserved_names.gen.py +++ b/libcxx/test/libcxx/system_reserved_names.gen.py @@ -17,7 +17,8 @@ from libcxx.header_information import lit_header_restrictions, public_headers for header in public_headers: - print(f"""\ + print( + f"""\ //--- {header}.compile.pass.cpp {lit_header_restrictions.get(header, '')} @@ -162,6 +163,18 @@ #define erase SYSTEM_RESERVED_NAME #define refresh SYSTEM_RESERVED_NAME +// Dinkumware libc ctype.h uses these definitions +#define _XA SYSTEM_RESERVED_NAME +#define _XS SYSTEM_RESERVED_NAME +#define _BB SYSTEM_RESERVED_NAME +#define _CN SYSTEM_RESERVED_NAME +#define _DI SYSTEM_RESERVED_NAME +#define _LO SYSTEM_RESERVED_NAME +#define _PU SYSTEM_RESERVED_NAME +#define _SP SYSTEM_RESERVED_NAME +#define _UP SYSTEM_RESERVED_NAME +#define _XD SYSTEM_RESERVED_NAME + #include <{header}> // Make sure we don't swallow the definition of the macros we push/pop @@ -172,4 +185,5 @@ static_assert(__builtin_strcmp(STRINGIFY(move), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, ""); static_assert(__builtin_strcmp(STRINGIFY(erase), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, ""); static_assert(__builtin_strcmp(STRINGIFY(refresh), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, ""); -""") +""" + ) diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv index 51e659f52000b..6db523002d5d7 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx03.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv @@ -129,6 +129,9 @@ chrono type_traits chrono vector chrono version cinttypes cstdint +cmath cstddef +cmath cstdint +cmath initializer_list cmath limits cmath type_traits cmath version diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv index 17e85e982729c..056eea9e5f3d2 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx11.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv @@ -129,6 +129,9 @@ chrono type_traits chrono vector chrono version cinttypes cstdint +cmath cstddef +cmath cstdint +cmath initializer_list cmath limits cmath type_traits cmath version diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv index 8aed93da9e6cc..5d79ee3cddf6e 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx14.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv @@ -130,6 +130,9 @@ chrono type_traits chrono vector chrono version cinttypes cstdint +cmath cstddef +cmath cstdint +cmath initializer_list cmath limits cmath type_traits cmath version diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv index 2c028462144ee..8099d2b79c4be 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx17.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv @@ -130,6 +130,9 @@ chrono type_traits chrono vector chrono version cinttypes cstdint +cmath cstddef +cmath cstdint +cmath initializer_list cmath limits cmath type_traits cmath version diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv index 982c2013e3417..384e51b101f31 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx20.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv @@ -135,6 +135,9 @@ chrono type_traits chrono vector chrono version cinttypes cstdint +cmath cstddef +cmath cstdint +cmath initializer_list cmath limits cmath type_traits cmath version diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv index 8ffb71d8b566b..46b833d143f39 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx23.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv @@ -83,6 +83,9 @@ chrono string_view chrono vector chrono version cinttypes cstdint +cmath cstddef +cmath cstdint +cmath initializer_list cmath limits cmath version codecvt cctype diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv index 8ffb71d8b566b..46b833d143f39 100644 --- a/libcxx/test/libcxx/transitive_includes/cxx26.csv +++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv @@ -83,6 +83,9 @@ chrono string_view chrono vector chrono version cinttypes cstdint +cmath cstddef +cmath cstdint +cmath initializer_list cmath limits cmath version codecvt cctype diff --git a/libcxx/test/libcxx/vendor/ibm/bad_function_call.pass.cpp b/libcxx/test/libcxx/vendor/ibm/bad_function_call.pass.cpp index 2b684465650fa..3714e4037a2dc 100644 --- a/libcxx/test/libcxx/vendor/ibm/bad_function_call.pass.cpp +++ b/libcxx/test/libcxx/vendor/ibm/bad_function_call.pass.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: target={{powerpc.*-ibm-aix.*}} +// REQUIRES: target={{.+}}-aix{{.*}} // ADDITIONAL_COMPILE_FLAGS: -fvisibility-inlines-hidden // When there is a weak hidden symbol in user code and a strong definition diff --git a/libcxx/test/std/atomics/atomics.lockfree/is_always_lock_free.cpp b/libcxx/test/std/atomics/atomics.lockfree/is_always_lock_free.cpp new file mode 100644 index 0000000000000..2dc7f5c765419 --- /dev/null +++ b/libcxx/test/std/atomics/atomics.lockfree/is_always_lock_free.cpp @@ -0,0 +1,165 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: c++03, c++11, c++14 + +// +// +// template +// class atomic; +// +// static constexpr bool is_always_lock_free; + +#include +#include +#include + +#include "test_macros.h" +#include "atomic_helpers.h" + +template +void check_always_lock_free(std::atomic const& a) { + using InfoT = LockFreeStatusInfo; + + constexpr std::same_as decltype(auto) is_always_lock_free = std::atomic::is_always_lock_free; + + // If we know the status of T for sure, validate the exact result of the function. + if constexpr (InfoT::status_known) { + constexpr LockFreeStatus known_status = InfoT::value; + if constexpr (known_status == LockFreeStatus::always) { + static_assert(is_always_lock_free, "is_always_lock_free is inconsistent with known lock-free status"); + assert(a.is_lock_free() && "is_lock_free() is inconsistent with known lock-free status"); + } else if constexpr (known_status == LockFreeStatus::never) { + static_assert(!is_always_lock_free, "is_always_lock_free is inconsistent with known lock-free status"); + assert(!a.is_lock_free() && "is_lock_free() is inconsistent with known lock-free status"); + } else { + assert(a.is_lock_free() || !a.is_lock_free()); // This is kinda dumb, but we might as well call the function once. + } + } + + // In all cases, also sanity-check it based on the implication always-lock-free => lock-free. + if (is_always_lock_free) { + std::same_as decltype(auto) is_lock_free = a.is_lock_free(); + assert(is_lock_free); + } + ASSERT_NOEXCEPT(a.is_lock_free()); +} + +#define CHECK_ALWAYS_LOCK_FREE(T) \ + do { \ + typedef T type; \ + type obj{}; \ + std::atomic a(obj); \ + check_always_lock_free(a); \ + } while (0) + +void test() { + char c = 'x'; + check_always_lock_free(std::atomic(c)); + + int i = 0; + check_always_lock_free(std::atomic(i)); + + float f = 0.f; + check_always_lock_free(std::atomic(f)); + + int* p = &i; + check_always_lock_free(std::atomic(p)); + + CHECK_ALWAYS_LOCK_FREE(bool); + CHECK_ALWAYS_LOCK_FREE(char); + CHECK_ALWAYS_LOCK_FREE(signed char); + CHECK_ALWAYS_LOCK_FREE(unsigned char); +#if TEST_STD_VER > 17 && defined(__cpp_char8_t) + CHECK_ALWAYS_LOCK_FREE(char8_t); +#endif + CHECK_ALWAYS_LOCK_FREE(char16_t); + CHECK_ALWAYS_LOCK_FREE(char32_t); + CHECK_ALWAYS_LOCK_FREE(wchar_t); + CHECK_ALWAYS_LOCK_FREE(short); + CHECK_ALWAYS_LOCK_FREE(unsigned short); + CHECK_ALWAYS_LOCK_FREE(int); + CHECK_ALWAYS_LOCK_FREE(unsigned int); + CHECK_ALWAYS_LOCK_FREE(long); + CHECK_ALWAYS_LOCK_FREE(unsigned long); + CHECK_ALWAYS_LOCK_FREE(long long); + CHECK_ALWAYS_LOCK_FREE(unsigned long long); + CHECK_ALWAYS_LOCK_FREE(std::nullptr_t); + CHECK_ALWAYS_LOCK_FREE(void*); + CHECK_ALWAYS_LOCK_FREE(float); + CHECK_ALWAYS_LOCK_FREE(double); + CHECK_ALWAYS_LOCK_FREE(long double); +#if __has_attribute(vector_size) && defined(_LIBCPP_VERSION) + CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(1 * sizeof(int))))); + CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(2 * sizeof(int))))); + CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(4 * sizeof(int))))); + CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(16 * sizeof(int))))); + CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(32 * sizeof(int))))); + CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(1 * sizeof(float))))); + CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(2 * sizeof(float))))); + CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(4 * sizeof(float))))); + CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(16 * sizeof(float))))); + CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(32 * sizeof(float))))); + CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(1 * sizeof(double))))); + CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(2 * sizeof(double))))); + CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(4 * sizeof(double))))); + CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(16 * sizeof(double))))); + CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(32 * sizeof(double))))); +#endif // __has_attribute(vector_size) && defined(_LIBCPP_VERSION) + CHECK_ALWAYS_LOCK_FREE(struct Empty{}); + CHECK_ALWAYS_LOCK_FREE(struct OneInt { int i; }); + CHECK_ALWAYS_LOCK_FREE(struct IntArr2 { int i[2]; }); + CHECK_ALWAYS_LOCK_FREE(struct FloatArr3 { float i[3]; }); + CHECK_ALWAYS_LOCK_FREE(struct LLIArr2 { long long int i[2]; }); + CHECK_ALWAYS_LOCK_FREE(struct LLIArr4 { long long int i[4]; }); + CHECK_ALWAYS_LOCK_FREE(struct LLIArr8 { long long int i[8]; }); + CHECK_ALWAYS_LOCK_FREE(struct LLIArr16 { long long int i[16]; }); + CHECK_ALWAYS_LOCK_FREE(struct Padding { + char c; /* padding */ + long long int i; + }); + CHECK_ALWAYS_LOCK_FREE(union IntFloat { + int i; + float f; + }); + CHECK_ALWAYS_LOCK_FREE(enum class CharEnumClass : char{foo}); + + // C macro and static constexpr must be consistent. + enum class CharEnumClass : char { foo }; + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_BOOL_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), ""); +#if TEST_STD_VER > 17 && defined(__cpp_char8_t) + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR8_T_LOCK_FREE), ""); +#endif + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR16_T_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR32_T_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_WCHAR_T_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_SHORT_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_SHORT_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_INT_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_INT_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_LONG_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_LONG_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_LLONG_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_LLONG_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE), ""); + static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE), ""); + +#if TEST_STD_VER >= 20 + static_assert(std::atomic_signed_lock_free::is_always_lock_free, ""); + static_assert(std::atomic_unsigned_lock_free::is_always_lock_free, ""); +#endif +} + +int main(int, char**) { + test(); + return 0; +} diff --git a/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp b/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp deleted file mode 100644 index 6d6e6477bc251..0000000000000 --- a/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp +++ /dev/null @@ -1,120 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: c++03, c++11, c++14 - -// - -// static constexpr bool is_always_lock_free; - -#include -#include -#include - -#include "test_macros.h" - -template -void checkAlwaysLockFree() { - if (std::atomic::is_always_lock_free) { - assert(std::atomic().is_lock_free()); - } -} - -void run() -{ -// structs and unions can't be defined in the template invocation. -// Work around this with a typedef. -#define CHECK_ALWAYS_LOCK_FREE(T) \ - do { \ - typedef T type; \ - checkAlwaysLockFree(); \ - } while (0) - - CHECK_ALWAYS_LOCK_FREE(bool); - CHECK_ALWAYS_LOCK_FREE(char); - CHECK_ALWAYS_LOCK_FREE(signed char); - CHECK_ALWAYS_LOCK_FREE(unsigned char); -#if TEST_STD_VER > 17 && defined(__cpp_char8_t) - CHECK_ALWAYS_LOCK_FREE(char8_t); -#endif - CHECK_ALWAYS_LOCK_FREE(char16_t); - CHECK_ALWAYS_LOCK_FREE(char32_t); - CHECK_ALWAYS_LOCK_FREE(wchar_t); - CHECK_ALWAYS_LOCK_FREE(short); - CHECK_ALWAYS_LOCK_FREE(unsigned short); - CHECK_ALWAYS_LOCK_FREE(int); - CHECK_ALWAYS_LOCK_FREE(unsigned int); - CHECK_ALWAYS_LOCK_FREE(long); - CHECK_ALWAYS_LOCK_FREE(unsigned long); - CHECK_ALWAYS_LOCK_FREE(long long); - CHECK_ALWAYS_LOCK_FREE(unsigned long long); - CHECK_ALWAYS_LOCK_FREE(std::nullptr_t); - CHECK_ALWAYS_LOCK_FREE(void*); - CHECK_ALWAYS_LOCK_FREE(float); - CHECK_ALWAYS_LOCK_FREE(double); - CHECK_ALWAYS_LOCK_FREE(long double); -#if __has_attribute(vector_size) && defined(_LIBCPP_VERSION) - CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(1 * sizeof(int))))); - CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(2 * sizeof(int))))); - CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(4 * sizeof(int))))); - CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(16 * sizeof(int))))); - CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(32 * sizeof(int))))); - CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(1 * sizeof(float))))); - CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(2 * sizeof(float))))); - CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(4 * sizeof(float))))); - CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(16 * sizeof(float))))); - CHECK_ALWAYS_LOCK_FREE(float __attribute__((vector_size(32 * sizeof(float))))); - CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(1 * sizeof(double))))); - CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(2 * sizeof(double))))); - CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(4 * sizeof(double))))); - CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(16 * sizeof(double))))); - CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(32 * sizeof(double))))); -#endif // __has_attribute(vector_size) && defined(_LIBCPP_VERSION) - CHECK_ALWAYS_LOCK_FREE(struct Empty {}); - CHECK_ALWAYS_LOCK_FREE(struct OneInt { int i; }); - CHECK_ALWAYS_LOCK_FREE(struct IntArr2 { int i[2]; }); - CHECK_ALWAYS_LOCK_FREE(struct FloatArr3 { float i[3]; }); - CHECK_ALWAYS_LOCK_FREE(struct LLIArr2 { long long int i[2]; }); - CHECK_ALWAYS_LOCK_FREE(struct LLIArr4 { long long int i[4]; }); - CHECK_ALWAYS_LOCK_FREE(struct LLIArr8 { long long int i[8]; }); - CHECK_ALWAYS_LOCK_FREE(struct LLIArr16 { long long int i[16]; }); - CHECK_ALWAYS_LOCK_FREE(struct Padding { char c; /* padding */ long long int i; }); - CHECK_ALWAYS_LOCK_FREE(union IntFloat { int i; float f; }); - CHECK_ALWAYS_LOCK_FREE(enum class CharEnumClass : char { foo }); - - // C macro and static constexpr must be consistent. - enum class CharEnumClass : char { foo }; - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_BOOL_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), ""); -#if TEST_STD_VER > 17 && defined(__cpp_char8_t) - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR8_T_LOCK_FREE), ""); -#endif - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR16_T_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_CHAR32_T_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_WCHAR_T_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_SHORT_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_SHORT_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_INT_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_INT_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_LONG_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_LONG_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_LLONG_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_LLONG_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE), ""); - static_assert(std::atomic::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE), ""); - -#if TEST_STD_VER >= 20 - static_assert(std::atomic_signed_lock_free::is_always_lock_free, ""); - static_assert(std::atomic_unsigned_lock_free::is_always_lock_free, ""); -#endif -} - -int main(int, char**) { run(); return 0; } diff --git a/libcxx/test/std/atomics/atomics.ref/is_always_lock_free.pass.cpp b/libcxx/test/std/atomics/atomics.ref/is_always_lock_free.pass.cpp index 94f65e3b4b669..78e46c0397951 100644 --- a/libcxx/test/std/atomics/atomics.ref/is_always_lock_free.pass.cpp +++ b/libcxx/test/std/atomics/atomics.ref/is_always_lock_free.pass.cpp @@ -9,7 +9,10 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // - +// +// template +// class atomic_ref; +// // static constexpr bool is_always_lock_free; // bool is_lock_free() const noexcept; @@ -18,10 +21,29 @@ #include #include "test_macros.h" +#include "atomic_helpers.h" template -void check_always_lock_free(std::atomic_ref const a) { - std::same_as decltype(auto) is_always_lock_free = std::atomic_ref::is_always_lock_free; +void check_always_lock_free(std::atomic_ref const& a) { + using InfoT = LockFreeStatusInfo; + + constexpr std::same_as decltype(auto) is_always_lock_free = std::atomic_ref::is_always_lock_free; + + // If we know the status of T for sure, validate the exact result of the function. + if constexpr (InfoT::status_known) { + constexpr LockFreeStatus known_status = InfoT::value; + if constexpr (known_status == LockFreeStatus::always) { + static_assert(is_always_lock_free, "is_always_lock_free is inconsistent with known lock-free status"); + assert(a.is_lock_free() && "is_lock_free() is inconsistent with known lock-free status"); + } else if constexpr (known_status == LockFreeStatus::never) { + static_assert(!is_always_lock_free, "is_always_lock_free is inconsistent with known lock-free status"); + assert(!a.is_lock_free() && "is_lock_free() is inconsistent with known lock-free status"); + } else { + assert(a.is_lock_free() || !a.is_lock_free()); // This is kinda dumb, but we might as well call the function once. + } + } + + // In all cases, also sanity-check it based on the implication always-lock-free => lock-free. if (is_always_lock_free) { std::same_as decltype(auto) is_lock_free = a.is_lock_free(); assert(is_lock_free); @@ -32,11 +54,15 @@ void check_always_lock_free(std::atomic_ref const a) { #define CHECK_ALWAYS_LOCK_FREE(T) \ do { \ typedef T type; \ - type obj{}; \ - check_always_lock_free(std::atomic_ref(obj)); \ + alignas(std::atomic_ref::required_alignment) type obj{}; \ + std::atomic_ref a(obj); \ + check_always_lock_free(a); \ } while (0) void test() { + char c = 'x'; + check_always_lock_free(std::atomic_ref(c)); + int i = 0; check_always_lock_free(std::atomic_ref(i)); diff --git a/libcxx/test/std/containers/sequences/array/iterators.pass.cpp b/libcxx/test/std/containers/sequences/array/iterators.pass.cpp index 106bc45c70998..710994c68295e 100644 --- a/libcxx/test/std/containers/sequences/array/iterators.pass.cpp +++ b/libcxx/test/std/containers/sequences/array/iterators.pass.cpp @@ -148,6 +148,15 @@ TEST_CONSTEXPR_CXX17 bool tests() assert(std::rbegin(c) != std::rend(c)); assert(std::cbegin(c) != std::cend(c)); assert(std::crbegin(c) != std::crend(c)); + +# if TEST_STD_VER >= 20 + // P1614 + LWG3352 + std::same_as decltype(auto) r1 = ii1 <=> ii2; + assert(r1 == std::strong_ordering::equal); + + std::same_as decltype(auto) r2 = cii <=> ii2; + assert(r2 == std::strong_ordering::equal); +# endif } { typedef std::array C; @@ -189,6 +198,15 @@ TEST_CONSTEXPR_CXX17 bool tests() assert(std::rbegin(c) == std::rend(c)); assert(std::cbegin(c) == std::cend(c)); assert(std::crbegin(c) == std::crend(c)); + +# if TEST_STD_VER >= 20 + // P1614 + LWG3352 + std::same_as decltype(auto) r1 = ii1 <=> ii2; + assert(r1 == std::strong_ordering::equal); + + std::same_as decltype(auto) r2 = cii <=> ii2; + assert(r2 == std::strong_ordering::equal); +# endif } } #endif diff --git a/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp b/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp index 1f06ffde41ac2..484a2961fdb0c 100644 --- a/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp @@ -41,7 +41,27 @@ int main(int, char**) i = c.begin(); C::const_iterator j; j = c.cbegin(); + assert(i == j); + assert(!(i != j)); + + assert(!(i < j)); + assert((i <= j)); + + assert(!(i > j)); + assert((i >= j)); + +# if TEST_STD_VER >= 20 + // P1614 + LWG3352 + // When the allocator does not have operator<=> then the iterator uses a + // fallback to provide operator<=>. + // Make sure to test with an allocator that does not have operator<=>. + static_assert(!std::three_way_comparable, std::strong_ordering>); + static_assert(std::three_way_comparable); + + std::same_as decltype(auto) r1 = i <=> j; + assert(r1 == std::strong_ordering::equal); +# endif } #endif #if TEST_STD_VER > 11 @@ -74,6 +94,15 @@ int main(int, char**) // assert ( cii != c.begin()); // assert ( cii != c.cend()); // assert ( ii1 != c.end()); + +# if TEST_STD_VER >= 20 + // P1614 + LWG3352 + std::same_as decltype(auto) r1 = ii1 <=> ii2; + assert(r1 == std::strong_ordering::equal); + + std::same_as decltype(auto) r2 = cii <=> ii2; + assert(r2 == std::strong_ordering::equal); +# endif // TEST_STD_VER > 20 } #endif diff --git a/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp index 9aaaac7a5557f..1e4877e8d2443 100644 --- a/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp @@ -77,7 +77,21 @@ TEST_CONSTEXPR_CXX20 bool tests() C::iterator i = c.begin(); C::iterator j = c.end(); assert(std::distance(i, j) == 0); + assert(i == j); + assert(!(i != j)); + + assert(!(i < j)); + assert((i <= j)); + + assert(!(i > j)); + assert((i >= j)); + +# if TEST_STD_VER >= 20 + // P1614 + LWG3352 + std::same_as decltype(auto) r = i <=> j; + assert(r == std::strong_ordering::equal); +# endif } { typedef bool T; @@ -86,7 +100,21 @@ TEST_CONSTEXPR_CXX20 bool tests() C::const_iterator i = c.begin(); C::const_iterator j = c.end(); assert(std::distance(i, j) == 0); + assert(i == j); + assert(!(i != j)); + + assert(!(i < j)); + assert((i <= j)); + + assert(!(i > j)); + assert((i >= j)); + +# if TEST_STD_VER >= 20 + // P1614 + LWG3352 + std::same_as decltype(auto) r = i <=> j; + assert(r == std::strong_ordering::equal); +# endif } { typedef bool T; @@ -131,6 +159,15 @@ TEST_CONSTEXPR_CXX20 bool tests() assert ( (cii >= ii1 )); assert (cii - ii1 == 0); assert (ii1 - cii == 0); + +# if TEST_STD_VER >= 20 + // P1614 + LWG3352 + std::same_as decltype(auto) r1 = ii1 <=> ii2; + assert(r1 == std::strong_ordering::equal); + + std::same_as decltype(auto) r2 = cii <=> ii2; + assert(r2 == std::strong_ordering::equal); +# endif // TEST_STD_VER > 20 } #endif diff --git a/libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp index b39245cab7bf4..f8bcee31964bb 100644 --- a/libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp @@ -39,11 +39,54 @@ TEST_CONSTEXPR_CXX20 bool tests() return true; } +#if TEST_STD_VER >= 23 +template +struct increasing_allocator { + using value_type = T; + std::size_t min_elements = 1000; + increasing_allocator() = default; + + template + constexpr increasing_allocator(const increasing_allocator& other) noexcept : min_elements(other.min_elements) {} + + constexpr std::allocation_result allocate_at_least(std::size_t n) { + if (n < min_elements) + n = min_elements; + min_elements += 1000; + return std::allocator{}.allocate_at_least(n); + } + constexpr T* allocate(std::size_t n) { return allocate_at_least(n).ptr; } + constexpr void deallocate(T* p, std::size_t n) noexcept { std::allocator{}.deallocate(p, n); } +}; + +template +bool operator==(increasing_allocator, increasing_allocator) { + return true; +} + +// https://github.com/llvm/llvm-project/issues/95161 +constexpr bool test_increasing_allocator() { + std::vector> v; + v.push_back(1); + std::size_t capacity = v.capacity(); + v.shrink_to_fit(); + assert(v.capacity() <= capacity); + assert(v.size() == 1); + + return true; +} +#endif // TEST_STD_VER >= 23 + int main(int, char**) { - tests(); + tests(); #if TEST_STD_VER > 17 static_assert(tests()); #endif +#if TEST_STD_VER >= 23 + test_increasing_allocator(); + static_assert(test_increasing_allocator()); +#endif // TEST_STD_VER >= 23 + return 0; } diff --git a/libcxx/test/std/containers/sequences/vector/iterators.pass.cpp b/libcxx/test/std/containers/sequences/vector/iterators.pass.cpp index 70e0e35767e09..0aa7ad0d42ed7 100644 --- a/libcxx/test/std/containers/sequences/vector/iterators.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/iterators.pass.cpp @@ -87,7 +87,27 @@ TEST_CONSTEXPR_CXX20 bool tests() C::iterator i = c.begin(); C::iterator j = c.end(); assert(std::distance(i, j) == 0); + assert(i == j); + assert(!(i != j)); + + assert(!(i < j)); + assert((i <= j)); + + assert(!(i > j)); + assert((i >= j)); + +# if TEST_STD_VER >= 20 + // P1614 + LWG3352 + // When the allocator does not have operator<=> then the iterator uses a + // fallback to provide operator<=>. + // Make sure to test with an allocator that does not have operator<=>. + static_assert(!std::three_way_comparable, std::strong_ordering>); + static_assert(std::three_way_comparable); + + std::same_as decltype(auto) r1 = i <=> j; + assert(r1 == std::strong_ordering::equal); +# endif } { typedef int T; @@ -96,7 +116,26 @@ TEST_CONSTEXPR_CXX20 bool tests() C::const_iterator i = c.begin(); C::const_iterator j = c.end(); assert(std::distance(i, j) == 0); + assert(i == j); + assert(!(i != j)); + + assert(!(i < j)); + assert((i <= j)); + + assert(!(i > j)); + assert((i >= j)); + +# if TEST_STD_VER >= 20 + // When the allocator does not have operator<=> then the iterator uses a + // fallback to provide operator<=>. + // Make sure to test with an allocator that does not have operator<=>. + static_assert(!std::three_way_comparable, std::strong_ordering>); + static_assert(std::three_way_comparable); + + std::same_as decltype(auto) r1 = i <=> j; + assert(r1 == std::strong_ordering::equal); +# endif } { typedef int T; @@ -164,8 +203,16 @@ TEST_CONSTEXPR_CXX20 bool tests() assert ( (cii >= ii1 )); assert (cii - ii1 == 0); assert (ii1 - cii == 0); +# if TEST_STD_VER >= 20 + // P1614 + LWG3352 + std::same_as decltype(auto) r1 = ii1 <=> ii2; + assert(r1 == std::strong_ordering::equal); + + std::same_as decltype(auto) r2 = cii <=> ii2; + assert(r2 == std::strong_ordering::equal); +# endif // TEST_STD_VER > 20 } -#endif +#endif // TEST_STD_VER > 11 return true; } diff --git a/libcxx/test/std/containers/views/views.span/span.cons/copy.pass.cpp b/libcxx/test/std/containers/views/views.span/span.cons/copy.pass.cpp index 28f13e122ddc5..d3990fd60a459 100644 --- a/libcxx/test/std/containers/views/views.span/span.cons/copy.pass.cpp +++ b/libcxx/test/std/containers/views/views.span/span.cons/copy.pass.cpp @@ -5,6 +5,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// + // UNSUPPORTED: c++03, c++11, c++14, c++17 // @@ -14,58 +15,101 @@ #include #include #include +#include #include "test_macros.h" -template -constexpr bool doCopy(const T &rhs) -{ - ASSERT_NOEXCEPT(T{rhs}); - T lhs{rhs}; - return lhs.data() == rhs.data() - && lhs.size() == rhs.size(); -} +template +constexpr void test() { + ASSERT_NOEXCEPT(std::span(std::declval const&>())); + ASSERT_NOEXCEPT(std::span{std::declval const&>()}); -struct A{}; - -template -void testCV () -{ - int arr[] = {1,2,3}; - assert((doCopy(std::span () ))); - assert((doCopy(std::span() ))); - assert((doCopy(std::span (&arr[0], 1)))); - assert((doCopy(std::span(&arr[0], 1)))); - assert((doCopy(std::span (&arr[0], 2)))); - assert((doCopy(std::span(&arr[0], 2)))); + // dynamic_extent + { + std::span x; + std::span copy(x); + assert(copy.data() == x.data()); + assert(copy.size() == x.size()); + } + { + T array[3] = {}; + std::span x(array, 3); + std::span copy(x); + assert(copy.data() == array); + assert(copy.size() == 3); + } + { + T array[3] = {}; + std::span x(array, 2); + std::span copy(x); + assert(copy.data() == array); + assert(copy.size() == 2); + } + + // static extent + { + std::span x; + std::span copy(x); + assert(copy.data() == x.data()); + assert(copy.size() == x.size()); + } + { + T array[3] = {}; + std::span x(array); + std::span copy(x); + assert(copy.data() == array); + assert(copy.size() == 3); + } + { + T array[2] = {}; + std::span x(array); + std::span copy(x); + assert(copy.data() == array); + assert(copy.size() == 2); + } } +struct Foo {}; + +constexpr bool test_all() { + test(); + test(); + test(); + test(); -int main(int, char**) -{ - constexpr int carr[] = {1,2,3}; + test(); + test(); + test(); + test(); - static_assert(doCopy(std::span< int> ()), ""); - static_assert(doCopy(std::span< int,0>()), ""); - static_assert(doCopy(std::span (&carr[0], 1)), ""); - static_assert(doCopy(std::span(&carr[0], 1)), ""); - static_assert(doCopy(std::span (&carr[0], 2)), ""); - static_assert(doCopy(std::span(&carr[0], 2)), ""); + test(); + test(); + test(); + test(); - static_assert(doCopy(std::span()), ""); - static_assert(doCopy(std::span()), ""); - static_assert(doCopy(std::span()), ""); + // Note: Can't test non-fundamental types with volatile because we require `T*` to be indirectly_readable, + // which isn't the case when T is volatile. + test(); + test(); - std::string s; - assert(doCopy(std::span () )); - assert(doCopy(std::span() )); - assert(doCopy(std::span (&s, 1))); - assert(doCopy(std::span(&s, 1))); + test(); + test(); + + // Regression test for https://github.com/llvm/llvm-project/issues/104496 + { + struct Incomplete; + std::span x; + std::span copy(x); + assert(copy.data() == x.data()); + assert(copy.size() == x.size()); + } + + return true; +} - testCV< int>(); - testCV(); - testCV< volatile int>(); - testCV(); +int main(int, char**) { + test_all(); + static_assert(test_all()); return 0; } diff --git a/libcxx/test/std/containers/views/views.span/span.iterators/iterator.pass.cpp b/libcxx/test/std/containers/views/views.span/span.iterators/iterator.pass.cpp new file mode 100644 index 0000000000000..13a7628e6043d --- /dev/null +++ b/libcxx/test/std/containers/views/views.span/span.iterators/iterator.pass.cpp @@ -0,0 +1,92 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// class iterator + +#include +#include +#include +#include +#include +#include // __cpp_lib_ranges_as_const is not defined in span. + +#include "test_macros.h" + +template +constexpr void test_type() { + using C = std::span; + typename C::iterator ii1{}, ii2{}; + typename C::iterator ii4 = ii1; + // TODO Test against C++23 after implementing + // P2278R4 cbegin should always return a constant iterator + // The means adjusting the #ifdef to guard against C++23. +#ifdef __cpp_lib_ranges_as_const + typename C::const_iterator cii{}; +#endif + assert(ii1 == ii2); + assert(ii1 == ii4); +#ifdef __cpp_lib_ranges_as_const + assert(ii1 == cii); +#endif + + assert(!(ii1 != ii2)); +#ifdef __cpp_lib_ranges_as_const + assert(!(ii1 != cii)); +#endif + + T v; + C c{&v, 1}; + assert(c.begin() == std::begin(c)); + assert(c.rbegin() == std::rbegin(c)); +#ifdef __cpp_lib_ranges_as_const + assert(c.cbegin() == std::cbegin(c)); + assert(c.crbegin() == std::crbegin(c)); +#endif + + assert(c.end() == std::end(c)); + assert(c.rend() == std::rend(c)); +#ifdef __cpp_lib_ranges_as_const + assert(c.cend() == std::cend(c)); + assert(c.crend() == std::crend(c)); +#endif + + assert(std::begin(c) != std::end(c)); + assert(std::rbegin(c) != std::rend(c)); +#ifdef __cpp_lib_ranges_as_const + assert(std::cbegin(c) != std::cend(c)); + assert(std::crbegin(c) != std::crend(c)); +#endif + + // P1614 + LWG3352 + std::same_as decltype(auto) r1 = ii1 <=> ii2; + assert(r1 == std::strong_ordering::equal); + +#ifdef __cpp_lib_ranges_as_const + std::same_as decltype(auto) r2 = cii <=> ii2; + assert(r2 == std::strong_ordering::equal); +#endif +} + +constexpr bool test() { + test_type(); + test_type(); + test_type(); + + return true; +} + +int main(int, char**) { + test(); + static_assert(test(), ""); + + return 0; +} diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp index aac00f20c7b45..1d61f43f9ee51 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp @@ -16,7 +16,7 @@ // Test the feature test macros defined by /* Constant Value - __cpp_lib_three_way_comparison 201711L [C++20] + __cpp_lib_three_way_comparison 201907L [C++20] */ #include @@ -45,8 +45,8 @@ # ifndef __cpp_lib_three_way_comparison # error "__cpp_lib_three_way_comparison should be defined in c++20" # endif -# if __cpp_lib_three_way_comparison != 201711L -# error "__cpp_lib_three_way_comparison should have the value 201711L in c++20" +# if __cpp_lib_three_way_comparison != 201907L +# error "__cpp_lib_three_way_comparison should have the value 201907L in c++20" # endif #elif TEST_STD_VER == 23 @@ -54,8 +54,8 @@ # ifndef __cpp_lib_three_way_comparison # error "__cpp_lib_three_way_comparison should be defined in c++23" # endif -# if __cpp_lib_three_way_comparison != 201711L -# error "__cpp_lib_three_way_comparison should have the value 201711L in c++23" +# if __cpp_lib_three_way_comparison != 201907L +# error "__cpp_lib_three_way_comparison should have the value 201907L in c++23" # endif #elif TEST_STD_VER > 23 @@ -63,8 +63,8 @@ # ifndef __cpp_lib_three_way_comparison # error "__cpp_lib_three_way_comparison should be defined in c++26" # endif -# if __cpp_lib_three_way_comparison != 201711L -# error "__cpp_lib_three_way_comparison should have the value 201711L in c++26" +# if __cpp_lib_three_way_comparison != 201907L +# error "__cpp_lib_three_way_comparison should have the value 201907L in c++26" # endif #endif // TEST_STD_VER > 23 diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp index f26e7dc4b4c63..b8bad696f1bae 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp @@ -221,7 +221,7 @@ __cpp_lib_submdspan 202306L [C++26] __cpp_lib_syncbuf 201803L [C++20] __cpp_lib_text_encoding 202306L [C++26] - __cpp_lib_three_way_comparison 201711L [C++20] + __cpp_lib_three_way_comparison 201907L [C++20] __cpp_lib_to_address 201711L [C++20] __cpp_lib_to_array 201907L [C++20] __cpp_lib_to_chars 201611L [C++17] @@ -4438,8 +4438,8 @@ # ifndef __cpp_lib_three_way_comparison # error "__cpp_lib_three_way_comparison should be defined in c++20" # endif -# if __cpp_lib_three_way_comparison != 201711L -# error "__cpp_lib_three_way_comparison should have the value 201711L in c++20" +# if __cpp_lib_three_way_comparison != 201907L +# error "__cpp_lib_three_way_comparison should have the value 201907L in c++20" # endif # ifndef __cpp_lib_to_address @@ -6037,8 +6037,8 @@ # ifndef __cpp_lib_three_way_comparison # error "__cpp_lib_three_way_comparison should be defined in c++23" # endif -# if __cpp_lib_three_way_comparison != 201711L -# error "__cpp_lib_three_way_comparison should have the value 201711L in c++23" +# if __cpp_lib_three_way_comparison != 201907L +# error "__cpp_lib_three_way_comparison should have the value 201907L in c++23" # endif # ifndef __cpp_lib_to_address @@ -7960,8 +7960,8 @@ # ifndef __cpp_lib_three_way_comparison # error "__cpp_lib_three_way_comparison should be defined in c++26" # endif -# if __cpp_lib_three_way_comparison != 201711L -# error "__cpp_lib_three_way_comparison should have the value 201711L in c++26" +# if __cpp_lib_three_way_comparison != 201907L +# error "__cpp_lib_three_way_comparison should have the value 201907L in c++26" # endif # ifndef __cpp_lib_to_address diff --git a/libcxx/test/std/numerics/bit/bitops.rot/rotl.pass.cpp b/libcxx/test/std/numerics/bit/bitops.rot/rotl.pass.cpp index 50e498b5761e5..16eabbd2a5a4d 100644 --- a/libcxx/test/std/numerics/bit/bitops.rot/rotl.pass.cpp +++ b/libcxx/test/std/numerics/bit/bitops.rot/rotl.pass.cpp @@ -41,6 +41,8 @@ constexpr bool test() assert(std::rotl(T(max - 1), 5) == T(max - 32)); assert(std::rotl(T(max - 1), 6) == T(max - 64)); assert(std::rotl(T(max - 1), 7) == T(max - 128)); + assert(std::rotl(T(max - 1), std::numeric_limits::max()) == + std::rotl(T(max - 1), std::numeric_limits::max() % std::numeric_limits::digits)); assert(std::rotl(T(max - 1), -1) == T(max - highbit)); assert(std::rotl(T(max - 1), -2) == T(max - (highbit >> 1))); @@ -49,6 +51,8 @@ constexpr bool test() assert(std::rotl(T(max - 1), -5) == T(max - (highbit >> 4))); assert(std::rotl(T(max - 1), -6) == T(max - (highbit >> 5))); assert(std::rotl(T(max - 1), -7) == T(max - (highbit >> 6))); + assert(std::rotl(T(max - 1), std::numeric_limits::min()) == + std::rotl(T(max - 1), std::numeric_limits::min() % std::numeric_limits::digits)); assert(std::rotl(T(1), 0) == T(1)); assert(std::rotl(T(1), 1) == T(2)); diff --git a/libcxx/test/std/numerics/bit/bitops.rot/rotr.pass.cpp b/libcxx/test/std/numerics/bit/bitops.rot/rotr.pass.cpp index 00c9e617d2edf..53405588266f7 100644 --- a/libcxx/test/std/numerics/bit/bitops.rot/rotr.pass.cpp +++ b/libcxx/test/std/numerics/bit/bitops.rot/rotr.pass.cpp @@ -41,6 +41,8 @@ constexpr bool test() assert(std::rotr(T(max - 1), 5) == T(max - (highbit >> 4))); assert(std::rotr(T(max - 1), 6) == T(max - (highbit >> 5))); assert(std::rotr(T(max - 1), 7) == T(max - (highbit >> 6))); + assert(std::rotr(T(max - 1), std::numeric_limits::max()) == + std::rotr(T(max - 1), std::numeric_limits::max() % std::numeric_limits::digits)); assert(std::rotr(T(max - 1), -1) == T(max - 2)); assert(std::rotr(T(max - 1), -2) == T(max - 4)); @@ -49,6 +51,8 @@ constexpr bool test() assert(std::rotr(T(max - 1), -5) == T(max - 32)); assert(std::rotr(T(max - 1), -6) == T(max - 64)); assert(std::rotr(T(max - 1), -7) == T(max - 128)); + assert(std::rotr(T(max - 1), std::numeric_limits::min()) == + std::rotr(T(max - 1), std::numeric_limits::min() % std::numeric_limits::digits)); assert(std::rotr(T(128), 0) == T(128)); assert(std::rotr(T(128), 1) == T(64)); diff --git a/libcxx/test/std/numerics/c.math/cmath.pass.cpp b/libcxx/test/std/numerics/c.math/cmath.pass.cpp index 9379084499792..19b5fd0cf8996 100644 --- a/libcxx/test/std/numerics/c.math/cmath.pass.cpp +++ b/libcxx/test/std/numerics/c.math/cmath.pass.cpp @@ -12,14 +12,17 @@ // +#include #include #include #include #include +#include "fp_compare.h" #include "test_macros.h" #include "hexfloat.h" #include "truncate_fp.h" +#include "type_algorithms.h" // convertible to int/float/double/etc template @@ -1113,6 +1116,56 @@ void test_fmin() assert(std::fmin(1,0) == 0); } +#if TEST_STD_VER >= 17 +struct TestHypot3 { + template + void operator()() const { + const auto check = [](Real elem, Real abs_tol) { + assert(std::isfinite(std::hypot(elem, Real(0), Real(0)))); + assert(fptest_close(std::hypot(elem, Real(0), Real(0)), elem, abs_tol)); + assert(std::isfinite(std::hypot(elem, elem, Real(0)))); + assert(fptest_close(std::hypot(elem, elem, Real(0)), std::sqrt(Real(2)) * elem, abs_tol)); + assert(std::isfinite(std::hypot(elem, elem, elem))); + assert(fptest_close(std::hypot(elem, elem, elem), std::sqrt(Real(3)) * elem, abs_tol)); + }; + + { // check for overflow + const auto [elem, abs_tol] = []() -> std::array { + if constexpr (std::is_same_v) + return {1e20f, 1e16f}; + else if constexpr (std::is_same_v) + return {1e300, 1e287}; + else { // long double +# if __DBL_MAX_EXP__ == __LDBL_MAX_EXP__ + return {1e300l, 1e287l}; // 64-bit +# else + return {1e4000l, 1e3985l}; // 80- or 128-bit +# endif + } + }(); + check(elem, abs_tol); + } + + { // check for underflow + const auto [elem, abs_tol] = []() -> std::array { + if constexpr (std::is_same_v) + return {1e-20f, 1e-24f}; + else if constexpr (std::is_same_v) + return {1e-287, 1e-300}; + else { // long double +# if __DBL_MAX_EXP__ == __LDBL_MAX_EXP__ + return {1e-287l, 1e-300l}; // 64-bit +# else + return {1e-3985l, 1e-4000l}; // 80- or 128-bit +# endif + } + }(); + check(elem, abs_tol); + } + } +}; +#endif + void test_hypot() { static_assert((std::is_same::value), ""); @@ -1135,25 +1188,31 @@ void test_hypot() static_assert((std::is_same::value), ""); assert(std::hypot(3,4) == 5); -#if TEST_STD_VER > 14 - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); +#if TEST_STD_VER >= 17 + // clang-format off + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + static_assert((std::is_same_v)); + // clang-format on assert(std::hypot(2,3,6) == 7); assert(std::hypot(1,4,8) == 9); + + // Check for undue over-/underflows of intermediate results. + // See discussion at https://github.com/llvm/llvm-project/issues/92782. + types::for_each(types::floating_point_types(), TestHypot3()); #endif } diff --git a/libcxx/test/std/numerics/complex.number/complex.special/gh_101960_ambiguous_ctor.pass.cpp b/libcxx/test/std/numerics/complex.number/complex.special/gh_101960_ambiguous_ctor.pass.cpp new file mode 100644 index 0000000000000..bffe8764386a7 --- /dev/null +++ b/libcxx/test/std/numerics/complex.number/complex.special/gh_101960_ambiguous_ctor.pass.cpp @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// + +// Regression test for https://github.com/llvm/llvm-project/issues/101960 where we used to +// trigger an ambiguous constructor. + +#include +#include + +struct NastyConvertible { + template + operator T() const { + return T(0); + } +}; + +template +void test() { + NastyConvertible nasty; + std::complex x(nasty, nasty); + assert(x.real() == T(0)); + assert(x.imag() == T(0)); +} + +int main(int, char**) { + test(); + test(); + test(); + + return 0; +} diff --git a/libcxx/test/std/re/re.traits/transform.pass.cpp b/libcxx/test/std/re/re.traits/transform.pass.cpp index 369dbdf7053ba..80cd3f01faff2 100644 --- a/libcxx/test/std/re/re.traits/transform.pass.cpp +++ b/libcxx/test/std/re/re.traits/transform.pass.cpp @@ -8,7 +8,6 @@ // // NetBSD does not support LC_COLLATE at the moment // XFAIL: netbsd -// XFAIL: LIBCXX-AIX-FIXME // REQUIRES: locale.cs_CZ.ISO8859-2 diff --git a/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp index 057050cdcf7fa..6f5e43d1341f5 100644 --- a/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp @@ -63,8 +63,49 @@ TEST_CONSTEXPR_CXX20 bool test() { return true; } +#if TEST_STD_VER >= 23 +std::size_t min_bytes = 1000; + +template +struct increasing_allocator { + using value_type = T; + increasing_allocator() = default; + template + increasing_allocator(const increasing_allocator&) noexcept {} + std::allocation_result allocate_at_least(std::size_t n) { + std::size_t allocation_amount = n * sizeof(T); + if (allocation_amount < min_bytes) + allocation_amount = min_bytes; + min_bytes += 1000; + return {static_cast(::operator new(allocation_amount)), allocation_amount / sizeof(T)}; + } + T* allocate(std::size_t n) { return allocate_at_least(n).ptr; } + void deallocate(T* p, std::size_t) noexcept { ::operator delete(static_cast(p)); } +}; + +template +bool operator==(increasing_allocator, increasing_allocator) { + return true; +} + +// https://github.com/llvm/llvm-project/issues/95161 +void test_increasing_allocator() { + std::basic_string, increasing_allocator> s{ + "String does not fit in the internal buffer"}; + std::size_t capacity = s.capacity(); + std::size_t size = s.size(); + s.shrink_to_fit(); + assert(s.capacity() <= capacity); + assert(s.size() == size); + LIBCPP_ASSERT(is_string_asan_correct(s)); +} +#endif // TEST_STD_VER >= 23 + int main(int, char**) { test(); +#if TEST_STD_VER >= 23 + test_increasing_allocator(); +#endif #if TEST_STD_VER > 17 static_assert(test()); #endif diff --git a/libcxx/test/std/strings/string.view/string.view.iterators/iterators.pass.cpp b/libcxx/test/std/strings/string.view/string.view.iterators/iterators.pass.cpp new file mode 100644 index 0000000000000..75d492bf7b3c6 --- /dev/null +++ b/libcxx/test/std/strings/string.view/string.view.iterators/iterators.pass.cpp @@ -0,0 +1,85 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: !stdlib=libc++ && (c++03 || c++11 || c++14) + +// + +// class iterator + +#include +#include +#include +#include + +#include "test_macros.h" +#include "make_string.h" + +template +TEST_CONSTEXPR_CXX14 void test_type() { + using C = std::basic_string_view; + typename C::iterator ii1 = typename C::iterator(), ii2 = typename C::iterator(); + typename C::iterator ii4 = ii1; + typename C::const_iterator cii = typename C::const_iterator(); + assert(ii1 == ii2); + assert(ii1 == ii4); + assert(ii1 == cii); + + assert(!(ii1 != ii2)); + assert(!(ii1 != cii)); + +#if TEST_STD_VER >= 17 + C c = MAKE_STRING_VIEW(CharT, "abc"); + assert(c.begin() == std::begin(c)); + assert(c.rbegin() == std::rbegin(c)); + assert(c.cbegin() == std::cbegin(c)); + assert(c.crbegin() == std::crbegin(c)); + + assert(c.end() == std::end(c)); + assert(c.rend() == std::rend(c)); + assert(c.cend() == std::cend(c)); + assert(c.crend() == std::crend(c)); + + assert(std::begin(c) != std::end(c)); + assert(std::rbegin(c) != std::rend(c)); + assert(std::cbegin(c) != std::cend(c)); + assert(std::crbegin(c) != std::crend(c)); +#endif + +#if TEST_STD_VER >= 20 + // P1614 + LWG3352 + std::same_as decltype(auto) r1 = ii1 <=> ii2; + assert(r1 == std::strong_ordering::equal); + + std::same_as decltype(auto) r2 = ii1 <=> ii2; + assert(r2 == std::strong_ordering::equal); +#endif +} + +TEST_CONSTEXPR_CXX14 bool test() { + test_type(); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + test_type(); +#endif +#ifndef TEST_HAS_NO_CHAR8_T + test_type(); +#endif + test_type(); + test_type(); + + return true; +} + +int main(int, char**) { + test(); +#if TEST_STD_VER >= 14 + static_assert(test(), ""); +#endif + + return 0; +} diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/gh_101960_internal_ctor.compile.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/gh_101960_internal_ctor.compile.pass.cpp new file mode 100644 index 0000000000000..1a1d6f52a5fec --- /dev/null +++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/gh_101960_internal_ctor.compile.pass.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11, c++14 + +// + +// Regression test for https://github.com/llvm/llvm-project/issues/101960 where a constructor +// of std::optional that should have been private was instead publicly available. + +#include +#include + +struct NastyConvertible { + template + operator T() { + return 0; + } +}; + +using F = int(int); + +static_assert(!std::is_constructible, NastyConvertible, int(int), int>::value); diff --git a/libcxx/test/support/atomic_helpers.h b/libcxx/test/support/atomic_helpers.h index 0266a0961067b..d2f2b751cb47d 100644 --- a/libcxx/test/support/atomic_helpers.h +++ b/libcxx/test/support/atomic_helpers.h @@ -11,9 +11,112 @@ #include #include +#include +#include #include "test_macros.h" +#if defined(TEST_COMPILER_CLANG) +# define TEST_ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE +# define TEST_ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE +# define TEST_ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE +# define TEST_ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE +# define TEST_ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE +# define TEST_ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE +#elif defined(TEST_COMPILER_GCC) +# define TEST_ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +# define TEST_ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +# define TEST_ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +# define TEST_ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +# define TEST_ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +# define TEST_ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#elif TEST_COMPILER_MSVC +// This is lifted from STL/stl/inc/atomic on github for the purposes of +// keeping the tests compiling for MSVC's STL. It's not a perfect solution +// but at least the tests will keep running. +// +// Note MSVC's STL never produces a type that is sometimes lock free, but not always lock free. +template +constexpr bool msvc_is_lock_free_macro_value() { + return (Size <= 8 && (Size & Size - 1) == 0) ? 2 : 0; +} +# define TEST_ATOMIC_CHAR_LOCK_FREE ::msvc_is_lock_free_macro_value() +# define TEST_ATOMIC_SHORT_LOCK_FREE ::msvc_is_lock_free_macro_value() +# define TEST_ATOMIC_INT_LOCK_FREE ::msvc_is_lock_free_macro_value() +# define TEST_ATOMIC_LONG_LOCK_FREE ::msvc_is_lock_free_macro_value() +# define TEST_ATOMIC_LLONG_LOCK_FREE ::msvc_is_lock_free_macro_value() +# define TEST_ATOMIC_POINTER_LOCK_FREE ::msvc_is_lock_free_macro_value() +#else +# error "Unknown compiler" +#endif + +#ifdef TEST_COMPILER_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wc++11-extensions" +#endif + +enum class LockFreeStatus : int { unknown = -1, never = 0, sometimes = 1, always = 2 }; + +// We should really be checking whether the alignment of T is greater-than-or-equal-to the alignment required +// for T to be atomic, but this is basically impossible to implement portably. Instead, we assume that any type +// aligned to at least its size is going to be atomic if there exists atomic operations for that size at all, +// which is true on most platforms. This technically reduces our test coverage in the sense that if a type has +// an alignment requirement less than its size but could still be made lockfree, LockFreeStatusInfo will report +// that we don't know whether it is lockfree or not. +#define COMPARE_TYPES(T, FundamentalT) (sizeof(T) == sizeof(FundamentalT) && TEST_ALIGNOF(T) >= sizeof(T)) + +template +struct LockFreeStatusInfo { + static const LockFreeStatus value = LockFreeStatus( + COMPARE_TYPES(T, char) + ? TEST_ATOMIC_CHAR_LOCK_FREE + : (COMPARE_TYPES(T, short) + ? TEST_ATOMIC_SHORT_LOCK_FREE + : (COMPARE_TYPES(T, int) + ? TEST_ATOMIC_INT_LOCK_FREE + : (COMPARE_TYPES(T, long) + ? TEST_ATOMIC_LONG_LOCK_FREE + : (COMPARE_TYPES(T, long long) + ? TEST_ATOMIC_LLONG_LOCK_FREE + : (COMPARE_TYPES(T, void*) ? TEST_ATOMIC_POINTER_LOCK_FREE : -1)))))); + + static const bool status_known = LockFreeStatusInfo::value != LockFreeStatus::unknown; +}; + +#undef COMPARE_TYPES + +// This doesn't work in C++03 due to issues with scoped enumerations. Just disable the test. +#if TEST_STD_VER >= 11 +static_assert(LockFreeStatusInfo::status_known, ""); +static_assert(LockFreeStatusInfo::status_known, ""); +static_assert(LockFreeStatusInfo::status_known, ""); +static_assert(LockFreeStatusInfo::status_known, ""); +static_assert(LockFreeStatusInfo::status_known, ""); + +// long long is a bit funky: on some platforms, its alignment is 4 bytes but its size is +// 8 bytes. In that case, atomics may or may not be lockfree based on their address. +static_assert(alignof(long long) == sizeof(long long) ? LockFreeStatusInfo::status_known : true, ""); + +// Those should always be lock free: hardcode some expected values to make sure our tests are actually +// testing something meaningful. +static_assert(LockFreeStatusInfo::value == LockFreeStatus::always, ""); +static_assert(LockFreeStatusInfo::value == LockFreeStatus::always, ""); +static_assert(LockFreeStatusInfo::value == LockFreeStatus::always, ""); +#endif + +// These macros are somewhat suprising to use, since they take the values 0, 1, or 2. +// To make the tests clearer, get rid of them in preference of LockFreeStatusInfo. +#undef TEST_ATOMIC_CHAR_LOCK_FREE +#undef TEST_ATOMIC_SHORT_LOCK_FREE +#undef TEST_ATOMIC_INT_LOCK_FREE +#undef TEST_ATOMIC_LONG_LOCK_FREE +#undef TEST_ATOMIC_LLONG_LOCK_FREE +#undef TEST_ATOMIC_POINTER_LOCK_FREE + +#ifdef TEST_COMPILER_CLANG +# pragma clang diagnostic pop +#endif + struct UserAtomicType { int i; diff --git a/libcxx/test/support/fp_compare.h b/libcxx/test/support/fp_compare.h index 1d1933b0bcd81..3088a211dadc3 100644 --- a/libcxx/test/support/fp_compare.h +++ b/libcxx/test/support/fp_compare.h @@ -9,39 +9,34 @@ #ifndef SUPPORT_FP_COMPARE_H #define SUPPORT_FP_COMPARE_H -#include // for std::abs -#include // for std::max +#include // for std::abs +#include // for std::max #include +#include <__config> // See https://www.boost.org/doc/libs/1_70_0/libs/test/doc/html/boost_test/testing_tools/extended_comparison/floating_point/floating_points_comparison_theory.html -template -bool fptest_close(T val, T expected, T eps) -{ - constexpr T zero = T(0); - assert(eps >= zero); +template +bool fptest_close(T val, T expected, T eps) { + _LIBCPP_CONSTEXPR T zero = T(0); + assert(eps >= zero); - // Handle the zero cases - if (eps == zero) return val == expected; - if (val == zero) return std::abs(expected) <= eps; - if (expected == zero) return std::abs(val) <= eps; + // Handle the zero cases + if (eps == zero) + return val == expected; + if (val == zero) + return std::abs(expected) <= eps; + if (expected == zero) + return std::abs(val) <= eps; - return std::abs(val - expected) < eps - && std::abs(val - expected)/std::abs(val) < eps; + return std::abs(val - expected) < eps && std::abs(val - expected) / std::abs(val) < eps; } -template -bool fptest_close_pct(T val, T expected, T percent) -{ - constexpr T zero = T(0); - assert(percent >= zero); - - // Handle the zero cases - if (percent == zero) return val == expected; - T eps = (percent / T(100)) * std::max(std::abs(val), std::abs(expected)); - - return fptest_close(val, expected, eps); +template +bool fptest_close_pct(T val, T expected, T percent) { + assert(percent >= T(0)); + T eps = (percent / T(100)) * std::max(std::abs(val), std::abs(expected)); + return fptest_close(val, expected, eps); } - #endif // SUPPORT_FP_COMPARE_H diff --git a/libcxx/test/support/test_iterators.h b/libcxx/test/support/test_iterators.h index 31564a3977317..95d1b7df0007c 100644 --- a/libcxx/test/support/test_iterators.h +++ b/libcxx/test/support/test_iterators.h @@ -389,6 +389,8 @@ class contiguous_iterator friend TEST_CONSTEXPR bool operator> (const contiguous_iterator& x, const contiguous_iterator& y) {return x.it_ > y.it_;} friend TEST_CONSTEXPR bool operator>=(const contiguous_iterator& x, const contiguous_iterator& y) {return x.it_ >= y.it_;} + // Note no operator<=>, use three_way_contiguous_iterator for testing operator<=> + friend TEST_CONSTEXPR It base(const contiguous_iterator& i) { return i.it_; } template diff --git a/libcxx/utils/ci/Dockerfile b/libcxx/utils/ci/Dockerfile deleted file mode 100644 index 9e1865ee61fdf..0000000000000 --- a/libcxx/utils/ci/Dockerfile +++ /dev/null @@ -1,293 +0,0 @@ -#===----------------------------------------------------------------------===## -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===----------------------------------------------------------------------===## -# -# This file defines the buildkite and github actions builder images. -# You can build both images using: -# -# docker compose build -# -# Or you can select a single image to build -# -# docker compose build buildkite-builder -# -# The final images can be found at -# -# ghcr.io/libcxx/buildkite-builder -# ghcr.io/libcxx/actions-builder -# ghcr.io/libcxx/android-buildkite-builder -# -# Members of the github.com/libcxx/ organizations can push new images to the CI. -# This is done by GitHub actions in the https://github.com/libcxx/builders repo. -# -# ===----------------------------------------------------------------------===## -# Running the buildkite image -# ===----------------------------------------------------------------------===## -# -# To start a Buildkite Agent, run it as: -# $ docker run --env-file -it $(docker build -q libcxx/utils/ci) -# -# The environment variables in `` should be the ones necessary -# to run a BuildKite agent: -# -# BUILDKITE_AGENT_TOKEN= -# -# If you're only looking to run the Docker image locally for debugging a -# build bot, see the `run-buildbot-container` script located in this directory. - - -# HACK: We set the base image in the docker-compose file depending on the final target (buildkite vs github actions). -# This means we have a much slower container build, but we can use the same Dockerfile for both targets. -ARG BASE_IMAGE -FROM $BASE_IMAGE AS builder-base - -# Make sure apt-get doesn't try to prompt for stuff like our time zone, etc. -ENV DEBIAN_FRONTEND=noninteractive - -# populated in the docker-compose file -ARG GCC_LATEST_VERSION -ENV GCC_LATEST_VERSION=${GCC_LATEST_VERSION} - -# populated in the docker-compose file -ARG LLVM_HEAD_VERSION -ENV LLVM_HEAD_VERSION=${LLVM_HEAD_VERSION} - -# HACK: The github actions runner image already has sudo and requires its use. The buildkite base image does not. -# Reconcile this. -RUN <, and ToT, which are the ones we support. -# We also install because we need to support the "latest-1" of the -# current LLVM release branch, which is effectively the of the -# tip-of-trunk LLVM. For example, after branching LLVM 14 but before branching -# LLVM 15, we still need to have Clang 12 in this Docker image because the LLVM -# 14 release branch CI uses it. The tip-of-trunk CI will never use Clang 12, -# though. -RUN <> /home/libcxx-builder/.buildkite-agent/buildkite-agent.cfg -EOF - -USER libcxx-builder -WORKDIR /home/libcxx-builder - -ENV PATH="${PATH}:/home/libcxx-builder/.buildkite-agent/bin" - -CMD ["buildkite-agent", "start"] - -# ===----------------------------------------------------------------------===## -# Android Buildkite Builder Image -# ===----------------------------------------------------------------------===## -# -# IMAGE: ghcr.io/libcxx/android-buildkite-builder. -# -FROM buildkite-builder AS android-buildkite-builder - -COPY --from=android-builder-base /opt/android /opt/android -COPY ./vendor/android/container-setup.sh /opt/android/container-setup.sh - -ENV PATH="/opt/android/sdk/platform-tools:${PATH}" - -USER libcxx-builder -WORKDIR /home/libcxx-builder - -# Reset the configuration, we pass the configuration via the environment. -RUN cp /home/libcxx-builder/.buildkite-agent/buildkite-agent.dist.cfg \ - /home/libcxx-builder/.buildkite-agent/buildkite-agent.cfg - -# Modify the Buildkite agent cmdline to do Android setup stuff first. -CMD /opt/android/container-setup.sh && buildkite-agent start - -# ===----------------------------------------------------------------------===## -# Github Actions Builder Image -# ===----------------------------------------------------------------------===## -# -# IMAGE: ghcr.io/libcxx/actions-builder. -# -FROM builder-base AS actions-builder - -WORKDIR /home/runner -USER runner diff --git a/libcxx/utils/ci/vendor/android/Dockerfile.emulator b/libcxx/utils/ci/vendor/android/Dockerfile.emulator deleted file mode 100644 index 2f52b27f6edcd..0000000000000 --- a/libcxx/utils/ci/vendor/android/Dockerfile.emulator +++ /dev/null @@ -1,59 +0,0 @@ -#===----------------------------------------------------------------------===## -# -# 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 -# -#===----------------------------------------------------------------------===## - -FROM ubuntu:jammy - -RUN apt-get update && apt-get install -y \ - curl \ - netcat-openbsd \ - openjdk-11-jdk \ - sudo \ - unzip \ - && rm -rf /var/lib/apt/lists/* - -ENV ANDROID_HOME=/opt/android/sdk - -RUN curl -sL https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip -o cmdline-tools.zip && \ - mkdir -p ${ANDROID_HOME} && \ - unzip cmdline-tools.zip -d ${ANDROID_HOME}/cmdline-tools && \ - mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest && \ - rm cmdline-tools.zip -ENV PATH="${ANDROID_HOME}/cmdline-tools/latest/bin:${PATH}" - -RUN yes | sdkmanager --licenses -RUN sdkmanager --install emulator -ENV PATH="${ANDROID_HOME}/emulator:${PATH}" - -ARG API # e.g. 21 -RUN sdkmanager --install "platforms;android-${API}" - -ARG TYPE # one of: default, google_apis, or google_apis_playstore -ARG ABI # e.g. armeabi-v7a, x86 -ENV EMU_PACKAGE_NAME="system-images;android-${API};${TYPE};${ABI}" -RUN sdkmanager --install "${EMU_PACKAGE_NAME}" - -COPY ./emulator-entrypoint.sh /opt/emulator/bin/emulator-entrypoint.sh -COPY ./emulator-wait-for-ready.sh /opt/emulator/bin/emulator-wait-for-ready.sh -ENV PATH="/opt/emulator/bin:${PATH}" -ENV PATH="${ANDROID_HOME}/platform-tools:${PATH}" - -# Setup password-less sudo so that /dev/kvm permissions can be changed. Run the -# emulator in an unprivileged user for reliability (and it might require it?) -RUN echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers -RUN useradd --create-home emulator -USER emulator -WORKDIR /home/emulator - -# Size of emulator /data partition in megabytes. -ENV EMU_PARTITION_SIZE=8192 - -EXPOSE 5037 - -HEALTHCHECK CMD emulator-wait-for-ready.sh 5 - -ENTRYPOINT ["emulator-entrypoint.sh"] diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py index a351112471295..6c42748002aee 100755 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -1302,8 +1302,7 @@ def add_version_header(tc): }, { "name": "__cpp_lib_three_way_comparison", - "values": {"c++20": 201711}, - # {"c++20": 201907} # P1614R2 The Mothership has Landed (see P1902R1 Missing feature-test macros 2017-2019) + "values": {"c++20": 201907}, "headers": ["compare"], }, { diff --git a/libcxxabi/src/private_typeinfo.cpp b/libcxxabi/src/private_typeinfo.cpp index 9e58501a55934..9dba91e1985e3 100644 --- a/libcxxabi/src/private_typeinfo.cpp +++ b/libcxxabi/src/private_typeinfo.cpp @@ -55,15 +55,12 @@ #include #endif - -template -static inline -T * -get_vtable(T *vtable) { +template +static inline T* strip_vtable(T* vtable) { #if __has_feature(ptrauth_calls) - vtable = ptrauth_strip(vtable, ptrauth_key_cxx_vtable_pointer); + vtable = ptrauth_strip(vtable, ptrauth_key_cxx_vtable_pointer); #endif - return vtable; + return vtable; } static inline @@ -117,11 +114,10 @@ void dyn_cast_get_derived_info(derived_object_info* info, const void* static_ptr reinterpret_cast(vtable) + offset_to_ti_proxy; info->dynamic_type = *(reinterpret_cast(ptr_to_ti_proxy)); #else - void **vtable = *static_cast(static_ptr); - vtable = get_vtable(vtable); - info->offset_to_derived = reinterpret_cast(vtable[-2]); - info->dynamic_ptr = static_cast(static_ptr) + info->offset_to_derived; - info->dynamic_type = static_cast(vtable[-1]); + void** vtable = strip_vtable(*static_cast(static_ptr)); + info->offset_to_derived = reinterpret_cast(vtable[-2]); + info->dynamic_ptr = static_cast(static_ptr) + info->offset_to_derived; + info->dynamic_type = static_cast(vtable[-1]); #endif } @@ -576,8 +572,7 @@ __base_class_type_info::has_unambiguous_public_base(__dynamic_cast_info* info, find the layout. */ offset_to_base = __offset_flags >> __offset_shift; if (is_virtual) { - const char* vtable = *static_cast(adjustedPtr); - vtable = get_vtable(vtable); + const char* vtable = strip_vtable(*static_cast(adjustedPtr)); offset_to_base = update_offset_to_base(vtable, offset_to_base); } } else if (!is_virtual) { @@ -1517,9 +1512,8 @@ __base_class_type_info::search_above_dst(__dynamic_cast_info* info, ptrdiff_t offset_to_base = __offset_flags >> __offset_shift; if (__offset_flags & __virtual_mask) { - const char* vtable = *static_cast(current_ptr); - vtable = get_vtable(vtable); - offset_to_base = update_offset_to_base(vtable, offset_to_base); + const char* vtable = strip_vtable(*static_cast(current_ptr)); + offset_to_base = update_offset_to_base(vtable, offset_to_base); } __base_type->search_above_dst(info, dst_ptr, static_cast(current_ptr) + offset_to_base, @@ -1538,9 +1532,8 @@ __base_class_type_info::search_below_dst(__dynamic_cast_info* info, ptrdiff_t offset_to_base = __offset_flags >> __offset_shift; if (__offset_flags & __virtual_mask) { - const char* vtable = *static_cast(current_ptr); - vtable = get_vtable(vtable); - offset_to_base = update_offset_to_base(vtable, offset_to_base); + const char* vtable = strip_vtable(*static_cast(current_ptr)); + offset_to_base = update_offset_to_base(vtable, offset_to_base); } __base_type->search_below_dst(info, static_cast(current_ptr) + offset_to_base, diff --git a/libcxxabi/test/vendor/ibm/aix_xlclang_nested_excp_32.pass.sh.s b/libcxxabi/test/vendor/ibm/aix_xlclang_nested_excp_32.pass.sh.s index ce90045586082..b35c999e6e50d 100644 --- a/libcxxabi/test/vendor/ibm/aix_xlclang_nested_excp_32.pass.sh.s +++ b/libcxxabi/test/vendor/ibm/aix_xlclang_nested_excp_32.pass.sh.s @@ -9,7 +9,7 @@ # Test that a nested exception is thrown by a destructor inside a try-block # when the code is generated by the legacy AIX xlclang compiler. -# REQUIRES: target=powerpc-ibm-aix +# REQUIRES: target=powerpc-ibm-aix{{.*}} # UNSUPPORTED: no-exceptions # RUN: %{cxx} %{flags} %s %{link_flags} \ diff --git a/libcxxabi/test/vendor/ibm/aix_xlclang_nested_excp_64.pass.sh.s b/libcxxabi/test/vendor/ibm/aix_xlclang_nested_excp_64.pass.sh.s index 7b0afb9ebae38..16754db2837ca 100644 --- a/libcxxabi/test/vendor/ibm/aix_xlclang_nested_excp_64.pass.sh.s +++ b/libcxxabi/test/vendor/ibm/aix_xlclang_nested_excp_64.pass.sh.s @@ -8,7 +8,7 @@ # Test that a nested exception is thrown by a destructor inside a try-block # when the code is generated by the legacy AIX xlclang compiler. -# REQUIRES: target=powerpc64-ibm-aix +# REQUIRES: target=powerpc64-ibm-aix{{.*}} # UNSUPPORTED: no-exceptions # RUN: %{cxx} %{flags} %s %{link_flags} \ diff --git a/libcxxabi/test/vendor/ibm/aix_xlclang_passing_excp_obj_32.pass.sh.S b/libcxxabi/test/vendor/ibm/aix_xlclang_passing_excp_obj_32.pass.sh.S index 71c3ab9409a81..8b92e4febf562 100644 --- a/libcxxabi/test/vendor/ibm/aix_xlclang_passing_excp_obj_32.pass.sh.S +++ b/libcxxabi/test/vendor/ibm/aix_xlclang_passing_excp_obj_32.pass.sh.S @@ -14,7 +14,7 @@ // xlclang++ compiler included in this file. This file tests for the 32-bit // mode. -# REQUIRES: target=powerpc-ibm-aix +# REQUIRES: target=powerpc-ibm-aix{{.*}} # UNSUPPORTED: no-exceptions // RUN: %{cxx} -c %s -o %t1_32.o -DT1_CPP_CODE %{flags} %{compile_flags} diff --git a/libcxxabi/test/vendor/ibm/aix_xlclang_passing_excp_obj_64.pass.sh.S b/libcxxabi/test/vendor/ibm/aix_xlclang_passing_excp_obj_64.pass.sh.S index da413577bd38f..64d7c80e9e6dd 100644 --- a/libcxxabi/test/vendor/ibm/aix_xlclang_passing_excp_obj_64.pass.sh.S +++ b/libcxxabi/test/vendor/ibm/aix_xlclang_passing_excp_obj_64.pass.sh.S @@ -14,7 +14,7 @@ // xlclang++ compiler included in this file. This file tests for the 64-bit // mode. -# REQUIRES: target=powerpc64-ibm-aix +# REQUIRES: target=powerpc64-ibm-aix{{.*}} # UNSUPPORTED: no-exceptions // RUN: %{cxx} -c %s -o %t1_64.o -DT1_CPP_CODE %{flags} %{compile_flags} diff --git a/libcxxabi/test/vendor/ibm/cond_reg_restore.pass.cpp b/libcxxabi/test/vendor/ibm/cond_reg_restore.pass.cpp index 63817e1b13a25..a5eb3c20534a3 100644 --- a/libcxxabi/test/vendor/ibm/cond_reg_restore.pass.cpp +++ b/libcxxabi/test/vendor/ibm/cond_reg_restore.pass.cpp @@ -10,7 +10,7 @@ // on AIX. Option -O3 is required so that the compiler will re-use the value // in the condition register instead of re-evaluating the condition expression. -// REQUIRES: target=powerpc{{(64)?}}-ibm-aix +// REQUIRES: target={{.+}}-aix{{.*}} // ADDITIONAL_COMPILE_FLAGS: -O3 // UNSUPPORTED: no-exceptions diff --git a/libcxxabi/test/vendor/ibm/vec_reg_restore.pass.cpp b/libcxxabi/test/vendor/ibm/vec_reg_restore.pass.cpp index 703c311dae392..7c31970546993 100644 --- a/libcxxabi/test/vendor/ibm/vec_reg_restore.pass.cpp +++ b/libcxxabi/test/vendor/ibm/vec_reg_restore.pass.cpp @@ -9,7 +9,7 @@ // Check that the PowerPC vector registers are restored properly during // unwinding. Option -mabi=vec-extabi is required to compile the test case. -// REQUIRES: target=powerpc{{(64)?}}-ibm-aix +// REQUIRES: target={{.+}}-aix{{.*}} // ADDITIONAL_COMPILE_FLAGS: -mabi=vec-extabi // UNSUPPORTED: no-exceptions diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt index b22ade0a7d71e..28d67b0fef92c 100644 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -37,6 +37,7 @@ if (LIBUNWIND_BUILD_32_BITS) endif() option(LIBUNWIND_ENABLE_CET "Build libunwind with CET enabled." OFF) +option(LIBUNWIND_ENABLE_GCS "Build libunwind with GCS enabled." OFF) option(LIBUNWIND_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON) option(LIBUNWIND_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) option(LIBUNWIND_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) @@ -188,6 +189,13 @@ if (LIBUNWIND_ENABLE_CET) endif() endif() +if (LIBUNWIND_ENABLE_GCS) + add_compile_flags_if_supported(-mbranch-protection=standard) + if (NOT CXX_SUPPORTS_MBRANCH_PROTECTION_EQ_STANDARD_FLAG) + message(SEND_ERROR "Compiler doesn't support GCS -mbranch-protection option!") + endif() +endif() + if (WIN32) # The headers lack matching dllexport attributes (_LIBUNWIND_EXPORT); # silence the warning instead of cluttering the headers (which aren't diff --git a/libunwind/include/CMakeLists.txt b/libunwind/include/CMakeLists.txt index 51065d68afd4e..6796d67a3354f 100644 --- a/libunwind/include/CMakeLists.txt +++ b/libunwind/include/CMakeLists.txt @@ -3,7 +3,6 @@ set(files libunwind.h libunwind.modulemap mach-o/compact_unwind_encoding.h - mach-o/compact_unwind_encoding.modulemap unwind_arm_ehabi.h unwind_itanium.h unwind.h diff --git a/libunwind/include/mach-o/compact_unwind_encoding.modulemap b/libunwind/include/mach-o/compact_unwind_encoding.modulemap deleted file mode 100644 index 6eae657d31b5c..0000000000000 --- a/libunwind/include/mach-o/compact_unwind_encoding.modulemap +++ /dev/null @@ -1,4 +0,0 @@ -module MachO.compact_unwind_encoding [system] { - header "compact_unwind_encoding.h" - export * -} diff --git a/libunwind/src/Registers.hpp b/libunwind/src/Registers.hpp index d11ddb3426d52..861e6b5f6f2c5 100644 --- a/libunwind/src/Registers.hpp +++ b/libunwind/src/Registers.hpp @@ -1815,6 +1815,13 @@ inline const char *Registers_ppc64::getRegisterName(int regNum) { /// process. class _LIBUNWIND_HIDDEN Registers_arm64; extern "C" void __libunwind_Registers_arm64_jumpto(Registers_arm64 *); + +#if defined(_LIBUNWIND_USE_GCS) +extern "C" void *__libunwind_cet_get_jump_target() { + return reinterpret_cast(&__libunwind_Registers_arm64_jumpto); +} +#endif + class _LIBUNWIND_HIDDEN Registers_arm64 { public: Registers_arm64(); diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp index 2ec60e4c123d5..06e654197351d 100644 --- a/libunwind/src/UnwindCursor.hpp +++ b/libunwind/src/UnwindCursor.hpp @@ -471,7 +471,7 @@ class _LIBUNWIND_HIDDEN AbstractUnwindCursor { } #endif -#if defined(_LIBUNWIND_USE_CET) +#if defined(_LIBUNWIND_USE_CET) || defined(_LIBUNWIND_USE_GCS) virtual void *get_registers() { _LIBUNWIND_ABORT("get_registers not implemented"); } @@ -954,7 +954,7 @@ class UnwindCursor : public AbstractUnwindCursor{ virtual uintptr_t getDataRelBase(); #endif -#if defined(_LIBUNWIND_USE_CET) +#if defined(_LIBUNWIND_USE_CET) || defined(_LIBUNWIND_USE_GCS) virtual void *get_registers() { return &_registers; } #endif @@ -2589,7 +2589,8 @@ void UnwindCursor::setInfoBasedOnIPRegister(bool isReturnAddress) { --pc; #endif -#if !(defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && defined(_WIN32)) +#if !(defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && defined(_WIN32)) && \ + !defined(_LIBUNWIND_SUPPORT_TBTAB_UNWIND) // In case of this is frame of signal handler, the IP saved in the signal // handler points to first non-executed instruction, while FDE/CIE expects IP // to be after the first non-executed instruction. @@ -3004,7 +3005,7 @@ bool UnwindCursor::isReadableAddr(const pint_t addr) const { } #endif -#if defined(_LIBUNWIND_USE_CET) +#if defined(_LIBUNWIND_USE_CET) || defined(_LIBUNWIND_USE_GCS) extern "C" void *__libunwind_cet_get_registers(unw_cursor_t *cursor) { AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; return co->get_registers(); diff --git a/libunwind/src/UnwindLevel1.c b/libunwind/src/UnwindLevel1.c index 48e7bc3b9e00e..7e785f4d31e71 100644 --- a/libunwind/src/UnwindLevel1.c +++ b/libunwind/src/UnwindLevel1.c @@ -44,7 +44,7 @@ // _LIBUNWIND_POP_CET_SSP is used to adjust CET shadow stack pointer and we // directly jump to __libunwind_Registers_x86/x86_64_jumpto instead of using // a regular function call to avoid pushing to CET shadow stack again. -#if !defined(_LIBUNWIND_USE_CET) +#if !defined(_LIBUNWIND_USE_CET) && !defined(_LIBUNWIND_USE_GCS) #define __unw_phase2_resume(cursor, fn) \ do { \ (void)fn; \ @@ -72,6 +72,19 @@ __asm__ volatile("jmpq *%%rdx\n\t" :: "D"(cetRegContext), \ "d"(cetJumpAddress)); \ } while (0) +#elif defined(_LIBUNWIND_TARGET_AARCH64) +#define __cet_ss_step_size 8 +#define __unw_phase2_resume(cursor, fn) \ + do { \ + _LIBUNWIND_POP_CET_SSP((fn)); \ + void *cetRegContext = __libunwind_cet_get_registers((cursor)); \ + void *cetJumpAddress = __libunwind_cet_get_jump_target(); \ + __asm__ volatile("mov x0, %0\n\t" \ + "br %1\n\t" \ + : \ + : "r"(cetRegContext), "r"(cetJumpAddress) \ + : "x0"); \ + } while (0) #endif static _Unwind_Reason_Code @@ -170,6 +183,10 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except } extern int __unw_step_stage2(unw_cursor_t *); +#if defined(_LIBUNWIND_USE_GCS) +// Enable the GCS target feature to permit gcspop instructions to be used. +__attribute__((target("gcs"))) +#endif static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) { __unw_init_local(cursor, uc); @@ -180,8 +197,12 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except // uc is initialized by __unw_getcontext in the parent frame. The first stack // frame walked is unwind_phase2. unsigned framesWalked = 1; -#ifdef _LIBUNWIND_USE_CET +#if defined(_LIBUNWIND_USE_CET) unsigned long shadowStackTop = _get_ssp(); +#elif defined(_LIBUNWIND_USE_GCS) + unsigned long shadowStackTop = 0; + if (__chkfeat(_CHKFEAT_GCS)) + shadowStackTop = (unsigned long)__gcspr(); #endif // Walk each frame until we reach where search phase said to stop. while (true) { @@ -238,7 +259,7 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except // against return address stored in CET shadow stack, if the 2 addresses don't // match, it means return address in normal stack has been corrupted, we return // _URC_FATAL_PHASE2_ERROR. -#ifdef _LIBUNWIND_USE_CET +#if defined(_LIBUNWIND_USE_CET) || defined(_LIBUNWIND_USE_GCS) if (shadowStackTop != 0) { unw_word_t retInNormalStack; __unw_get_reg(cursor, UNW_REG_IP, &retInNormalStack); @@ -306,6 +327,10 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except return _URC_FATAL_PHASE2_ERROR; } +#if defined(_LIBUNWIND_USE_GCS) +// Enable the GCS target feature to permit gcspop instructions to be used. +__attribute__((target("gcs"))) +#endif static _Unwind_Reason_Code unwind_phase2_forced(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object, diff --git a/libunwind/src/UnwindRegistersRestore.S b/libunwind/src/UnwindRegistersRestore.S index 67d9e05711898..9d34c7909ed37 100644 --- a/libunwind/src/UnwindRegistersRestore.S +++ b/libunwind/src/UnwindRegistersRestore.S @@ -629,6 +629,10 @@ Lnovec: #elif defined(__aarch64__) +#if defined(__ARM_FEATURE_GCS_DEFAULT) +.arch_extension gcs +#endif + // // extern "C" void __libunwind_Registers_arm64_jumpto(Registers_arm64 *); // @@ -680,6 +684,16 @@ DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_arm64_jumpto) ldr x16, [x0, #0x0F8] ldp x0, x1, [x0, #0x000] // restore x0,x1 mov sp,x16 // restore sp +#if defined(__ARM_FEATURE_GCS_DEFAULT) + // If GCS is enabled we need to push the address we're returning to onto the + // GCS stack. We can't just return using br, as there won't be a BTI landing + // pad instruction at the destination. + mov x16, #1 + chkfeat x16 + cbnz x16, Lnogcs + gcspushm x30 +Lnogcs: +#endif ret x30 // jump to pc #elif defined(__arm__) && !defined(__APPLE__) diff --git a/libunwind/src/assembly.h b/libunwind/src/assembly.h index fb07d04071af3..f8e83e138eff5 100644 --- a/libunwind/src/assembly.h +++ b/libunwind/src/assembly.h @@ -82,7 +82,22 @@ #define PPC64_OPD2 #endif -#if defined(__aarch64__) && defined(__ARM_FEATURE_BTI_DEFAULT) +#if defined(__aarch64__) +#if defined(__ARM_FEATURE_GCS_DEFAULT) && defined(__ARM_FEATURE_BTI_DEFAULT) +// Set BTI, PAC, and GCS gnu property bits +#define GNU_PROPERTY 7 +// We indirectly branch to __libunwind_Registers_arm64_jumpto from +// __unw_phase2_resume, so we need to use bti jc. +#define AARCH64_BTI bti jc +#elif defined(__ARM_FEATURE_GCS_DEFAULT) +// Set GCS gnu property bit +#define GNU_PROPERTY 4 +#elif defined(__ARM_FEATURE_BTI_DEFAULT) +// Set BTI and PAC gnu property bits +#define GNU_PROPERTY 3 +#define AARCH64_BTI bti c +#endif +#ifdef GNU_PROPERTY .pushsection ".note.gnu.property", "a" SEPARATOR \ .balign 8 SEPARATOR \ .long 4 SEPARATOR \ @@ -91,12 +106,12 @@ .asciz "GNU" SEPARATOR \ .long 0xc0000000 SEPARATOR /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */ \ .long 4 SEPARATOR \ - .long 3 SEPARATOR /* GNU_PROPERTY_AARCH64_FEATURE_1_BTI AND */ \ - /* GNU_PROPERTY_AARCH64_FEATURE_1_PAC */ \ + .long GNU_PROPERTY SEPARATOR \ .long 0 SEPARATOR \ .popsection SEPARATOR -#define AARCH64_BTI bti c -#else +#endif +#endif +#if !defined(AARCH64_BTI) #define AARCH64_BTI #endif diff --git a/libunwind/src/cet_unwind.h b/libunwind/src/cet_unwind.h index c364ed3e12feb..47d7616a7322c 100644 --- a/libunwind/src/cet_unwind.h +++ b/libunwind/src/cet_unwind.h @@ -35,6 +35,28 @@ } while (0) #endif +// On AArch64 we use _LIBUNWIND_USE_GCS to indicate that GCS is supported. We +// need to guard any use of GCS instructions with __chkfeat though, as GCS may +// not be enabled. +#if defined(_LIBUNWIND_TARGET_AARCH64) && defined(__ARM_FEATURE_GCS_DEFAULT) +#include + +// We can only use GCS if arm_acle.h defines the GCS intrinsics. +#ifdef _CHKFEAT_GCS +#define _LIBUNWIND_USE_GCS 1 +#endif + +#define _LIBUNWIND_POP_CET_SSP(x) \ + do { \ + if (__chkfeat(_CHKFEAT_GCS)) { \ + unsigned tmp = (x); \ + while (tmp--) \ + __gcspopm(); \ + } \ + } while (0) + +#endif + extern void *__libunwind_cet_get_registers(unw_cursor_t *); extern void *__libunwind_cet_get_jump_target(void); diff --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt index 19f055f6f93ff..c7b1b3d01d8c7 100644 --- a/libunwind/test/CMakeLists.txt +++ b/libunwind/test/CMakeLists.txt @@ -9,6 +9,7 @@ macro(pythonize_bool var) endmacro() pythonize_bool(LIBUNWIND_ENABLE_CET) +pythonize_bool(LIBUNWIND_ENABLE_GCS) pythonize_bool(LIBUNWIND_ENABLE_THREADS) pythonize_bool(LIBUNWIND_USES_ARM_EHABI) diff --git a/libunwind/test/aix_signal_unwind.pass.sh.S b/libunwind/test/aix_signal_unwind.pass.sh.S index 9ca18e9481f4f..2c0cf140fe267 100644 --- a/libunwind/test/aix_signal_unwind.pass.sh.S +++ b/libunwind/test/aix_signal_unwind.pass.sh.S @@ -10,7 +10,7 @@ // a correct traceback when the function raising the signal does not save // the link register or does not store the stack back chain. -// REQUIRES: target=powerpc{{(64)?}}-ibm-aix +// REQUIRES: target={{.+}}-aix{{.*}} // Test when the function raising the signal does not save the link register // RUN: %{cxx} -x c++ %s -o %t.exe -DCXX_CODE %{flags} %{compile_flags} diff --git a/libunwind/test/configs/llvm-libunwind-merged.cfg.in b/libunwind/test/configs/llvm-libunwind-merged.cfg.in index 38b79840c9fe2..fafe12962b428 100644 --- a/libunwind/test/configs/llvm-libunwind-merged.cfg.in +++ b/libunwind/test/configs/llvm-libunwind-merged.cfg.in @@ -11,6 +11,9 @@ link_flags = [] if @LIBUNWIND_ENABLE_CET@: compile_flags.append('-fcf-protection=full') +if @LIBUNWIND_ENABLE_GCS@: + compile_flags.append('-mbranch-protection=standard') + # On ELF platforms, link tests with -Wl,--export-dynamic if supported by the linker. if len('@CMAKE_EXE_EXPORTS_CXX_FLAG@'): link_flags.append('@CMAKE_EXE_EXPORTS_CXX_FLAG@') diff --git a/libunwind/test/configs/llvm-libunwind-shared.cfg.in b/libunwind/test/configs/llvm-libunwind-shared.cfg.in index 13896aeb13bc4..f3e40928b525d 100644 --- a/libunwind/test/configs/llvm-libunwind-shared.cfg.in +++ b/libunwind/test/configs/llvm-libunwind-shared.cfg.in @@ -10,6 +10,9 @@ link_flags = [] if @LIBUNWIND_ENABLE_CET@: compile_flags.append('-fcf-protection=full') +if @LIBUNWIND_ENABLE_GCS@: + compile_flags.append('-mbranch-protection=standard') + # On ELF platforms, link tests with -Wl,--export-dynamic if supported by the linker. if len('@CMAKE_EXE_EXPORTS_CXX_FLAG@'): link_flags.append('@CMAKE_EXE_EXPORTS_CXX_FLAG@') diff --git a/libunwind/test/configs/llvm-libunwind-static.cfg.in b/libunwind/test/configs/llvm-libunwind-static.cfg.in index 50b64dc665a5a..a3a65ae82591b 100644 --- a/libunwind/test/configs/llvm-libunwind-static.cfg.in +++ b/libunwind/test/configs/llvm-libunwind-static.cfg.in @@ -13,6 +13,9 @@ if @LIBUNWIND_ENABLE_THREADS@: if @LIBUNWIND_ENABLE_CET@: compile_flags.append('-fcf-protection=full') +if @LIBUNWIND_ENABLE_GCS@: + compile_flags.append('-mbranch-protection=standard') + # On ELF platforms, link tests with -Wl,--export-dynamic if supported by the linker. if len('@CMAKE_EXE_EXPORTS_CXX_FLAG@'): link_flags.append('@CMAKE_EXE_EXPORTS_CXX_FLAG@') diff --git a/lld/ELF/Arch/ARM.cpp b/lld/ELF/Arch/ARM.cpp index 3e0efe540e1bf..07a7535c4a231 100644 --- a/lld/ELF/Arch/ARM.cpp +++ b/lld/ELF/Arch/ARM.cpp @@ -228,10 +228,16 @@ static void writePltHeaderLong(uint8_t *buf) { write32(buf + 16, gotPlt - l1 - 8); } +// True if we should use Thumb PLTs, which currently require Thumb2, and are +// only used if the target does not have the ARM ISA. +static bool useThumbPLTs() { + return config->armHasThumb2ISA && !config->armHasArmISA; +} + // The default PLT header requires the .got.plt to be within 128 Mb of the // .plt in the positive direction. void ARM::writePltHeader(uint8_t *buf) const { - if (config->armThumbPLTs) { + if (useThumbPLTs()) { // The instruction sequence for thumb: // // 0: b500 push {lr} @@ -289,7 +295,7 @@ void ARM::writePltHeader(uint8_t *buf) const { } void ARM::addPltHeaderSymbols(InputSection &isec) const { - if (config->armThumbPLTs) { + if (useThumbPLTs()) { addSyntheticLocal("$t", STT_NOTYPE, 0, 0, isec); addSyntheticLocal("$d", STT_NOTYPE, 12, 0, isec); } else { @@ -315,7 +321,7 @@ static void writePltLong(uint8_t *buf, uint64_t gotPltEntryAddr, void ARM::writePlt(uint8_t *buf, const Symbol &sym, uint64_t pltEntryAddr) const { - if (!config->armThumbPLTs) { + if (!useThumbPLTs()) { uint64_t offset = sym.getGotPltVA() - pltEntryAddr - 8; // The PLT entry is similar to the example given in Appendix A of ELF for @@ -367,7 +373,7 @@ void ARM::writePlt(uint8_t *buf, const Symbol &sym, } void ARM::addPltSymbols(InputSection &isec, uint64_t off) const { - if (config->armThumbPLTs) { + if (useThumbPLTs()) { addSyntheticLocal("$t", STT_NOTYPE, off, 0, isec); } else { addSyntheticLocal("$a", STT_NOTYPE, off, 0, isec); @@ -393,7 +399,7 @@ bool ARM::needsThunk(RelExpr expr, RelType type, const InputFile *file, case R_ARM_JUMP24: // Source is ARM, all PLT entries are ARM so no interworking required. // Otherwise we need to interwork if STT_FUNC Symbol has bit 0 set (Thumb). - assert(!config->armThumbPLTs && + assert(!useThumbPLTs() && "If the source is ARM, we should not need Thumb PLTs"); if (s.isFunc() && expr == R_PC && (s.getVA() & 1)) return true; @@ -407,7 +413,8 @@ bool ARM::needsThunk(RelExpr expr, RelType type, const InputFile *file, case R_ARM_THM_JUMP24: // Source is Thumb, when all PLT entries are ARM interworking is required. // Otherwise we need to interwork if STT_FUNC Symbol has bit 0 clear (ARM). - if ((expr == R_PLT_PC && !config->armThumbPLTs) || (s.isFunc() && (s.getVA() & 1) == 0)) + if ((expr == R_PLT_PC && !useThumbPLTs()) || + (s.isFunc() && (s.getVA() & 1) == 0)) return true; [[fallthrough]]; case R_ARM_THM_CALL: { @@ -675,7 +682,7 @@ void ARM::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { // PLT entries are always ARM state so we know we need to interwork. assert(rel.sym); // R_ARM_THM_CALL is always reached via relocate(). bool bit0Thumb = val & 1; - bool useThumb = bit0Thumb || config->armThumbPLTs; + bool useThumb = bit0Thumb || useThumbPLTs(); bool isBlx = (read16(loc + 2) & 0x1000) == 0; // lld 10.0 and before always used bit0Thumb when deciding to write a BLX // even when type not STT_FUNC. diff --git a/lld/ELF/Arch/Hexagon.cpp b/lld/ELF/Arch/Hexagon.cpp index 54821c299bde9..abde3cd964917 100644 --- a/lld/ELF/Arch/Hexagon.cpp +++ b/lld/ELF/Arch/Hexagon.cpp @@ -60,17 +60,15 @@ Hexagon::Hexagon() { } uint32_t Hexagon::calcEFlags() const { - assert(!ctx.objectFiles.empty()); - // The architecture revision must always be equal to or greater than // greatest revision in the list of inputs. - uint32_t ret = 0; + std::optional ret; for (InputFile *f : ctx.objectFiles) { uint32_t eflags = cast>(f)->getObj().getHeader().e_flags; - if (eflags > ret) + if (!ret || eflags > *ret) ret = eflags; } - return ret; + return ret.value_or(/* Default Arch Rev: */ 0x60); } static uint32_t applyMask(uint32_t mask, uint32_t data) { diff --git a/lld/ELF/Arch/LoongArch.cpp b/lld/ELF/Arch/LoongArch.cpp index 9466e8b1ce54d..db0bc6c760096 100644 --- a/lld/ELF/Arch/LoongArch.cpp +++ b/lld/ELF/Arch/LoongArch.cpp @@ -511,6 +511,12 @@ RelExpr LoongArch::getRelExpr(const RelType type, const Symbol &s, return R_TLSDESC; case R_LARCH_TLS_DESC_CALL: return R_TLSDESC_CALL; + case R_LARCH_TLS_LD_PCREL20_S2: + return R_TLSLD_PC; + case R_LARCH_TLS_GD_PCREL20_S2: + return R_TLSGD_PC; + case R_LARCH_TLS_DESC_PCREL20_S2: + return R_TLSDESC_PC; // Other known relocs that are explicitly unimplemented: // @@ -557,7 +563,11 @@ void LoongArch::relocate(uint8_t *loc, const Relocation &rel, write64le(loc, val); return; + // Relocs intended for `pcaddi`. case R_LARCH_PCREL20_S2: + case R_LARCH_TLS_LD_PCREL20_S2: + case R_LARCH_TLS_GD_PCREL20_S2: + case R_LARCH_TLS_DESC_PCREL20_S2: checkInt(loc, val, 22, rel); checkAlignment(loc, val, 4, rel); write32le(loc, setJ20(read32le(loc), val >> 2)); diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h index 0173be396163e..28726d48e4284 100644 --- a/lld/ELF/Config.h +++ b/lld/ELF/Config.h @@ -217,7 +217,8 @@ struct Config { bool allowMultipleDefinition; bool fatLTOObjects; bool androidPackDynRelocs = false; - bool armThumbPLTs = false; + bool armHasArmISA = false; + bool armHasThumb2ISA = false; bool armHasBlx = false; bool armHasMovtMovw = false; bool armJ1J2BranchEncoding = false; diff --git a/lld/ELF/DWARF.cpp b/lld/ELF/DWARF.cpp index 5d58e0c60a952..517d26810a378 100644 --- a/lld/ELF/DWARF.cpp +++ b/lld/ELF/DWARF.cpp @@ -136,7 +136,8 @@ template std::optional LLDDwarfObj::find(const llvm::DWARFSection &s, uint64_t pos) const { auto &sec = static_cast(s); - const RelsOrRelas rels = sec.sec->template relsOrRelas(); + const RelsOrRelas rels = + sec.sec->template relsOrRelas(/*supportsCrel=*/false); if (rels.areRelocsRel()) return findAux(*sec.sec, pos, rels.rels); return findAux(*sec.sec, pos, rels.relas); diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 40e095a133d95..eb6734dfd458d 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -991,6 +991,15 @@ processCallGraphRelocations(SmallVector &symbolIndices, for (size_t i = 0, e = objSections.size(); i < e; ++i) { const Elf_Shdr_Impl &sec = objSections[i]; if (sec.sh_info == inputObj->cgProfileSectionIndex) { + if (sec.sh_type == SHT_CREL) { + auto crels = + CHECK(obj.crels(sec), "could not retrieve cg profile rela section"); + for (const auto &rel : crels.first) + symbolIndices.push_back(rel.getSymbol(false)); + for (const auto &rel : crels.second) + symbolIndices.push_back(rel.getSymbol(false)); + break; + } if (sec.sh_type == SHT_RELA) { ArrayRef relas = CHECK(obj.relas(sec), "could not retrieve cg profile rela section"); diff --git a/lld/ELF/ICF.cpp b/lld/ELF/ICF.cpp index bfc605c793a92..44e8a71cc6286 100644 --- a/lld/ELF/ICF.cpp +++ b/lld/ELF/ICF.cpp @@ -103,12 +103,12 @@ template class ICF { void segregate(size_t begin, size_t end, uint32_t eqClassBase, bool constant); template - bool constantEq(const InputSection *a, ArrayRef relsA, - const InputSection *b, ArrayRef relsB); + bool constantEq(const InputSection *a, Relocs relsA, + const InputSection *b, Relocs relsB); template - bool variableEq(const InputSection *a, ArrayRef relsA, - const InputSection *b, ArrayRef relsB); + bool variableEq(const InputSection *a, Relocs relsA, + const InputSection *b, Relocs relsB); bool equalsConstant(const InputSection *a, const InputSection *b); bool equalsVariable(const InputSection *a, const InputSection *b); @@ -235,8 +235,8 @@ void ICF::segregate(size_t begin, size_t end, uint32_t eqClassBase, // Compare two lists of relocations. template template -bool ICF::constantEq(const InputSection *secA, ArrayRef ra, - const InputSection *secB, ArrayRef rb) { +bool ICF::constantEq(const InputSection *secA, Relocs ra, + const InputSection *secB, Relocs rb) { if (ra.size() != rb.size()) return false; auto rai = ra.begin(), rae = ra.end(), rbi = rb.begin(); @@ -324,6 +324,8 @@ bool ICF::equalsConstant(const InputSection *a, const InputSection *b) { const RelsOrRelas ra = a->template relsOrRelas(); const RelsOrRelas rb = b->template relsOrRelas(); + if (ra.areRelocsCrel()) + return constantEq(a, ra.crels, b, rb.crels); return ra.areRelocsRel() || rb.areRelocsRel() ? constantEq(a, ra.rels, b, rb.rels) : constantEq(a, ra.relas, b, rb.relas); @@ -333,8 +335,8 @@ bool ICF::equalsConstant(const InputSection *a, const InputSection *b) { // relocations point to the same section in terms of ICF. template template -bool ICF::variableEq(const InputSection *secA, ArrayRef ra, - const InputSection *secB, ArrayRef rb) { +bool ICF::variableEq(const InputSection *secA, Relocs ra, + const InputSection *secB, Relocs rb) { assert(ra.size() == rb.size()); auto rai = ra.begin(), rae = ra.end(), rbi = rb.begin(); @@ -374,6 +376,8 @@ template bool ICF::equalsVariable(const InputSection *a, const InputSection *b) { const RelsOrRelas ra = a->template relsOrRelas(); const RelsOrRelas rb = b->template relsOrRelas(); + if (ra.areRelocsCrel()) + return variableEq(a, ra.crels, b, rb.crels); return ra.areRelocsRel() || rb.areRelocsRel() ? variableEq(a, ra.rels, b, rb.rels) : variableEq(a, ra.relas, b, rb.relas); @@ -441,7 +445,7 @@ void ICF::forEachClass(llvm::function_ref fn) { // hash. template static void combineRelocHashes(unsigned cnt, InputSection *isec, - ArrayRef rels) { + Relocs rels) { uint32_t hash = isec->eqClass[cnt % 2]; for (RelTy rel : rels) { Symbol &s = isec->file->getRelocTargetSym(rel); @@ -505,7 +509,9 @@ template void ICF::run() { for (unsigned cnt = 0; cnt != 2; ++cnt) { parallelForEach(sections, [&](InputSection *s) { const RelsOrRelas rels = s->template relsOrRelas(); - if (rels.areRelocsRel()) + if (rels.areRelocsCrel()) + combineRelocHashes(cnt, s, rels.crels); + else if (rels.areRelocsRel()) combineRelocHashes(cnt, s, rels.rels); else combineRelocHashes(cnt, s, rels.relas); diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 03ff4eadfe670..48f5a9609ecfb 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -203,10 +203,8 @@ static void updateSupportedARMFeatures(const ARMAttributeParser &attributes) { attributes.getAttributeValue(ARMBuildAttrs::ARM_ISA_use); std::optional thumb = attributes.getAttributeValue(ARMBuildAttrs::THUMB_ISA_use); - bool noArmISA = !armISA || *armISA == ARMBuildAttrs::Not_Allowed; - bool hasThumb2 = thumb && *thumb >= ARMBuildAttrs::AllowThumb32; - if (noArmISA && hasThumb2) - config->armThumbPLTs = true; + config->armHasArmISA |= armISA && *armISA >= ARMBuildAttrs::Allowed; + config->armHasThumb2ISA |= thumb && *thumb >= ARMBuildAttrs::AllowThumb32; } InputFile::InputFile(Kind k, MemoryBufferRef m) @@ -834,6 +832,7 @@ void ObjFile::initializeSections(bool ignoreComdats, case SHT_STRTAB: case SHT_REL: case SHT_RELA: + case SHT_CREL: case SHT_NULL: break; case SHT_PROGBITS: diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h index 0617f41e1e13a..8566baf61e1ab 100644 --- a/lld/ELF/InputFiles.h +++ b/lld/ELF/InputFiles.h @@ -84,6 +84,7 @@ class InputFile { assert(fileKind == ObjKind || fileKind == BinaryKind); return sections; } + void cacheDecodedCrel(size_t i, InputSectionBase *s) { sections[i] = s; } // Returns object file symbols. It is a runtime error to call this // function on files of other types. diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 12ab1f1eac808..570e485455bad 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -133,21 +133,56 @@ void InputSectionBase::decompress() const { compressed = false; } -template RelsOrRelas InputSectionBase::relsOrRelas() const { +template +RelsOrRelas InputSectionBase::relsOrRelas(bool supportsCrel) const { if (relSecIdx == 0) return {}; RelsOrRelas ret; - typename ELFT::Shdr shdr = - cast(file)->getELFShdrs()[relSecIdx]; + auto *f = cast>(file); + typename ELFT::Shdr shdr = f->template getELFShdrs()[relSecIdx]; + if (shdr.sh_type == SHT_CREL) { + // Return an iterator if supported by caller. + if (supportsCrel) { + ret.crels = Relocs( + (const uint8_t *)f->mb.getBufferStart() + shdr.sh_offset); + return ret; + } + InputSectionBase *const &relSec = f->getSections()[relSecIdx]; + // Otherwise, allocate a buffer to hold the decoded RELA relocations. When + // called for the first time, relSec is null (without --emit-relocs) or an + // InputSection with zero eqClass[0]. + if (!relSec || !cast(relSec)->eqClass[0]) { + auto *sec = makeThreadLocal(*f, shdr, name); + f->cacheDecodedCrel(relSecIdx, sec); + sec->type = SHT_RELA; + sec->eqClass[0] = SHT_RELA; + + RelocsCrel entries(sec->content_); + sec->size = entries.size() * sizeof(typename ELFT::Rela); + auto *relas = makeThreadLocalN(entries.size()); + sec->content_ = reinterpret_cast(relas); + for (auto [i, r] : llvm::enumerate(entries)) { + relas[i].r_offset = r.r_offset; + relas[i].setSymbolAndType(r.r_symidx, r.r_type, false); + relas[i].r_addend = r.r_addend; + } + } + ret.relas = {ArrayRef( + reinterpret_cast(relSec->content_), + relSec->size / sizeof(typename ELFT::Rela))}; + return ret; + } + + const void *content = f->mb.getBufferStart() + shdr.sh_offset; + size_t size = shdr.sh_size; if (shdr.sh_type == SHT_REL) { - ret.rels = ArrayRef(reinterpret_cast( - file->mb.getBufferStart() + shdr.sh_offset), - shdr.sh_size / sizeof(typename ELFT::Rel)); + ret.rels = {ArrayRef(reinterpret_cast(content), + size / sizeof(typename ELFT::Rel))}; } else { assert(shdr.sh_type == SHT_RELA); - ret.relas = ArrayRef(reinterpret_cast( - file->mb.getBufferStart() + shdr.sh_offset), - shdr.sh_size / sizeof(typename ELFT::Rela)); + ret.relas = { + ArrayRef(reinterpret_cast(content), + size / sizeof(typename ELFT::Rela))}; } return ret; } @@ -911,7 +946,7 @@ uint64_t InputSectionBase::getRelocTargetVA(const InputFile *file, RelType type, // So, we handle relocations for non-alloc sections directly in this // function as a performance optimization. template -void InputSection::relocateNonAlloc(uint8_t *buf, ArrayRef rels) { +void InputSection::relocateNonAlloc(uint8_t *buf, Relocs rels) { const unsigned bits = sizeof(typename ELFT::uint) * 8; const TargetInfo &target = *elf::target; const auto emachine = config->emachine; @@ -1073,11 +1108,7 @@ void InputSectionBase::relocate(uint8_t *buf, uint8_t *bufEnd) { auto *sec = cast(this); // For a relocatable link, also call relocateNonAlloc() to rewrite applicable // locations with tombstone values. - const RelsOrRelas rels = sec->template relsOrRelas(); - if (rels.areRelocsRel()) - sec->relocateNonAlloc(buf, rels.rels); - else - sec->relocateNonAlloc(buf, rels.relas); + invokeOnRelocs(*sec, sec->relocateNonAlloc, buf); } // For each function-defining prologue, find any calls to __morestack, @@ -1252,7 +1283,7 @@ SyntheticSection *EhInputSection::getParent() const { // .eh_frame is a sequence of CIE or FDE records. // This function splits an input section into records and returns them. template void EhInputSection::split() { - const RelsOrRelas rels = relsOrRelas(); + const RelsOrRelas rels = relsOrRelas(/*supportsCrel=*/false); // getReloc expects the relocations to be sorted by r_offset. See the comment // in scanRelocs. if (rels.areRelocsRel()) { @@ -1418,10 +1449,14 @@ template void InputSection::writeTo(uint8_t *); template void InputSection::writeTo(uint8_t *); template void InputSection::writeTo(uint8_t *); -template RelsOrRelas InputSectionBase::relsOrRelas() const; -template RelsOrRelas InputSectionBase::relsOrRelas() const; -template RelsOrRelas InputSectionBase::relsOrRelas() const; -template RelsOrRelas InputSectionBase::relsOrRelas() const; +template RelsOrRelas +InputSectionBase::relsOrRelas(bool) const; +template RelsOrRelas +InputSectionBase::relsOrRelas(bool) const; +template RelsOrRelas +InputSectionBase::relsOrRelas(bool) const; +template RelsOrRelas +InputSectionBase::relsOrRelas(bool) const; template MergeInputSection::MergeInputSection(ObjFile &, const ELF32LE::Shdr &, StringRef); diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h index ec12235f842a9..6659530a9c9c2 100644 --- a/lld/ELF/InputSection.h +++ b/lld/ELF/InputSection.h @@ -35,13 +35,26 @@ class OutputSection; LLVM_LIBRARY_VISIBILITY extern std::vector partitions; -// Returned by InputSectionBase::relsOrRelas. At least one member is empty. +// Returned by InputSectionBase::relsOrRelas. At most one member is empty. template struct RelsOrRelas { - ArrayRef rels; - ArrayRef relas; + Relocs rels; + Relocs relas; + Relocs crels; bool areRelocsRel() const { return rels.size(); } + bool areRelocsCrel() const { return crels.size(); } }; +#define invokeOnRelocs(sec, f, ...) \ + { \ + const RelsOrRelas rs = (sec).template relsOrRelas(); \ + if (rs.areRelocsCrel()) \ + f(__VA_ARGS__, rs.crels); \ + else if (rs.areRelocsRel()) \ + f(__VA_ARGS__, rs.rels); \ + else \ + f(__VA_ARGS__, rs.relas); \ + } + // This is the base class of all sections that lld handles. Some are sections in // input files, some are sections in the produced output file and some exist // just as a convenience for implementing special ways of combining some @@ -200,7 +213,8 @@ class InputSectionBase : public SectionBase { // used by --gc-sections. InputSectionBase *nextInSectionGroup = nullptr; - template RelsOrRelas relsOrRelas() const; + template + RelsOrRelas relsOrRelas(bool supportsCrel = true) const; // InputSections that are dependent on us (reverse dependency for GC) llvm::TinyPtrVector dependentSections; @@ -407,7 +421,7 @@ class InputSection : public InputSectionBase { InputSectionBase *getRelocatedSection() const; template - void relocateNonAlloc(uint8_t *buf, llvm::ArrayRef rels); + void relocateNonAlloc(uint8_t *buf, Relocs rels); // Points to the canonical section. If ICF folds two sections, repl pointer of // one section points to the other. @@ -474,7 +488,8 @@ class SyntheticSection : public InputSection { }; inline bool isStaticRelSecType(uint32_t type) { - return type == llvm::ELF::SHT_RELA || type == llvm::ELF::SHT_REL; + return type == llvm::ELF::SHT_RELA || type == llvm::ELF::SHT_CREL || + type == llvm::ELF::SHT_REL; } inline bool isDebugSection(const InputSectionBase &sec) { diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index e2208da18dce0..055fa21d44ca6 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -61,6 +61,8 @@ static StringRef getOutputSectionName(const InputSectionBase *s) { assert(config->relocatable && (rel->flags & SHF_LINK_ORDER)); return s->name; } + if (s->type == SHT_CREL) + return saver().save(".crel" + out->name); if (s->type == SHT_RELA) return saver().save(".rela" + out->name); return saver().save(".rel" + out->name); diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp index 45431e44a6c8c..16e5883c2002c 100644 --- a/lld/ELF/MarkLive.cpp +++ b/lld/ELF/MarkLive.cpp @@ -85,6 +85,13 @@ static uint64_t getAddend(InputSectionBase &sec, return rel.r_addend; } +// Currently, we assume all input CREL relocations have an explicit addend. +template +static uint64_t getAddend(InputSectionBase &sec, + const typename ELFT::Crel &rel) { + return rel.r_addend; +} + template template void MarkLive::resolveReloc(InputSectionBase &sec, RelTy &rel, @@ -239,7 +246,8 @@ template void MarkLive::run() { // all of them. We also want to preserve personality routines and LSDA // referenced by .eh_frame sections, so we scan them for that here. for (EhInputSection *eh : ctx.ehInputSections) { - const RelsOrRelas rels = eh->template relsOrRelas(); + const RelsOrRelas rels = + eh->template relsOrRelas(/*supportsCrel=*/false); if (rels.areRelocsRel()) scanEhFrameSection(*eh, rels.rels); else if (rels.relas.size()) @@ -310,6 +318,8 @@ template void MarkLive::mark() { resolveReloc(sec, rel, false); for (const typename ELFT::Rela &rel : rels.relas) resolveReloc(sec, rel, false); + for (const typename ELFT::Crel &rel : rels.crels) + resolveReloc(sec, rel, false); for (InputSectionBase *isec : sec.dependentSections) enqueue(isec, 0); diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 60de10061c53d..29f18f89274f3 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -18,6 +18,7 @@ #include "llvm/BinaryFormat/Dwarf.h" #include "llvm/Config/llvm-config.h" // LLVM_ENABLE_ZLIB #include "llvm/Support/Compression.h" +#include "llvm/Support/LEB128.h" #include "llvm/Support/Parallel.h" #include "llvm/Support/Path.h" #include "llvm/Support/TimeProfiler.h" @@ -115,7 +116,19 @@ void OutputSection::recordSection(InputSectionBase *isec) { // other InputSections. void OutputSection::commitSection(InputSection *isec) { if (LLVM_UNLIKELY(type != isec->type)) { - if (hasInputSections || typeIsSet) { + if (!hasInputSections && !typeIsSet) { + type = isec->type; + } else if (isStaticRelSecType(type) && isStaticRelSecType(isec->type) && + (type == SHT_CREL) != (isec->type == SHT_CREL)) { + // Combine mixed SHT_REL[A] and SHT_CREL to SHT_CREL. + type = SHT_CREL; + if (type == SHT_REL) { + if (name.consume_front(".rel")) + name = saver().save(".crel" + name); + } else if (name.consume_front(".rela")) { + name = saver().save(".crel" + name); + } + } else { if (typeIsSet || !canMergeToProgbits(type) || !canMergeToProgbits(isec->type)) { // The (NOLOAD) changes the section type to SHT_NOBITS, the intention is @@ -133,8 +146,6 @@ void OutputSection::commitSection(InputSection *isec) { } if (!typeIsSet) type = SHT_PROGBITS; - } else { - type = isec->type; } } if (!hasInputSections) { @@ -470,6 +481,11 @@ void OutputSection::writeTo(uint8_t *buf, parallel::TaskGroup &tg) { llvm::TimeTraceScope timeScope("Write sections", name); if (type == SHT_NOBITS) return; + if (type == SHT_CREL && !(flags & SHF_ALLOC)) { + buf += encodeULEB128(crelHeader, buf); + memcpy(buf, crelBody.data(), crelBody.size()); + return; + } // If the section is compressed due to // --compress-debug-section/--compress-sections, the content is already known. @@ -505,6 +521,12 @@ void OutputSection::writeTo(uint8_t *buf, parallel::TaskGroup &tg) { if (nonZeroFiller) fill(buf, sections.empty() ? size : sections[0]->outSecOff, filler); + if (type == SHT_CREL && !(flags & SHF_ALLOC)) { + buf += encodeULEB128(crelHeader, buf); + memcpy(buf, crelBody.data(), crelBody.size()); + return; + } + auto fn = [=](size_t begin, size_t end) { size_t numSections = sections.size(); for (size_t i = begin; i != end; ++i) { @@ -592,6 +614,103 @@ static void finalizeShtGroup(OutputSection *os, InputSection *section) { os->size = (1 + seen.size()) * sizeof(uint32_t); } +template +LLVM_ATTRIBUTE_ALWAYS_INLINE static void +encodeOneCrel(raw_svector_ostream &os, Elf_Crel &out, + uint offset, const Symbol &sym, uint32_t type, uint addend) { + const auto deltaOffset = static_cast(offset - out.r_offset); + out.r_offset = offset; + int64_t symidx = in.symTab->getSymbolIndex(sym); + if (sym.type == STT_SECTION) { + auto *d = dyn_cast(&sym); + if (d) { + SectionBase *section = d->section; + assert(section->isLive()); + addend = sym.getVA(addend) - section->getOutputSection()->addr; + } else { + // Encode R_*_NONE(symidx=0). + symidx = type = addend = 0; + } + } + + // Similar to llvm::ELF::encodeCrel. + uint8_t b = deltaOffset * 8 + (out.r_symidx != symidx) + + (out.r_type != type ? 2 : 0) + + (uint(out.r_addend) != addend ? 4 : 0); + if (deltaOffset < 0x10) { + os << char(b); + } else { + os << char(b | 0x80); + encodeULEB128(deltaOffset >> 4, os); + } + if (b & 1) { + encodeSLEB128(static_cast(symidx - out.r_symidx), os); + out.r_symidx = symidx; + } + if (b & 2) { + encodeSLEB128(static_cast(type - out.r_type), os); + out.r_type = type; + } + if (b & 4) { + encodeSLEB128(std::make_signed_t(addend - out.r_addend), os); + out.r_addend = addend; + } +} + +template +static size_t relToCrel(raw_svector_ostream &os, Elf_Crel &out, + InputSection *relSec, InputSectionBase *sec) { + const auto &file = *cast(relSec->file); + if (relSec->type == SHT_REL) { + // REL conversion is complex and unsupported yet. + errorOrWarn(toString(relSec) + ": REL cannot be converted to CREL"); + return 0; + } + auto rels = relSec->getDataAs(); + for (auto rel : rels) { + encodeOneCrel( + os, out, sec->getVA(rel.r_offset), file.getRelocTargetSym(rel), + rel.getType(config->isMips64EL), getAddend(rel)); + } + return rels.size(); +} + +// Compute the content of a non-alloc CREL section due to -r or --emit-relocs. +// Input CREL sections are decoded while REL[A] need to be converted. +template void OutputSection::finalizeNonAllocCrel() { + using uint = typename Elf_Crel_Impl::uint; + raw_svector_ostream os(crelBody); + uint64_t totalCount = 0; + Elf_Crel out{}; + assert(commands.size() == 1); + auto *isd = cast(commands[0]); + for (InputSection *relSec : isd->sections) { + const auto &file = *cast(relSec->file); + InputSectionBase *sec = relSec->getRelocatedSection(); + if (relSec->type == SHT_CREL) { + RelocsCrel entries(relSec->content_); + totalCount += entries.size(); + for (Elf_Crel_Impl r : entries) { + encodeOneCrel(os, out, uint(sec->getVA(r.r_offset)), + file.getSymbol(r.r_symidx), r.r_type, r.r_addend); + } + continue; + } + + // Convert REL[A] to CREL. + if constexpr (is64) { + totalCount += config->isLE ? relToCrel(os, out, relSec, sec) + : relToCrel(os, out, relSec, sec); + } else { + totalCount += config->isLE ? relToCrel(os, out, relSec, sec) + : relToCrel(os, out, relSec, sec); + } + } + + crelHeader = totalCount * 8 + 4; + size = getULEB128Size(crelHeader) + crelBody.size(); +} + void OutputSection::finalize() { InputSection *first = getFirstInputSection(this); @@ -628,6 +747,13 @@ void OutputSection::finalize() { InputSectionBase *s = first->getRelocatedSection(); info = s->getOutputSection()->sectionIndex; flags |= SHF_INFO_LINK; + // Finalize the content of non-alloc CREL. + if (type == SHT_CREL) { + if (config->is64) + finalizeNonAllocCrel(); + else + finalizeNonAllocCrel(); + } } // Returns true if S is in one of the many forms the compiler driver may pass diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index 78fede48a23f2..8c0c52f34ac9f 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -84,6 +84,11 @@ class OutputSection final : public SectionBase { Expr alignExpr; Expr lmaExpr; Expr subalignExpr; + + // Used by non-alloc SHT_CREL to hold the header and content byte stream. + uint64_t crelHeader = 0; + SmallVector crelBody; + SmallVector commands; SmallVector phdrs; std::optional> filler; @@ -106,6 +111,7 @@ class OutputSection final : public SectionBase { // DATA_RELRO_END. bool relro = false; + template void finalizeNonAllocCrel(); void finalize(); template void writeTo(uint8_t *buf, llvm::parallel::TaskGroup &tg); diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 36857d72c647e..707768dee6d38 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -459,7 +459,8 @@ class OffsetGetter { // InputSectionBase. class RelocationScanner { public: - template void scanSection(InputSectionBase &s); + template + void scanSection(InputSectionBase &s, bool isEH = false); private: InputSectionBase *sec; @@ -475,8 +476,9 @@ class RelocationScanner { uint64_t relOff) const; void processAux(RelExpr expr, RelType type, uint64_t offset, Symbol &sym, int64_t addend) const; - template void scanOne(RelTy *&i); - template void scan(ArrayRef rels); + template + void scanOne(typename Relocs::const_iterator &i); + template void scan(Relocs rels); }; } // namespace @@ -1308,7 +1310,8 @@ static unsigned handleTlsRelocation(RelType type, Symbol &sym, // LoongArch does not yet implement transition from TLSDESC to LE/IE, so // generate TLSDESC dynamic relocation for the dynamic linker to handle. if (config->emachine == EM_LOONGARCH && - oneof(expr)) { + oneof(expr)) { if (expr != R_TLSDESC_CALL) { sym.setFlags(NEEDS_TLSDESC); c.addReloc({expr, type, offset, addend, &sym}); @@ -1433,15 +1436,17 @@ static unsigned handleTlsRelocation(RelType type, Symbol &sym, return 0; } -template void RelocationScanner::scanOne(RelTy *&i) { +template +void RelocationScanner::scanOne(typename Relocs::const_iterator &i) { const RelTy &rel = *i; uint32_t symIndex = rel.getSymbol(config->isMips64EL); Symbol &sym = sec->getFile()->getSymbol(symIndex); RelType type; - if constexpr (ELFT::Is64Bits) { + if constexpr (ELFT::Is64Bits || RelTy::IsCrel) { type = rel.getType(config->isMips64EL); ++i; } else { + // CREL is unsupported for MIPS N32. if (config->mipsN32Abi) { type = getMipsN32RelType(i); } else { @@ -1494,15 +1499,18 @@ template void RelocationScanner::scanOne(RelTy *&i) { if ((type == R_PPC64_TLSGD && expr == R_TLSDESC_CALL) || (type == R_PPC64_TLSLD && expr == R_TLSLD_HINT)) { - if (i == end) { - errorOrWarn("R_PPC64_TLSGD/R_PPC64_TLSLD may not be the last " - "relocation" + - getLocation(*sec, sym, offset)); - return; + // Skip the error check for CREL, which does not set `end`. + if constexpr (!RelTy::IsCrel) { + if (i == end) { + errorOrWarn("R_PPC64_TLSGD/R_PPC64_TLSLD may not be the last " + "relocation" + + getLocation(*sec, sym, offset)); + return; + } } - // Offset the 4-byte aligned R_PPC64_TLSGD by one byte in the NOTOC case, - // so we can discern it later from the toc-case. + // Offset the 4-byte aligned R_PPC64_TLSGD by one byte in the NOTOC + // case, so we can discern it later from the toc-case. if (i->getType(/*isMips64EL=*/false) == R_PPC64_REL24_NOTOC) ++offset; } @@ -1542,7 +1550,7 @@ template void RelocationScanner::scanOne(RelTy *&i) { // instructions are generated by very old IBM XL compilers. Work around the // issue by disabling GD/LD to IE/LE relaxation. template -static void checkPPC64TLSRelax(InputSectionBase &sec, ArrayRef rels) { +static void checkPPC64TLSRelax(InputSectionBase &sec, Relocs rels) { // Skip if sec is synthetic (sec.file is null) or if sec has been marked. if (!sec.file || sec.file->ppc64DisableTLSRelax) return; @@ -1574,7 +1582,7 @@ static void checkPPC64TLSRelax(InputSectionBase &sec, ArrayRef rels) { } template -void RelocationScanner::scan(ArrayRef rels) { +void RelocationScanner::scan(Relocs rels) { // Not all relocations end up in Sec->Relocations, but a lot do. sec->relocations.reserve(rels.size()); @@ -1590,9 +1598,15 @@ void RelocationScanner::scan(ArrayRef rels) { if (isa(sec) || config->emachine == EM_S390) rels = sortRels(rels, storage); - end = static_cast(rels.end()); - for (auto i = rels.begin(); i != end;) - scanOne(i); + if constexpr (RelTy::IsCrel) { + for (auto i = rels.begin(); i != rels.end();) + scanOne(i); + } else { + // The non-CREL code path has additional check for PPC64 TLS. + end = static_cast(rels.end()); + for (auto i = rels.begin(); i != end;) + scanOne(i); + } // Sort relocations by offset for more efficient searching for // R_RISCV_PCREL_HI20 and R_PPC64_ADDR64. @@ -1604,11 +1618,14 @@ void RelocationScanner::scan(ArrayRef rels) { }); } -template void RelocationScanner::scanSection(InputSectionBase &s) { +template +void RelocationScanner::scanSection(InputSectionBase &s, bool isEH) { sec = &s; getter = OffsetGetter(s); - const RelsOrRelas rels = s.template relsOrRelas(); - if (rels.areRelocsRel()) + const RelsOrRelas rels = s.template relsOrRelas(!isEH); + if (rels.areRelocsCrel()) + scan(rels.crels); + else if (rels.areRelocsRel()) scan(rels.rels); else scan(rels.relas); @@ -1643,7 +1660,7 @@ template void elf::scanRelocations() { RelocationScanner scanner; for (Partition &part : partitions) { for (EhInputSection *sec : part.ehFrame->sections) - scanner.template scanSection(*sec); + scanner.template scanSection(*sec, /*isEH=*/true); if (part.armExidx && part.armExidx->isLive()) for (InputSection *sec : part.armExidx->exidxSections) if (sec->isLive()) @@ -2409,11 +2426,7 @@ template void elf::checkNoCrossRefs() { if (!isd) continue; parallelForEach(isd->sections, [&](InputSection *sec) { - const RelsOrRelas rels = sec->template relsOrRelas(); - if (rels.areRelocsRel()) - scanCrossRefs(noxref, osec, sec, rels.rels); - else - scanCrossRefs(noxref, osec, sec, rels.relas); + invokeOnRelocs(*sec, scanCrossRefs, noxref, osec, sec); }); } } diff --git a/lld/ELF/Relocations.h b/lld/ELF/Relocations.h index 1bee0dedf8587..aaa4581490a28 100644 --- a/lld/ELF/Relocations.h +++ b/lld/ELF/Relocations.h @@ -12,6 +12,7 @@ #include "lld/Common/LLVM.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/Object/ELFTypes.h" #include namespace lld::elf { @@ -205,6 +206,91 @@ class ThunkCreator { uint32_t pass = 0; }; +// Decode LEB128 without error checking. Only used by performance critical code +// like RelocsCrel. +inline uint64_t readLEB128(const uint8_t *&p, uint64_t leb) { + uint64_t acc = 0, shift = 0, byte; + do { + byte = *p++; + acc |= (byte - 128 * (byte >= leb)) << shift; + shift += 7; + } while (byte >= 128); + return acc; +} +inline uint64_t readULEB128(const uint8_t *&p) { return readLEB128(p, 128); } +inline int64_t readSLEB128(const uint8_t *&p) { return readLEB128(p, 64); } + +// This class implements a CREL iterator that does not allocate extra memory. +template struct RelocsCrel { + using uint = std::conditional_t; + struct const_iterator { + using iterator_category = std::forward_iterator_tag; + using value_type = llvm::object::Elf_Crel_Impl; + using difference_type = ptrdiff_t; + using pointer = value_type *; + using reference = const value_type &; + uint32_t count; + uint8_t flagBits, shift; + const uint8_t *p; + llvm::object::Elf_Crel_Impl crel{}; + const_iterator(size_t hdr, const uint8_t *p) + : count(hdr / 8), flagBits(hdr & 4 ? 3 : 2), shift(hdr % 4), p(p) { + if (count) + step(); + } + void step() { + // See object::decodeCrel. + const uint8_t b = *p++; + crel.r_offset += b >> flagBits << shift; + if (b >= 0x80) + crel.r_offset += + ((readULEB128(p) << (7 - flagBits)) - (0x80 >> flagBits)) << shift; + if (b & 1) + crel.r_symidx += readSLEB128(p); + if (b & 2) + crel.r_type += readSLEB128(p); + if (b & 4 && flagBits == 3) + crel.r_addend += static_cast(readSLEB128(p)); + } + llvm::object::Elf_Crel_Impl operator*() const { return crel; }; + const llvm::object::Elf_Crel_Impl *operator->() const { + return &crel; + } + // For llvm::enumerate. + bool operator==(const const_iterator &r) const { return count == r.count; } + bool operator!=(const const_iterator &r) const { return count != r.count; } + const_iterator &operator++() { + if (--count) + step(); + return *this; + } + // For RelocationScanner::scanOne. + void operator+=(size_t n) { + for (; n; --n) + operator++(); + } + }; + + size_t hdr = 0; + const uint8_t *p = nullptr; + + constexpr RelocsCrel() = default; + RelocsCrel(const uint8_t *p) : hdr(readULEB128(p)) { this->p = p; } + size_t size() const { return hdr / 8; } + const_iterator begin() const { return {hdr, p}; } + const_iterator end() const { return {0, nullptr}; } +}; + +template struct Relocs : ArrayRef { + Relocs() = default; + Relocs(ArrayRef a) : ArrayRef(a) {} +}; + +template +struct Relocs> : RelocsCrel { + using RelocsCrel::RelocsCrel; +}; + // Return a int64_t to make sure we get the sign extension out of the way as // early as possible. template @@ -215,20 +301,32 @@ template static inline int64_t getAddend(const typename ELFT::Rela &rel) { return rel.r_addend; } +template +static inline int64_t getAddend(const typename ELFT::Crel &rel) { + return rel.r_addend; +} template -ArrayRef sortRels(ArrayRef rels, SmallVector &storage) { +inline Relocs sortRels(Relocs rels, + SmallVector &storage) { auto cmp = [](const RelTy &a, const RelTy &b) { return a.r_offset < b.r_offset; }; if (!llvm::is_sorted(rels, cmp)) { storage.assign(rels.begin(), rels.end()); llvm::stable_sort(storage, cmp); - rels = storage; + rels = Relocs(storage); } return rels; } +template +inline Relocs> +sortRels(Relocs> rels, + SmallVector, 0> &storage) { + return {}; +} + // Returns true if Expr refers a GOT entry. Note that this function returns // false for TLS variables even though they need GOT, because TLS variables uses // GOT differently than the regular variables. diff --git a/lld/ELF/ScriptLexer.cpp b/lld/ELF/ScriptLexer.cpp index c8c02ab0f3e09..847cd8423b49a 100644 --- a/lld/ELF/ScriptLexer.cpp +++ b/lld/ELF/ScriptLexer.cpp @@ -20,11 +20,6 @@ // in various corner cases. We do not care much about efficiency because // the time spent in parsing linker scripts is usually negligible. // -// Our grammar of the linker script is LL(2), meaning that it needs at -// most two-token lookahead to parse. The only place we need two-token -// lookahead is labels in version scripts, where we need to parse "local :" -// as if "local:". -// // Overall, this lexer works fine for most linker scripts. There might // be room for improving compatibility, but that's probably not at the // top of our todo list. diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 5d3f3df216b85..41053c6472751 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -455,7 +455,8 @@ template void EhFrameSection::addSectionAux(EhInputSection *sec) { if (!sec->isLive()) return; - const RelsOrRelas rels = sec->template relsOrRelas(); + const RelsOrRelas rels = + sec->template relsOrRelas(/*supportsCrel=*/false); if (rels.areRelocsRel()) addRecords(sec, rels.rels); else @@ -489,7 +490,8 @@ void EhFrameSection::iterateFDEWithLSDA( DenseSet ciesWithLSDA; for (EhInputSection *sec : sections) { ciesWithLSDA.clear(); - const RelsOrRelas rels = sec->template relsOrRelas(); + const RelsOrRelas rels = + sec->template relsOrRelas(/*supportsCrel=*/false); if (rels.areRelocsRel()) iterateFDEWithLSDAAux(*sec, rels.rels, ciesWithLSDA, fn); else @@ -3203,10 +3205,10 @@ template DebugNamesSection::DebugNamesSection() { template template void DebugNamesSection::getNameRelocs( - InputSection *sec, ArrayRef rels, - DenseMap &relocs) { + const InputFile &file, DenseMap &relocs, + Relocs rels) { for (const RelTy &rel : rels) { - Symbol &sym = sec->file->getRelocTargetSym(rel); + Symbol &sym = file.getRelocTargetSym(rel); relocs[rel.r_offset] = sym.getVA(getAddend(rel)); } } @@ -3216,11 +3218,7 @@ template void DebugNamesSection::finalizeContents() { auto relocs = std::make_unique[]>(numChunks); parallelFor(0, numChunks, [&](size_t i) { InputSection *sec = inputSections[i]; - auto rels = sec->template relsOrRelas(); - if (rels.areRelocsRel()) - getNameRelocs(sec, rels.rels, relocs.get()[i]); - else - getNameRelocs(sec, rels.relas, relocs.get()[i]); + invokeOnRelocs(*sec, getNameRelocs, *sec->file, relocs.get()[i]); // Relocate CU offsets with .debug_info + X relocations. OutputChunk &chunk = chunks.get()[i]; diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h index eaa09ea7194fb..d4169e1e1acaf 100644 --- a/lld/ELF/SyntheticSections.h +++ b/lld/ELF/SyntheticSections.h @@ -916,8 +916,9 @@ class DebugNamesSection final : public DebugNamesBaseSection { void writeTo(uint8_t *buf) override; template - void getNameRelocs(InputSection *sec, ArrayRef rels, - llvm::DenseMap &relocs); + void getNameRelocs(const InputFile &file, + llvm::DenseMap &relocs, + Relocs rels); private: static void readOffsets(InputChunk &inputChunk, OutputChunk &chunk, diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 5cffdb771a738..8e3a746a08eb2 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -401,10 +401,19 @@ template static void markUsedLocalSymbols() { InputSection *isec = dyn_cast_or_null(s); if (!isec) continue; - if (isec->type == SHT_REL) + if (isec->type == SHT_REL) { markUsedLocalSymbolsImpl(f, isec->getDataAs()); - else if (isec->type == SHT_RELA) + } else if (isec->type == SHT_RELA) { markUsedLocalSymbolsImpl(f, isec->getDataAs()); + } else if (isec->type == SHT_CREL) { + // The is64=true variant also works with ELF32 since only the r_symidx + // member is used. + for (Elf_Crel_Impl r : RelocsCrel(isec->content_)) { + Symbol &sym = file->getSymbol(r.r_symidx); + if (sym.isLocal()) + sym.used = true; + } + } } } } diff --git a/lld/MachO/ObjC.cpp b/lld/MachO/ObjC.cpp index 9c056f40aa943..39d885188d34a 100644 --- a/lld/MachO/ObjC.cpp +++ b/lld/MachO/ObjC.cpp @@ -873,7 +873,6 @@ Defined *ObjcCategoryMerger::emitAndLinkProtocolList( infoCategoryWriter.catPtrListInfo.align); listSec->parent = infoCategoryWriter.catPtrListInfo.outputSection; listSec->live = true; - addInputSection(listSec); listSec->parent = infoCategoryWriter.catPtrListInfo.outputSection; @@ -889,6 +888,7 @@ Defined *ObjcCategoryMerger::emitAndLinkProtocolList( ptrListSym->used = true; parentSym->getObjectFile()->symbols.push_back(ptrListSym); + addInputSection(listSec); createSymbolReference(parentSym, ptrListSym, linkAtOffset, infoCategoryWriter.catBodyInfo.relocTemplate); @@ -933,7 +933,6 @@ void ObjcCategoryMerger::emitAndLinkPointerList( infoCategoryWriter.catPtrListInfo.align); listSec->parent = infoCategoryWriter.catPtrListInfo.outputSection; listSec->live = true; - addInputSection(listSec); listSec->parent = infoCategoryWriter.catPtrListInfo.outputSection; @@ -949,6 +948,7 @@ void ObjcCategoryMerger::emitAndLinkPointerList( ptrListSym->used = true; parentSym->getObjectFile()->symbols.push_back(ptrListSym); + addInputSection(listSec); createSymbolReference(parentSym, ptrListSym, linkAtOffset, infoCategoryWriter.catBodyInfo.relocTemplate); @@ -974,7 +974,6 @@ ObjcCategoryMerger::emitCatListEntrySec(const std::string &forCategoryName, bodyData, infoCategoryWriter.catListInfo.align); newCatList->parent = infoCategoryWriter.catListInfo.outputSection; newCatList->live = true; - addInputSection(newCatList); newCatList->parent = infoCategoryWriter.catListInfo.outputSection; @@ -990,6 +989,7 @@ ObjcCategoryMerger::emitCatListEntrySec(const std::string &forCategoryName, catListSym->used = true; objFile->symbols.push_back(catListSym); + addInputSection(newCatList); return catListSym; } @@ -1012,7 +1012,6 @@ Defined *ObjcCategoryMerger::emitCategoryBody(const std::string &name, bodyData, infoCategoryWriter.catBodyInfo.align); newBodySec->parent = infoCategoryWriter.catBodyInfo.outputSection; newBodySec->live = true; - addInputSection(newBodySec); std::string symName = objc::symbol_names::category + baseClassName + "(" + name + ")"; @@ -1025,6 +1024,7 @@ Defined *ObjcCategoryMerger::emitCategoryBody(const std::string &name, catBodySym->used = true; objFile->symbols.push_back(catBodySym); + addInputSection(newBodySec); createSymbolReference(catBodySym, nameSym, catLayout.nameOffset, infoCategoryWriter.catBodyInfo.relocTemplate); @@ -1245,7 +1245,6 @@ void ObjcCategoryMerger::generateCatListForNonErasedCategories( infoCategoryWriter.catListInfo.align); listSec->parent = infoCategoryWriter.catListInfo.outputSection; listSec->live = true; - addInputSection(listSec); std::string slotSymName = "<__objc_catlist slot for category "; slotSymName += nonErasedCatBody->getName(); @@ -1260,6 +1259,7 @@ void ObjcCategoryMerger::generateCatListForNonErasedCategories( catListSlotSym->used = true; objFile->symbols.push_back(catListSlotSym); + addInputSection(listSec); // Now link the category body into the newly created slot createSymbolReference(catListSlotSym, nonErasedCatBody, 0, diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp index 35fd478a21905..c7d7b9cfca386 100644 --- a/lld/MinGW/Driver.cpp +++ b/lld/MinGW/Driver.cpp @@ -448,6 +448,9 @@ bool link(ArrayRef argsArr, llvm::raw_ostream &stdoutOS, add("-errorlimit:" + s); } + if (auto *a = args.getLastArg(OPT_rpath)) + warn("parameter " + a->getSpelling() + " has no effect on PE/COFF targets"); + for (auto *a : args.filtered(OPT_mllvm)) add("-mllvm:" + StringRef(a->getValue())); diff --git a/lld/MinGW/Options.td b/lld/MinGW/Options.td index 56f67e3dd96c4..7bd5fb80749da 100644 --- a/lld/MinGW/Options.td +++ b/lld/MinGW/Options.td @@ -243,6 +243,9 @@ defm: EqNoHelp<"sysroot">; def: F<"sort-common">; def: F<"start-group">; +// Ignored options, that produce warnings +defm rpath: EqNoHelp<"rpath">; + // Ignore GCC collect2 LTO plugin related options. Note that we don't support // GCC LTO, but GCC collect2 passes these options even in non-LTO mode. def: J<"plugin-opt=-fresolution=">; diff --git a/lld/cmake/modules/AddLLD.cmake b/lld/cmake/modules/AddLLD.cmake index 9f2684b6f933e..8efaab8b07451 100644 --- a/lld/cmake/modules/AddLLD.cmake +++ b/lld/cmake/modules/AddLLD.cmake @@ -62,8 +62,58 @@ macro(add_lld_tool name) DEPENDS ${name} COMPONENT ${name}) endif() - set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name}) + + if(APPLE) + if(LLVM_EXTERNALIZE_DEBUGINFO_INSTALL) + if(LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION) + set(file_ext ${LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION}) + elseif(LLVM_EXTERNALIZE_DEBUGINFO_FLATTEN) + set(file_ext dwarf) + else() + set(file_ext dSYM) + endif() + set(output_name "$.${file_ext}") + if(LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR) + set(output_path "${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR}/${output_name}") + else() + set(output_path "${output_name}") + endif() + get_filename_component(debuginfo_absolute_path ${output_path} REALPATH BASE_DIR $) + install(FILES ${debuginfo_absolute_path} DESTINATION bin OPTIONAL COMPONENT ${name}) + endif() + elseif(WIN32) + if(LLVM_EXTERNALIZE_DEBUGINFO_INSTALL) + install(FILES $ DESTINATION bin OPTIONAL COMPONENT ${name}) + endif() + else() + if(LLVM_EXTERNALIZE_DEBUGINFO_INSTALL) + if(LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION) + set(file_ext ${LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION}) + else() + set(file_ext debug) + endif() + + set(output_name "$.${file_ext}") + + if(LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR) + set(output_path "${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR}/${output_name}") + # If an output dir is specified, it must be manually mkdir'd on Linux, + # as that directory needs to exist before we can pipe to a file in it. + add_custom_command(TARGET ${name} POST_BUILD + WORKING_DIRECTORY ${LLVM_RUNTIME_OUTPUT_INTDIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR} + ) + else() + set(output_path "${output_name}") + endif() + + get_filename_component(debuginfo_absolute_path ${output_path} REALPATH BASE_DIR $) + install(FILES ${debuginfo_absolute_path} DESTINATION bin OPTIONAL COMPONENT ${name}) + endif() + endif() endif() + + set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name}) endif() endmacro() diff --git a/lld/docs/ReleaseNotes.rst b/lld/docs/ReleaseNotes.rst index 09081e421e905..98fddcd7bf7f2 100644 --- a/lld/docs/ReleaseNotes.rst +++ b/lld/docs/ReleaseNotes.rst @@ -26,6 +26,12 @@ Non-comprehensive list of changes in this release ELF Improvements ---------------- +* Experimental CREL relocations with explicit addends are now supported using the + temporary section type code 0x40000020 (``clang -c -Wa,--crel,--allow-experimental-crel``). + LLVM will change the code and break compatibility (Clang and lld of different + versions are not guaranteed to cooperate, unlike other features). CREL with + implicit addends are not supported. + (`#98115 `_) * ``EI_OSABI`` in the output is now inferred from input object files. (`#97144 `_) * ``--compress-sections ={none,zlib,zstd}[:level]`` is added to compress @@ -88,7 +94,7 @@ ELF Improvements (`#94099 `_) Non-alloc orphan sections are now placed at the end. (`#94519 `_) -* R_X86_64_REX_GOTPCRELX of the addq form is no longer incorrectly optimized when the address is larger than 0x80000000. +* ``R_X86_64_REX_GOTPCRELX`` of the addq form is no longer incorrectly optimized when the address is larger than 0x80000000. Breaking changes ---------------- diff --git a/lld/test/ELF/arm-cmse-implib.s b/lld/test/ELF/arm-cmse-implib.s index 581bff9dd8536..60a68b0226c3d 100644 --- a/lld/test/ELF/arm-cmse-implib.s +++ b/lld/test/ELF/arm-cmse-implib.s @@ -53,8 +53,8 @@ secure_entry: // CHECK1-NEXT: Num: Value Size Type Bind Vis Ndx Name // CHECK1-NEXT: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND // CHECK1-NEXT: 1: 00020000 0 NOTYPE LOCAL DEFAULT 2 $t -// CHECK1-NEXT: 2: 00008000 0 NOTYPE LOCAL DEFAULT 1 $t.0 -// CHECK1-NEXT: 3: 00008004 0 NOTYPE LOCAL DEFAULT 1 $t.0 +// CHECK1-NEXT: 2: 00008000 0 NOTYPE LOCAL DEFAULT 1 $t +// CHECK1-NEXT: 3: 00008004 0 NOTYPE LOCAL DEFAULT 1 $t // CHECK1-NEXT: 4: 00008001 2 FUNC GLOBAL DEFAULT 1 secure_entry // CHECK1-NEXT: 5: 00020001 8 FUNC GLOBAL DEFAULT 2 foo // CHECK1-NEXT: 6: 00008005 2 FUNC GLOBAL DEFAULT 1 __acle_se_foo @@ -82,8 +82,8 @@ secure_entry: // CHECK2-NEXT: Num: Value Size Type Bind Vis Ndx Name // CHECK2-NEXT: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND // CHECK2-NEXT: 1: 00020000 0 NOTYPE LOCAL DEFAULT 2 $t -// CHECK2-NEXT: 2: 00008000 0 NOTYPE LOCAL DEFAULT 1 $t.0 -// CHECK2-NEXT: 3: 00008004 0 NOTYPE LOCAL DEFAULT 1 $t.0 +// CHECK2-NEXT: 2: 00008000 0 NOTYPE LOCAL DEFAULT 1 $t +// CHECK2-NEXT: 3: 00008004 0 NOTYPE LOCAL DEFAULT 1 $t // CHECK2-NEXT: 4: 00008001 2 FUNC GLOBAL DEFAULT 1 secure_entry // CHECK2-NEXT: 5: 00020011 8 FUNC WEAK DEFAULT 2 baz // CHECK2-NEXT: 6: 00008005 2 FUNC GLOBAL DEFAULT 1 __acle_se_baz diff --git a/lld/test/ELF/arm-mixed-plts.s b/lld/test/ELF/arm-mixed-plts.s new file mode 100644 index 0000000000000..801de70f4f101 --- /dev/null +++ b/lld/test/ELF/arm-mixed-plts.s @@ -0,0 +1,44 @@ +# REQUIRES: arm + +# RUN: rm -rf %t && split-file %s %t +# RUN: llvm-mc -filetype=obj -arm-add-build-attributes -triple=armv7a-none-linux-gnueabi %t/a.s -o %t1.o +# RUN: llvm-mc -filetype=obj -arm-add-build-attributes -triple=armv7a-none-linux-gnueabi %t/b.s -o %t2.o +# RUN: ld.lld -shared %t1.o %t2.o -o %t.so +# RUN: llvm-objdump -d %t.so | FileCheck %s + +## Check that, when the input is a mixture of objects which can and cannot use +## the ARM ISA, we use the default ARM PLT sequences. + +# CHECK: <.plt>: +# CHECK-NEXT: e52de004 str lr, [sp, #-0x4]! +# CHECK-NEXT: e28fe600 add lr, pc, #0, #12 +# CHECK-NEXT: e28eea20 add lr, lr, #32, #20 +# CHECK-NEXT: e5bef084 ldr pc, [lr, #0x84]! +# CHECK-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4 +# CHECK-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4 +# CHECK-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4 +# CHECK-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4 +# CHECK-NEXT: e28fc600 add r12, pc, #0, #12 +# CHECK-NEXT: e28cca20 add r12, r12, #32, #20 +# CHECK-NEXT: e5bcf06c ldr pc, [r12, #0x6c]! +# CHECK-NEXT: d4 d4 d4 d4 .word 0xd4d4d4d4 + +#--- a.s + .globl foo + .type foo, %function + .globl bar + .type bar, %function + + .thumb +foo: + bl bar + bx lr + +#--- b.s + .eabi_attribute Tag_ARM_ISA_use, 0 + + .arm + .globl bar + .type bar, %function +bar: + bx lr diff --git a/lld/test/ELF/avr-reloc.s b/lld/test/ELF/avr-reloc.s index ec088eaa149d0..41c32580f63a1 100644 --- a/lld/test/ELF/avr-reloc.s +++ b/lld/test/ELF/avr-reloc.s @@ -76,32 +76,6 @@ adiw r24, b ; R_AVR_6_ADIW in r20, b ; R_AVR_PORT6 sbic b, 1 ; R_AVR_PORT5 -.section .PCREL,"ax",@progbits -; CHECK-LABEL: section .PCREL -; CHECK: rjmp .+30 -; CHECK-NEXT: rjmp .-36 -; CHECK-NEXT: breq .+26 -; CHECK-NEXT: breq .-40 -; CHECK-NEXT: rjmp .-4096 -; CHECK-NEXT: rjmp .+4094 -; CHECK-NEXT: rjmp .+4094 -; CHECK-NEXT: rjmp .-4096 -; CHECK-NEXT: breq .-128 -; CHECK-NEXT: breq .+126 -; HEX-LABEL: section .PCREL: -; HEX-NEXT: 0fc0eecf 69f061f3 -foo: -rjmp foo + 32 ; R_AVR_13_PCREL -rjmp foo - 32 ; R_AVR_13_PCREL -breq foo + 32 ; R_AVR_7_PCREL -breq foo - 32 ; R_AVR_7_PCREL -rjmp 1f - 4096 $ 1: ; R_AVR_13_PCREL -rjmp 1f + 4094 $ 1: ; R_AVR_13_PCREL -rjmp 1f - 4098 $ 1: ; R_AVR_13_PCREL (overflow) -rjmp 1f + 4096 $ 1: ; R_AVR_13_PCREL (overflow) -breq 1f - 128 $ 1: ; R_AVR_7_PCREL -breq 1f + 126 $ 1: ; R_AVR_7_PCREL - .section .LDSSTS,"ax",@progbits ; CHECK-LABEL: section .LDSSTS: ; CHECK: lds r20, 0x1e diff --git a/lld/test/ELF/cgprofile-rela.test b/lld/test/ELF/cgprofile-rela.test index 141dfd4c65b1e..87dad02940b98 100644 --- a/lld/test/ELF/cgprofile-rela.test +++ b/lld/test/ELF/cgprofile-rela.test @@ -8,6 +8,10 @@ # RUN: ld.lld --no-call-graph-profile-sort %t.o -o %t # RUN: llvm-nm --no-sort %t | FileCheck %s --check-prefix=NO-CG +# RUN: yaml2obj -DTYPE=SHT_CREL %s -o %tcrel.o +# RUN: ld.lld --call-graph-profile-sort=hfsort %tcrel.o -o %t +# RUN: llvm-nm --no-sort %t | FileCheck %s + # CHECK: 0000000000201124 t D # CHECK: 0000000000201122 t C # CHECK: 0000000000201128 t B @@ -60,7 +64,7 @@ Sections: - Weight: 30 - Weight: 90 - Name: .rela.llvm.call-graph-profile - Type: SHT_RELA + Type: [[TYPE=SHT_RELA]] Info: .llvm.call-graph-profile Relocations: - Offset: 0x0 diff --git a/lld/test/ELF/crel-rel-mixed.s b/lld/test/ELF/crel-rel-mixed.s new file mode 100644 index 0000000000000..a69fa1c09b436 --- /dev/null +++ b/lld/test/ELF/crel-rel-mixed.s @@ -0,0 +1,22 @@ +# REQUIRES: arm +# RUN: rm -rf %t && split-file %s %t && cd %t +# RUN: llvm-mc -filetype=obj -triple=armv7a -crel a.s -o a.o +# RUN: llvm-mc -filetype=obj -triple=armv7a b.s -o b.o +# RUN: not ld.lld -r a.o b.o 2>&1 | FileCheck %s --check-prefix=ERR + +# ERR: error: b.o:(.rel.text): REL cannot be converted to CREL + +#--- a.s +.global _start, foo +_start: + bl foo + bl .text.foo + +.section .text.foo,"ax" +foo: + nop + +#--- b.s +.globl fb +fb: + bl fb diff --git a/lld/test/ELF/crel.s b/lld/test/ELF/crel.s new file mode 100644 index 0000000000000..1de3f314fc677 --- /dev/null +++ b/lld/test/ELF/crel.s @@ -0,0 +1,98 @@ +# REQUIRES: x86 +# RUN: rm -rf %t && split-file %s %t && cd %t +# RUN: llvm-mc -filetype=obj -triple=x86_64 -crel a.s -o a.o +# RUN: llvm-mc -filetype=obj -triple=x86_64 -crel b.s -o b.o +# RUN: ld.lld -pie a.o b.o -o out +# RUN: llvm-objdump -d out | FileCheck %s +# RUN: llvm-readelf -Srs out | FileCheck %s --check-prefix=RELOC +# RUN: llvm-dwarfdump --eh-frame out | FileCheck %s --check-prefix=UNWIND + +# CHECK: <_start>: +# CHECK-NEXT: callq {{.*}} +# CHECK-NEXT: callq {{.*}} +# CHECK-EMPTY: +# CHECK-NEXT: : +# CHECK-NEXT: leaq {{.*}} # 0x27c +# CHECK-NEXT: leaq {{.*}} # 0x278 + +# RELOC: .data PROGBITS {{0*}}[[#%x,DATA:]] + +# RELOC: {{0*}}[[#DATA+8]] 0000000000000008 R_X86_64_RELATIVE [[#%x,DATA+0x8000000000000000]] + +# RELOC: 00000000000012f4 0 NOTYPE GLOBAL DEFAULT [[#]] _start +# RELOC-NEXT: 00000000000012fe 0 NOTYPE GLOBAL DEFAULT [[#]] foo + +## initial_location fields in FDEs are correctly relocated. +# UNWIND: 00000018 00000010 0000001c FDE cie=00000000 pc=000012f4...000012fe +# UNWIND: 0000002c 00000010 00000030 FDE cie=00000000 pc=000012fe...0000130c + +# RUN: ld.lld -pie --emit-relocs a.o b.o -o out1 +# RUN: llvm-objdump -dr out1 | FileCheck %s --check-prefix=CHECKE +# RUN: llvm-readelf -Sr out1 | FileCheck %s --check-prefix=RELOCE + +# CHECKE: <_start>: +# CHECKE-NEXT: callq {{.*}} +# CHECKE-NEXT: R_X86_64_PLT32 foo-0x4 +# CHECKE-NEXT: callq {{.*}} +# CHECKE-NEXT: R_X86_64_PLT32 .text+0x6 +# CHECKE-EMPTY: +# CHECKE-NEXT: : +# CHECKE-NEXT: leaq {{.*}} +# CHECKE-NEXT: R_X86_64_PC32 .L.str-0x4 +# CHECKE-NEXT: leaq {{.*}} +# CHECKE-NEXT: R_X86_64_PC32 .L.str1-0x4 + +# RELOCE: .rodata PROGBITS {{0*}}[[#%x,RO:]] +# RELOCE: .eh_frame PROGBITS {{0*}}[[#%x,EHFRAME:]] +# RELOCE: .data PROGBITS {{0*}}[[#%x,DATA:]] + +# RELOCE: Relocation section '.crel.data' at offset {{.*}} contains 2 entries: +# RELOCE-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend +# RELOCE-NEXT: {{0*}}[[#DATA+8]] {{.*}} R_X86_64_64 {{.*}} .data - 8000000000000000 +# RELOCE-NEXT: {{0*}}[[#DATA+24]]{{.*}} R_X86_64_64 {{.*}} .data - 1 +# RELOCE: Relocation section '.crel.eh_frame' at offset {{.*}} contains 2 entries: +# RELOCE-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend +# RELOCE-NEXT: {{0*}}[[#EHFRAME+32]] {{.*}} R_X86_64_PC32 {{.*}} .text + 0 +# RELOCE-NEXT: {{0*}}[[#EHFRAME+52]] {{.*}} R_X86_64_PC32 {{.*}} .text + a +# RELOCE: Relocation section '.crel.rodata' at offset {{.*}} contains 4 entries: +# RELOCE-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend +# RELOCE-NEXT: {{0*}}[[#RO+8]] {{.*}} R_X86_64_PC32 {{.*}} foo + 0 +# RELOCE-NEXT: {{0*}}[[#RO+23]] {{.*}} R_X86_64_PC32 {{.*}} foo + 3f +# RELOCE-NEXT: {{0*}}[[#RO+39]] {{.*}} R_X86_64_PC64 {{.*}} foo + 7f +# RELOCE-NEXT: {{0*}}[[#RO+47]] {{.*}} R_X86_64_PC32 {{.*}} _start - 1f81 + +#--- a.s +.global _start, foo +_start: + .cfi_startproc # Test .eh_frame + call foo + call .text.foo + .cfi_endproc + +.section .text.foo,"ax" +foo: + .cfi_startproc + leaq .L.str(%rip), %rsi + leaq .L.str1(%rip), %rsi + .cfi_endproc + +.section .rodata.str1.1,"aMS",@progbits,1 +.L.str: + .asciz "abc" +.L.str1: + .asciz "def" + +.data +.quad 0 +.quad .data - 0x8000000000000000 +.quad 0 +.quad .data - 1 + +#--- b.s +.section .rodata,"a" +.long foo - . +.space 15-4 +.long foo - . + 63 # offset+=15 +.space 16-4 +.quad foo - . + 127 # offset+=16 +.long _start - . - 8065 diff --git a/lld/test/ELF/debug-names.s b/lld/test/ELF/debug-names.s index 888dd9007ed12..1bbb07b065e33 100644 --- a/lld/test/ELF/debug-names.s +++ b/lld/test/ELF/debug-names.s @@ -10,7 +10,7 @@ # REQUIRES: x86 # RUN: rm -rf %t && split-file %s %t && cd %t -# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o +# RUN: llvm-mc -filetype=obj -triple=x86_64 --crel a.s -o a.o # RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o # RUN: ld.lld --debug-names --no-debug-names a.o b.o -o out0 diff --git a/lld/test/ELF/gc-sections.s b/lld/test/ELF/gc-sections.s index 94adc8210b4bc..31e00d495146a 100644 --- a/lld/test/ELF/gc-sections.s +++ b/lld/test/ELF/gc-sections.s @@ -8,6 +8,10 @@ # RUN: ld.lld --export-dynamic --gc-sections %t -o %t2 # RUN: llvm-readobj --sections --symbols %t2 | FileCheck -check-prefix=GC2 %s +# RUN: llvm-mc -filetype=obj -triple=x86_64 --crel %s -o %t.o +# RUN: ld.lld --gc-sections --print-gc-sections %t.o -o %t2 | FileCheck --check-prefix=GC1-DISCARD %s +# RUN: llvm-readobj --sections --symbols %t2 | FileCheck -check-prefix=GC1 %s + # NOGC: Name: .eh_frame # NOGC: Name: .text # NOGC: Name: .init diff --git a/lld/test/ELF/hexagon-eflag.s b/lld/test/ELF/hexagon-eflag.s index 01cb5e5b0f293..dbe8604f69fda 100644 --- a/lld/test/ELF/hexagon-eflag.s +++ b/lld/test/ELF/hexagon-eflag.s @@ -5,3 +5,8 @@ # RUN: llvm-readelf -h %t3 | FileCheck %s # Verify that the largest arch in the input list is selected. # CHECK: Flags: 0x62 + +# RUN: llvm-ar rcsD %t4 +# RUN: ld.lld -m hexagonelf %t4 -o %t5 +# RUN: llvm-readelf -h %t5 | FileCheck --check-prefix=CHECK-EMPTYARCHIVE %s +# CHECK-EMPTYARCHIVE: Flags: 0x60 diff --git a/lld/test/ELF/icf1.s b/lld/test/ELF/icf1.s index 5c6e667d53c78..9682b06f4606f 100644 --- a/lld/test/ELF/icf1.s +++ b/lld/test/ELF/icf1.s @@ -3,6 +3,9 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t # RUN: ld.lld %t -o /dev/null --icf=all --print-icf-sections | FileCheck %s +# RUN: llvm-mc -filetype=obj -triple=x86_64 --crel %s -o %t +# RUN: ld.lld %t -o /dev/null --icf=all --print-icf-sections | FileCheck %s + # CHECK: selected section {{.*}}:(.text.f1) # CHECK: removing identical section {{.*}}:(.text.f2) diff --git a/lld/test/ELF/icf4.s b/lld/test/ELF/icf4.s index ff13a7ebff3da..310577a55c0d8 100644 --- a/lld/test/ELF/icf4.s +++ b/lld/test/ELF/icf4.s @@ -1,6 +1,6 @@ # REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: llvm-mc --crel -filetype=obj -triple=x86_64-unknown-linux %s -o %t # RUN: ld.lld %t -o /dev/null --icf=all --print-icf-sections | count 0 .globl _start, f1, f2 diff --git a/lld/test/ELF/linkerscript/diag.test b/lld/test/ELF/linkerscript/diag.test new file mode 100644 index 0000000000000..fbc24659a5311 --- /dev/null +++ b/lld/test/ELF/linkerscript/diag.test @@ -0,0 +1,49 @@ +# REQUIRES: x86 +# RUN: rm -rf %t && split-file %s %t && cd %t +# RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o 0.o + +#--- 1.lds +SECTIONS { + .text + { *(.text) } + .keep : { *(.keep) } /* + comment line 1 + comment line 2 */ + .temp : { *(.temp) } +} + +# RUN: not ld.lld -shared 0.o -T 1.lds 2>&1 | FileCheck %s --check-prefix=CHECK1 --match-full-lines --strict-whitespace +# CHECK1:{{.*}}:2: malformed number: + +# CHECK1-NEXT:>>> .text + { *(.text) } +# CHECK1-NEXT:>>> ^ + +#--- 2.lds + +UNKNOWN_TAG { + .text : { *(.text) } + .keep : { *(.keep) } + .temp : { *(.temp) } +} + +# RUN: not ld.lld -shared 0.o -T 2.lds 2>&1 | FileCheck %s --check-prefix=CHECK2 --match-full-lines --strict-whitespace +# CHECK2:{{.*}}:2: unknown directive: UNKNOWN_TAG +# CHECK2-NEXT:>>> UNKNOWN_TAG { +# CHECK2-NEXT:>>> ^ + +#--- 3.lds +SECTIONS { + .text : { *(.text) } + .keep : { *(.keep) } + boom ^temp : { *(.temp) } +} +#--- 3a.lds +INCLUDE "3.lds" +#--- 3b.lds +foo = 3; +INCLUDE "3a.lds" + +# RUN: not ld.lld -shared 0.o -T 3.lds 2>&1 | FileCheck %s --check-prefix=CHECK3 --match-full-lines --strict-whitespace +# RUN: not ld.lld -shared 0.o -T 3a.lds 2>&1 | FileCheck %s --check-prefix=CHECK3 --match-full-lines --strict-whitespace +# RUN: not ld.lld -shared 0.o -T 3b.lds 2>&1 | FileCheck %s --check-prefix=CHECK3 --match-full-lines --strict-whitespace +# CHECK3:{{.*}}3.lds:4: malformed number: ^ +# CHECK3-NEXT:>>> boom ^temp : { *(.temp) } +# CHECK3-NEXT:>>> ^ diff --git a/lld/test/ELF/linkerscript/diag1.test b/lld/test/ELF/linkerscript/diag1.test deleted file mode 100644 index 829bc5a1bffaf..0000000000000 --- a/lld/test/ELF/linkerscript/diag1.test +++ /dev/null @@ -1,15 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o -# RUN: not ld.lld -shared %t.o -o /dev/null --script %s 2>&1 | FileCheck -strict-whitespace %s - -SECTIONS { - .text + { *(.text) } - .keep : { *(.keep) } /* - comment line 1 - comment line 2 */ - .temp : { *(.temp) } -} - -CHECK: 6: malformed number: + -CHECK-NEXT: >>> .text + { *(.text) } -CHECK-NEXT: >>> ^ diff --git a/lld/test/ELF/linkerscript/diag2.test b/lld/test/ELF/linkerscript/diag2.test deleted file mode 100644 index aeb623dbb7f4b..0000000000000 --- a/lld/test/ELF/linkerscript/diag2.test +++ /dev/null @@ -1,13 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o -# RUN: not ld.lld -shared %t.o -o /dev/null --script %s 2>&1 | FileCheck -strict-whitespace %s - -UNKNOWN_TAG { - .text : { *(.text) } - .keep : { *(.keep) } - .temp : { *(.temp) } -} - -CHECK: 5: unknown directive: UNKNOWN_TAG -CHECK-NEXT: >>> UNKNOWN_TAG { -CHECK-NEXT: >>> ^ diff --git a/lld/test/ELF/linkerscript/diag3.test b/lld/test/ELF/linkerscript/diag3.test deleted file mode 100644 index 1df8d601db016..0000000000000 --- a/lld/test/ELF/linkerscript/diag3.test +++ /dev/null @@ -1,13 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o -# RUN: not ld.lld -shared %t.o -o /dev/null --script %s 2>&1 | FileCheck -strict-whitespace %s - -SECTIONS { - .text : { *(.text) } - .keep : { *(.keep) } - boom ^temp : { *(.temp) } -} - -# CHECK: 8: malformed number: ^ -# CHECK-NEXT: >>> boom ^temp : { *(.temp) } -# CHECK-NEXT: >>> ^ diff --git a/lld/test/ELF/linkerscript/diag4.test b/lld/test/ELF/linkerscript/diag4.test deleted file mode 100644 index d93a69a95c61d..0000000000000 --- a/lld/test/ELF/linkerscript/diag4.test +++ /dev/null @@ -1,14 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o -# RUN: echo "INCLUDE \"%s\"" > %t.script -# RUN: not ld.lld -shared %t.o -o /dev/null --script %t.script 2>&1 | FileCheck -strict-whitespace %s - -SECTIONS { - .text : { *(.text) } - .keep : { *(.keep) } - boom ^temp : { *(.temp) } -} - -# CHECK: 9: malformed number: ^{{$}} -# CHECK-NEXT: >>> boom ^temp : { *(.temp) } -# CHECK-NEXT: >>> ^ diff --git a/lld/test/ELF/linkerscript/diag5.test b/lld/test/ELF/linkerscript/diag5.test deleted file mode 100644 index 9a2304baa4413..0000000000000 --- a/lld/test/ELF/linkerscript/diag5.test +++ /dev/null @@ -1,14 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o -# RUN: echo "INCLUDE \"%s\"" > %t.script -# RUN: not ld.lld -shared %t.o -o /dev/null --script %t.script 2>&1 | FileCheck -strict-whitespace %s - -SECTIONS { - .text : { *(.text) } - .keep : { *(.keep) } - boom ^temp : { *(.temp) } -} - -# CHECK: 9: malformed number: ^ -# CHECK-NEXT: >>> boom ^temp : { *(.temp) } -# CHECK-NEXT: >>> ^ diff --git a/lld/test/ELF/linkerscript/diag6.test b/lld/test/ELF/linkerscript/diag6.test deleted file mode 100644 index 0ec0400040b54..0000000000000 --- a/lld/test/ELF/linkerscript/diag6.test +++ /dev/null @@ -1,7 +0,0 @@ -# REQUIRES: x86 -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o -# RUN: not ld.lld -shared %t.o -o /dev/null --script %s 2>&1 | FileCheck %s - -SECTIONS /* - -CHECK: error: {{.*}}diag6.test:1: unclosed comment in a linker script diff --git a/lld/test/ELF/invalid-linkerscript.test b/lld/test/ELF/linkerscript/invalid.test similarity index 100% rename from lld/test/ELF/invalid-linkerscript.test rename to lld/test/ELF/linkerscript/invalid.test diff --git a/lld/test/ELF/linkerscript/nocrossrefs.test b/lld/test/ELF/linkerscript/nocrossrefs.test index f13d50a03be87..5eb56190fe63b 100644 --- a/lld/test/ELF/linkerscript/nocrossrefs.test +++ b/lld/test/ELF/linkerscript/nocrossrefs.test @@ -2,6 +2,7 @@ # RUN: rm -rf %t && split-file %s %t && cd %t # RUN: llvm-mc --triple=x86_64 -filetype=obj a.s -o a.o +# RUN: llvm-mc --triple=x86_64 -filetype=obj -crel a.s -o ac.o # RUN: llvm-mc --triple=x86_64 -filetype=obj data.s -o data.o # RUN: ld.lld a.o data.o -T 0.t 2>&1 | FileCheck %s --check-prefix=CHECK0 --implicit-check-not=warning: @@ -9,7 +10,8 @@ # CHECK0-NEXT: warning: 0.t:4: ignored with fewer than 2 output sections # RUN: not ld.lld a.o data.o -T 1.t 2>&1 | FileCheck %s --check-prefix=CHECK1 --implicit-check-not=error: -# CHECK1: error: a.o:(.text.start+0x11): prohibited cross reference from '.text' to 'data' in '.data' +# RUN: not ld.lld ac.o data.o -T 1.t 2>&1 | FileCheck %s --check-prefix=CHECK1 --implicit-check-not=error: +# CHECK1: error: a{{.?}}.o:(.text.start+0x11): prohibited cross reference from '.text' to 'data' in '.data' ## .text and .text1 are in two NOCROSSREFS commands. Violations are reported twice. # RUN: not ld.lld --threads=1 a.o data.o -T 2.t 2>&1 | FileCheck %s --check-prefix=CHECK2 --implicit-check-not=error: diff --git a/lld/test/ELF/linkerscript/unquoted.test b/lld/test/ELF/linkerscript/unquoted.test new file mode 100644 index 0000000000000..7dca75fe09ab1 --- /dev/null +++ b/lld/test/ELF/linkerscript/unquoted.test @@ -0,0 +1,26 @@ +# REQUIRES: x86 +# RUN: rm -rf %t && split-file %s %t && cd %t +# RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o 0.o + +#--- empty.lds +#--- 1.lds + +SECTIONS /* +#--- 1a.lds +foo = 3; +INCLUDE "empty.lds" +INCLUDE "1.lds" + +# RUN: not ld.lld -shared 0.o -T 1.lds 2>&1 | FileCheck %s --check-prefix=CHECK1 --match-full-lines --strict-whitespace +# RUN: not ld.lld -shared 0.o -T 1a.lds 2>&1 | FileCheck %s --check-prefix=CHECK1A --match-full-lines --strict-whitespace +# CHECK1:{{.*}}error: 1.lds:1: unclosed comment in a linker script +# CHECK1A:{{.*}}error: 1a.lds:3: unclosed comment in a linker script +#CHECK1A-NEXT:>>> INCLUDE "1.lds" +#CHECK1A-NEXT:>>> ^ + +#--- 2.lds +INCLUDE "empty.lds" +" +# RUN: not ld.lld -shared 0.o -T 2.lds 2>&1 | FileCheck %s --check-prefix=CHECK2 --match-full-lines --strict-whitespace +# CHECK2:{{.*}}error: 2.lds:2: unclosed quote +# CHECK2-NOT:{{.}} diff --git a/lld/test/ELF/loongarch-tls-gd-pcrel20-s2.s b/lld/test/ELF/loongarch-tls-gd-pcrel20-s2.s new file mode 100644 index 0000000000000..d4d12b9d4a520 --- /dev/null +++ b/lld/test/ELF/loongarch-tls-gd-pcrel20-s2.s @@ -0,0 +1,129 @@ +# REQUIRES: loongarch +# RUN: rm -rf %t && split-file %s %t + +# RUN: llvm-mc --filetype=obj --triple=loongarch32 %t/a.s -o %t/a.32.o +# RUN: llvm-mc --filetype=obj --triple=loongarch32 %t/bc.s -o %t/bc.32.o +# RUN: ld.lld -shared -soname=bc.so %t/bc.32.o -o %t/bc.32.so +# RUN: llvm-mc --filetype=obj --triple=loongarch32 %t/tga.s -o %t/tga.32.o +# RUN: llvm-mc --filetype=obj --triple=loongarch64 %t/a.s -o %t/a.64.o +# RUN: llvm-mc --filetype=obj --triple=loongarch64 %t/bc.s -o %t/bc.64.o +# RUN: ld.lld -shared -soname=bc.so %t/bc.64.o -o %t/bc.64.so +# RUN: llvm-mc --filetype=obj --triple=loongarch64 %t/tga.s -o %t/tga.64.o + +## LA32 GD +# RUN: ld.lld -shared %t/a.32.o %t/bc.32.o -o %t/gd.32.so +# RUN: llvm-readobj -r %t/gd.32.so | FileCheck --check-prefix=GD32-REL %s +# RUN: llvm-objdump -d --no-show-raw-insn %t/gd.32.so | FileCheck --check-prefix=GD32 %s + +## LA32 GD -> LE +# RUN: ld.lld %t/a.32.o %t/bc.32.o %t/tga.32.o -o %t/le.32 +# RUN: llvm-readelf -r %t/le.32 | FileCheck --check-prefix=NOREL %s +# RUN: llvm-readelf -x .got %t/le.32 | FileCheck --check-prefix=LE32-GOT %s +# RUN: ld.lld -pie %t/a.32.o %t/bc.32.o %t/tga.32.o -o %t/le-pie.32 +# RUN: llvm-readelf -r %t/le-pie.32 | FileCheck --check-prefix=NOREL %s +# RUN: llvm-readelf -x .got %t/le-pie.32 | FileCheck --check-prefix=LE32-GOT %s + +## LA32 GD -> IE +# RUN: ld.lld %t/a.32.o %t/bc.32.so %t/tga.32.o -o %t/ie.32 +# RUN: llvm-readobj -r %t/ie.32 | FileCheck --check-prefix=IE32-REL %s +# RUN: llvm-readelf -x .got %t/ie.32 | FileCheck --check-prefix=IE32-GOT %s + +## LA64 GD +# RUN: ld.lld -shared %t/a.64.o %t/bc.64.o -o %t/gd.64.so +# RUN: llvm-readobj -r %t/gd.64.so | FileCheck --check-prefix=GD64-REL %s +# RUN: llvm-objdump -d --no-show-raw-insn %t/gd.64.so | FileCheck --check-prefix=GD64 %s + +## LA64 GD -> LE +# RUN: ld.lld %t/a.64.o %t/bc.64.o %t/tga.64.o -o %t/le.64 +# RUN: llvm-readelf -r %t/le.64 | FileCheck --check-prefix=NOREL %s +# RUN: llvm-readelf -x .got %t/le.64 | FileCheck --check-prefix=LE64-GOT %s +# RUN: ld.lld -pie %t/a.64.o %t/bc.64.o %t/tga.64.o -o %t/le-pie.64 +# RUN: llvm-readelf -r %t/le-pie.64 | FileCheck --check-prefix=NOREL %s +# RUN: llvm-readelf -x .got %t/le-pie.64 | FileCheck --check-prefix=LE64-GOT %s + +## LA64 GD -> IE +# RUN: ld.lld %t/a.64.o %t/bc.64.so %t/tga.64.o -o %t/ie.64 +# RUN: llvm-readobj -r %t/ie.64 | FileCheck --check-prefix=IE64-REL %s +# RUN: llvm-readelf -x .got %t/ie.64 | FileCheck --check-prefix=IE64-GOT %s + +# GD32-REL: .rela.dyn { +# GD32-REL-NEXT: 0x20300 R_LARCH_TLS_DTPMOD32 a 0x0 +# GD32-REL-NEXT: 0x20304 R_LARCH_TLS_DTPREL32 a 0x0 +# GD32-REL-NEXT: 0x20308 R_LARCH_TLS_DTPMOD32 b 0x0 +# GD32-REL-NEXT: 0x2030C R_LARCH_TLS_DTPREL32 b 0x0 +# GD32-REL-NEXT: } + +## &DTPMOD(a) - . = 0x20300 - 0x10250 = 16428<<2 +# GD32: 10250: pcaddi $a0, 16428 +# GD32-NEXT: bl 44 + +## &DTPMOD(b) - . = 0x20308 - 0x10258 = 16428<<2 +# GD32: 10258: pcaddi $a0, 16428 +# GD32-NEXT: bl 36 + +# GD64-REL: .rela.dyn { +# GD64-REL-NEXT: 0x204C0 R_LARCH_TLS_DTPMOD64 a 0x0 +# GD64-REL-NEXT: 0x204C8 R_LARCH_TLS_DTPREL64 a 0x0 +# GD64-REL-NEXT: 0x204D0 R_LARCH_TLS_DTPMOD64 b 0x0 +# GD64-REL-NEXT: 0x204D8 R_LARCH_TLS_DTPREL64 b 0x0 +# GD64-REL-NEXT: } + +## &DTPMOD(a) - . = 0x204c0 - 0x10398 = 16458<<2 +# GD64: 10398: pcaddi $a0, 16458 +# GD64-NEXT: bl 52 + +## &DTPMOD(b) - . = 0x204d0 - 0x103a4 = 16460<<2 +# GD64: 103a0: pcaddi $a0, 16460 +# GD64-NEXT: bl 44 + +# NOREL: no relocations + +## .got contains pre-populated values: [a@dtpmod, a@dtprel, b@dtpmod, b@dtprel] +## a@dtprel = st_value(a) = 0x8 +## b@dtprel = st_value(b) = 0xc +# LE32-GOT: section '.got': +# LE32-GOT-NEXT: 0x[[#%x,A:]] 01000000 08000000 01000000 0c000000 +# LE64-GOT: section '.got': +# LE64-GOT-NEXT: 0x[[#%x,A:]] 01000000 00000000 08000000 00000000 +# LE64-GOT-NEXT: 0x[[#%x,A:]] 01000000 00000000 0c000000 00000000 + +## a is local - relaxed to LE - its DTPMOD/DTPREL slots are link-time constants. +## b is external - DTPMOD/DTPREL dynamic relocations are required. +# IE32-REL: .rela.dyn { +# IE32-REL-NEXT: 0x30220 R_LARCH_TLS_DTPMOD32 b 0x0 +# IE32-REL-NEXT: 0x30224 R_LARCH_TLS_DTPREL32 b 0x0 +# IE32-REL-NEXT: } +# IE32-GOT: section '.got': +# IE32-GOT-NEXT: 0x00030218 01000000 08000000 00000000 00000000 + +# IE64-REL: .rela.dyn { +# IE64-REL-NEXT: 0x30380 R_LARCH_TLS_DTPMOD64 b 0x0 +# IE64-REL-NEXT: 0x30388 R_LARCH_TLS_DTPREL64 b 0x0 +# IE64-REL-NEXT: } +# IE64-GOT: section '.got': +# IE64-GOT-NEXT: 0x00030370 01000000 00000000 08000000 00000000 +# IE64-GOT-NEXT: 0x00030380 00000000 00000000 00000000 00000000 + +#--- a.s +pcaddi $a0, %gd_pcrel_20(a) +bl %plt(__tls_get_addr) + +pcaddi $a0, %gd_pcrel_20(b) +bl %plt(__tls_get_addr) + +.section .tbss,"awT",@nobits +.globl a +.zero 8 +a: +.zero 4 + +#--- bc.s +.section .tbss,"awT",@nobits +.globl b, c +b: +.zero 4 +c: + +#--- tga.s +.globl __tls_get_addr +__tls_get_addr: diff --git a/lld/test/ELF/loongarch-tls-ld-pcrel20-s2.s b/lld/test/ELF/loongarch-tls-ld-pcrel20-s2.s new file mode 100644 index 0000000000000..70186f5538dfc --- /dev/null +++ b/lld/test/ELF/loongarch-tls-ld-pcrel20-s2.s @@ -0,0 +1,82 @@ +# REQUIRES: loongarch +# RUN: rm -rf %t && split-file %s %t + +# RUN: llvm-mc --filetype=obj --triple=loongarch32 --position-independent %t/a.s -o %t/a.32.o +# RUN: llvm-mc --filetype=obj --triple=loongarch32 %t/tga.s -o %t/tga.32.o +# RUN: llvm-mc --filetype=obj --triple=loongarch64 --position-independent %t/a.s -o %t/a.64.o +# RUN: llvm-mc --filetype=obj --triple=loongarch64 %t/tga.s -o %t/tga.64.o + +## LA32 LD +# RUN: ld.lld -shared %t/a.32.o -o %t/ld.32.so +# RUN: llvm-readobj -r %t/ld.32.so | FileCheck --check-prefix=LD32-REL %s +# RUN: llvm-readelf -x .got %t/ld.32.so | FileCheck --check-prefix=LD32-GOT %s +# RUN: llvm-objdump -d --no-show-raw-insn %t/ld.32.so | FileCheck --check-prefixes=LD32 %s + +## LA32 LD -> LE +# RUN: ld.lld %t/a.32.o %t/tga.32.o -o %t/le.32 +# RUN: llvm-readelf -r %t/le.32 | FileCheck --check-prefix=NOREL %s +# RUN: llvm-readelf -x .got %t/le.32 | FileCheck --check-prefix=LE32-GOT %s +# RUN: llvm-objdump -d --no-show-raw-insn %t/le.32 | FileCheck --check-prefixes=LE32 %s + +## LA64 LD +# RUN: ld.lld -shared %t/a.64.o -o %t/ld.64.so +# RUN: llvm-readobj -r %t/ld.64.so | FileCheck --check-prefix=LD64-REL %s +# RUN: llvm-readelf -x .got %t/ld.64.so | FileCheck --check-prefix=LD64-GOT %s +# RUN: llvm-objdump -d --no-show-raw-insn %t/ld.64.so | FileCheck --check-prefixes=LD64 %s + +## LA64 LD -> LE +# RUN: ld.lld %t/a.64.o %t/tga.64.o -o %t/le.64 +# RUN: llvm-readelf -r %t/le.64 | FileCheck --check-prefix=NOREL %s +# RUN: llvm-readelf -x .got %t/le.64 | FileCheck --check-prefix=LE64-GOT %s +# RUN: llvm-objdump -d --no-show-raw-insn %t/le.64 | FileCheck --check-prefixes=LE64 %s + +## a@dtprel = st_value(a) = 0 is a link-time constant. +# LD32-REL: .rela.dyn { +# LD32-REL-NEXT: 0x20280 R_LARCH_TLS_DTPMOD32 - 0x0 +# LD32-REL-NEXT: } +# LD32-GOT: section '.got': +# LD32-GOT-NEXT: 0x00020280 00000000 00000000 + +# LD64-REL: .rela.dyn { +# LD64-REL-NEXT: 0x20400 R_LARCH_TLS_DTPMOD64 - 0x0 +# LD64-REL-NEXT: } +# LD64-GOT: section '.got': +# LD64-GOT-NEXT: 0x00020400 00000000 00000000 00000000 00000000 + +## LA32: &DTPMOD(a) - . = 0x20280 - 0x101cc = 16429<<2 +# LD32: 101cc: pcaddi $a0, 16429 +# LD32-NEXT: bl 48 + +## LA64: &DTPMOD(a) - . = 0x20400 - 0x102e0 = 16456<<2 +# LD64: 102e0: pcaddi $a0, 16456 +# LD64-NEXT: bl 44 + +# NOREL: no relocations + +## a is local - its DTPMOD/DTPREL slots are link-time constants. +## a@dtpmod = 1 (main module) +# LE32-GOT: section '.got': +# LE32-GOT-NEXT: 0x0003011c 01000000 00000000 + +# LE64-GOT: section '.got': +# LE64-GOT-NEXT: 0x000301d0 01000000 00000000 00000000 00000000 + +## LA32: DTPMOD(.LANCHOR0) - . = 0x3011c - 0x20114 = 16386<<2 +# LE32: 20114: pcaddi $a0, 16386 +# LE32-NEXT: bl 4 + +## LA64: DTPMOD(.LANCHOR0) - . = 0x301d0 - 0x201c8 = 16386<<2 +# LE64: 201c8: pcaddi $a0, 16386 +# LE64-NEXT: bl 4 + +#--- a.s +pcaddi $a0, %ld_pcrel_20(.LANCHOR0) +bl %plt(__tls_get_addr) + +.section .tbss,"awT",@nobits +.set .LANCHOR0, . + 0 +.zero 8 + +#--- tga.s +.globl __tls_get_addr +__tls_get_addr: diff --git a/lld/test/ELF/loongarch-tlsdesc-pcrel20-s2.s b/lld/test/ELF/loongarch-tlsdesc-pcrel20-s2.s new file mode 100644 index 0000000000000..99e21d9935197 --- /dev/null +++ b/lld/test/ELF/loongarch-tlsdesc-pcrel20-s2.s @@ -0,0 +1,142 @@ +# REQUIRES: loongarch +# RUN: rm -rf %t && split-file %s %t && cd %t +# RUN: llvm-mc -filetype=obj -triple=loongarch64 a.s -o a.64.o +# RUN: llvm-mc -filetype=obj -triple=loongarch64 c.s -o c.64.o +# RUN: ld.lld -shared -soname=c.64.so c.64.o -o c.64.so +# RUN: llvm-mc -filetype=obj -triple=loongarch32 --defsym ELF32=1 a.s -o a.32.o +# RUN: llvm-mc -filetype=obj -triple=loongarch32 --defsym ELF32=1 c.s -o c.32.o +# RUN: ld.lld -shared -soname=c.32.so c.32.o -o c.32.so + +# RUN: ld.lld -shared -z now a.64.o c.64.o -o a.64.so +# RUN: llvm-readobj -r -x .got a.64.so | FileCheck --check-prefix=GD64-RELA %s +# RUN: llvm-objdump --no-show-raw-insn -h -d a.64.so | FileCheck %s --check-prefix=GD64 + +# RUN: ld.lld -shared -z now a.64.o c.64.o -o rel.64.so -z rel +# RUN: llvm-readobj -r -x .got rel.64.so | FileCheck --check-prefix=GD64-REL %s + +## FIXME: The transition frome TLSDESC to IE/LE has not yet been implemented. +## Keep the dynamic relocations and hand them over to dynamic linker. + +# RUN: ld.lld -e 0 -z now a.64.o c.64.o -o a.64.le +# RUN: llvm-readobj -r -x .got a.64.le | FileCheck --check-prefix=LE64-RELA %s + +# RUN: ld.lld -e 0 -z now a.64.o c.64.so -o a.64.ie +# RUN: llvm-readobj -r -x .got a.64.ie | FileCheck --check-prefix=IE64-RELA %s + +## 32-bit code is mostly the same. We only test a few variants. + +# RUN: ld.lld -shared -z now a.32.o c.32.o -o rel.32.so -z rel +# RUN: llvm-readobj -r -x .got rel.32.so | FileCheck --check-prefix=GD32-REL %s + +# GD64-RELA: .rela.dyn { +# GD64-RELA-NEXT: 0x203F0 R_LARCH_TLS_DESC64 - 0x7FF +# GD64-RELA-NEXT: 0x203D0 R_LARCH_TLS_DESC64 a 0x0 +# GD64-RELA-NEXT: 0x203E0 R_LARCH_TLS_DESC64 c 0x0 +# GD64-RELA-NEXT: } +# GD64-RELA: Hex dump of section '.got': +# GD64-RELA-NEXT: 0x000203d0 00000000 00000000 00000000 00000000 . +# GD64-RELA-NEXT: 0x000203e0 00000000 00000000 00000000 00000000 . +# GD64-RELA-NEXT: 0x000203f0 00000000 00000000 00000000 00000000 . + +# GD64-REL: .rel.dyn { +# GD64-REL-NEXT: 0x203D8 R_LARCH_TLS_DESC64 - +# GD64-REL-NEXT: 0x203B8 R_LARCH_TLS_DESC64 a +# GD64-REL-NEXT: 0x203C8 R_LARCH_TLS_DESC64 c +# GD64-REL-NEXT: } +# GD64-REL: Hex dump of section '.got': +# GD64-REL-NEXT: 0x000203b8 00000000 00000000 00000000 00000000 . +# GD64-REL-NEXT: 0x000203c8 00000000 00000000 00000000 00000000 . +# GD64-REL-NEXT: 0x000203d8 00000000 00000000 ff070000 00000000 . + +# GD64: .got 00000030 00000000000203d0 + +## &.got[a]-. = 0x203d0 - 0x102e0 = 16444<<2 +# GD64: 102e0: pcaddi $a0, 16444 +# GD64-NEXT: ld.d $ra, $a0, 0 +# GD64-NEXT: jirl $ra, $ra, 0 +# GD64-NEXT: add.d $a1, $a0, $tp + +## &.got[b]-. = 0x203d0+32 - 0x102f0 = 16448<<2 +# GD64: 102f0: pcaddi $a0, 16448 +# GD64-NEXT: ld.d $ra, $a0, 0 +# GD64-NEXT: jirl $ra, $ra, 0 +# GD64-NEXT: add.d $a2, $a0, $tp + +## &.got[c]-. = 0x203d0+16 - 0x10300 = 16440<<2 +# GD64: 10300: pcaddi $a0, 16440 +# GD64-NEXT: ld.d $ra, $a0, 0 +# GD64-NEXT: jirl $ra, $ra, 0 +# GD64-NEXT: add.d $a3, $a0, $tp + +# LE64-RELA: .rela.dyn { +# LE64-RELA-NEXT: 0x30240 R_LARCH_TLS_DESC64 - 0x8 +# LE64-RELA-NEXT: 0x30250 R_LARCH_TLS_DESC64 - 0x800 +# LE64-RELA-NEXT: 0x30260 R_LARCH_TLS_DESC64 - 0x7FF +# LE64-RELA-NEXT: } +# LE64-RELA: Hex dump of section '.got': +# LE64-RELA-NEXT: 0x00030240 00000000 00000000 00000000 00000000 . +# LE64-RELA-NEXT: 0x00030250 00000000 00000000 00000000 00000000 . +# LE64-RELA-NEXT: 0x00030260 00000000 00000000 00000000 00000000 . + +# IE64-RELA: .rela.dyn { +# IE64-RELA-NEXT: 0x303C8 R_LARCH_TLS_DESC64 - 0x8 +# IE64-RELA-NEXT: 0x303E8 R_LARCH_TLS_DESC64 - 0x7FF +# IE64-RELA-NEXT: 0x303D8 R_LARCH_TLS_DESC64 c 0x0 +# IE64-RELA-NEXT: } +# IE64-RELA: Hex dump of section '.got': +# IE64-RELA-NEXT: 0x000303c8 00000000 00000000 00000000 00000000 . +# IE64-RELA-NEXT: 0x000303d8 00000000 00000000 00000000 00000000 . +# IE64-RELA-NEXT: 0x000303e8 00000000 00000000 00000000 00000000 . + +# GD32-REL: .rel.dyn { +# GD32-REL-NEXT: 0x20264 R_LARCH_TLS_DESC32 - +# GD32-REL-NEXT: 0x20254 R_LARCH_TLS_DESC32 a +# GD32-REL-NEXT: 0x2025C R_LARCH_TLS_DESC32 c +# GD32-REL-NEXT: } +# GD32-REL: Hex dump of section '.got': +# GD32-REL-NEXT: 0x00020254 00000000 00000000 00000000 00000000 . +# GD32-REL-NEXT: 0x00020264 00000000 ff070000 . + +#--- a.s +.macro add dst, src1, src2 +.ifdef ELF32 +add.w \dst, \src1, \src2 +.else +add.d \dst, \src1, \src2 +.endif +.endm +.macro load dst, src1, src2 +.ifdef ELF32 +ld.w \dst, \src1, \src2 +.else +ld.d \dst, \src1, \src2 +.endif +.endm + +pcaddi $a0, %desc_pcrel_20(a) +load $ra, $a0, %desc_ld(a) +jirl $ra, $ra, %desc_call(a) +add $a1, $a0, $tp + +pcaddi $a0, %desc_pcrel_20(b) +load $ra, $a0, %desc_ld(b) +jirl $ra, $ra, %desc_call(b) +add $a2, $a0, $tp + +pcaddi $a0, %desc_pcrel_20(c) +load $ra, $a0, %desc_ld(c) +jirl $ra, $ra, %desc_call(c) +add $a3, $a0, $tp + +.section .tbss,"awT",@nobits +.globl a +.zero 8 +a: +.zero 2039 ## Place b at 0x7ff +b: +.zero 1 + +#--- c.s +.section .tbss,"awT",@nobits +.globl c +c: .zero 4 diff --git a/lld/test/ELF/relocatable-crel-32.s b/lld/test/ELF/relocatable-crel-32.s new file mode 100644 index 0000000000000..8fbf236d77452 --- /dev/null +++ b/lld/test/ELF/relocatable-crel-32.s @@ -0,0 +1,71 @@ +# REQUIRES: ppc +# RUN: rm -rf %t && split-file %s %t && cd %t +# RUN: llvm-mc -filetype=obj -triple=powerpc -crel a.s -o a.o +# RUN: llvm-mc -filetype=obj -triple=powerpc -crel b.s -o b.o +# RUN: ld.lld -r b.o a.o -o out +# RUN: llvm-readobj -r out | FileCheck %s --check-prefixes=CHECK,CRELFOO + +# RUN: llvm-mc -filetype=obj -triple=powerpc a.s -o a1.o +# RUN: ld.lld -r b.o a1.o -o out1 +# RUN: llvm-readobj -r out1 | FileCheck %s --check-prefixes=CHECK,RELAFOO +# RUN: ld.lld -r a1.o b.o -o out2 +# RUN: llvm-readobj -r out2 | FileCheck %s --check-prefixes=CHECK2 + +# CHECK: Relocations [ +# CHECK-NEXT: Section (2) .crel.text { +# CHECK-NEXT: 0x0 R_PPC_REL24 fb 0x0 +# CHECK-NEXT: 0x4 R_PPC_REL24 foo 0x0 +# CHECK-NEXT: 0x8 R_PPC_REL24 .text.foo 0x0 +# CHECK-NEXT: 0xE R_PPC_ADDR16_HA .rodata.str1.1 0x4 +# CHECK-NEXT: 0x12 R_PPC_ADDR16_LO .rodata.str1.1 0x4 +# CHECK-NEXT: 0x16 R_PPC_ADDR16_HA .rodata.str1.1 0x0 +# CHECK-NEXT: 0x1A R_PPC_ADDR16_LO .rodata.str1.1 0x0 +# CHECK-NEXT: } +# CRELFOO-NEXT: Section (4) .crel.text.foo { +# RELAFOO-NEXT: Section (4) .rela.text.foo { +# CHECK-NEXT: 0x0 R_PPC_REL24 g 0x0 +# CHECK-NEXT: 0x4 R_PPC_REL24 g 0x0 +# CHECK-NEXT: } +# CHECK-NEXT: ] + +# CHECK2: Relocations [ +# CHECK2-NEXT: Section (2) .crel.text { +# CHECK2-NEXT: 0x0 R_PPC_REL24 foo 0x0 +# CHECK2-NEXT: 0x4 R_PPC_REL24 .text.foo 0x0 +# CHECK2-NEXT: 0xA R_PPC_ADDR16_HA .rodata.str1.1 0x4 +# CHECK2-NEXT: 0xE R_PPC_ADDR16_LO .rodata.str1.1 0x4 +# CHECK2-NEXT: 0x12 R_PPC_ADDR16_HA .rodata.str1.1 0x0 +# CHECK2-NEXT: 0x16 R_PPC_ADDR16_LO .rodata.str1.1 0x0 +# CHECK2-NEXT: 0x18 R_PPC_REL24 fb 0x0 +# CHECK2-NEXT: } +# CHECK2-NEXT: Section (4) .rela.text.foo { +# CHECK2-NEXT: 0x0 R_PPC_REL24 g 0x0 +# CHECK2-NEXT: 0x4 R_PPC_REL24 g 0x0 +# CHECK2-NEXT: } +# CHECK2-NEXT: ] + +#--- a.s +.global _start, foo +_start: + bl foo + bl .text.foo + lis 3, .L.str@ha + la 3, .L.str@l(3) + lis 3, .L.str1@ha + la 3, .L.str1@l(3) + +.section .text.foo,"ax" +foo: + bl g + bl g + +.section .rodata.str1.1,"aMS",@progbits,1 +.L.str: + .asciz "abc" +.L.str1: + .asciz "def" + +#--- b.s +.globl fb +fb: + bl fb diff --git a/lld/test/ELF/relocatable-crel.s b/lld/test/ELF/relocatable-crel.s new file mode 100644 index 0000000000000..6e97c3e24d66c --- /dev/null +++ b/lld/test/ELF/relocatable-crel.s @@ -0,0 +1,107 @@ +# REQUIRES: x86 +# RUN: rm -rf %t && split-file %s %t && cd %t +# RUN: llvm-mc -filetype=obj -triple=x86_64 -crel a.s -o a.o +# RUN: llvm-mc -filetype=obj -triple=x86_64 -crel b.s -o b.o +# RUN: ld.lld -r b.o a.o -o out +# RUN: llvm-readobj -r out | FileCheck %s --check-prefixes=CHECK,CRELFOO + +# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a1.o +# RUN: ld.lld -r b.o a1.o -o out1 +# RUN: llvm-readobj -r out1 | FileCheck %s --check-prefixes=CHECK,RELAFOO +# RUN: ld.lld -r a1.o b.o -o out2 +# RUN: llvm-readobj -r out2 | FileCheck %s --check-prefixes=CHECK2 + +# CHECK: Relocations [ +# CHECK-NEXT: .crel.text { +# CHECK-NEXT: 0x1 R_X86_64_PLT32 fb 0xFFFFFFFFFFFFFFFC +# CHECK-NEXT: 0x9 R_X86_64_PLT32 foo 0xFFFFFFFFFFFFFFFC +# CHECK-NEXT: 0xE R_X86_64_PLT32 .text.foo 0xFFFFFFFFFFFFFFFC +# CHECK-NEXT: } +# CHECK-NEXT: .crel.rodata { +# CHECK-NEXT: 0x0 R_X86_64_PC32 foo 0x0 +# CHECK-NEXT: 0xF R_X86_64_PC32 foo 0x3F +# CHECK-NEXT: 0x1F R_X86_64_PC64 foo 0x7F +# CHECK-NEXT: 0x27 R_X86_64_PC32 _start 0xFFFFFFFFFFFFE07F +# CHECK-COUNT-12: R_X86_64_32 _start 0x0 +# CHECK-NEXT: } +# CRELFOO-NEXT: .crel.text.foo { +# RELAFOO-NEXT: .rela.text.foo { +# CHECK-NEXT: 0x3 R_X86_64_PC32 .L.str 0xFFFFFFFFFFFFFFFC +# CHECK-NEXT: 0xA R_X86_64_PC32 .L.str1 0xFFFFFFFFFFFFFFFC +# CHECK-NEXT: 0xF R_X86_64_PLT32 g 0xFFFFFFFFFFFFFFFC +# CHECK-NEXT: 0x14 R_X86_64_PLT32 g 0xFFFFFFFFFFFFFFFC +# CHECK-NEXT: } +# CRELFOO-NEXT: .crel.data { +# RELAFOO-NEXT: .rela.data { +# CHECK-NEXT: 0x8 R_X86_64_64 _start 0x8000000000000000 +# CHECK-NEXT: 0x18 R_X86_64_64 _start 0xFFFFFFFFFFFFFFFF +# CHECK-NEXT: } +# CHECK-NEXT: ] + +# CHECK2: Relocations [ +# CHECK2-NEXT: .crel.text { +# CHECK2-NEXT: 0x1 R_X86_64_PLT32 foo 0xFFFFFFFFFFFFFFFC +# CHECK2-NEXT: 0x6 R_X86_64_PLT32 .text.foo 0xFFFFFFFFFFFFFFFC +# CHECK2-NEXT: 0xD R_X86_64_PLT32 fb 0xFFFFFFFFFFFFFFFC +# CHECK2-NEXT: } +# CHECK2-NEXT: .rela.text.foo { +# CHECK2-NEXT: 0x3 R_X86_64_PC32 .L.str 0xFFFFFFFFFFFFFFFC +# CHECK2-NEXT: 0xA R_X86_64_PC32 .L.str1 0xFFFFFFFFFFFFFFFC +# CHECK2-NEXT: 0xF R_X86_64_PLT32 g 0xFFFFFFFFFFFFFFFC +# CHECK2-NEXT: 0x14 R_X86_64_PLT32 g 0xFFFFFFFFFFFFFFFC +# CHECK2-NEXT: } +# CHECK2-NEXT: .rela.data { +# CHECK2-NEXT: 0x8 R_X86_64_64 _start 0x8000000000000000 +# CHECK2-NEXT: 0x18 R_X86_64_64 _start 0xFFFFFFFFFFFFFFFF +# CHECK2-NEXT: } +# CHECK2-NEXT: .crel.rodata { +# CHECK2-NEXT: 0x0 R_X86_64_PC32 foo 0x0 +# CHECK2-NEXT: 0xF R_X86_64_PC32 foo 0x3F +# CHECK2-NEXT: 0x1F R_X86_64_PC64 foo 0x7F +# CHECK2-NEXT: 0x27 R_X86_64_PC32 _start 0xFFFFFFFFFFFFE07F +# CHECK2-COUNT-12: R_X86_64_32 _start 0x0 +# CHECK2-NEXT: } +# CHECK2-NEXT: ] + +#--- a.s +.global _start, foo +_start: + call foo + call .text.foo + +.section .text.foo,"ax" +foo: + leaq .L.str(%rip), %rsi + leaq .L.str1(%rip), %rsi + call g + call g + +.section .rodata.str1.1,"aMS",@progbits,1 +.L.str: + .asciz "abc" +.L.str1: + .asciz "def" + +.data +.quad 0 +.quad _start - 0x8000000000000000 +.quad 0 +.quad _start - 1 + +#--- b.s +.globl fb +fb: + call fb + +.section .rodata,"a" +.long foo - . +.space 15-4 +.long foo - . + 63 # offset+=15 +.space 16-4 +.quad foo - . + 127 # offset+=16 +.long _start - . - 8065 + +## Ensure .crel.rodata contains 16 relocations so that getULEB128Size(crelHeader) > 1. +.rept 12 +.long _start +.endr diff --git a/lld/test/MachO/objc-category-merging-minimal.s b/lld/test/MachO/objc-category-merging-minimal.s index 527493303c583..b94799a57a4d8 100644 --- a/lld/test/MachO/objc-category-merging-minimal.s +++ b/lld/test/MachO/objc-category-merging-minimal.s @@ -9,7 +9,7 @@ ## Create our main testing dylib - linking against the fake dylib above # RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos -o merge_cat_minimal.o merge_cat_minimal.s # RUN: %lld -arch arm64 -dylib -o merge_cat_minimal_no_merge.dylib a64_fakedylib.dylib merge_cat_minimal.o -# RUN: %lld -arch arm64 -dylib -o merge_cat_minimal_merge.dylib -objc_category_merging a64_fakedylib.dylib merge_cat_minimal.o +# RUN: %lld -objc_relative_method_lists -arch arm64 -dylib -o merge_cat_minimal_merge.dylib -objc_category_merging a64_fakedylib.dylib merge_cat_minimal.o ## Now verify that the flag caused category merging to happen appropriatelly # RUN: llvm-objdump --objc-meta-data --macho merge_cat_minimal_no_merge.dylib | FileCheck %s --check-prefixes=NO_MERGE_CATS @@ -17,7 +17,7 @@ ############ Test merging multiple categories into the base class ############ # RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos -o merge_base_class_minimal.o merge_base_class_minimal.s -# RUN: %lld -arch arm64 -dylib -o merge_base_class_minimal_yes_merge.dylib -objc_category_merging merge_base_class_minimal.o merge_cat_minimal.o +# RUN: %lld -arch arm64 -dylib -objc_relative_method_lists -o merge_base_class_minimal_yes_merge.dylib -objc_category_merging merge_base_class_minimal.o merge_cat_minimal.o # RUN: %lld -arch arm64 -dylib -o merge_base_class_minimal_no_merge.dylib merge_base_class_minimal.o merge_cat_minimal.o # RUN: llvm-objdump --objc-meta-data --macho merge_base_class_minimal_no_merge.dylib | FileCheck %s --check-prefixes=NO_MERGE_INTO_BASE @@ -37,14 +37,14 @@ MERGE_CATS-NOT: __OBJC_$_CATEGORY_MyBaseClass_$_Category02 MERGE_CATS: __OBJC_$_CATEGORY_MyBaseClass(Category01|Category02) MERGE_CATS-NEXT: name {{.*}} Category01|Category02 MERGE_CATS: instanceMethods -MERGE_CATS-NEXT: 24 -MERGE_CATS-NEXT: 2 +MERGE_CATS-NEXT: entsize 12 (relative) +MERGE_CATS-NEXT: count 2 MERGE_CATS-NEXT: name {{.*}} cat01_InstanceMethod MERGE_CATS-NEXT: types {{.*}} v16@0:8 -MERGE_CATS-NEXT: imp -[MyBaseClass(Category01) cat01_InstanceMethod] +MERGE_CATS-NEXT: imp {{.*}} -[MyBaseClass(Category01) cat01_InstanceMethod] MERGE_CATS-NEXT: name {{.*}} cat02_InstanceMethod MERGE_CATS-NEXT: types {{.*}} v16@0:8 -MERGE_CATS-NEXT: imp -[MyBaseClass(Category02) cat02_InstanceMethod] +MERGE_CATS-NEXT: imp {{.*}} -[MyBaseClass(Category02) cat02_InstanceMethod] MERGE_CATS-NEXT: classMethods 0x0 MERGE_CATS-NEXT: protocols 0x0 MERGE_CATS-NEXT: instanceProperties 0x0 @@ -69,17 +69,17 @@ YES_MERGE_INTO_BASE-NOT: __OBJC_$_CATEGORY_MyBaseClass_$_Category02 YES_MERGE_INTO_BASE: _OBJC_CLASS_$_MyBaseClass YES_MERGE_INTO_BASE-NEXT: _OBJC_METACLASS_$_MyBaseClass YES_MERGE_INTO_BASE: baseMethods -YES_MERGE_INTO_BASE-NEXT: entsize 24 +YES_MERGE_INTO_BASE-NEXT: entsize 12 (relative) YES_MERGE_INTO_BASE-NEXT: count 3 YES_MERGE_INTO_BASE-NEXT: name {{.*}} cat01_InstanceMethod YES_MERGE_INTO_BASE-NEXT: types {{.*}} v16@0:8 -YES_MERGE_INTO_BASE-NEXT: imp -[MyBaseClass(Category01) cat01_InstanceMethod] +YES_MERGE_INTO_BASE-NEXT: imp {{.*}} -[MyBaseClass(Category01) cat01_InstanceMethod] YES_MERGE_INTO_BASE-NEXT: name {{.*}} cat02_InstanceMethod YES_MERGE_INTO_BASE-NEXT: types {{.*}} v16@0:8 -YES_MERGE_INTO_BASE-NEXT: imp -[MyBaseClass(Category02) cat02_InstanceMethod] +YES_MERGE_INTO_BASE-NEXT: imp {{.*}} -[MyBaseClass(Category02) cat02_InstanceMethod] YES_MERGE_INTO_BASE-NEXT: name {{.*}} baseInstanceMethod YES_MERGE_INTO_BASE-NEXT: types {{.*}} v16@0:8 -YES_MERGE_INTO_BASE-NEXT: imp -[MyBaseClass baseInstanceMethod] +YES_MERGE_INTO_BASE-NEXT: imp {{.*}} -[MyBaseClass baseInstanceMethod] #### Check merge swift category into base class ### diff --git a/lld/test/MinGW/driver.test b/lld/test/MinGW/driver.test index cbccd09793c2f..0dab66b613c77 100644 --- a/lld/test/MinGW/driver.test +++ b/lld/test/MinGW/driver.test @@ -446,3 +446,9 @@ RUN: ld.lld -### foo.o -m i386pep --build-id=none 2>&1 | FileCheck -check-prefix RUN: ld.lld -### foo.o -m i386pep -s 2>&1 | FileCheck -check-prefix=NO_BUILD_ID %s RUN: ld.lld -### foo.o -m i386pep -S 2>&1 | FileCheck -check-prefix=NO_BUILD_ID %s NO_BUILD_ID: -build-id:no + +RUN: ld.lld -### foo.o -m i386pep -rpath foo 2>&1 | FileCheck -check-prefix=WARN_RPATH %s +RUN: ld.lld -### foo.o -m i386pep --rpath foo 2>&1 | FileCheck -check-prefix=WARN_RPATH %s +RUN: ld.lld -### foo.o -m i386pep -rpath=foo 2>&1 | FileCheck -check-prefix=WARN_RPATH %s +RUN: ld.lld -### foo.o -m i386pep --rpath=foo 2>&1 | FileCheck -check-prefix=WARN_RPATH %s +WARN_RPATH: warning: parameter -{{-?}}rpath has no effect on PE/COFF targets diff --git a/lld/test/wasm/archive-local-sym.s b/lld/test/wasm/archive-local-sym.s new file mode 100644 index 0000000000000..53e95b9bbb105 --- /dev/null +++ b/lld/test/wasm/archive-local-sym.s @@ -0,0 +1,24 @@ +## Test that local symbols in archive files are ignored. +# RUN: split-file %s %t +# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t/foo.o %t/foo.s +# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t/main.o %t/main.s +# RUN: rm -f %t/libfoo.a +# RUN: llvm-ar rcs %t/libfoo.a %t/foo.o +# RUN: not wasm-ld %t/libfoo.a %t/main.o -o out.wasm 2>&1 | FileCheck %s + +#--- main.s + +.functype foo () -> () + +.globl _start +_start: + .functype _start () -> () + call foo +# CHECK: main.o: undefined symbol: foo + end_function + +#--- foo.s + +foo: + .functype foo () -> () + end_function diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp index f3f0ef9a99497..3b5a0f3681c9e 100644 --- a/lld/wasm/InputFiles.cpp +++ b/lld/wasm/InputFiles.cpp @@ -392,7 +392,7 @@ void ObjFile::parseLazy() { << wasmObj.get() << "\n"); for (const SymbolRef &sym : wasmObj->symbols()) { const WasmSymbol &wasmSym = wasmObj->getWasmSymbol(sym.getRawDataRefImpl()); - if (!wasmSym.isDefined()) + if (wasmSym.isUndefined() || wasmSym.isBindingLocal()) continue; symtab->addLazy(wasmSym.Info.Name, this); // addLazy() may trigger this->extract() if an existing symbol is an diff --git a/lldb/include/lldb/API/SBSaveCoreOptions.h b/lldb/include/lldb/API/SBSaveCoreOptions.h index e77496bd3a4a0..75506fd752e76 100644 --- a/lldb/include/lldb/API/SBSaveCoreOptions.h +++ b/lldb/include/lldb/API/SBSaveCoreOptions.h @@ -17,7 +17,7 @@ class LLDB_API SBSaveCoreOptions { public: SBSaveCoreOptions(); SBSaveCoreOptions(const lldb::SBSaveCoreOptions &rhs); - ~SBSaveCoreOptions() = default; + ~SBSaveCoreOptions(); const SBSaveCoreOptions &operator=(const lldb::SBSaveCoreOptions &rhs); diff --git a/lldb/include/lldb/Utility/AddressableBits.h b/lldb/include/lldb/Utility/AddressableBits.h index 0d27c3561ec27..8c7a1ec5f52c0 100644 --- a/lldb/include/lldb/Utility/AddressableBits.h +++ b/lldb/include/lldb/Utility/AddressableBits.h @@ -12,6 +12,8 @@ #include "lldb/lldb-forward.h" #include "lldb/lldb-public.h" +#include + namespace lldb_private { /// \class AddressableBits AddressableBits.h "lldb/Core/AddressableBits.h" diff --git a/lldb/source/API/SBSaveCoreOptions.cpp b/lldb/source/API/SBSaveCoreOptions.cpp index 6c3f74596203d..19ca83f932bcf 100644 --- a/lldb/source/API/SBSaveCoreOptions.cpp +++ b/lldb/source/API/SBSaveCoreOptions.cpp @@ -29,6 +29,8 @@ SBSaveCoreOptions::SBSaveCoreOptions(const SBSaveCoreOptions &rhs) { m_opaque_up = clone(rhs.m_opaque_up); } +SBSaveCoreOptions::~SBSaveCoreOptions() = default; + const SBSaveCoreOptions & SBSaveCoreOptions::operator=(const SBSaveCoreOptions &rhs) { LLDB_INSTRUMENT_VA(this, rhs); diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm.h b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm.h index 89ffa617294aa..b9537e6952f6c 100644 --- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm.h +++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm.h @@ -30,7 +30,7 @@ class NativeProcessFreeBSD; class NativeRegisterContextFreeBSD_arm : public NativeRegisterContextFreeBSD { public: NativeRegisterContextFreeBSD_arm(const ArchSpec &target_arch, - NativeThreadProtocol &native_thread); + NativeThreadFreeBSD &native_thread); uint32_t GetRegisterSetCount() const override; diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.h b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.h index 0b4a508a7d5dd..286b4fd8d8b99 100644 --- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.h +++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_mips64.h @@ -31,7 +31,7 @@ class NativeRegisterContextFreeBSD_mips64 : public NativeRegisterContextFreeBSD { public: NativeRegisterContextFreeBSD_mips64(const ArchSpec &target_arch, - NativeThreadProtocol &native_thread); + NativeThreadFreeBSD &native_thread); uint32_t GetRegisterSetCount() const override; diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.h b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.h index 3df371036f915..420db822acc0f 100644 --- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.h +++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_powerpc.h @@ -31,7 +31,7 @@ class NativeRegisterContextFreeBSD_powerpc : public NativeRegisterContextFreeBSD { public: NativeRegisterContextFreeBSD_powerpc(const ArchSpec &target_arch, - NativeThreadProtocol &native_thread); + NativeThreadFreeBSD &native_thread); uint32_t GetRegisterSetCount() const override; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 85c59a605c675..ac769ad9fbd52 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -269,8 +269,15 @@ static void PrepareContextToReceiveMembers(TypeSystemClang &ast, } // We don't have a type definition and/or the import failed, but we need to - // add members to it. Start the definition to make that possible. - tag_decl_ctx->startDefinition(); + // add members to it. Start the definition to make that possible. If the type + // has no external storage we also have to complete the definition. Otherwise, + // that will happen when we are asked to complete the type + // (CompleteTypeFromDWARF). + ast.StartTagDeclarationDefinition(type); + if (!tag_decl_ctx->hasExternalLexicalStorage()) { + ast.SetDeclIsForcefullyCompleted(tag_decl_ctx); + ast.CompleteTagDeclarationDefinition(type); + } } ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE &die) { diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/typedef-in-incomplete-type.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/typedef-in-incomplete-type.cpp new file mode 100644 index 0000000000000..591607784b0a9 --- /dev/null +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/typedef-in-incomplete-type.cpp @@ -0,0 +1,23 @@ +// RUN: %clangxx --target=x86_64-pc-linux -flimit-debug-info -o %t -c %s -g +// RUN: %lldb %t -o "target var a" -o "expr -- var" -o exit | FileCheck %s + +// This forces lldb to attempt to complete the type A. Since it has no +// definition it will fail. +// CHECK: target var a +// CHECK: (A) a = + +// Now attempt to display the second variable, which will try to add a typedef +// to the incomplete type. Make sure that succeeds. Use the expression command +// to make sure the resulting AST can be imported correctly. +// CHECK: expr -- var +// CHECK: (A::X) $0 = 0 + +struct A { + // Declare the constructor, but don't define it to avoid emitting the + // definition in the debug info. + A(); + using X = int; +}; + +A a; +A::X var; diff --git a/lldb/tools/lldb-dap/.npmrc b/lldb/tools/lldb-dap/.npmrc new file mode 100644 index 0000000000000..33312472ae5bf --- /dev/null +++ b/lldb/tools/lldb-dap/.npmrc @@ -0,0 +1 @@ +registry=https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/ \ No newline at end of file diff --git a/llvm.proj b/llvm.proj new file mode 100644 index 0000000000000..d8d4ca51a6657 --- /dev/null +++ b/llvm.proj @@ -0,0 +1,274 @@ + + + + + + Unix Makefiles + Ninja + <_VCVarsScriptName Condition="'$(BuildOS)' == 'Windows_NT'">vcvars64.bat + <_VCVarsScriptName Condition="'$(BuildOS)' == 'Windows_NT' and '$(TargetArchitecture)' == 'arm64'">vcvarsamd64_arm64.bat + <_SetupEnvironment Condition="'$(BuildOS)' == 'Windows_NT'"> + :: VisualStudio includes vswhere.exe that can be used to locate current VisualStudio installation. + set VSWHERE_TOOLS_BIN=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe + set VS_VCINSTALL_DIR= + + :: Try to locate installed VisualStudio VC environment. + if "%VCINSTALLDIR%" == "" if exist "%VSWHERE_TOOLS_BIN%" ( + for /f "tokens=*" %%a in ('"%VSWHERE_TOOLS_BIN%" -latest -prerelease -property installationPath') do ( + set VS_VCINSTALL_DIR=%%a\VC\ + ) + ) + + if NOT "%VCINSTALLDIR%" == "" set VS_VCINSTALL_DIR=%VCINSTALLDIR% + + :: Run VS build environment script. + call "%VS_VCINSTALL_DIR%\Auxiliary\Build\$(_VCVarsScriptName)" + + + <_CMakeConfigureCommand>$(_SetupEnvironment) cmake $(_LLVMSourceDir) -G "$(CMakeGenerator)" @(_LLVMBuildArgs->'%(Identity)',' ') + <_LibCxxConfigureCommand>$(_SetupEnvironment) cmake $(_LibCxxSourceDir) -G "$(CMakeGenerator)" @(_LibCxxBuildArgs->'%(Identity)',' ') + <_BuildSubset Condition="'$(BuildLLVMTableGenOnly)' == 'true'">llvm-tblgen clang-tblgen llvm-config clang-tidy-confusable-chars-gen clang-pseudo-gen + <_BuildSubset Condition="'$(BuildJitToolsOnly)' == 'true'">llvm-mca llvm-dwarfdump FileCheck + <_BuildCommand Condition="'$(CMakeGenerator)' == 'Unix Makefiles'">$(_SetupEnvironment) make $(_BuildSubset) -j$([System.Environment]::ProcessorCount) + <_BuildCommand Condition="'$(CMakeGenerator)' == 'Ninja'">$(_SetupEnvironment) ninja $(_BuildSubset) + <_CMakeInstallCommand Condition="'$(BuildJitToolsOnly)' == 'true'"> + $(_SetupEnvironment) + + cmake -DCMAKE_INSTALL_DO_STRIP=1 -DCMAKE_INSTALL_PREFIX=$(_LLVMInstallDir) -DCMAKE_INSTALL_COMPONENT=llvm-mca -P cmake_install.cmake + cmake -DCMAKE_INSTALL_DO_STRIP=1 -DCMAKE_INSTALL_PREFIX=$(_LLVMInstallDir) -DCMAKE_INSTALL_COMPONENT=llvm-dwarfdump -P cmake_install.cmake + cmake -DCMAKE_INSTALL_DO_STRIP=1 -DCMAKE_INSTALL_PREFIX=$(_LLVMInstallDir) -DCMAKE_INSTALL_COMPONENT=FileCheck -P cmake_install.cmake + + <_CMakeInstallCommand Condition="'$(BuildJitToolsOnly)' != 'true'">$(_SetupEnvironment) cmake -DCMAKE_INSTALL_DO_STRIP=1 -DCMAKE_INSTALL_PREFIX=$(_LLVMInstallDir) -P cmake_install.cmake + <_CrossBuild>false + <_CrossBuild Condition="'$(ClangTarget)' != ''">true + <_hostArch>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant) + <_CrossBuild Condition="'$(BuildOS)' == 'Windows_NT' and '$(TargetArchitecture)' != '$(_hostArch)'">true + + + + <_CrossCFlags Condition="'$(_CrossBuild)' == 'true'">--target=$(ClangTarget) + <_CrossCFlags Condition="'$(_CrossBuild)' == 'true' and '$(BuildOS)' == 'Linux'">$(_CrossCFlags) --sysroot=$(ROOTFS_DIR) --gcc-toolchain=$(ROOTFS_DIR)/usr + <_CFlags>$(_CrossCFlags) + <_SharedLinkerFlags>$(_CFlags) + <_SharedLinkerFlags Condition="'$(BuildOS)' == 'Linux'">-Wl,--build-id -Wl,-rpath,'%5C%24ORIGIN' -fuse-ld=lld $(_SharedLinkerFlags) + /usr/bin + + + + <_CFlags>$(_CFlags) /guard:cf + <_SharedLinkerFlags>/guard:cf + + + + <_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm64'" Include="-DLLVM_TARGET_ARCH=AARCH64" /> + <_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm'" Include="-DLLVM_TARGET_ARCH=ARM" /> + <_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'x64'" Include="-DLLVM_TARGET_ARCH=X86_64" /> + + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'Windows_NT'" Include="-DCMAKE_SYSTEM_NAME=Windows" /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'Linux'" Include="-DCMAKE_SYSTEM_NAME=Linux" /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'OSX'" Include="-DCMAKE_SYSTEM_NAME=Darwin" /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'Linux'" Include='-DCROSS_TOOLCHAIN_FLAGS_LLVM_NATIVE="-DCMAKE_EXE_LINKER_FLAGS_INIT=-fuse-ld=lld;-DCMAKE_SHARED_LINKER_FLAGS_INIT=-fuse-ld=lld"' /> + + + + <_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm64' and '$(BuildOS)' == 'Windows_NT'" Include="-DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-windows-msvc" /> + <_LLVMBuildArgs Condition="'$(ClangTarget)' != '' and '$(BuildOS)' == 'Linux'" Include="-DLLVM_DEFAULT_TARGET_TRIPLE=$(ClangTarget)" /> + <_LLVMBuildArgs Condition="'$(ClangTarget)' != '' and '$(BuildOS)' == 'Linux'" Include="-DCMAKE_OBJCOPY=$(ClangBinDir)/llvm-objcopy" /> + <_LLVMBuildArgs Condition="'$(ClangTarget)' != '' and '$(BuildOS)' == 'Linux'" Include="-DCMAKE_STRIP=$(ClangBinDir)/llvm-strip" /> + <_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'x64' and '$(BuildOS)' == 'OSX'" Include="-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-apple-darwin" /> + <_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'x64' and '$(BuildOS)' == 'OSX'" Include="-DCMAKE_OSX_ARCHITECTURES=x86_64"/> + <_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm64' and '$(BuildOS)' == 'OSX'" Include="-DLLVM_DEFAULT_TARGET_TRIPLE=arm64-apple-darwin" /> + <_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm64' and '$(BuildOS)' == 'OSX'" Include="-DCMAKE_OSX_ARCHITECTURES=arm64"/> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'Linux'" Include="-DCMAKE_SYSTEM_NAME=Linux" /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'OSX'" Include="-DCMAKE_SYSTEM_NAME=Darwin" /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'FreeBSD'" Include="-DCMAKE_SYSTEM_NAME=FreeBSD" /> + <_LLVMBuildArgs Include="-DCMAKE_BUILD_TYPE=$(Configuration)" Condition="'$(BuildOS)' != 'Windows_NT'" /> + <_LLVMBuildArgs Include="-DCMAKE_BUILD_TYPE=Release" Condition="'$(BuildOS)' == 'Windows_NT'" /> + <_LLVMBuildArgs Include="-DLLVM_BUILD_LLVM_C_DYLIB=OFF" /> + <_LLVMBuildArgs Include="-DLLVM_ENABLE_DIA_SDK=OFF" /> + <_LLVMBuildArgs Include="-DLLVM_INCLUDE_TESTS=OFF" /> + <_LLVMBuildArgs Include="-DLLVM_INCLUDE_BENCHMARKS=OFF" /> + <_LLVMBuildArgs Include='-DLLVM_TARGETS_TO_BUILD="X86%3BAArch64%3BARM%3BWebAssembly"' /> + <_LLVMBuildArgs Include='-DLLVM_BUILD_TESTS=OFF' /> + <_LLVMBuildArgs Include='-DLLVM_BUILD_EXAMPLES=OFF' /> + <_LLVMBuildArgs Include='-DLLVM_INCLUDE_EXAMPLES=OFF' /> + <_LLVMBuildArgs Include='-DLLVM_INSTALL_BINUTILS_SYMLINKS=TRUE' /> + <_LLVMBuildArgs Include='-DLLVM_ENABLE_LIBXML2=OFF' /> + <_LLVMBuildArgs Include='-DLLVM_ENABLE_TERMINFO=OFF' /> + <_LLVMBuildArgs Include='-DLLVM_ENABLE_ZSTD=OFF' /> + <_LLVMBuildArgs Include='-DLLVM_EXTERNALIZE_DEBUGINFO=ON' /> + <_LLVMBuildArgs Include='-DLLVM_EXTERNALIZE_DEBUGINFO_INSTALL=ON' /> + <_LLVMBuildArgs Include='-DCOMPILER_RT_USE_LLVM_UNWINDER=OFF' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'Windows_NT'" Include='-DLLVM_ENABLE_PDB=ON' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'Windows_NT'" Include='-DLEGAL_COPYRIGHT="\xa9 Microsoft Corporation. All rights reserved."' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'Linux'" Include='-DLLVM_EXTERNALIZE_DEBUGINFO_EXTENSION=dbg' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'OSX'" Include='-DLLVM_EXTERNALIZE_DEBUGINFO_EXTENSION=dwarf -DLLVM_EXTERNALIZE_DEBUGINFO_FLATTEN=ON' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'FreeBSD'" Include='-DLLVM_EXTERNALIZE_DEBUGINFO_EXTENSION=dbg' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'Windows_NT' and '$(Configuration)' == 'Release'" Include='-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'Windows_NT' and '$(Configuration)' == 'Debug'" Include='-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'Windows_NT'" Include='-DLLVM_NATIVE_TOOL_DIR=$(NativeTablegenDir)' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' != 'Windows_NT'" Include='-DLLVM_ENABLE_ZLIB=FORCE_ON' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' != 'Windows_NT' and '$(LibsRoot)' != ''" Include='-DZLIB_ROOT=$(LibsRoot)' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'Windows_NT'" Include='-DLLVM_ENABLE_ZLIB=OFF' /> + <_LLVMBuildArgs Include='-DLLVM_ENABLE_PROJECTS="lld%3Bclang%3Bclang-tools-extra"' /> + <_LLVMBuildArgs Include='-DLLVM_BUILD_TOOLS:BOOL=ON' /> + <_LLVMBuildArgs Include='-DLLVM_INSTALL_UTILS:BOOL=ON' /> + <_LLVMBuildArgs Include="-DLLVM_INCLUDE_UTILS:BOOL=ON" /> + <_LLVMBuildArgs Include='-DCLANG_INCLUDE_TESTS=OFF' /> + <_LLVMBuildArgs Include='-DCLANG_ENABLE_ARCMT=OFF' /> + <_LLVMBuildArgs Include='-DCLANG_ENABLE_STATIC_ANALYZER=OFF' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'Linux'" Include='-DCMAKE_POSITION_INDEPENDENT_CODE=ON' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'Linux'" Include='-DCROSS_TOOLCHAIN_FLAGS_LLVM_NATIVE="-DCMAKE_C_COMPILER=clang%3B-DCMAKE_CXX_COMPILER=clang++%3B-DCMAKE_ASM_COMPILER=clang%3B-DCMAKE_EXE_LINKER_FLAGS_INIT=-fuse-ld=lld%3B-DCMAKE_SHARED_LINKER_FLAGS_INIT=-fuse-ld=lld"' /> + + + + <_LLVMBuildArgs Include="-DCMAKE_C_COMPILER=clang" /> + <_LLVMBuildArgs Include="-DCMAKE_CXX_COMPILER=clang++" /> + <_LLVMBuildArgs Include="-DCMAKE_ASM_COMPILER=clang" /> + + + + <_LibCxxCFlags>-I$(_LibCxxInstallDir)/include/c++/v1 -nostdinc++ -nostdlib++ + <_LibCxxLinkerFlags>-L$(_LibCxxInstallDir)/lib -nostdlib++ -lc++ -lc++abi + + + <_CMakeExtraCFlags>-DNDEBUG + + + + <_LLVMBuildArgs Include='-DCMAKE_C_FLAGS="-I../llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CMakeExtraCFlags) -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CFlags)"' /> + <_LLVMBuildArgs Include='-DCMAKE_CXX_FLAGS="-I../llvm/include $(_LibCxxCFlags) -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CMakeExtraCFlags) -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CFlags) "' /> + <_LLVMBuildArgs Include='-DCMAKE_ASM_FLAGS="-I../llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CMakeExtraCFlags) -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CFlags) "' /> + <_LLVMBuildArgs Include='-DCMAKE_EXE_LINKER_FLAGS_INIT="$(_SharedLinkerFlags) $(_LibCxxLinkerFlags)"' /> + <_LLVMBuildArgs Include='-DCMAKE_SHARED_LINKER_FLAGS_INIT="$(_SharedLinkerFlags) $(_LibCxxLinkerFlags)"' /> + <_LLVMBuildArgs Include='-DCMAKE_MODULE_LINKER_FLAGS_INIT="$(_SharedLinkerFlags) $(_LibCxxLinkerFlags)"' /> + <_LLVMBuildArgs Condition="'$(BuildOS)' == 'OSX'" Include='-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0' /> + + + + <_LLVMBuildArgs Include='-DCMAKE_C_FLAGS="$(_CFlags) "' /> + <_LLVMBuildArgs Include='-DCMAKE_CXX_FLAGS="$(_CFlags) "' /> + <_LLVMBuildArgs Include='-DCMAKE_EXE_LINKER_FLAGS_INIT="$(_SharedLinkerFlags)" ' /> + <_LLVMBuildArgs Include='-DCMAKE_SHARED_LINKER_FLAGS_INIT="$(_SharedLinkerFlags)" ' /> + <_LLVMBuildArgs Include='-DCMAKE_MODULE_LINKER_FLAGS_INIT="$(_SharedLinkerFlags)" ' /> + + + + + + + + + + <_LibCxxBuildArgs Include='-DLLVM_ENABLE_RUNTIMES="libcxx%3Blibcxxabi%3Blibunwind"' /> + <_LibCxxBuildArgs Include="-DCMAKE_C_COMPILER=clang" /> + <_LibCxxBuildArgs Include="-DCMAKE_CXX_COMPILER=clang++" /> + <_LibCxxBuildArgs Include="-DCMAKE_ASM_COMPILER=clang" /> + <_LibCxxBuildArgs Include='-DCMAKE_C_FLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CMakeExtraCFlags) -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CFlags)"' /> + <_LibCxxBuildArgs Include='-DCMAKE_CXX_FLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CMakeExtraCFlags) -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CFlags)"' /> + <_LibCxxBuildArgs Include='-DCMAKE_ASM_FLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CMakeExtraCFlags) -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CFlags)"' /> + <_LibCxxBuildArgs Include='-DCMAKE_EXE_LINKER_FLAGS_INIT="-Wl,--build-id -fuse-ld=lld"' /> + <_LibCxxBuildArgs Include='-DCMAKE_SHARED_LINKER_FLAGS_INIT="-Wl,--build-id -fuse-ld=lld"' /> + <_LibCxxBuildArgs Include='-DCMAKE_MODULE_LINKER_FLAGS_INIT="-Wl,--build-id -fuse-ld=lld"' /> + <_LibCxxBuildArgs Include='-DCMAKE_INSTALL_PREFIX=$(_LibCxxInstallDir)' /> + <_LibCxxBuildArgs Include='-DCMAKE_POSITION_INDEPENDENT_CODE=ON' /> + <_LibCxxBuildArgs Include="-DCMAKE_CXX_COMPILER_TARGET=$(ClangTarget)" /> + <_LibCxxBuildArgs Include="-DLLVM_DEFAULT_TARGET_TRIPLE=$(ClangTarget)" /> + <_LibCxxBuildArgs Include="-DLIBCXXABI_USE_LLVM_UNWINDER=OFF" /> + <_LibCxxBuildArgs Condition="$(ClangTarget.ToLowerInvariant().Contains('musl'))" Include="-DLIBCXX_HAS_MUSL_LIBC=ON" /> + + + <_LibCxxBuildCommand Condition="'$(CMakeGenerator)' == 'Unix Makefiles'">$(_SetupEnvironment) make -j$([System.Environment]::ProcessorCount) + <_LibCxxBuildCommand Condition="'$(CMakeGenerator)' == 'Ninja'">$(_SetupEnvironment) ninja + + + + + + + + + <_LibCxxUnstripped Include="libc++.so.1.0" /> + <_LibCxxUnstripped Include="libc++abi.so.1.0" /> + <_LibCxxUnstripped Include="libunwind.so.1.0" /> + + + .dbg + + + + + + + + + + + + + + + + + + llvm-$(PackageVersion.Trim())-dotnet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index 12618966c4adf..21b8a94571137 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -19,6 +19,8 @@ include(${LLVM_COMMON_CMAKE_UTILS}/Modules/LLVMVersion.cmake) set_directory_properties(PROPERTIES LLVM_VERSION_MAJOR "${LLVM_VERSION_MAJOR}") +set(MONO_API_VERSION 1900) + if (NOT PACKAGE_VERSION) set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}") @@ -1423,3 +1425,8 @@ endif() if (LLVM_INCLUDE_UTILS AND LLVM_INCLUDE_TOOLS) add_subdirectory(utils/llvm-locstats) endif() + +# emit version we consume in Arcade +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/version.txt.in + ${CMAKE_CURRENT_BINARY_DIR}/version.txt) diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 03f4e1f190fd9..84769b07b37d4 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -430,11 +430,13 @@ endfunction(add_windows_version_resource_file) # Optional version string (defaults to PACKAGE_VERSION) # PRODUCT_NAME # Optional product name string (defaults to "LLVM") +# PRODUCT_LEGAL_COPYRIGHT +# Optional product legal copyright string # ) function(set_windows_version_resource_properties name resource_file) cmake_parse_arguments(ARG "" - "VERSION_MAJOR;VERSION_MINOR;VERSION_PATCHLEVEL;VERSION_STRING;PRODUCT_NAME" + "VERSION_MAJOR;VERSION_MINOR;VERSION_PATCHLEVEL;VERSION_STRING;PRODUCT_NAME;PRODUCT_LEGAL_COPYRIGHT" "" ${ARGN}) @@ -474,6 +476,10 @@ function(set_windows_version_resource_properties name resource_file) set(ARG_PRODUCT_NAME "LLVM") endif() + if (NOT DEFINED ARG_PRODUCT_LEGAL_COPYRIGHT) + set(ARG_PRODUCT_LEGAL_COPYRIGHT ${LEGAL_COPYRIGHT}) + endif() + set_property(SOURCE ${resource_file} PROPERTY COMPILE_FLAGS /nologo) set_property(SOURCE ${resource_file} @@ -485,7 +491,8 @@ function(set_windows_version_resource_properties name resource_file) "RC_FILE_VERSION=\"${ARG_VERSION_STRING}\"" "RC_INTERNAL_NAME=\"${name}\"" "RC_PRODUCT_NAME=\"${ARG_PRODUCT_NAME}\"" - "RC_PRODUCT_VERSION=\"${ARG_VERSION_STRING}\"") + "RC_PRODUCT_VERSION=\"${ARG_VERSION_STRING}\"" + "RC_COPYRIGHT=\"${ARG_PRODUCT_LEGAL_COPYRIGHT}\"") endfunction(set_windows_version_resource_properties) # llvm_add_library(name sources... @@ -1010,10 +1017,15 @@ endmacro() macro(add_llvm_executable name) cmake_parse_arguments(ARG - "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH;SUPPORT_PLUGINS" + "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH;SUPPORT_PLUGINS;DEBUGINFO_INSTALL" "ENTITLEMENTS;BUNDLE_PATH" "" ${ARGN}) + + if(ARG_DEBUGINFO_INSTALL) + set(DEBUGINFO_INSTALL "DEBUGINFO_INSTALL") + endif() + generate_llvm_objects(${name} ${ARG_UNPARSED_ARGUMENTS}) add_windows_version_resource_file(ALL_FILES ${ALL_FILES}) @@ -1097,7 +1109,7 @@ macro(add_llvm_executable name) add_custom_linker_flags(${name}) if(NOT ARG_IGNORE_EXTERNALIZE_DEBUGINFO) - llvm_externalize_debuginfo(${name}) + llvm_externalize_debuginfo(${name} ${DEBUGINFO_INSTALL}) endif() if (LLVM_PTHREAD_LIB) # libpthreads overrides some standard library symbols, so main @@ -1429,7 +1441,10 @@ macro(llvm_add_tool project name) generate_llvm_objects(${name} ${ARGN}) add_custom_target(${name} DEPENDS llvm-driver) else() - add_llvm_executable(${name} ${ARGN}) + if ( (${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS ) + set(DEBUGINFO_INSTALL "DEBUGINFO_INSTALL") + endif() + add_llvm_executable(${name} ${DEBUGINFO_INSTALL} ${ARGN}) if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) if( LLVM_BUILD_TOOLS ) @@ -1463,7 +1478,12 @@ macro(add_llvm_example name) if( NOT LLVM_BUILD_EXAMPLES ) set(EXCLUDE_FROM_ALL ON) endif() - add_llvm_executable(${name} ${ARGN}) + + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS) + set(DEBUGINFO_INSTALL "DEBUGINFO_INSTALL") + endif() + + add_llvm_executable(${name} ${DEBUGINFO_INSTALL} ${ARGN}) if( LLVM_BUILD_EXAMPLES ) install(TARGETS ${name} RUNTIME DESTINATION "${LLVM_EXAMPLES_INSTALL_DIR}") endif() @@ -1490,7 +1510,11 @@ macro(add_llvm_utility name) set(EXCLUDE_FROM_ALL ON) endif() - add_llvm_executable(${name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN}) + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS) + set(DEBUGINFO_INSTALL "DEBUGINFO_INSTALL") + endif() + + add_llvm_executable(${name} DISABLE_LLVM_LINK_LLVM_DYLIB ${DEBUGINFO_INSTALL} ${ARGN}) get_subproject_title(subproject_title) set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Utils") if ( ${name} IN_LIST LLVM_TOOLCHAIN_UTILITIES OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) @@ -2343,6 +2367,8 @@ function(llvm_externalize_debuginfo name) return() endif() + cmake_parse_arguments(ARG "DEBUGINFO_INSTALL" "" "" ${ARGN}) + if(NOT LLVM_EXTERNALIZE_DEBUGINFO_SKIP_STRIP) if(APPLE) if(NOT CMAKE_STRIP) @@ -2357,6 +2383,8 @@ function(llvm_externalize_debuginfo name) if(APPLE) if(LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION) set(file_ext ${LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION}) + elseif(LLVM_EXTERNALIZE_DEBUGINFO_FLATTEN) + set(file_ext dwarf) else() set(file_ext dSYM) endif() @@ -2364,9 +2392,16 @@ function(llvm_externalize_debuginfo name) set(output_name "$.${file_ext}") if(LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR) - set(output_path "-o=${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR}/${output_name}") + set(output_path "${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR}/${output_name}") else() - set(output_path "-o=${output_name}") + set(output_path "${output_name}") + endif() + set(output_flag "-o=${output_path}") + + if(LLVM_EXTERNALIZE_DEBUGINFO_FLATTEN) + set(flatten_debuginfo "--flat") + else() + set(flatten_debuginfo "") endif() if(CMAKE_CXX_FLAGS MATCHES "-flto" @@ -2380,15 +2415,50 @@ function(llvm_externalize_debuginfo name) set(CMAKE_DSYMUTIL xcrun dsymutil) endif() add_custom_command(TARGET ${name} POST_BUILD - COMMAND ${CMAKE_DSYMUTIL} ${output_path} $ + WORKING_DIRECTORY ${LLVM_RUNTIME_OUTPUT_INTDIR} + COMMAND ${CMAKE_DSYMUTIL} ${flatten_debuginfo} ${output_flag} $ ${strip_command} ) + if(LLVM_EXTERNALIZE_DEBUGINFO_INSTALL AND ARG_DEBUGINFO_INSTALL) + get_filename_component(debuginfo_absolute_path ${output_path} REALPATH BASE_DIR $) + install(FILES ${debuginfo_absolute_path} DESTINATION bin OPTIONAL COMPONENT ${name}) + endif() + elseif(WIN32) + if(LLVM_EXTERNALIZE_DEBUGINFO_INSTALL AND ARG_DEBUGINFO_INSTALL) + install(FILES $ DESTINATION bin OPTIONAL COMPONENT ${name}) + endif() else() + + if(LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION) + set(file_ext ${LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION}) + else() + set(file_ext debug) + endif() + + set(output_name "$.${file_ext}") + + if(LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR) + set(output_path "${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR}/${output_name}") + # If an output dir is specified, it must be manually mkdir'd on Linux, + # as that directory needs to exist before we can pipe to a file in it. + add_custom_command(TARGET ${name} POST_BUILD + WORKING_DIRECTORY ${LLVM_RUNTIME_OUTPUT_INTDIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR} + ) + else() + set(output_path "${output_name}") + endif() + add_custom_command(TARGET ${name} POST_BUILD - COMMAND ${CMAKE_OBJCOPY} --only-keep-debug $ $.debug + WORKING_DIRECTORY ${LLVM_RUNTIME_OUTPUT_INTDIR} + COMMAND ${CMAKE_OBJCOPY} --only-keep-debug $ ${output_path} ${strip_command} -R .gnu_debuglink - COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=$.debug $ + COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${output_path} $ ) + if(LLVM_EXTERNALIZE_DEBUGINFO_INSTALL AND ARG_DEBUGINFO_INSTALL) + get_filename_component(debuginfo_absolute_path ${output_path} REALPATH BASE_DIR $) + install(FILES ${debuginfo_absolute_path} DESTINATION bin OPTIONAL COMPONENT ${name}) + endif() endif() endfunction() diff --git a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake index cd071d50bdce9..eef0c16f6847e 100644 --- a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake +++ b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake @@ -350,7 +350,6 @@ function(llvm_ExternalProject_Add name source_dir) ${sysroot_arg} -DLLVM_BINARY_DIR=${PROJECT_BINARY_DIR} -DLLVM_CONFIG_PATH=${llvm_config_path} - -DLLVM_CMAKE_DIR=${LLVM_CMAKE_DIR} -DLLVM_ENABLE_WERROR=${LLVM_ENABLE_WERROR} -DLLVM_HOST_TRIPLE=${LLVM_HOST_TRIPLE} -DLLVM_HAVE_LINK_VERSION_SCRIPT=${LLVM_HAVE_LINK_VERSION_SCRIPT} diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake index ffcc718b47775..5e74f52345a84 100644 --- a/llvm/cmake/modules/TableGen.cmake +++ b/llvm/cmake/modules/TableGen.cmake @@ -178,7 +178,19 @@ macro(add_tablegen target project) set(${target}_OLD_LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS}) set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} TableGen) - add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB + # # CMake doesn't let compilation units depend on their dependent libraries on some generators. + # if(NOT CMAKE_GENERATOR MATCHES "Ninja" AND NOT XCODE) + # # FIXME: It leaks to user, callee of add_tablegen. + # set(LLVM_ENABLE_OBJLIB ON) + # endif() + + if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS) + set(DEBUGINFO_INSTALL "DEBUGINFO_INSTALL") + endif() + + # add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB ${DEBUGINFO_INSTALL} + + add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB ${DEBUGINFO_INSTALL} ${ADD_TABLEGEN_UNPARSED_ARGUMENTS}) set(LLVM_LINK_COMPONENTS ${${target}_OLD_LLVM_LINK_COMPONENTS}) diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst index a81caa160883d..7b9e15da9b2b0 100644 --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -42,6 +42,10 @@ Non-comprehensive list of changes in this release functionality, or simply have a lot to talk about), see the `NOTE` below for adding a new subsection. +* Starting with LLVM 19, the Windows installers only include support for the + X86, ARM, and AArch64 targets in order to keep the build size within the + limits of the NSIS installer framework. + * ... Update on required toolchains to build LLVM @@ -80,6 +84,11 @@ Changes to the LLVM IR removed. The next argument has been changed from byte index to bit index. * Added ``llvm.experimental.vector.compress`` intrinsic. +* Added special kind of `constant expressions + `_ to + represent pointers with signature embedded into it. +* Added `pointer authentication operand bundles + `_. Changes to LLVM infrastructure ------------------------------ @@ -108,6 +117,8 @@ Changes to TableGen Changes to Interprocedural Optimizations ---------------------------------------- +* Hot cold region splitting analysis improvements for overlapping cold regions. + Changes to the AArch64 Backend ------------------------------ @@ -125,6 +136,15 @@ Changes to the AArch64 Backend when specified via ``-march=`` or an ``-mcpu=`` that supports them. The attribute ``"target-features"="+v9a"`` no longer implies ``"+sve"`` and ``"+sve2"`` respectively. +* Added support for ELF pointer authentication relocations as specified in + `PAuth ABI Extension to ELF + `_. +* Added codegeneration, ELF object file and linker support for authenticated + call lowering, signed constants and emission of signing scheme details in + ``GNU_PROPERTY_AARCH64_FEATURE_PAUTH`` property of ``.note.gnu.property`` + section. +* Added codegeneration support for ``llvm.ptrauth.auth`` and + ``llvm.ptrauth.resign`` intrinsics. Changes to the AMDGPU Backend ----------------------------- @@ -180,6 +200,16 @@ Changes to the MIPS Backend Changes to the PowerPC Backend ------------------------------ +* PPC big-endian Linux now supports ``-fpatchable-function-entry``. +* PPC AIX now supports local-dynamic TLS mode. +* PPC AIX saves the Git revision in binaries when built with LLVM_APPEND_VC_REV=ON. +* PPC AIX now supports toc-data attribute for large code model. +* PPC AIX now supports passing arguments by value having greater alignment than + the pointer size. Currently only compatible with the IBM XL C compiler. +* Add support for the per global code model attribute on AIX. +* Support spilling non-volatile registers for traceback table accuracy on AIX. +* Codegen improvements and bug fixes. + Changes to the RISC-V Backend ----------------------------- @@ -422,6 +452,8 @@ Changes to the LLVM tools be disabled by ``--no-verify-note-sections``. (`#90458 `). +* llvm-objdump now supports the ``--file-headers`` option for XCOFF object files. + Changes to LLDB --------------------------------- diff --git a/llvm/docs/requirements-hashed.txt b/llvm/docs/requirements-hashed.txt deleted file mode 100644 index 64cfc8fc79799..0000000000000 --- a/llvm/docs/requirements-hashed.txt +++ /dev/null @@ -1,366 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile --generate-hashes --output-file=requirements-hashed.txt requirements.txt -# -alabaster==0.7.13 \ - --hash=sha256:1ee19aca801bbabb5ba3f5f258e4422dfa86f82f3e9cefb0859b283cdd7f62a3 \ - --hash=sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2 - # via sphinx -babel==2.14.0 \ - --hash=sha256:6919867db036398ba21eb5c7a0f6b28ab8cbc3ae7a73a44ebe34ae74a4e7d363 \ - --hash=sha256:efb1a25b7118e67ce3a259bed20545c29cb68be8ad2c784c83689981b7a57287 - # via sphinx -beautifulsoup4==4.12.2 \ - --hash=sha256:492bbc69dca35d12daac71c4db1bfff0c876c00ef4a2ffacce226d4638eb72da \ - --hash=sha256:bd2520ca0d9d7d12694a53d44ac482d181b4ec1888909b035a3dbf40d0f57d4a - # via furo -certifi==2023.11.17 \ - --hash=sha256:9b469f3a900bf28dc19b8cfbf8019bf47f7fdd1a65a1d4ffb98fc14166beb4d1 \ - --hash=sha256:e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474 - # via requests -charset-normalizer==3.3.2 \ - --hash=sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027 \ - --hash=sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087 \ - --hash=sha256:0a55554a2fa0d408816b3b5cedf0045f4b8e1a6065aec45849de2d6f3f8e9786 \ - --hash=sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8 \ - --hash=sha256:10955842570876604d404661fbccbc9c7e684caf432c09c715ec38fbae45ae09 \ - --hash=sha256:122c7fa62b130ed55f8f285bfd56d5f4b4a5b503609d181f9ad85e55c89f4185 \ - --hash=sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574 \ - --hash=sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e \ - --hash=sha256:1f79682fbe303db92bc2b1136016a38a42e835d932bab5b3b1bfcfbf0640e519 \ - --hash=sha256:2127566c664442652f024c837091890cb1942c30937add288223dc895793f898 \ - --hash=sha256:22afcb9f253dac0696b5a4be4a1c0f8762f8239e21b99680099abd9b2b1b2269 \ - --hash=sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3 \ - --hash=sha256:2e81c7b9c8979ce92ed306c249d46894776a909505d8f5a4ba55b14206e3222f \ - --hash=sha256:3287761bc4ee9e33561a7e058c72ac0938c4f57fe49a09eae428fd88aafe7bb6 \ - --hash=sha256:34d1c8da1e78d2e001f363791c98a272bb734000fcef47a491c1e3b0505657a8 \ - --hash=sha256:37e55c8e51c236f95b033f6fb391d7d7970ba5fe7ff453dad675e88cf303377a \ - --hash=sha256:3d47fa203a7bd9c5b6cee4736ee84ca03b8ef23193c0d1ca99b5089f72645c73 \ - --hash=sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc \ - --hash=sha256:42cb296636fcc8b0644486d15c12376cb9fa75443e00fb25de0b8602e64c1714 \ - --hash=sha256:45485e01ff4d3630ec0d9617310448a8702f70e9c01906b0d0118bdf9d124cf2 \ - --hash=sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc \ - --hash=sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce \ - --hash=sha256:4d0d1650369165a14e14e1e47b372cfcb31d6ab44e6e33cb2d4e57265290044d \ - --hash=sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e \ - --hash=sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6 \ - --hash=sha256:572c3763a264ba47b3cf708a44ce965d98555f618ca42c926a9c1616d8f34269 \ - --hash=sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96 \ - --hash=sha256:5b4c145409bef602a690e7cfad0a15a55c13320ff7a3ad7ca59c13bb8ba4d45d \ - --hash=sha256:6463effa3186ea09411d50efc7d85360b38d5f09b870c48e4600f63af490e56a \ - --hash=sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4 \ - --hash=sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77 \ - --hash=sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d \ - --hash=sha256:68d1f8a9e9e37c1223b656399be5d6b448dea850bed7d0f87a8311f1ff3dabb0 \ - --hash=sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed \ - --hash=sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068 \ - --hash=sha256:6c4caeef8fa63d06bd437cd4bdcf3ffefe6738fb1b25951440d80dc7df8c03ac \ - --hash=sha256:6ef1d82a3af9d3eecdba2321dc1b3c238245d890843e040e41e470ffa64c3e25 \ - --hash=sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8 \ - --hash=sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab \ - --hash=sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26 \ - --hash=sha256:7f04c839ed0b6b98b1a7501a002144b76c18fb1c1850c8b98d458ac269e26ed2 \ - --hash=sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db \ - --hash=sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f \ - --hash=sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5 \ - --hash=sha256:86216b5cee4b06df986d214f664305142d9c76df9b6512be2738aa72a2048f99 \ - --hash=sha256:87d1351268731db79e0f8e745d92493ee2841c974128ef629dc518b937d9194c \ - --hash=sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d \ - --hash=sha256:8c622a5fe39a48f78944a87d4fb8a53ee07344641b0562c540d840748571b811 \ - --hash=sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa \ - --hash=sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a \ - --hash=sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03 \ - --hash=sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b \ - --hash=sha256:923c0c831b7cfcb071580d3f46c4baf50f174be571576556269530f4bbd79d04 \ - --hash=sha256:95f2a5796329323b8f0512e09dbb7a1860c46a39da62ecb2324f116fa8fdc85c \ - --hash=sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001 \ - --hash=sha256:9f96df6923e21816da7e0ad3fd47dd8f94b2a5ce594e00677c0013018b813458 \ - --hash=sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389 \ - --hash=sha256:a50aebfa173e157099939b17f18600f72f84eed3049e743b68ad15bd69b6bf99 \ - --hash=sha256:a981a536974bbc7a512cf44ed14938cf01030a99e9b3a06dd59578882f06f985 \ - --hash=sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537 \ - --hash=sha256:ae5f4161f18c61806f411a13b0310bea87f987c7d2ecdbdaad0e94eb2e404238 \ - --hash=sha256:aed38f6e4fb3f5d6bf81bfa990a07806be9d83cf7bacef998ab1a9bd660a581f \ - --hash=sha256:b01b88d45a6fcb69667cd6d2f7a9aeb4bf53760d7fc536bf679ec94fe9f3ff3d \ - --hash=sha256:b261ccdec7821281dade748d088bb6e9b69e6d15b30652b74cbbac25e280b796 \ - --hash=sha256:b2b0a0c0517616b6869869f8c581d4eb2dd83a4d79e0ebcb7d373ef9956aeb0a \ - --hash=sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143 \ - --hash=sha256:bd8f7df7d12c2db9fab40bdd87a7c09b1530128315d047a086fa3ae3435cb3a8 \ - --hash=sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c \ - --hash=sha256:c002b4ffc0be611f0d9da932eb0f704fe2602a9a949d1f738e4c34c75b0863d5 \ - --hash=sha256:c083af607d2515612056a31f0a8d9e0fcb5876b7bfc0abad3ecd275bc4ebc2d5 \ - --hash=sha256:c180f51afb394e165eafe4ac2936a14bee3eb10debc9d9e4db8958fe36afe711 \ - --hash=sha256:c235ebd9baae02f1b77bcea61bce332cb4331dc3617d254df3323aa01ab47bd4 \ - --hash=sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6 \ - --hash=sha256:d0eccceffcb53201b5bfebb52600a5fb483a20b61da9dbc885f8b103cbe7598c \ - --hash=sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7 \ - --hash=sha256:db364eca23f876da6f9e16c9da0df51aa4f104a972735574842618b8c6d999d4 \ - --hash=sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b \ - --hash=sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae \ - --hash=sha256:e06ed3eb3218bc64786f7db41917d4e686cc4856944f53d5bdf83a6884432e12 \ - --hash=sha256:e27ad930a842b4c5eb8ac0016b0a54f5aebbe679340c26101df33424142c143c \ - --hash=sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae \ - --hash=sha256:eb00ed941194665c332bf8e078baf037d6c35d7c4f3102ea2d4f16ca94a26dc8 \ - --hash=sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887 \ - --hash=sha256:eb8821e09e916165e160797a6c17edda0679379a4be5c716c260e836e122f54b \ - --hash=sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4 \ - --hash=sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f \ - --hash=sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5 \ - --hash=sha256:fb69256e180cb6c8a894fee62b3afebae785babc1ee98b81cdf68bbca1987f33 \ - --hash=sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519 \ - --hash=sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561 - # via requests -commonmark==0.9.1 \ - --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ - --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 - # via recommonmark -docutils==0.20.1 \ - --hash=sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6 \ - --hash=sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b - # via - # -r requirements.txt - # myst-parser - # recommonmark - # sphinx -furo==2024.1.29 \ - --hash=sha256:3548be2cef45a32f8cdc0272d415fcb3e5fa6a0eb4ddfe21df3ecf1fe45a13cf \ - --hash=sha256:4d6b2fe3f10a6e36eb9cc24c1e7beb38d7a23fc7b3c382867503b7fcac8a1e02 - # via -r requirements.txt -idna==3.6 \ - --hash=sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca \ - --hash=sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f - # via requests -imagesize==1.4.1 \ - --hash=sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b \ - --hash=sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a - # via sphinx -jinja2==3.1.2 \ - --hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \ - --hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61 - # via - # myst-parser - # sphinx -markdown==3.5.1 \ - --hash=sha256:5874b47d4ee3f0b14d764324d2c94c03ea66bee56f2d929da9f2508d65e722dc \ - --hash=sha256:b65d7beb248dc22f2e8a31fb706d93798093c308dc1aba295aedeb9d41a813bd - # via sphinx-markdown-tables -markdown-it-py==3.0.0 \ - --hash=sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1 \ - --hash=sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb - # via - # mdit-py-plugins - # myst-parser -markupsafe==2.1.3 \ - --hash=sha256:05fb21170423db021895e1ea1e1f3ab3adb85d1c2333cbc2310f2a26bc77272e \ - --hash=sha256:0a4e4a1aff6c7ac4cd55792abf96c915634c2b97e3cc1c7129578aa68ebd754e \ - --hash=sha256:10bbfe99883db80bdbaff2dcf681dfc6533a614f700da1287707e8a5d78a8431 \ - --hash=sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686 \ - --hash=sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c \ - --hash=sha256:1577735524cdad32f9f694208aa75e422adba74f1baee7551620e43a3141f559 \ - --hash=sha256:1b40069d487e7edb2676d3fbdb2b0829ffa2cd63a2ec26c4938b2d34391b4ecc \ - --hash=sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb \ - --hash=sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939 \ - --hash=sha256:282c2cb35b5b673bbcadb33a585408104df04f14b2d9b01d4c345a3b92861c2c \ - --hash=sha256:2c1b19b3aaacc6e57b7e25710ff571c24d6c3613a45e905b1fde04d691b98ee0 \ - --hash=sha256:2ef12179d3a291be237280175b542c07a36e7f60718296278d8593d21ca937d4 \ - --hash=sha256:338ae27d6b8745585f87218a3f23f1512dbf52c26c28e322dbe54bcede54ccb9 \ - --hash=sha256:3c0fae6c3be832a0a0473ac912810b2877c8cb9d76ca48de1ed31e1c68386575 \ - --hash=sha256:3fd4abcb888d15a94f32b75d8fd18ee162ca0c064f35b11134be77050296d6ba \ - --hash=sha256:42de32b22b6b804f42c5d98be4f7e5e977ecdd9ee9b660fda1a3edf03b11792d \ - --hash=sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd \ - --hash=sha256:504b320cd4b7eff6f968eddf81127112db685e81f7e36e75f9f84f0df46041c3 \ - --hash=sha256:525808b8019e36eb524b8c68acdd63a37e75714eac50e988180b169d64480a00 \ - --hash=sha256:56d9f2ecac662ca1611d183feb03a3fa4406469dafe241673d521dd5ae92a155 \ - --hash=sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac \ - --hash=sha256:65c1a9bcdadc6c28eecee2c119465aebff8f7a584dd719facdd9e825ec61ab52 \ - --hash=sha256:68e78619a61ecf91e76aa3e6e8e33fc4894a2bebe93410754bd28fce0a8a4f9f \ - --hash=sha256:69c0f17e9f5a7afdf2cc9fb2d1ce6aabdb3bafb7f38017c0b77862bcec2bbad8 \ - --hash=sha256:6b2b56950d93e41f33b4223ead100ea0fe11f8e6ee5f641eb753ce4b77a7042b \ - --hash=sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007 \ - --hash=sha256:787003c0ddb00500e49a10f2844fac87aa6ce977b90b0feaaf9de23c22508b24 \ - --hash=sha256:7ef3cb2ebbf91e330e3bb937efada0edd9003683db6b57bb108c4001f37a02ea \ - --hash=sha256:8023faf4e01efadfa183e863fefde0046de576c6f14659e8782065bcece22198 \ - --hash=sha256:8758846a7e80910096950b67071243da3e5a20ed2546e6392603c096778d48e0 \ - --hash=sha256:8afafd99945ead6e075b973fefa56379c5b5c53fd8937dad92c662da5d8fd5ee \ - --hash=sha256:8c41976a29d078bb235fea9b2ecd3da465df42a562910f9022f1a03107bd02be \ - --hash=sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2 \ - --hash=sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1 \ - --hash=sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707 \ - --hash=sha256:962f82a3086483f5e5f64dbad880d31038b698494799b097bc59c2edf392fce6 \ - --hash=sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c \ - --hash=sha256:9dcdfd0eaf283af041973bff14a2e143b8bd64e069f4c383416ecd79a81aab58 \ - --hash=sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823 \ - --hash=sha256:aa7bd130efab1c280bed0f45501b7c8795f9fdbeb02e965371bbef3523627779 \ - --hash=sha256:ab4a0df41e7c16a1392727727e7998a467472d0ad65f3ad5e6e765015df08636 \ - --hash=sha256:ad9e82fb8f09ade1c3e1b996a6337afac2b8b9e365f926f5a61aacc71adc5b3c \ - --hash=sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad \ - --hash=sha256:b076b6226fb84157e3f7c971a47ff3a679d837cf338547532ab866c57930dbee \ - --hash=sha256:b7ff0f54cb4ff66dd38bebd335a38e2c22c41a8ee45aa608efc890ac3e3931bc \ - --hash=sha256:bfce63a9e7834b12b87c64d6b155fdd9b3b96191b6bd334bf37db7ff1fe457f2 \ - --hash=sha256:c011a4149cfbcf9f03994ec2edffcb8b1dc2d2aede7ca243746df97a5d41ce48 \ - --hash=sha256:c9c804664ebe8f83a211cace637506669e7890fec1b4195b505c214e50dd4eb7 \ - --hash=sha256:ca379055a47383d02a5400cb0d110cef0a776fc644cda797db0c5696cfd7e18e \ - --hash=sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b \ - --hash=sha256:cd0f502fe016460680cd20aaa5a76d241d6f35a1c3350c474bac1273803893fa \ - --hash=sha256:ceb01949af7121f9fc39f7d27f91be8546f3fb112c608bc4029aef0bab86a2a5 \ - --hash=sha256:d080e0a5eb2529460b30190fcfcc4199bd7f827663f858a226a81bc27beaa97e \ - --hash=sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb \ - --hash=sha256:df0be2b576a7abbf737b1575f048c23fb1d769f267ec4358296f31c2479db8f9 \ - --hash=sha256:e09031c87a1e51556fdcb46e5bd4f59dfb743061cf93c4d6831bf894f125eb57 \ - --hash=sha256:e4dd52d80b8c83fdce44e12478ad2e85c64ea965e75d66dbeafb0a3e77308fcc \ - --hash=sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc \ - --hash=sha256:fec21693218efe39aa7f8599346e90c705afa52c5b31ae019b2e57e8f6542bb2 \ - --hash=sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11 - # via jinja2 -mdit-py-plugins==0.4.0 \ - --hash=sha256:b51b3bb70691f57f974e257e367107857a93b36f322a9e6d44ca5bf28ec2def9 \ - --hash=sha256:d8ab27e9aed6c38aa716819fedfde15ca275715955f8a185a8e1cf90fb1d2c1b - # via myst-parser -mdurl==0.1.2 \ - --hash=sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8 \ - --hash=sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba - # via markdown-it-py -myst-parser==2.0.0 \ - --hash=sha256:7c36344ae39c8e740dad7fdabf5aa6fc4897a813083c6cc9990044eb93656b14 \ - --hash=sha256:ea929a67a6a0b1683cdbe19b8d2e724cd7643f8aa3e7bb18dd65beac3483bead - # via -r requirements.txt -packaging==23.2 \ - --hash=sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5 \ - --hash=sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7 - # via sphinx -pygments==2.17.2 \ - --hash=sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c \ - --hash=sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367 - # via - # furo - # sphinx -pyyaml==6.0.1 \ - --hash=sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5 \ - --hash=sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc \ - --hash=sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df \ - --hash=sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741 \ - --hash=sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206 \ - --hash=sha256:18aeb1bf9a78867dc38b259769503436b7c72f7a1f1f4c93ff9a17de54319b27 \ - --hash=sha256:1d4c7e777c441b20e32f52bd377e0c409713e8bb1386e1099c2415f26e479595 \ - --hash=sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62 \ - --hash=sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98 \ - --hash=sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696 \ - --hash=sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290 \ - --hash=sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9 \ - --hash=sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d \ - --hash=sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6 \ - --hash=sha256:4fb147e7a67ef577a588a0e2c17b6db51dda102c71de36f8549b6816a96e1867 \ - --hash=sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47 \ - --hash=sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486 \ - --hash=sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6 \ - --hash=sha256:596106435fa6ad000c2991a98fa58eeb8656ef2325d7e158344fb33864ed87e3 \ - --hash=sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007 \ - --hash=sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938 \ - --hash=sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0 \ - --hash=sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c \ - --hash=sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735 \ - --hash=sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d \ - --hash=sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28 \ - --hash=sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4 \ - --hash=sha256:9046c58c4395dff28dd494285c82ba00b546adfc7ef001486fbf0324bc174fba \ - --hash=sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8 \ - --hash=sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5 \ - --hash=sha256:afd7e57eddb1a54f0f1a974bc4391af8bcce0b444685d936840f125cf046d5bd \ - --hash=sha256:b1275ad35a5d18c62a7220633c913e1b42d44b46ee12554e5fd39c70a243d6a3 \ - --hash=sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0 \ - --hash=sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515 \ - --hash=sha256:baa90d3f661d43131ca170712d903e6295d1f7a0f595074f151c0aed377c9b9c \ - --hash=sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c \ - --hash=sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924 \ - --hash=sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34 \ - --hash=sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43 \ - --hash=sha256:c8098ddcc2a85b61647b2590f825f3db38891662cfc2fc776415143f599bb859 \ - --hash=sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673 \ - --hash=sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54 \ - --hash=sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a \ - --hash=sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b \ - --hash=sha256:f003ed9ad21d6a4713f0a9b5a7a0a79e08dd0f221aff4525a2be4c346ee60aab \ - --hash=sha256:f22ac1c3cac4dbc50079e965eba2c1058622631e526bd9afd45fedd49ba781fa \ - --hash=sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c \ - --hash=sha256:fca0e3a251908a499833aa292323f32437106001d436eca0e6e7833256674585 \ - --hash=sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d \ - --hash=sha256:fd66fc5d0da6d9815ba2cebeb4205f95818ff4b79c3ebe268e75d961704af52f - # via myst-parser -recommonmark==0.7.1 \ - --hash=sha256:1b1db69af0231efce3fa21b94ff627ea33dee7079a01dd0a7f8482c3da148b3f \ - --hash=sha256:bdb4db649f2222dcd8d2d844f0006b958d627f732415d399791ee436a3686d67 - # via -r requirements.txt -requests==2.31.0 \ - --hash=sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f \ - --hash=sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1 - # via sphinx -snowballstemmer==2.2.0 \ - --hash=sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1 \ - --hash=sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a - # via sphinx -soupsieve==2.5 \ - --hash=sha256:5663d5a7b3bfaeee0bc4372e7fc48f9cff4940b3eec54a6451cc5299f1097690 \ - --hash=sha256:eaa337ff55a1579b6549dc679565eac1e3d000563bcb1c8ab0d0fefbc0c2cdc7 - # via beautifulsoup4 -sphinx==7.2.6 \ - --hash=sha256:1e09160a40b956dc623c910118fa636da93bd3ca0b9876a7b3df90f07d691560 \ - --hash=sha256:9a5160e1ea90688d5963ba09a2dcd8bdd526620edbb65c328728f1b2228d5ab5 - # via - # -r requirements.txt - # furo - # myst-parser - # recommonmark - # sphinx-automodapi - # sphinx-basic-ng - # sphinxcontrib-devhelp - # sphinxcontrib-htmlhelp - # sphinxcontrib-qthelp - # sphinxcontrib-serializinghtml -sphinx-automodapi==0.17.0 \ - --hash=sha256:4d029cb79eef29413e94ab01bb0177ebd2d5ba86e9789b73575afe9c06ae1501 \ - --hash=sha256:7ccdadad57add4aa9149d9f2bb5cf28c8f8b590280b4735b1156ea8355c423a1 - # via -r requirements.txt -sphinx-basic-ng==1.0.0b2 \ - --hash=sha256:9ec55a47c90c8c002b5960c57492ec3021f5193cb26cebc2dc4ea226848651c9 \ - --hash=sha256:eb09aedbabfb650607e9b4b68c9d240b90b1e1be221d6ad71d61c52e29f7932b - # via furo -sphinx-bootstrap-theme==0.8.1 \ - --hash=sha256:683e3b735448dadd0149f76edecf95ff4bd9157787e9e77e0d048ca6f1d680df \ - --hash=sha256:6ef36206c211846ea6cbdb45bc85645578e7c62d0a883361181708f8b6ea743b - # via -r requirements.txt -sphinx-markdown-tables==0.0.17 \ - --hash=sha256:2bd0c30779653e4dd120300cbd9ca412c480738cc2241f6dea477a883f299e04 \ - --hash=sha256:6bc6d3d400eaccfeebd288446bc08dd83083367c58b85d40fe6c12d77ef592f1 - # via -r requirements.txt -sphinxcontrib-applehelp==1.0.8 \ - --hash=sha256:c40a4f96f3776c4393d933412053962fac2b84f4c99a7982ba42e09576a70619 \ - --hash=sha256:cb61eb0ec1b61f349e5cc36b2028e9e7ca765be05e49641c97241274753067b4 - # via - # -r requirements.txt - # sphinx -sphinxcontrib-devhelp==1.0.5 \ - --hash=sha256:63b41e0d38207ca40ebbeabcf4d8e51f76c03e78cd61abe118cf4435c73d4212 \ - --hash=sha256:fe8009aed765188f08fcaadbb3ea0d90ce8ae2d76710b7e29ea7d047177dae2f - # via sphinx -sphinxcontrib-htmlhelp==2.0.4 \ - --hash=sha256:6c26a118a05b76000738429b724a0568dbde5b72391a688577da08f11891092a \ - --hash=sha256:8001661c077a73c29beaf4a79968d0726103c5605e27db92b9ebed8bab1359e9 - # via sphinx -sphinxcontrib-jsmath==1.0.1 \ - --hash=sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178 \ - --hash=sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8 - # via sphinx -sphinxcontrib-qthelp==1.0.6 \ - --hash=sha256:62b9d1a186ab7f5ee3356d906f648cacb7a6bdb94d201ee7adf26db55092982d \ - --hash=sha256:bf76886ee7470b934e363da7a954ea2825650013d367728588732c7350f49ea4 - # via sphinx -sphinxcontrib-serializinghtml==1.1.9 \ - --hash=sha256:0c64ff898339e1fac29abd2bf5f11078f3ec413cfe9c046d3120d7ca65530b54 \ - --hash=sha256:9b36e503703ff04f20e9675771df105e58aa029cfcbc23b8ed716019b7416ae1 - # via sphinx -urllib3==2.1.0 \ - --hash=sha256:55901e917a5896a349ff771be919f8bd99aff50b79fe58fec595eb37bbc56bb3 \ - --hash=sha256:df7aa8afb0148fa78488e7899b2c59b5f4ffcfa82e6c54ccb9dd37c1d7b52d54 - # via requests diff --git a/llvm/docs/requirements.txt b/llvm/docs/requirements.txt deleted file mode 100644 index 960a6eb644e14..0000000000000 --- a/llvm/docs/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -sphinx==7.2.6 -docutils==0.20.1 -sphinx-markdown-tables==0.0.17 -recommonmark==0.7.1 -sphinx-automodapi==0.17.0 -sphinx-bootstrap-theme==0.8.1 -sphinxcontrib-applehelp==1.0.8 -furo==2024.1.29 -myst-parser==2.0.0 diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h index 223d8efe57daa..998b62396b464 100644 --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -221,6 +221,7 @@ typedef enum { LLVMPreserveAllCallConv = 15, LLVMSwiftCallConv = 16, LLVMCXXFASTTLSCallConv = 17, + LLVMMono1CallConv = 22, LLVMX86StdcallCallConv = 64, LLVMX86FastcallCallConv = 65, LLVMARMAPCSCallConv = 66, diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index e34068592de81..8f988d01cb2a6 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -2027,6 +2027,12 @@ template bool equal(L &&LRange, R &&RRange) { adl_end(RRange)); } +template +bool equal(L &&LRange, R &&RRange, BinaryPredicate P) { + return std::equal(adl_begin(LRange), adl_end(LRange), adl_begin(RRange), + adl_end(RRange), P); +} + /// Returns true if all elements in Range are equal or when the Range is empty. template bool all_equal(R &&Range) { auto Begin = adl_begin(Range); diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h index 09676d792dfeb..17444147b102a 100644 --- a/llvm/include/llvm/ADT/SmallVector.h +++ b/llvm/include/llvm/ADT/SmallVector.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h index 812b5a9f72a3a..4140387a1f341 100644 --- a/llvm/include/llvm/Analysis/AliasAnalysis.h +++ b/llvm/include/llvm/Analysis/AliasAnalysis.h @@ -244,12 +244,23 @@ class AAQueryInfo { public: using LocPair = std::pair; struct CacheEntry { + /// Cache entry is neither an assumption nor does it use a (non-definitive) + /// assumption. + static constexpr int Definitive = -2; + /// Cache entry is not an assumption itself, but may be using an assumption + /// from higher up the stack. + static constexpr int AssumptionBased = -1; + AliasResult Result; - /// Number of times a NoAlias assumption has been used. - /// 0 for assumptions that have not been used, -1 for definitive results. + /// Number of times a NoAlias assumption has been used, 0 for assumptions + /// that have not been used. Can also take one of the Definitive or + /// AssumptionBased values documented above. int NumAssumptionUses; + /// Whether this is a definitive (non-assumption) result. - bool isDefinitive() const { return NumAssumptionUses < 0; } + bool isDefinitive() const { return NumAssumptionUses == Definitive; } + /// Whether this is an assumption that has not been proven yet. + bool isAssumption() const { return NumAssumptionUses >= 0; } }; // Alias analysis result aggregration using which this query is performed. diff --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h index afafb74bdcb0a..95a74b91f7acb 100644 --- a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h +++ b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h @@ -199,9 +199,8 @@ class MemoryDepChecker { /// Check whether the dependencies between the accesses are safe. /// /// Only checks sets with elements in \p CheckDeps. - bool areDepsSafe(DepCandidates &AccessSets, MemAccessInfoList &CheckDeps, - const DenseMap> - &UnderlyingObjects); + bool areDepsSafe(const DepCandidates &AccessSets, + const MemAccessInfoList &CheckDeps); /// No memory dependence was encountered that would inhibit /// vectorization. @@ -351,11 +350,8 @@ class MemoryDepChecker { /// element access it records this distance in \p MinDepDistBytes (if this /// distance is smaller than any other distance encountered so far). /// Otherwise, this function returns true signaling a possible dependence. - Dependence::DepType - isDependent(const MemAccessInfo &A, unsigned AIdx, const MemAccessInfo &B, - unsigned BIdx, - const DenseMap> - &UnderlyingObjects); + Dependence::DepType isDependent(const MemAccessInfo &A, unsigned AIdx, + const MemAccessInfo &B, unsigned BIdx); /// Check whether the data dependence could prevent store-load /// forwarding. @@ -392,11 +388,9 @@ class MemoryDepChecker { /// determined, or a struct containing (Distance, Stride, TypeSize, AIsWrite, /// BIsWrite). std::variant - getDependenceDistanceStrideAndSize( - const MemAccessInfo &A, Instruction *AInst, const MemAccessInfo &B, - Instruction *BInst, - const DenseMap> - &UnderlyingObjects); + getDependenceDistanceStrideAndSize(const MemAccessInfo &A, Instruction *AInst, + const MemAccessInfo &B, + Instruction *BInst); }; class RuntimePointerChecking; @@ -797,7 +791,8 @@ replaceSymbolicStrideSCEV(PredicatedScalarEvolution &PSE, Value *Ptr); /// If the pointer has a constant stride return it in units of the access type -/// size. Otherwise return std::nullopt. +/// size. If the pointer is loop-invariant, return 0. Otherwise return +/// std::nullopt. /// /// Ensure that it does not wrap in the address space, assuming the predicate /// associated with \p PSE is true. diff --git a/llvm/include/llvm/Analysis/SimplifyQuery.h b/llvm/include/llvm/Analysis/SimplifyQuery.h index a560744f01222..e8f43c8c2e91f 100644 --- a/llvm/include/llvm/Analysis/SimplifyQuery.h +++ b/llvm/include/llvm/Analysis/SimplifyQuery.h @@ -130,6 +130,12 @@ struct SimplifyQuery { Copy.CC = &CC; return Copy; } + + SimplifyQuery getWithoutCondContext() const { + SimplifyQuery Copy(*this); + Copy.CC = nullptr; + return Copy; + } }; } // end namespace llvm diff --git a/llvm/include/llvm/AsmParser/LLToken.h b/llvm/include/llvm/AsmParser/LLToken.h index db6780b70ca5a..fc116d7ce772b 100644 --- a/llvm/include/llvm/AsmParser/LLToken.h +++ b/llvm/include/llvm/AsmParser/LLToken.h @@ -184,6 +184,7 @@ enum Kind { kw_m68k_rtdcc, kw_graalcc, kw_riscv_vector_cc, + kw_monocc, // Attributes: kw_attributes, diff --git a/llvm/include/llvm/CodeGen/MachineFrameInfo.h b/llvm/include/llvm/CodeGen/MachineFrameInfo.h index 466fed7fb3a29..213b7ec6b3fbf 100644 --- a/llvm/include/llvm/CodeGen/MachineFrameInfo.h +++ b/llvm/include/llvm/CodeGen/MachineFrameInfo.h @@ -251,7 +251,7 @@ class MachineFrameInfo { /// targets, this value is only used when generating debug info (via /// TargetRegisterInfo::getFrameIndexReference); when generating code, the /// corresponding adjustments are performed directly. - int OffsetAdjustment = 0; + int64_t OffsetAdjustment = 0; /// The prolog/epilog code inserter may process objects that require greater /// alignment than the default alignment the target provides. @@ -280,7 +280,7 @@ class MachineFrameInfo { /// setup/destroy pseudo instructions (as defined in the TargetFrameInfo /// class). This information is important for frame pointer elimination. /// It is only valid during and after prolog/epilog code insertion. - unsigned MaxCallFrameSize = ~0u; + uint64_t MaxCallFrameSize = ~UINT64_C(0); /// The number of bytes of callee saved registers that the target wants to /// report for the current function in the CodeView S_FRAMEPROC record. @@ -593,10 +593,10 @@ class MachineFrameInfo { uint64_t estimateStackSize(const MachineFunction &MF) const; /// Return the correction for frame offsets. - int getOffsetAdjustment() const { return OffsetAdjustment; } + int64_t getOffsetAdjustment() const { return OffsetAdjustment; } /// Set the correction for frame offsets. - void setOffsetAdjustment(int Adj) { OffsetAdjustment = Adj; } + void setOffsetAdjustment(int64_t Adj) { OffsetAdjustment = Adj; } /// Return the alignment in bytes that this function must be aligned to, /// which is greater than the default stack alignment provided by the target. @@ -663,7 +663,7 @@ class MachineFrameInfo { /// CallFrameSetup/Destroy pseudo instructions are used by the target, and /// then only during or after prolog/epilog code insertion. /// - unsigned getMaxCallFrameSize() const { + uint64_t getMaxCallFrameSize() const { // TODO: Enable this assert when targets are fixed. //assert(isMaxCallFrameSizeComputed() && "MaxCallFrameSize not computed yet"); if (!isMaxCallFrameSizeComputed()) @@ -671,9 +671,9 @@ class MachineFrameInfo { return MaxCallFrameSize; } bool isMaxCallFrameSizeComputed() const { - return MaxCallFrameSize != ~0u; + return MaxCallFrameSize != ~UINT64_C(0); } - void setMaxCallFrameSize(unsigned S) { MaxCallFrameSize = S; } + void setMaxCallFrameSize(uint64_t S) { MaxCallFrameSize = S; } /// Returns how many bytes of callee-saved registers the target pushed in the /// prologue. Only used for debug info. diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h b/llvm/include/llvm/CodeGen/MachineFunction.h index 6e7292abeddbb..b1d5f578bf56e 100644 --- a/llvm/include/llvm/CodeGen/MachineFunction.h +++ b/llvm/include/llvm/CodeGen/MachineFunction.h @@ -406,6 +406,9 @@ class LLVM_EXTERNAL_VISIBILITY MachineFunction { /// \pre Fn, Target, MMI, and FunctionNumber are properly set. void init(); + // Stack slot containing the this pointer for mono compiled functions + int MonoThisSlot; + public: /// Description of the location of a variable whose Address is valid and /// unchanging during function execution. The Address may be: @@ -676,6 +679,9 @@ class LLVM_EXTERNAL_VISIBILITY MachineFunction { PseudoSourceValueManager &getPSVManager() const { return *PSVManager; } + int getMonoThisSlot() const { return MonoThisSlot; } + void setMonoThisSlot(int Slot) { MonoThisSlot = Slot; } + /// Return the DataLayout attached to the Module associated to this MF. const DataLayout &getDataLayout() const; diff --git a/llvm/include/llvm/CodeGen/TargetFrameLowering.h b/llvm/include/llvm/CodeGen/TargetFrameLowering.h index 0b9cacecc7cbe..d8c9d0a432ad8 100644 --- a/llvm/include/llvm/CodeGen/TargetFrameLowering.h +++ b/llvm/include/llvm/CodeGen/TargetFrameLowering.h @@ -15,6 +15,7 @@ #include "llvm/ADT/BitVector.h" #include "llvm/CodeGen/MachineBasicBlock.h" +#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h" #include "llvm/Support/TypeSize.h" #include @@ -51,7 +52,7 @@ class TargetFrameLowering { // Maps a callee saved register to a stack slot with a fixed offset. struct SpillSlot { unsigned Reg; - int Offset; // Offset relative to stack pointer on function entry. + int64_t Offset; // Offset relative to stack pointer on function entry. }; struct DwarfFrameBase { @@ -66,7 +67,7 @@ class TargetFrameLowering { // Used with FrameBaseKind::Register. unsigned Reg; // Used with FrameBaseKind::CFA. - int Offset; + int64_t Offset; struct WasmFrameBase WasmLoc; } Location; }; @@ -343,6 +344,13 @@ class TargetFrameLowering { return getFrameIndexReference(MF, FI, FrameReg); } + /// getFrameIndexReferenceFromSP - This method returns the offset from the + /// stack pointer to the slot of the specified index. This function serves to + /// provide a comparable offset from a single reference point (the value of + /// the stack-pointer at function entry) that can be used for analysis. + virtual StackOffset getFrameIndexReferenceFromSP(const MachineFunction &MF, + int FI) const; + /// Returns the callee-saved registers as computed by determineCalleeSaves /// in the BitVector \p SavedRegs. virtual void getCalleeSaves(const MachineFunction &MF, @@ -466,6 +474,11 @@ class TargetFrameLowering { /// Return the frame base information to be encoded in the DWARF subprogram /// debug info. virtual DwarfFrameBase getDwarfFrameBase(const MachineFunction &MF) const; + + /// This method is called at the end of prolog/epilog code insertion, so + /// targets can emit remarks based on the final frame layout. + virtual void emitRemarks(const MachineFunction &MF, + MachineOptimizationRemarkEmitter *ORE) const {}; }; } // End llvm namespace diff --git a/llvm/include/llvm/CodeGenData/CodeGenData.h b/llvm/include/llvm/CodeGenData/CodeGenData.h deleted file mode 100644 index 659008c78abd9..0000000000000 --- a/llvm/include/llvm/CodeGenData/CodeGenData.h +++ /dev/null @@ -1,204 +0,0 @@ -//===- CodeGenData.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 -// -//===----------------------------------------------------------------------===// -// -// This file contains support for codegen data that has stable summary which -// can be used to optimize the code in the subsequent codegen. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CODEGENDATA_CODEGENDATA_H -#define LLVM_CODEGENDATA_CODEGENDATA_H - -#include "llvm/ADT/BitmaskEnum.h" -#include "llvm/Bitcode/BitcodeReader.h" -#include "llvm/CodeGenData/OutlinedHashTree.h" -#include "llvm/CodeGenData/OutlinedHashTreeRecord.h" -#include "llvm/IR/Module.h" -#include "llvm/Object/ObjectFile.h" -#include "llvm/Support/ErrorHandling.h" -#include "llvm/TargetParser/Triple.h" -#include - -namespace llvm { - -enum CGDataSectKind { -#define CG_DATA_SECT_ENTRY(Kind, SectNameCommon, SectNameCoff, Prefix) Kind, -#include "llvm/CodeGenData/CodeGenData.inc" -}; - -std::string getCodeGenDataSectionName(CGDataSectKind CGSK, - Triple::ObjectFormatType OF, - bool AddSegmentInfo = true); - -enum class CGDataKind { - Unknown = 0x0, - // A function outlining info. - FunctionOutlinedHashTree = 0x1, - LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/FunctionOutlinedHashTree) -}; - -const std::error_category &cgdata_category(); - -enum class cgdata_error { - success = 0, - eof, - bad_magic, - bad_header, - empty_cgdata, - malformed, - unsupported_version, -}; - -inline std::error_code make_error_code(cgdata_error E) { - return std::error_code(static_cast(E), cgdata_category()); -} - -class CGDataError : public ErrorInfo { -public: - CGDataError(cgdata_error Err, const Twine &ErrStr = Twine()) - : Err(Err), Msg(ErrStr.str()) { - assert(Err != cgdata_error::success && "Not an error"); - } - - std::string message() const override; - - void log(raw_ostream &OS) const override { OS << message(); } - - std::error_code convertToErrorCode() const override { - return make_error_code(Err); - } - - cgdata_error get() const { return Err; } - const std::string &getMessage() const { return Msg; } - - /// Consume an Error and return the raw enum value contained within it, and - /// the optional error message. The Error must either be a success value, or - /// contain a single CGDataError. - static std::pair take(Error E) { - auto Err = cgdata_error::success; - std::string Msg; - handleAllErrors(std::move(E), [&Err, &Msg](const CGDataError &IPE) { - assert(Err == cgdata_error::success && "Multiple errors encountered"); - Err = IPE.get(); - Msg = IPE.getMessage(); - }); - return {Err, Msg}; - } - - static char ID; - -private: - cgdata_error Err; - std::string Msg; -}; - -enum CGDataMode { - None, - Read, - Write, -}; - -class CodeGenData { - /// Global outlined hash tree that has oulined hash sequences across modules. - std::unique_ptr PublishedHashTree; - - /// This flag is set when -fcodegen-data-generate is passed. - /// Or, it can be mutated with -fcodegen-data-thinlto-two-rounds. - bool EmitCGData; - - /// This is a singleton instance which is thread-safe. Unlike profile data - /// which is largely function-based, codegen data describes the whole module. - /// Therefore, this can be initialized once, and can be used across modules - /// instead of constructing the same one for each codegen backend. - static std::unique_ptr Instance; - static std::once_flag OnceFlag; - - CodeGenData() = default; - -public: - ~CodeGenData() = default; - - static CodeGenData &getInstance(); - - /// Returns true if we have a valid outlined hash tree. - bool hasOutlinedHashTree() { - return PublishedHashTree && !PublishedHashTree->empty(); - } - - /// Returns the outlined hash tree. This can be globally used in a read-only - /// manner. - const OutlinedHashTree *getOutlinedHashTree() { - return PublishedHashTree.get(); - } - - /// Returns true if we should write codegen data. - bool emitCGData() { return EmitCGData; } - - /// Publish the (globally) merged or read outlined hash tree. - void publishOutlinedHashTree(std::unique_ptr HashTree) { - PublishedHashTree = std::move(HashTree); - // Ensure we disable emitCGData as we do not want to read and write both. - EmitCGData = false; - } -}; - -namespace cgdata { - -inline bool hasOutlinedHashTree() { - return CodeGenData::getInstance().hasOutlinedHashTree(); -} - -inline const OutlinedHashTree *getOutlinedHashTree() { - return CodeGenData::getInstance().getOutlinedHashTree(); -} - -inline bool emitCGData() { return CodeGenData::getInstance().emitCGData(); } - -inline void -publishOutlinedHashTree(std::unique_ptr HashTree) { - CodeGenData::getInstance().publishOutlinedHashTree(std::move(HashTree)); -} - -void warn(Error E, StringRef Whence = ""); -void warn(Twine Message, std::string Whence = "", std::string Hint = ""); - -} // end namespace cgdata - -namespace IndexedCGData { - -// A signature for data validation, representing "\xffcgdata\x81" in -// little-endian order -const uint64_t Magic = 0x81617461646763ff; - -enum CGDataVersion { - // Version 1 is the first version. This version supports the outlined - // hash tree. - Version1 = 1, - CurrentVersion = CG_DATA_INDEX_VERSION -}; -const uint64_t Version = CGDataVersion::CurrentVersion; - -struct Header { - uint64_t Magic; - uint32_t Version; - uint32_t DataKind; - uint64_t OutlinedHashTreeOffset; - - // New fields should only be added at the end to ensure that the size - // computation is correct. The methods below need to be updated to ensure that - // the new field is read correctly. - - // Reads a header struct from the buffer. - static Expected
readFromBuffer(const unsigned char *Curr); -}; - -} // end namespace IndexedCGData - -} // end namespace llvm - -#endif // LLVM_CODEGEN_PREPARE_H diff --git a/llvm/include/llvm/CodeGenData/CodeGenData.inc b/llvm/include/llvm/CodeGenData/CodeGenData.inc deleted file mode 100644 index 08ec14ea051a0..0000000000000 --- a/llvm/include/llvm/CodeGenData/CodeGenData.inc +++ /dev/null @@ -1,46 +0,0 @@ -/*===-- CodeGenData.inc ----------------------------------------*- 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 -|* -\*===----------------------------------------------------------------------===*/ -/* - * This is the main file that defines all the data structure, signature, - * constant literals that are shared across compiler, host tools (reader/writer) - * to support codegen data. - * -\*===----------------------------------------------------------------------===*/ - -/* Helper macros. */ -#define CG_DATA_SIMPLE_QUOTE(x) #x -#define CG_DATA_QUOTE(x) CG_DATA_SIMPLE_QUOTE(x) - -#ifdef CG_DATA_SECT_ENTRY -#define CG_DATA_DEFINED -CG_DATA_SECT_ENTRY(CG_outline, CG_DATA_QUOTE(CG_DATA_OUTLINE_COMMON), - CG_DATA_OUTLINE_COFF, "__DATA,") - -#undef CG_DATA_SECT_ENTRY -#endif - -/* section name strings common to all targets other - than WIN32 */ -#define CG_DATA_OUTLINE_COMMON __llvm_outline -/* Since cg data sections are not allocated, we don't need to - * access them at runtime. - */ -#define CG_DATA_OUTLINE_COFF ".loutline" - -#ifdef _WIN32 -/* Runtime section names and name strings. */ -#define CG_DATA_SECT_NAME CG_DATA_OUTLINE_COFF - -#else -/* Runtime section names and name strings. */ -#define CG_DATA_SECT_NAME CG_DATA_QUOTE(CG_DATA_OUTLINE_COMMON) - -#endif - -/* Indexed codegen data format version (start from 1). */ -#define CG_DATA_INDEX_VERSION 1 diff --git a/llvm/include/llvm/CodeGenData/CodeGenDataReader.h b/llvm/include/llvm/CodeGenData/CodeGenDataReader.h deleted file mode 100644 index df4ae3ed24e79..0000000000000 --- a/llvm/include/llvm/CodeGenData/CodeGenDataReader.h +++ /dev/null @@ -1,154 +0,0 @@ -//===- CodeGenDataReader.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 -// -//===----------------------------------------------------------------------===// -// -// This file contains support for reading codegen data. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CODEGENDATA_CODEGENDATAREADER_H -#define LLVM_CODEGENDATA_CODEGENDATAREADER_H - -#include "llvm/CodeGenData/CodeGenData.h" -#include "llvm/CodeGenData/OutlinedHashTreeRecord.h" -#include "llvm/Support/LineIterator.h" -#include "llvm/Support/VirtualFileSystem.h" - -namespace llvm { - -class CodeGenDataReader { - cgdata_error LastError = cgdata_error::success; - std::string LastErrorMsg; - -public: - CodeGenDataReader() = default; - virtual ~CodeGenDataReader() = default; - - /// Read the header. Required before reading first record. - virtual Error read() = 0; - /// Return the codegen data version. - virtual uint32_t getVersion() const = 0; - /// Return the codegen data kind. - virtual CGDataKind getDataKind() const = 0; - /// Return true if the data has an outlined hash tree. - virtual bool hasOutlinedHashTree() const = 0; - /// Return the outlined hash tree that is released from the reader. - std::unique_ptr releaseOutlinedHashTree() { - return std::move(HashTreeRecord.HashTree); - } - - /// Factory method to create an appropriately typed reader for the given - /// codegen data file path and file system. - static Expected> - create(const Twine &Path, vfs::FileSystem &FS); - - /// Factory method to create an appropriately typed reader for the given - /// memory buffer. - static Expected> - create(std::unique_ptr Buffer); - - /// Extract the cgdata embedded in sections from the given object file and - /// merge them into the GlobalOutlineRecord. This is a static helper that - /// is used by `llvm-cgdata merge` or ThinLTO's two-codegen rounds. - static Error mergeFromObjectFile(const object::ObjectFile *Obj, - OutlinedHashTreeRecord &GlobalOutlineRecord); - -protected: - /// The outlined hash tree that has been read. When it's released by - /// releaseOutlinedHashTree(), it's no longer valid. - OutlinedHashTreeRecord HashTreeRecord; - - /// Set the current error and return same. - Error error(cgdata_error Err, const std::string &ErrMsg = "") { - LastError = Err; - LastErrorMsg = ErrMsg; - if (Err == cgdata_error::success) - return Error::success(); - return make_error(Err, ErrMsg); - } - - Error error(Error &&E) { - handleAllErrors(std::move(E), [&](const CGDataError &IPE) { - LastError = IPE.get(); - LastErrorMsg = IPE.getMessage(); - }); - return make_error(LastError, LastErrorMsg); - } - - /// Clear the current error and return a successful one. - Error success() { return error(cgdata_error::success); } -}; - -class IndexedCodeGenDataReader : public CodeGenDataReader { - /// The codegen data file contents. - std::unique_ptr DataBuffer; - /// The header - IndexedCGData::Header Header; - -public: - IndexedCodeGenDataReader(std::unique_ptr DataBuffer) - : DataBuffer(std::move(DataBuffer)) {} - IndexedCodeGenDataReader(const IndexedCodeGenDataReader &) = delete; - IndexedCodeGenDataReader & - operator=(const IndexedCodeGenDataReader &) = delete; - - /// Return true if the given buffer is in binary codegen data format. - static bool hasFormat(const MemoryBuffer &Buffer); - /// Read the contents including the header. - Error read() override; - /// Return the codegen data version. - uint32_t getVersion() const override { return Header.Version; } - /// Return the codegen data kind. - CGDataKind getDataKind() const override { - return static_cast(Header.DataKind); - } - /// Return true if the header indicates the data has an outlined hash tree. - /// This does not mean that the data is still available. - bool hasOutlinedHashTree() const override { - return Header.DataKind & - static_cast(CGDataKind::FunctionOutlinedHashTree); - } -}; - -/// This format is a simple text format that's suitable for test data. -/// The header is a custom format starting with `:` per line to indicate which -/// codegen data is recorded. `#` is used to indicate a comment. -/// The subsequent data is a YAML format per each codegen data in order. -/// Currently, it only has a function outlined hash tree. -class TextCodeGenDataReader : public CodeGenDataReader { - /// The codegen data file contents. - std::unique_ptr DataBuffer; - /// Iterator over the profile data. - line_iterator Line; - /// Describe the kind of the codegen data. - CGDataKind DataKind = CGDataKind::Unknown; - -public: - TextCodeGenDataReader(std::unique_ptr DataBuffer_) - : DataBuffer(std::move(DataBuffer_)), Line(*DataBuffer, true, '#') {} - TextCodeGenDataReader(const TextCodeGenDataReader &) = delete; - TextCodeGenDataReader &operator=(const TextCodeGenDataReader &) = delete; - - /// Return true if the given buffer is in text codegen data format. - static bool hasFormat(const MemoryBuffer &Buffer); - /// Read the contents including the header. - Error read() override; - /// Text format does not have version, so return 0. - uint32_t getVersion() const override { return 0; } - /// Return the codegen data kind. - CGDataKind getDataKind() const override { return DataKind; } - /// Return true if the header indicates the data has an outlined hash tree. - /// This does not mean that the data is still available. - bool hasOutlinedHashTree() const override { - return static_cast(DataKind) & - static_cast(CGDataKind::FunctionOutlinedHashTree); - } -}; - -} // end namespace llvm - -#endif // LLVM_CODEGENDATA_CODEGENDATAREADER_H diff --git a/llvm/include/llvm/CodeGenData/CodeGenDataWriter.h b/llvm/include/llvm/CodeGenData/CodeGenDataWriter.h deleted file mode 100644 index e17ffc3482ec9..0000000000000 --- a/llvm/include/llvm/CodeGenData/CodeGenDataWriter.h +++ /dev/null @@ -1,68 +0,0 @@ -//===- CodeGenDataWriter.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 -// -//===----------------------------------------------------------------------===// -// -// This file contains support for writing codegen data. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CODEGENDATA_CODEGENDATAWRITER_H -#define LLVM_CODEGENDATA_CODEGENDATAWRITER_H - -#include "llvm/CodeGenData/CodeGenData.h" -#include "llvm/CodeGenData/OutlinedHashTreeRecord.h" -#include "llvm/Support/Error.h" - -namespace llvm { - -class CGDataOStream; - -class CodeGenDataWriter { - /// The outlined hash tree to be written. - OutlinedHashTreeRecord HashTreeRecord; - - /// A bit mask describing the kind of the codegen data. - CGDataKind DataKind = CGDataKind::Unknown; - -public: - CodeGenDataWriter() = default; - ~CodeGenDataWriter() = default; - - /// Add the outlined hash tree record. The input Record is released. - void addRecord(OutlinedHashTreeRecord &Record); - - /// Write the codegen data to \c OS - Error write(raw_fd_ostream &OS); - - /// Write the codegen data in text format to \c OS - Error writeText(raw_fd_ostream &OS); - - /// Return the attributes of the current CGData. - CGDataKind getCGDataKind() const { return DataKind; } - - /// Return true if the header indicates the data has an outlined hash tree. - bool hasOutlinedHashTree() const { - return static_cast(DataKind) & - static_cast(CGDataKind::FunctionOutlinedHashTree); - } - -private: - /// The offset of the outlined hash tree in the file. - uint64_t OutlinedHashTreeOffset; - - /// Write the codegen data header to \c COS - Error writeHeader(CGDataOStream &COS); - - /// Write the codegen data header in text to \c OS - Error writeHeaderText(raw_fd_ostream &OS); - - Error writeImpl(CGDataOStream &COS); -}; - -} // end namespace llvm - -#endif // LLVM_CODEGENDATA_CODEGENDATAWRITER_H diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake index 629977cc11d68..1394e4bb7b343 100644 --- a/llvm/include/llvm/Config/llvm-config.h.cmake +++ b/llvm/include/llvm/Config/llvm-config.h.cmake @@ -201,4 +201,7 @@ /* Define if logf128 is available */ #cmakedefine LLVM_HAS_LOGF128 +/* Mono api version */ +#cmakedefine MONO_API_VERSION ${MONO_API_VERSION} + #endif diff --git a/llvm/include/llvm/IR/CallingConv.h b/llvm/include/llvm/IR/CallingConv.h index 55e32028e3ed0..c09aafe9e79bf 100644 --- a/llvm/include/llvm/IR/CallingConv.h +++ b/llvm/include/llvm/IR/CallingConv.h @@ -89,6 +89,9 @@ namespace CallingConv { /// Used for runtime calls that preserves none general registers. PreserveNone = 21, + // Mono - Calling convention used by Mono + Mono = 22, + /// This is the start of the target-specific calling conventions, e.g. /// fastcall and thiscall on X86. FirstTargetCC = 64, diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h index fe3f92da400f8..94c8fa092f45e 100644 --- a/llvm/include/llvm/IR/IntrinsicInst.h +++ b/llvm/include/llvm/IR/IntrinsicInst.h @@ -569,6 +569,10 @@ class VPIntrinsic : public IntrinsicInst { /// The llvm.vp.* intrinsics for this instruction Opcode static Intrinsic::ID getForOpcode(unsigned OC); + /// The llvm.vp.* intrinsics for this intrinsic ID \p Id. Return \p Id if it + /// is already a VP intrinsic. + static Intrinsic::ID getForIntrinsic(Intrinsic::ID Id); + // Whether \p ID is a VP intrinsic ID. static bool isVPIntrinsic(Intrinsic::ID); diff --git a/llvm/include/llvm/IR/IntrinsicsBPF.td b/llvm/include/llvm/IR/IntrinsicsBPF.td index c7ec0916f1d1f..d02eaa6d0dff6 100644 --- a/llvm/include/llvm/IR/IntrinsicsBPF.td +++ b/llvm/include/llvm/IR/IntrinsicsBPF.td @@ -13,11 +13,11 @@ // Specialized loads from packet let TargetPrefix = "bpf" in { // All intrinsics start with "llvm.bpf." def int_bpf_load_byte : ClangBuiltin<"__builtin_bpf_load_byte">, - Intrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>; + DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>; def int_bpf_load_half : ClangBuiltin<"__builtin_bpf_load_half">, - Intrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>; + DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>; def int_bpf_load_word : ClangBuiltin<"__builtin_bpf_load_word">, - Intrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>; + DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>; def int_bpf_pseudo : ClangBuiltin<"__builtin_bpf_pseudo">, Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty]>; def int_bpf_preserve_field_info : ClangBuiltin<"__builtin_bpf_preserve_field_info">, diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h index 22da54a1f03c5..7b54c74fb1b9d 100644 --- a/llvm/include/llvm/IR/Metadata.h +++ b/llvm/include/llvm/IR/Metadata.h @@ -846,8 +846,10 @@ struct AAMDNodes { AAMDNodes concat(const AAMDNodes &Other) const; /// Create a new AAMDNode for accessing \p AccessSize bytes of this AAMDNode. - /// If his AAMDNode has !tbaa.struct and \p AccessSize matches the size of the - /// field at offset 0, get the TBAA tag describing the accessed field. + /// If this AAMDNode has !tbaa.struct and \p AccessSize matches the size of + /// the field at offset 0, get the TBAA tag describing the accessed field. + /// If such an AAMDNode already embeds !tbaa, the existing one is retrieved. + /// Finally, !tbaa.struct is zeroed out. AAMDNodes adjustForAccess(unsigned AccessSize); AAMDNodes adjustForAccess(size_t Offset, Type *AccessTy, const DataLayout &DL); diff --git a/llvm/include/llvm/IR/VectorBuilder.h b/llvm/include/llvm/IR/VectorBuilder.h index 6af7f6075551d..dbb9f4c7336d5 100644 --- a/llvm/include/llvm/IR/VectorBuilder.h +++ b/llvm/include/llvm/IR/VectorBuilder.h @@ -15,7 +15,6 @@ #ifndef LLVM_IR_VECTORBUILDER_H #define LLVM_IR_VECTORBUILDER_H -#include #include #include #include @@ -100,11 +99,11 @@ class VectorBuilder { const Twine &Name = Twine()); /// Emit a VP reduction intrinsic call for recurrence kind. - /// \param Kind The kind of recurrence + /// \param RdxID The intrinsic ID of llvm.vector.reduce.* /// \param ValTy The type of operand which the reduction operation is /// performed. /// \param VecOpArray The operand list. - Value *createSimpleTargetReduction(RecurKind Kind, Type *ValTy, + Value *createSimpleTargetReduction(Intrinsic::ID RdxID, Type *ValTy, ArrayRef VecOpArray, const Twine &Name = Twine()); }; diff --git a/llvm/include/llvm/MC/MCAsmBackend.h b/llvm/include/llvm/MC/MCAsmBackend.h index 736f44686689b..3f88ac02cd92a 100644 --- a/llvm/include/llvm/MC/MCAsmBackend.h +++ b/llvm/include/llvm/MC/MCAsmBackend.h @@ -217,15 +217,14 @@ class MCAsmBackend { virtual bool writeNopData(raw_ostream &OS, uint64_t Count, const MCSubtargetInfo *STI) const = 0; - // Return true if fragment offsets have been adjusted and an extra layout - // iteration is needed. - virtual bool finishLayout(const MCAssembler &Asm) const { return false; } + /// Give backend an opportunity to finish layout after relaxation + virtual void finishLayout(MCAssembler const &Asm) const {} /// Handle any target-specific assembler flags. By default, do nothing. virtual void handleAssemblerFlag(MCAssemblerFlag Flag) {} /// Generate the compact unwind encoding for the CFI instructions. - virtual uint32_t generateCompactUnwindEncoding(const MCDwarfFrameInfo *FI, + virtual uint64_t generateCompactUnwindEncoding(const MCDwarfFrameInfo *FI, const MCContext *Ctxt) const { return 0; } diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h index d9752912ee66a..c6fa48128d189 100644 --- a/llvm/include/llvm/MC/MCAssembler.h +++ b/llvm/include/llvm/MC/MCAssembler.h @@ -111,7 +111,6 @@ class MCAssembler { /// Check whether the given fragment needs relaxation. bool fragmentNeedsRelaxation(const MCRelaxableFragment *IF) const; - void layoutSection(MCSection &Sec); /// Perform one layout iteration and return true if any offsets /// were adjusted. bool layoutOnce(); @@ -148,9 +147,10 @@ class MCAssembler { uint64_t computeFragmentSize(const MCFragment &F) const; void layoutBundle(MCFragment *Prev, MCFragment *F) const; + void ensureValid(MCSection &Sec) const; // Get the offset of the given fragment inside its containing section. - uint64_t getFragmentOffset(const MCFragment &F) const { return F.Offset; } + uint64_t getFragmentOffset(const MCFragment &F) const; uint64_t getSectionAddressSize(const MCSection &Sec) const; uint64_t getSectionFileSize(const MCSection &Sec) const; diff --git a/llvm/include/llvm/MC/MCDwarf.h b/llvm/include/llvm/MC/MCDwarf.h index d0e45ab59a92e..7dba67efa22fa 100644 --- a/llvm/include/llvm/MC/MCDwarf.h +++ b/llvm/include/llvm/MC/MCDwarf.h @@ -509,11 +509,11 @@ class MCCFIInstruction { union { struct { unsigned Register; - int Offset; + int64_t Offset; } RI; struct { unsigned Register; - int Offset; + int64_t Offset; unsigned AddressSpace; } RIA; struct { @@ -527,7 +527,7 @@ class MCCFIInstruction { std::vector Values; std::string Comment; - MCCFIInstruction(OpType Op, MCSymbol *L, unsigned R, int O, SMLoc Loc, + MCCFIInstruction(OpType Op, MCSymbol *L, unsigned R, int64_t O, SMLoc Loc, StringRef V = "", StringRef Comment = "") : Label(L), Operation(Op), Loc(Loc), Values(V.begin(), V.end()), Comment(Comment) { @@ -539,7 +539,7 @@ class MCCFIInstruction { assert(Op == OpRegister); U.RR = {R1, R2}; } - MCCFIInstruction(OpType Op, MCSymbol *L, unsigned R, int O, unsigned AS, + MCCFIInstruction(OpType Op, MCSymbol *L, unsigned R, int64_t O, unsigned AS, SMLoc Loc) : Label(L), Operation(Op), Loc(Loc) { assert(Op == OpLLVMDefAspaceCfa); @@ -555,8 +555,8 @@ class MCCFIInstruction { public: /// .cfi_def_cfa defines a rule for computing CFA as: take address from /// Register and add Offset to it. - static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register, int Offset, - SMLoc Loc = {}) { + static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register, + int64_t Offset, SMLoc Loc = {}) { return MCCFIInstruction(OpDefCfa, L, Register, Offset, Loc); } @@ -564,13 +564,13 @@ class MCCFIInstruction { /// on Register will be used instead of the old one. Offset remains the same. static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register, SMLoc Loc = {}) { - return MCCFIInstruction(OpDefCfaRegister, L, Register, 0, Loc); + return MCCFIInstruction(OpDefCfaRegister, L, Register, INT64_C(0), Loc); } /// .cfi_def_cfa_offset modifies a rule for computing CFA. Register /// remains the same, but offset is new. Note that it is the absolute offset /// that will be added to a defined register to the compute CFA address. - static MCCFIInstruction cfiDefCfaOffset(MCSymbol *L, int Offset, + static MCCFIInstruction cfiDefCfaOffset(MCSymbol *L, int64_t Offset, SMLoc Loc = {}) { return MCCFIInstruction(OpDefCfaOffset, L, 0, Offset, Loc); } @@ -578,7 +578,7 @@ class MCCFIInstruction { /// .cfi_adjust_cfa_offset Same as .cfi_def_cfa_offset, but /// Offset is a relative value that is added/subtracted from the previous /// offset. - static MCCFIInstruction createAdjustCfaOffset(MCSymbol *L, int Adjustment, + static MCCFIInstruction createAdjustCfaOffset(MCSymbol *L, int64_t Adjustment, SMLoc Loc = {}) { return MCCFIInstruction(OpAdjustCfaOffset, L, 0, Adjustment, Loc); } @@ -588,7 +588,7 @@ class MCCFIInstruction { /// be the result of evaluating the DWARF operation expression /// `DW_OP_constu AS; DW_OP_aspace_bregx R, B` as a location description. static MCCFIInstruction createLLVMDefAspaceCfa(MCSymbol *L, unsigned Register, - int Offset, + int64_t Offset, unsigned AddressSpace, SMLoc Loc) { return MCCFIInstruction(OpLLVMDefAspaceCfa, L, Register, Offset, @@ -598,7 +598,7 @@ class MCCFIInstruction { /// .cfi_offset Previous value of Register is saved at offset Offset /// from CFA. static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, - int Offset, SMLoc Loc = {}) { + int64_t Offset, SMLoc Loc = {}) { return MCCFIInstruction(OpOffset, L, Register, Offset, Loc); } @@ -606,7 +606,7 @@ class MCCFIInstruction { /// Offset from the current CFA register. This is transformed to .cfi_offset /// using the known displacement of the CFA register from the CFA. static MCCFIInstruction createRelOffset(MCSymbol *L, unsigned Register, - int Offset, SMLoc Loc = {}) { + int64_t Offset, SMLoc Loc = {}) { return MCCFIInstruction(OpRelOffset, L, Register, Offset, Loc); } @@ -619,12 +619,12 @@ class MCCFIInstruction { /// .cfi_window_save SPARC register window is saved. static MCCFIInstruction createWindowSave(MCSymbol *L, SMLoc Loc = {}) { - return MCCFIInstruction(OpWindowSave, L, 0, 0, Loc); + return MCCFIInstruction(OpWindowSave, L, 0, INT64_C(0), Loc); } /// .cfi_negate_ra_state AArch64 negate RA state. static MCCFIInstruction createNegateRAState(MCSymbol *L, SMLoc Loc = {}) { - return MCCFIInstruction(OpNegateRAState, L, 0, 0, Loc); + return MCCFIInstruction(OpNegateRAState, L, 0, INT64_C(0), Loc); } /// .cfi_restore says that the rule for Register is now the same as it @@ -632,31 +632,31 @@ class MCCFIInstruction { /// by .cfi_startproc were executed. static MCCFIInstruction createRestore(MCSymbol *L, unsigned Register, SMLoc Loc = {}) { - return MCCFIInstruction(OpRestore, L, Register, 0, Loc); + return MCCFIInstruction(OpRestore, L, Register, INT64_C(0), Loc); } /// .cfi_undefined From now on the previous value of Register can't be /// restored anymore. static MCCFIInstruction createUndefined(MCSymbol *L, unsigned Register, SMLoc Loc = {}) { - return MCCFIInstruction(OpUndefined, L, Register, 0, Loc); + return MCCFIInstruction(OpUndefined, L, Register, INT64_C(0), Loc); } /// .cfi_same_value Current value of Register is the same as in the /// previous frame. I.e., no restoration is needed. static MCCFIInstruction createSameValue(MCSymbol *L, unsigned Register, SMLoc Loc = {}) { - return MCCFIInstruction(OpSameValue, L, Register, 0, Loc); + return MCCFIInstruction(OpSameValue, L, Register, INT64_C(0), Loc); } /// .cfi_remember_state Save all current rules for all registers. static MCCFIInstruction createRememberState(MCSymbol *L, SMLoc Loc = {}) { - return MCCFIInstruction(OpRememberState, L, 0, 0, Loc); + return MCCFIInstruction(OpRememberState, L, 0, INT64_C(0), Loc); } /// .cfi_restore_state Restore the previously saved state. static MCCFIInstruction createRestoreState(MCSymbol *L, SMLoc Loc = {}) { - return MCCFIInstruction(OpRestoreState, L, 0, 0, Loc); + return MCCFIInstruction(OpRestoreState, L, 0, INT64_C(0), Loc); } /// .cfi_escape Allows the user to add arbitrary bytes to the unwind @@ -667,7 +667,7 @@ class MCCFIInstruction { } /// A special wrapper for .cfi_escape that indicates GNU_ARGS_SIZE - static MCCFIInstruction createGnuArgsSize(MCSymbol *L, int Size, + static MCCFIInstruction createGnuArgsSize(MCSymbol *L, int64_t Size, SMLoc Loc = {}) { return MCCFIInstruction(OpGnuArgsSize, L, 0, Size, Loc); } @@ -702,7 +702,7 @@ class MCCFIInstruction { return U.RIA.AddressSpace; } - int getOffset() const { + int64_t getOffset() const { if (Operation == OpLLVMDefAspaceCfa) return U.RIA.Offset; assert(Operation == OpDefCfa || Operation == OpOffset || @@ -736,7 +736,7 @@ struct MCDwarfFrameInfo { unsigned CurrentCfaRegister = 0; unsigned PersonalityEncoding = 0; unsigned LsdaEncoding = 0; - uint32_t CompactUnwindEncoding = 0; + uint64_t CompactUnwindEncoding = 0; bool IsSignalFrame = false; bool IsSimple = false; unsigned RAReg = static_cast(INT_MAX); diff --git a/llvm/include/llvm/MC/MCObjectFileInfo.h b/llvm/include/llvm/MC/MCObjectFileInfo.h index dda3e8a020f3a..16a18b8d2c41f 100644 --- a/llvm/include/llvm/MC/MCObjectFileInfo.h +++ b/llvm/include/llvm/MC/MCObjectFileInfo.h @@ -348,7 +348,7 @@ class MCObjectFileInfo { } MCSection *getTLSExtraDataSection() const { return TLSExtraDataSection; } - const MCSection *getTLSDataSection() const { return TLSDataSection; } + MCSection *getTLSDataSection() const { return TLSDataSection; } MCSection *getTLSBSSSection() const { return TLSBSSSection; } MCSection *getStackMapSection() const { return StackMapSection; } diff --git a/llvm/include/llvm/MC/MCSection.h b/llvm/include/llvm/MC/MCSection.h index 1289d6f6f9f65..dcdcd094fa17b 100644 --- a/llvm/include/llvm/MC/MCSection.h +++ b/llvm/include/llvm/MC/MCSection.h @@ -99,6 +99,8 @@ class MCSection { /// Whether this section has had instructions emitted into it. bool HasInstructions : 1; + bool HasLayout : 1; + bool IsRegistered : 1; bool IsText : 1; @@ -167,6 +169,9 @@ class MCSection { bool hasInstructions() const { return HasInstructions; } void setHasInstructions(bool Value) { HasInstructions = Value; } + bool hasLayout() const { return HasLayout; } + void setHasLayout(bool Value) { HasLayout = Value; } + bool isRegistered() const { return IsRegistered; } void setIsRegistered(bool Value) { IsRegistered = Value; } diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h index 78aa12062102c..7f5325a988d85 100644 --- a/llvm/include/llvm/MC/MCStreamer.h +++ b/llvm/include/llvm/MC/MCStreamer.h @@ -1020,6 +1020,7 @@ class MCStreamer { virtual void emitCFIWindowSave(SMLoc Loc = {}); virtual void emitCFINegateRAState(SMLoc Loc = {}); virtual void emitCFILabelDirective(SMLoc Loc, StringRef Name); + virtual void emitCFICompactUnwindEncoding(unsigned Encoding); virtual void emitWinCFIStartProc(const MCSymbol *Symbol, SMLoc Loc = SMLoc()); virtual void emitWinCFIEndProc(SMLoc Loc = SMLoc()); diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h index 0d0fa826f7bba..e568e42afcf4d 100644 --- a/llvm/include/llvm/Support/MathExtras.h +++ b/llvm/include/llvm/Support/MathExtras.h @@ -770,6 +770,14 @@ std::enable_if_t, T> MulOverflow(T X, T Y, T &Result) { #endif } +/// Type to force float point values onto the stack, so that x86 doesn't add +/// hidden precision, avoiding rounding differences on various platforms. +#if defined(__i386__) || defined(_M_IX86) +using stack_float_t = volatile float; +#else +using stack_float_t = float; +#endif + } // namespace llvm #endif diff --git a/llvm/include/llvm/TargetParser/PPCTargetParser.def b/llvm/include/llvm/TargetParser/PPCTargetParser.def index 44e97d56a059c..df956a68d75d6 100644 --- a/llvm/include/llvm/TargetParser/PPCTargetParser.def +++ b/llvm/include/llvm/TargetParser/PPCTargetParser.def @@ -40,6 +40,7 @@ #undef AIX_PPC8_VALUE #undef AIX_PPC9_VALUE #undef AIX_PPC10_VALUE +#undef AIX_PPC11_VALUE #else #ifndef PPC_LNX_FEATURE #define PPC_LNX_FEATURE(NAME, DESC, ENUMNAME, ENUMVAL, HWCAPN) @@ -84,6 +85,7 @@ #define AIX_PPC8_VALUE 0x00010000 #define AIX_PPC9_VALUE 0x00020000 #define AIX_PPC10_VALUE 0x00040000 +#define AIX_PPC11_VALUE 0x00080000 // __builtin_cpu_is() and __builtin_cpu_supports() are supported only on Power7 and up on AIX. // PPC_CPU(Name, Linux_SUPPORT_METHOD, LinuxID, AIX_SUPPORT_METHOD, AIXID) @@ -103,6 +105,7 @@ PPC_CPU("ppc476",SYS_CALL,44,BUILTIN_PPC_FALSE,0) PPC_CPU("power8",SYS_CALL,45,USE_SYS_CONF,AIX_PPC8_VALUE) PPC_CPU("power9",SYS_CALL,46,USE_SYS_CONF,AIX_PPC9_VALUE) PPC_CPU("power10",SYS_CALL,47,USE_SYS_CONF,AIX_PPC10_VALUE) +PPC_CPU("power11",SYS_CALL,48,USE_SYS_CONF,AIX_PPC11_VALUE) #undef PPC_CPU // PPC features on Linux: diff --git a/llvm/include/llvm/TargetParser/X86TargetParser.def b/llvm/include/llvm/TargetParser/X86TargetParser.def index 92798cbe4b4c1..008cf5381c126 100644 --- a/llvm/include/llvm/TargetParser/X86TargetParser.def +++ b/llvm/include/llvm/TargetParser/X86TargetParser.def @@ -49,11 +49,13 @@ X86_CPU_TYPE(ZHAOXIN_FAM7H, "zhaoxin_fam7h") X86_CPU_TYPE(INTEL_SIERRAFOREST, "sierraforest") X86_CPU_TYPE(INTEL_GRANDRIDGE, "grandridge") X86_CPU_TYPE(INTEL_CLEARWATERFOREST, "clearwaterforest") +X86_CPU_TYPE(AMDFAM1AH, "amdfam1ah") // Alternate names supported by __builtin_cpu_is and target multiversioning. X86_CPU_TYPE_ALIAS(INTEL_BONNELL, "atom") X86_CPU_TYPE_ALIAS(AMDFAM10H, "amdfam10") X86_CPU_TYPE_ALIAS(AMDFAM15H, "amdfam15") +X86_CPU_TYPE_ALIAS(AMDFAM1AH, "amdfam1a") X86_CPU_TYPE_ALIAS(INTEL_SILVERMONT, "slm") #undef X86_CPU_TYPE_ALIAS @@ -104,6 +106,7 @@ X86_CPU_SUBTYPE(INTEL_COREI7_GRANITERAPIDS_D,"graniterapids-d") X86_CPU_SUBTYPE(INTEL_COREI7_ARROWLAKE, "arrowlake") X86_CPU_SUBTYPE(INTEL_COREI7_ARROWLAKE_S, "arrowlake-s") X86_CPU_SUBTYPE(INTEL_COREI7_PANTHERLAKE, "pantherlake") +X86_CPU_SUBTYPE(AMDFAM1AH_ZNVER5, "znver5") // Alternate names supported by __builtin_cpu_is and target multiversioning. X86_CPU_SUBTYPE_ALIAS(INTEL_COREI7_ALDERLAKE, "raptorlake") diff --git a/llvm/include/llvm/TargetParser/X86TargetParser.h b/llvm/include/llvm/TargetParser/X86TargetParser.h index 2083e585af4ac..5468aaa81edb7 100644 --- a/llvm/include/llvm/TargetParser/X86TargetParser.h +++ b/llvm/include/llvm/TargetParser/X86TargetParser.h @@ -147,6 +147,7 @@ enum CPUKind { CK_x86_64_v3, CK_x86_64_v4, CK_Geode, + CK_ZNVER5, }; /// Parse \p CPU string into a CPUKind. Will only accept 64-bit capable CPUs if diff --git a/llvm/include/llvm/Transforms/Utils/LoopUtils.h b/llvm/include/llvm/Transforms/Utils/LoopUtils.h index b01a447f3c28b..56880bd4822c7 100644 --- a/llvm/include/llvm/Transforms/Utils/LoopUtils.h +++ b/llvm/include/llvm/Transforms/Utils/LoopUtils.h @@ -359,6 +359,10 @@ bool canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT, SinkAndHoistLICMFlags &LICMFlags, OptimizationRemarkEmitter *ORE = nullptr); +/// Returns the llvm.vector.reduce intrinsic that corresponds to the recurrence +/// kind. +constexpr Intrinsic::ID getReductionIntrinsicID(RecurKind RK); + /// Returns the arithmetic instruction opcode used when expanding a reduction. unsigned getArithmeticReductionInstruction(Intrinsic::ID RdxID); diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 161a3034e4829..e474899fb548e 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -1692,9 +1692,12 @@ AliasResult BasicAAResult::aliasCheck(const Value *V1, LocationSize V1Size, if (!Pair.second) { auto &Entry = Pair.first->second; if (!Entry.isDefinitive()) { - // Remember that we used an assumption. - ++Entry.NumAssumptionUses; + // Remember that we used an assumption. This may either be a direct use + // of an assumption, or a use of an entry that may itself be based on an + // assumption. ++AAQI.NumAssumptionUses; + if (Entry.isAssumption()) + ++Entry.NumAssumptionUses; } // Cache contains sorted {V1,V2} pairs but we should return original order. auto Result = Entry.Result; @@ -1722,7 +1725,6 @@ AliasResult BasicAAResult::aliasCheck(const Value *V1, LocationSize V1Size, Entry.Result = Result; // Cache contains sorted {V1,V2} pairs. Entry.Result.swap(Swapped); - Entry.NumAssumptionUses = -1; // If the assumption has been disproven, remove any results that may have // been based on this assumption. Do this after the Entry updates above to @@ -1734,8 +1736,26 @@ AliasResult BasicAAResult::aliasCheck(const Value *V1, LocationSize V1Size, // The result may still be based on assumptions higher up in the chain. // Remember it, so it can be purged from the cache later. if (OrigNumAssumptionUses != AAQI.NumAssumptionUses && - Result != AliasResult::MayAlias) + Result != AliasResult::MayAlias) { AAQI.AssumptionBasedResults.push_back(Locs); + Entry.NumAssumptionUses = AAQueryInfo::CacheEntry::AssumptionBased; + } else { + Entry.NumAssumptionUses = AAQueryInfo::CacheEntry::Definitive; + } + + // Depth is incremented before this function is called, so Depth==1 indicates + // a root query. + if (AAQI.Depth == 1) { + // Any remaining assumption based results must be based on proven + // assumptions, so convert them to definitive results. + for (const auto &Loc : AAQI.AssumptionBasedResults) { + auto It = AAQI.AliasCache.find(Loc); + if (It != AAQI.AliasCache.end()) + It->second.NumAssumptionUses = AAQueryInfo::CacheEntry::Definitive; + } + AAQI.AssumptionBasedResults.clear(); + AAQI.NumAssumptionUses = 0; + } return Result; } diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index 84214c47a10e1..f3fc69c86cd1e 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -728,11 +728,6 @@ class AccessAnalysis { MemAccessInfoList &getDependenciesToCheck() { return CheckDeps; } - const DenseMap> & - getUnderlyingObjects() { - return UnderlyingObjects; - } - private: typedef MapVector> PtrAccessMap; @@ -1459,22 +1454,23 @@ static bool isNoWrapAddRec(Value *Ptr, const SCEVAddRecExpr *AR, } /// Check whether the access through \p Ptr has a constant stride. -std::optional llvm::getPtrStride(PredicatedScalarEvolution &PSE, - Type *AccessTy, Value *Ptr, - const Loop *Lp, - const DenseMap &StridesMap, - bool Assume, bool ShouldCheckWrap) { +std::optional +llvm::getPtrStride(PredicatedScalarEvolution &PSE, Type *AccessTy, Value *Ptr, + const Loop *Lp, + const DenseMap &StridesMap, + bool Assume, bool ShouldCheckWrap) { + const SCEV *PtrScev = replaceSymbolicStrideSCEV(PSE, StridesMap, Ptr); + if (PSE.getSE()->isLoopInvariant(PtrScev, Lp)) + return {0}; + Type *Ty = Ptr->getType(); assert(Ty->isPointerTy() && "Unexpected non-ptr"); - if (isa(AccessTy)) { LLVM_DEBUG(dbgs() << "LAA: Bad stride - Scalable object: " << *AccessTy << "\n"); return std::nullopt; } - const SCEV *PtrScev = replaceSymbolicStrideSCEV(PSE, StridesMap, Ptr); - const SCEVAddRecExpr *AR = dyn_cast(PtrScev); if (Assume && !AR) AR = PSE.getAsAddRec(Ptr); @@ -1899,24 +1895,12 @@ static bool areStridedAccessesIndependent(uint64_t Distance, uint64_t Stride, return ScaledDist % Stride; } -/// Returns true if any of the underlying objects has a loop varying address, -/// i.e. may change in \p L. -static bool -isLoopVariantIndirectAddress(ArrayRef UnderlyingObjects, - ScalarEvolution &SE, const Loop *L) { - return any_of(UnderlyingObjects, [&SE, L](const Value *UO) { - return !SE.isLoopInvariant(SE.getSCEV(const_cast(UO)), L); - }); -} - std::variant MemoryDepChecker::getDependenceDistanceStrideAndSize( const AccessAnalysis::MemAccessInfo &A, Instruction *AInst, - const AccessAnalysis::MemAccessInfo &B, Instruction *BInst, - const DenseMap> - &UnderlyingObjects) { - auto &DL = InnermostLoop->getHeader()->getDataLayout(); + const AccessAnalysis::MemAccessInfo &B, Instruction *BInst) { + const auto &DL = InnermostLoop->getHeader()->getDataLayout(); auto &SE = *PSE.getSE(); auto [APtr, AIsWrite] = A; auto [BPtr, BIsWrite] = B; @@ -1933,12 +1917,10 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize( BPtr->getType()->getPointerAddressSpace()) return MemoryDepChecker::Dependence::Unknown; - int64_t StrideAPtr = - getPtrStride(PSE, ATy, APtr, InnermostLoop, SymbolicStrides, true) - .value_or(0); - int64_t StrideBPtr = - getPtrStride(PSE, BTy, BPtr, InnermostLoop, SymbolicStrides, true) - .value_or(0); + std::optional StrideAPtr = + getPtrStride(PSE, ATy, APtr, InnermostLoop, SymbolicStrides, true, true); + std::optional StrideBPtr = + getPtrStride(PSE, BTy, BPtr, InnermostLoop, SymbolicStrides, true, true); const SCEV *Src = PSE.getSCEV(APtr); const SCEV *Sink = PSE.getSCEV(BPtr); @@ -1946,26 +1928,19 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize( // If the induction step is negative we have to invert source and sink of the // dependence when measuring the distance between them. We should not swap // AIsWrite with BIsWrite, as their uses expect them in program order. - if (StrideAPtr < 0) { + if (StrideAPtr && *StrideAPtr < 0) { std::swap(Src, Sink); std::swap(AInst, BInst); + std::swap(StrideAPtr, StrideBPtr); } const SCEV *Dist = SE.getMinusSCEV(Sink, Src); LLVM_DEBUG(dbgs() << "LAA: Src Scev: " << *Src << "Sink Scev: " << *Sink - << "(Induction step: " << StrideAPtr << ")\n"); + << "\n"); LLVM_DEBUG(dbgs() << "LAA: Distance for " << *AInst << " to " << *BInst << ": " << *Dist << "\n"); - // Needs accesses where the addresses of the accessed underlying objects do - // not change within the loop. - if (isLoopVariantIndirectAddress(UnderlyingObjects.find(APtr)->second, SE, - InnermostLoop) || - isLoopVariantIndirectAddress(UnderlyingObjects.find(BPtr)->second, SE, - InnermostLoop)) - return MemoryDepChecker::Dependence::IndirectUnsafe; - // Check if we can prove that Sink only accesses memory after Src's end or // vice versa. At the moment this is limited to cases where either source or // sink are loop invariant to avoid compile-time increases. This is not @@ -1987,12 +1962,33 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize( } } - // Need accesses with constant strides and the same direction. We don't want - // to vectorize "A[B[i]] += ..." and similar code or pointer arithmetic that - // could wrap in the address space. - if (!StrideAPtr || !StrideBPtr || (StrideAPtr > 0 && StrideBPtr < 0) || - (StrideAPtr < 0 && StrideBPtr > 0)) { + // Need accesses with constant strides and the same direction for further + // dependence analysis. We don't want to vectorize "A[B[i]] += ..." and + // similar code or pointer arithmetic that could wrap in the address space. + + // If either Src or Sink are not strided (i.e. not a non-wrapping AddRec) and + // not loop-invariant (stride will be 0 in that case), we cannot analyze the + // dependence further and also cannot generate runtime checks. + if (!StrideAPtr || !StrideBPtr) { LLVM_DEBUG(dbgs() << "Pointer access with non-constant stride\n"); + return MemoryDepChecker::Dependence::IndirectUnsafe; + } + + int64_t StrideAPtrInt = *StrideAPtr; + int64_t StrideBPtrInt = *StrideBPtr; + LLVM_DEBUG(dbgs() << "LAA: Src induction step: " << StrideAPtrInt + << " Sink induction step: " << StrideBPtrInt << "\n"); + // At least Src or Sink are loop invariant and the other is strided or + // invariant. We can generate a runtime check to disambiguate the accesses. + if (StrideAPtrInt == 0 || StrideBPtrInt == 0) + return MemoryDepChecker::Dependence::Unknown; + + // Both Src and Sink have a constant stride, check if they are in the same + // direction. + if ((StrideAPtrInt > 0 && StrideBPtrInt < 0) || + (StrideAPtrInt < 0 && StrideBPtrInt > 0)) { + LLVM_DEBUG( + dbgs() << "Pointer access with strides in different directions\n"); return MemoryDepChecker::Dependence::Unknown; } @@ -2001,22 +1997,20 @@ MemoryDepChecker::getDependenceDistanceStrideAndSize( DL.getTypeStoreSizeInBits(ATy) == DL.getTypeStoreSizeInBits(BTy); if (!HasSameSize) TypeByteSize = 0; - return DepDistanceStrideAndSizeInfo(Dist, std::abs(StrideAPtr), - std::abs(StrideBPtr), TypeByteSize, + return DepDistanceStrideAndSizeInfo(Dist, std::abs(StrideAPtrInt), + std::abs(StrideBPtrInt), TypeByteSize, AIsWrite, BIsWrite); } -MemoryDepChecker::Dependence::DepType MemoryDepChecker::isDependent( - const MemAccessInfo &A, unsigned AIdx, const MemAccessInfo &B, - unsigned BIdx, - const DenseMap> - &UnderlyingObjects) { +MemoryDepChecker::Dependence::DepType +MemoryDepChecker::isDependent(const MemAccessInfo &A, unsigned AIdx, + const MemAccessInfo &B, unsigned BIdx) { assert(AIdx < BIdx && "Must pass arguments in program order"); // Get the dependence distance, stride, type size and what access writes for // the dependence between A and B. - auto Res = getDependenceDistanceStrideAndSize( - A, InstMap[AIdx], B, InstMap[BIdx], UnderlyingObjects); + auto Res = + getDependenceDistanceStrideAndSize(A, InstMap[AIdx], B, InstMap[BIdx]); if (std::holds_alternative(Res)) return std::get(Res); @@ -2250,10 +2244,8 @@ MemoryDepChecker::Dependence::DepType MemoryDepChecker::isDependent( return Dependence::BackwardVectorizable; } -bool MemoryDepChecker::areDepsSafe( - DepCandidates &AccessSets, MemAccessInfoList &CheckDeps, - const DenseMap> - &UnderlyingObjects) { +bool MemoryDepChecker::areDepsSafe(const DepCandidates &AccessSets, + const MemAccessInfoList &CheckDeps) { MinDepDistBytes = -1; SmallPtrSet Visited; @@ -2296,8 +2288,8 @@ bool MemoryDepChecker::areDepsSafe( if (*I1 > *I2) std::swap(A, B); - Dependence::DepType Type = isDependent(*A.first, A.second, *B.first, - B.second, UnderlyingObjects); + Dependence::DepType Type = + isDependent(*A.first, A.second, *B.first, B.second); mergeInStatus(Dependence::isSafeForVectorization(Type)); // Gather dependences unless we accumulated MaxDependences @@ -2652,8 +2644,7 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo *LI, if (Accesses.isDependencyCheckNeeded()) { LLVM_DEBUG(dbgs() << "LAA: Checking memory dependencies\n"); DepsAreSafe = DepChecker->areDepsSafe(DependentAccesses, - Accesses.getDependenciesToCheck(), - Accesses.getUnderlyingObjects()); + Accesses.getDependenciesToCheck()); if (!DepsAreSafe && DepChecker->shouldRetryWithRuntimeCheck()) { LLVM_DEBUG(dbgs() << "LAA: Retrying with memory checks\n"); diff --git a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp index e1cb63a9ab8f9..0d7eb7da8d6b6 100644 --- a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp +++ b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp @@ -822,16 +822,16 @@ MDNode *AAMDNodes::extendToTBAA(MDNode *MD, ssize_t Len) { AAMDNodes AAMDNodes::adjustForAccess(unsigned AccessSize) { AAMDNodes New = *this; MDNode *M = New.TBAAStruct; - if (M && M->getNumOperands() >= 3 && M->getOperand(0) && + if (!New.TBAA && M && M->getNumOperands() >= 3 && M->getOperand(0) && mdconst::hasa(M->getOperand(0)) && mdconst::extract(M->getOperand(0))->isZero() && M->getOperand(1) && mdconst::hasa(M->getOperand(1)) && mdconst::extract(M->getOperand(1))->getValue() == AccessSize && - M->getOperand(2) && isa(M->getOperand(2))) { - New.TBAAStruct = nullptr; + M->getOperand(2) && isa(M->getOperand(2))) New.TBAA = cast(M->getOperand(2)); - } + + New.TBAAStruct = nullptr; return New; } diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 40fe1ffe13f1b..4b77c0046cc70 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -1435,7 +1435,7 @@ static void computeKnownBitsFromOperator(const Operator *I, // inferred hold at original context instruction. TODO: It may be // correct to use the original context. IF warranted, explore and // add sufficient tests to cover. - SimplifyQuery RecQ = Q; + SimplifyQuery RecQ = Q.getWithoutCondContext(); RecQ.CxtI = P; computeKnownBits(R, DemandedElts, Known2, Depth + 1, RecQ); switch (Opcode) { @@ -1468,7 +1468,7 @@ static void computeKnownBitsFromOperator(const Operator *I, // phi. This is important because that is where the value is actually // "evaluated" even though it is used later somewhere else. (see also // D69571). - SimplifyQuery RecQ = Q; + SimplifyQuery RecQ = Q.getWithoutCondContext(); unsigned OpNum = P->getOperand(0) == R ? 0 : 1; Instruction *RInst = P->getIncomingBlock(OpNum)->getTerminator(); @@ -1546,7 +1546,7 @@ static void computeKnownBitsFromOperator(const Operator *I, // phi. This is important because that is where the value is actually // "evaluated" even though it is used later somewhere else. (see also // D69571). - SimplifyQuery RecQ = Q; + SimplifyQuery RecQ = Q.getWithoutCondContext(); RecQ.CxtI = P->getIncomingBlock(u)->getTerminator(); Known2 = KnownBits(BitWidth); @@ -2329,7 +2329,7 @@ bool isKnownToBeAPowerOfTwo(const Value *V, bool OrZero, unsigned Depth, // it is an induction variable where in each step its value is a power of // two. auto *PN = cast(I); - SimplifyQuery RecQ = Q; + SimplifyQuery RecQ = Q.getWithoutCondContext(); // Check if it is an induction variable and always power of two. if (isPowerOfTwoRecurrence(PN, OrZero, Depth, RecQ)) @@ -2943,7 +2943,7 @@ static bool isKnownNonZeroFromOperator(const Operator *I, return true; // Check if all incoming values are non-zero using recursion. - SimplifyQuery RecQ = Q; + SimplifyQuery RecQ = Q.getWithoutCondContext(); unsigned NewDepth = std::max(Depth, MaxAnalysisRecursionDepth - 1); return llvm::all_of(PN->operands(), [&](const Use &U) { if (U.get() == PN) @@ -3509,7 +3509,7 @@ static bool isNonEqualPHIs(const PHINode *PN1, const PHINode *PN2, if (UsedFullRecursion) return false; - SimplifyQuery RecQ = Q; + SimplifyQuery RecQ = Q.getWithoutCondContext(); RecQ.CxtI = IncomBB->getTerminator(); if (!isKnownNonEqual(IV1, IV2, DemandedElts, Depth + 1, RecQ)) return false; @@ -4001,7 +4001,7 @@ static unsigned ComputeNumSignBitsImpl(const Value *V, // Take the minimum of all incoming values. This can't infinitely loop // because of our depth threshold. - SimplifyQuery RecQ = Q; + SimplifyQuery RecQ = Q.getWithoutCondContext(); Tmp = TyBits; for (unsigned i = 0, e = NumIncomingValues; i != e; ++i) { if (Tmp == 1) return Tmp; @@ -5909,10 +5909,10 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts, // Recurse, but cap the recursion to two levels, because we don't want // to waste time spinning around in loops. We need at least depth 2 to // detect known sign bits. - computeKnownFPClass( - IncValue, DemandedElts, InterestedClasses, KnownSrc, - PhiRecursionLimit, - Q.getWithInstruction(P->getIncomingBlock(U)->getTerminator())); + computeKnownFPClass(IncValue, DemandedElts, InterestedClasses, KnownSrc, + PhiRecursionLimit, + Q.getWithoutCondContext().getWithInstruction( + P->getIncomingBlock(U)->getTerminator())); if (First) { Known = KnownSrc; diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp index 7d7fe19568e8a..4e58fb29adc41 100644 --- a/llvm/lib/AsmParser/LLLexer.cpp +++ b/llvm/lib/AsmParser/LLLexer.cpp @@ -643,6 +643,7 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(m68k_rtdcc); KEYWORD(graalcc); KEYWORD(riscv_vector_cc); + KEYWORD(monocc); KEYWORD(cc); KEYWORD(c); diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index a886f6e3a4b93..b1d5070704ee4 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -2205,6 +2205,7 @@ void LLParser::parseOptionalDLLStorageClass(unsigned &Res) { /// ::= 'm68k_rtdcc' /// ::= 'graalcc' /// ::= 'riscv_vector_cc' +/// ::= 'monocc' /// ::= 'cc' UINT /// bool LLParser::parseOptionalCallingConv(unsigned &CC) { @@ -2281,6 +2282,7 @@ bool LLParser::parseOptionalCallingConv(unsigned &CC) { case lltok::kw_riscv_vector_cc: CC = CallingConv::RISCV_VectorCall; break; + case lltok::kw_monocc: CC = CallingConv::Mono; break; case lltok::kw_cc: { Lex.Lex(); return parseUInt32(CC); diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 2297b27ffdc07..692f122134865 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -18,6 +18,7 @@ #include "WasmException.h" #include "WinCFGuard.h" #include "WinException.h" +#include "MonoException.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/APInt.h" #include "llvm/ADT/DenseMap.h" @@ -157,6 +158,12 @@ static cl::bits PgoAnalysisMapFeatures( STATISTIC(EmittedInsts, "Number of machine instrs printed"); +cl::opt EnableMonoEH("enable-mono-eh-frame", cl::NotHidden, + cl::desc("Enable generation of Mono specific EH tables")); + +static cl::opt DisableGNUEH("disable-gnu-eh-frame", cl::NotHidden, + cl::desc("Disable generation of GNU .eh_frame")); + char AsmPrinter::ID = 0; namespace { @@ -583,10 +590,12 @@ bool AsmPrinter::doInitialization(Module &M) { case ExceptionHandling::SjLj: case ExceptionHandling::DwarfCFI: case ExceptionHandling::ZOS: - ES = new DwarfCFIException(this); + if (!DisableGNUEH) + ES = new DwarfCFIException(this); break; case ExceptionHandling::ARM: - ES = new ARMException(this); + if (!DisableGNUEH) + ES = new ARMException(this); break; case ExceptionHandling::WinEH: switch (MAI->getWinEHEncodingType()) { @@ -595,7 +604,10 @@ bool AsmPrinter::doInitialization(Module &M) { break; case WinEH::EncodingType::X86: case WinEH::EncodingType::Itanium: - ES = new WinException(this); + if (!EnableMonoEH) + ES = new WinException(this); + else + ES = new WinException(this, true); break; } break; @@ -618,6 +630,13 @@ bool AsmPrinter::doInitialization(Module &M) { for (auto &Handler : Handlers) Handler->beginModule(&M); + if (EnableMonoEH) { + MonoException *mono_eh = new MonoException (this, DisableGNUEH); + Handlers.push_back(std::unique_ptr (mono_eh)); + MonoExceptionDebugHandler *mono_eh_dbg = new MonoExceptionDebugHandler(this, mono_eh); + addDebugHandler(std::unique_ptr (mono_eh_dbg)); + } + return false; } @@ -1745,7 +1764,8 @@ void AsmPrinter::emitFunctionBody() { switch (MI.getOpcode()) { case TargetOpcode::CFI_INSTRUCTION: - emitCFIInstruction(MI); + if (!EnableMonoEH) + emitCFIInstruction(MI); break; case TargetOpcode::LOCAL_ESCAPE: emitFrameAlloc(MI); @@ -1944,7 +1964,7 @@ void AsmPrinter::emitFunctionBody() { // are automatically sized. bool EmitFunctionSize = MAI->hasDotTypeDotSizeDirective() && !TT.isWasm(); - if (needFuncLabels(*MF, *MMI) || EmitFunctionSize) { + if (needFuncLabels(*MF, *MMI) || EmitFunctionSize || EnableMonoEH) { // Create a symbol for the end of function. CurrentFnEnd = createTempSymbol("func_end"); OutStreamer->emitLabel(CurrentFnEnd); @@ -2590,7 +2610,7 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) { F.hasFnAttribute("xray-instruction-threshold") || needFuncLabels(MF, *MMI) || NeedsLocalForSize || MF.getTarget().Options.EmitStackSizeSection || - MF.getTarget().Options.BBAddrMap || MF.hasBBLabels()) { + MF.getTarget().Options.BBAddrMap || MF.hasBBLabels() || EnableMonoEH) { CurrentFnBegin = createTempSymbol("func_begin"); if (NeedsLocalForSize) CurrentFnSymForSize = CurrentFnBegin; diff --git a/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt b/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt index 0fe4b905831ff..6260d38c4ba84 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt +++ b/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt @@ -26,6 +26,7 @@ add_llvm_component_library(LLVMAsmPrinter WinException.cpp CodeViewDebug.cpp WasmException.cpp + MonoException.cpp DEPENDS intrinsics_gen diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index f88653146cc6f..b00a06ba2dbb2 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1998,6 +1998,8 @@ void DwarfDebug::collectEntityInfo(DwarfCompileUnit &TheCU, // Process beginning of an instruction. void DwarfDebug::beginInstruction(const MachineInstr *MI) { + if (!MMI->hasDebugInfo()) + return; const MachineFunction &MF = *MI->getMF(); const auto *SP = MF.getFunction().getSubprogram(); bool NoDebug = diff --git a/llvm/lib/CodeGen/AsmPrinter/MonoException.cpp b/llvm/lib/CodeGen/AsmPrinter/MonoException.cpp new file mode 100644 index 0000000000000..a02d466f3146c --- /dev/null +++ b/llvm/lib/CodeGen/AsmPrinter/MonoException.cpp @@ -0,0 +1,678 @@ +//===---*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 2 -*---------===// +//===-- CodeGen/AsmPrinter/MonoException.cpp - Dwarf Exception Impl ------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains code to emit Mono specific exception handling tables. +// It is based on code in DwarfException.cpp and MCDwarf.cpp. +// +//===----------------------------------------------------------------------===// + +#include "MonoException.h" +#include "llvm/IR/Module.h" +#include "llvm/IR/Constants.h" +#include "llvm/CodeGen/AsmPrinter.h" +#include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/CodeGen/MachineFrameInfo.h" +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/TargetRegisterInfo.h" +#include "llvm/CodeGen/TargetSubtargetInfo.h" +#include "llvm/CodeGen/TargetFrameLowering.h" +#include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCContext.h" +#include "llvm/MC/MCExpr.h" +#include "llvm/MC/MCObjectStreamer.h" +#include "llvm/MC/MCSection.h" +#include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCSymbol.h" +#include "llvm/MC/MCSymbolELF.h" +#include "llvm/IR/DataLayout.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetOptions.h" +#include "llvm/Target/TargetLoweringObjectFile.h" +#include "llvm/BinaryFormat/Dwarf.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/FormattedStream.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/Twine.h" +using namespace llvm; + +// +// The EH tables emitted by this class enable the following functionality: +// - obtaining the GNU EH information for a given method +// - obtaining the DWARF CFI unwind info for a given method +// - obtaining the address of the table itself from user +// code, ie. it is in the text segment pointed to by +// a symbol. +// + +cl::opt MonoEHFrameSymbol("mono-eh-frame-symbol", cl::NotHidden, + cl::desc("Symbol name for the mono eh frame")); + +// Emit a CFI instruction in DWARF format +static void +emitCFIInstruction(MCStreamer &BaseStreamer, + const MCCFIInstruction &Instr, + int &CFAOffset, int DataAlignmentFactor) +{ + // Same as MCDwarf::EmitCFIInstruction () + // FIXME: Unify + int dataAlignmentFactor = DataAlignmentFactor; + MCObjectStreamer *Streamer = (MCObjectStreamer *)(&BaseStreamer); + bool VerboseAsm = Streamer->isVerboseAsm(); + + switch (Instr.getOperation()) { + case MCCFIInstruction::OpWindowSave: { + Streamer->emitIntValue(dwarf::DW_CFA_GNU_window_save, 1); + return; + } + case MCCFIInstruction::OpUndefined: { + unsigned Reg = Instr.getRegister(); + if (VerboseAsm) { + Streamer->AddComment("DW_CFA_undefined"); + Streamer->AddComment(Twine("Reg ") + Twine(Reg)); + } + Streamer->emitIntValue(dwarf::DW_CFA_undefined, 1); + Streamer->emitULEB128IntValue(Reg); + return; + } + case MCCFIInstruction::OpAdjustCfaOffset: + case MCCFIInstruction::OpDefCfaOffset: { + const bool IsRelative = + Instr.getOperation() == MCCFIInstruction::OpAdjustCfaOffset; + + if (VerboseAsm) + Streamer->AddComment("DW_CFA_def_cfa_offset"); + Streamer->emitIntValue(dwarf::DW_CFA_def_cfa_offset, 1); + + if (IsRelative) { + CFAOffset += Instr.getOffset(); + } else { + // The backends pass in a negative value, + // then createDefCfaOffset () negates it + CFAOffset = Instr.getOffset(); + assert(CFAOffset >= 0); + } + + if (VerboseAsm) + Streamer->AddComment(Twine("Offset " + Twine(CFAOffset))); + Streamer->emitULEB128IntValue(CFAOffset); + + return; + } + case MCCFIInstruction::OpDefCfa: { + if (VerboseAsm) + Streamer->AddComment("DW_CFA_def_cfa"); + Streamer->emitIntValue(dwarf::DW_CFA_def_cfa, 1); + + if (VerboseAsm) + Streamer->AddComment(Twine("Reg ") + Twine(Instr.getRegister())); + Streamer->emitULEB128IntValue(Instr.getRegister()); + + // The backends pass in a negative value, + // then createDefCfaOffset () negates it + CFAOffset = Instr.getOffset(); + if (CFAOffset < 0) { + outs () << CFAOffset << "\n"; + LLVM_BUILTIN_TRAP; + } + assert(CFAOffset >= 0); + + if (VerboseAsm) + Streamer->AddComment(Twine("Offset " + Twine(CFAOffset))); + Streamer->emitULEB128IntValue(CFAOffset); + + return; + } + + case MCCFIInstruction::OpDefCfaRegister: { + if (VerboseAsm) + Streamer->AddComment("DW_CFA_def_cfa_register"); + Streamer->emitIntValue(dwarf::DW_CFA_def_cfa_register, 1); + + if (VerboseAsm) + Streamer->AddComment(Twine("Reg ") + Twine(Instr.getRegister())); + Streamer->emitULEB128IntValue(Instr.getRegister()); + + return; + } + + case MCCFIInstruction::OpOffset: + case MCCFIInstruction::OpRelOffset: { + const bool IsRelative = + Instr.getOperation() == MCCFIInstruction::OpRelOffset; + + unsigned Reg = Instr.getRegister(); + int Offset = Instr.getOffset(); + if (IsRelative) + Offset -= CFAOffset; + Offset = Offset / dataAlignmentFactor; + + if (Offset < 0) { + if (VerboseAsm) Streamer->AddComment("DW_CFA_offset_extended_sf"); + Streamer->emitIntValue(dwarf::DW_CFA_offset_extended_sf, 1); + if (VerboseAsm) Streamer->AddComment(Twine("Reg ") + Twine(Reg)); + Streamer->emitULEB128IntValue(Reg); + if (VerboseAsm) Streamer->AddComment(Twine("Offset ") + Twine(Offset)); + Streamer->emitSLEB128IntValue(Offset); + } else if (Reg < 64) { + if (VerboseAsm) Streamer->AddComment(Twine("DW_CFA_offset + Reg(") + + Twine(Reg) + ")"); + Streamer->emitIntValue(dwarf::DW_CFA_offset + Reg, 1); + if (VerboseAsm) Streamer->AddComment(Twine("Offset ") + Twine(Offset)); + Streamer->emitULEB128IntValue(Offset); + } else { + if (VerboseAsm) Streamer->AddComment("DW_CFA_offset_extended"); + Streamer->emitIntValue(dwarf::DW_CFA_offset_extended, 1); + if (VerboseAsm) Streamer->AddComment(Twine("Reg ") + Twine(Reg)); + Streamer->emitULEB128IntValue(Reg); + if (VerboseAsm) Streamer->AddComment(Twine("Offset ") + Twine(Offset)); + Streamer->emitULEB128IntValue(Offset); + } + return; + } + case MCCFIInstruction::OpRememberState: + if (VerboseAsm) Streamer->AddComment("DW_CFA_remember_state"); + Streamer->emitIntValue(dwarf::DW_CFA_remember_state, 1); + return; + case MCCFIInstruction::OpRestoreState: + if (VerboseAsm) Streamer->AddComment("DW_CFA_restore_state"); + Streamer->emitIntValue(dwarf::DW_CFA_restore_state, 1); + return; + case MCCFIInstruction::OpSameValue: { + unsigned Reg = Instr.getRegister(); + if (VerboseAsm) Streamer->AddComment("DW_CFA_same_value"); + Streamer->emitIntValue(dwarf::DW_CFA_same_value, 1); + if (VerboseAsm) Streamer->AddComment(Twine("Reg ") + Twine(Reg)); + Streamer->emitULEB128IntValue(Reg); + return; + } + case MCCFIInstruction::OpRestore: { + unsigned Reg = Instr.getRegister(); + if (VerboseAsm) { + Streamer->AddComment("DW_CFA_restore"); + Streamer->AddComment(Twine("Reg ") + Twine(Reg)); + } + Streamer->emitIntValue(dwarf::DW_CFA_restore | Reg, 1); + return; + } + case MCCFIInstruction::OpEscape: + if (VerboseAsm) Streamer->AddComment("Escape bytes"); + Streamer->emitBytes(Instr.getValues()); + return; + case MCCFIInstruction::OpRegister: + case MCCFIInstruction::OpGnuArgsSize: + llvm_unreachable("Unhandled case in switch"); + return; + default: + break; + } + llvm_unreachable("Unhandled case in switch"); +} + +// Emit a list of CFI instructions +static void +emitCFIInstructions(MCStreamer &streamer, + const std::vector &Instrs, + MCSymbol *BaseLabel, + const std::vector *Labels, + int &CFAOffset, + int DataAlignmentFactor) +{ + MCObjectStreamer *OS = (MCObjectStreamer *)(&streamer); + for (unsigned i = 0, N = Instrs.size(); i < N; ++i) { + const MCCFIInstruction &Instr = Instrs[i]; + MCSymbol *Label = Labels ? ((*Labels)[i]) : NULL; + + // Advance row if new location. + if (BaseLabel && Label) { + MCSymbol *ThisSym = Label; + if (ThisSym != BaseLabel) { + OS->AddComment ("cfa_advance"); + OS->emitDwarfAdvanceFrameAddr(BaseLabel, ThisSym, Instr.getLoc()); + BaseLabel = ThisSym; + } + } + + emitCFIInstruction(streamer, Instr, CFAOffset, DataAlignmentFactor); + } +} + +MonoException::MonoException(AsmPrinter *A, bool disableGNUEH) + : EHStreamer(A) +{ + RI = nullptr; + DisableGNUEH = disableGNUEH; +} + +MonoException::~MonoException() +{ +} + +void +MonoException::beginFunction(const MachineFunction *MF) +{ + EmitFnStart(); + EHLabels.clear(); +} + +void +MonoException::PrepareMonoLSDA(EHInfo *info) +{ + const MachineFunction *MF = Asm->MF; + const std::vector &TypeInfos = MF->getTypeInfos(); + const std::vector &PadInfos = MF->getLandingPads(); + + // Sort the landing pads in order of their type ids. This is used to fold + // duplicate actions. + SmallVector LandingPads; + LandingPads.reserve(PadInfos.size()); + + for (unsigned i = 0, N = PadInfos.size(); i != N; ++i) + LandingPads.push_back(&PadInfos[i]); + + std::sort(LandingPads.begin(), LandingPads.end(), + [](const LandingPadInfo *L, + const LandingPadInfo *R) { return L->TypeIds < R->TypeIds; }); + + // Invokes and nounwind calls have entries in PadMap (due to being bracketed + // by try-range labels when lowered). Ordinary calls do not, so appropriate + // try-ranges for them need be deduced when using DWARF exception handling. + RangeMapType PadMap; + for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) { + const LandingPadInfo *LandingPad = LandingPads[i]; + for (unsigned j = 0, E = LandingPad->BeginLabels.size(); j != E; ++j) { + MCSymbol *BeginLabel = LandingPad->BeginLabels[j]; + assert(!PadMap.count(BeginLabel) && "Duplicate landing pad labels!"); + PadRange P = { i, j }; + PadMap[BeginLabel] = P; + } + } + + // Compute the call-site table. + SmallVector CallSites; + + MCSymbol *LastLabel = 0; + for (MachineFunction::const_iterator I = MF->begin(), E = MF->end(); + I != E; ++I) { + for (MachineBasicBlock::const_iterator MI = I->begin(), E = I->end(); + MI != E; ++MI) { + if (!MI->isLabel()) { + continue; + } + + MCSymbol *BeginLabel = MI->getOperand(0).getMCSymbol(); + assert(BeginLabel && "Invalid label!"); + + RangeMapType::iterator L = PadMap.find(BeginLabel); + + if (L == PadMap.end()) + continue; + + PadRange P = L->second; + const LandingPadInfo *LandingPad = LandingPads[P.PadIndex]; + + assert(BeginLabel == LandingPad->BeginLabels[P.RangeIndex] && + "Inconsistent landing pad map!"); + + // Mono emits one landing pad for each CLR exception clause, + // and the type info contains the clause index + assert (LandingPad->TypeIds.size() == 1); + assert (LandingPad->LandingPadLabel); + + LastLabel = LandingPad->EndLabels[P.RangeIndex]; + MonoCallSiteEntry Site = {BeginLabel, LastLabel, + LandingPad->LandingPadLabel, LandingPad->TypeIds [0]}; + + assert(Site.BeginLabel && Site.EndLabel && Site.PadLabel && + "Invalid landing pad!"); + + // FIXME: This doesn't work because it includes ranges outside clauses +#if 0 + // Try to merge with the previous call-site. + if (CallSites.size()) { + MonoCallSiteEntry &Prev = CallSites.back(); + if (Site.PadLabel == Prev.PadLabel && Site.TypeID == Prev.TypeID) { + // Extend the range of the previous entry. + Prev.EndLabel = Site.EndLabel; + continue; + } + } +#endif + + // Otherwise, create a new call-site. + CallSites.push_back(Site); + } + } + + info->CallSites.insert(info->CallSites.begin(), CallSites.begin(), CallSites.end()); + info->TypeInfos = TypeInfos; + info->PadInfos = PadInfos; + + int ThisSlot = Asm->MF->getMonoThisSlot(); + + if (ThisSlot != -1) { + llvm::Register FrameReg; + info->ThisOffset = Asm->MF->getTarget ().getSubtargetImpl (Asm->MF->getFunction())->getFrameLowering ()->getFrameIndexReference (*Asm->MF, ThisSlot, FrameReg).getFixed (); + info->FrameReg = Asm->MF->getTarget ().getSubtargetImpl (Asm->MF->getFunction())->getRegisterInfo ()->getDwarfRegNum (FrameReg, true); + } else { + info->FrameReg = -1; + } +} + +void +MonoException::EmitFnStart(void) +{ + if (DisableGNUEH && Asm->MAI->getExceptionHandlingType() == ExceptionHandling::ARM) + static_cast(Asm->OutStreamer->getTargetStreamer())->emitFnStart(); +} + +void +MonoException::EmitFnEnd(void) +{ + if (DisableGNUEH && Asm->MAI->getExceptionHandlingType() == ExceptionHandling::ARM) + static_cast(Asm->OutStreamer->getTargetStreamer())->emitFnEnd(); +} + +void +MonoException::endFunction(const MachineFunction *MF) +{ + // + // Compute a mapping from method names to their AOT method index + // + if (FuncIndexes.size () == 0) { + const Module *m = MMI->getModule (); + NamedMDNode *indexes = m->getNamedMetadata ("mono.function_indexes"); + if (indexes) { + for (unsigned int i = 0; i < indexes->getNumOperands (); ++i) { + MDNode *n = indexes->getOperand (i); + MDString *s = cast(n->getOperand (0)); + auto *idx = mdconst::dyn_extract(n->getOperand (1)); + FuncIndexes.insert (std::make_pair(s->getString (), (int)idx->getLimitedValue () + 1)); + } + } + } + + // Remember the register info + RI = MF->getSubtarget().getRegisterInfo(); + + int monoMethodIdx = FuncIndexes.lookup (Asm->MF->getFunction ().getName ()) - 1; + + if (monoMethodIdx == -1) { + EmitFnEnd (); + return; + } + + //outs () << "D: " << Asm->MF->getFunction()->getName() << " " << monoMethodIdx << "\n"; + + // Save information for use by endModule () + EHInfo info; + + info.FunctionNumber = Asm->getFunctionNumber(); + info.BeginSym = Asm->getFunctionBegin (); + info.EndSym = Asm->getFunctionEnd (); + info.EHLabels = EHLabels; + info.MonoMethodIdx = monoMethodIdx; + info.HasLandingPads = !MF->getLandingPads().empty(); + info.Instructions = MF->getFrameInstructions(); + assert (info.Instructions.size () == info.EHLabels.size()); + + if (DisableGNUEH) + /* ARMAsmPrinter generates references to this */ + Asm->OutStreamer->emitLabel(Asm->getMBBExceptionSym(MF->front())); + + PrepareMonoLSDA(&info); + + Frames.push_back(info); + EHLabels.clear(); + + EmitFnEnd (); +} + +/// EmitMonoLSDA - Mono's version of EmitExceptionTable +/// +/// The code below is a modified/simplified version of DwarfException::EmitExceptionTable() +/// We emit the information inline instead of into a separate section. +/// +void +MonoException::EmitMonoLSDA(const EHInfo *info) +{ + // Load saved information from EHFrameInfo + const std::vector &TypeInfos = info->TypeInfos; + const std::vector &PadInfos = info->PadInfos; + const std::vector CallSites = info->CallSites; + int FrameReg = info->FrameReg; + int ThisOffset = info->ThisOffset; + + // Sort the landing pads in order of their type ids. This is used to fold + // duplicate actions. + SmallVector LandingPads; + LandingPads.reserve(PadInfos.size()); + + for (unsigned i = 0, N = PadInfos.size(); i != N; ++i) + LandingPads.push_back(&PadInfos[i]); + + std::sort(LandingPads.begin(), LandingPads.end(), + [](const LandingPadInfo *L, + const LandingPadInfo *R) { return L->TypeIds < R->TypeIds; }); + + // The type_info itself is emitted + int TTypeEncoding = dwarf::DW_EH_PE_udata4; + + // Emit the LSDA. + // Keep this in sync with JITDwarfEmitter::EmitExceptionTable () + Asm->emitULEB128(0x4d4fef4f, "MONO Magic"); + Asm->emitULEB128(1, "Version"); + + // Emit the LSDA header. + if (FrameReg != -1) { + Asm->emitEncodingByte(dwarf::DW_EH_PE_udata4, "This encoding"); + + // Emit 'this' location + Asm->OutStreamer->AddComment("bregx"); + Asm->emitInt8((int)dwarf::DW_OP_bregx); + Asm->emitULEB128(FrameReg, "Base reg"); + Asm->emitSLEB128(ThisOffset, "Offset"); + } else { + Asm->emitEncodingByte(dwarf::DW_EH_PE_omit, "@This encoding"); + } + + Asm->emitULEB128 (CallSites.size (), "Number of call sites"); + Asm->emitAlignment(llvm::Align(4)); + for (std::vector::const_iterator + I = CallSites.begin(), E = CallSites.end(); I != E; ++I) { + const MonoCallSiteEntry &S = *I; + + MCSymbol *EHFuncBeginSym = info->BeginSym; + + MCSymbol *BeginLabel = S.BeginLabel; + if (BeginLabel == 0) + BeginLabel = EHFuncBeginSym; + MCSymbol *EndLabel = S.EndLabel; + if (EndLabel == 0) + EndLabel = info->EndSym; + + Asm->OutStreamer->AddComment("Region start"); + Asm->emitLabelDifference(BeginLabel, EHFuncBeginSym, 4); + + Asm->OutStreamer->AddComment("Region length"); + Asm->emitLabelDifference(EndLabel, BeginLabel, 4); + + Asm->OutStreamer->AddComment("Landing pad"); + if (!S.PadLabel) + Asm->OutStreamer->emitIntValue(0, 4); + else + Asm->emitLabelDifference(S.PadLabel, EHFuncBeginSym, 4); + + unsigned int TypeID = S.TypeID; + assert (TypeID > 0 && TypeID <= TypeInfos.size ()); + const GlobalVariable *GV = dyn_cast(TypeInfos[TypeID - 1]); + assert (GV); + + // + // Mono typeinfos are simple constant integers. Emit the constant itself. + // + assert(GV); + const ConstantInt *ci = dyn_cast(GV->getInitializer()); + + Asm->OutStreamer->AddComment("TypeInfo"); + Asm->OutStreamer->emitIntValue(ci->getZExtValue(),Asm->GetSizeOfEncodedValue(TTypeEncoding)); + } +} + +void +MonoException::endModule() +{ + const TargetLoweringObjectFile &tlof = Asm->getObjFileLowering(); + auto &streamer = *Asm->OutStreamer; + + // Size and sign of stack growth. + int stackGrowth = -Asm->getDataLayout().getPointerSize(); + int dataAlignmentFactor = stackGrowth; + + // Emit the EH table + + // Can't use rodata as the symbols we reference are in the text segment + streamer.switchSection(tlof.getTextSection()); + + MCSymbol *tableSymbol = + Asm->OutContext.getOrCreateSymbol(Twine(MonoEHFrameSymbol)); + MCSymbol *tableEndSym = Asm->createTempSymbol ("mono_eh_frame_end"); + + // Symbol + Asm->emitAlignment(llvm::Align(16)); + streamer.emitLabel(tableSymbol); + streamer.emitSymbolAttribute(tableSymbol, MCSA_ELF_TypeObject); + if (Asm->MAI->hasDotTypeDotSizeDirective()) { + const MCExpr *SizeExp = MCBinaryExpr::createSub( + MCSymbolRefExpr::create(tableEndSym, Asm->OutContext), + MCSymbolRefExpr::create(tableSymbol, Asm->OutContext), Asm->OutContext); + streamer.emitELFSize(cast(tableSymbol), SizeExp); + } + + // Header + streamer.AddComment("version"); + streamer.emitIntValue(3, 1); + streamer.AddComment ("func addr encoding"); + // Unused + streamer.emitIntValue (0, 1); + + // Search table + Asm->emitAlignment(llvm::Align(4)); + streamer.AddComment("fde_count"); + streamer.emitIntValue (Frames.size(), 4); + + MCSymbol *lastBegin = nullptr; + MCSymbol *lastEnd = nullptr; + for (std::vector::iterator + I = Frames.begin(), E = Frames.end(); I != E; ++I) { + EHInfo &info = *I; + + info.FDESym = Asm->createTempSymbol ("mono_fde"); + + streamer.AddComment("mono method idx"); + streamer.emitIntValue (info.MonoMethodIdx, 4); + + Asm->emitLabelDifference(info.FDESym, tableSymbol, 4); + lastBegin = info.BeginSym; + lastEnd = info.EndSym; + } + + // Emit a last entry to simplify binary searches and to enable the computation of + // the size of the last function/FDE entry + if (Frames.size() == 0) { + streamer.emitIntValue (-1, 4); + Asm->emitLabelDifference(tableSymbol, tableSymbol, 4); + } else { + // Emit the size of the last function, since it cannot be computed using the next table entry + Asm->emitLabelDifference(lastEnd, lastBegin, 4); + Asm->emitLabelDifference(tableEndSym, tableSymbol, 4); + } + + // CIE + // This comes right after the search table + Asm->emitULEB128(1, "CIE Code Alignment Factor"); + Asm->emitSLEB128(stackGrowth, "CIE Data Alignment Factor"); + streamer.AddComment("CIE Return Address Column"); + // RI can be null if there are no methods + if (RI) + Asm->emitInt8(RI->getDwarfRegNum(RI->getRARegister(), true)); + Asm->emitEncodingByte(dwarf::DW_EH_PE_omit, "Personality"); + + int cfaOffset = 0; + + // Initial CIE program + emitCFIInstructions(streamer, streamer.getContext().getAsmInfo()->getInitialFrameState(), NULL, NULL, cfaOffset, stackGrowth); + streamer.AddComment("End of CIE program"); + streamer.emitIntValue(dwarf::DW_CFA_nop, 1); + + int cieCfaOffset = cfaOffset; + + // FDEs + streamer.addBlankLine(); + for (std::vector::iterator + I = Frames.begin(), E = Frames.end(); I != E; ++I) { + const EHInfo &info = *I; + + streamer.emitLabel(info.FDESym); + + // Emit augmentation + if (info.HasLandingPads || info.FrameReg != -1) { + // Need an extra has_augmentation field as the augmentation size is always encoded + // in 4 bytes + Asm->emitULEB128(1, "Has augmentation"); + + MCSymbol *fdeBeginSym = Asm->OutContext.createTempSymbol("mono_fde_aug_begin", info.FunctionNumber); + MCSymbol *fdeEndSym = Asm->OutContext.createTempSymbol("mono_fde_aug_end", info.FunctionNumber); + + streamer.AddComment("Augmentation size"); + Asm->emitLabelDifference(fdeEndSym, fdeBeginSym, 4); + + streamer.emitLabel(fdeBeginSym); + EmitMonoLSDA (&info); + streamer.emitLabel(fdeEndSym); + } else { + Asm->emitULEB128(0, "Has augmentation"); + } + + // Emit unwind info + cfaOffset = cieCfaOffset; + emitCFIInstructions(streamer, info.Instructions, info.BeginSym, &info.EHLabels, cfaOffset, dataAlignmentFactor); + + streamer.addBlankLine(); + } + + streamer.emitLabel(tableEndSym); + Asm->emitAlignment(llvm::Align(8)); +} + +MonoExceptionDebugHandler::MonoExceptionDebugHandler(AsmPrinter *A, MonoException *ME) + : DebugHandlerBase(A), me(ME) +{ +} + +void +MonoExceptionDebugHandler::beginInstruction(const MachineInstr *MI) +{ + if (MI->getOpcode() == TargetOpcode::CFI_INSTRUCTION) { + unsigned CFIIndex = MI->getOperand(0).getCFIIndex(); + + //outs () << "D: " << CFIIndex << " " << EHLabels.size() << "\n"; + + /* Emit a label and save the label-cfi index association */ + if (CFIIndex != me->EHLabels.size()) + assert (0); + + MCSymbol *Label = Asm->OutContext.createTempSymbol(); + Asm->OutStreamer->emitLabel(Label); + + me->EHLabels.push_back(Label); + } +} diff --git a/llvm/lib/CodeGen/AsmPrinter/MonoException.h b/llvm/lib/CodeGen/AsmPrinter/MonoException.h new file mode 100644 index 0000000000000..1d0e5153c9609 --- /dev/null +++ b/llvm/lib/CodeGen/AsmPrinter/MonoException.h @@ -0,0 +1,102 @@ +//===---*- mode: c++; indent-tabs-mode: nil -*----------------------------===// +//===-- MonoException.h - Dwarf Exception Framework -----------*- C++ -*--===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// + +#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_MONOEXCEPTION_H +#define LLVM_LIB_CODEGEN_ASMPRINTER_MONOEXCEPTION_H + +#include "EHStreamer.h" +#include "llvm/CodeGen/AsmPrinter.h" +#include "llvm/CodeGen/DebugHandlerBase.h" + +namespace llvm { + +class TargetRegisterInfo; + +class MonoException : public EHStreamer { +public: + MonoException(AsmPrinter *A, bool disableGNUEH); + virtual ~MonoException(); + + void endModule() override; + + void beginFunction(const MachineFunction *MF) override; + + void endFunction(const MachineFunction *) override; + + std::vector EHLabels; + +private: + + struct MonoCallSiteEntry { + // The 'try-range' is BeginLabel .. EndLabel. + MCSymbol *BeginLabel; // zero indicates the start of the function. + MCSymbol *EndLabel; // zero indicates the end of the function. + + // The landing pad starts at PadLabel. + MCSymbol *PadLabel; // zero indicates that there is no landing pad. + int TypeID; + }; + + // Per-function EH info + struct EHInfo { + int FunctionNumber, MonoMethodIdx; + MCSymbol *BeginSym, *EndSym, *FDESym; + std::vector EHLabels; + std::vector Instructions; + std::vector CallSites; + std::vector TypeInfos; + std::vector PadInfos; + int FrameReg; + int ThisOffset; + bool HasLandingPads; + + EHInfo() { + FunctionNumber = 0; + MonoMethodIdx = 0; + BeginSym = nullptr; + EndSym = nullptr; + FrameReg = -1; + ThisOffset = 0; + HasLandingPads = 0; + } + }; + + void PrepareMonoLSDA(EHInfo *info); + void EmitMonoLSDA(const EHInfo *info); + void EmitFnStart(); + void EmitFnEnd(); + + std::vector Frames; + StringMap FuncIndexes; + const TargetRegisterInfo *RI; + bool DisableGNUEH; +}; + +class MonoExceptionDebugHandler : public DebugHandlerBase { + + public: + + MonoExceptionDebugHandler(AsmPrinter *A, MonoException* ME); + + void beginInstruction(const MachineInstr *MI) override; + void endInstruction() override {} + + void beginFunctionImpl(const MachineFunction *MF) override {} + void endFunctionImpl(const MachineFunction *MF) override {} + void beginModule(Module *M) override {} + void endModule() override {} + + private: + MonoException* me; +}; + +} // End of namespace llvm + +#endif + diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp index 6d6432b61f2d7..2ae9d38ef3728 100644 --- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp @@ -40,6 +40,13 @@ WinException::WinException(AsmPrinter *A) : EHStreamer(A) { isThumb = Asm->TM.getTargetTriple().isThumb(); } +WinException::WinException(AsmPrinter *A, bool disableEmitPersonality) +: EHStreamer(A), disableEmitPersonality(disableEmitPersonality) { + // MSVC's EH tables are always composed of 32-bit words. All known 64-bit + // platforms use an imagerel32 relocation to refer to symbols. + useImageRel32 = (A->getDataLayout().getPointerSizeInBits() == 64); +} + WinException::~WinException() = default; /// endModule - Emit all exception information that should come after the @@ -85,9 +92,11 @@ void WinException::beginFunction(const MachineFunction *MF) { !isNoOpWithoutInvoke(Per) && F.needsUnwindTableEntry(); - shouldEmitPersonality = - forceEmitPersonality || ((hasLandingPads || hasEHFunclets) && - PerEncoding != dwarf::DW_EH_PE_omit && PerFn); + if (!disableEmitPersonality) { + shouldEmitPersonality = + forceEmitPersonality || ((hasLandingPads || hasEHFunclets) && + PerEncoding != dwarf::DW_EH_PE_omit && PerFn); + } unsigned LSDAEncoding = TLOF.getLSDAEncoding(); shouldEmitLSDA = shouldEmitPersonality && diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.h b/llvm/lib/CodeGen/AsmPrinter/WinException.h index 638589adf0ddc..1deba2016bb5f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/WinException.h +++ b/llvm/lib/CodeGen/AsmPrinter/WinException.h @@ -33,6 +33,9 @@ class LLVM_LIBRARY_VISIBILITY WinException : public EHStreamer { /// Per-function flag to indicate if frame moves info should be emitted. bool shouldEmitMoves = false; + /// Per-function flag to indicate if personality info should be disabled. + bool disableEmitPersonality = false; + /// True if this is a 64-bit target and we should use image relative offsets. bool useImageRel32 = false; @@ -97,6 +100,7 @@ class LLVM_LIBRARY_VISIBILITY WinException : public EHStreamer { // Main entry points. // WinException(AsmPrinter *A); + WinException(AsmPrinter *A, bool disableEmitPersonality); ~WinException() override; /// Emit all exception information that should come after the content. diff --git a/llvm/lib/CodeGen/CFIInstrInserter.cpp b/llvm/lib/CodeGen/CFIInstrInserter.cpp index 1ff01ad34b30e..06de92515c044 100644 --- a/llvm/lib/CodeGen/CFIInstrInserter.cpp +++ b/llvm/lib/CodeGen/CFIInstrInserter.cpp @@ -68,9 +68,9 @@ class CFIInstrInserter : public MachineFunctionPass { struct MBBCFAInfo { MachineBasicBlock *MBB; /// Value of cfa offset valid at basic block entry. - int IncomingCFAOffset = -1; + int64_t IncomingCFAOffset = -1; /// Value of cfa offset valid at basic block exit. - int OutgoingCFAOffset = -1; + int64_t OutgoingCFAOffset = -1; /// Value of cfa register valid at basic block entry. unsigned IncomingCFARegister = 0; /// Value of cfa register valid at basic block exit. @@ -120,7 +120,7 @@ class CFIInstrInserter : public MachineFunctionPass { /// Return the cfa offset value that should be set at the beginning of a MBB /// if needed. The negated value is needed when creating CFI instructions that /// set absolute offset. - int getCorrectCFAOffset(MachineBasicBlock *MBB) { + int64_t getCorrectCFAOffset(MachineBasicBlock *MBB) { return MBBVector[MBB->getNumber()].IncomingCFAOffset; } @@ -175,7 +175,7 @@ void CFIInstrInserter::calculateCFAInfo(MachineFunction &MF) { void CFIInstrInserter::calculateOutgoingCFAInfo(MBBCFAInfo &MBBInfo) { // Outgoing cfa offset set by the block. - int SetOffset = MBBInfo.IncomingCFAOffset; + int64_t SetOffset = MBBInfo.IncomingCFAOffset; // Outgoing cfa register set by the block. unsigned SetRegister = MBBInfo.IncomingCFARegister; MachineFunction *MF = MBBInfo.MBB->getParent(); @@ -188,7 +188,7 @@ void CFIInstrInserter::calculateOutgoingCFAInfo(MBBCFAInfo &MBBInfo) { for (MachineInstr &MI : *MBBInfo.MBB) { if (MI.isCFIInstruction()) { std::optional CSRReg; - std::optional CSROffset; + std::optional CSROffset; unsigned CFIIndex = MI.getOperand(0).getCFIIndex(); const MCCFIInstruction &CFI = Instrs[CFIIndex]; switch (CFI.getOperation()) { diff --git a/llvm/lib/CodeGen/CalcSpillWeights.cpp b/llvm/lib/CodeGen/CalcSpillWeights.cpp index 1d767a3484bca..9d8c9119f7719 100644 --- a/llvm/lib/CodeGen/CalcSpillWeights.cpp +++ b/llvm/lib/CodeGen/CalcSpillWeights.cpp @@ -22,6 +22,7 @@ #include "llvm/CodeGen/TargetSubtargetInfo.h" #include "llvm/CodeGen/VirtRegMap.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" #include #include @@ -257,7 +258,9 @@ float VirtRegAuxInfo::weightCalcHelper(LiveInterval &LI, SlotIndex *Start, return -1.0f; } - float Weight = 1.0f; + // Force Weight onto the stack so that x86 doesn't add hidden precision, + // similar to HWeight below. + stack_float_t Weight = 1.0f; if (IsSpillable) { // Get loop info for mi. if (MI->getParent() != MBB) { @@ -284,11 +287,9 @@ float VirtRegAuxInfo::weightCalcHelper(LiveInterval &LI, SlotIndex *Start, Register HintReg = copyHint(MI, LI.reg(), TRI, MRI); if (!HintReg) continue; - // Force hweight onto the stack so that x86 doesn't add hidden precision, + // Force HWeight onto the stack so that x86 doesn't add hidden precision, // making the comparison incorrectly pass (i.e., 1 > 1 == true??). - // - // FIXME: we probably shouldn't use floats at all. - volatile float HWeight = Hint[HintReg] += Weight; + stack_float_t HWeight = Hint[HintReg] += Weight; if (HintReg.isVirtual() || MRI.isAllocatable(HintReg)) CopyHints.insert(CopyHint(HintReg, HWeight)); } diff --git a/llvm/lib/CodeGen/DwarfEHPrepare.cpp b/llvm/lib/CodeGen/DwarfEHPrepare.cpp index 324329ce989e7..f4324fffc4ed4 100644 --- a/llvm/lib/CodeGen/DwarfEHPrepare.cpp +++ b/llvm/lib/CodeGen/DwarfEHPrepare.cpp @@ -293,6 +293,13 @@ bool DwarfEHPrepare::InsertUnwindResumeCalls() { // Call the function. CallInst *CI = CallInst::Create(RewindFunction, RewindFunctionArgs, "", UnwindBB); + // The verifier requires that all calls of debug-info-bearing functions + // from debug-info-bearing functions have a debug location (for inlining + // purposes). Assign a dummy location to satisfy the constraint. + Function *RewindFn = dyn_cast(RewindFunction.getCallee()); + if (RewindFn && RewindFn->getSubprogram()) + if (DISubprogram *SP = F.getSubprogram()) + CI->setDebugLoc(DILocation::get(SP->getContext(), 0, 0, SP)); CI->setCallingConv(RewindFunctionCallingConv); // We never expect _Unwind_Resume to return. diff --git a/llvm/lib/CodeGen/FaultMaps.cpp b/llvm/lib/CodeGen/FaultMaps.cpp index 3f8fe2402d653..f016b7d34d385 100644 --- a/llvm/lib/CodeGen/FaultMaps.cpp +++ b/llvm/lib/CodeGen/FaultMaps.cpp @@ -15,9 +15,16 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/Format.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/CommandLine.h" using namespace llvm; +static cl::opt DisableFaultMaps("disable-fault-maps", + cl::desc("Disables emission of fault map metadata."), + cl::init(false), cl::Hidden); + #define DEBUG_TYPE "faultmaps" static const int FaultMapVersion = 1; @@ -43,6 +50,8 @@ void FaultMaps::recordFaultingOp(FaultKind FaultTy, } void FaultMaps::serializeToFaultMapSection() { + if (DisableFaultMaps) + return; if (FunctionInfos.empty()) return; diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index 68a8a273a1b47..eb010afd41b6b 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -3889,6 +3889,7 @@ bool IRTranslator::runOnMachineFunction(MachineFunction &CurMF) { F.getSubprogram(), &F.getEntryBlock()); R << "unable to translate in big endian mode"; reportTranslationError(*MF, *TPC, *ORE, R); + return false; } // Release the per-function state when we return, whether we succeeded or not. diff --git a/llvm/lib/CodeGen/ImplicitNullChecks.cpp b/llvm/lib/CodeGen/ImplicitNullChecks.cpp index 5ad003ed31802..d3c2a80a8cca6 100644 --- a/llvm/lib/CodeGen/ImplicitNullChecks.cpp +++ b/llvm/lib/CodeGen/ImplicitNullChecks.cpp @@ -344,13 +344,18 @@ ImplicitNullChecks::areMemoryOpsAliased(const MachineInstr &MI, for (MachineMemOperand *MMO1 : MI.memoperands()) { // MMO1 should have a value due it comes from operation we'd like to use // as implicit null check. - assert(MMO1->getValue() && "MMO1 should have a Value!"); + //assert(MMO1->getValue() && "MMO1 should have a Value!"); + // Doesn't have a value, unclear why + if (MMO1->getValue() == nullptr) + return AR_MayAlias; for (MachineMemOperand *MMO2 : PrevMI->memoperands()) { if (const PseudoSourceValue *PSV = MMO2->getPseudoValue()) { if (PSV->mayAlias(MFI)) return AR_MayAlias; continue; } + if (MMO2->getValue() == nullptr) + return AR_MayAlias; if (!AA->isNoAlias( MemoryLocation::getAfter(MMO1->getValue(), MMO1->getAAInfo()), MemoryLocation::getAfter(MMO2->getValue(), MMO2->getAAInfo()))) diff --git a/llvm/lib/CodeGen/MachineFrameInfo.cpp b/llvm/lib/CodeGen/MachineFrameInfo.cpp index 853de4c88caeb..e4b993850f73d 100644 --- a/llvm/lib/CodeGen/MachineFrameInfo.cpp +++ b/llvm/lib/CodeGen/MachineFrameInfo.cpp @@ -197,7 +197,7 @@ void MachineFrameInfo::computeMaxCallFrameSize( for (MachineInstr &MI : MBB) { unsigned Opcode = MI.getOpcode(); if (Opcode == FrameSetupOpcode || Opcode == FrameDestroyOpcode) { - unsigned Size = TII.getFrameSize(MI); + uint64_t Size = TII.getFrameSize(MI); MaxCallFrameSize = std::max(MaxCallFrameSize, Size); if (FrameSDOps != nullptr) FrameSDOps->push_back(&MI); diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 7f6a75208d253..6690695779dcc 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -248,6 +248,8 @@ void MachineFunction::init() { "Target-incompatible DataLayout attached\n"); PSVManager = std::make_unique(getTarget()); + + MonoThisSlot = -1; } void MachineFunction::initTargetMachineFunctionInfo( diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index 497e282bb9768..5c68711ff6193 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -528,8 +528,16 @@ bool MachinePipeliner::useSwingModuloScheduler() { } bool MachinePipeliner::useWindowScheduler(bool Changed) { - // WindowScheduler does not work when it is off or when SwingModuloScheduler - // is successfully scheduled. + // WindowScheduler does not work for following cases: + // 1. when it is off. + // 2. when SwingModuloScheduler is successfully scheduled. + // 3. when pragma II is enabled. + if (II_setByPragma) { + LLVM_DEBUG(dbgs() << "Window scheduling is disabled when " + "llvm.loop.pipeline.initiationinterval is set.\n"); + return false; + } + return WindowSchedulingOption == WindowSchedulingFlag::WS_Force || (WindowSchedulingOption == WindowSchedulingFlag::WS_On && !Changed); } diff --git a/llvm/lib/CodeGen/ModuloSchedule.cpp b/llvm/lib/CodeGen/ModuloSchedule.cpp index 0f29ebe3ee798..b1a2bfaf78957 100644 --- a/llvm/lib/CodeGen/ModuloSchedule.cpp +++ b/llvm/lib/CodeGen/ModuloSchedule.cpp @@ -130,6 +130,7 @@ void ModuloScheduleExpander::generatePipelinedLoop() { // Generate the prolog instructions that set up the pipeline. generateProlog(MaxStageCount, KernelBB, VRMap, PrologBBs); MF.insert(BB->getIterator(), KernelBB); + LIS.insertMBBInMaps(KernelBB); // Rearrange the instructions to generate the new, pipelined loop, // and update register names as needed. @@ -210,6 +211,7 @@ void ModuloScheduleExpander::generateProlog(unsigned LastStage, NewBB->transferSuccessors(PredBB); PredBB->addSuccessor(NewBB); PredBB = NewBB; + LIS.insertMBBInMaps(NewBB); // Generate instructions for each appropriate stage. Process instructions // in original program order. @@ -283,6 +285,7 @@ void ModuloScheduleExpander::generateEpilog( PredBB->replaceSuccessor(LoopExitBB, NewBB); NewBB->addSuccessor(LoopExitBB); + LIS.insertMBBInMaps(NewBB); if (EpilogStart == LoopExitBB) EpilogStart = NewBB; diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index 3db5e17615fd4..f4490873cfdcd 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -341,6 +341,9 @@ bool PEI::runOnMachineFunction(MachineFunction &MF) { << ore::NV("Function", MF.getFunction().getName()) << "'"; }); + // Emit any remarks implemented for the target, based on final frame layout. + TFI->emitRemarks(MF, ORE); + delete RS; SaveBlocks.clear(); RestoreBlocks.clear(); @@ -366,8 +369,8 @@ void PEI::calculateCallFrameInfo(MachineFunction &MF) { return; // (Re-)Compute the MaxCallFrameSize. - [[maybe_unused]] uint32_t MaxCFSIn = - MFI.isMaxCallFrameSizeComputed() ? MFI.getMaxCallFrameSize() : UINT32_MAX; + [[maybe_unused]] uint64_t MaxCFSIn = + MFI.isMaxCallFrameSizeComputed() ? MFI.getMaxCallFrameSize() : UINT64_MAX; std::vector FrameSDOps; MFI.computeMaxCallFrameSize(MF, &FrameSDOps); assert(MFI.getMaxCallFrameSize() <= MaxCFSIn && diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp index 1c35a88b4dc4a..043ea20191487 100644 --- a/llvm/lib/CodeGen/RegisterCoalescer.cpp +++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp @@ -3673,6 +3673,13 @@ bool RegisterCoalescer::joinVirtRegs(CoalescerPair &CP) { LHSVals.pruneSubRegValues(LHS, ShrinkMask); RHSVals.pruneSubRegValues(LHS, ShrinkMask); + } else if (TrackSubRegLiveness && !CP.getDstIdx() && CP.getSrcIdx()) { + LHS.createSubRangeFrom(LIS->getVNInfoAllocator(), + CP.getNewRC()->getLaneMask(), LHS); + mergeSubRangeInto(LHS, RHS, TRI->getSubRegIndexLaneMask(CP.getSrcIdx()), CP, + CP.getDstIdx()); + LHSVals.pruneMainSegments(LHS, ShrinkMainRange); + LHSVals.pruneSubRegValues(LHS, ShrinkMask); } // The merging algorithm in LiveInterval::join() can't handle conflicting diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index aa9032ea2574c..71cdec91e5f67 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -15680,13 +15680,16 @@ SDValue DAGCombiner::visitFREEZE(SDNode *N) { } } - SmallSetVector MaybePoisonOperands; - for (SDValue Op : N0->ops()) { + SmallSet MaybePoisonOperands; + SmallVector MaybePoisonOperandNumbers; + for (auto [OpNo, Op] : enumerate(N0->ops())) { if (DAG.isGuaranteedNotToBeUndefOrPoison(Op, /*PoisonOnly*/ false, /*Depth*/ 1)) continue; bool HadMaybePoisonOperands = !MaybePoisonOperands.empty(); - bool IsNewMaybePoisonOperand = MaybePoisonOperands.insert(Op); + bool IsNewMaybePoisonOperand = MaybePoisonOperands.insert(Op).second; + if (IsNewMaybePoisonOperand) + MaybePoisonOperandNumbers.push_back(OpNo); if (!HadMaybePoisonOperands) continue; if (IsNewMaybePoisonOperand && !AllowMultipleMaybePoisonOperands) { @@ -15698,7 +15701,18 @@ SDValue DAGCombiner::visitFREEZE(SDNode *N) { // it could create undef or poison due to it's poison-generating flags. // So not finding any maybe-poison operands is fine. - for (SDValue MaybePoisonOperand : MaybePoisonOperands) { + for (unsigned OpNo : MaybePoisonOperandNumbers) { + // N0 can mutate during iteration, so make sure to refetch the maybe poison + // operands via the operand numbers. The typical scenario is that we have + // something like this + // t262: i32 = freeze t181 + // t150: i32 = ctlz_zero_undef t262 + // t184: i32 = ctlz_zero_undef t181 + // t268: i32 = select_cc t181, Constant:i32<0>, t184, t186, setne:ch + // When freezing the t181 operand we get t262 back, and then the + // ReplaceAllUsesOfValueWith call will not only replace t181 by t262, but + // also recursively replace t184 by t150. + SDValue MaybePoisonOperand = N->getOperand(0).getOperand(OpNo); // Don't replace every single UNDEF everywhere with frozen UNDEF, though. if (MaybePoisonOperand.getOpcode() == ISD::UNDEF) continue; diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index 8f5b05b662b33..2830a833b6cf0 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -172,6 +172,17 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf, for (int *CatchObjPtr : Iter->second) *CatchObjPtr = FrameIndex; } + + // + // The mono exception handling code needs to location of the 'this' pointer + // to handle stack traces containing generic shared methods. + // To implement this, it saves the this pointer to an alloca which is marked with + // the 'mono.this' custom metadata. We save the stack slot used by this alloca + // in MachineFunction, so the dwarf exception info emission code can use it to + // compute the reg+offset for it, and save it into the LSDA. + // + if (AI->getMetadata("mono.this")) + MF->setMonoThisSlot(StaticAllocaMap[AI]); } else { // FIXME: Overaligned static allocas should be grouped into // a single dynamic allocation instead of using a separate diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index df3d207d85d35..b961d3bb1fec7 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -1453,6 +1453,10 @@ void SelectionDAGISel::reportIPToStateForBlocks(MachineFunction *MF) { if (BB->getFirstMayFaultInst()) { // Report IP range only for blocks with Faulty inst auto MBBb = MBB.getFirstNonPHI(); + + if (MBBb == MBB.end()) + continue; + MachineInstr *MIb = &*MBBb; if (MIb->isTerminator()) continue; diff --git a/llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp b/llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp index 940aecd1cb363..0a7a6bad4e86d 100644 --- a/llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp +++ b/llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp @@ -51,6 +51,8 @@ struct StackFrameLayoutAnalysisPass : public MachineFunctionPass { enum SlotType { Spill, // a Spill slot + Fixed, // a Fixed slot (e.g. arguments passed on the stack) + VariableSized, // a variable sized object StackProtector, // Stack Protector slot Variable, // a slot used to store a local data (could be a tmp) Invalid // It's an error for a slot to have this type @@ -60,29 +62,42 @@ struct StackFrameLayoutAnalysisPass : public MachineFunctionPass { int Slot; int Size; int Align; - int Offset; + StackOffset Offset; SlotType SlotTy; bool Scalable; - SlotData(const MachineFrameInfo &MFI, const int ValOffset, const int Idx) + SlotData(const MachineFrameInfo &MFI, const StackOffset Offset, + const int Idx) : Slot(Idx), Size(MFI.getObjectSize(Idx)), - Align(MFI.getObjectAlign(Idx).value()), - Offset(MFI.getObjectOffset(Idx) - ValOffset), SlotTy(Invalid), - Scalable(false) { + Align(MFI.getObjectAlign(Idx).value()), Offset(Offset), + SlotTy(Invalid), Scalable(false) { Scalable = MFI.getStackID(Idx) == TargetStackID::ScalableVector; if (MFI.isSpillSlotObjectIndex(Idx)) SlotTy = SlotType::Spill; - else if (Idx == MFI.getStackProtectorIndex()) + else if (MFI.isFixedObjectIndex(Idx)) + SlotTy = SlotType::Fixed; + else if (MFI.isVariableSizedObjectIndex(Idx)) + SlotTy = SlotType::VariableSized; + else if (MFI.hasStackProtectorIndex() && + Idx == MFI.getStackProtectorIndex()) SlotTy = SlotType::StackProtector; else SlotTy = SlotType::Variable; } + bool isVarSize() const { return SlotTy == SlotType::VariableSized; } + // We use this to sort in reverse order, so that the layout is displayed - // correctly. Scalable slots are sorted to the end of the list. + // correctly. Variable sized slots are sorted to the end of the list, as + // offsets are currently incorrect for these but they reside at the end of + // the stack frame. The Slot index is used to ensure deterministic order + // when offsets are equal. bool operator<(const SlotData &Rhs) const { - return std::make_tuple(!Scalable, Offset) > - std::make_tuple(!Rhs.Scalable, Rhs.Offset); + return std::make_tuple(!isVarSize(), + Offset.getFixed() + Offset.getScalable(), Slot) > + std::make_tuple(!Rhs.isVarSize(), + Rhs.Offset.getFixed() + Rhs.Offset.getScalable(), + Rhs.Slot); } }; @@ -121,6 +136,10 @@ struct StackFrameLayoutAnalysisPass : public MachineFunctionPass { switch (Ty) { case SlotType::Spill: return "Spill"; + case SlotType::Fixed: + return "Fixed"; + case SlotType::VariableSized: + return "VariableSized"; case SlotType::StackProtector: return "Protector"; case SlotType::Variable: @@ -149,15 +168,27 @@ struct StackFrameLayoutAnalysisPass : public MachineFunctionPass { // For example we store the Offset in YAML as: // ... // - Offset: -8 + // - ScalableOffset: -16 + // Note: the ScalableOffset entries are added only for slots with non-zero + // scalable offsets. // - // But we print it to the CLI as + // But we print it to the CLI as: // Offset: [SP-8] + // + // Or with non-zero scalable offset: + // Offset: [SP-8-16 x vscale] // Negative offsets will print a leading `-`, so only add `+` std::string Prefix = - formatv("\nOffset: [SP{0}", (D.Offset < 0) ? "" : "+").str(); - Rem << Prefix << ore::NV("Offset", D.Offset) - << "], Type: " << ore::NV("Type", getTypeString(D.SlotTy)) + formatv("\nOffset: [SP{0}", (D.Offset.getFixed() < 0) ? "" : "+").str(); + Rem << Prefix << ore::NV("Offset", D.Offset.getFixed()); + + if (D.Offset.getScalable()) { + Rem << ((D.Offset.getScalable() < 0) ? "" : "+") + << ore::NV("ScalableOffset", D.Offset.getScalable()) << " x vscale"; + } + + Rem << "], Type: " << ore::NV("Type", getTypeString(D.SlotTy)) << ", Align: " << ore::NV("Align", D.Align) << ", Size: " << ore::NV("Size", ElementCount::get(D.Size, D.Scalable)); } @@ -170,17 +201,22 @@ struct StackFrameLayoutAnalysisPass : public MachineFunctionPass { Rem << "\n " << ore::NV("DataLoc", Loc); } + StackOffset getStackOffset(const MachineFunction &MF, + const MachineFrameInfo &MFI, + const TargetFrameLowering *FI, int FrameIdx) { + if (!FI) + return StackOffset::getFixed(MFI.getObjectOffset(FrameIdx)); + + return FI->getFrameIndexReferenceFromSP(MF, FrameIdx); + } + void emitStackFrameLayoutRemarks(MachineFunction &MF, MachineOptimizationRemarkAnalysis &Rem) { const MachineFrameInfo &MFI = MF.getFrameInfo(); if (!MFI.hasStackObjects()) return; - // ValOffset is the offset to the local area from the SP at function entry. - // To display the true offset from SP, we need to subtract ValOffset from - // MFI's ObjectOffset. const TargetFrameLowering *FI = MF.getSubtarget().getFrameLowering(); - const int ValOffset = (FI ? FI->getOffsetOfLocalArea() : 0); LLVM_DEBUG(dbgs() << "getStackProtectorIndex ==" << MFI.getStackProtectorIndex() << "\n"); @@ -194,7 +230,7 @@ struct StackFrameLayoutAnalysisPass : public MachineFunctionPass { Idx != EndIdx; ++Idx) { if (MFI.isDeadObjectIndex(Idx)) continue; - SlotInfo.emplace_back(MFI, ValOffset, Idx); + SlotInfo.emplace_back(MFI, getStackOffset(MF, MFI, FI, Idx), Idx); } // sort the ordering, to match the actual layout in memory diff --git a/llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp b/llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp index 48a2094f5d451..7d054cb7c7c71 100644 --- a/llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp +++ b/llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp @@ -61,6 +61,20 @@ TargetFrameLowering::getFrameIndexReference(const MachineFunction &MF, int FI, MFI.getOffsetAdjustment()); } +/// Returns the offset from the stack pointer to the slot of the specified +/// index. This function serves to provide a comparable offset from a single +/// reference point (the value of the stack-pointer at function entry) that can +/// be used for analysis. This is the default implementation using +/// MachineFrameInfo offsets. +StackOffset +TargetFrameLowering::getFrameIndexReferenceFromSP(const MachineFunction &MF, + int FI) const { + // To display the true offset from SP, we need to subtract the offset to the + // local area from MFI's ObjectOffset. + return StackOffset::getFixed(MF.getFrameInfo().getObjectOffset(FI) - + getOffsetOfLocalArea()); +} + bool TargetFrameLowering::needsFrameIndexResolution( const MachineFunction &MF) const { return MF.getFrameInfo().hasStackObjects(); diff --git a/llvm/lib/CodeGen/WindowScheduler.cpp b/llvm/lib/CodeGen/WindowScheduler.cpp index 0777480499e55..f1658e36ae1e9 100644 --- a/llvm/lib/CodeGen/WindowScheduler.cpp +++ b/llvm/lib/CodeGen/WindowScheduler.cpp @@ -232,8 +232,11 @@ bool WindowScheduler::initialize() { return false; } for (auto &Def : MI.all_defs()) - if (Def.isReg() && Def.getReg().isPhysical()) + if (Def.isReg() && Def.getReg().isPhysical()) { + LLVM_DEBUG(dbgs() << "Physical registers are not supported in " + "window scheduling!\n"); return false; + } } if (SchedInstrNum <= WindowRegionLimit) { LLVM_DEBUG(dbgs() << "There are too few MIs in the window region!\n"); @@ -437,14 +440,17 @@ int WindowScheduler::calculateMaxCycle(ScheduleDAGInstrs &DAG, int PredCycle = getOriCycle(PredMI); ExpectCycle = std::max(ExpectCycle, PredCycle + (int)Pred.getLatency()); } - // ResourceManager can be used to detect resource conflicts between the - // current MI and the previously inserted MIs. - while (!RM.canReserveResources(*SU, CurCycle) || CurCycle < ExpectCycle) { - ++CurCycle; - if (CurCycle == (int)WindowIILimit) - return CurCycle; + // Zero cost instructions do not need to check resource. + if (!TII->isZeroCost(MI.getOpcode())) { + // ResourceManager can be used to detect resource conflicts between the + // current MI and the previously inserted MIs. + while (!RM.canReserveResources(*SU, CurCycle) || CurCycle < ExpectCycle) { + ++CurCycle; + if (CurCycle == (int)WindowIILimit) + return CurCycle; + } + RM.reserveResources(*SU, CurCycle); } - RM.reserveResources(*SU, CurCycle); OriToCycle[getOriMI(&MI)] = CurCycle; LLVM_DEBUG(dbgs() << "\tCycle " << CurCycle << " [S." << getOriStage(getOriMI(&MI), Offset) << "]: " << MI); @@ -485,6 +491,7 @@ int WindowScheduler::calculateMaxCycle(ScheduleDAGInstrs &DAG, // ======================================== int WindowScheduler::calculateStallCycle(unsigned Offset, int MaxCycle) { int MaxStallCycle = 0; + int CurrentII = MaxCycle + 1; auto Range = getScheduleRange(Offset, SchedInstrNum); for (auto &MI : Range) { auto *SU = TripleDAG->getSUnit(&MI); @@ -492,8 +499,8 @@ int WindowScheduler::calculateStallCycle(unsigned Offset, int MaxCycle) { for (auto &Succ : SU->Succs) { if (Succ.isWeak() || Succ.getSUnit() == &TripleDAG->ExitSU) continue; - // If the expected cycle does not exceed MaxCycle, no check is needed. - if (DefCycle + (int)Succ.getLatency() <= MaxCycle) + // If the expected cycle does not exceed CurrentII, no check is needed. + if (DefCycle + (int)Succ.getLatency() <= CurrentII) continue; // If the cycle of the scheduled MI A is less than that of the scheduled // MI B, the scheduling will fail because the lifetime of the @@ -503,7 +510,7 @@ int WindowScheduler::calculateStallCycle(unsigned Offset, int MaxCycle) { if (DefCycle < UseCycle) return WindowIILimit; // Get the stall cycle introduced by the register between two trips. - int StallCycle = DefCycle + (int)Succ.getLatency() - MaxCycle - UseCycle; + int StallCycle = DefCycle + (int)Succ.getLatency() - CurrentII - UseCycle; MaxStallCycle = std::max(MaxStallCycle, StallCycle); } } diff --git a/llvm/lib/CodeGenData/CMakeLists.txt b/llvm/lib/CodeGenData/CMakeLists.txt index 0a231d6214fea..f9d107f52a715 100644 --- a/llvm/lib/CodeGenData/CMakeLists.txt +++ b/llvm/lib/CodeGenData/CMakeLists.txt @@ -1,7 +1,4 @@ add_llvm_component_library(LLVMCodeGenData - CodeGenData.cpp - CodeGenDataReader.cpp - CodeGenDataWriter.cpp OutlinedHashTree.cpp OutlinedHashTreeRecord.cpp diff --git a/llvm/lib/CodeGenData/CodeGenData.cpp b/llvm/lib/CodeGenData/CodeGenData.cpp deleted file mode 100644 index 49b7447440959..0000000000000 --- a/llvm/lib/CodeGenData/CodeGenData.cpp +++ /dev/null @@ -1,196 +0,0 @@ -//===-- CodeGenData.cpp ---------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file contains support for codegen data that has stable summary which -// can be used to optimize the code in the subsequent codegen. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Bitcode/BitcodeWriter.h" -#include "llvm/CodeGenData/CodeGenDataReader.h" -#include "llvm/CodeGenData/OutlinedHashTreeRecord.h" -#include "llvm/Object/ObjectFile.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/FileSystem.h" -#include "llvm/Support/WithColor.h" - -#define DEBUG_TYPE "cg-data" - -using namespace llvm; -using namespace cgdata; - -static std::string getCGDataErrString(cgdata_error Err, - const std::string &ErrMsg = "") { - std::string Msg; - raw_string_ostream OS(Msg); - - switch (Err) { - case cgdata_error::success: - OS << "success"; - break; - case cgdata_error::eof: - OS << "end of File"; - break; - case cgdata_error::bad_magic: - OS << "invalid codegen data (bad magic)"; - break; - case cgdata_error::bad_header: - OS << "invalid codegen data (file header is corrupt)"; - break; - case cgdata_error::empty_cgdata: - OS << "empty codegen data"; - break; - case cgdata_error::malformed: - OS << "malformed codegen data"; - break; - case cgdata_error::unsupported_version: - OS << "unsupported codegen data version"; - break; - } - - // If optional error message is not empty, append it to the message. - if (!ErrMsg.empty()) - OS << ": " << ErrMsg; - - return OS.str(); -} - -namespace { - -// FIXME: This class is only here to support the transition to llvm::Error. It -// will be removed once this transition is complete. Clients should prefer to -// deal with the Error value directly, rather than converting to error_code. -class CGDataErrorCategoryType : public std::error_category { - const char *name() const noexcept override { return "llvm.cgdata"; } - - std::string message(int IE) const override { - return getCGDataErrString(static_cast(IE)); - } -}; - -} // end anonymous namespace - -const std::error_category &llvm::cgdata_category() { - static CGDataErrorCategoryType ErrorCategory; - return ErrorCategory; -} - -std::string CGDataError::message() const { - return getCGDataErrString(Err, Msg); -} - -char CGDataError::ID = 0; - -namespace { - -const char *CodeGenDataSectNameCommon[] = { -#define CG_DATA_SECT_ENTRY(Kind, SectNameCommon, SectNameCoff, Prefix) \ - SectNameCommon, -#include "llvm/CodeGenData/CodeGenData.inc" -}; - -const char *CodeGenDataSectNameCoff[] = { -#define CG_DATA_SECT_ENTRY(Kind, SectNameCommon, SectNameCoff, Prefix) \ - SectNameCoff, -#include "llvm/CodeGenData/CodeGenData.inc" -}; - -const char *CodeGenDataSectNamePrefix[] = { -#define CG_DATA_SECT_ENTRY(Kind, SectNameCommon, SectNameCoff, Prefix) Prefix, -#include "llvm/CodeGenData/CodeGenData.inc" -}; - -} // namespace - -namespace llvm { - -std::string getCodeGenDataSectionName(CGDataSectKind CGSK, - Triple::ObjectFormatType OF, - bool AddSegmentInfo) { - std::string SectName; - - if (OF == Triple::MachO && AddSegmentInfo) - SectName = CodeGenDataSectNamePrefix[CGSK]; - - if (OF == Triple::COFF) - SectName += CodeGenDataSectNameCoff[CGSK]; - else - SectName += CodeGenDataSectNameCommon[CGSK]; - - return SectName; -} - -std::unique_ptr CodeGenData::Instance = nullptr; -std::once_flag CodeGenData::OnceFlag; - -CodeGenData &CodeGenData::getInstance() { - std::call_once(CodeGenData::OnceFlag, []() { - Instance = std::unique_ptr(new CodeGenData()); - - // TODO: Initialize writer or reader mode for the client optimization. - }); - return *(Instance.get()); -} - -namespace IndexedCGData { - -Expected
Header::readFromBuffer(const unsigned char *Curr) { - using namespace support; - - static_assert(std::is_standard_layout_v, - "The header should be standard layout type since we use offset " - "of fields to read."); - Header H; - H.Magic = endian::readNext(Curr); - if (H.Magic != IndexedCGData::Magic) - return make_error(cgdata_error::bad_magic); - H.Version = endian::readNext(Curr); - if (H.Version > IndexedCGData::CGDataVersion::CurrentVersion) - return make_error(cgdata_error::unsupported_version); - H.DataKind = endian::readNext(Curr); - - switch (H.Version) { - // When a new field is added to the header add a case statement here to - // compute the size as offset of the new field + size of the new field. This - // relies on the field being added to the end of the list. - static_assert(IndexedCGData::CGDataVersion::CurrentVersion == Version1, - "Please update the size computation below if a new field has " - "been added to the header, if not add a case statement to " - "fall through to the latest version."); - case 1ull: - H.OutlinedHashTreeOffset = - endian::readNext(Curr); - } - - return H; -} - -} // end namespace IndexedCGData - -namespace cgdata { - -void warn(Twine Message, std::string Whence, std::string Hint) { - WithColor::warning(); - if (!Whence.empty()) - errs() << Whence << ": "; - errs() << Message << "\n"; - if (!Hint.empty()) - WithColor::note() << Hint << "\n"; -} - -void warn(Error E, StringRef Whence) { - if (E.isA()) { - handleAllErrors(std::move(E), [&](const CGDataError &IPE) { - warn(IPE.message(), Whence.str(), ""); - }); - } -} - -} // end namespace cgdata - -} // end namespace llvm diff --git a/llvm/lib/CodeGenData/CodeGenDataReader.cpp b/llvm/lib/CodeGenData/CodeGenDataReader.cpp deleted file mode 100644 index bcd61047079ff..0000000000000 --- a/llvm/lib/CodeGenData/CodeGenDataReader.cpp +++ /dev/null @@ -1,175 +0,0 @@ -//===- CodeGenDataReader.cpp ----------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file contains support for reading codegen data. -// -//===----------------------------------------------------------------------===// - -#include "llvm/CodeGenData/CodeGenDataReader.h" -#include "llvm/CodeGenData/OutlinedHashTreeRecord.h" -#include "llvm/Object/ObjectFile.h" -#include "llvm/Support/MemoryBuffer.h" - -#define DEBUG_TYPE "cg-data-reader" - -using namespace llvm; - -namespace llvm { - -static Expected> -setupMemoryBuffer(const Twine &Filename, vfs::FileSystem &FS) { - auto BufferOrErr = Filename.str() == "-" ? MemoryBuffer::getSTDIN() - : FS.getBufferForFile(Filename); - if (std::error_code EC = BufferOrErr.getError()) - return errorCodeToError(EC); - return std::move(BufferOrErr.get()); -} - -Error CodeGenDataReader::mergeFromObjectFile( - const object::ObjectFile *Obj, - OutlinedHashTreeRecord &GlobalOutlineRecord) { - Triple TT = Obj->makeTriple(); - auto CGOutLineName = - getCodeGenDataSectionName(CG_outline, TT.getObjectFormat(), false); - - for (auto &Section : Obj->sections()) { - Expected NameOrErr = Section.getName(); - if (!NameOrErr) - return NameOrErr.takeError(); - Expected ContentsOrErr = Section.getContents(); - if (!ContentsOrErr) - return ContentsOrErr.takeError(); - auto *Data = reinterpret_cast(ContentsOrErr->data()); - auto *EndData = Data + ContentsOrErr->size(); - - if (*NameOrErr == CGOutLineName) { - // In case dealing with an executable that has concatenated cgdata, - // we want to merge them into a single cgdata. - // Although it's not a typical workflow, we support this scenario. - while (Data != EndData) { - OutlinedHashTreeRecord LocalOutlineRecord; - LocalOutlineRecord.deserialize(Data); - GlobalOutlineRecord.merge(LocalOutlineRecord); - } - } - // TODO: Add support for other cgdata sections. - } - - return Error::success(); -} - -Error IndexedCodeGenDataReader::read() { - using namespace support; - - // The smallest header with the version 1 is 24 bytes - const unsigned MinHeaderSize = 24; - if (DataBuffer->getBufferSize() < MinHeaderSize) - return error(cgdata_error::bad_header); - - auto *Start = - reinterpret_cast(DataBuffer->getBufferStart()); - auto *End = - reinterpret_cast(DataBuffer->getBufferEnd()); - if (auto E = IndexedCGData::Header::readFromBuffer(Start).moveInto(Header)) - return E; - - if (hasOutlinedHashTree()) { - const unsigned char *Ptr = Start + Header.OutlinedHashTreeOffset; - if (Ptr >= End) - return error(cgdata_error::eof); - HashTreeRecord.deserialize(Ptr); - } - - return success(); -} - -Expected> -CodeGenDataReader::create(const Twine &Path, vfs::FileSystem &FS) { - // Set up the buffer to read. - auto BufferOrError = setupMemoryBuffer(Path, FS); - if (Error E = BufferOrError.takeError()) - return std::move(E); - return CodeGenDataReader::create(std::move(BufferOrError.get())); -} - -Expected> -CodeGenDataReader::create(std::unique_ptr Buffer) { - if (Buffer->getBufferSize() == 0) - return make_error(cgdata_error::empty_cgdata); - - std::unique_ptr Reader; - // Create the reader. - if (IndexedCodeGenDataReader::hasFormat(*Buffer)) - Reader = std::make_unique(std::move(Buffer)); - else if (TextCodeGenDataReader::hasFormat(*Buffer)) - Reader = std::make_unique(std::move(Buffer)); - else - return make_error(cgdata_error::malformed); - - // Initialize the reader and return the result. - if (Error E = Reader->read()) - return std::move(E); - - return std::move(Reader); -} - -bool IndexedCodeGenDataReader::hasFormat(const MemoryBuffer &DataBuffer) { - using namespace support; - if (DataBuffer.getBufferSize() < sizeof(IndexedCGData::Magic)) - return false; - - uint64_t Magic = endian::read( - DataBuffer.getBufferStart()); - // Verify that it's magical. - return Magic == IndexedCGData::Magic; -} - -bool TextCodeGenDataReader::hasFormat(const MemoryBuffer &Buffer) { - // Verify that this really looks like plain ASCII text by checking a - // 'reasonable' number of characters (up to the magic size). - StringRef Prefix = Buffer.getBuffer().take_front(sizeof(uint64_t)); - return llvm::all_of(Prefix, [](char c) { return isPrint(c) || isSpace(c); }); -} -Error TextCodeGenDataReader::read() { - using namespace support; - - // Parse the custom header line by line. - for (; !Line.is_at_eof(); ++Line) { - // Skip empty or whitespace-only lines - if (Line->trim().empty()) - continue; - - if (!Line->starts_with(":")) - break; - StringRef Str = Line->drop_front().rtrim(); - if (Str.equals_insensitive("outlined_hash_tree")) - DataKind |= CGDataKind::FunctionOutlinedHashTree; - else - return error(cgdata_error::bad_header); - } - - // We treat an empty header (that is a comment # only) as a valid header. - if (Line.is_at_eof()) { - if (DataKind == CGDataKind::Unknown) - return Error::success(); - return error(cgdata_error::bad_header); - } - - // The YAML docs follow after the header. - const char *Pos = Line->data(); - size_t Size = reinterpret_cast(DataBuffer->getBufferEnd()) - - reinterpret_cast(Pos); - yaml::Input YOS(StringRef(Pos, Size)); - if (hasOutlinedHashTree()) - HashTreeRecord.deserializeYAML(YOS); - - // TODO: Add more yaml cgdata in order - - return Error::success(); -} -} // end namespace llvm diff --git a/llvm/lib/CodeGenData/CodeGenDataWriter.cpp b/llvm/lib/CodeGenData/CodeGenDataWriter.cpp deleted file mode 100644 index 3c91a1b303450..0000000000000 --- a/llvm/lib/CodeGenData/CodeGenDataWriter.cpp +++ /dev/null @@ -1,162 +0,0 @@ -//===- CodeGenDataWriter.cpp ----------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file contains support for writing codegen data. -// -//===----------------------------------------------------------------------===// - -#include "llvm/CodeGenData/CodeGenDataWriter.h" -#include "llvm/Support/Endian.h" -#include "llvm/Support/EndianStream.h" - -#define DEBUG_TYPE "cg-data-writer" - -using namespace llvm; - -namespace llvm { - -/// A struct to define how the data stream should be patched. -struct CGDataPatchItem { - uint64_t Pos; // Where to patch. - uint64_t *D; // Pointer to an array of source data. - int N; // Number of elements in \c D array. -}; - -// A wrapper class to abstract writer stream with support of bytes -// back patching. -class CGDataOStream { -public: - CGDataOStream(raw_fd_ostream &FD) - : IsFDOStream(true), OS(FD), LE(FD, llvm::endianness::little) {} - CGDataOStream(raw_string_ostream &STR) - : IsFDOStream(false), OS(STR), LE(STR, llvm::endianness::little) {} - - uint64_t tell() { return OS.tell(); } - void write(uint64_t V) { LE.write(V); } - void write32(uint32_t V) { LE.write(V); } - void write8(uint8_t V) { LE.write(V); } - - // \c patch can only be called when all data is written and flushed. - // For raw_string_ostream, the patch is done on the target string - // directly and it won't be reflected in the stream's internal buffer. - void patch(ArrayRef P) { - using namespace support; - - if (IsFDOStream) { - raw_fd_ostream &FDOStream = static_cast(OS); - const uint64_t LastPos = FDOStream.tell(); - for (const auto &K : P) { - FDOStream.seek(K.Pos); - for (int I = 0; I < K.N; I++) - write(K.D[I]); - } - // Reset the stream to the last position after patching so that users - // don't accidentally overwrite data. This makes it consistent with - // the string stream below which replaces the data directly. - FDOStream.seek(LastPos); - } else { - raw_string_ostream &SOStream = static_cast(OS); - std::string &Data = SOStream.str(); // with flush - for (const auto &K : P) { - for (int I = 0; I < K.N; I++) { - uint64_t Bytes = - endian::byte_swap(K.D[I]); - Data.replace(K.Pos + I * sizeof(uint64_t), sizeof(uint64_t), - (const char *)&Bytes, sizeof(uint64_t)); - } - } - } - } - - // If \c OS is an instance of \c raw_fd_ostream, this field will be - // true. Otherwise, \c OS will be an raw_string_ostream. - bool IsFDOStream; - raw_ostream &OS; - support::endian::Writer LE; -}; - -} // end namespace llvm - -void CodeGenDataWriter::addRecord(OutlinedHashTreeRecord &Record) { - assert(Record.HashTree && "empty hash tree in the record"); - HashTreeRecord.HashTree = std::move(Record.HashTree); - - DataKind |= CGDataKind::FunctionOutlinedHashTree; -} - -Error CodeGenDataWriter::write(raw_fd_ostream &OS) { - CGDataOStream COS(OS); - return writeImpl(COS); -} - -Error CodeGenDataWriter::writeHeader(CGDataOStream &COS) { - using namespace support; - IndexedCGData::Header Header; - Header.Magic = IndexedCGData::Magic; - Header.Version = IndexedCGData::Version; - - // Set the CGDataKind depending on the kind. - Header.DataKind = 0; - if (static_cast(DataKind & CGDataKind::FunctionOutlinedHashTree)) - Header.DataKind |= - static_cast(CGDataKind::FunctionOutlinedHashTree); - - Header.OutlinedHashTreeOffset = 0; - - // Only write up to the CGDataKind. We need to remember the offset of the - // remaining fields to allow back-patching later. - COS.write(Header.Magic); - COS.write32(Header.Version); - COS.write32(Header.DataKind); - - // Save the location of Header.OutlinedHashTreeOffset field in \c COS. - OutlinedHashTreeOffset = COS.tell(); - - // Reserve the space for OutlinedHashTreeOffset field. - COS.write(0); - - return Error::success(); -} - -Error CodeGenDataWriter::writeImpl(CGDataOStream &COS) { - if (Error E = writeHeader(COS)) - return E; - - uint64_t OutlinedHashTreeFieldStart = COS.tell(); - if (hasOutlinedHashTree()) - HashTreeRecord.serialize(COS.OS); - - // Back patch the offsets. - CGDataPatchItem PatchItems[] = { - {OutlinedHashTreeOffset, &OutlinedHashTreeFieldStart, 1}}; - COS.patch(PatchItems); - - return Error::success(); -} - -Error CodeGenDataWriter::writeHeaderText(raw_fd_ostream &OS) { - if (hasOutlinedHashTree()) - OS << "# Outlined stable hash tree\n:outlined_hash_tree\n"; - - // TODO: Add more data types in this header - - return Error::success(); -} - -Error CodeGenDataWriter::writeText(raw_fd_ostream &OS) { - if (Error E = writeHeaderText(OS)) - return E; - - yaml::Output YOS(OS); - if (hasOutlinedHashTree()) - HashTreeRecord.serializeYAML(YOS); - - // TODO: Write more yaml cgdata in order - - return Error::success(); -} diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index 6599730590de6..5954fb1ea839d 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -369,6 +369,7 @@ static void PrintCallingConv(unsigned cc, raw_ostream &Out) { case CallingConv::RISCV_VectorCall: Out << "riscv_vector_cc"; break; + case CallingConv::Mono: Out << "monocc"; break; } } diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp index bf19934da047c..46896d3cdf7d5 100644 --- a/llvm/lib/IR/BasicBlock.cpp +++ b/llvm/lib/IR/BasicBlock.cpp @@ -961,9 +961,13 @@ void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src, // Detach the marker at Dest -- this lets us move the "====" DbgRecords // around. DbgMarker *DestMarker = nullptr; - if (Dest != end()) { - if ((DestMarker = getMarker(Dest))) + if ((DestMarker = getMarker(Dest))) { + if (Dest == end()) { + assert(DestMarker == getTrailingDbgRecords()); + deleteTrailingDbgRecords(); + } else { DestMarker->removeFromParent(); + } } // If we're moving the tail range of DbgRecords (":::"), absorb them into the @@ -971,8 +975,16 @@ void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src, if (ReadFromTail && Src->getMarker(Last)) { DbgMarker *FromLast = Src->getMarker(Last); if (LastIsEnd) { - Dest->adoptDbgRecords(Src, Last, true); - // adoptDbgRecords will release any trailers. + if (Dest == end()) { + // Abosrb the trailing markers from Src. + assert(FromLast == Src->getTrailingDbgRecords()); + createMarker(Dest)->absorbDebugValues(*FromLast, true); + FromLast->eraseFromParent(); + Src->deleteTrailingDbgRecords(); + } else { + // adoptDbgRecords will release any trailers. + Dest->adoptDbgRecords(Src, Last, true); + } assert(!Src->getTrailingDbgRecords()); } else { // FIXME: can we use adoptDbgRecords here to reduce allocations? @@ -1005,22 +1017,14 @@ void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src, } else { // Insert them right at the start of the range we moved, ahead of First // and the "++++" DbgRecords. + // This also covers the rare circumstance where we insert at end(), and we + // did not generate the iterator with begin() / getFirstInsertionPt(), + // meaning any trailing debug-info at the end of the block would + // "normally" have been pushed in front of "First". We move it there now. DbgMarker *FirstMarker = createMarker(First); FirstMarker->absorbDebugValues(*DestMarker, true); } DestMarker->eraseFromParent(); - } else if (Dest == end() && !InsertAtHead) { - // In the rare circumstance where we insert at end(), and we did not - // generate the iterator with begin() / getFirstInsertionPt(), it means - // any trailing debug-info at the end of the block would "normally" have - // been pushed in front of "First". Move it there now. - DbgMarker *TrailingDbgRecords = getTrailingDbgRecords(); - if (TrailingDbgRecords) { - DbgMarker *FirstMarker = createMarker(First); - FirstMarker->absorbDebugValues(*TrailingDbgRecords, true); - TrailingDbgRecords->eraseFromParent(); - deleteTrailingDbgRecords(); - } } } diff --git a/llvm/lib/IR/DebugProgramInstruction.cpp b/llvm/lib/IR/DebugProgramInstruction.cpp index 362d467beeb11..5d2189b54204f 100644 --- a/llvm/lib/IR/DebugProgramInstruction.cpp +++ b/llvm/lib/IR/DebugProgramInstruction.cpp @@ -473,11 +473,12 @@ DbgLabelRecord::createDebugIntrinsic(Module *M, Value *DbgVariableRecord::getAddress() const { auto *MD = getRawAddress(); - if (auto *V = dyn_cast(MD)) + if (auto *V = dyn_cast_or_null(MD)) return V->getValue(); // When the value goes to null, it gets replaced by an empty MDNode. - assert(!cast(MD)->getNumOperands() && "Expected an empty MDNode"); + assert(!MD || + !cast(MD)->getNumOperands() && "Expected an empty MDNode"); return nullptr; } diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp index 64a14da55b15e..db3b0196f66fd 100644 --- a/llvm/lib/IR/IntrinsicInst.cpp +++ b/llvm/lib/IR/IntrinsicInst.cpp @@ -599,6 +599,25 @@ Intrinsic::ID VPIntrinsic::getForOpcode(unsigned IROPC) { return Intrinsic::not_intrinsic; } +constexpr static Intrinsic::ID getForIntrinsic(Intrinsic::ID Id) { + if (::isVPIntrinsic(Id)) + return Id; + + switch (Id) { + default: + break; +#define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) break; +#define VP_PROPERTY_FUNCTIONAL_INTRINSIC(INTRIN) case Intrinsic::INTRIN: +#define END_REGISTER_VP_INTRINSIC(VPID) return Intrinsic::VPID; +#include "llvm/IR/VPIntrinsics.def" + } + return Intrinsic::not_intrinsic; +} + +Intrinsic::ID VPIntrinsic::getForIntrinsic(Intrinsic::ID Id) { + return ::getForIntrinsic(Id); +} + bool VPIntrinsic::canIgnoreVectorLengthParam() const { using namespace PatternMatch; diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp index 9c44eff7953ac..01aaedcf7d547 100644 --- a/llvm/lib/IR/LegacyPassManager.cpp +++ b/llvm/lib/IR/LegacyPassManager.cpp @@ -12,7 +12,6 @@ #include "llvm/IR/LegacyPassManager.h" #include "llvm/ADT/MapVector.h" -#include "llvm/Demangle/Demangle.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/IRPrintingPasses.h" #include "llvm/IR/LLVMContext.h" @@ -1416,8 +1415,7 @@ bool FPPassManager::runOnFunction(Function &F) { // Store name outside of loop to avoid redundant calls. const StringRef Name = F.getName(); - llvm::TimeTraceScope FunctionScope( - "OptFunction", [&F]() { return demangle(F.getName().str()); }); + llvm::TimeTraceScope FunctionScope("OptFunction", Name); for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { FunctionPass *FP = getContainedPass(Index); diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index ae5f5de142328..fd2f4d184162f 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -1318,10 +1318,11 @@ MDNode *MDNode::getMostGenericRange(MDNode *A, MDNode *B) { ++BI; } - // If we have more than 2 ranges (4 endpoints) we have to try to merge + // We haven't handled wrap in the previous merge, + // if we have at least 2 ranges (4 endpoints) we have to try to merge // the last and first ones. unsigned Size = EndPoints.size(); - if (Size > 4) { + if (Size > 2) { ConstantInt *FB = EndPoints[0]; ConstantInt *FE = EndPoints[1]; if (tryMergeRange(EndPoints, FB, FE)) { diff --git a/llvm/lib/IR/TypeFinder.cpp b/llvm/lib/IR/TypeFinder.cpp index 003155a4af487..963f4b4806e1f 100644 --- a/llvm/lib/IR/TypeFinder.cpp +++ b/llvm/lib/IR/TypeFinder.cpp @@ -88,6 +88,20 @@ void TypeFinder::run(const Module &M, bool onlyNamed) { for (const auto &MD : MDForInst) incorporateMDNode(MD.second); MDForInst.clear(); + + // Incorporate types hiding in variable-location information. + for (const auto &Dbg : I.getDbgRecordRange()) { + // Pick out records that have Values. + if (const DbgVariableRecord *DVI = + dyn_cast(&Dbg)) { + for (Value *V : DVI->location_ops()) + incorporateValue(V); + if (DVI->isDbgAssign()) { + if (Value *Addr = DVI->getAddress()) + incorporateValue(Addr); + } + } + } } } diff --git a/llvm/lib/IR/VectorBuilder.cpp b/llvm/lib/IR/VectorBuilder.cpp index 5ff3082879895..8dbf25277bf5d 100644 --- a/llvm/lib/IR/VectorBuilder.cpp +++ b/llvm/lib/IR/VectorBuilder.cpp @@ -60,60 +60,13 @@ Value *VectorBuilder::createVectorInstruction(unsigned Opcode, Type *ReturnTy, return createVectorInstructionImpl(VPID, ReturnTy, InstOpArray, Name); } -Value *VectorBuilder::createSimpleTargetReduction(RecurKind Kind, Type *ValTy, +Value *VectorBuilder::createSimpleTargetReduction(Intrinsic::ID RdxID, + Type *ValTy, ArrayRef InstOpArray, const Twine &Name) { - Intrinsic::ID VPID; - switch (Kind) { - case RecurKind::Add: - VPID = Intrinsic::vp_reduce_add; - break; - case RecurKind::Mul: - VPID = Intrinsic::vp_reduce_mul; - break; - case RecurKind::And: - VPID = Intrinsic::vp_reduce_and; - break; - case RecurKind::Or: - VPID = Intrinsic::vp_reduce_or; - break; - case RecurKind::Xor: - VPID = Intrinsic::vp_reduce_xor; - break; - case RecurKind::FMulAdd: - case RecurKind::FAdd: - VPID = Intrinsic::vp_reduce_fadd; - break; - case RecurKind::FMul: - VPID = Intrinsic::vp_reduce_fmul; - break; - case RecurKind::SMax: - VPID = Intrinsic::vp_reduce_smax; - break; - case RecurKind::SMin: - VPID = Intrinsic::vp_reduce_smin; - break; - case RecurKind::UMax: - VPID = Intrinsic::vp_reduce_umax; - break; - case RecurKind::UMin: - VPID = Intrinsic::vp_reduce_umin; - break; - case RecurKind::FMax: - VPID = Intrinsic::vp_reduce_fmax; - break; - case RecurKind::FMin: - VPID = Intrinsic::vp_reduce_fmin; - break; - case RecurKind::FMaximum: - VPID = Intrinsic::vp_reduce_fmaximum; - break; - case RecurKind::FMinimum: - VPID = Intrinsic::vp_reduce_fminimum; - break; - default: - llvm_unreachable("No VPIntrinsic for this reduction"); - } + auto VPID = VPIntrinsic::getForIntrinsic(RdxID); + assert(VPReductionIntrinsic::isVPReduction(VPID) && + "No VPIntrinsic for this reduction"); return createVectorInstructionImpl(VPID, ValTy, InstOpArray, Name); } diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index ceeb7af0fecc4..c3da4bb5cc363 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -432,6 +432,28 @@ void MCAssembler::layoutBundle(MCFragment *Prev, MCFragment *F) const { DF->Offset = EF->Offset; } +void MCAssembler::ensureValid(MCSection &Sec) const { + if (Sec.hasLayout()) + return; + Sec.setHasLayout(true); + MCFragment *Prev = nullptr; + uint64_t Offset = 0; + for (MCFragment &F : Sec) { + F.Offset = Offset; + if (isBundlingEnabled() && F.hasInstructions()) { + layoutBundle(Prev, &F); + Offset = F.Offset; + } + Offset += computeFragmentSize(F); + Prev = &F; + } +} + +uint64_t MCAssembler::getFragmentOffset(const MCFragment &F) const { + ensureValid(*F.getParent()); + return F.Offset; +} + // Simple getSymbolOffset helper for the non-variable case. static bool getLabelOffset(const MCAssembler &Asm, const MCSymbol &S, bool ReportError, uint64_t &Val) { @@ -916,20 +938,22 @@ void MCAssembler::layout() { // Layout until everything fits. this->HasLayout = true; - for (MCSection &Sec : *this) - layoutSection(Sec); while (layoutOnce()) { + if (getContext().hadError()) + return; + // Size of fragments in one section can depend on the size of fragments in + // another. If any fragment has changed size, we have to re-layout (and + // as a result possibly further relax) all. + for (MCSection &Sec : *this) + Sec.setHasLayout(false); } DEBUG_WITH_TYPE("mc-dump", { errs() << "assembler backend - post-relaxation\n--\n"; dump(); }); - // Some targets might want to adjust fragment offsets. If so, perform another - // layout loop. - if (getBackend().finishLayout(*this)) - for (MCSection &Sec : *this) - layoutSection(Sec); + // Finalize the layout, including fragment lowering. + getBackend().finishLayout(*this); DEBUG_WITH_TYPE("mc-dump", { errs() << "assembler backend - final-layout\n--\n"; @@ -1282,42 +1306,15 @@ bool MCAssembler::relaxFragment(MCFragment &F) { } } -void MCAssembler::layoutSection(MCSection &Sec) { - MCFragment *Prev = nullptr; - uint64_t Offset = 0; - for (MCFragment &F : Sec) { - F.Offset = Offset; - if (LLVM_UNLIKELY(isBundlingEnabled())) { - if (F.hasInstructions()) { - layoutBundle(Prev, &F); - Offset = F.Offset; - } - Prev = &F; - } - Offset += computeFragmentSize(F); - } -} - bool MCAssembler::layoutOnce() { ++stats::RelaxationSteps; - // Size of fragments in one section can depend on the size of fragments in - // another. If any fragment has changed size, we have to re-layout (and - // as a result possibly further relax) all. - bool ChangedAny = false; - for (MCSection &Sec : *this) { - for (;;) { - bool Changed = false; - for (MCFragment &F : Sec) - if (relaxFragment(F)) - Changed = true; - ChangedAny |= Changed; - if (!Changed) - break; - layoutSection(Sec); - } - } - return ChangedAny; + bool Changed = false; + for (MCSection &Sec : *this) + for (MCFragment &Frag : Sec) + if (relaxFragment(Frag)) + Changed = true; + return Changed; } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index efafd555c5c5c..1297dc3828b58 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -1299,8 +1299,8 @@ static void EmitPersonality(MCStreamer &streamer, const MCSymbol &symbol, namespace { class FrameEmitterImpl { - int CFAOffset = 0; - int InitialCFAOffset = 0; + int64_t CFAOffset = 0; + int64_t InitialCFAOffset = 0; bool IsEH; MCObjectStreamer &Streamer; @@ -1414,7 +1414,7 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) { if (!IsEH) Reg = MRI->getDwarfRegNumFromDwarfEHRegNum(Reg); - int Offset = Instr.getOffset(); + int64_t Offset = Instr.getOffset(); if (IsRelative) Offset -= CFAOffset; Offset = Offset / dataAlignmentFactor; diff --git a/llvm/lib/MC/MCSection.cpp b/llvm/lib/MC/MCSection.cpp index 97e87a41c8ce5..8c2ee5635a49c 100644 --- a/llvm/lib/MC/MCSection.cpp +++ b/llvm/lib/MC/MCSection.cpp @@ -23,8 +23,8 @@ using namespace llvm; MCSection::MCSection(SectionVariant V, StringRef Name, bool IsText, bool IsVirtual, MCSymbol *Begin) : Begin(Begin), BundleGroupBeforeFirstInst(false), HasInstructions(false), - IsRegistered(false), IsText(IsText), IsVirtual(IsVirtual), Name(Name), - Variant(V) { + HasLayout(false), IsRegistered(false), IsText(IsText), + IsVirtual(IsVirtual), Name(Name), Variant(V) { DummyFragment.setParent(this); // The initial subsection number is 0. Create a fragment list. CurFragList = &Subsections.emplace_back(0u, FragList{}).second; diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index 1594bd3231abe..fcec8835586e2 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -124,6 +124,7 @@ void MCStreamer::emitExplicitComments() {} void MCStreamer::generateCompactUnwindEncodings(MCAsmBackend *MAB) { for (auto &FI : DwarfFrameInfos) +// in previous dotnet change if (FI.CompactUnwindEncoding == 0) { FI.CompactUnwindEncoding = (MAB ? MAB->generateCompactUnwindEncoding(&FI, &Context) : 0); } @@ -682,6 +683,14 @@ void MCStreamer::emitCFINegateRAState(SMLoc Loc) { CurFrame->Instructions.push_back(Instruction); } +void MCStreamer::emitCFICompactUnwindEncoding(unsigned Encoding) +{ + MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo(); + if (!CurFrame) + return; + CurFrame->CompactUnwindEncoding = Encoding; +} + void MCStreamer::emitCFIReturnColumn(int64_t Register) { MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo(); if (!CurFrame) diff --git a/llvm/lib/Passes/CMakeLists.txt b/llvm/lib/Passes/CMakeLists.txt index b5224327d7921..6425f4934b210 100644 --- a/llvm/lib/Passes/CMakeLists.txt +++ b/llvm/lib/Passes/CMakeLists.txt @@ -21,7 +21,6 @@ add_llvm_component_library(LLVMPasses CodeGen Core Coroutines - Demangle HipStdPar IPO InstCombine diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index 6f36bdad780ae..e58c64d19e9ae 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -1131,11 +1131,12 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, // and prior to optimizing globals. // FIXME: This position in the pipeline hasn't been carefully considered in // years, it should be re-analyzed. - MPM.addPass(IPSCCPPass( - IPSCCPOptions(/*AllowFuncSpec=*/ - Level != OptimizationLevel::Os && - Level != OptimizationLevel::Oz && - !isLTOPreLink(Phase)))); + // mono: FIXME: disabled for now, we need to fix mono EH frame generation first + // MPM.addPass(IPSCCPPass( + // IPSCCPOptions(/*AllowFuncSpec=*/ + // Level != OptimizationLevel::Os && + // Level != OptimizationLevel::Oz && + // !isLTOPreLink(Phase)))); // Attach metadata to indirect call sites indicating the set of functions // they may target at run-time. This should follow IPSCCP. @@ -1805,9 +1806,11 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level, // Propagate constants at call sites into the functions they call. This // opens opportunities for globalopt (and inlining) by substituting function // pointers passed as arguments to direct uses of functions. - MPM.addPass(IPSCCPPass(IPSCCPOptions(/*AllowFuncSpec=*/ - Level != OptimizationLevel::Os && - Level != OptimizationLevel::Oz))); + + // mono: FIXME: disabled for now, we need to fix mono EH frame generation first + // MPM.addPass(IPSCCPPass(IPSCCPOptions(/*AllowFuncSpec=*/ + // Level != OptimizationLevel::Os && + // Level != OptimizationLevel::Oz))); // Attach metadata to indirect call sites indicating the set of functions // they may target at run-time. This should follow IPSCCP. diff --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp index fc7b82d522bf0..4eff2deef9abc 100644 --- a/llvm/lib/Passes/StandardInstrumentations.cpp +++ b/llvm/lib/Passes/StandardInstrumentations.cpp @@ -23,7 +23,6 @@ #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineVerifier.h" -#include "llvm/Demangle/Demangle.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Function.h" #include "llvm/IR/Module.h" @@ -236,12 +235,12 @@ void printIR(raw_ostream &OS, const MachineFunction *MF) { MF->print(OS); } -std::string getIRName(Any IR, bool demangled = false) { +std::string getIRName(Any IR) { if (unwrapIR(IR)) return "[module]"; if (const auto *F = unwrapIR(IR)) - return demangled ? demangle(F->getName()) : F->getName().str(); + return F->getName().str(); if (const auto *C = unwrapIR(IR)) return C->getName(); @@ -251,7 +250,7 @@ std::string getIRName(Any IR, bool demangled = false) { L->getHeader()->getParent()->getName().str(); if (const auto *MF = unwrapIR(IR)) - return demangled ? demangle(MF->getName()) : MF->getName().str(); + return MF->getName().str(); llvm_unreachable("Unknown wrapped IR type"); } @@ -1589,7 +1588,7 @@ void TimeProfilingPassesHandler::registerCallbacks( } void TimeProfilingPassesHandler::runBeforePass(StringRef PassID, Any IR) { - timeTraceProfilerBegin(PassID, getIRName(IR, true)); + timeTraceProfilerBegin(PassID, getIRName(IR)); } void TimeProfilingPassesHandler::runAfterPass() { timeTraceProfilerEnd(); } diff --git a/llvm/lib/Support/Windows/Process.inc b/llvm/lib/Support/Windows/Process.inc index 34d294b232c32..d525f5b16e862 100644 --- a/llvm/lib/Support/Windows/Process.inc +++ b/llvm/lib/Support/Windows/Process.inc @@ -482,7 +482,8 @@ static RTL_OSVERSIONINFOEXW GetWindowsVer() { HMODULE hMod = ::GetModuleHandleW(L"ntdll.dll"); assert(hMod); - auto getVer = (RtlGetVersionPtr)::GetProcAddress(hMod, "RtlGetVersion"); + auto getVer = + (RtlGetVersionPtr)(void *)::GetProcAddress(hMod, "RtlGetVersion"); assert(getVer); RTL_OSVERSIONINFOEXW info{}; diff --git a/llvm/lib/Support/Windows/Signals.inc b/llvm/lib/Support/Windows/Signals.inc index 29ebf7c696e04..f11ad09f37139 100644 --- a/llvm/lib/Support/Windows/Signals.inc +++ b/llvm/lib/Support/Windows/Signals.inc @@ -171,23 +171,27 @@ static bool load64BitDebugHelp(void) { HMODULE hLib = ::LoadLibraryExA("Dbghelp.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); if (hLib) { - fMiniDumpWriteDump = - (fpMiniDumpWriteDump)::GetProcAddress(hLib, "MiniDumpWriteDump"); - fStackWalk64 = (fpStackWalk64)::GetProcAddress(hLib, "StackWalk64"); - fSymGetModuleBase64 = - (fpSymGetModuleBase64)::GetProcAddress(hLib, "SymGetModuleBase64"); - fSymGetSymFromAddr64 = - (fpSymGetSymFromAddr64)::GetProcAddress(hLib, "SymGetSymFromAddr64"); - fSymGetLineFromAddr64 = - (fpSymGetLineFromAddr64)::GetProcAddress(hLib, "SymGetLineFromAddr64"); - fSymGetModuleInfo64 = - (fpSymGetModuleInfo64)::GetProcAddress(hLib, "SymGetModuleInfo64"); - fSymFunctionTableAccess64 = (fpSymFunctionTableAccess64)::GetProcAddress( - hLib, "SymFunctionTableAccess64"); - fSymSetOptions = (fpSymSetOptions)::GetProcAddress(hLib, "SymSetOptions"); - fSymInitialize = (fpSymInitialize)::GetProcAddress(hLib, "SymInitialize"); - fEnumerateLoadedModules = (fpEnumerateLoadedModules)::GetProcAddress( - hLib, "EnumerateLoadedModules64"); + fMiniDumpWriteDump = (fpMiniDumpWriteDump)(void *)::GetProcAddress( + hLib, "MiniDumpWriteDump"); + fStackWalk64 = (fpStackWalk64)(void *)::GetProcAddress(hLib, "StackWalk64"); + fSymGetModuleBase64 = (fpSymGetModuleBase64)(void *)::GetProcAddress( + hLib, "SymGetModuleBase64"); + fSymGetSymFromAddr64 = (fpSymGetSymFromAddr64)(void *)::GetProcAddress( + hLib, "SymGetSymFromAddr64"); + fSymGetLineFromAddr64 = (fpSymGetLineFromAddr64)(void *)::GetProcAddress( + hLib, "SymGetLineFromAddr64"); + fSymGetModuleInfo64 = (fpSymGetModuleInfo64)(void *)::GetProcAddress( + hLib, "SymGetModuleInfo64"); + fSymFunctionTableAccess64 = + (fpSymFunctionTableAccess64)(void *)::GetProcAddress( + hLib, "SymFunctionTableAccess64"); + fSymSetOptions = + (fpSymSetOptions)(void *)::GetProcAddress(hLib, "SymSetOptions"); + fSymInitialize = + (fpSymInitialize)(void *)::GetProcAddress(hLib, "SymInitialize"); + fEnumerateLoadedModules = + (fpEnumerateLoadedModules)(void *)::GetProcAddress( + hLib, "EnumerateLoadedModules64"); } return isDebugHelpInitialized(); } diff --git a/llvm/lib/Support/Z3Solver.cpp b/llvm/lib/Support/Z3Solver.cpp index 5a34ff160f6cf..9aece099b0629 100644 --- a/llvm/lib/Support/Z3Solver.cpp +++ b/llvm/lib/Support/Z3Solver.cpp @@ -19,6 +19,7 @@ using namespace llvm; #include "llvm/ADT/Twine.h" #include +#include #include diff --git a/llvm/lib/Support/regcomp.c b/llvm/lib/Support/regcomp.c index 990aef32a396f..daa41eb4912ef 100644 --- a/llvm/lib/Support/regcomp.c +++ b/llvm/lib/Support/regcomp.c @@ -278,7 +278,7 @@ static char nuls[10]; /* place to point scanner in event of error */ #else #define DUPMAX 255 #endif -#define INFINITY (DUPMAX + 1) +#define REGINFINITY (DUPMAX + 1) #ifndef NDEBUG static int never = 0; /* for use in asserts; shuts lint up */ @@ -582,7 +582,7 @@ p_ere_exp(struct parse *p) count2 = p_count(p); REQUIRE(count <= count2, REG_BADBR); } else /* single number with comma */ - count2 = INFINITY; + count2 = REGINFINITY; } else /* just a single number */ count2 = count; repeat(p, pos, count, count2); @@ -753,7 +753,7 @@ p_simp_re(struct parse *p, count2 = p_count(p); REQUIRE(count <= count2, REG_BADBR); } else /* single number with comma */ - count2 = INFINITY; + count2 = REGINFINITY; } else /* just a single number */ count2 = count; repeat(p, pos, count, count2); @@ -1115,7 +1115,7 @@ repeat(struct parse *p, # define N 2 # define INF 3 # define REP(f, t) ((f)*8 + (t)) -# define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N) +# define MAP(n) (((n) <= 1) ? (n) : ((n) == REGINFINITY) ? INF : N) sopno copy; if (p->error != 0) /* head off possible runaway recursion */ diff --git a/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp b/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp index 310b152ef9817..415edb189e60c 100644 --- a/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp @@ -833,6 +833,11 @@ bool AArch64Arm64ECCallLowering::runOnModule(Module &Mod) { "EXP+" + MangledName.value()))); A->setAliasee(&F); + if (F.hasDLLExportStorageClass()) { + A->setDLLStorageClass(GlobalValue::DLLExportStorageClass); + F.setDLLStorageClass(GlobalValue::DefaultStorageClass); + } + FnsMap[A] = GlobalAlias::create(GlobalValue::LinkOnceODRLinkage, MangledName.value(), &F); PatchableFns.insert(A); diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp index 3c9b07ad45bf2..c64454cc253c3 100644 --- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp +++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp @@ -1292,6 +1292,13 @@ void AArch64AsmPrinter::emitGlobalAlias(const Module &M, StringRef ExpStr = cast(Node->getOperand(0))->getString(); MCSymbol *ExpSym = MMI->getContext().getOrCreateSymbol(ExpStr); MCSymbol *Sym = MMI->getContext().getOrCreateSymbol(GA.getName()); + + OutStreamer->beginCOFFSymbolDef(ExpSym); + OutStreamer->emitCOFFSymbolStorageClass(COFF::IMAGE_SYM_CLASS_EXTERNAL); + OutStreamer->emitCOFFSymbolType(COFF::IMAGE_SYM_DTYPE_FUNCTION + << COFF::SCT_COMPLEX_TYPE_SHIFT); + OutStreamer->endCOFFSymbolDef(); + OutStreamer->beginCOFFSymbolDef(Sym); OutStreamer->emitCOFFSymbolStorageClass(COFF::IMAGE_SYM_CLASS_EXTERNAL); OutStreamer->emitCOFFSymbolType(COFF::IMAGE_SYM_DTYPE_FUNCTION diff --git a/llvm/lib/Target/AArch64/AArch64CallingConvention.h b/llvm/lib/Target/AArch64/AArch64CallingConvention.h index 63185a97cba03..820aeac90f026 100644 --- a/llvm/lib/Target/AArch64/AArch64CallingConvention.h +++ b/llvm/lib/Target/AArch64/AArch64CallingConvention.h @@ -65,6 +65,15 @@ bool RetCC_AArch64_Arm64EC_CFGuard_Check(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State); +bool RetCC_AArch64_WebKit_JS(unsigned ValNo, MVT ValVT, MVT LocVT, + CCValAssign::LocInfo LocInfo, + ISD::ArgFlagsTy ArgFlags, CCState &State); +bool CC_AArch64_Mono_DarwinPCS(unsigned ValNo, MVT ValVT, MVT LocVT, + CCValAssign::LocInfo LocInfo, + ISD::ArgFlagsTy ArgFlags, CCState &State); +bool CC_AArch64_Mono_AAPCS(unsigned ValNo, MVT ValVT, MVT LocVT, + CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, + CCState &State); } // namespace llvm #endif diff --git a/llvm/lib/Target/AArch64/AArch64CallingConvention.td b/llvm/lib/Target/AArch64/AArch64CallingConvention.td index 2bbb4997d56a5..a5afd0f56a519 100644 --- a/llvm/lib/Target/AArch64/AArch64CallingConvention.td +++ b/llvm/lib/Target/AArch64/AArch64CallingConvention.td @@ -754,3 +754,28 @@ def CSR_AArch64_SVE_AAPCS_SCS : CalleeSavedRegs<(add CSR_AArch64_SVE_AAPCS, X18)>; def CSR_AArch64_AAPCS_SCS : CalleeSavedRegs<(add CSR_AArch64_AAPCS, X18)>; + +//===----------------------------------------------------------------------===// +// AARCH64 Mono calling conventions +//===----------------------------------------------------------------------===// + +let Entry = 1 in +def CC_AArch64_Mono_DarwinPCS : CallingConv<[ + + // Mono marks the parameter it wants to pass in this non-abi register with + // the 'inreg' attribute. + CCIfInReg>, + + CCDelegateTo +]>; + +let Entry = 1 in +def CC_AArch64_Mono_AAPCS : CallingConv<[ + + // Mono marks the parameter it wants to pass in this non-abi register with + // the 'inreg' attribute. + CCIfInReg>, + + CCDelegateTo +]>; + diff --git a/llvm/lib/Target/AArch64/AArch64DeadRegisterDefinitionsPass.cpp b/llvm/lib/Target/AArch64/AArch64DeadRegisterDefinitionsPass.cpp index 2bc14f9821e63..161cf24dd4037 100644 --- a/llvm/lib/Target/AArch64/AArch64DeadRegisterDefinitionsPass.cpp +++ b/llvm/lib/Target/AArch64/AArch64DeadRegisterDefinitionsPass.cpp @@ -108,6 +108,10 @@ static bool atomicReadDroppedOnZero(unsigned Opcode) { case AArch64::LDUMINW: case AArch64::LDUMINX: case AArch64::LDUMINLB: case AArch64::LDUMINLH: case AArch64::LDUMINLW: case AArch64::LDUMINLX: + case AArch64::SWPB: case AArch64::SWPH: + case AArch64::SWPW: case AArch64::SWPX: + case AArch64::SWPLB: case AArch64::SWPLH: + case AArch64::SWPLW: case AArch64::SWPLX: return true; } return false; diff --git a/llvm/lib/Target/AArch64/AArch64Features.td b/llvm/lib/Target/AArch64/AArch64Features.td index a1ae0873fc190..a4f8f8c2d9629 100644 --- a/llvm/lib/Target/AArch64/AArch64Features.td +++ b/llvm/lib/Target/AArch64/AArch64Features.td @@ -438,6 +438,15 @@ def FeatureSVE2p1: ExtensionWithMArch<"sve2p1", "SVE2p1", "FEAT_SVE2p1", def FeatureB16B16 : ExtensionWithMArch<"b16b16", "B16B16", "FEAT_SVE_B16B16", "Enable SVE2.1 or SME2.1 non-widening BFloat16 to BFloat16 instructions", [FeatureBF16]>; +// FeatureSVEB16B16 and FeatureSMEB16B16 act as aliases for {FeatureB16B16}, and +// {FeatureB16B16, FeatureSME2} respectively. This allows LLVM-20 interfacing programs +// that use '+sve-b16b16' and '+sme-b16b16' to compile in LLVM-19. +def FeatureSVEB16B16 : ExtensionWithMArch<"sve-b16b16", "SVEB16B16", "FEAT_SVE_B16B16", + "Enable SVE2 non-widening and SME2 Z-targeting non-widening BFloat16 instructions", [FeatureB16B16]>; + +def FeatureSMEB16B16 : ExtensionWithMArch<"sme-b16b16", "SMEB16B16", "FEAT_SME_B16B16", + "Enable SME2.1 ZA-targeting non-widening BFloat16 instructions", [FeatureSME2, FeatureB16B16]>; + def FeatureSMEF16F16 : ExtensionWithMArch<"sme-f16f16", "SMEF16F16", "FEAT_SME_F16F16", "Enable SME non-widening Float16 instructions", [FeatureSME2]>; @@ -778,27 +787,26 @@ def HasV8_2aOps : Architecture64<8, 2, "a", "v8.2a", [HasV8_1aOps, FeaturePsUAO, FeaturePAN_RWV, FeatureRAS, FeatureCCPP], !listconcat(HasV8_1aOps.DefaultExts, [FeatureRAS])>; def HasV8_3aOps : Architecture64<8, 3, "a", "v8.3a", - [HasV8_2aOps, FeatureRCPC, FeaturePAuth, FeatureJS, FeatureCCIDX, - FeatureComplxNum], + [HasV8_2aOps, FeatureRCPC, FeaturePAuth, FeatureJS, FeatureComplxNum], !listconcat(HasV8_2aOps.DefaultExts, [FeatureComplxNum, FeatureJS, - FeaturePAuth, FeatureRCPC])>; + FeaturePAuth, FeatureRCPC, FeatureCCIDX])>; def HasV8_4aOps : Architecture64<8, 4, "a", "v8.4a", [HasV8_3aOps, FeatureDotProd, FeatureNV, FeatureMPAM, FeatureDIT, FeatureTRACEV8_4, FeatureAM, FeatureSEL2, FeatureTLB_RMI, FeatureFlagM, FeatureRCPC_IMMO, FeatureLSE2], - !listconcat(HasV8_3aOps.DefaultExts, [FeatureDotProd])>; + !listconcat(HasV8_3aOps.DefaultExts, [FeatureDotProd, FeatureDIT, FeatureFlagM])>; def HasV8_5aOps : Architecture64<8, 5, "a", "v8.5a", [HasV8_4aOps, FeatureAltFPCmp, FeatureFRInt3264, FeatureSpecRestrict, - FeatureSSBS, FeatureSB, FeaturePredRes, FeatureCacheDeepPersist, + FeatureSB, FeaturePredRes, FeatureCacheDeepPersist, FeatureBranchTargetId], - !listconcat(HasV8_4aOps.DefaultExts, [])>; + !listconcat(HasV8_4aOps.DefaultExts, [FeaturePredRes, FeatureSSBS, FeatureBranchTargetId, FeatureSB])>; def HasV8_6aOps : Architecture64<8, 6, "a", "v8.6a", [HasV8_5aOps, FeatureAMVS, FeatureBF16, FeatureFineGrainedTraps, FeatureEnhancedCounterVirtualization, FeatureMatMulInt8], !listconcat(HasV8_5aOps.DefaultExts, [FeatureBF16, FeatureMatMulInt8])>; def HasV8_7aOps : Architecture64<8, 7, "a", "v8.7a", [HasV8_6aOps, FeatureXS, FeatureWFxT, FeatureHCX], - !listconcat(HasV8_6aOps.DefaultExts, [])>; + !listconcat(HasV8_6aOps.DefaultExts, [FeatureWFxT])>; def HasV8_8aOps : Architecture64<8, 8, "a", "v8.8a", [HasV8_7aOps, FeatureHBC, FeatureMOPS, FeatureNMI], !listconcat(HasV8_7aOps.DefaultExts, [FeatureMOPS, FeatureHBC])>; @@ -816,7 +824,7 @@ def HasV9_1aOps : Architecture64<9, 1, "a", "v9.1a", !listconcat(HasV9_0aOps.DefaultExts, [FeatureBF16, FeatureMatMulInt8, FeatureRME])>; def HasV9_2aOps : Architecture64<9, 2, "a", "v9.2a", [HasV8_7aOps, HasV9_1aOps], - !listconcat(HasV9_1aOps.DefaultExts, [FeatureMEC])>; + !listconcat(HasV9_1aOps.DefaultExts, [FeatureMEC, FeatureWFxT])>; def HasV9_3aOps : Architecture64<9, 3, "a", "v9.3a", [HasV8_8aOps, HasV9_2aOps], !listconcat(HasV9_2aOps.DefaultExts, [FeatureMOPS, FeatureHBC])>; @@ -833,7 +841,7 @@ def HasV8_0rOps : Architecture64<8, 0, "r", "v8r", //v8.2 FeatureRAS, FeaturePsUAO, FeatureCCPP, FeaturePAN_RWV, //v8.3 - FeatureCCIDX, FeaturePAuth, FeatureRCPC, + FeaturePAuth, FeatureRCPC, //v8.4 FeatureTRACEV8_4, FeatureTLB_RMI, FeatureFlagM, FeatureDIT, FeatureSEL2, FeatureRCPC_IMMO, @@ -844,7 +852,7 @@ def HasV8_0rOps : Architecture64<8, 0, "r", "v8r", // For v8-R, we do not enable crypto and align with GCC that enables a more // minimal set of optional architecture extensions. !listconcat( - !listremove(HasV8_5aOps.DefaultExts, [FeatureLSE]), + !listremove(HasV8_5aOps.DefaultExts, [FeatureBranchTargetId, FeaturePredRes]), [FeatureSSBS, FeatureFullFP16, FeatureFP16FML, FeatureSB] )>; diff --git a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp index b1b83e27c5592..87e057a468afd 100644 --- a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp @@ -240,6 +240,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetMachine.h" @@ -275,6 +276,10 @@ cl::opt EnableHomogeneousPrologEpilog( // Stack hazard padding size. 0 = disabled. static cl::opt StackHazardSize("aarch64-stack-hazard-size", cl::init(0), cl::Hidden); +// Stack hazard size for analysis remarks. StackHazardSize takes precedence. +static cl::opt + StackHazardRemarkSize("aarch64-stack-hazard-remark-size", cl::init(0), + cl::Hidden); // Whether to insert padding into non-streaming functions (for testing). static cl::opt StackHazardInNonStreaming("aarch64-stack-hazard-in-non-streaming", @@ -2603,6 +2608,48 @@ AArch64FrameLowering::getFrameIndexReference(const MachineFunction &MF, int FI, /*ForSimm=*/false); } +StackOffset +AArch64FrameLowering::getFrameIndexReferenceFromSP(const MachineFunction &MF, + int FI) const { + // This function serves to provide a comparable offset from a single reference + // point (the value of SP at function entry) that can be used for analysis, + // e.g. the stack-frame-layout analysis pass. It is not guaranteed to be + // correct for all objects in the presence of VLA-area objects or dynamic + // stack re-alignment. + + const auto &MFI = MF.getFrameInfo(); + + int64_t ObjectOffset = MFI.getObjectOffset(FI); + StackOffset SVEStackSize = getSVEStackSize(MF); + + // For VLA-area objects, just emit an offset at the end of the stack frame. + // Whilst not quite correct, these objects do live at the end of the frame and + // so it is more useful for analysis for the offset to reflect this. + if (MFI.isVariableSizedObjectIndex(FI)) { + return StackOffset::getFixed(-((int64_t)MFI.getStackSize())) - SVEStackSize; + } + + // This is correct in the absence of any SVE stack objects. + if (!SVEStackSize) + return StackOffset::getFixed(ObjectOffset - getOffsetOfLocalArea()); + + const auto *AFI = MF.getInfo(); + if (MFI.getStackID(FI) == TargetStackID::ScalableVector) { + return StackOffset::get(-((int64_t)AFI->getCalleeSavedStackSize()), + ObjectOffset); + } + + bool IsFixed = MFI.isFixedObjectIndex(FI); + bool IsCSR = + !IsFixed && ObjectOffset >= -((int)AFI->getCalleeSavedStackSize(MFI)); + + StackOffset ScalableOffset = {}; + if (!IsFixed && !IsCSR) + ScalableOffset = -SVEStackSize; + + return StackOffset::getFixed(ObjectOffset) + ScalableOffset; +} + StackOffset AArch64FrameLowering::getNonLocalFrameIndexReference(const MachineFunction &MF, int FI) const { @@ -2884,16 +2931,6 @@ struct RegPairInfo { } // end anonymous namespace -unsigned findFreePredicateReg(BitVector &SavedRegs) { - for (unsigned PReg = AArch64::P8; PReg <= AArch64::P15; ++PReg) { - if (SavedRegs.test(PReg)) { - unsigned PNReg = PReg - AArch64::P0 + AArch64::PN0; - return PNReg; - } - } - return AArch64::NoRegister; -} - static void computeCalleeSaveRegisterPairs( MachineFunction &MF, ArrayRef CSI, const TargetRegisterInfo *TRI, SmallVectorImpl &RegPairs, @@ -3493,13 +3530,9 @@ bool AArch64FrameLowering::restoreCalleeSavedRegisters( return true; } -// Return the FrameID for a Load/Store instruction by looking at the MMO. -static std::optional getLdStFrameID(const MachineInstr &MI, - const MachineFrameInfo &MFI) { - if (!MI.mayLoadOrStore() || MI.getNumMemOperands() < 1) - return std::nullopt; - - MachineMemOperand *MMO = *MI.memoperands_begin(); +// Return the FrameID for a MMO. +static std::optional getMMOFrameID(MachineMemOperand *MMO, + const MachineFrameInfo &MFI) { auto *PSV = dyn_cast_or_null(MMO->getPseudoValue()); if (PSV) @@ -3517,6 +3550,15 @@ static std::optional getLdStFrameID(const MachineInstr &MI, return std::nullopt; } +// Return the FrameID for a Load/Store instruction by looking at the first MMO. +static std::optional getLdStFrameID(const MachineInstr &MI, + const MachineFrameInfo &MFI) { + if (!MI.mayLoadOrStore() || MI.getNumMemOperands() < 1) + return std::nullopt; + + return getMMOFrameID(*MI.memoperands_begin(), MFI); +} + // Check if a Hazard slot is needed for the current function, and if so create // one for it. The index is stored in AArch64FunctionInfo->StackHazardSlotIndex, // which can be used to determine if any hazard padding is needed. @@ -3593,7 +3635,6 @@ void AArch64FrameLowering::determineCalleeSaves(MachineFunction &MF, unsigned ExtraCSSpill = 0; bool HasUnpairedGPR64 = false; - bool HasPairZReg = false; // Figure out which callee-saved registers to save/restore. for (unsigned i = 0; CSRegs[i]; ++i) { const unsigned Reg = CSRegs[i]; @@ -3647,28 +3688,6 @@ void AArch64FrameLowering::determineCalleeSaves(MachineFunction &MF, !RegInfo->isReservedReg(MF, PairedReg)) ExtraCSSpill = PairedReg; } - // Check if there is a pair of ZRegs, so it can select PReg for spill/fill - HasPairZReg |= (AArch64::ZPRRegClass.contains(Reg, CSRegs[i ^ 1]) && - SavedRegs.test(CSRegs[i ^ 1])); - } - - if (HasPairZReg && (Subtarget.hasSVE2p1() || Subtarget.hasSME2())) { - AArch64FunctionInfo *AFI = MF.getInfo(); - // Find a suitable predicate register for the multi-vector spill/fill - // instructions. - unsigned PnReg = findFreePredicateReg(SavedRegs); - if (PnReg != AArch64::NoRegister) - AFI->setPredicateRegForFillSpill(PnReg); - // If no free callee-save has been found assign one. - if (!AFI->getPredicateRegForFillSpill() && - MF.getFunction().getCallingConv() == - CallingConv::AArch64_SVE_VectorCall) { - SavedRegs.set(AArch64::P8); - AFI->setPredicateRegForFillSpill(AArch64::PN8); - } - - assert(!RegInfo->isReservedReg(MF, AFI->getPredicateRegForFillSpill()) && - "Predicate cannot be a reserved register"); } if (MF.getFunction().getCallingConv() == CallingConv::Win64 && @@ -4994,3 +5013,174 @@ void AArch64FrameLowering::inlineStackProbe(MachineFunction &MF, MI->eraseFromParent(); } } + +struct StackAccess { + enum AccessType { + NotAccessed = 0, // Stack object not accessed by load/store instructions. + GPR = 1 << 0, // A general purpose register. + PPR = 1 << 1, // A predicate register. + FPR = 1 << 2, // A floating point/Neon/SVE register. + }; + + int Idx; + StackOffset Offset; + int64_t Size; + unsigned AccessTypes; + + StackAccess() : Idx(0), Offset(), Size(0), AccessTypes(NotAccessed) {} + + bool operator<(const StackAccess &Rhs) const { + return std::make_tuple(start(), Idx) < + std::make_tuple(Rhs.start(), Rhs.Idx); + } + + bool isCPU() const { + // Predicate register load and store instructions execute on the CPU. + return AccessTypes & (AccessType::GPR | AccessType::PPR); + } + bool isSME() const { return AccessTypes & AccessType::FPR; } + bool isMixed() const { return isCPU() && isSME(); } + + int64_t start() const { return Offset.getFixed() + Offset.getScalable(); } + int64_t end() const { return start() + Size; } + + std::string getTypeString() const { + switch (AccessTypes) { + case AccessType::FPR: + return "FPR"; + case AccessType::PPR: + return "PPR"; + case AccessType::GPR: + return "GPR"; + case AccessType::NotAccessed: + return "NA"; + default: + return "Mixed"; + } + } + + void print(raw_ostream &OS) const { + OS << getTypeString() << " stack object at [SP" + << (Offset.getFixed() < 0 ? "" : "+") << Offset.getFixed(); + if (Offset.getScalable()) + OS << (Offset.getScalable() < 0 ? "" : "+") << Offset.getScalable() + << " * vscale"; + OS << "]"; + } +}; + +static inline raw_ostream &operator<<(raw_ostream &OS, const StackAccess &SA) { + SA.print(OS); + return OS; +} + +void AArch64FrameLowering::emitRemarks( + const MachineFunction &MF, MachineOptimizationRemarkEmitter *ORE) const { + + SMEAttrs Attrs(MF.getFunction()); + if (Attrs.hasNonStreamingInterfaceAndBody()) + return; + + const uint64_t HazardSize = + (StackHazardSize) ? StackHazardSize : StackHazardRemarkSize; + + if (HazardSize == 0) + return; + + const MachineFrameInfo &MFI = MF.getFrameInfo(); + // Bail if function has no stack objects. + if (!MFI.hasStackObjects()) + return; + + std::vector StackAccesses(MFI.getNumObjects()); + + size_t NumFPLdSt = 0; + size_t NumNonFPLdSt = 0; + + // Collect stack accesses via Load/Store instructions. + for (const MachineBasicBlock &MBB : MF) { + for (const MachineInstr &MI : MBB) { + if (!MI.mayLoadOrStore() || MI.getNumMemOperands() < 1) + continue; + for (MachineMemOperand *MMO : MI.memoperands()) { + std::optional FI = getMMOFrameID(MMO, MFI); + if (FI && !MFI.isDeadObjectIndex(*FI)) { + int FrameIdx = *FI; + + size_t ArrIdx = FrameIdx + MFI.getNumFixedObjects(); + if (StackAccesses[ArrIdx].AccessTypes == StackAccess::NotAccessed) { + StackAccesses[ArrIdx].Idx = FrameIdx; + StackAccesses[ArrIdx].Offset = + getFrameIndexReferenceFromSP(MF, FrameIdx); + StackAccesses[ArrIdx].Size = MFI.getObjectSize(FrameIdx); + } + + unsigned RegTy = StackAccess::AccessType::GPR; + if (MFI.getStackID(FrameIdx) == TargetStackID::ScalableVector) { + if (AArch64::PPRRegClass.contains(MI.getOperand(0).getReg())) + RegTy = StackAccess::PPR; + else + RegTy = StackAccess::FPR; + } else if (AArch64InstrInfo::isFpOrNEON(MI)) { + RegTy = StackAccess::FPR; + } + + StackAccesses[ArrIdx].AccessTypes |= RegTy; + + if (RegTy == StackAccess::FPR) + ++NumFPLdSt; + else + ++NumNonFPLdSt; + } + } + } + } + + if (NumFPLdSt == 0 || NumNonFPLdSt == 0) + return; + + llvm::sort(StackAccesses); + StackAccesses.erase(llvm::remove_if(StackAccesses, + [](const StackAccess &S) { + return S.AccessTypes == + StackAccess::NotAccessed; + }), + StackAccesses.end()); + + SmallVector MixedObjects; + SmallVector> HazardPairs; + + if (StackAccesses.front().isMixed()) + MixedObjects.push_back(&StackAccesses.front()); + + for (auto It = StackAccesses.begin(), End = std::prev(StackAccesses.end()); + It != End; ++It) { + const auto &First = *It; + const auto &Second = *(It + 1); + + if (Second.isMixed()) + MixedObjects.push_back(&Second); + + if ((First.isSME() && Second.isCPU()) || + (First.isCPU() && Second.isSME())) { + uint64_t Distance = static_cast(Second.start() - First.end()); + if (Distance < HazardSize) + HazardPairs.emplace_back(&First, &Second); + } + } + + auto EmitRemark = [&](llvm::StringRef Str) { + ORE->emit([&]() { + auto R = MachineOptimizationRemarkAnalysis( + "sme", "StackHazard", MF.getFunction().getSubprogram(), &MF.front()); + return R << formatv("stack hazard in '{0}': ", MF.getName()).str() << Str; + }); + }; + + for (const auto &P : HazardPairs) + EmitRemark(formatv("{0} is too close to {1}", *P.first, *P.second).str()); + + for (const auto *Obj : MixedObjects) + EmitRemark( + formatv("{0} accessed by both GP and FP instructions", *Obj).str()); +} diff --git a/llvm/lib/Target/AArch64/AArch64FrameLowering.h b/llvm/lib/Target/AArch64/AArch64FrameLowering.h index da315850d6362..c197312496208 100644 --- a/llvm/lib/Target/AArch64/AArch64FrameLowering.h +++ b/llvm/lib/Target/AArch64/AArch64FrameLowering.h @@ -13,8 +13,9 @@ #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H #define LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H -#include "llvm/Support/TypeSize.h" +#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h" #include "llvm/CodeGen/TargetFrameLowering.h" +#include "llvm/Support/TypeSize.h" namespace llvm { @@ -41,6 +42,8 @@ class AArch64FrameLowering : public TargetFrameLowering { StackOffset getFrameIndexReference(const MachineFunction &MF, int FI, Register &FrameReg) const override; + StackOffset getFrameIndexReferenceFromSP(const MachineFunction &MF, + int FI) const override; StackOffset resolveFrameIndexReference(const MachineFunction &MF, int FI, Register &FrameReg, bool PreferFP, bool ForSimm) const; @@ -176,6 +179,9 @@ class AArch64FrameLowering : public TargetFrameLowering { inlineStackProbeLoopExactMultiple(MachineBasicBlock::iterator MBBI, int64_t NegProbeSize, Register TargetReg) const; + + void emitRemarks(const MachineFunction &MF, + MachineOptimizationRemarkEmitter *ORE) const override; }; } // End llvm namespace diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 87e7750768d2d..7e1100cbf6219 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -1080,6 +1080,10 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM, // Try to create BICs for vector ANDs. setTargetDAGCombine(ISD::AND); + // llvm.init.trampoline and llvm.adjust.trampoline + setOperationAction(ISD::INIT_TRAMPOLINE, MVT::Other, Custom); + setOperationAction(ISD::ADJUST_TRAMPOLINE, MVT::Other, Custom); + // Vector add and sub nodes may conceal a high-half opportunity. // Also, try to fold ADD into CSINC/CSINV.. setTargetDAGCombine({ISD::ADD, ISD::ABS, ISD::SUB, ISD::XOR, ISD::SINT_TO_FP, @@ -6688,6 +6692,56 @@ static SDValue LowerFLDEXP(SDValue Op, SelectionDAG &DAG) { return Final; } +SDValue AArch64TargetLowering::LowerADJUST_TRAMPOLINE(SDValue Op, + SelectionDAG &DAG) const { + // Note: x18 cannot be used for the Nest parameter on Windows and macOS. + if (Subtarget->isTargetDarwin() || Subtarget->isTargetWindows()) + report_fatal_error( + "ADJUST_TRAMPOLINE operation is only supported on Linux."); + + return Op.getOperand(0); +} + +SDValue AArch64TargetLowering::LowerINIT_TRAMPOLINE(SDValue Op, + SelectionDAG &DAG) const { + + // Note: x18 cannot be used for the Nest parameter on Windows and macOS. + if (Subtarget->isTargetDarwin() || Subtarget->isTargetWindows()) + report_fatal_error("INIT_TRAMPOLINE operation is only supported on Linux."); + + SDValue Chain = Op.getOperand(0); + SDValue Trmp = Op.getOperand(1); // trampoline + SDValue FPtr = Op.getOperand(2); // nested function + SDValue Nest = Op.getOperand(3); // 'nest' parameter value + SDLoc dl(Op); + + EVT PtrVT = getPointerTy(DAG.getDataLayout()); + Type *IntPtrTy = DAG.getDataLayout().getIntPtrType(*DAG.getContext()); + + TargetLowering::ArgListTy Args; + TargetLowering::ArgListEntry Entry; + + Entry.Ty = IntPtrTy; + Entry.Node = Trmp; + Args.push_back(Entry); + Entry.Node = DAG.getConstant(20, dl, MVT::i64); + Args.push_back(Entry); + + Entry.Node = FPtr; + Args.push_back(Entry); + Entry.Node = Nest; + Args.push_back(Entry); + + // Lower to a call to __trampoline_setup(Trmp, TrampSize, FPtr, ctx_reg) + TargetLowering::CallLoweringInfo CLI(DAG); + CLI.setDebugLoc(dl).setChain(Chain).setLibCallee( + CallingConv::C, Type::getVoidTy(*DAG.getContext()), + DAG.getExternalSymbol("__trampoline_setup", PtrVT), std::move(Args)); + + std::pair CallResult = LowerCallTo(CLI); + return CallResult.second; +} + SDValue AArch64TargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const { LLVM_DEBUG(dbgs() << "Custom lowering: "); @@ -6705,6 +6759,10 @@ SDValue AArch64TargetLowering::LowerOperation(SDValue Op, return LowerGlobalTLSAddress(Op, DAG); case ISD::PtrAuthGlobalAddress: return LowerPtrAuthGlobalAddress(Op, DAG); + case ISD::ADJUST_TRAMPOLINE: + return LowerADJUST_TRAMPOLINE(Op, DAG); + case ISD::INIT_TRAMPOLINE: + return LowerINIT_TRAMPOLINE(Op, DAG); case ISD::SETCC: case ISD::STRICT_FSETCC: case ISD::STRICT_FSETCCS: @@ -7173,6 +7231,13 @@ CCAssignFn *AArch64TargetLowering::CCAssignFnForCall(CallingConv::ID CC, return CC_AArch64_Arm64EC_Thunk; case CallingConv::ARM64EC_Thunk_Native: return CC_AArch64_Arm64EC_Thunk_Native; + case CallingConv::Mono: + if (Subtarget->isTargetDarwin()) + return CC_AArch64_Mono_DarwinPCS; + else if (Subtarget->isTargetWindows()) + report_fatal_error("Unsupported calling convention."); + else + return CC_AArch64_Mono_AAPCS; } } @@ -17661,6 +17726,9 @@ static SDValue performVecReduceAddCombineWithUADDLP(SDNode *N, // and generate vecreduce.add(concat_vector(DOT, DOT2, ..)). static SDValue performVecReduceAddCombine(SDNode *N, SelectionDAG &DAG, const AArch64Subtarget *ST) { + if (!ST->isNeonAvailable()) + return SDValue(); + if (!ST->hasDotProd()) return performVecReduceAddCombineWithUADDLP(N, DAG); diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.h b/llvm/lib/Target/AArch64/AArch64ISelLowering.h index ef45e4f01ecd3..81e15185f985d 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.h +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.h @@ -1143,6 +1143,8 @@ class AArch64TargetLowering : public TargetLowering { SDValue LowerSELECT_CC(ISD::CondCode CC, SDValue LHS, SDValue RHS, SDValue TVal, SDValue FVal, const SDLoc &dl, SelectionDAG &DAG) const; + SDValue LowerINIT_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const; + SDValue LowerADJUST_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const; SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const; SDValue LowerBR_JT(SDValue Op, SelectionDAG &DAG) const; SDValue LowerBRIND(SDValue Op, SelectionDAG &DAG) const; diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp index 1b301a4a05fc5..805684ef69a59 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -5144,10 +5144,6 @@ void AArch64InstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB, if (PNRReg.isValid() && !PNRReg.isVirtual()) MI.addDef(PNRReg, RegState::Implicit); MI.addMemOperand(MMO); - - if (PNRReg.isValid() && PNRReg.isVirtual()) - BuildMI(MBB, MBBI, DebugLoc(), get(TargetOpcode::COPY), PNRReg) - .addReg(DestReg); } bool llvm::isNZCVTouchedInInstructionRange(const MachineInstr &DefMI, @@ -8339,7 +8335,8 @@ AArch64InstrInfo::getOutliningCandidateInfo( NumBytesToCreateFrame += 8; // PAuth is enabled - set extra tail call cost, if any. - auto LRCheckMethod = Subtarget.getAuthenticatedLRCheckMethod(); + auto LRCheckMethod = Subtarget.getAuthenticatedLRCheckMethod( + *RepeatedSequenceLocs[0].getMF()); NumBytesToCheckLRInTCEpilogue = AArch64PAuth::getCheckerSizeInBytes(LRCheckMethod); // Checking the authenticated LR value may significantly impact @@ -8700,6 +8697,10 @@ void AArch64InstrInfo::mergeOutliningCandidateAttributes( // behaviour of one of them const auto &CFn = Candidates.front().getMF()->getFunction(); + if (CFn.hasFnAttribute("ptrauth-returns")) + F.addFnAttr(CFn.getFnAttribute("ptrauth-returns")); + if (CFn.hasFnAttribute("ptrauth-auth-traps")) + F.addFnAttr(CFn.getFnAttribute("ptrauth-auth-traps")); // Since all candidates belong to the same module, just copy the // function-level attributes of an arbitrary function. if (CFn.hasFnAttribute("sign-return-address")) diff --git a/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp b/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp index 201e8047b3686..e96c5a953ff2b 100644 --- a/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp @@ -38,6 +38,8 @@ void AArch64FunctionInfo::initializeBaseYamlFields( } static std::pair GetSignReturnAddress(const Function &F) { + if (F.hasFnAttribute("ptrauth-returns")) + return {true, false}; // non-leaf // The function should be signed in the following situations: // - sign-return-address=all // - sign-return-address=non-leaf and the functions spills the LR @@ -56,6 +58,8 @@ static std::pair GetSignReturnAddress(const Function &F) { } static bool ShouldSignWithBKey(const Function &F, const AArch64Subtarget &STI) { + if (F.hasFnAttribute("ptrauth-returns")) + return true; if (!F.hasFnAttribute("sign-return-address-key")) { if (STI.getTargetTriple().isOSWindows()) return true; diff --git a/llvm/lib/Target/AArch64/AArch64PointerAuth.cpp b/llvm/lib/Target/AArch64/AArch64PointerAuth.cpp index 465e689d4a7a5..92ab4b5c3d251 100644 --- a/llvm/lib/Target/AArch64/AArch64PointerAuth.cpp +++ b/llvm/lib/Target/AArch64/AArch64PointerAuth.cpp @@ -341,7 +341,8 @@ bool AArch64PointerAuth::checkAuthenticatedLR( AArch64PACKey::ID KeyId = MFnI->shouldSignWithBKey() ? AArch64PACKey::IB : AArch64PACKey::IA; - AuthCheckMethod Method = Subtarget->getAuthenticatedLRCheckMethod(); + AuthCheckMethod Method = + Subtarget->getAuthenticatedLRCheckMethod(*TI->getMF()); if (Method == AuthCheckMethod::None) return false; diff --git a/llvm/lib/Target/AArch64/AArch64Processors.td b/llvm/lib/Target/AArch64/AArch64Processors.td index 71384a23c49af..410b53e14de22 100644 --- a/llvm/lib/Target/AArch64/AArch64Processors.td +++ b/llvm/lib/Target/AArch64/AArch64Processors.td @@ -688,6 +688,7 @@ def ProcessorFeatures { FeatureMatMulInt8, FeatureBF16, FeatureAM, FeatureMTE, FeatureETE, FeatureSVE2BitPerm, FeatureFP16FML, + FeatureCCIDX, FeatureSB, FeaturePAuth, FeatureSSBS, FeatureSVE, FeatureSVE2, FeatureComplxNum, FeatureCRC, FeatureDotProd, FeatureFPARMv8,FeatureFullFP16, FeatureJS, FeatureLSE, @@ -695,6 +696,7 @@ def ProcessorFeatures { list A520 = [HasV9_2aOps, FeaturePerfMon, FeatureAM, FeatureMTE, FeatureETE, FeatureSVE2BitPerm, FeatureFP16FML, + FeatureCCIDX, FeatureSB, FeatureSSBS, FeaturePAuth, FeatureFlagM, FeaturePredRes, FeatureSVE, FeatureSVE2, FeatureBF16, FeatureComplxNum, FeatureCRC, FeatureFPARMv8, FeatureFullFP16, FeatureMatMulInt8, FeatureJS, @@ -703,6 +705,7 @@ def ProcessorFeatures { list A520AE = [HasV9_2aOps, FeaturePerfMon, FeatureAM, FeatureMTE, FeatureETE, FeatureSVE2BitPerm, FeatureFP16FML, + FeatureCCIDX, FeatureSB, FeatureSSBS, FeaturePAuth, FeatureFlagM, FeaturePredRes, FeatureSVE, FeatureSVE2, FeatureBF16, FeatureComplxNum, FeatureCRC, FeatureFPARMv8, FeatureFullFP16, FeatureMatMulInt8, FeatureJS, @@ -734,12 +737,14 @@ def ProcessorFeatures { FeaturePerfMon, FeatureRCPC, FeatureSPE, FeatureSSBS, FeatureCRC, FeatureLSE, FeatureRAS, FeatureRDM]; list A710 = [HasV9_0aOps, FeatureNEON, FeaturePerfMon, + FeatureCCIDX, FeatureSSBS, FeatureETE, FeatureMTE, FeatureFP16FML, FeatureSVE2BitPerm, FeatureBF16, FeatureMatMulInt8, FeaturePAuth, FeatureFlagM, FeatureSB, FeatureSVE, FeatureSVE2, FeatureComplxNum, FeatureCRC, FeatureDotProd, FeatureFPARMv8, FeatureFullFP16, FeatureJS, FeatureLSE, FeatureRAS, FeatureRCPC, FeatureRDM]; list A715 = [HasV9_0aOps, FeatureNEON, FeatureMTE, + FeatureCCIDX, FeatureFP16FML, FeatureSVE, FeatureTRBE, FeatureSVE2BitPerm, FeatureBF16, FeatureETE, FeaturePerfMon, FeatureMatMulInt8, FeatureSPE, @@ -749,6 +754,7 @@ def ProcessorFeatures { FeatureJS, FeatureLSE, FeatureRAS, FeatureRCPC, FeatureRDM]; list A720 = [HasV9_2aOps, FeatureMTE, FeatureFP16FML, + FeatureCCIDX, FeatureTRBE, FeatureSVE2BitPerm, FeatureETE, FeaturePerfMon, FeatureSPE, FeatureSPE_EEF, FeatureSB, FeatureSSBS, FeaturePAuth, FeatureFlagM, FeaturePredRes, @@ -757,6 +763,7 @@ def ProcessorFeatures { FeatureJS, FeatureLSE, FeatureNEON, FeatureRAS, FeatureRCPC, FeatureRDM]; list A720AE = [HasV9_2aOps, FeatureMTE, FeatureFP16FML, + FeatureCCIDX, FeatureTRBE, FeatureSVE2BitPerm, FeatureETE, FeaturePerfMon, FeatureSPE, FeatureSPE_EEF, FeatureSB, FeatureSSBS, FeaturePAuth, FeatureFlagM, FeaturePredRes, @@ -765,6 +772,7 @@ def ProcessorFeatures { FeatureJS, FeatureLSE, FeatureNEON, FeatureRAS, FeatureRCPC, FeatureRDM]; list A725 = [HasV9_2aOps, FeatureMTE, FeatureFP16FML, + FeatureCCIDX, FeatureETE, FeaturePerfMon, FeatureSPE, FeatureSVE2BitPerm, FeatureSPE_EEF, FeatureTRBE, FeatureFlagM, FeaturePredRes, FeatureSB, FeatureSSBS, @@ -800,6 +808,7 @@ def ProcessorFeatures { FeatureMatMulInt8, FeatureBF16, FeatureAM, FeatureMTE, FeatureETE, FeatureSVE2BitPerm, FeatureFP16FML, + FeatureCCIDX, FeaturePAuth, FeatureSSBS, FeatureSB, FeatureSVE, FeatureSVE2, FeatureFlagM, FeatureComplxNum, FeatureCRC, FeatureDotProd, FeatureFPARMv8, FeatureFullFP16, FeatureJS, FeatureLSE, FeatureRAS, FeatureRCPC, FeatureRDM]; @@ -808,6 +817,7 @@ def ProcessorFeatures { FeatureSPE, FeatureBF16, FeatureMatMulInt8, FeatureMTE, FeatureSVE2BitPerm, FeatureFullFP16, FeatureFP16FML, + FeatureCCIDX, FeatureSB, FeaturePAuth, FeaturePredRes, FeatureFlagM, FeatureSSBS, FeatureSVE2, FeatureComplxNum, FeatureCRC, FeatureFPARMv8, FeatureJS, FeatureLSE, FeatureRAS, FeatureRCPC, FeatureRDM, FeatureDotProd]; @@ -815,11 +825,13 @@ def ProcessorFeatures { FeaturePerfMon, FeatureETE, FeatureTRBE, FeatureSPE, FeatureMTE, FeatureSVE2BitPerm, FeatureFP16FML, FeatureSPE_EEF, + FeatureCCIDX, FeatureSB, FeatureSSBS, FeaturePAuth, FeatureFlagM, FeaturePredRes, FeatureSVE, FeatureSVE2, FeatureComplxNum, FeatureCRC, FeatureDotProd, FeatureFPARMv8, FeatureFullFP16, FeatureMatMulInt8, FeatureJS, FeatureLSE, FeatureNEON, FeatureRAS, FeatureRCPC, FeatureRDM, FeatureBF16]; list X925 = [HasV9_2aOps, FeatureMTE, FeatureFP16FML, + FeatureCCIDX, FeatureETE, FeaturePerfMon, FeatureSPE, FeatureSVE2BitPerm, FeatureSPE_EEF, FeatureTRBE, FeatureFlagM, FeaturePredRes, FeatureSB, FeatureSSBS, @@ -863,24 +875,32 @@ def ProcessorFeatures { list AppleA15 = [HasV8_6aOps, FeatureSHA2, FeatureAES, FeatureFPARMv8, FeatureNEON, FeaturePerfMon, FeatureSHA3, FeatureFullFP16, FeatureFP16FML, - FeatureComplxNum, FeatureCRC, FeatureJS, FeatureLSE, - FeaturePAuth, FeatureRAS, FeatureRCPC, FeatureRDM, - FeatureBF16, FeatureDotProd, FeatureMatMulInt8]; + FeatureComplxNum, FeatureCRC, FeatureJS, + FeatureLSE, FeaturePAuth, + FeatureRAS, FeatureRCPC, FeatureRDM, + FeatureBF16, FeatureDotProd, FeatureMatMulInt8, FeatureSSBS]; list AppleA16 = [HasV8_6aOps, FeatureSHA2, FeatureAES, FeatureFPARMv8, FeatureNEON, FeaturePerfMon, FeatureSHA3, FeatureFullFP16, FeatureFP16FML, FeatureHCX, - FeatureComplxNum, FeatureCRC, FeatureJS, FeatureLSE, - FeaturePAuth, FeatureRAS, FeatureRCPC, FeatureRDM, - FeatureBF16, FeatureDotProd, FeatureMatMulInt8]; + FeatureComplxNum, FeatureCRC, FeatureJS, + FeatureLSE, FeaturePAuth, + FeatureRAS, FeatureRCPC, FeatureRDM, + FeatureBF16, FeatureDotProd, FeatureMatMulInt8, FeatureSSBS]; list AppleA17 = [HasV8_6aOps, FeatureSHA2, FeatureAES, FeatureFPARMv8, FeatureNEON, FeaturePerfMon, FeatureSHA3, FeatureFullFP16, FeatureFP16FML, FeatureHCX, - FeatureComplxNum, FeatureCRC, FeatureJS, FeatureLSE, - FeaturePAuth, FeatureRAS, FeatureRCPC, FeatureRDM, - FeatureBF16, FeatureDotProd, FeatureMatMulInt8]; - list AppleM4 = [HasV9_2aOps, FeatureSHA2, FeatureFPARMv8, + FeatureComplxNum, FeatureCRC, FeatureJS, + FeatureLSE, FeaturePAuth, + FeatureRAS, FeatureRCPC, FeatureRDM, + FeatureBF16, FeatureDotProd, FeatureMatMulInt8, FeatureSSBS]; + // Technically apple-m4 is v9.2a, but we can't use that here. + // Historically, llvm defined v9.0a as requiring SVE, but it's optional + // according to the Arm ARM, and not supported by the core. We decoupled the + // two in the clang driver and in the backend subtarget features, but it's + // still an issue in the clang frontend. v8.7a is the next closest choice. + list AppleM4 = [HasV8_7aOps, FeatureSHA2, FeatureFPARMv8, FeatureNEON, FeaturePerfMon, FeatureSHA3, FeatureFullFP16, FeatureFP16FML, FeatureAES, FeatureBF16, @@ -909,6 +929,7 @@ def ProcessorFeatures { FeatureMatMulInt8, FeatureMTE, FeatureSVE2, FeatureSVE2BitPerm, FeatureTRBE, FeaturePerfMon, + FeatureCCIDX, FeatureDotProd, FeatureFullFP16, FeatureSB, FeatureSSBS, FeatureSVE, FeatureComplxNum, FeatureCRC, FeatureFPARMv8, FeatureJS, FeatureLSE, FeatureNEON, FeaturePAuth, FeatureRAS, FeatureRCPC, FeatureRDM]; @@ -916,6 +937,7 @@ def ProcessorFeatures { FeatureFullFP16, FeatureMTE, FeaturePerfMon, FeatureRandGen, FeatureSPE, FeatureSPE_EEF, FeatureSVE2BitPerm, + FeatureCCIDX, FeatureSSBS, FeatureSB, FeaturePredRes, FeaturePAuth, FeatureFlagM, FeatureSVE, FeatureSVE2, FeatureBF16, FeatureComplxNum, FeatureCRC, FeatureDotProd, FeatureFPARMv8, FeatureMatMulInt8, @@ -926,6 +948,7 @@ def ProcessorFeatures { FeatureFullFP16, FeatureMatMulInt8, FeatureNEON, FeaturePerfMon, FeatureRandGen, FeatureSPE, FeatureSSBS, FeatureSVE, + FeatureCCIDX, FeatureSHA3, FeatureSM4, FeatureDotProd, FeatureComplxNum, FeatureCRC, FeatureJS, FeatureLSE, FeaturePAuth, FeatureRAS, FeatureRCPC, FeatureRDM]; @@ -934,6 +957,7 @@ def ProcessorFeatures { FeatureFullFP16, FeatureMatMulInt8, FeatureNEON, FeaturePerfMon, FeatureRandGen, FeatureSPE, FeatureSSBS, FeatureSVE, + FeatureCCIDX, FeatureSHA3, FeatureSM4, FeatureDotProd, FeatureComplxNum, FeatureCRC, FeatureJS, FeatureLSE, FeaturePAuth, FeatureRAS, FeatureRCPC, FeatureRDM]; @@ -941,12 +965,14 @@ def ProcessorFeatures { FeaturePerfMon, FeatureETE, FeatureMatMulInt8, FeatureNEON, FeatureSVE2BitPerm, FeatureFP16FML, FeatureMTE, FeatureRandGen, + FeatureCCIDX, FeatureSVE, FeatureSVE2, FeatureSSBS, FeatureFullFP16, FeatureDotProd, FeatureComplxNum, FeatureCRC, FeatureFPARMv8, FeatureJS, FeatureLSE, FeaturePAuth, FeatureRAS, FeatureRCPC, FeatureRDM]; list NeoverseV3 = [HasV9_2aOps, FeatureETE, FeatureFP16FML, FeatureFullFP16, FeatureLS64, FeatureMTE, FeaturePerfMon, FeatureRandGen, FeatureSPE, + FeatureCCIDX, FeatureSPE_EEF, FeatureSVE2BitPerm, FeatureBRBE, FeatureSSBS, FeatureSB, FeaturePredRes, FeaturePAuth, FeatureFlagM, FeatureSVE, FeatureSVE2, FeatureBF16, FeatureComplxNum, FeatureCRC, @@ -957,12 +983,14 @@ def ProcessorFeatures { FeaturePerfMon, FeatureRandGen, FeatureSPE, FeatureSPE_EEF, FeatureSVE2BitPerm, FeatureBRBE, FeatureSSBS, FeatureSB, FeaturePredRes, FeaturePAuth, FeatureFlagM, + FeatureCCIDX, FeatureSVE, FeatureSVE2, FeatureBF16, FeatureComplxNum, FeatureCRC, FeatureDotProd, FeatureFPARMv8, FeatureMatMulInt8, FeatureJS, FeatureLSE, FeatureNEON, FeatureRAS, FeatureRCPC, FeatureRDM, FeatureRME]; list Saphira = [HasV8_4aOps, FeatureSHA2, FeatureAES, FeatureFPARMv8, FeatureNEON, FeatureSPE, FeaturePerfMon, FeatureCRC, + FeatureCCIDX, FeatureLSE, FeatureRDM, FeatureRAS, FeatureRCPC]; list ThunderX = [HasV8_0aOps, FeatureCRC, FeatureSHA2, FeatureAES, FeatureFPARMv8, FeaturePerfMon, FeatureNEON]; @@ -971,6 +999,7 @@ def ProcessorFeatures { FeatureRDM]; list ThunderX3T110 = [HasV8_3aOps, FeatureCRC, FeatureSHA2, FeatureAES, FeatureFPARMv8, FeatureNEON, FeatureLSE, + FeatureCCIDX, FeaturePAuth, FeaturePerfMon, FeatureComplxNum, FeatureJS, FeatureRAS, FeatureRCPC, FeatureRDM]; list TSV110 = [HasV8_2aOps, FeatureSHA2, FeatureAES, FeatureFPARMv8, @@ -983,6 +1012,7 @@ def ProcessorFeatures { FeatureSHA2, FeatureSHA3, FeatureAES, FeatureFullFP16, FeatureBF16, FeatureComplxNum, FeatureCRC, FeatureDotProd, FeatureFPARMv8, FeatureMatMulInt8, FeatureJS, + FeatureCCIDX, FeatureLSE, FeaturePAuth, FeatureRAS, FeatureRCPC, FeatureRDM]; list Ampere1A = [HasV8_6aOps, FeatureNEON, FeaturePerfMon, FeatureMTE, FeatureSSBS, FeatureRandGen, @@ -991,6 +1021,7 @@ def ProcessorFeatures { FeatureFullFP16, FeatureBF16, FeatureComplxNum, FeatureCRC, FeatureDotProd, FeatureFPARMv8, FeatureMatMulInt8, FeatureJS, FeatureLSE, FeaturePAuth, FeatureRAS, FeatureRCPC, + FeatureCCIDX, FeatureRDM]; list Ampere1B = [HasV8_7aOps, FeatureNEON, FeaturePerfMon, FeatureMTE, FeatureSSBS, FeatureRandGen, @@ -999,6 +1030,7 @@ def ProcessorFeatures { FeatureWFxT, FeatureFullFP16, FeatureBF16, FeatureComplxNum, FeatureCRC, FeatureDotProd, FeatureFPARMv8, FeatureMatMulInt8, FeatureJS, FeatureLSE, FeaturePAuth, FeatureRAS, FeatureRCPC, + FeatureCCIDX, FeatureRDM]; list Oryon = [HasV8_6aOps, FeatureNEON, FeaturePerfMon, @@ -1007,6 +1039,7 @@ def ProcessorFeatures { FeatureSHA3, FeatureAES, FeatureSPE, FeatureBF16, FeatureComplxNum, FeatureCRC, FeatureDotProd, FeatureFPARMv8, FeatureMatMulInt8, + FeatureSSBS, FeatureCCIDX, FeatureJS, FeatureLSE, FeatureRAS, FeatureRCPC, FeatureRDM]; // ETE and TRBE are future architecture extensions. We temporarily enable them diff --git a/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp b/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp index 435cc18cdea62..4c4b8e5492901 100644 --- a/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp @@ -432,6 +432,9 @@ AArch64RegisterInfo::getStrictlyReservedRegs(const MachineFunction &MF) const { markSuperRegs(Reserved, AArch64::WSP); markSuperRegs(Reserved, AArch64::WZR); + if (MF.getFunction().getCallingConv() == CallingConv::Mono) + markSuperRegs(Reserved, AArch64::W15); + if (TFI->hasFP(MF) || TT.isOSDarwin()) markSuperRegs(Reserved, AArch64::W29); @@ -684,6 +687,13 @@ bool AArch64RegisterInfo::isArgumentRegister(const MachineFunction &MF, if (STI.isTargetWindows()) return HasReg(CC_AArch64_Win64PCS_ArgRegs, Reg); return HasReg(CC_AArch64_AAPCS_ArgRegs, Reg); + case CallingConv::Mono: + if (STI.isTargetDarwin()) + return HasReg(CC_AArch64_Mono_DarwinPCS_ArgRegs, Reg); + else if (STI.isTargetWindows()) + report_fatal_error("Unsupported calling convention."); + else + return HasReg(CC_AArch64_Mono_AAPCS_ArgRegs, Reg); } } diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp index 32a355fe38f1c..642006e706c13 100644 --- a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp +++ b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp @@ -565,8 +565,13 @@ bool AArch64Subtarget::useAA() const { return UseAA; } // exception on its own. Later, if the callee spills the signed LR value and // neither FEAT_PAuth2 nor FEAT_EPAC are implemented, the valid PAC replaces // the higher bits of LR thus hiding the authentication failure. -AArch64PAuth::AuthCheckMethod -AArch64Subtarget::getAuthenticatedLRCheckMethod() const { +AArch64PAuth::AuthCheckMethod AArch64Subtarget::getAuthenticatedLRCheckMethod( + const MachineFunction &MF) const { + // TODO: Check subtarget for the scheme. Present variant is a default for + // pauthtest ABI. + if (MF.getFunction().hasFnAttribute("ptrauth-returns") && + MF.getFunction().hasFnAttribute("ptrauth-auth-traps")) + return AArch64PAuth::AuthCheckMethod::HighBitsNoTBI; if (AuthenticatedLRCheckMethod.getNumOccurrences()) return AuthenticatedLRCheckMethod; diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.h b/llvm/lib/Target/AArch64/AArch64Subtarget.h index e585aad2f7a68..0f3a637f98fbe 100644 --- a/llvm/lib/Target/AArch64/AArch64Subtarget.h +++ b/llvm/lib/Target/AArch64/AArch64Subtarget.h @@ -413,7 +413,8 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo { } /// Choose a method of checking LR before performing a tail call. - AArch64PAuth::AuthCheckMethod getAuthenticatedLRCheckMethod() const; + AArch64PAuth::AuthCheckMethod + getAuthenticatedLRCheckMethod(const MachineFunction &MF) const; /// Compute the integer discriminator for a given BlockAddress constant, if /// blockaddress signing is enabled, or std::nullopt otherwise. diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp index 45148449dfb82..39fba6a257bb0 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp @@ -254,7 +254,8 @@ bool AArch64TTIImpl::areInlineCompatible(const Function *Caller, return false; if (CallerAttrs.requiresLazySave(CalleeAttrs) || - CallerAttrs.requiresSMChange(CalleeAttrs)) { + CallerAttrs.requiresSMChange(CalleeAttrs) || + CallerAttrs.requiresPreservingZT0(CalleeAttrs)) { if (hasPossibleIncompatibleOps(Callee)) return false; } @@ -540,7 +541,15 @@ static InstructionCost getHistogramCost(const IntrinsicCostAttributes &ICA) { InstructionCost AArch64TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind) { + // The code-generator is currently not able to handle scalable vectors + // of yet, so return an invalid cost to avoid selecting + // it. This change will be removed when code-generation for these types is + // sufficiently reliable. auto *RetTy = ICA.getReturnType(); + if (auto *VTy = dyn_cast(RetTy)) + if (VTy->getElementCount() == ElementCount::getScalable(1)) + return InstructionCost::getInvalid(); + switch (ICA.getID()) { case Intrinsic::experimental_vector_histogram_add: if (!ST->hasSVE2()) @@ -2295,6 +2304,11 @@ std::optional AArch64TTIImpl::simplifyDemandedVectorEltsIntrinsic( return std::nullopt; } +bool AArch64TTIImpl::enableScalableVectorization() const { + return ST->isSVEAvailable() || (ST->isSVEorStreamingSVEAvailable() && + EnableScalableAutovecInStreamingMode); +} + TypeSize AArch64TTIImpl::getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const { switch (K) { @@ -3018,6 +3032,14 @@ InstructionCost AArch64TTIImpl::getArithmeticInstrCost( ArrayRef Args, const Instruction *CxtI) { + // The code-generator is currently not able to handle scalable vectors + // of yet, so return an invalid cost to avoid selecting + // it. This change will be removed when code-generation for these types is + // sufficiently reliable. + if (auto *VTy = dyn_cast(Ty)) + if (VTy->getElementCount() == ElementCount::getScalable(1)) + return InstructionCost::getInvalid(); + // TODO: Handle more cost kinds. if (CostKind != TTI::TCK_RecipThroughput) return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, @@ -3792,6 +3814,14 @@ InstructionCost AArch64TTIImpl::getMinMaxReductionCost(Intrinsic::ID IID, VectorType *Ty, FastMathFlags FMF, TTI::TargetCostKind CostKind) { + // The code-generator is currently not able to handle scalable vectors + // of yet, so return an invalid cost to avoid selecting + // it. This change will be removed when code-generation for these types is + // sufficiently reliable. + if (auto *VTy = dyn_cast(Ty)) + if (VTy->getElementCount() == ElementCount::getScalable(1)) + return InstructionCost::getInvalid(); + std::pair LT = getTypeLegalizationCost(Ty); if (LT.second.getScalarType() == MVT::f16 && !ST->hasFullFP16()) @@ -3836,6 +3866,14 @@ InstructionCost AArch64TTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *ValTy, std::optional FMF, TTI::TargetCostKind CostKind) { + // The code-generator is currently not able to handle scalable vectors + // of yet, so return an invalid cost to avoid selecting + // it. This change will be removed when code-generation for these types is + // sufficiently reliable. + if (auto *VTy = dyn_cast(ValTy)) + if (VTy->getElementCount() == ElementCount::getScalable(1)) + return InstructionCost::getInvalid(); + if (TTI::requiresOrderedReduction(FMF)) { if (auto *FixedVTy = dyn_cast(ValTy)) { InstructionCost BaseCost = diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h index a9189fd53f40b..4a6457d7a7dbf 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h +++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h @@ -381,7 +381,7 @@ class AArch64TTIImpl : public BasicTTIImplBase { return ST->isSVEorStreamingSVEAvailable(); } - bool enableScalableVectorization() const { return ST->isSVEAvailable(); } + bool enableScalableVectorization() const; bool isLegalToVectorizeReduction(const RecurrenceDescriptor &RdxDesc, ElementCount VF) const; diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp index be470c71ae8b6..be34a649e1c4b 100644 --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp @@ -599,7 +599,7 @@ class DarwinAArch64AsmBackend : public AArch64AsmBackend { } /// Generate the compact unwind encoding from the CFI directives. - uint32_t generateCompactUnwindEncoding(const MCDwarfFrameInfo *FI, + uint64_t generateCompactUnwindEncoding(const MCDwarfFrameInfo *FI, const MCContext *Ctxt) const override { ArrayRef Instrs = FI->Instructions; if (Instrs.empty()) @@ -609,10 +609,10 @@ class DarwinAArch64AsmBackend : public AArch64AsmBackend { return CU::UNWIND_ARM64_MODE_DWARF; bool HasFP = false; - unsigned StackSize = 0; + uint64_t StackSize = 0; - uint32_t CompactUnwindEncoding = 0; - int CurOffset = 0; + uint64_t CompactUnwindEncoding = 0; + int64_t CurOffset = 0; for (size_t i = 0, e = Instrs.size(); i != e; ++i) { const MCCFIInstruction &Inst = Instrs[i]; diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td index 7906e0ee9d785..9efdbd751d96e 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPU.td +++ b/llvm/lib/Target/AMDGPU/AMDGPU.td @@ -953,6 +953,12 @@ def FeatureRequiredExportPriority : SubtargetFeature<"required-export-priority", "Export priority must be explicitly manipulated on GFX11.5" >; +def FeatureVmemWriteVgprInOrder : SubtargetFeature<"vmem-write-vgpr-in-order", + "HasVmemWriteVgprInOrder", + "true", + "VMEM instructions of the same type write VGPR results in order" +>; + //===------------------------------------------------------------===// // Subtarget Features (options and debugging) //===------------------------------------------------------------===// @@ -1123,7 +1129,8 @@ def FeatureSouthernIslands : GCNSubtargetFeatureGeneration<"SOUTHERN_ISLANDS", FeatureDsSrc2Insts, FeatureLDSBankCount32, FeatureMovrel, FeatureTrigReducedRange, FeatureExtendedImageInsts, FeatureImageInsts, FeatureGDS, FeatureGWS, FeatureDefaultComponentZero, - FeatureAtomicFMinFMaxF32GlobalInsts, FeatureAtomicFMinFMaxF64GlobalInsts + FeatureAtomicFMinFMaxF32GlobalInsts, FeatureAtomicFMinFMaxF64GlobalInsts, + FeatureVmemWriteVgprInOrder ] >; @@ -1136,7 +1143,8 @@ def FeatureSeaIslands : GCNSubtargetFeatureGeneration<"SEA_ISLANDS", FeatureDsSrc2Insts, FeatureExtendedImageInsts, FeatureUnalignedBufferAccess, FeatureImageInsts, FeatureGDS, FeatureGWS, FeatureDefaultComponentZero, FeatureAtomicFMinFMaxF32GlobalInsts, FeatureAtomicFMinFMaxF64GlobalInsts, - FeatureAtomicFMinFMaxF32FlatInsts, FeatureAtomicFMinFMaxF64FlatInsts + FeatureAtomicFMinFMaxF32FlatInsts, FeatureAtomicFMinFMaxF64FlatInsts, + FeatureVmemWriteVgprInOrder ] >; @@ -1152,7 +1160,7 @@ def FeatureVolcanicIslands : GCNSubtargetFeatureGeneration<"VOLCANIC_ISLANDS", FeatureGFX7GFX8GFX9Insts, FeatureSMemTimeInst, FeatureMadMacF32Insts, FeatureDsSrc2Insts, FeatureExtendedImageInsts, FeatureFastDenormalF32, FeatureUnalignedBufferAccess, FeatureImageInsts, FeatureGDS, FeatureGWS, - FeatureDefaultComponentZero + FeatureDefaultComponentZero, FeatureVmemWriteVgprInOrder ] >; @@ -1170,7 +1178,8 @@ def FeatureGFX9 : GCNSubtargetFeatureGeneration<"GFX9", FeatureScalarFlatScratchInsts, FeatureScalarAtomics, FeatureR128A16, FeatureA16, FeatureSMemTimeInst, FeatureFastDenormalF32, FeatureSupportsXNACK, FeatureUnalignedBufferAccess, FeatureUnalignedDSAccess, - FeatureNegativeScratchOffsetBug, FeatureGWS, FeatureDefaultComponentZero + FeatureNegativeScratchOffsetBug, FeatureGWS, FeatureDefaultComponentZero, + FeatureVmemWriteVgprInOrder ] >; @@ -1193,7 +1202,8 @@ def FeatureGFX10 : GCNSubtargetFeatureGeneration<"GFX10", FeatureGDS, FeatureGWS, FeatureDefaultComponentZero, FeatureMaxHardClauseLength63, FeatureAtomicFMinFMaxF32GlobalInsts, FeatureAtomicFMinFMaxF64GlobalInsts, - FeatureAtomicFMinFMaxF32FlatInsts, FeatureAtomicFMinFMaxF64FlatInsts + FeatureAtomicFMinFMaxF32FlatInsts, FeatureAtomicFMinFMaxF64FlatInsts, + FeatureVmemWriteVgprInOrder ] >; @@ -1215,7 +1225,8 @@ def FeatureGFX11 : GCNSubtargetFeatureGeneration<"GFX11", FeatureUnalignedBufferAccess, FeatureUnalignedDSAccess, FeatureGDS, FeatureGWS, FeatureDefaultComponentZero, FeatureMaxHardClauseLength32, - FeatureAtomicFMinFMaxF32GlobalInsts, FeatureAtomicFMinFMaxF32FlatInsts + FeatureAtomicFMinFMaxF32GlobalInsts, FeatureAtomicFMinFMaxF32FlatInsts, + FeatureVmemWriteVgprInOrder ] >; diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp index 39ae7c96cf772..a71c9453d968d 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -4349,6 +4349,7 @@ AMDGPUTargetLowering::performMulLoHiCombine(SDNode *N, SelectionDAG &DAG = DCI.DAG; SDLoc DL(N); + bool Signed = N->getOpcode() == ISD::SMUL_LOHI; SDValue N0 = N->getOperand(0); SDValue N1 = N->getOperand(1); @@ -4363,20 +4364,25 @@ AMDGPUTargetLowering::performMulLoHiCombine(SDNode *N, // Try to use two fast 24-bit multiplies (one for each half of the result) // instead of one slow extending multiply. - unsigned LoOpcode, HiOpcode; - if (Subtarget->hasMulU24() && isU24(N0, DAG) && isU24(N1, DAG)) { - N0 = DAG.getZExtOrTrunc(N0, DL, MVT::i32); - N1 = DAG.getZExtOrTrunc(N1, DL, MVT::i32); - LoOpcode = AMDGPUISD::MUL_U24; - HiOpcode = AMDGPUISD::MULHI_U24; - } else if (Subtarget->hasMulI24() && isI24(N0, DAG) && isI24(N1, DAG)) { - N0 = DAG.getSExtOrTrunc(N0, DL, MVT::i32); - N1 = DAG.getSExtOrTrunc(N1, DL, MVT::i32); - LoOpcode = AMDGPUISD::MUL_I24; - HiOpcode = AMDGPUISD::MULHI_I24; + unsigned LoOpcode = 0; + unsigned HiOpcode = 0; + if (Signed) { + if (Subtarget->hasMulI24() && isI24(N0, DAG) && isI24(N1, DAG)) { + N0 = DAG.getSExtOrTrunc(N0, DL, MVT::i32); + N1 = DAG.getSExtOrTrunc(N1, DL, MVT::i32); + LoOpcode = AMDGPUISD::MUL_I24; + HiOpcode = AMDGPUISD::MULHI_I24; + } } else { - return SDValue(); + if (Subtarget->hasMulU24() && isU24(N0, DAG) && isU24(N1, DAG)) { + N0 = DAG.getZExtOrTrunc(N0, DL, MVT::i32); + N1 = DAG.getZExtOrTrunc(N1, DL, MVT::i32); + LoOpcode = AMDGPUISD::MUL_U24; + HiOpcode = AMDGPUISD::MULHI_U24; + } } + if (!LoOpcode) + return SDValue(); SDValue Lo = DAG.getNode(LoOpcode, DL, MVT::i32, N0, N1); SDValue Hi = DAG.getNode(HiOpcode, DL, MVT::i32, N0, N1); diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h b/llvm/lib/Target/AMDGPU/GCNSubtarget.h index def89c785b855..9386bcf0d74b2 100644 --- a/llvm/lib/Target/AMDGPU/GCNSubtarget.h +++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.h @@ -239,6 +239,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo, bool HasVALUTransUseHazard = false; bool HasForceStoreSC0SC1 = false; bool HasRequiredExportPriority = false; + bool HasVmemWriteVgprInOrder = false; bool RequiresCOV6 = false; @@ -1285,10 +1286,18 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo, bool hasRequiredExportPriority() const { return HasRequiredExportPriority; } + bool hasVmemWriteVgprInOrder() const { return HasVmemWriteVgprInOrder; } + /// \returns true if the target uses LOADcnt/SAMPLEcnt/BVHcnt, DScnt/KMcnt /// and STOREcnt rather than VMcnt, LGKMcnt and VScnt respectively. bool hasExtendedWaitCounts() const { return getGeneration() >= GFX12; } + /// \returns true if inline constants are not supported for F16 pseudo + /// scalar transcendentals. + bool hasNoF16PseudoScalarTransInlineConstants() const { + return getGeneration() == GFX12; + } + /// \returns The maximum number of instructions that can be enclosed in an /// S_CLAUSE on the given subtarget, or 0 for targets that do not support that /// instruction. diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h index 3ef00f75735b0..879dbe1b279b1 100644 --- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h +++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h @@ -15,6 +15,7 @@ #ifndef LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCTARGETDESC_H #define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCTARGETDESC_H +#include #include namespace llvm { diff --git a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp index 9b2cab2eb73a3..32ecf350db59c 100644 --- a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp +++ b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp @@ -1581,7 +1581,18 @@ bool SIFoldOperands::tryFoldClamp(MachineInstr &MI) { // Clamp is applied after omod, so it is OK if omod is set. DefClamp->setImm(1); - MRI->replaceRegWith(MI.getOperand(0).getReg(), Def->getOperand(0).getReg()); + + Register DefReg = Def->getOperand(0).getReg(); + Register MIDstReg = MI.getOperand(0).getReg(); + if (TRI->isSGPRReg(*MRI, DefReg)) { + // Pseudo scalar instructions have a SGPR for dst and clamp is a v_max* + // instruction with a VGPR dst. + BuildMI(*MI.getParent(), MI, MI.getDebugLoc(), TII->get(AMDGPU::COPY), + MIDstReg) + .addReg(DefReg); + } else { + MRI->replaceRegWith(MIDstReg, DefReg); + } MI.eraseFromParent(); // Use of output modifiers forces VOP3 encoding for a VOP2 mac/fmac diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp index 1315aa0855788..13130db884dc1 100644 --- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp +++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp @@ -1778,11 +1778,12 @@ bool SIInsertWaitcnts::generateWaitcntInstBefore(MachineInstr &MI, if (IsVGPR) { // RAW always needs an s_waitcnt. WAW needs an s_waitcnt unless the // previous write and this write are the same type of VMEM - // instruction, in which case they're guaranteed to write their - // results in order anyway. + // instruction, in which case they are (in some architectures) + // guaranteed to write their results in order anyway. if (Op.isUse() || !updateVMCntOnly(MI) || ScoreBrackets.hasOtherPendingVmemTypes(RegNo, - getVmemType(MI))) { + getVmemType(MI)) || + !ST->hasVmemWriteVgprInOrder()) { ScoreBrackets.determineWait(LOAD_CNT, RegNo, Wait); ScoreBrackets.determineWait(SAMPLE_CNT, RegNo, Wait); ScoreBrackets.determineWait(BVH_CNT, RegNo, Wait); @@ -2389,7 +2390,7 @@ bool SIInsertWaitcnts::shouldFlushVmCnt(MachineLoop *ML, } if (!ST->hasVscnt() && HasVMemStore && !HasVMemLoad && UsesVgprLoadedOutside) return true; - return HasVMemLoad && UsesVgprLoadedOutside; + return HasVMemLoad && UsesVgprLoadedOutside && ST->hasVmemWriteVgprInOrder(); } bool SIInsertWaitcnts::runOnMachineFunction(MachineFunction &MF) { diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp index 463737f645d45..27b8c1b17422a 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp @@ -5768,6 +5768,10 @@ bool SIInstrInfo::isOperandLegal(const MachineInstr &MI, unsigned OpIdx, return false; } } + } else if (ST.hasNoF16PseudoScalarTransInlineConstants() && !MO->isReg() && + isF16PseudoScalarTrans(MI.getOpcode()) && + isInlineConstant(*MO, OpInfo)) { + return false; } if (MO->isReg()) { diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.h b/llvm/lib/Target/AMDGPU/SIInstrInfo.h index 1712dfe8d406c..91855fb14f6f3 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.h +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.h @@ -946,6 +946,14 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo { Opcode == AMDGPU::DS_GWS_BARRIER; } + static bool isF16PseudoScalarTrans(unsigned Opcode) { + return Opcode == AMDGPU::V_S_EXP_F16_e64 || + Opcode == AMDGPU::V_S_LOG_F16_e64 || + Opcode == AMDGPU::V_S_RCP_F16_e64 || + Opcode == AMDGPU::V_S_RSQ_F16_e64 || + Opcode == AMDGPU::V_S_SQRT_F16_e64; + } + static bool doesNotReadTiedSource(const MachineInstr &MI) { return MI.getDesc().TSFlags & SIInstrFlags::TiedSourceNotRead; } diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp index 642739a29d6b0..96d7074e6ef37 100644 --- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp @@ -153,9 +153,9 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) { OptimizationGoals = 0; if (Subtarget->isTargetCOFF()) { - bool Internal = F.hasInternalLinkage(); - COFF::SymbolStorageClass Scl = Internal ? COFF::IMAGE_SYM_CLASS_STATIC - : COFF::IMAGE_SYM_CLASS_EXTERNAL; + bool Local = F.hasLocalLinkage(); + COFF::SymbolStorageClass Scl = + Local ? COFF::IMAGE_SYM_CLASS_STATIC : COFF::IMAGE_SYM_CLASS_EXTERNAL; int Type = COFF::IMAGE_SYM_DTYPE_FUNCTION << COFF::SCT_COMPLEX_TYPE_SHIFT; OutStreamer->beginCOFFSymbolDef(CurrentFnSym); diff --git a/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp b/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp index c149db3144c7c..bc5def30a5064 100644 --- a/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp +++ b/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp @@ -214,6 +214,11 @@ getReservedRegs(const MachineFunction &MF) const { // Some targets reserve R9. if (STI.isR9Reserved()) markSuperRegs(Reserved, ARM::R9); + if (MF.getFunction().getCallingConv() == CallingConv::Mono) + // FIXME: This is required for some reason, otherwise llvm treats R8 as a callee-saved registers + // even if we exclude it in getCalleeSavedRegs (). Luckily, R8 can still be used for argument + // passing even if it is 'reserved'. + markSuperRegs(Reserved, ARM::R8); // Reserve D16-D31 if the subtarget doesn't support them. if (!STI.hasD32()) { static_assert(ARM::D31 == ARM::D16 + 15, "Register list not consecutive!"); diff --git a/llvm/lib/Target/ARM/ARMCallLowering.cpp b/llvm/lib/Target/ARM/ARMCallLowering.cpp index 9cc162d041f48..883808ae981f5 100644 --- a/llvm/lib/Target/ARM/ARMCallLowering.cpp +++ b/llvm/lib/Target/ARM/ARMCallLowering.cpp @@ -50,6 +50,13 @@ using namespace llvm; +// Whether Big-endian GISel is enabled, defaults to off, can be enabled for +// testing. +static cl::opt + EnableGISelBigEndian("enable-arm-gisel-bigendian", cl::Hidden, + cl::init(false), + cl::desc("Enable Global-ISel Big Endian Lowering")); + ARMCallLowering::ARMCallLowering(const ARMTargetLowering &TLI) : CallLowering(&TLI) {} @@ -539,3 +546,5 @@ bool ARMCallLowering::lowerCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo & return true; } + +bool ARMCallLowering::enableBigEndian() const { return EnableGISelBigEndian; } \ No newline at end of file diff --git a/llvm/lib/Target/ARM/ARMCallLowering.h b/llvm/lib/Target/ARM/ARMCallLowering.h index 38095617fb4f3..32c95a044d7b7 100644 --- a/llvm/lib/Target/ARM/ARMCallLowering.h +++ b/llvm/lib/Target/ARM/ARMCallLowering.h @@ -42,6 +42,8 @@ class ARMCallLowering : public CallLowering { bool lowerCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const override; + bool enableBigEndian() const override; + private: bool lowerReturnVal(MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef VRegs, diff --git a/llvm/lib/Target/ARM/ARMCallingConv.h b/llvm/lib/Target/ARM/ARMCallingConv.h index 7c692f03b4405..19eb5316ba2c6 100644 --- a/llvm/lib/Target/ARM/ARMCallingConv.h +++ b/llvm/lib/Target/ARM/ARMCallingConv.h @@ -47,7 +47,12 @@ bool RetCC_ARM_APCS(unsigned ValNo, MVT ValVT, MVT LocVT, bool RetFastCC_ARM_APCS(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State); - +bool CC_ARM_Mono_AAPCS(unsigned ValNo, MVT ValVT, MVT LocVT, + CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, + CCState &State); +bool CC_ARM_Mono_APCS(unsigned ValNo, MVT ValVT, MVT LocVT, + CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, + CCState &State); } // namespace llvm #endif diff --git a/llvm/lib/Target/ARM/ARMCallingConv.td b/llvm/lib/Target/ARM/ARMCallingConv.td index d14424c2decac..2a16272741154 100644 --- a/llvm/lib/Target/ARM/ARMCallingConv.td +++ b/llvm/lib/Target/ARM/ARMCallingConv.td @@ -365,4 +365,25 @@ def CSR_GenericInt : CalleeSavedRegs<(add LR, (sequence "R%u", 12, 0))>; // registers. def CSR_FIQ : CalleeSavedRegs<(add LR, R11, (sequence "R%u", 7, 0))>; +//===----------------------------------------------------------------------===// +// ARM Mono calling conventions +//===----------------------------------------------------------------------===// + +let Entry = 1 in +def CC_ARM_Mono_APCS : CallingConv<[ + // Mono marks the parameter it wants to pass in this non-abi register with + // the 'inreg' attribute. + CCIfInReg>, + + CCDelegateTo +]>; + +let Entry = 1 in +def CC_ARM_Mono_AAPCS : CallingConv<[ + // Mono marks the parameter it wants to pass in this non-abi register with + // the 'inreg' attribute. + CCIfInReg>, + + CCDelegateTo +]>; diff --git a/llvm/lib/Target/ARM/ARMFrameLowering.cpp b/llvm/lib/Target/ARM/ARMFrameLowering.cpp index 62d01b9f7e90b..40354f9955989 100644 --- a/llvm/lib/Target/ARM/ARMFrameLowering.cpp +++ b/llvm/lib/Target/ARM/ARMFrameLowering.cpp @@ -1166,7 +1166,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF, if (STI.splitFramePushPop(MF)) { unsigned DwarfReg = MRI->getDwarfRegNum( Reg == ARM::R12 ? ARM::RA_AUTH_CODE : Reg, true); - unsigned Offset = MFI.getObjectOffset(FI); + int64_t Offset = MFI.getObjectOffset(FI); unsigned CFIIndex = MF.addFrameInst( MCCFIInstruction::createOffset(nullptr, DwarfReg, Offset)); BuildMI(MBB, Pos, dl, TII.get(TargetOpcode::CFI_INSTRUCTION)) @@ -1188,7 +1188,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF, if ((Reg >= ARM::D0 && Reg <= ARM::D31) && (Reg < ARM::D8 || Reg >= ARM::D8 + AFI->getNumAlignedDPRCS2Regs())) { unsigned DwarfReg = MRI->getDwarfRegNum(Reg, true); - unsigned Offset = MFI.getObjectOffset(FI); + int64_t Offset = MFI.getObjectOffset(FI); unsigned CFIIndex = MF.addFrameInst( MCCFIInstruction::createOffset(nullptr, DwarfReg, Offset)); BuildMI(MBB, Pos, dl, TII.get(TargetOpcode::CFI_INSTRUCTION)) diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index 75d16a42d0205..4d0eeefeda48b 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -2129,6 +2129,8 @@ ARMTargetLowering::getEffectiveCallingConv(CallingConv::ID CC, return CallingConv::ARM_AAPCS_VFP; else return CallingConv::ARM_AAPCS; + case CallingConv::Mono: + return CallingConv::Mono; } } @@ -2166,6 +2168,15 @@ CCAssignFn *ARMTargetLowering::CCAssignFnForNode(CallingConv::ID CC, return (Return ? RetCC_ARM_AAPCS : CC_ARM_AAPCS); case CallingConv::CFGuard_Check: return (Return ? RetCC_ARM_AAPCS : CC_ARM_Win32_CFGuard_Check); + case CallingConv::Mono: + if (Return) { + return CCAssignFnForNode(CallingConv::C, true, isVarArg); + } else { + if (Subtarget->isAAPCS_ABI()) + return CC_ARM_Mono_AAPCS; + else + return CC_ARM_Mono_APCS; + } } } diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp index eb55a2b5e70b8..994b43f1abb49 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp @@ -1146,7 +1146,7 @@ enum CompactUnwindEncodings { /// instructions. If the CFI instructions describe a frame that cannot be /// encoded in compact unwind, the method returns UNWIND_ARM_MODE_DWARF which /// tells the runtime to fallback and unwind using dwarf. -uint32_t ARMAsmBackendDarwin::generateCompactUnwindEncoding( +uint64_t ARMAsmBackendDarwin::generateCompactUnwindEncoding( const MCDwarfFrameInfo *FI, const MCContext *Ctxt) const { DEBUG_WITH_TYPE("compact-unwind", llvm::dbgs() << "generateCU()\n"); // Only armv7k uses CFI based unwinding. diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackendDarwin.h b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackendDarwin.h index ac0c9b101cae1..9c958003ca756 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackendDarwin.h +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackendDarwin.h @@ -34,7 +34,7 @@ class ARMAsmBackendDarwin : public ARMAsmBackend { /*Is64Bit=*/false, cantFail(MachO::getCPUType(TT)), Subtype); } - uint32_t generateCompactUnwindEncoding(const MCDwarfFrameInfo *FI, + uint64_t generateCompactUnwindEncoding(const MCDwarfFrameInfo *FI, const MCContext *Ctxt) const override; }; } // end namespace llvm diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp index 3182fecffecf4..de343a7d72ad9 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp @@ -670,8 +670,7 @@ class ARMELFStreamer : public MCELFStreamer { } void EmitMappingSymbol(StringRef Name) { - auto *Symbol = cast(getContext().getOrCreateSymbol( - Name + "." + Twine(MappingSymbolCounter++))); + auto *Symbol = cast(getContext().createLocalSymbol(Name)); emitLabel(Symbol); Symbol->setType(ELF::STT_NOTYPE); @@ -679,8 +678,7 @@ class ARMELFStreamer : public MCELFStreamer { } void emitMappingSymbol(StringRef Name, MCDataFragment &F, uint64_t Offset) { - auto *Symbol = cast(getContext().getOrCreateSymbol( - Name + "." + Twine(MappingSymbolCounter++))); + auto *Symbol = cast(getContext().createLocalSymbol(Name)); emitLabelAtPos(Symbol, SMLoc(), F, Offset); Symbol->setType(ELF::STT_NOTYPE); Symbol->setBinding(ELF::STB_LOCAL); @@ -710,7 +708,6 @@ class ARMELFStreamer : public MCELFStreamer { bool IsThumb; bool IsAndroid; - int64_t MappingSymbolCounter = 0; DenseMap> LastMappingSymbols; @@ -1121,7 +1118,6 @@ void ARMELFStreamer::reset() { MCTargetStreamer &TS = *getTargetStreamer(); ARMTargetStreamer &ATS = static_cast(TS); ATS.reset(); - MappingSymbolCounter = 0; MCELFStreamer::reset(); LastMappingSymbols.clear(); LastEMSInfo.reset(); diff --git a/llvm/lib/Target/AVR/AsmParser/AVRAsmParser.cpp b/llvm/lib/Target/AVR/AsmParser/AVRAsmParser.cpp index 383dfcc31117c..c016b2dd91dc6 100644 --- a/llvm/lib/Target/AVR/AsmParser/AVRAsmParser.cpp +++ b/llvm/lib/Target/AVR/AsmParser/AVRAsmParser.cpp @@ -72,7 +72,7 @@ class AVRAsmParser : public MCTargetAsmParser { int parseRegisterName(); int parseRegister(bool RestoreOnFailure = false); bool tryParseRegisterOperand(OperandVector &Operands); - bool tryParseExpression(OperandVector &Operands); + bool tryParseExpression(OperandVector &Operands, int64_t offset); bool tryParseRelocExpression(OperandVector &Operands); void eatComma(); @@ -418,7 +418,7 @@ bool AVRAsmParser::tryParseRegisterOperand(OperandVector &Operands) { return false; } -bool AVRAsmParser::tryParseExpression(OperandVector &Operands) { +bool AVRAsmParser::tryParseExpression(OperandVector &Operands, int64_t offset) { SMLoc S = Parser.getTok().getLoc(); if (!tryParseRelocExpression(Operands)) @@ -437,6 +437,11 @@ bool AVRAsmParser::tryParseExpression(OperandVector &Operands) { if (getParser().parseExpression(Expression)) return true; + if (offset) { + Expression = MCBinaryExpr::createAdd( + Expression, MCConstantExpr::create(offset, getContext()), getContext()); + } + SMLoc E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1); Operands.push_back(AVROperand::CreateImm(Expression, S, E)); return false; @@ -529,8 +534,9 @@ bool AVRAsmParser::parseOperand(OperandVector &Operands, bool maybeReg) { [[fallthrough]]; case AsmToken::LParen: case AsmToken::Integer: + return tryParseExpression(Operands, 0); case AsmToken::Dot: - return tryParseExpression(Operands); + return tryParseExpression(Operands, 2); case AsmToken::Plus: case AsmToken::Minus: { // If the sign preceeds a number, parse the number, @@ -540,7 +546,7 @@ bool AVRAsmParser::parseOperand(OperandVector &Operands, bool maybeReg) { case AsmToken::BigNum: case AsmToken::Identifier: case AsmToken::Real: - if (!tryParseExpression(Operands)) + if (!tryParseExpression(Operands, 0)) return false; break; default: @@ -643,6 +649,7 @@ bool AVRAsmParser::ParseInstruction(ParseInstructionInfo &Info, // These specific operands should be treated as addresses/symbols/labels, // other than registers. bool maybeReg = true; + if (OperandNum == 1) { std::array Insts = {"lds", "adiw", "sbiw", "ldi"}; for (auto Inst : Insts) { diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp b/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp index 0d29912bee264..388d58a82214d 100644 --- a/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp +++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp @@ -94,6 +94,9 @@ static void adjustRelativeBranch(unsigned Size, const MCFixup &Fixup, // Rightshifts the value by one. AVR::fixups::adjustBranchTarget(Value); + + // Jumps are relative to the current instruction. + Value -= 1; } /// 22-bit absolute fixup. @@ -513,15 +516,10 @@ bool AVRAsmBackend::shouldForceRelocation(const MCAssembler &Asm, switch ((unsigned)Fixup.getKind()) { default: return Fixup.getKind() >= FirstLiteralRelocationKind; - // Fixups which should always be recorded as relocations. case AVR::fixup_7_pcrel: case AVR::fixup_13_pcrel: - // Do not force relocation for PC relative branch like 'rjmp .', - // 'rcall . - off' and 'breq . + off'. - if (const auto *SymA = Target.getSymA()) - if (SymA->getSymbol().getName().size() == 0) - return false; - [[fallthrough]]; + // Always resolve relocations for PC-relative branches + return false; case AVR::fixup_call: return true; } diff --git a/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp b/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp index f0933765bbcbd..86ce6b4e05ed2 100644 --- a/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp +++ b/llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp @@ -1223,6 +1223,10 @@ void HCE::recordExtender(MachineInstr &MI, unsigned OpNum) { if (ER.Kind == MachineOperand::MO_GlobalAddress) if (ER.V.GV->getName().empty()) return; + // Ignore block address that points to block in another function + if (ER.Kind == MachineOperand::MO_BlockAddress) + if (ER.V.BA->getFunction() != &(MI.getMF()->getFunction())) + return; Extenders.push_back(ED); } diff --git a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp index 6ca18528591af..05357de40e3a9 100644 --- a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp +++ b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp @@ -1659,7 +1659,7 @@ bool HexagonFrameLowering::assignCalleeSavedSpillSlots(MachineFunction &MF, using SpillSlot = TargetFrameLowering::SpillSlot; unsigned NumFixed; - int MinOffset = 0; // CS offsets are negative. + int64_t MinOffset = 0; // CS offsets are negative. const SpillSlot *FixedSlots = getCalleeSavedSpillSlots(NumFixed); for (const SpillSlot *S = FixedSlots; S != FixedSlots+NumFixed; ++S) { if (!SRegs[S->Reg]) @@ -1678,7 +1678,7 @@ bool HexagonFrameLowering::assignCalleeSavedSpillSlots(MachineFunction &MF, Register R = x; const TargetRegisterClass *RC = TRI->getMinimalPhysRegClass(R); unsigned Size = TRI->getSpillSize(*RC); - int Off = MinOffset - Size; + int64_t Off = MinOffset - Size; Align Alignment = std::min(TRI->getSpillAlign(*RC), getStackAlign()); Off &= -Alignment.value(); int FI = MFI.CreateFixedSpillStackObject(Size, Off); diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp index 1570493b765ca..6acc37e599f2e 100644 --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp @@ -702,7 +702,7 @@ class HexagonAsmBackend : public MCAsmBackend { return true; } - bool finishLayout(const MCAssembler &Asm) const override { + void finishLayout(MCAssembler const &Asm) const override { SmallVector Frags; for (MCSection &Sec : Asm) { Frags.clear(); @@ -747,6 +747,7 @@ class HexagonAsmBackend : public MCAsmBackend { //assert(!Error); (void)Error; ReplaceInstruction(Asm.getEmitter(), RF, Inst); + Sec.setHasLayout(false); Size = 0; // Only look back one instruction break; } @@ -756,7 +757,6 @@ class HexagonAsmBackend : public MCAsmBackend { } } } - return true; } }; // class HexagonAsmBackend diff --git a/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp b/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp index 208bd3db8f14e..f52e188f87792 100644 --- a/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp +++ b/llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp @@ -450,6 +450,24 @@ class LoongArchOperand : public MCParsedAsmOperand { IsValidKind; } + bool isSImm20pcaddi() const { + if (!isImm()) + return false; + + int64_t Imm; + LoongArchMCExpr::VariantKind VK = LoongArchMCExpr::VK_LoongArch_None; + bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK); + bool IsValidKind = VK == LoongArchMCExpr::VK_LoongArch_None || + VK == LoongArchMCExpr::VK_LoongArch_PCREL20_S2 || + VK == LoongArchMCExpr::VK_LoongArch_TLS_LD_PCREL20_S2 || + VK == LoongArchMCExpr::VK_LoongArch_TLS_GD_PCREL20_S2 || + VK == LoongArchMCExpr::VK_LoongArch_TLS_DESC_PCREL20_S2; + return IsConstantImm + ? isInt<20>(Imm) && IsValidKind + : LoongArchAsmParser::classifySymbolRef(getImm(), VK) && + IsValidKind; + } + bool isSImm21lsl2() const { if (!isImm()) return false; @@ -1676,6 +1694,12 @@ bool LoongArchAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, /*Upper=*/(1 << 19) - 1, "operand must be a symbol with modifier (e.g. %call36) or an integer " "in the range"); + case Match_InvalidSImm20pcaddi: + return generateImmOutOfRangeError( + Operands, ErrorInfo, /*Lower=*/-(1 << 19), + /*Upper=*/(1 << 19) - 1, + "operand must be a symbol with modifier (e.g. %pcrel_20) or an integer " + "in the range"); case Match_InvalidSImm21lsl2: return generateImmOutOfRangeError( Operands, ErrorInfo, /*Lower=*/-(1 << 22), /*Upper=*/(1 << 22) - 4, diff --git a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.td b/llvm/lib/Target/LoongArch/LoongArchInstrInfo.td index 97f0e8d6a10c7..ef647a4277873 100644 --- a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.td +++ b/llvm/lib/Target/LoongArch/LoongArchInstrInfo.td @@ -397,6 +397,10 @@ def simm20_pcaddu18i : SImm20Operand { let ParserMatchClass = SImmAsmOperand<20, "pcaddu18i">; } +def simm20_pcaddi : SImm20Operand { + let ParserMatchClass = SImmAsmOperand<20, "pcaddi">; +} + def simm21_lsl2 : Operand { let ParserMatchClass = SImmAsmOperand<21, "lsl2">; let EncoderMethod = "getImmOpValueAsr<2>"; @@ -754,7 +758,7 @@ def SLT : ALU_3R<0x00120000>; def SLTU : ALU_3R<0x00128000>; def SLTI : ALU_2RI12<0x02000000, simm12>; def SLTUI : ALU_2RI12<0x02400000, simm12>; -def PCADDI : ALU_1RI20<0x18000000, simm20>; +def PCADDI : ALU_1RI20<0x18000000, simm20_pcaddi>; def PCADDU12I : ALU_1RI20<0x1c000000, simm20>; def PCALAU12I : ALU_1RI20<0x1a000000, simm20_pcalau12i>; def AND : ALU_3R<0x00148000>; @@ -1144,7 +1148,6 @@ def : PatGprGpr; def : PatGprGpr; def : PatGprGpr; def : PatGprGpr; -def : PatGprGpr_32; def : PatGprImm; def : PatGprImm_32; def : PatGprImm; diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h index 29ed14f6e4d62..370f5b0189b51 100644 --- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h +++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchFixupKinds.h @@ -111,6 +111,8 @@ enum Fixups { fixup_loongarch_relax = FirstLiteralRelocationKind + ELF::R_LARCH_RELAX, // Generate an R_LARCH_ALIGN which indicates the linker may fixup align here. fixup_loongarch_align = FirstLiteralRelocationKind + ELF::R_LARCH_ALIGN, + // 20-bit fixup corresponding to %pcrel_20(foo) for instruction pcaddi. + fixup_loongarch_pcrel20_s2, // 36-bit fixup corresponding to %call36(foo) for a pair instructions: // pcaddu18i+jirl. fixup_loongarch_call36 = FirstLiteralRelocationKind + ELF::R_LARCH_CALL36, @@ -142,6 +144,12 @@ enum Fixups { fixup_loongarch_tls_le_add_r, // 12-bit fixup corresponding to %le_lo12_r(foo) for instruction addi.w/d. fixup_loongarch_tls_le_lo12_r, + // 20-bit fixup corresponding to %ld_pcrel_20(foo) for instruction pcaddi. + fixup_loongarch_tls_ld_pcrel20_s2, + // 20-bit fixup corresponding to %gd_pcrel_20(foo) for instruction pcaddi. + fixup_loongarch_tls_gd_pcrel20_s2, + // 20-bit fixup corresponding to %desc_pcrel_20(foo) for instruction pcaddi. + fixup_loongarch_tls_desc_pcrel20_s2, }; } // end namespace LoongArch } // end namespace llvm diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp index efbfce35dbfca..4f7f93fa4783e 100644 --- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp +++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp @@ -287,6 +287,18 @@ LoongArchMCCodeEmitter::getExprOpValue(const MCInst &MI, const MCOperand &MO, case LoongArchMCExpr::VK_LoongArch_TLS_LE_LO12_R: FixupKind = LoongArch::fixup_loongarch_tls_le_lo12_r; break; + case LoongArchMCExpr::VK_LoongArch_PCREL20_S2: + FixupKind = LoongArch::fixup_loongarch_pcrel20_s2; + break; + case LoongArchMCExpr::VK_LoongArch_TLS_LD_PCREL20_S2: + FixupKind = LoongArch::fixup_loongarch_tls_ld_pcrel20_s2; + break; + case LoongArchMCExpr::VK_LoongArch_TLS_GD_PCREL20_S2: + FixupKind = LoongArch::fixup_loongarch_tls_gd_pcrel20_s2; + break; + case LoongArchMCExpr::VK_LoongArch_TLS_DESC_PCREL20_S2: + FixupKind = LoongArch::fixup_loongarch_tls_desc_pcrel20_s2; + break; } } else if (Kind == MCExpr::SymbolRef && cast(Expr)->getKind() == diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp index 98b9b1ab6d3f4..53d46cca913e5 100644 --- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp +++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp @@ -166,6 +166,14 @@ StringRef LoongArchMCExpr::getVariantKindName(VariantKind Kind) { return "le_add_r"; case VK_LoongArch_TLS_LE_LO12_R: return "le_lo12_r"; + case VK_LoongArch_PCREL20_S2: + return "pcrel_20"; + case VK_LoongArch_TLS_LD_PCREL20_S2: + return "ld_pcrel_20"; + case VK_LoongArch_TLS_GD_PCREL20_S2: + return "gd_pcrel_20"; + case VK_LoongArch_TLS_DESC_PCREL20_S2: + return "desc_pcrel_20"; } } @@ -222,6 +230,10 @@ LoongArchMCExpr::getVariantKindForName(StringRef name) { .Case("le_hi20_r", VK_LoongArch_TLS_LE_HI20_R) .Case("le_add_r", VK_LoongArch_TLS_LE_ADD_R) .Case("le_lo12_r", VK_LoongArch_TLS_LE_LO12_R) + .Case("pcrel_20", VK_LoongArch_PCREL20_S2) + .Case("ld_pcrel_20", VK_LoongArch_TLS_LD_PCREL20_S2) + .Case("gd_pcrel_20", VK_LoongArch_TLS_GD_PCREL20_S2) + .Case("desc_pcrel_20", VK_LoongArch_TLS_DESC_PCREL20_S2) .Default(VK_LoongArch_Invalid); } @@ -264,6 +276,9 @@ void LoongArchMCExpr::fixELFSymbolsInTLSFixups(MCAssembler &Asm) const { case VK_LoongArch_TLS_GD_HI20: case VK_LoongArch_TLS_DESC_PC_HI20: case VK_LoongArch_TLS_DESC_HI20: + case VK_LoongArch_TLS_LD_PCREL20_S2: + case VK_LoongArch_TLS_GD_PCREL20_S2: + case VK_LoongArch_TLS_DESC_PCREL20_S2: break; } fixELFSymbolsInTLSFixupsImpl(getSubExpr(), Asm); diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.h b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.h index 1546d894d56ab..91215b863ccc2 100644 --- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.h +++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.h @@ -75,6 +75,10 @@ class LoongArchMCExpr : public MCTargetExpr { VK_LoongArch_TLS_LE_HI20_R, VK_LoongArch_TLS_LE_ADD_R, VK_LoongArch_TLS_LE_LO12_R, + VK_LoongArch_PCREL20_S2, + VK_LoongArch_TLS_LD_PCREL20_S2, + VK_LoongArch_TLS_GD_PCREL20_S2, + VK_LoongArch_TLS_DESC_PCREL20_S2, VK_LoongArch_Invalid // Must be the last item. }; diff --git a/llvm/lib/Target/MSP430/MSP430FrameLowering.cpp b/llvm/lib/Target/MSP430/MSP430FrameLowering.cpp index f4d703ebeeab2..d0dc6dd146efd 100644 --- a/llvm/lib/Target/MSP430/MSP430FrameLowering.cpp +++ b/llvm/lib/Target/MSP430/MSP430FrameLowering.cpp @@ -293,7 +293,7 @@ void MSP430FrameLowering::emitEpilogue(MachineFunction &MF, if (!hasFP(MF)) { MBBI = FirstCSPop; - int64_t Offset = -CSSize - 2; + int64_t Offset = -(int64_t)CSSize - 2; // Mark callee-saved pop instruction. // Define the current CFA rule to use the provided offset. while (MBBI != MBB.end()) { diff --git a/llvm/lib/Target/Mips/MipsFastISel.cpp b/llvm/lib/Target/Mips/MipsFastISel.cpp index bd8ef43da625c..64a0e9321598f 100644 --- a/llvm/lib/Target/Mips/MipsFastISel.cpp +++ b/llvm/lib/Target/Mips/MipsFastISel.cpp @@ -1608,8 +1608,8 @@ bool MipsFastISel::fastLowerIntrinsicCall(const IntrinsicInst *II) { } emitInst(Mips::SLL, TempReg[0]).addReg(SrcReg).addImm(8); emitInst(Mips::SRL, TempReg[1]).addReg(SrcReg).addImm(8); - emitInst(Mips::OR, TempReg[2]).addReg(TempReg[0]).addReg(TempReg[1]); - emitInst(Mips::ANDi, DestReg).addReg(TempReg[2]).addImm(0xFFFF); + emitInst(Mips::ANDi, TempReg[2]).addReg(TempReg[1]).addImm(0xFF); + emitInst(Mips::OR, DestReg).addReg(TempReg[0]).addReg(TempReg[2]); updateValueMap(II, DestReg); return true; } diff --git a/llvm/lib/Target/NVPTX/NVPTXFrameLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXFrameLowering.cpp index 10ae81e0460e3..9abe0e3186f20 100644 --- a/llvm/lib/Target/NVPTX/NVPTXFrameLowering.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXFrameLowering.cpp @@ -93,5 +93,8 @@ MachineBasicBlock::iterator NVPTXFrameLowering::eliminateCallFramePseudoInstr( TargetFrameLowering::DwarfFrameBase NVPTXFrameLowering::getDwarfFrameBase(const MachineFunction &MF) const { - return {DwarfFrameBase::CFA, {0}}; + DwarfFrameBase FrameBase; + FrameBase.Kind = DwarfFrameBase::CFA; + FrameBase.Location.Offset = 0; + return FrameBase; } diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp index 44c1a2e50486c..6975412ce5d35 100644 --- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp @@ -1429,7 +1429,6 @@ std::string NVPTXTargetLowering::getPrototype( bool first = true; - const Function *F = CB.getFunction(); unsigned NumArgs = VAInfo ? VAInfo->first : Args.size(); for (unsigned i = 0, OIdx = 0; i != NumArgs; ++i, ++OIdx) { Type *Ty = Args[i].Ty; @@ -1471,10 +1470,12 @@ std::string NVPTXTargetLowering::getPrototype( continue; } + // Indirect calls need strict ABI alignment so we disable optimizations by + // not providing a function to optimize. Type *ETy = Args[i].IndirectType; Align InitialAlign = Outs[OIdx].Flags.getNonZeroByValAlign(); Align ParamByValAlign = - getFunctionByValParamAlign(F, ETy, InitialAlign, DL); + getFunctionByValParamAlign(/*F=*/nullptr, ETy, InitialAlign, DL); O << ".param .align " << ParamByValAlign.value() << " .b8 "; O << "_"; diff --git a/llvm/lib/Target/PowerPC/PPC.td b/llvm/lib/Target/PowerPC/PPC.td index 84ef582c029d3..da31a993b9c69 100644 --- a/llvm/lib/Target/PowerPC/PPC.td +++ b/llvm/lib/Target/PowerPC/PPC.td @@ -52,6 +52,7 @@ def DirectivePwr7: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR7", "">; def DirectivePwr8: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR8", "">; def DirectivePwr9: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR9", "">; def DirectivePwr10: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR10", "">; +def DirectivePwr11: SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR11", "">; def DirectivePwrFuture : SubtargetFeature<"", "CPUDirective", "PPC::DIR_PWR_FUTURE", "">; @@ -467,13 +468,25 @@ def ProcessorFeatures { list P10Features = !listconcat(P10InheritableFeatures, P10SpecificFeatures); - // Future - // For future CPU we assume that all of the existing features from Power10 + // Power11 + // For P11 CPU we assume that all the existing features from Power10 // still exist with the exception of those we know are Power10 specific. + list P11AdditionalFeatures = + [DirectivePwr11]; + list P11SpecificFeatures = + []; + list P11InheritableFeatures = + !listconcat(P10InheritableFeatures, P11AdditionalFeatures); + list P11Features = + !listconcat(P11InheritableFeatures, P11SpecificFeatures); + + // Future + // For future CPU we assume that all of the existing features from Power11 + // still exist with the exception of those we know are Power11 specific. list FutureAdditionalFeatures = [FeatureISAFuture]; list FutureSpecificFeatures = []; list FutureInheritableFeatures = - !listconcat(P10InheritableFeatures, FutureAdditionalFeatures); + !listconcat(P11InheritableFeatures, FutureAdditionalFeatures); list FutureFeatures = !listconcat(FutureInheritableFeatures, FutureSpecificFeatures); } @@ -672,6 +685,7 @@ def : ProcessorModel<"pwr7", P7Model, ProcessorFeatures.P7Features>; def : ProcessorModel<"pwr8", P8Model, ProcessorFeatures.P8Features>; def : ProcessorModel<"pwr9", P9Model, ProcessorFeatures.P9Features>; def : ProcessorModel<"pwr10", P10Model, ProcessorFeatures.P10Features>; +def : ProcessorModel<"pwr11", P10Model, ProcessorFeatures.P11Features>; // No scheduler model for future CPU. def : ProcessorModel<"future", NoSchedModel, ProcessorFeatures.FutureFeatures>; diff --git a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp index 1963582ce6863..a57ed33bda9c7 100644 --- a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp @@ -1007,7 +1007,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, // R0 cannot be used as a base register, but it can be used as an // index in a store-indexed. int LastOffset = 0; - if (HasFP) { + if (HasFP) { // R0 += (FPOffset-LastOffset). // Need addic, since addi treats R0 as 0. BuildMI(MBB, MBBI, dl, TII.get(PPC::ADDIC), ScratchReg) @@ -2025,8 +2025,18 @@ void PPCFrameLowering::determineCalleeSaves(MachineFunction &MF, // code. Same goes for the base pointer and the PIC base register. if (needsFP(MF)) SavedRegs.reset(isPPC64 ? PPC::X31 : PPC::R31); - if (RegInfo->hasBasePointer(MF)) + if (RegInfo->hasBasePointer(MF)) { SavedRegs.reset(RegInfo->getBaseRegister(MF)); + // On AIX, when BaseRegister(R30) is used, need to spill r31 too to match + // AIX trackback table requirement. + if (!needsFP(MF) && !SavedRegs.test(isPPC64 ? PPC::X31 : PPC::R31) && + Subtarget.isAIXABI()) { + assert( + (RegInfo->getBaseRegister(MF) == (isPPC64 ? PPC::X30 : PPC::R30)) && + "Invalid base register on AIX!"); + SavedRegs.set(isPPC64 ? PPC::X31 : PPC::R31); + } + } if (FI->usesPICBase()) SavedRegs.reset(PPC::R30); diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 898d1f80d0564..758de9d732fa7 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -1469,6 +1469,7 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM, case PPC::DIR_PWR8: case PPC::DIR_PWR9: case PPC::DIR_PWR10: + case PPC::DIR_PWR11: case PPC::DIR_PWR_FUTURE: setPrefLoopAlignment(Align(16)); setPrefFunctionAlignment(Align(16)); @@ -9337,14 +9338,19 @@ SDValue PPCTargetLowering::LowerBITCAST(SDValue Op, SelectionDAG &DAG) const { SDLoc dl(Op); SDValue Op0 = Op->getOperand(0); - if ((Op.getValueType() != MVT::f128) || - (Op0.getOpcode() != ISD::BUILD_PAIR) || - (Op0.getOperand(0).getValueType() != MVT::i64) || - (Op0.getOperand(1).getValueType() != MVT::i64) || !Subtarget.isPPC64()) + if (!Subtarget.isPPC64() || (Op0.getOpcode() != ISD::BUILD_PAIR) || + (Op.getValueType() != MVT::f128)) return SDValue(); - return DAG.getNode(PPCISD::BUILD_FP128, dl, MVT::f128, Op0.getOperand(0), - Op0.getOperand(1)); + SDValue Lo = Op0.getOperand(0); + SDValue Hi = Op0.getOperand(1); + if ((Lo.getValueType() != MVT::i64) || (Hi.getValueType() != MVT::i64)) + return SDValue(); + + if (!Subtarget.isLittleEndian()) + std::swap(Lo, Hi); + + return DAG.getNode(PPCISD::BUILD_FP128, dl, MVT::f128, Lo, Hi); } static const SDValue *getNormalLoadInput(const SDValue &Op, bool &IsPermuted) { @@ -16664,6 +16670,7 @@ Align PPCTargetLowering::getPrefLoopAlignment(MachineLoop *ML) const { case PPC::DIR_PWR8: case PPC::DIR_PWR9: case PPC::DIR_PWR10: + case PPC::DIR_PWR11: case PPC::DIR_PWR_FUTURE: { if (!ML) break; @@ -18046,6 +18053,7 @@ SDValue PPCTargetLowering::combineMUL(SDNode *N, DAGCombinerInfo &DCI) const { return true; case PPC::DIR_PWR9: case PPC::DIR_PWR10: + case PPC::DIR_PWR11: case PPC::DIR_PWR_FUTURE: // type mul add shl // scalar 5 2 2 diff --git a/llvm/lib/Target/PowerPC/PPCInstr64Bit.td b/llvm/lib/Target/PowerPC/PPCInstr64Bit.td index 8f5afbae01de1..ed39fc67a0a73 100644 --- a/llvm/lib/Target/PowerPC/PPCInstr64Bit.td +++ b/llvm/lib/Target/PowerPC/PPCInstr64Bit.td @@ -2014,9 +2014,9 @@ def SLBSYNC : XForm_0<31, 338, (outs), (ins), "slbsync", IIC_SprSLBSYNC, []>; } // IsISA3_0 def : Pat<(int_ppc_stdcx ForceXForm:$dst, g8rc:$A), - (STDCX g8rc:$A, ForceXForm:$dst)>; + (RLWINM (STDCX g8rc:$A, ForceXForm:$dst), 31, 31, 31)>; def : Pat<(PPCStoreCond ForceXForm:$dst, g8rc:$A, 8), - (STDCX g8rc:$A, ForceXForm:$dst)>; + (RLWINM (STDCX g8rc:$A, ForceXForm:$dst), 31, 31, 31)>; def : Pat<(i64 (int_ppc_mfspr timm:$SPR)), (MFSPR8 $SPR)>; diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp index 2d3c520429f2a..81f16eb1a905b 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -3485,6 +3485,7 @@ unsigned PPCInstrInfo::getSpillTarget() const { // With P10, we may need to spill paired vector registers or accumulator // registers. MMA implies paired vectors, so we can just check that. bool IsP10Variant = Subtarget.isISA3_1() || Subtarget.pairedVectorMemops(); + // P11 uses the P10 target. return Subtarget.isISAFuture() ? 3 : IsP10Variant ? 2 : Subtarget.hasP9Vector() ? 1 : 0; diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/llvm/lib/Target/PowerPC/PPCInstrInfo.td index 1686249c0f89d..69f8ddc0ea701 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td @@ -5286,13 +5286,13 @@ def : Pat<(i64 (bitreverse i64:$A)), (OR8 (RLDICR DWBytes7654.DWord, 32, 31), DWBytes3210.DWord)>; def : Pat<(int_ppc_stwcx ForceXForm:$dst, gprc:$A), - (STWCX gprc:$A, ForceXForm:$dst)>; + (RLWINM (STWCX gprc:$A, ForceXForm:$dst), 31, 31, 31)>; def : Pat<(PPCStoreCond ForceXForm:$dst, gprc:$A, 4), - (STWCX gprc:$A, ForceXForm:$dst)>; + (RLWINM (STWCX gprc:$A, ForceXForm:$dst), 31, 31, 31)>; def : Pat<(int_ppc_stbcx ForceXForm:$dst, gprc:$A), - (STBCX gprc:$A, ForceXForm:$dst)>; + (RLWINM (STBCX gprc:$A, ForceXForm:$dst), 31, 31, 31)>; def : Pat<(PPCStoreCond ForceXForm:$dst, gprc:$A, 1), - (STBCX gprc:$A, ForceXForm:$dst)>; + (RLWINM (STBCX gprc:$A, ForceXForm:$dst), 31, 31, 31)>; def : Pat<(int_ppc_fcfid f64:$A), (XSCVSXDDP $A)>; @@ -5322,9 +5322,9 @@ def : Pat<(int_ppc_mtmsr gprc:$RS), let Predicates = [IsISA2_07] in { def : Pat<(int_ppc_sthcx ForceXForm:$dst, gprc:$A), - (STHCX gprc:$A, ForceXForm:$dst)>; + (RLWINM (STHCX gprc:$A, ForceXForm:$dst), 31, 31, 31)>; def : Pat<(PPCStoreCond ForceXForm:$dst, gprc:$A, 2), - (STHCX gprc:$A, ForceXForm:$dst)>; + (RLWINM (STHCX gprc:$A, ForceXForm:$dst), 31, 31, 31)>; } def : Pat<(int_ppc_dcbtstt ForceXForm:$dst), (DCBTST 16, ForceXForm:$dst)>; diff --git a/llvm/lib/Target/PowerPC/PPCRegisterInfo.td b/llvm/lib/Target/PowerPC/PPCRegisterInfo.td index fdbdc14736c86..3cb7cd9d8f229 100644 --- a/llvm/lib/Target/PowerPC/PPCRegisterInfo.td +++ b/llvm/lib/Target/PowerPC/PPCRegisterInfo.td @@ -17,6 +17,7 @@ def sub_un : SubRegIndex<1, 3>; def sub_32 : SubRegIndex<32>; def sub_32_hi_phony : SubRegIndex<32,32>; def sub_64 : SubRegIndex<64>; +def sub_64_hi_phony : SubRegIndex<64,64>; def sub_vsx0 : SubRegIndex<128>; def sub_vsx1 : SubRegIndex<128, 128>; def sub_gp8_x0 : SubRegIndex<64>; @@ -77,19 +78,19 @@ class VF num, string n> : PPCReg { } // VR - One of the 32 128-bit vector registers -class VR : PPCReg { +class VR : PPCReg { let HWEncoding{4-0} = SubReg.HWEncoding{4-0}; let HWEncoding{5} = 0; - let SubRegs = [SubReg]; - let SubRegIndices = [sub_64]; + let SubRegs = [SubReg, SubRegH]; + let SubRegIndices = [sub_64, sub_64_hi_phony]; } // VSRL - One of the 32 128-bit VSX registers that overlap with the scalar // floating-point registers. -class VSRL : PPCReg { +class VSRL : PPCReg { let HWEncoding = SubReg.HWEncoding; - let SubRegs = [SubReg]; - let SubRegIndices = [sub_64]; + let SubRegs = [SubReg, SubRegH]; + let SubRegIndices = [sub_64, sub_64_hi_phony]; } // VSXReg - One of the VSX registers in the range vs32-vs63 with numbering @@ -155,6 +156,22 @@ foreach Index = 0-31 in { DwarfRegNum<[!add(Index, 32), !add(Index, 32)]>; } +// The FH and VFH registers have been marked as Artifical because there are no +// instructions on PowerPC that use those register classes. They only exist +// in order to ensure that the super registers (V and VSL) are covered by their +// subregisters and have correct subregister lane masks. +let isArtificial = 1 in { + foreach Index = 0-31 in { + def FH#Index : FPR<-1, "">; + def VFH#Index : VF<-1, "">; + } +} + +let isAllocatable = 0, CopyCost = -1 in { + def VFHRC : RegisterClass<"PPC", [f64], 64, (sequence "VFH%u", 0, 31)>; + def FHRC : RegisterClass<"PPC", [f64], 64, (sequence "FH%u", 0, 31)>; +} + // Floating-point pair registers foreach Index = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 } in { def Fpair#Index : FPPair<"fp"#Index, Index>; @@ -168,17 +185,19 @@ foreach Index = 0-31 in { DwarfRegNum<[!add(Index, 77), !add(Index, 77)]>; } +let CoveredBySubRegs = 1 in { // Vector registers foreach Index = 0-31 in { - def V#Index : VR("VF"#Index), "v"#Index>, + def V#Index : VR("VF"#Index), !cast("VFH"#Index), "v"#Index>, DwarfRegNum<[!add(Index, 77), !add(Index, 77)]>; } // VSX registers foreach Index = 0-31 in { - def VSL#Index : VSRL("F"#Index), "vs"#Index>, + def VSL#Index : VSRL("F"#Index), !cast("FH"#Index), "vs"#Index>, DwarfRegAlias("F"#Index)>; } +} // Dummy VSX registers, this defines string: "vs32"-"vs63", and is only used for // asm printing. diff --git a/llvm/lib/Target/PowerPC/PPCSubtarget.h b/llvm/lib/Target/PowerPC/PPCSubtarget.h index bf35f8ec151b1..2079dc0acc3cf 100644 --- a/llvm/lib/Target/PowerPC/PPCSubtarget.h +++ b/llvm/lib/Target/PowerPC/PPCSubtarget.h @@ -61,6 +61,7 @@ enum { DIR_PWR8, DIR_PWR9, DIR_PWR10, + DIR_PWR11, DIR_PWR_FUTURE, DIR_64 }; diff --git a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp index 3fa35efc2d159..b7bdbeb535d52 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp @@ -504,7 +504,7 @@ unsigned PPCTTIImpl::getCacheLineSize() const { // Assume that Future CPU has the same cache line size as the others. if (Directive == PPC::DIR_PWR7 || Directive == PPC::DIR_PWR8 || Directive == PPC::DIR_PWR9 || Directive == PPC::DIR_PWR10 || - Directive == PPC::DIR_PWR_FUTURE) + Directive == PPC::DIR_PWR11 || Directive == PPC::DIR_PWR_FUTURE) return 128; // On other processors return a default of 64 bytes. @@ -538,7 +538,7 @@ unsigned PPCTTIImpl::getMaxInterleaveFactor(ElementCount VF) { // Assume that future is the same as the others. if (Directive == PPC::DIR_PWR7 || Directive == PPC::DIR_PWR8 || Directive == PPC::DIR_PWR9 || Directive == PPC::DIR_PWR10 || - Directive == PPC::DIR_PWR_FUTURE) + Directive == PPC::DIR_PWR11 || Directive == PPC::DIR_PWR_FUTURE) return 12; // For most things, modern systems have two execution units (and diff --git a/llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp b/llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp index 0a66a38f6d5ab..be2e880ecd3a9 100644 --- a/llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp +++ b/llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp @@ -187,25 +187,10 @@ bool RISCVCodeGenPrepare::expandVPStrideLoad(IntrinsicInst &II) { auto *VTy = cast(II.getType()); IRBuilder<> Builder(&II); - - // Extend VL from i32 to XLen if needed. - if (ST->is64Bit()) - VL = Builder.CreateZExt(VL, Builder.getInt64Ty()); - Type *STy = VTy->getElementType(); Value *Val = Builder.CreateLoad(STy, BasePtr); - const auto &TLI = *ST->getTargetLowering(); - Value *Res; - - // TODO: Also support fixed/illegal vector types to splat with evl = vl. - if (isa(VTy) && TLI.isTypeLegal(EVT::getEVT(VTy))) { - unsigned VMVOp = STy->isFloatingPointTy() ? Intrinsic::riscv_vfmv_v_f - : Intrinsic::riscv_vmv_v_x; - Res = Builder.CreateIntrinsic(VMVOp, {VTy, VL->getType()}, - {PoisonValue::get(VTy), Val, VL}); - } else { - Res = Builder.CreateVectorSplat(VTy->getElementCount(), Val); - } + Value *Res = Builder.CreateIntrinsic(Intrinsic::experimental_vp_splat, {VTy}, + {Val, II.getOperand(2), VL}); II.replaceAllUsesWith(Res); II.eraseFromParent(); diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp index eef6ae677ac85..db949f3476e2b 100644 --- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp @@ -3721,6 +3721,10 @@ bool RISCVDAGToDAGISel::performCombineVMergeAndVOps(SDNode *N) { assert(!Mask || cast(Mask)->getReg() == RISCV::V0); assert(!Glue || Glue.getValueType() == MVT::Glue); + // If the EEW of True is different from vmerge's SEW, then we can't fold. + if (True.getSimpleValueType() != N->getSimpleValueType(0)) + return false; + // We require that either merge and false are the same, or that merge // is undefined. if (Merge != False && !isImplicitDef(Merge)) diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp index ba3b4bd701d63..6c0cbeadebf43 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -2902,7 +2902,7 @@ RISCVInstrInfo::getOutliningTypeImpl(MachineBasicBlock::iterator &MBBI, // if any possible. if (MO.getTargetFlags() == RISCVII::MO_PCREL_LO && (MI.getMF()->getTarget().getFunctionSections() || F.hasComdat() || - F.hasSection())) + F.hasSection() || F.getSectionPrefix())) return outliner::InstrType::Illegal; } diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td index 9257ee5a09a8e..3f279b7a58ca6 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td @@ -764,9 +764,9 @@ def InsnCR : DirectiveInsnCR<(outs AnyReg:$rd), (ins uimm2_opcode:$opcode, uimm4:$funct4, AnyReg:$rs2), "$opcode, $funct4, $rd, $rs2">; -def InsnCI : DirectiveInsnCI<(outs AnyRegC:$rd), (ins uimm2_opcode:$opcode, - uimm3:$funct3, - simm6:$imm6), +def InsnCI : DirectiveInsnCI<(outs AnyReg:$rd), (ins uimm2_opcode:$opcode, + uimm3:$funct3, + simm6:$imm6), "$opcode, $funct3, $rd, $imm6">; def InsnCIW : DirectiveInsnCIW<(outs AnyRegC:$rd), (ins uimm2_opcode:$opcode, uimm3:$funct3, @@ -818,7 +818,7 @@ def : InstAlias<".insn_cr $opcode, $funct4, $rd, $rs2", (InsnCR AnyReg:$rd, uimm2_opcode:$opcode, uimm4:$funct4, AnyReg:$rs2)>; def : InstAlias<".insn_ci $opcode, $funct3, $rd, $imm6", - (InsnCI AnyRegC:$rd, uimm2_opcode:$opcode, uimm3:$funct3, + (InsnCI AnyReg:$rd, uimm2_opcode:$opcode, uimm3:$funct3, simm6:$imm6)>; def : InstAlias<".insn_ciw $opcode, $funct3, $rd, $imm8", (InsnCIW AnyRegC:$rd, uimm2_opcode:$opcode, uimm3:$funct3, diff --git a/llvm/lib/Target/RISCV/RISCVMergeBaseOffset.cpp b/llvm/lib/Target/RISCV/RISCVMergeBaseOffset.cpp index fecc83a821f42..b6ac3384e7d3e 100644 --- a/llvm/lib/Target/RISCV/RISCVMergeBaseOffset.cpp +++ b/llvm/lib/Target/RISCV/RISCVMergeBaseOffset.cpp @@ -429,8 +429,16 @@ bool RISCVMergeBaseOffsetOpt::foldIntoMemoryOps(MachineInstr &Hi, NumOps = Flags.getNumOperandRegisters(); // Memory constraints have two operands. - if (NumOps != 2 || !Flags.isMemKind()) + if (NumOps != 2 || !Flags.isMemKind()) { + // If the register is used by something other than a memory contraint, + // we should not fold. + for (unsigned J = 0; J < NumOps; ++J) { + const MachineOperand &MO = UseMI.getOperand(I + 1 + J); + if (MO.isReg() && MO.getReg() == DestReg) + return false; + } continue; + } // We can't do this for constraint A because AMO instructions don't have // an immediate offset field. diff --git a/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp b/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp index 6855471840e9d..71ec01aeb011c 100644 --- a/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp +++ b/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp @@ -314,57 +314,6 @@ void SparcAsmPrinter::printOperand(const MachineInstr *MI, int opNum, const MachineOperand &MO = MI->getOperand (opNum); SparcMCExpr::VariantKind TF = (SparcMCExpr::VariantKind) MO.getTargetFlags(); -#ifndef NDEBUG - // Verify the target flags. - if (MO.isGlobal() || MO.isSymbol() || MO.isCPI()) { - if (MI->getOpcode() == SP::CALL) - assert(TF == SparcMCExpr::VK_Sparc_None && - "Cannot handle target flags on call address"); - else if (MI->getOpcode() == SP::SETHIi) - assert((TF == SparcMCExpr::VK_Sparc_HI - || TF == SparcMCExpr::VK_Sparc_H44 - || TF == SparcMCExpr::VK_Sparc_HH - || TF == SparcMCExpr::VK_Sparc_LM - || TF == SparcMCExpr::VK_Sparc_TLS_GD_HI22 - || TF == SparcMCExpr::VK_Sparc_TLS_LDM_HI22 - || TF == SparcMCExpr::VK_Sparc_TLS_LDO_HIX22 - || TF == SparcMCExpr::VK_Sparc_TLS_IE_HI22 - || TF == SparcMCExpr::VK_Sparc_TLS_LE_HIX22) && - "Invalid target flags for address operand on sethi"); - else if (MI->getOpcode() == SP::TLS_CALL) - assert((TF == SparcMCExpr::VK_Sparc_None - || TF == SparcMCExpr::VK_Sparc_TLS_GD_CALL - || TF == SparcMCExpr::VK_Sparc_TLS_LDM_CALL) && - "Cannot handle target flags on tls call address"); - else if (MI->getOpcode() == SP::TLS_ADDrr) - assert((TF == SparcMCExpr::VK_Sparc_TLS_GD_ADD - || TF == SparcMCExpr::VK_Sparc_TLS_LDM_ADD - || TF == SparcMCExpr::VK_Sparc_TLS_LDO_ADD - || TF == SparcMCExpr::VK_Sparc_TLS_IE_ADD) && - "Cannot handle target flags on add for TLS"); - else if (MI->getOpcode() == SP::TLS_LDrr) - assert(TF == SparcMCExpr::VK_Sparc_TLS_IE_LD && - "Cannot handle target flags on ld for TLS"); - else if (MI->getOpcode() == SP::TLS_LDXrr) - assert(TF == SparcMCExpr::VK_Sparc_TLS_IE_LDX && - "Cannot handle target flags on ldx for TLS"); - else if (MI->getOpcode() == SP::XORri) - assert((TF == SparcMCExpr::VK_Sparc_TLS_LDO_LOX10 - || TF == SparcMCExpr::VK_Sparc_TLS_LE_LOX10) && - "Cannot handle target flags on xor for TLS"); - else - assert((TF == SparcMCExpr::VK_Sparc_LO - || TF == SparcMCExpr::VK_Sparc_M44 - || TF == SparcMCExpr::VK_Sparc_L44 - || TF == SparcMCExpr::VK_Sparc_HM - || TF == SparcMCExpr::VK_Sparc_TLS_GD_LO10 - || TF == SparcMCExpr::VK_Sparc_TLS_LDM_LO10 - || TF == SparcMCExpr::VK_Sparc_TLS_IE_LO10 ) && - "Invalid target flags for small address operand"); - } -#endif - - bool CloseParen = SparcMCExpr::printVariantKind(O, TF); switch (MO.getType()) { diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp index a3ef11b2cab45..67d993a51ad97 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp @@ -201,7 +201,7 @@ class X86AsmBackend : public MCAsmBackend { bool padInstructionEncoding(MCRelaxableFragment &RF, MCCodeEmitter &Emitter, unsigned &RemainingSize) const; - bool finishLayout(const MCAssembler &Asm) const override; + void finishLayout(const MCAssembler &Asm) const override; unsigned getMaximumNopSize(const MCSubtargetInfo &STI) const override; @@ -856,7 +856,7 @@ bool X86AsmBackend::padInstructionEncoding(MCRelaxableFragment &RF, return Changed; } -bool X86AsmBackend::finishLayout(const MCAssembler &Asm) const { +void X86AsmBackend::finishLayout(MCAssembler const &Asm) const { // See if we can further relax some instructions to cut down on the number of // nop bytes required for code alignment. The actual win is in reducing // instruction count, not number of bytes. Modern X86-64 can easily end up @@ -864,7 +864,7 @@ bool X86AsmBackend::finishLayout(const MCAssembler &Asm) const { // (i.e. eliminate nops) even at the cost of increasing the size and // complexity of others. if (!X86PadForAlign && !X86PadForBranchAlign) - return false; + return; // The processed regions are delimitered by LabeledFragments. -g may have more // MCSymbols and therefore different relaxation results. X86PadForAlign is @@ -911,6 +911,9 @@ bool X86AsmBackend::finishLayout(const MCAssembler &Asm) const { continue; } +#ifndef NDEBUG + const uint64_t OrigOffset = Asm.getFragmentOffset(F); +#endif const uint64_t OrigSize = Asm.computeFragmentSize(F); // To keep the effects local, prefer to relax instructions closest to @@ -923,7 +926,8 @@ bool X86AsmBackend::finishLayout(const MCAssembler &Asm) const { // Give the backend a chance to play any tricks it wishes to increase // the encoding size of the given instruction. Target independent code // will try further relaxation, but target's may play further tricks. - padInstructionEncoding(RF, Asm.getEmitter(), RemainingSize); + if (padInstructionEncoding(RF, Asm.getEmitter(), RemainingSize)) + Sec.setHasLayout(false); // If we have an instruction which hasn't been fully relaxed, we can't // skip past it and insert bytes before it. Changing its starting @@ -940,6 +944,14 @@ bool X86AsmBackend::finishLayout(const MCAssembler &Asm) const { if (F.getKind() == MCFragment::FT_BoundaryAlign) cast(F).setSize(RemainingSize); +#ifndef NDEBUG + const uint64_t FinalOffset = Asm.getFragmentOffset(F); + const uint64_t FinalSize = Asm.computeFragmentSize(F); + assert(OrigOffset + OrigSize == FinalOffset + FinalSize && + "can't move start of next fragment!"); + assert(FinalSize == RemainingSize && "inconsistent size computation?"); +#endif + // If we're looking at a boundary align, make sure we don't try to pad // its target instructions for some following directive. Doing so would // break the alignment of the current boundary align. @@ -953,7 +965,11 @@ bool X86AsmBackend::finishLayout(const MCAssembler &Asm) const { } } - return true; + // The layout is done. Mark every fragment as valid. + for (MCSection &Section : Asm) { + Asm.getFragmentOffset(*Section.curFragList()->Tail); + Asm.computeFragmentSize(*Section.curFragList()->Tail); + } } unsigned X86AsmBackend::getMaximumNopSize(const MCSubtargetInfo &STI) const { @@ -1312,7 +1328,7 @@ class DarwinX86AsmBackend : public X86AsmBackend { /// Implementation of algorithm to generate the compact unwind encoding /// for the CFI instructions. - uint32_t generateCompactUnwindEncoding(const MCDwarfFrameInfo *FI, + uint64_t generateCompactUnwindEncoding(const MCDwarfFrameInfo *FI, const MCContext *Ctxt) const override { ArrayRef Instrs = FI->Instructions; if (Instrs.empty()) return 0; @@ -1327,13 +1343,13 @@ class DarwinX86AsmBackend : public X86AsmBackend { bool HasFP = false; // Encode that we are using EBP/RBP as the frame pointer. - uint32_t CompactUnwindEncoding = 0; + uint64_t CompactUnwindEncoding = 0; unsigned SubtractInstrIdx = Is64Bit ? 3 : 2; unsigned InstrOffset = 0; unsigned StackAdjust = 0; - unsigned StackSize = 0; - int MinAbsOffset = std::numeric_limits::max(); + uint64_t StackSize = 0; + int64_t MinAbsOffset = std::numeric_limits::max(); for (const MCCFIInstruction &Inst : Instrs) { switch (Inst.getOperation()) { @@ -1360,7 +1376,7 @@ class DarwinX86AsmBackend : public X86AsmBackend { memset(SavedRegs, 0, sizeof(SavedRegs)); StackAdjust = 0; SavedRegIdx = 0; - MinAbsOffset = std::numeric_limits::max(); + MinAbsOffset = std::numeric_limits::max(); InstrOffset += MoveInstrSize; break; } @@ -1403,7 +1419,7 @@ class DarwinX86AsmBackend : public X86AsmBackend { unsigned Reg = *MRI.getLLVMRegNum(Inst.getRegister(), true); SavedRegs[SavedRegIdx++] = Reg; StackAdjust += OffsetSize; - MinAbsOffset = std::min(MinAbsOffset, abs(Inst.getOffset())); + MinAbsOffset = std::min(MinAbsOffset, std::abs(Inst.getOffset())); InstrOffset += PushInstrSize(Reg); break; } diff --git a/llvm/lib/Target/X86/X86.td b/llvm/lib/Target/X86/X86.td index 9dafd5e628ca8..e82e624f70997 100644 --- a/llvm/lib/Target/X86/X86.td +++ b/llvm/lib/Target/X86/X86.td @@ -1543,6 +1543,19 @@ def ProcessorFeatures { FeatureVPOPCNTDQ]; list ZN4Features = !listconcat(ZN3Features, ZN4AdditionalFeatures); + + + list ZN5Tuning = ZN4Tuning; + list ZN5AdditionalFeatures = [FeatureVNNI, + FeatureMOVDIRI, + FeatureMOVDIR64B, + FeatureVP2INTERSECT, + FeaturePREFETCHI, + FeatureAVXVNNI + ]; + list ZN5Features = + !listconcat(ZN4Features, ZN5AdditionalFeatures); + } //===----------------------------------------------------------------------===// @@ -1892,6 +1905,8 @@ def : ProcModel<"znver3", Znver3Model, ProcessorFeatures.ZN3Features, ProcessorFeatures.ZN3Tuning>; def : ProcModel<"znver4", Znver4Model, ProcessorFeatures.ZN4Features, ProcessorFeatures.ZN4Tuning>; +def : ProcModel<"znver5", Znver4Model, ProcessorFeatures.ZN5Features, + ProcessorFeatures.ZN5Tuning>; def : Proc<"geode", [FeatureX87, FeatureCX8, FeatureMMX, FeaturePRFCHW], [TuningSlowUAMem16, TuningInsertVZEROUPPER]>; diff --git a/llvm/lib/Target/X86/X86CallingConv.td b/llvm/lib/Target/X86/X86CallingConv.td index 9ec68bfb8e0f7..6f5c7671052b3 100644 --- a/llvm/lib/Target/X86/X86CallingConv.td +++ b/llvm/lib/Target/X86/X86CallingConv.td @@ -753,6 +753,15 @@ def CC_X86_64_AnyReg : CallingConv<[ CCCustom<"CC_X86_AnyReg_Error"> ]>; +def CC_X86_64_Mono : CallingConv<[ + CCIfInReg>, + + // Mingw64 and native Win64 use Win64 CC + CCIfSubtarget<"isTargetWin64()", CCDelegateTo>, + // Otherwise, drop to normal X86-64 CC + CCDelegateTo +]>; + //===----------------------------------------------------------------------===// // X86 C Calling Convention //===----------------------------------------------------------------------===// @@ -1075,6 +1084,12 @@ def CC_X86_64_Preserve_None : CallingConv<[ CCDelegateTo ]>; +def CC_X86_32_Mono : CallingConv<[ + CCIfInReg>, + + CCDelegateTo +]>; + //===----------------------------------------------------------------------===// // X86 Root Argument Calling Conventions //===----------------------------------------------------------------------===// @@ -1096,6 +1111,7 @@ def CC_X86_32 : CallingConv<[ CCIfCC<"CallingConv::X86_RegCall", CCIfSubtarget<"isTargetWin32()", CCIfRegCallv4>>>, CCIfCC<"CallingConv::X86_RegCall", CCDelegateTo>, + CCIfCC<"CallingConv::Mono", CCDelegateTo>, // Otherwise, drop to normal X86-32 CC CCDelegateTo @@ -1116,6 +1132,7 @@ def CC_X86_64 : CallingConv<[ CCIfCC<"CallingConv::X86_RegCall", CCDelegateTo>, CCIfCC<"CallingConv::PreserveNone", CCDelegateTo>, CCIfCC<"CallingConv::X86_INTR", CCCustom<"CC_X86_Intr">>, + CCIfCC<"CallingConv::Mono", CCDelegateTo>, // Mingw64 and native Win64 use Win64 CC CCIfSubtarget<"isTargetWin64()", CCDelegateTo>, diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp index 2eae155956368..9c6a507e0de42 100644 --- a/llvm/lib/Target/X86/X86FastISel.cpp +++ b/llvm/lib/Target/X86/X86FastISel.cpp @@ -1179,6 +1179,9 @@ bool X86FastISel::X86SelectRet(const Instruction *I) { return false; CallingConv::ID CC = F.getCallingConv(); + if (CC == CallingConv::Mono && Subtarget->isTargetWin64()) + CC = CallingConv::Win64; + if (CC != CallingConv::C && CC != CallingConv::Fast && CC != CallingConv::Tail && @@ -3239,6 +3242,9 @@ bool X86FastISel::fastLowerCall(CallLoweringInfo &CLI) { if (Subtarget->useIndirectThunkCalls()) return false; + if (CC == CallingConv::Mono && Subtarget->isTargetWin64()) + CC = CallingConv::Win64; + // Handle only C and fastcc calling conventions for now. switch (CC) { default: return false; diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp index 0ff50d8ef678e..edd2d003dccbf 100644 --- a/llvm/lib/Target/X86/X86FrameLowering.cpp +++ b/llvm/lib/Target/X86/X86FrameLowering.cpp @@ -473,7 +473,7 @@ void X86FrameLowering::emitCalleeSavedFrameMovesFullCFA( : FramePtr; unsigned DwarfReg = MRI->getDwarfRegNum(MachineFramePtr, true); // Offset = space for return address + size of the frame pointer itself. - unsigned Offset = (Is64Bit ? 8 : 4) + (Uses64BitFramePtr ? 8 : 4); + int64_t Offset = (Is64Bit ? 8 : 4) + (Uses64BitFramePtr ? 8 : 4); BuildCFI(MBB, MBBI, DebugLoc{}, MCCFIInstruction::createOffset(nullptr, DwarfReg, -Offset)); emitCalleeSavedFrameMoves(MBB, MBBI, DebugLoc{}, true); @@ -1547,7 +1547,10 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, bool NeedsWinFPO = !IsFunclet && STI.isTargetWin32() && MF.getFunction().getParent()->getCodeViewFlag(); bool NeedsWinCFI = NeedsWin64CFI || NeedsWinFPO; - bool NeedsDwarfCFI = needsDwarfCFI(MF); + bool NeedsDwarfCFI = + Fn.getCallingConv() == CallingConv::Mono + ? MF.needsFrameMoves() + : needsDwarfCFI(MF); Register FramePtr = TRI->getFrameRegister(MF); const Register MachineFramePtr = STI.isTarget64BitILP32() ? Register(getX86SubSuperRegister(FramePtr, 64)) @@ -1705,6 +1708,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, uint64_t NumBytes = 0; int stackGrowth = -SlotSize; + int StackOffset = 2 * stackGrowth; // Find the funclet establisher parameter Register Establisher = X86::NoRegister; @@ -1748,16 +1752,18 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, assert(StackSize); BuildCFI(MBB, MBBI, DL, MCCFIInstruction::cfiDefCfaOffset( - nullptr, -2 * stackGrowth + (int)TailCallArgReserveSize), + nullptr, -StackOffset + (int)TailCallArgReserveSize), MachineInstr::FrameSetup); // Change the rule for the FramePtr to be an "offset" rule. unsigned DwarfFramePtr = TRI->getDwarfRegNum(MachineFramePtr, true); BuildCFI(MBB, MBBI, DL, MCCFIInstruction::createOffset(nullptr, DwarfFramePtr, - 2 * stackGrowth - + StackOffset - (int)TailCallArgReserveSize), MachineInstr::FrameSetup); + + StackOffset += stackGrowth; } if (NeedsWinCFI) { @@ -1878,7 +1884,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, // Skip the callee-saved push instructions. bool PushedRegs = false; - int StackOffset = 2 * stackGrowth; + StackOffset = 2 * stackGrowth; MachineBasicBlock::const_iterator LastCSPush = MBBI; auto IsCSPush = [&](const MachineBasicBlock::iterator &MBBI) { if (MBBI == MBB.end() || !MBBI->getFlag(MachineInstr::FrameSetup)) @@ -1895,7 +1901,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, ++MBBI; unsigned Opc = LastCSPush->getOpcode(); - if (!HasFP && NeedsDwarfCFI) { + if (!HasFP && NeedsDwarfCFI || (IsWin64Prologue && NeedsDwarfCFI)) { // Mark callee-saved push instruction. // Define the current CFA rule to use the provided offset. assert(StackSize); @@ -1906,6 +1912,14 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, BuildCFI(MBB, MBBI, DL, MCCFIInstruction::cfiDefCfaOffset(nullptr, -StackOffset), MachineInstr::FrameSetup); + + if (IsWin64Prologue && NeedsDwarfCFI) { + unsigned DwarfReg = TRI->getDwarfRegNum(Reg, true); + BuildCFI( + MBB, MBBI, DL, + MCCFIInstruction::createOffset(nullptr, DwarfReg, StackOffset)); + } + StackOffset += stackGrowth; } @@ -2017,6 +2031,13 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, .setMIFlag(MachineInstr::FrameSetup); } + // When emitting Dwarf CFI on Win64 account for adjustment at correct + // location in stream. + if (IsWin64Prologue && NeedsDwarfCFI && NumBytes) { + BuildCFI(MBB, MBBI, DL, + MCCFIInstruction::createAdjustCfaOffset(nullptr, NumBytes)); + } + int SEHFrameOffset = 0; unsigned SPOrEstablisher; if (IsFunclet) { @@ -2071,6 +2092,21 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, if (isAsynchronousEHPersonality(Personality)) MF.getWinEHFuncInfo()->SEHSetFrameOffset = SEHFrameOffset; } + + if (NeedsDwarfCFI && !IsFunclet) { + // Define the current CFA to use the EBP/RBP register. + unsigned DwarfFramePtr = TRI->getDwarfRegNum(FramePtr, true); + BuildCFI(MBB, MBBI, DL, + MCCFIInstruction::createDefCfaRegister(nullptr, DwarfFramePtr)); + + if (SEHFrameOffset) { + // Framepointer has been adjusted with an offset, make sure + // it is reflected in CFA offset. + BuildCFI( + MBB, MBBI, DL, + MCCFIInstruction::createAdjustCfaOffset(nullptr, -SEHFrameOffset)); + } + } } else if (IsFunclet && STI.is32Bit()) { // Reset EBP / ESI to something good for funclets. MBBI = restoreWin32EHStackPointers(MBB, MBBI, DL); @@ -2194,7 +2230,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, .setMIFlag(MachineInstr::FrameSetup); } - if (((!HasFP && NumBytes) || PushedRegs) && NeedsDwarfCFI) { + if (((!HasFP && NumBytes) || PushedRegs) && NeedsDwarfCFI && !IsWin64Prologue) { // Mark end of stack pointer adjustment. if (!HasFP && NumBytes) { // Define the current CFA rule to use the provided offset. @@ -2553,7 +2589,7 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF, if (!HasFP && NeedsDwarfCFI) { MBBI = FirstCSPop; - int64_t Offset = -CSSize - SlotSize; + int64_t Offset = -(int64_t)CSSize - SlotSize; // Mark callee-saved pop instruction. // Define the current CFA rule to use the provided offset. while (MBBI != MBB.end()) { diff --git a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp index f659c168b86e0..38cded2d6df48 100644 --- a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp +++ b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp @@ -1251,7 +1251,9 @@ static bool canGuaranteeTCO(CallingConv::ID CC) { } /// Return true if we might ever do TCO for calls with this calling convention. -static bool mayTailCallThisCC(CallingConv::ID CC) { +static bool mayTailCallThisCC(CallingConv::ID CC, bool isTargetWin64) { + if (CC == CallingConv::Mono && isTargetWin64) + CC = CallingConv::Win64; switch (CC) { // C calling conventions: case CallingConv::C: @@ -1283,7 +1285,7 @@ bool X86TargetLowering::mayBeEmittedAsTailCall(const CallInst *CI) const { return false; CallingConv::ID CalleeCC = CI->getCallingConv(); - if (!mayTailCallThisCC(CalleeCC)) + if (!mayTailCallThisCC(CalleeCC, Subtarget.isTargetWin64())) return false; return true; @@ -2738,7 +2740,7 @@ bool X86TargetLowering::IsEligibleForTailCallOptimization( CallingConv::ID CalleeCC = CLI.CallConv; bool isVarArg = CLI.IsVarArg; - if (!mayTailCallThisCC(CalleeCC)) + if (!mayTailCallThisCC(CalleeCC, Subtarget.isTargetWin64())) return false; // If -tailcallopt is specified, make fastcc functions tail-callable. diff --git a/llvm/lib/Target/X86/X86PfmCounters.td b/llvm/lib/Target/X86/X86PfmCounters.td index 2b1dac411c992..c30e989cdc2af 100644 --- a/llvm/lib/Target/X86/X86PfmCounters.td +++ b/llvm/lib/Target/X86/X86PfmCounters.td @@ -350,3 +350,4 @@ def ZnVer4PfmCounters : ProcPfmCounters { let ValidationCounters = DefaultAMDPfmValidationCounters; } def : PfmCountersBinding<"znver4", ZnVer4PfmCounters>; +def : PfmCountersBinding<"znver5", ZnVer4PfmCounters>; diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp index 555ede9e95403..afe4c0ac96707 100644 --- a/llvm/lib/Target/X86/X86RegisterInfo.cpp +++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp @@ -301,6 +301,9 @@ X86RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { if (MF->getFunction().hasFnAttribute("no_callee_saved_registers")) return CSR_NoRegs_SaveList; + if (CC == CallingConv::Mono && IsWin64) + CC = CallingConv::Win64; + switch (CC) { case CallingConv::GHC: case CallingConv::HiPE: @@ -425,6 +428,9 @@ X86RegisterInfo::getCallPreservedMask(const MachineFunction &MF, bool HasAVX = Subtarget.hasAVX(); bool HasAVX512 = Subtarget.hasAVX512(); + if ( CC == CallingConv::Mono && IsWin64) + CC = CallingConv::Win64; + switch (CC) { case CallingConv::GHC: case CallingConv::HiPE: diff --git a/llvm/lib/Target/X86/X86SchedIceLake.td b/llvm/lib/Target/X86/X86SchedIceLake.td index 186d4d84c2510..b68be9be6d473 100644 --- a/llvm/lib/Target/X86/X86SchedIceLake.td +++ b/llvm/lib/Target/X86/X86SchedIceLake.td @@ -1510,8 +1510,10 @@ def ICXWriteResGroup113 : SchedWriteRes<[ICXPort0,ICXPort49,ICXPort78,ICXPort015 let ReleaseAtCycles = [1,8,8,2]; } def: InstRW<[ICXWriteResGroup113], (instrs VPSCATTERDQZmr, + VPSCATTERQDZmr, VPSCATTERQQZmr, VSCATTERDPDZmr, + VSCATTERQPSZmr, VSCATTERQPDZmr)>; def ICXWriteResGroup114 : SchedWriteRes<[ICXPort0,ICXPort49,ICXPort5,ICXPort78,ICXPort0156]> { diff --git a/llvm/lib/Target/X86/X86SchedSkylakeServer.td b/llvm/lib/Target/X86/X86SchedSkylakeServer.td index 4fded44085e89..2423602d06c47 100644 --- a/llvm/lib/Target/X86/X86SchedSkylakeServer.td +++ b/llvm/lib/Target/X86/X86SchedSkylakeServer.td @@ -1499,8 +1499,10 @@ def SKXWriteResGroup113 : SchedWriteRes<[SKXPort0,SKXPort4,SKXPort237,SKXPort015 let ReleaseAtCycles = [1,8,8,2]; } def: InstRW<[SKXWriteResGroup113], (instrs VPSCATTERDQZmr, + VPSCATTERQDZmr, VPSCATTERQQZmr, VSCATTERDPDZmr, + VSCATTERQPSZmr, VSCATTERQPDZmr)>; def SKXWriteResGroup114 : SchedWriteRes<[SKXPort0,SKXPort4,SKXPort5,SKXPort237,SKXPort0156]> { diff --git a/llvm/lib/Target/X86/X86Subtarget.h b/llvm/lib/Target/X86/X86Subtarget.h index e3cb9ee8ce190..94a7cb0c04f97 100644 --- a/llvm/lib/Target/X86/X86Subtarget.h +++ b/llvm/lib/Target/X86/X86Subtarget.h @@ -347,6 +347,7 @@ class X86Subtarget final : public X86GenSubtargetInfo { case CallingConv::X86_ThisCall: case CallingConv::X86_VectorCall: case CallingConv::Intel_OCL_BI: + case CallingConv::Mono: return isTargetWin64(); // This convention allows using the Win64 convention on other targets. case CallingConv::Win64: diff --git a/llvm/lib/TargetParser/Host.cpp b/llvm/lib/TargetParser/Host.cpp index fda085f880096..865b6a44adbb0 100644 --- a/llvm/lib/TargetParser/Host.cpp +++ b/llvm/lib/TargetParser/Host.cpp @@ -150,6 +150,7 @@ StringRef sys::detail::getHostCPUNameForPowerPC(StringRef ProcCpuinfoContent) { .Case("POWER8NVL", "pwr8") .Case("POWER9", "pwr9") .Case("POWER10", "pwr10") + .Case("POWER11", "pwr11") // FIXME: If we get a simulator or machine with the capabilities of // mcpu=future, we should revisit this and add the name reported by the // simulator/machine. @@ -1212,6 +1213,25 @@ static const char *getAMDProcessorTypeAndSubtype(unsigned Family, break; // "znver4" } break; // family 19h + case 26: + CPU = "znver5"; + *Type = X86::AMDFAM1AH; + if (Model <= 0x77) { + // Models 00h-0Fh (Breithorn). + // Models 10h-1Fh (Breithorn-Dense). + // Models 20h-2Fh (Strix 1). + // Models 30h-37h (Strix 2). + // Models 38h-3Fh (Strix 3). + // Models 40h-4Fh (Granite Ridge). + // Models 50h-5Fh (Weisshorn). + // Models 60h-6Fh (Krackan1). + // Models 70h-77h (Sarlak). + CPU = "znver5"; + *Subtype = X86::AMDFAM1AH_ZNVER5; + break; // "znver5" + } + break; + default: break; // Unknown AMD CPU. } @@ -1549,6 +1569,12 @@ StringRef sys::getHostCPUName() { case 0x40000: #endif return "pwr10"; +#ifdef POWER_11 + case POWER_11: +#else + case 0x80000: +#endif + return "pwr11"; default: return "generic"; } diff --git a/llvm/lib/TargetParser/X86TargetParser.cpp b/llvm/lib/TargetParser/X86TargetParser.cpp index dcf9130052ac1..a6f3b5ba5d33e 100644 --- a/llvm/lib/TargetParser/X86TargetParser.cpp +++ b/llvm/lib/TargetParser/X86TargetParser.cpp @@ -238,6 +238,10 @@ static constexpr FeatureBitset FeaturesZNVER4 = FeatureAVX512BITALG | FeatureAVX512VPOPCNTDQ | FeatureAVX512BF16 | FeatureGFNI | FeatureSHSTK; +static constexpr FeatureBitset FeaturesZNVER5 = + FeaturesZNVER4 | FeatureAVXVNNI | FeatureMOVDIRI | FeatureMOVDIR64B | + FeatureAVX512VP2INTERSECT | FeaturePREFETCHI | FeatureAVXVNNI; + // D151696 tranplanted Mangling and OnlyForCPUDispatchSpecific from // X86TargetParser.def to here. They are assigned by following ways: // 1. Copy the mangling from the original CPU_SPEICIFC MACROs. If no, assign @@ -417,6 +421,7 @@ constexpr ProcInfo Processors[] = { { {"znver2"}, CK_ZNVER2, FEATURE_AVX2, FeaturesZNVER2, '\0', false }, { {"znver3"}, CK_ZNVER3, FEATURE_AVX2, FeaturesZNVER3, '\0', false }, { {"znver4"}, CK_ZNVER4, FEATURE_AVX512VBMI2, FeaturesZNVER4, '\0', false }, + { {"znver5"}, CK_ZNVER5, FEATURE_AVX512VP2INTERSECT, FeaturesZNVER5, '\0', false }, // Generic 64-bit processor. { {"x86-64"}, CK_x86_64, FEATURE_SSE2 , FeaturesX86_64, '\0', false }, { {"x86-64-v2"}, CK_x86_64_v2, FEATURE_SSE4_2 , FeaturesX86_64_V2, '\0', false }, diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 809be499ee0f9..9d2990c98ce27 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -171,7 +171,7 @@ Instruction *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst *MI) { IntegerType* IntType = IntegerType::get(MI->getContext(), Size<<3); // If the memcpy has metadata describing the members, see if we can get the - // TBAA tag describing our copy. + // TBAA, scope and noalias tags describing our copy. AAMDNodes AACopyMD = MI->getAAMetadata().adjustForAccess(Size); Value *Src = MI->getArgOperand(1); diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp index c979e81ac1a3f..078bc0c9e5e63 100644 --- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -4999,15 +4999,22 @@ struct VarArgHelperBase : public VarArgHelper { VAListTagSize, Alignment, false); } + bool isTargetWin64() const { + Triple TargetTriple(F.getParent()->getTargetTriple()); + return TargetTriple.isArch64Bit() && TargetTriple.isOSWindows(); + } + void visitVAStartInst(VAStartInst &I) override { - if (F.getCallingConv() == CallingConv::Win64) + if (F.getCallingConv() == CallingConv::Win64 || + (F.getCallingConv() == CallingConv::Mono && isTargetWin64())) return; VAStartInstrumentationList.push_back(&I); unpoisonVAListTagForInst(I); } void visitVACopyInst(VACopyInst &I) override { - if (F.getCallingConv() == CallingConv::Win64) + if (F.getCallingConv() == CallingConv::Win64 || + (F.getCallingConv() == CallingConv::Mono && isTargetWin64())) return; unpoisonVAListTagForInst(I); } diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index 1ce8f58c1aa14..4924d5a317478 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -1625,11 +1625,17 @@ void PGOUseFunc::setBranchWeights() { continue; // We have a non-zero Branch BB. - unsigned Size = BBCountInfo.OutEdges.size(); - SmallVector EdgeCounts(Size, 0); + + // SuccessorCount can be greater than OutEdgesCount, because + // removed edges don't appear in OutEdges. + unsigned OutEdgesCount = BBCountInfo.OutEdges.size(); + unsigned SuccessorCount = BB.getTerminator()->getNumSuccessors(); + assert(OutEdgesCount <= SuccessorCount); + + SmallVector EdgeCounts(SuccessorCount, 0); uint64_t MaxCount = 0; - for (unsigned s = 0; s < Size; s++) { - const PGOUseEdge *E = BBCountInfo.OutEdges[s]; + for (unsigned It = 0; It < OutEdgesCount; It++) { + const PGOUseEdge *E = BBCountInfo.OutEdges[It]; const BasicBlock *SrcBB = E->SrcBB; const BasicBlock *DestBB = E->DestBB; if (DestBB == nullptr) diff --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp index c31173879af1e..37022104d0a9b 100644 --- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp +++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp @@ -1464,7 +1464,7 @@ static bool checkAndReplaceCmp(CmpIntrinsic *I, ConstraintInfo &Info, ToRemove.push_back(I); return true; } - if (checkCondition(ICmpInst::ICMP_EQ, LHS, RHS, I, Info)) { + if (checkCondition(ICmpInst::ICMP_EQ, LHS, RHS, I, Info).value_or(false)) { I->replaceAllUsesWith(ConstantInt::get(I->getType(), 0)); ToRemove.push_back(I); return true; diff --git a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp index c9be8ee00cdc7..6b9566f1ae461 100644 --- a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp +++ b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp @@ -1233,7 +1233,7 @@ bool InferAddressSpacesImpl::rewriteWithNewAddressSpaces( // If V is used as the pointer operand of a compatible memory operation, // sets the pointer operand to NewV. This replacement does not change // the element type, so the resultant load/store is still valid. - CurUser->replaceUsesOfWith(V, NewV); + U.set(NewV); continue; } diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index fe264503dee9e..91ef2b4b7c183 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -113,8 +113,6 @@ STATISTIC(NumFPAssociationsHoisted, "Number of invariant FP expressions " STATISTIC(NumIntAssociationsHoisted, "Number of invariant int expressions " "reassociated and hoisted out of the loop"); -STATISTIC(NumBOAssociationsHoisted, "Number of invariant BinaryOp expressions " - "reassociated and hoisted out of the loop"); /// Memory promotion is enabled by default. static cl::opt @@ -2781,60 +2779,6 @@ static bool hoistMulAddAssociation(Instruction &I, Loop &L, return true; } -/// Reassociate general associative binary expressions of the form -/// -/// 1. "(LV op C1) op C2" ==> "LV op (C1 op C2)" -/// -/// where op is an associative binary op, LV is a loop variant, and C1 and C2 -/// are loop invariants that we want to hoist. -/// -/// TODO: This can be extended to more cases such as -/// 2. "C1 op (C2 op LV)" ==> "(C1 op C2) op LV" -/// 3. "(C1 op LV) op C2" ==> "LV op (C1 op C2)" if op is commutative -/// 4. "C1 op (LV op C2)" ==> "(C1 op C2) op LV" if op is commutative -static bool hoistBOAssociation(Instruction &I, Loop &L, - ICFLoopSafetyInfo &SafetyInfo, - MemorySSAUpdater &MSSAU, AssumptionCache *AC, - DominatorTree *DT) { - BinaryOperator *BO = dyn_cast(&I); - if (!BO || !BO->isAssociative()) - return false; - - Instruction::BinaryOps Opcode = BO->getOpcode(); - BinaryOperator *Op0 = dyn_cast(BO->getOperand(0)); - - // Transform: "(LV op C1) op C2" ==> "LV op (C1 op C2)" - if (Op0 && Op0->getOpcode() == Opcode) { - Value *LV = Op0->getOperand(0); - Value *C1 = Op0->getOperand(1); - Value *C2 = BO->getOperand(1); - - if (L.isLoopInvariant(LV) || !L.isLoopInvariant(C1) || - !L.isLoopInvariant(C2)) - return false; - - auto *Preheader = L.getLoopPreheader(); - assert(Preheader && "Loop is not in simplify form?"); - IRBuilder<> Builder(Preheader->getTerminator()); - Value *Inv = Builder.CreateBinOp(Opcode, C1, C2, "invariant.op"); - - auto *NewBO = - BinaryOperator::Create(Opcode, LV, Inv, BO->getName() + ".reass", BO); - NewBO->copyIRFlags(BO); - BO->replaceAllUsesWith(NewBO); - eraseInstruction(*BO, SafetyInfo, MSSAU); - - // Note: (LV op C1) might not be erased if it has more uses than the one we - // just replaced. - if (Op0->use_empty()) - eraseInstruction(*Op0, SafetyInfo, MSSAU); - - return true; - } - - return false; -} - static bool hoistArithmetics(Instruction &I, Loop &L, ICFLoopSafetyInfo &SafetyInfo, MemorySSAUpdater &MSSAU, AssumptionCache *AC, @@ -2872,12 +2816,6 @@ static bool hoistArithmetics(Instruction &I, Loop &L, return true; } - if (hoistBOAssociation(I, L, SafetyInfo, MSSAU, AC, DT)) { - ++NumHoisted; - ++NumBOAssociationsHoisted; - return true; - } - return false; } diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 11f9f7822a15c..91461d1ed2759 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -946,13 +946,15 @@ static Immediate ExtractImmediate(const SCEV *&S, ScalarEvolution &SE) { // FIXME: AR->getNoWrapFlags(SCEV::FlagNW) SCEV::FlagAnyWrap); return Result; - } else if (EnableVScaleImmediates) - if (const SCEVMulExpr *M = dyn_cast(S)) + } else if (const SCEVMulExpr *M = dyn_cast(S)) { + if (EnableVScaleImmediates && M->getNumOperands() == 2) { if (const SCEVConstant *C = dyn_cast(M->getOperand(0))) if (isa(M->getOperand(1))) { S = SE.getConstant(M->getType(), 0); return Immediate::getScalable(C->getValue()->getSExtValue()); } + } + } return Immediate::getZero(); } diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index 4609376a748f9..0abf6d77496dc 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -918,6 +918,44 @@ bool llvm::hasIterationCountInvariantInParent(Loop *InnerLoop, return true; } +constexpr Intrinsic::ID llvm::getReductionIntrinsicID(RecurKind RK) { + switch (RK) { + default: + llvm_unreachable("Unexpected recurrence kind"); + case RecurKind::Add: + return Intrinsic::vector_reduce_add; + case RecurKind::Mul: + return Intrinsic::vector_reduce_mul; + case RecurKind::And: + return Intrinsic::vector_reduce_and; + case RecurKind::Or: + return Intrinsic::vector_reduce_or; + case RecurKind::Xor: + return Intrinsic::vector_reduce_xor; + case RecurKind::FMulAdd: + case RecurKind::FAdd: + return Intrinsic::vector_reduce_fadd; + case RecurKind::FMul: + return Intrinsic::vector_reduce_fmul; + case RecurKind::SMax: + return Intrinsic::vector_reduce_smax; + case RecurKind::SMin: + return Intrinsic::vector_reduce_smin; + case RecurKind::UMax: + return Intrinsic::vector_reduce_umax; + case RecurKind::UMin: + return Intrinsic::vector_reduce_umin; + case RecurKind::FMax: + return Intrinsic::vector_reduce_fmax; + case RecurKind::FMin: + return Intrinsic::vector_reduce_fmin; + case RecurKind::FMaximum: + return Intrinsic::vector_reduce_fmaximum; + case RecurKind::FMinimum: + return Intrinsic::vector_reduce_fminimum; + } +} + unsigned llvm::getArithmeticReductionInstruction(Intrinsic::ID RdxID) { switch (RdxID) { case Intrinsic::vector_reduce_fadd: @@ -1215,12 +1253,13 @@ Value *llvm::createSimpleTargetReduction(VectorBuilder &VBuilder, Value *Src, RecurKind Kind = Desc.getRecurrenceKind(); assert(!RecurrenceDescriptor::isAnyOfRecurrenceKind(Kind) && "AnyOf reduction is not supported."); + Intrinsic::ID Id = getReductionIntrinsicID(Kind); auto *SrcTy = cast(Src->getType()); Type *SrcEltTy = SrcTy->getElementType(); Value *Iden = Desc.getRecurrenceIdentity(Kind, SrcEltTy, Desc.getFastMathFlags()); Value *Ops[] = {Iden, Src}; - return VBuilder.createSimpleTargetReduction(Kind, SrcTy, Ops); + return VBuilder.createSimpleTargetReduction(Id, SrcTy, Ops); } Value *llvm::createTargetReduction(IRBuilderBase &B, @@ -1260,9 +1299,10 @@ Value *llvm::createOrderedReduction(VectorBuilder &VBuilder, assert(Src->getType()->isVectorTy() && "Expected a vector type"); assert(!Start->getType()->isVectorTy() && "Expected a scalar type"); + Intrinsic::ID Id = getReductionIntrinsicID(RecurKind::FAdd); auto *SrcTy = cast(Src->getType()); Value *Ops[] = {Start, Src}; - return VBuilder.createSimpleTargetReduction(RecurKind::FAdd, SrcTy, Ops); + return VBuilder.createSimpleTargetReduction(Id, SrcTy, Ops); } void llvm::propagateIRFlags(Value *I, ArrayRef VL, Value *OpValue, diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp index 5bda7c50c62c6..0b4a75e0bc52d 100644 --- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp @@ -1928,18 +1928,24 @@ Instruction *WidenIV::widenIVUse(WidenIV::NarrowIVDefUse DU, if (!WideAddRec.first) return nullptr; - // Reuse the IV increment that SCEVExpander created. Recompute flags, unless - // the flags for both increments agree and it is safe to use the ones from - // the original inc. In that case, the new use of the wide increment won't - // be more poisonous. - bool NeedToRecomputeFlags = - !SCEVExpander::canReuseFlagsFromOriginalIVInc(OrigPhi, WidePhi, - DU.NarrowUse, WideInc) || - DU.NarrowUse->hasNoUnsignedWrap() != WideInc->hasNoUnsignedWrap() || - DU.NarrowUse->hasNoSignedWrap() != WideInc->hasNoSignedWrap(); + auto CanUseWideInc = [&]() { + if (!WideInc) + return false; + // Reuse the IV increment that SCEVExpander created. Recompute flags, + // unless the flags for both increments agree and it is safe to use the + // ones from the original inc. In that case, the new use of the wide + // increment won't be more poisonous. + bool NeedToRecomputeFlags = + !SCEVExpander::canReuseFlagsFromOriginalIVInc( + OrigPhi, WidePhi, DU.NarrowUse, WideInc) || + DU.NarrowUse->hasNoUnsignedWrap() != WideInc->hasNoUnsignedWrap() || + DU.NarrowUse->hasNoSignedWrap() != WideInc->hasNoSignedWrap(); + return WideAddRec.first == WideIncExpr && + Rewriter.hoistIVInc(WideInc, DU.NarrowUse, NeedToRecomputeFlags); + }; + Instruction *WideUse = nullptr; - if (WideAddRec.first == WideIncExpr && - Rewriter.hoistIVInc(WideInc, DU.NarrowUse, NeedToRecomputeFlags)) + if (CanUseWideInc()) WideUse = WideInc; else { WideUse = cloneIVUser(DU, WideAddRec.first); diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 6d28b8fabe42e..68363abdb817a 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -206,7 +206,7 @@ static cl::opt VectorizeMemoryCheckThreshold( cl::desc("The maximum allowed number of runtime memory checks")); static cl::opt UseLegacyCostModel( - "vectorize-use-legacy-cost-model", cl::init(false), cl::Hidden, + "vectorize-use-legacy-cost-model", cl::init(true), cl::Hidden, cl::desc("Use the legacy cost model instead of the VPlan-based cost model. " "This option will be removed in the future.")); diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index cca9eeebaa53f..ab2b96cdc42db 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -15211,7 +15211,8 @@ bool BoUpSLP::collectValuesToDemote( if (any_of(E.Scalars, [&](Value *V) { return !all_of(V->users(), [=](User *U) { return getTreeEntry(U) || - (UserIgnoreList && UserIgnoreList->contains(U)) || + (E.Idx == 0 && UserIgnoreList && + UserIgnoreList->contains(U)) || (!isa(U) && U->getType()->isSized() && !U->getType()->isScalableTy() && DL->getTypeSizeInBits(U->getType()) <= BitWidth); @@ -15539,6 +15540,11 @@ void BoUpSLP::computeMinimumValueSizes() { const TreeEntry *UserTE = E.UserTreeIndices.back().UserTE; if (TE == UserTE || !TE) return false; + if (!isa(U) || + !isa(UserTE->getMainOp())) + return true; unsigned UserTESz = DL->getTypeSizeInBits( UserTE->Scalars.front()->getType()); auto It = MinBWs.find(TE); diff --git a/llvm/test/Analysis/CostModel/AArch64/arith-fp-sve.ll b/llvm/test/Analysis/CostModel/AArch64/arith-fp-sve.ll index 18a1c31c03f74..770d3087b0752 100644 --- a/llvm/test/Analysis/CostModel/AArch64/arith-fp-sve.ll +++ b/llvm/test/Analysis/CostModel/AArch64/arith-fp-sve.ll @@ -8,6 +8,7 @@ define void @fadd() { ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fadd undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fadd undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V16F16 = fadd undef, undef +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %V1F32 = fadd undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fadd undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fadd undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fadd undef, undef @@ -19,6 +20,7 @@ define void @fadd() { %V8F16 = fadd undef, undef %V16F16 = fadd undef, undef + %V1F32 = fadd undef, undef %V2F32 = fadd undef, undef %V4F32 = fadd undef, undef %V8F32 = fadd undef, undef @@ -34,6 +36,7 @@ define void @fsub() { ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fsub undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fsub undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V16F16 = fsub undef, undef +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %V1F32 = fsub undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fsub undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fsub undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fsub undef, undef @@ -45,6 +48,7 @@ define void @fsub() { %V8F16 = fsub undef, undef %V16F16 = fsub undef, undef + %V1F32 = fsub undef, undef %V2F32 = fsub undef, undef %V4F32 = fsub undef, undef %V8F32 = fsub undef, undef diff --git a/llvm/test/Analysis/CostModel/AArch64/cttz_elts.ll b/llvm/test/Analysis/CostModel/AArch64/cttz_elts.ll index e1a9ee114d261..98d5bd5bd13f4 100644 --- a/llvm/test/Analysis/CostModel/AArch64/cttz_elts.ll +++ b/llvm/test/Analysis/CostModel/AArch64/cttz_elts.ll @@ -3,6 +3,7 @@ define void @foo_no_vscale_range() { ; CHECK-LABEL: 'foo_no_vscale_range' +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %res.i64.nxv1i1.zip = call i64 @llvm.experimental.cttz.elts.i64.nxv1i1( undef, i1 true) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %res.i64.nxv2i1.zip = call i64 @llvm.experimental.cttz.elts.i64.nxv2i1( undef, i1 true) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %res.i64.nxv4i1.zip = call i64 @llvm.experimental.cttz.elts.i64.nxv4i1( undef, i1 true) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %res.i64.nxv8i1.zip = call i64 @llvm.experimental.cttz.elts.i64.nxv8i1( undef, i1 true) @@ -45,6 +46,7 @@ define void @foo_no_vscale_range() { ; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %res.i32.v32i1.nzip = call i32 @llvm.experimental.cttz.elts.i32.v32i1(<32 x i1> undef, i1 false) ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; + %res.i64.nxv1i1.zip = call i64 @llvm.experimental.cttz.elts.i64.nxv1i1( undef, i1 true) %res.i64.nxv2i1.zip = call i64 @llvm.experimental.cttz.elts.i64.nxv2i1( undef, i1 true) %res.i64.nxv4i1.zip = call i64 @llvm.experimental.cttz.elts.i64.nxv4i1( undef, i1 true) %res.i64.nxv8i1.zip = call i64 @llvm.experimental.cttz.elts.i64.nxv8i1( undef, i1 true) diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-arith.ll b/llvm/test/Analysis/CostModel/AArch64/sve-arith.ll index f4dfea4cce349..46450e68f40e2 100644 --- a/llvm/test/Analysis/CostModel/AArch64/sve-arith.ll +++ b/llvm/test/Analysis/CostModel/AArch64/sve-arith.ll @@ -43,6 +43,7 @@ define void @scalable_mul() #0 { ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %mul_nxv8i16 = mul undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %mul_nxv4i32 = mul undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %mul_nxv2i64 = mul undef, undef +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %mul_nxv1i64 = mul undef, undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; entry: @@ -50,6 +51,26 @@ entry: %mul_nxv8i16 = mul undef, undef %mul_nxv4i32 = mul undef, undef %mul_nxv2i64 = mul undef, undef + %mul_nxv1i64 = mul undef, undef + + ret void +} + +define void @scalable_add() #0 { +; CHECK-LABEL: 'scalable_add' +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %add_nxv16i8 = add undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %add_nxv8i16 = add undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %add_nxv4i32 = add undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %add_nxv2i64 = add undef, undef +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %add_nxv1i64 = add undef, undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void +; +entry: + %add_nxv16i8 = add undef, undef + %add_nxv8i16 = add undef, undef + %add_nxv4i32 = add undef, undef + %add_nxv2i64 = add undef, undef + %add_nxv1i64 = add undef, undef ret void } diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-intrinsics.ll b/llvm/test/Analysis/CostModel/AArch64/sve-intrinsics.ll index 1993023c91e26..a3e260d211c43 100644 --- a/llvm/test/Analysis/CostModel/AArch64/sve-intrinsics.ll +++ b/llvm/test/Analysis/CostModel/AArch64/sve-intrinsics.ll @@ -116,82 +116,118 @@ declare <8 x float> @llvm.vector.extract.v8f32.nxv4f32(, i64 define void @reductions( %v0, %v1, %v2, %v3) { ; CHECK-LABEL: 'reductions' +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %add_nxv1i32 = call i32 @llvm.vector.reduce.add.nxv1i32( undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %add_nxv4i32 = call i32 @llvm.vector.reduce.add.nxv4i32( %v0) ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %add_nxv4i64 = call i64 @llvm.vector.reduce.add.nxv4i64( %v1) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %mul_nxv1i32 = call i32 @llvm.vector.reduce.mul.nxv1i32( undef) ; CHECK-NEXT: Cost Model: Invalid cost for instruction: %mul_nxv4i32 = call i32 @llvm.vector.reduce.mul.nxv4i32( %v0) ; CHECK-NEXT: Cost Model: Invalid cost for instruction: %mul_nxv4i64 = call i64 @llvm.vector.reduce.mul.nxv4i64( %v1) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %and_nxv1i32 = call i32 @llvm.vector.reduce.and.nxv1i32( undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %and_nxv4i32 = call i32 @llvm.vector.reduce.and.nxv4i32( %v0) ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %and_nxv4i64 = call i64 @llvm.vector.reduce.and.nxv4i64( %v1) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %or_nxv1i32 = call i32 @llvm.vector.reduce.or.nxv1i32( undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %or_nxv4i32 = call i32 @llvm.vector.reduce.or.nxv4i32( %v0) ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %or_nxv4i64 = call i64 @llvm.vector.reduce.or.nxv4i64( %v1) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %xor_nxv1i32 = call i32 @llvm.vector.reduce.xor.nxv1i32( undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %xor_nxv4i32 = call i32 @llvm.vector.reduce.xor.nxv4i32( %v0) ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %xor_nxv4i64 = call i64 @llvm.vector.reduce.xor.nxv4i64( %v1) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %umin_nxv1i64 = call i64 @llvm.vector.reduce.umin.nxv1i64( undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %umin_nxv4i32 = call i32 @llvm.vector.reduce.umin.nxv4i32( %v0) ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %umin_nxv4i64 = call i64 @llvm.vector.reduce.umin.nxv4i64( %v1) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %smin_nxv1i64 = call i64 @llvm.vector.reduce.smin.nxv1i64( undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %smin_nxv4i32 = call i32 @llvm.vector.reduce.smin.nxv4i32( %v0) ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %smin_nxv4i64 = call i64 @llvm.vector.reduce.smin.nxv4i64( %v1) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %umax_nxv1i64 = call i64 @llvm.vector.reduce.umax.nxv1i64( undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %umax_nxv4i32 = call i32 @llvm.vector.reduce.umax.nxv4i32( %v0) ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %umax_nxv4i64 = call i64 @llvm.vector.reduce.umax.nxv4i64( %v1) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %smax_nxv1i64 = call i64 @llvm.vector.reduce.smax.nxv1i64( undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %smax_nxv4i32 = call i32 @llvm.vector.reduce.smax.nxv4i32( %v0) ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %smax_nxv4i64 = call i64 @llvm.vector.reduce.smax.nxv4i64( %v1) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %fadd_nxv1f32 = call fast float @llvm.vector.reduce.fadd.nxv1f32(float 0.000000e+00, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %fadd_nxv4f32 = call fast float @llvm.vector.reduce.fadd.nxv4f32(float 0.000000e+00, %v2) ; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %fadd_nxv4f64 = call fast double @llvm.vector.reduce.fadd.nxv4f64(double 0.000000e+00, %v3) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %fmin_nxv1f32 = call fast float @llvm.vector.reduce.fmin.nxv1f32( undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %fmin_nxv4f32 = call fast float @llvm.vector.reduce.fmin.nxv4f32( %v2) ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %fmin_nxv4f64 = call fast double @llvm.vector.reduce.fmin.nxv4f64( %v3) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %fmax_nxv1f32 = call fast float @llvm.vector.reduce.fmax.nxv1f32( undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %fmax_nxv4f32 = call fast float @llvm.vector.reduce.fmax.nxv4f32( %v2) ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %fmax_nxv4f64 = call fast double @llvm.vector.reduce.fmax.nxv4f64( %v3) ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; ; TYPE_BASED_ONLY-LABEL: 'reductions' +; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %add_nxv1i32 = call i32 @llvm.vector.reduce.add.nxv1i32( undef) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %add_nxv4i32 = call i32 @llvm.vector.reduce.add.nxv4i32( %v0) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %add_nxv4i64 = call i64 @llvm.vector.reduce.add.nxv4i64( %v1) +; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %mul_nxv1i32 = call i32 @llvm.vector.reduce.mul.nxv1i32( undef) ; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %mul_nxv4i32 = call i32 @llvm.vector.reduce.mul.nxv4i32( %v0) ; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %mul_nxv4i64 = call i64 @llvm.vector.reduce.mul.nxv4i64( %v1) +; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %and_nxv1i32 = call i32 @llvm.vector.reduce.and.nxv1i32( undef) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %and_nxv4i32 = call i32 @llvm.vector.reduce.and.nxv4i32( %v0) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %and_nxv4i64 = call i64 @llvm.vector.reduce.and.nxv4i64( %v1) +; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %or_nxv1i32 = call i32 @llvm.vector.reduce.or.nxv1i32( undef) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %or_nxv4i32 = call i32 @llvm.vector.reduce.or.nxv4i32( %v0) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %or_nxv4i64 = call i64 @llvm.vector.reduce.or.nxv4i64( %v1) +; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %xor_nxv1i32 = call i32 @llvm.vector.reduce.xor.nxv1i32( undef) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %xor_nxv4i32 = call i32 @llvm.vector.reduce.xor.nxv4i32( %v0) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %xor_nxv4i64 = call i64 @llvm.vector.reduce.xor.nxv4i64( %v1) +; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %umin_nxv1i64 = call i64 @llvm.vector.reduce.umin.nxv1i64( undef) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %umin_nxv4i32 = call i32 @llvm.vector.reduce.umin.nxv4i32( %v0) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %umin_nxv4i64 = call i64 @llvm.vector.reduce.umin.nxv4i64( %v1) +; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %smin_nxv1i64 = call i64 @llvm.vector.reduce.smin.nxv1i64( undef) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %smin_nxv4i32 = call i32 @llvm.vector.reduce.smin.nxv4i32( %v0) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %smin_nxv4i64 = call i64 @llvm.vector.reduce.smin.nxv4i64( %v1) +; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %umax_nxv1i64 = call i64 @llvm.vector.reduce.umax.nxv1i64( undef) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %umax_nxv4i32 = call i32 @llvm.vector.reduce.umax.nxv4i32( %v0) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %umax_nxv4i64 = call i64 @llvm.vector.reduce.umax.nxv4i64( %v1) +; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %smax_nxv1i64 = call i64 @llvm.vector.reduce.smax.nxv1i64( undef) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %smax_nxv4i32 = call i32 @llvm.vector.reduce.smax.nxv4i32( %v0) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %smax_nxv4i64 = call i64 @llvm.vector.reduce.smax.nxv4i64( %v1) +; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %fadd_nxv1f32 = call fast float @llvm.vector.reduce.fadd.nxv1f32(float 0.000000e+00, undef) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %fadd_nxv4f32 = call fast float @llvm.vector.reduce.fadd.nxv4f32(float 0.000000e+00, %v2) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %fadd_nxv4f64 = call fast double @llvm.vector.reduce.fadd.nxv4f64(double 0.000000e+00, %v3) +; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %fmin_nxv1f32 = call fast float @llvm.vector.reduce.fmin.nxv1f32( undef) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %fmin_nxv4f32 = call fast float @llvm.vector.reduce.fmin.nxv4f32( %v2) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %fmin_nxv4f64 = call fast double @llvm.vector.reduce.fmin.nxv4f64( %v3) +; TYPE_BASED_ONLY-NEXT: Cost Model: Invalid cost for instruction: %fmax_nxv1f32 = call fast float @llvm.vector.reduce.fmax.nxv1f32( undef) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %fmax_nxv4f32 = call fast float @llvm.vector.reduce.fmax.nxv4f32( %v2) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %fmax_nxv4f64 = call fast double @llvm.vector.reduce.fmax.nxv4f64( %v3) ; TYPE_BASED_ONLY-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; + %add_nxv1i32 = call i32 @llvm.vector.reduce.add.nxv1i32( undef) %add_nxv4i32 = call i32 @llvm.vector.reduce.add.nxv4i32( %v0) %add_nxv4i64 = call i64 @llvm.vector.reduce.add.nxv4i64( %v1) + %mul_nxv1i32 = call i32 @llvm.vector.reduce.mul.nxv1i32( undef) %mul_nxv4i32 = call i32 @llvm.vector.reduce.mul.nxv4i32( %v0) %mul_nxv4i64 = call i64 @llvm.vector.reduce.mul.nxv4i64( %v1) + %and_nxv1i32 = call i32 @llvm.vector.reduce.and.nxv1i32( undef) %and_nxv4i32 = call i32 @llvm.vector.reduce.and.nxv4i32( %v0) %and_nxv4i64 = call i64 @llvm.vector.reduce.and.nxv4i64( %v1) + %or_nxv1i32 = call i32 @llvm.vector.reduce.or.nxv1i32( undef) %or_nxv4i32 = call i32 @llvm.vector.reduce.or.nxv4i32( %v0) %or_nxv4i64 = call i64 @llvm.vector.reduce.or.nxv4i64( %v1) + %xor_nxv1i32 = call i32 @llvm.vector.reduce.xor.nxv1i32( undef) %xor_nxv4i32 = call i32 @llvm.vector.reduce.xor.nxv4i32( %v0) %xor_nxv4i64 = call i64 @llvm.vector.reduce.xor.nxv4i64( %v1) + %umin_nxv1i64 = call i64 @llvm.vector.reduce.umin.nxv1i64( undef) %umin_nxv4i32 = call i32 @llvm.vector.reduce.umin.nxv4i32( %v0) %umin_nxv4i64 = call i64 @llvm.vector.reduce.umin.nxv4i64( %v1) + %smin_nxv1i64 = call i64 @llvm.vector.reduce.smin.nxv1i64( undef) %smin_nxv4i32 = call i32 @llvm.vector.reduce.smin.nxv4i32( %v0) %smin_nxv4i64 = call i64 @llvm.vector.reduce.smin.nxv4i64( %v1) + %umax_nxv1i64 = call i64 @llvm.vector.reduce.umax.nxv1i64( undef) %umax_nxv4i32 = call i32 @llvm.vector.reduce.umax.nxv4i32( %v0) %umax_nxv4i64 = call i64 @llvm.vector.reduce.umax.nxv4i64( %v1) + %smax_nxv1i64 = call i64 @llvm.vector.reduce.smax.nxv1i64( undef) %smax_nxv4i32 = call i32 @llvm.vector.reduce.smax.nxv4i32( %v0) %smax_nxv4i64 = call i64 @llvm.vector.reduce.smax.nxv4i64( %v1) + %fadd_nxv1f32 = call fast float @llvm.vector.reduce.fadd.nxv1f32(float 0.0, undef) %fadd_nxv4f32 = call fast float @llvm.vector.reduce.fadd.nxv4f32(float 0.0, %v2) %fadd_nxv4f64 = call fast double @llvm.vector.reduce.fadd.nxv4f64(double 0.0, %v3) + %fmin_nxv1f32 = call fast float @llvm.vector.reduce.fmin.nxv1f32( undef) %fmin_nxv4f32 = call fast float @llvm.vector.reduce.fmin.nxv4f32( %v2) %fmin_nxv4f64 = call fast double @llvm.vector.reduce.fmin.nxv4f64( %v3) + %fmax_nxv1f32 = call fast float @llvm.vector.reduce.fmax.nxv1f32( undef) %fmax_nxv4f32 = call fast float @llvm.vector.reduce.fmax.nxv4f32( %v2) %fmax_nxv4f64 = call fast double @llvm.vector.reduce.fmax.nxv4f64( %v3) diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-min-max.ll b/llvm/test/Analysis/CostModel/AArch64/sve-min-max.ll index 7a801db1f35fa..777f4a2c4a64e 100644 --- a/llvm/test/Analysis/CostModel/AArch64/sve-min-max.ll +++ b/llvm/test/Analysis/CostModel/AArch64/sve-min-max.ll @@ -14,6 +14,7 @@ define void @umin() { ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V4i16 = call @llvm.umin.nxv4i16( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V8i16 = call @llvm.umin.nxv8i16( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V16i16 = call @llvm.umin.nxv16i16( undef, undef) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %V1i32 = call @llvm.umin.nxv1i32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V2i32 = call @llvm.umin.nxv2i32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V4i32 = call @llvm.umin.nxv4i32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8i32 = call @llvm.umin.nxv8i32( undef, undef) @@ -30,6 +31,7 @@ define void @umin() { %V4i16 = call @llvm.umin.nxv4i16( undef, undef) %V8i16 = call @llvm.umin.nxv8i16( undef, undef) %V16i16 = call @llvm.umin.nxv16i16( undef, undef) + %V1i32 = call @llvm.umin.nxv1i32( undef, undef) %V2i32 = call @llvm.umin.nxv2i32( undef, undef) %V4i32 = call @llvm.umin.nxv4i32( undef, undef) %V8i32 = call @llvm.umin.nxv8i32( undef, undef) @@ -49,6 +51,7 @@ define void @umax() { ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V4i16 = call @llvm.umax.nxv4i16( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V8i16 = call @llvm.umax.nxv8i16( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V16i16 = call @llvm.umax.nxv16i16( undef, undef) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %V1i32 = call @llvm.umax.nxv1i32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V2i32 = call @llvm.umax.nxv2i32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V4i32 = call @llvm.umax.nxv4i32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8i32 = call @llvm.umax.nxv8i32( undef, undef) @@ -65,6 +68,7 @@ define void @umax() { %V4i16 = call @llvm.umax.nxv4i16( undef, undef) %V8i16 = call @llvm.umax.nxv8i16( undef, undef) %V16i16 = call @llvm.umax.nxv16i16( undef, undef) + %V1i32 = call @llvm.umax.nxv1i32( undef, undef) %V2i32 = call @llvm.umax.nxv2i32( undef, undef) %V4i32 = call @llvm.umax.nxv4i32( undef, undef) %V8i32 = call @llvm.umax.nxv8i32( undef, undef) @@ -84,6 +88,7 @@ define void @smin() { ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V4i16 = call @llvm.smin.nxv4i16( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V8i16 = call @llvm.smin.nxv8i16( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V16i16 = call @llvm.smin.nxv16i16( undef, undef) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %V1i32 = call @llvm.smin.nxv1i32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V2i32 = call @llvm.smin.nxv2i32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V4i32 = call @llvm.smin.nxv4i32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8i32 = call @llvm.smin.nxv8i32( undef, undef) @@ -100,6 +105,7 @@ define void @smin() { %V4i16 = call @llvm.smin.nxv4i16( undef, undef) %V8i16 = call @llvm.smin.nxv8i16( undef, undef) %V16i16 = call @llvm.smin.nxv16i16( undef, undef) + %V1i32 = call @llvm.smin.nxv1i32( undef, undef) %V2i32 = call @llvm.smin.nxv2i32( undef, undef) %V4i32 = call @llvm.smin.nxv4i32( undef, undef) %V8i32 = call @llvm.smin.nxv8i32( undef, undef) @@ -119,6 +125,7 @@ define void @smax() { ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V4i16 = call @llvm.smax.nxv4i16( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V8i16 = call @llvm.smax.nxv8i16( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V16i16 = call @llvm.smax.nxv16i16( undef, undef) +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %V1i32 = call @llvm.smax.nxv1i32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V2i32 = call @llvm.smax.nxv2i32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %V4i32 = call @llvm.smax.nxv4i32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V8i32 = call @llvm.smax.nxv8i32( undef, undef) @@ -135,6 +142,7 @@ define void @smax() { %V4i16 = call @llvm.smax.nxv4i16( undef, undef) %V8i16 = call @llvm.smax.nxv8i16( undef, undef) %V16i16 = call @llvm.smax.nxv16i16( undef, undef) + %V1i32 = call @llvm.smax.nxv1i32( undef, undef) %V2i32 = call @llvm.smax.nxv2i32( undef, undef) %V4i32 = call @llvm.smax.nxv4i32( undef, undef) %V8i32 = call @llvm.smax.nxv8i32( undef, undef) @@ -145,6 +153,7 @@ define void @smax() { define void @minnum() { ; CHECK-LABEL: 'minnum' +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %V1f32 = call @llvm.minnum.nxv1f32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2f32 = call @llvm.minnum.nxv2f32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4f32 = call @llvm.minnum.nxv4f32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V8f32 = call @llvm.minnum.nxv8f32( undef, undef) @@ -156,6 +165,7 @@ define void @minnum() { ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V16f16 = call @llvm.minnum.nxv16f16( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; + %V1f32 = call @llvm.minnum.nxv1f32( undef, undef) %V2f32 = call @llvm.minnum.nxv2f32( undef, undef) %V4f32 = call @llvm.minnum.nxv4f32( undef, undef) %V8f32 = call @llvm.minnum.nxv8f32( undef, undef) @@ -170,6 +180,7 @@ define void @minnum() { define void @maxnum() { ; CHECK-LABEL: 'maxnum' +; CHECK-NEXT: Cost Model: Invalid cost for instruction: %V1f32 = call @llvm.maxnum.nxv1f32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V2f32 = call @llvm.maxnum.nxv2f32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %V4f32 = call @llvm.maxnum.nxv4f32( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V8f32 = call @llvm.maxnum.nxv8f32( undef, undef) @@ -181,6 +192,7 @@ define void @maxnum() { ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V16f16 = call @llvm.maxnum.nxv16f16( undef, undef) ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; + %V1f32 = call @llvm.maxnum.nxv1f32( undef, undef) %V2f32 = call @llvm.maxnum.nxv2f32( undef, undef) %V4f32 = call @llvm.maxnum.nxv4f32( undef, undef) %V8f32 = call @llvm.maxnum.nxv8f32( undef, undef) diff --git a/llvm/test/Analysis/LoopAccessAnalysis/load-store-index-loaded-in-loop.ll b/llvm/test/Analysis/LoopAccessAnalysis/load-store-index-loaded-in-loop.ll index 2e61a28039846..6d8e296ec72fa 100644 --- a/llvm/test/Analysis/LoopAccessAnalysis/load-store-index-loaded-in-loop.ll +++ b/llvm/test/Analysis/LoopAccessAnalysis/load-store-index-loaded-in-loop.ll @@ -9,21 +9,19 @@ define void @B_indices_loaded_in_loop_A_stored(ptr %A, ptr noalias %B, i64 %N, i64 %off) { ; CHECK-LABEL: 'B_indices_loaded_in_loop_A_stored' ; CHECK-NEXT: loop: -; CHECK-NEXT: Memory dependences are safe with run-time checks +; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop +; CHECK-NEXT: Unsafe indirect dependence. ; CHECK-NEXT: Dependences: +; CHECK-NEXT: IndirectUnsafe: +; CHECK-NEXT: %l = load i32, ptr %gep.B, align 4 -> +; CHECK-NEXT: store i32 %inc, ptr %gep.B, align 4 +; CHECK-EMPTY: +; CHECK-NEXT: Unknown: +; CHECK-NEXT: %indices = load i8, ptr %gep.A, align 1 -> +; CHECK-NEXT: store i32 %l, ptr %gep.C, align 4 +; CHECK-EMPTY: ; CHECK-NEXT: Run-time memory checks: -; CHECK-NEXT: Check 0: -; CHECK-NEXT: Comparing group ([[GRP1:0x[0-9a-f]+]]): -; CHECK-NEXT: %gep.C = getelementptr inbounds i32, ptr %A, i64 %iv -; CHECK-NEXT: Against group ([[GRP2:0x[0-9a-f]+]]): -; CHECK-NEXT: %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv.off ; CHECK-NEXT: Grouped accesses: -; CHECK-NEXT: Group [[GRP1]]: -; CHECK-NEXT: (Low: %A High: ((4 * %N) + %A)) -; CHECK-NEXT: Member: {%A,+,4}<%loop> -; CHECK-NEXT: Group [[GRP2]]: -; CHECK-NEXT: (Low: (%off + %A) High: (%N + %off + %A)) -; CHECK-NEXT: Member: {(%off + %A),+,1}<%loop> ; CHECK-EMPTY: ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop. ; CHECK-NEXT: SCEV assumptions: @@ -59,9 +57,9 @@ define void @B_indices_loaded_in_loop_A_not_stored(ptr %A, ptr noalias %B, i64 % ; CHECK-LABEL: 'B_indices_loaded_in_loop_A_not_stored' ; CHECK-NEXT: loop: ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop -; CHECK-NEXT: Unknown data dependence. +; CHECK-NEXT: Unsafe indirect dependence. ; CHECK-NEXT: Dependences: -; CHECK-NEXT: Unknown: +; CHECK-NEXT: IndirectUnsafe: ; CHECK-NEXT: %l = load i32, ptr %gep.B, align 4 -> ; CHECK-NEXT: store i32 %inc, ptr %gep.B, align 4 ; CHECK-EMPTY: diff --git a/llvm/test/Analysis/LoopAccessAnalysis/pointer-with-unknown-bounds.ll b/llvm/test/Analysis/LoopAccessAnalysis/pointer-with-unknown-bounds.ll index 546a75cf4efd5..28ee6c6f0a89a 100644 --- a/llvm/test/Analysis/LoopAccessAnalysis/pointer-with-unknown-bounds.ll +++ b/llvm/test/Analysis/LoopAccessAnalysis/pointer-with-unknown-bounds.ll @@ -13,9 +13,9 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" ; CHECK-NEXT: for.body: ; CHECK-NEXT: Report: unsafe dependent memory operations in loop ; CHECK-NOT: Report: cannot identify array bounds -; CHECK-NEXT: Unknown data dependence. +; CHECK-NEXT: Unsafe indirect dependence. ; CHECK-NEXT: Dependences: -; CHECK-NEXT: Unknown: +; CHECK-NEXT: IndirectUnsafe: ; CHECK-NEXT: %loadA = load i16, ptr %arrayidxA, align 2 -> ; CHECK-NEXT: store i16 %mul, ptr %arrayidxA, align 2 diff --git a/llvm/test/Analysis/LoopAccessAnalysis/print-order.ll b/llvm/test/Analysis/LoopAccessAnalysis/print-order.ll index 18e45f469b4a3..8ca30383092c6 100644 --- a/llvm/test/Analysis/LoopAccessAnalysis/print-order.ll +++ b/llvm/test/Analysis/LoopAccessAnalysis/print-order.ll @@ -9,8 +9,9 @@ ; CHECK-LABEL: 'negative_step' ; CHECK: LAA: Found an analyzable loop: loop ; CHECK: LAA: Checking memory dependencies -; CHECK-NEXT: LAA: Src Scev: {(4092 + %A),+,-4}<%loop>Sink Scev: {(4088 + %A),+,-4}<%loop>(Induction step: -1) +; CHECK-NEXT: LAA: Src Scev: {(4092 + %A),+,-4}<%loop>Sink Scev: {(4088 + %A),+,-4}<%loop> ; CHECK-NEXT: LAA: Distance for store i32 %add, ptr %gep.A.plus.1, align 4 to %l = load i32, ptr %gep.A, align 4: -4 +; CHECK-NEXT: LAA: Src induction step: -1 Sink induction step: -1 ; CHECK-NEXT: LAA: Dependence is negative define void @negative_step(ptr nocapture %A) { @@ -41,8 +42,9 @@ exit: ; CHECK-LABEL: 'positive_step' ; CHECK: LAA: Found an analyzable loop: loop ; CHECK: LAA: Checking memory dependencies -; CHECK-NEXT: LAA: Src Scev: {(4 + %A),+,4}<%loop>Sink Scev: {%A,+,4}<%loop>(Induction step: 1) +; CHECK-NEXT: LAA: Src Scev: {(4 + %A),+,4}<%loop>Sink Scev: {%A,+,4}<%loop> ; CHECK-NEXT: LAA: Distance for %l = load i32, ptr %gep.A, align 4 to store i32 %add, ptr %gep.A.minus.1, align 4: -4 +; CHECK-NEXT: LAA: Src induction step: 1 Sink induction step: 1 ; CHECK-NEXT: LAA: Dependence is negative define void @positive_step(ptr nocapture %A) { diff --git a/llvm/test/Analysis/LoopAccessAnalysis/select-dependence.ll b/llvm/test/Analysis/LoopAccessAnalysis/select-dependence.ll index 60fe8b4fcbed4..8bef7583c35c0 100644 --- a/llvm/test/Analysis/LoopAccessAnalysis/select-dependence.ll +++ b/llvm/test/Analysis/LoopAccessAnalysis/select-dependence.ll @@ -5,9 +5,9 @@ define void @test(ptr noalias %x, ptr noalias %y, ptr noalias %z) { ; CHECK-LABEL: 'test' ; CHECK-NEXT: loop: ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop -; CHECK-NEXT: Unknown data dependence. +; CHECK-NEXT: Unsafe indirect dependence. ; CHECK-NEXT: Dependences: -; CHECK-NEXT: Unknown: +; CHECK-NEXT: IndirectUnsafe: ; CHECK-NEXT: %load = load double, ptr %gep.sel, align 8 -> ; CHECK-NEXT: store double %load, ptr %gep.sel2, align 8 ; CHECK-EMPTY: diff --git a/llvm/test/Analysis/LoopAccessAnalysis/symbolic-stride.ll b/llvm/test/Analysis/LoopAccessAnalysis/symbolic-stride.ll index 7c1b11e22aef2..f0aed2421a96e 100644 --- a/llvm/test/Analysis/LoopAccessAnalysis/symbolic-stride.ll +++ b/llvm/test/Analysis/LoopAccessAnalysis/symbolic-stride.ll @@ -276,9 +276,9 @@ define void @single_stride_used_for_trip_count(ptr noalias %A, ptr noalias %B, i ; CHECK-LABEL: 'single_stride_used_for_trip_count' ; CHECK-NEXT: loop: ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop -; CHECK-NEXT: Unknown data dependence. +; CHECK-NEXT: Unsafe indirect dependence. ; CHECK-NEXT: Dependences: -; CHECK-NEXT: Unknown: +; CHECK-NEXT: IndirectUnsafe: ; CHECK-NEXT: %load = load i32, ptr %gep.A, align 4 -> ; CHECK-NEXT: store i32 %add, ptr %gep.A.next, align 4 ; CHECK-EMPTY: diff --git a/llvm/test/CMakeLists.txt b/llvm/test/CMakeLists.txt index 720cbd064ed26..6b7f2b58e603e 100644 --- a/llvm/test/CMakeLists.txt +++ b/llvm/test/CMakeLists.txt @@ -74,7 +74,6 @@ set(LLVM_TEST_DEPENDS llvm-c-test llvm-cat llvm-cfi-verify - llvm-cgdata llvm-config llvm-cov llvm-cvtres diff --git a/llvm/test/CodeGen/AArch64/Atomics/aarch64-atomic-exchange-fence.ll b/llvm/test/CodeGen/AArch64/Atomics/aarch64-atomic-exchange-fence.ll new file mode 100644 index 0000000000000..2adbc709d238d --- /dev/null +++ b/llvm/test/CodeGen/AArch64/Atomics/aarch64-atomic-exchange-fence.ll @@ -0,0 +1,64 @@ +; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64 -mattr=+lse -O0 | FileCheck %s +; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64 -mattr=+lse -O1 | FileCheck %s + +; When their destination register is WZR/ZZR, SWP operations are not regarded as +; a read for the purpose of a DMB.LD in the AArch64 memory model. +; This test ensures that the AArch64DeadRegisterDefinitions pass does not +; replace the desitnation register of SWP instructions with the zero register +; when the read value is unused. + +define dso_local i32 @atomic_exchange_monotonic(ptr %ptr, ptr %ptr2, i32 %value) { +; CHECK-LABEL: atomic_exchange_monotonic: +; CHECK: // %bb.0: +; CHECK-NEXT: swp +; CHECK-NOT: wzr +; CHECK-NEXT: dmb ishld +; CHECK-NEXT: ldr w0, [x1] +; CHECK-NEXT: ret + %r0 = atomicrmw xchg ptr %ptr, i32 %value monotonic + fence acquire + %r1 = load atomic i32, ptr %ptr2 monotonic, align 4 + ret i32 %r1 +} + +define dso_local i32 @atomic_exchange_acquire(ptr %ptr, ptr %ptr2, i32 %value) { +; CHECK-LABEL: atomic_exchange_acquire: +; CHECK: // %bb.0: +; CHECK-NEXT: swpa +; CHECK-NOT: wzr +; CHECK-NEXT: dmb ishld +; CHECK-NEXT: ldr w0, [x1] +; CHECK-NEXT: ret + %r0 = atomicrmw xchg ptr %ptr, i32 %value acquire + fence acquire + %r1 = load atomic i32, ptr %ptr2 monotonic, align 4 + ret i32 %r1 +} + +define dso_local i32 @atomic_exchange_release(ptr %ptr, ptr %ptr2, i32 %value) { +; CHECK-LABEL: atomic_exchange_release: +; CHECK: // %bb.0: +; CHECK-NEXT: swpl +; CHECK-NOT: wzr +; CHECK-NEXT: dmb ishld +; CHECK-NEXT: ldr w0, [x1] +; CHECK-NEXT: ret + %r0 = atomicrmw xchg ptr %ptr, i32 %value release + fence acquire + %r1 = load atomic i32, ptr %ptr2 monotonic, align 4 + ret i32 %r1 +} + +define dso_local i32 @atomic_exchange_acquire_release(ptr %ptr, ptr %ptr2, i32 %value) { +; CHECK-LABEL: atomic_exchange_acquire_release: +; CHECK: // %bb.0: +; CHECK-NEXT: swpal +; CHECK-NOT: wzr +; CHECK-NEXT: dmb ishld +; CHECK-NEXT: ldr w0, [x1] +; CHECK-NEXT: ret + %r0 = atomicrmw xchg ptr %ptr, i32 %value acq_rel + fence acquire + %r1 = load atomic i32, ptr %ptr2 monotonic, align 4 + ret i32 %r1 +} diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/endian_fallback.ll b/llvm/test/CodeGen/AArch64/GlobalISel/endian_fallback.ll new file mode 100644 index 0000000000000..6c27b4dd85f9b --- /dev/null +++ b/llvm/test/CodeGen/AArch64/GlobalISel/endian_fallback.ll @@ -0,0 +1,21 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 +; RUN: llc -mtriple aarch64-unknown-linux-musl -O0 -global-isel-abort=2 < %s 2>&1 | FileCheck %s --check-prefix=CHECK-LE +; RUN: llc -mtriple aarch64_be-unknown-linux-musl -O0 -global-isel-abort=2 < %s 2>&1 | FileCheck %s --check-prefix=CHECK-BE + +; Make sure we fall-back to SDAG for BE targets. + +; CHECK-LE-NOT: warning: Instruction selection used fallback path for foo +; CHECK-BE: warning: Instruction selection used fallback path for foo + +define <4 x i6> @foo(float %0, <4 x i6> %1) { +; CHECK-LE-LABEL: foo: +; CHECK-LE: // %bb.0: +; CHECK-LE-NEXT: fmov d0, d1 +; CHECK-LE-NEXT: ret +; +; CHECK-BE-LABEL: foo: +; CHECK-BE: // %bb.0: +; CHECK-BE-NEXT: fmov d0, d1 +; CHECK-BE-NEXT: ret + ret <4 x i6> %1 +} diff --git a/llvm/test/CodeGen/AArch64/arm64ec-hybrid-patchable.ll b/llvm/test/CodeGen/AArch64/arm64ec-hybrid-patchable.ll index e5387d40b9c64..1ed6a273338ab 100644 --- a/llvm/test/CodeGen/AArch64/arm64ec-hybrid-patchable.ll +++ b/llvm/test/CodeGen/AArch64/arm64ec-hybrid-patchable.ll @@ -238,8 +238,12 @@ define dso_local void @caller() nounwind { ; CHECK-NEXT: .symidx exp ; CHECK-NEXT: .word 0 ; CHECK-NEXT: .section .drectve,"yni" -; CHECK-NEXT: .ascii " /EXPORT:\"#exp$hp_target,EXPORTAS,exp$hp_target\"" +; CHECK-NEXT: .ascii " /EXPORT:exp" +; CHECK-NEXT: .def "EXP+#func"; +; CHECK-NEXT: .scl 2; +; CHECK-NEXT: .type 32; +; CHECK-NEXT: .endef ; CHECK-NEXT: .def func; ; CHECK-NEXT: .scl 2; ; CHECK-NEXT: .type 32; @@ -252,6 +256,10 @@ define dso_local void @caller() nounwind { ; CHECK-NEXT: .type 32; ; CHECK-NEXT: .endef ; CHECK-NEXT: .set "#func", "#func$hybpatch_thunk"{{$}} +; CHECK-NEXT: .def "EXP+#has_varargs"; +; CHECK-NEXT: .scl 2; +; CHECK-NEXT: .type 32; +; CHECK-NEXT: .endef ; CHECK-NEXT: .def has_varargs; ; CHECK-NEXT: .scl 2; ; CHECK-NEXT: .type 32; @@ -264,6 +272,10 @@ define dso_local void @caller() nounwind { ; CHECK-NEXT: .type 32; ; CHECK-NEXT: .endef ; CHECK-NEXT: .set "#has_varargs", "#has_varargs$hybpatch_thunk" +; CHECK-NEXT: .def "EXP+#has_sret"; +; CHECK-NEXT: .scl 2; +; CHECK-NEXT: .type 32; +; CHECK-NEXT: .endef ; CHECK-NEXT: .def has_sret; ; CHECK-NEXT: .scl 2; ; CHECK-NEXT: .type 32; @@ -276,6 +288,10 @@ define dso_local void @caller() nounwind { ; CHECK-NEXT: .type 32; ; CHECK-NEXT: .endef ; CHECK-NEXT: .set "#has_sret", "#has_sret$hybpatch_thunk" +; CHECK-NEXT: .def "EXP+#exp"; +; CHECK-NEXT: .scl 2; +; CHECK-NEXT: .type 32; +; CHECK-NEXT: .endef ; CHECK-NEXT: .def exp; ; CHECK-NEXT: .scl 2; ; CHECK-NEXT: .type 32; @@ -295,18 +311,18 @@ define dso_local void @caller() nounwind { ; SYM: [78](sec 20)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 #exp$hybpatch_thunk ; SYM: [110](sec 0)(fl 0x00)(ty 0)(scl 69) (nx 1) 0x00000000 func ; SYM-NEXT: AUX indx 112 srch 3 -; SYM-NEXT: [112](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 EXP+#func +; SYM-NEXT: [112](sec 0)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 EXP+#func ; SYM: [116](sec 0)(fl 0x00)(ty 0)(scl 69) (nx 1) 0x00000000 #func ; SYM-NEXT: AUX indx 53 srch 3 ; SYM: [122](sec 0)(fl 0x00)(ty 0)(scl 69) (nx 1) 0x00000000 has_varargs ; SYM-NEXT: AUX indx 124 srch 3 -; SYM-NEXT: [124](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 EXP+#has_varargs +; SYM-NEXT: [124](sec 0)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 EXP+#has_varargs ; SYM-NEXT: [125](sec 0)(fl 0x00)(ty 0)(scl 69) (nx 1) 0x00000000 has_sret ; SYM-NEXT: AUX indx 127 srch 3 -; SYM-NEXT: [127](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 EXP+#has_sret +; SYM-NEXT: [127](sec 0)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 EXP+#has_sret ; SYM-NEXT: [128](sec 0)(fl 0x00)(ty 0)(scl 69) (nx 1) 0x00000000 exp ; SYM-NEXT: AUX indx 130 srch 3 -; SYM-NEXT: [130](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 EXP+#exp +; SYM-NEXT: [130](sec 0)(fl 0x00)(ty 20)(scl 2) (nx 0) 0x00000000 EXP+#exp ; SYM-NEXT: [131](sec 0)(fl 0x00)(ty 0)(scl 69) (nx 1) 0x00000000 #has_varargs ; SYM-NEXT: AUX indx 58 srch 3 ; SYM-NEXT: [133](sec 0)(fl 0x00)(ty 0)(scl 69) (nx 1) 0x00000000 #has_sret diff --git a/llvm/test/CodeGen/AArch64/dag-combine-freeze.ll b/llvm/test/CodeGen/AArch64/dag-combine-freeze.ll new file mode 100644 index 0000000000000..4f0c3d0ce1800 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/dag-combine-freeze.ll @@ -0,0 +1,31 @@ +; RUN: llc -mtriple aarch64 -o /dev/null %s + +; This used to fail with: +; Assertion `N1.getOpcode() != ISD::DELETED_NODE && +; "Operand is DELETED_NODE!"' failed. +; Just make sure we do not crash here. +define void @test_fold_freeze_over_select_cc(i15 %a, ptr %p1, ptr %p2) { +entry: + %a2 = add nsw i15 %a, 1 + %sext = sext i15 %a2 to i32 + %ashr = ashr i32 %sext, 31 + %lshr = lshr i32 %ashr, 7 + ; Setup an already frozen input to ctlz. + %freeze = freeze i32 %lshr + %ctlz = call i32 @llvm.ctlz.i32(i32 %freeze, i1 true) + store i32 %ctlz, ptr %p1, align 1 + ; Here is another ctlz, which is used by a frozen select. + ; DAGCombiner::visitFREEZE will to try to fold the freeze over a SELECT_CC, + ; and when dealing with the condition operand the other SELECT_CC operands + ; will be replaced/simplified as well. So the SELECT_CC is mutated while + ; freezing the "maybe poison operands". This needs to be handled by + ; DAGCombiner::visitFREEZE, as it can't store the list of SDValues that + ; should be frozen in a separate data structure that isn't updated when the + ; SELECT_CC is mutated. + %ctlz1 = call i32 @llvm.ctlz.i32(i32 %lshr, i1 true) + %icmp = icmp ne i32 %lshr, 0 + %select = select i1 %icmp, i32 %ctlz1, i32 0 + %freeze1 = freeze i32 %select + store i32 %freeze1, ptr %p2, align 1 + ret void +} diff --git a/llvm/test/CodeGen/AArch64/dwarf-eh-prepare-dbg.ll b/llvm/test/CodeGen/AArch64/dwarf-eh-prepare-dbg.ll new file mode 100644 index 0000000000000..020a10f278ed6 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/dwarf-eh-prepare-dbg.ll @@ -0,0 +1,1175 @@ +; RUN: opt -S -mtriple=aarch64-unknown-linux-gnu -dwarf-eh-prepare < %s | FileCheck %s +; RUN: opt -S -mtriple=aarch64-unknown-linux-gnu -passes=dwarf-eh-prepare < %s | FileCheck %s + +; If _Unwind_Resume is defined in the same module and we have debug +; info, then the inserted _Unwind_Resume calls also need to have a dummy debug +; location to satisfy inlining requirements. + +; CHECK-LABEL: @_ZN9unwinding8unwinder5frame5Frame19evaluate_expression17h2bd8716b79f71675E( +; CHECK: %exn.obj = phi ptr [ [[A:%.*]], %cleanup.i ], [ [[B:%.*]], %bb44 ] +; CHECK: call void @_Unwind_Resume(ptr %exn.obj) #2, !dbg !1039 + +target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" +target triple = "aarch64-unknown-linux-gnu" + +; Function Attrs: uwtable +declare void @"17h74cc711a87d52d83E"() unnamed_addr #0 + +; Function Attrs: uwtable +define void @_ZN9unwinding8unwinder5frame5Frame19evaluate_expression17h2bd8716b79f71675E() unnamed_addr #0 personality ptr @rust_eh_personality !dbg !2 { +start: + invoke void @_ZN4core6result13unwrap_failed17h043998f7f81c2189E() #2 + to label %unreachable.i unwind label %cleanup.i, !dbg !999 + +cleanup.i: ; preds = %start + %i9 = landingpad { ptr, i32 } + cleanup + resume { ptr, i32 } undef, !dbg !999 + +unreachable.i: ; preds = %start + unreachable + +bb43: ; preds = %cleanup.loopexit.split-lp + invoke void @"17h74cc711a87d52d83E"() + to label %bb44 unwind label %cleanup.loopexit.split-lp, !dbg !999 + +cleanup.loopexit.split-lp: ; preds = %bb43 + %lpad.loopexit.split-lp = landingpad { ptr, i32 } + cleanup + br label %bb43 + +bb44: ; preds = %bb43 + resume { ptr, i32 } undef, !dbg !999 +} + +; Function Attrs: noreturn uwtable +define void @_Unwind_Resume(ptr %arg) unnamed_addr #1 !dbg !1039 { +start: + unreachable +} + +declare i32 @rust_eh_personality(...) unnamed_addr + +; Function Attrs: noreturn uwtable +declare void @_ZN4core6result13unwrap_failed17h043998f7f81c2189E() unnamed_addr #1 + +attributes #0 = { uwtable } +attributes #1 = { noreturn uwtable } +attributes #2 = { noreturn } + +!llvm.module.flags = !{!0, !1} + +!0 = !{i32 2, !"Dwarf Version", i32 4} +!1 = !{i32 2, !"Debug Info Version", i32 3} +!2 = distinct !DISubprogram(name: "evaluate_expression", linkageName: "_ZN9unwinding8unwinder5frame5Frame19evaluate_expression17h2bd8716b79f71675E", scope: !4, file: !3, line: 79, type: !302, scopeLine: 79, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !564, templateParams: !46, declaration: !607, retainedNodes: !608) +!3 = !DIFile(filename: "src/unwinder/frame.rs", directory: "/home/dev/ecosystem/unwinding", checksumkind: CSK_MD5, checksum: "8e7ed70cea65000339db1f4ec1025545") +!4 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Frame", scope: !6, file: !5, size: 35520, align: 64, flags: DIFlagPublic, elements: !9, templateParams: !46, identifier: "668e0516028efb27d51536b6c511f9") +!5 = !DIFile(filename: "", directory: "") +!6 = !DINamespace(name: "frame", scope: !7) +!7 = !DINamespace(name: "unwinder", scope: !8) +!8 = !DINamespace(name: "unwinding", scope: null) +!9 = !{!10, !205} +!10 = !DIDerivedType(tag: DW_TAG_member, name: "fde_result", scope: !4, file: !5, baseType: !11, size: 2304, align: 64, flags: DIFlagPrivate) +!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "FDESearchResult", scope: !12, file: !5, size: 2304, align: 64, flags: DIFlagPublic, elements: !13, templateParams: !46, identifier: "83083fb6983108ea9bd5c8494868595d") +!12 = !DINamespace(name: "find_fde", scope: !7) +!13 = !{!14, !171, !194} +!14 = !DIDerivedType(tag: DW_TAG_member, name: "fde", scope: !11, file: !5, baseType: !15, size: 1344, align: 64, offset: 768, flags: DIFlagPublic) +!15 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "FrameDescriptionEntry, usize>", scope: !16, file: !5, size: 1344, align: 64, flags: DIFlagPublic, elements: !19, templateParams: !134, identifier: "5d3a70f21598ef08f33176ed3c9f48e9") +!16 = !DINamespace(name: "cfi", scope: !17) +!17 = !DINamespace(name: "read", scope: !18) +!18 = !DINamespace(name: "gimli", scope: null) +!19 = !{!20, !22, !23, !30, !137, !138, !139, !140, !170} +!20 = !DIDerivedType(tag: DW_TAG_member, name: "offset", scope: !15, file: !5, baseType: !21, size: 64, align: 64, offset: 960, flags: DIFlagPrivate) +!21 = !DIBasicType(name: "usize", size: 64, encoding: DW_ATE_unsigned) +!22 = !DIDerivedType(tag: DW_TAG_member, name: "length", scope: !15, file: !5, baseType: !21, size: 64, align: 64, offset: 1024, flags: DIFlagPrivate) +!23 = !DIDerivedType(tag: DW_TAG_member, name: "format", scope: !15, file: !5, baseType: !24, size: 8, align: 8, offset: 1280, flags: DIFlagPrivate) +!24 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "Format", scope: !25, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagEnumClass, elements: !27) +!25 = !DINamespace(name: "common", scope: !18) +!26 = !DIBasicType(name: "u8", size: 8, encoding: DW_ATE_unsigned) +!27 = !{!28, !29} +!28 = !DIEnumerator(name: "Dwarf64", value: 8, isUnsigned: true) +!29 = !DIEnumerator(name: "Dwarf32", value: 4, isUnsigned: true) +!30 = !DIDerivedType(tag: DW_TAG_member, name: "cie", scope: !15, file: !5, baseType: !31, size: 704, align: 64, offset: 128, flags: DIFlagPrivate) +!31 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "CommonInformationEntry, usize>", scope: !16, file: !5, size: 704, align: 64, flags: DIFlagPublic, elements: !32, templateParams: !134, identifier: "d702b04fb343c0c9e9d3001992e9a1") +!32 = !{!33, !34, !35, !36, !37, !109, !110, !111, !112, !114, !119} +!33 = !DIDerivedType(tag: DW_TAG_member, name: "offset", scope: !31, file: !5, baseType: !21, size: 64, align: 64, offset: 384, flags: DIFlagPrivate) +!34 = !DIDerivedType(tag: DW_TAG_member, name: "length", scope: !31, file: !5, baseType: !21, size: 64, align: 64, offset: 448, flags: DIFlagPrivate) +!35 = !DIDerivedType(tag: DW_TAG_member, name: "format", scope: !31, file: !5, baseType: !24, size: 8, align: 8, offset: 656, flags: DIFlagPrivate) +!36 = !DIDerivedType(tag: DW_TAG_member, name: "version", scope: !31, file: !5, baseType: !26, size: 8, align: 8, offset: 664, flags: DIFlagPrivate) +!37 = !DIDerivedType(tag: DW_TAG_member, name: "augmentation", scope: !31, file: !5, baseType: !38, size: 256, align: 64, flags: DIFlagPrivate) +!38 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Option", scope: !39, file: !5, size: 256, align: 64, flags: DIFlagPublic, elements: !41, templateParams: !46, identifier: "3a0af3bf6a8f5409cf76f6c3324a8471") +!39 = !DINamespace(name: "option", scope: !40) +!40 = !DINamespace(name: "core", scope: null) +!41 = !{!42} +!42 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !38, file: !5, size: 256, align: 64, elements: !43, templateParams: !46, identifier: "38f36f4fe7ce04182001fea3f0ce78b9", discriminator: !108) +!43 = !{!44, !104} +!44 = !DIDerivedType(tag: DW_TAG_member, name: "None", scope: !42, file: !5, baseType: !45, size: 256, align: 64, extraData: i128 3) +!45 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "None", scope: !38, file: !5, size: 256, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !47, identifier: "fc965678566be8f379abea64e9b3abac") +!46 = !{} +!47 = !{!48} +!48 = !DITemplateTypeParameter(name: "T", type: !49) +!49 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Augmentation", scope: !16, file: !5, size: 256, align: 64, flags: DIFlagPublic, elements: !50, templateParams: !46, identifier: "437b83c5d52a974b59a7fdcd9a6e5529") +!50 = !{!51, !69, !101, !102} +!51 = !DIDerivedType(tag: DW_TAG_member, name: "lsda", scope: !49, file: !5, baseType: !52, size: 16, align: 8, offset: 192, flags: DIFlagPrivate) +!52 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Option", scope: !39, file: !5, size: 16, align: 8, flags: DIFlagPublic, elements: !53, templateParams: !46, identifier: "269c974aec4b862f607e3d0f37bf4289") +!53 = !{!54} +!54 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !52, file: !5, size: 16, align: 8, elements: !55, templateParams: !46, identifier: "a41237f2e73a6dfd1e15b8d422b0caf", discriminator: !68) +!55 = !{!56, !64} +!56 = !DIDerivedType(tag: DW_TAG_member, name: "None", scope: !54, file: !5, baseType: !57, size: 16, align: 8, extraData: i128 0) +!57 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "None", scope: !52, file: !5, size: 16, align: 8, flags: DIFlagPublic, elements: !46, templateParams: !58, identifier: "f43d443124b25d2cf6c3daa0ca6dbe8e") +!58 = !{!59} +!59 = !DITemplateTypeParameter(name: "T", type: !60) +!60 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DwEhPe", scope: !61, file: !5, size: 8, align: 8, flags: DIFlagPublic, elements: !62, templateParams: !46, identifier: "be9eed4e424cae07de87786ea65cc31a") +!61 = !DINamespace(name: "constants", scope: !18) +!62 = !{!63} +!63 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !60, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagPublic) +!64 = !DIDerivedType(tag: DW_TAG_member, name: "Some", scope: !54, file: !5, baseType: !65, size: 16, align: 8, extraData: i128 1) +!65 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Some", scope: !52, file: !5, size: 16, align: 8, flags: DIFlagPublic, elements: !66, templateParams: !58, identifier: "2c48764c698ea6f9c8867fbde87bbb17") +!66 = !{!67} +!67 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !65, file: !5, baseType: !60, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!68 = !DIDerivedType(tag: DW_TAG_member, scope: !52, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagArtificial) +!69 = !DIDerivedType(tag: DW_TAG_member, name: "personality", scope: !49, file: !5, baseType: !70, size: 192, align: 64, flags: DIFlagPrivate) +!70 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Option<(gimli::constants::DwEhPe, gimli::read::cfi::Pointer)>", scope: !39, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !71, templateParams: !46, identifier: "1fdf28ed684e117d758984993d4c393") +!71 = !{!72} +!72 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !70, file: !5, size: 192, align: 64, elements: !73, templateParams: !46, identifier: "186ecead5120d6ea5f8043eb398d7171", discriminator: !100) +!73 = !{!74, !96} +!74 = !DIDerivedType(tag: DW_TAG_member, name: "None", scope: !72, file: !5, baseType: !75, size: 192, align: 64, extraData: i128 2) +!75 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "None", scope: !70, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !76, identifier: "8ffc865f6e828740f09ae9b5f0639b8b") +!76 = !{!77} +!77 = !DITemplateTypeParameter(name: "T", type: !78) +!78 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "(gimli::constants::DwEhPe, gimli::read::cfi::Pointer)", file: !5, size: 192, align: 64, elements: !79, templateParams: !46, identifier: "1135188aa1561172ec3fe388e59e5ad3") +!79 = !{!80, !81} +!80 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !78, file: !5, baseType: !60, size: 8, align: 8) +!81 = !DIDerivedType(tag: DW_TAG_member, name: "__1", scope: !78, file: !5, baseType: !82, size: 128, align: 64, offset: 64) +!82 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Pointer", scope: !16, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !83, templateParams: !46, identifier: "54ccac1071baa52ac351c194c6a75888") +!83 = !{!84} +!84 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !82, file: !5, size: 128, align: 64, elements: !85, templateParams: !46, identifier: "28884e6a838202696aebd009c8be1e5d", discriminator: !95) +!85 = !{!86, !91} +!86 = !DIDerivedType(tag: DW_TAG_member, name: "Direct", scope: !84, file: !5, baseType: !87, size: 128, align: 64, extraData: i128 0) +!87 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Direct", scope: !82, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !88, templateParams: !46, identifier: "d33e0cdef11588372b91f9bf78c76dea") +!88 = !{!89} +!89 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !87, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!90 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned) +!91 = !DIDerivedType(tag: DW_TAG_member, name: "Indirect", scope: !84, file: !5, baseType: !92, size: 128, align: 64, extraData: i128 1) +!92 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Indirect", scope: !82, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !93, templateParams: !46, identifier: "878c7c7b43c77510f5719ec0e083c0df") +!93 = !{!94} +!94 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !92, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!95 = !DIDerivedType(tag: DW_TAG_member, scope: !82, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagArtificial) +!96 = !DIDerivedType(tag: DW_TAG_member, name: "Some", scope: !72, file: !5, baseType: !97, size: 192, align: 64) +!97 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Some", scope: !70, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !98, templateParams: !76, identifier: "dbb5400f4ed59423d6d6c8d7daf9d6e2") +!98 = !{!99} +!99 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !97, file: !5, baseType: !78, size: 192, align: 64, flags: DIFlagPublic) +!100 = !DIDerivedType(tag: DW_TAG_member, scope: !70, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagArtificial) +!101 = !DIDerivedType(tag: DW_TAG_member, name: "fde_address_encoding", scope: !49, file: !5, baseType: !52, size: 16, align: 8, offset: 208, flags: DIFlagPrivate) +!102 = !DIDerivedType(tag: DW_TAG_member, name: "is_signal_trampoline", scope: !49, file: !5, baseType: !103, size: 8, align: 8, offset: 224, flags: DIFlagPrivate) +!103 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean) +!104 = !DIDerivedType(tag: DW_TAG_member, name: "Some", scope: !42, file: !5, baseType: !105, size: 256, align: 64) +!105 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Some", scope: !38, file: !5, size: 256, align: 64, flags: DIFlagPublic, elements: !106, templateParams: !47, identifier: "7e0027ca0949f7cbda755de183ba6ac7") +!106 = !{!107} +!107 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !105, file: !5, baseType: !49, size: 256, align: 64, flags: DIFlagPublic) +!108 = !DIDerivedType(tag: DW_TAG_member, scope: !38, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagArtificial) +!109 = !DIDerivedType(tag: DW_TAG_member, name: "address_size", scope: !31, file: !5, baseType: !26, size: 8, align: 8, offset: 672, flags: DIFlagPrivate) +!110 = !DIDerivedType(tag: DW_TAG_member, name: "segment_size", scope: !31, file: !5, baseType: !26, size: 8, align: 8, offset: 680, flags: DIFlagPrivate) +!111 = !DIDerivedType(tag: DW_TAG_member, name: "code_alignment_factor", scope: !31, file: !5, baseType: !90, size: 64, align: 64, offset: 512, flags: DIFlagPrivate) +!112 = !DIDerivedType(tag: DW_TAG_member, name: "data_alignment_factor", scope: !31, file: !5, baseType: !113, size: 64, align: 64, offset: 576, flags: DIFlagPrivate) +!113 = !DIBasicType(name: "i64", size: 64, encoding: DW_ATE_signed) +!114 = !DIDerivedType(tag: DW_TAG_member, name: "return_address_register", scope: !31, file: !5, baseType: !115, size: 16, align: 16, offset: 640, flags: DIFlagPrivate) +!115 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Register", scope: !25, file: !5, size: 16, align: 16, flags: DIFlagPublic, elements: !116, templateParams: !46, identifier: "ab7721750f04c98f7840c9b9e52b656e") +!116 = !{!117} +!117 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !115, file: !5, baseType: !118, size: 16, align: 16, flags: DIFlagPublic) +!118 = !DIBasicType(name: "u16", size: 16, encoding: DW_ATE_unsigned) +!119 = !DIDerivedType(tag: DW_TAG_member, name: "initial_instructions", scope: !31, file: !5, baseType: !120, size: 128, align: 64, offset: 256, flags: DIFlagPrivate) +!120 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "EndianSlice", scope: !121, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !122, templateParams: !132, identifier: "da07131e2106746f95d2ea314dd1a7d6") +!121 = !DINamespace(name: "endian_slice", scope: !17) +!122 = !{!123, !129} +!123 = !DIDerivedType(tag: DW_TAG_member, name: "slice", scope: !120, file: !5, baseType: !124, size: 128, align: 64, flags: DIFlagPrivate) +!124 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "&[u8]", file: !5, size: 128, align: 64, elements: !125, templateParams: !46, identifier: "31681e0c10b314f1f33e38b2779acbb4") +!125 = !{!126, !128} +!126 = !DIDerivedType(tag: DW_TAG_member, name: "data_ptr", scope: !124, file: !5, baseType: !127, size: 64, align: 64) +!127 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !26, size: 64, align: 64, dwarfAddressSpace: 0) +!128 = !DIDerivedType(tag: DW_TAG_member, name: "length", scope: !124, file: !5, baseType: !21, size: 64, align: 64, offset: 64) +!129 = !DIDerivedType(tag: DW_TAG_member, name: "endian", scope: !120, file: !5, baseType: !130, align: 8, offset: 128, flags: DIFlagPrivate) +!130 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "LittleEndian", scope: !131, file: !5, align: 8, flags: DIFlagPublic, elements: !46, identifier: "3d0f5d089fd1d1e4e850cd8b54585231") +!131 = !DINamespace(name: "endianity", scope: !18) +!132 = !{!133} +!133 = !DITemplateTypeParameter(name: "Endian", type: !130) +!134 = !{!135, !136} +!135 = !DITemplateTypeParameter(name: "R", type: !120) +!136 = !DITemplateTypeParameter(name: "Offset", type: !21) +!137 = !DIDerivedType(tag: DW_TAG_member, name: "initial_segment", scope: !15, file: !5, baseType: !90, size: 64, align: 64, offset: 1088, flags: DIFlagPrivate) +!138 = !DIDerivedType(tag: DW_TAG_member, name: "initial_address", scope: !15, file: !5, baseType: !90, size: 64, align: 64, offset: 1152, flags: DIFlagPrivate) +!139 = !DIDerivedType(tag: DW_TAG_member, name: "address_range", scope: !15, file: !5, baseType: !90, size: 64, align: 64, offset: 1216, flags: DIFlagPrivate) +!140 = !DIDerivedType(tag: DW_TAG_member, name: "augmentation", scope: !15, file: !5, baseType: !141, size: 128, align: 64, flags: DIFlagPrivate) +!141 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Option", scope: !39, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !142, templateParams: !46, identifier: "6c86ed6ec859a01352ba34a0d8b67b42") +!142 = !{!143} +!143 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !141, file: !5, size: 128, align: 64, elements: !144, templateParams: !46, identifier: "fba0139e17508a99930ee3f15479fed", discriminator: !169) +!144 = !{!145, !165} +!145 = !DIDerivedType(tag: DW_TAG_member, name: "None", scope: !143, file: !5, baseType: !146, size: 128, align: 64, extraData: i128 3) +!146 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "None", scope: !141, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !147, identifier: "80c4c2d1f17a14408b80f1b79766a748") +!147 = !{!148} +!148 = !DITemplateTypeParameter(name: "T", type: !149) +!149 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "AugmentationData", scope: !16, file: !5, size: 128, align: 64, flags: DIFlagPrivate, elements: !150, templateParams: !46, identifier: "3de3a0bd67f5300b194fe75d6a32ba34") +!150 = !{!151} +!151 = !DIDerivedType(tag: DW_TAG_member, name: "lsda", scope: !149, file: !5, baseType: !152, size: 128, align: 64, flags: DIFlagPrivate) +!152 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Option", scope: !39, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !153, templateParams: !46, identifier: "63ae53efcc3b644d5af5be76d59f1b22") +!153 = !{!154} +!154 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !152, file: !5, size: 128, align: 64, elements: !155, templateParams: !46, identifier: "7cc3843db76c59d9856a0146da2deda", discriminator: !164) +!155 = !{!156, !160} +!156 = !DIDerivedType(tag: DW_TAG_member, name: "None", scope: !154, file: !5, baseType: !157, size: 128, align: 64, extraData: i128 2) +!157 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "None", scope: !152, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !158, identifier: "3f7569d9bddac98414af4ae68a670d47") +!158 = !{!159} +!159 = !DITemplateTypeParameter(name: "T", type: !82) +!160 = !DIDerivedType(tag: DW_TAG_member, name: "Some", scope: !154, file: !5, baseType: !161, size: 128, align: 64) +!161 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Some", scope: !152, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !162, templateParams: !158, identifier: "a59a0ac8e43839cb28a35341b044ba6") +!162 = !{!163} +!163 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !161, file: !5, baseType: !82, size: 128, align: 64, flags: DIFlagPublic) +!164 = !DIDerivedType(tag: DW_TAG_member, scope: !152, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagArtificial) +!165 = !DIDerivedType(tag: DW_TAG_member, name: "Some", scope: !143, file: !5, baseType: !166, size: 128, align: 64) +!166 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Some", scope: !141, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !167, templateParams: !147, identifier: "310743464abe902a5334b2cd55207cfe") +!167 = !{!168} +!168 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !166, file: !5, baseType: !149, size: 128, align: 64, flags: DIFlagPublic) +!169 = !DIDerivedType(tag: DW_TAG_member, scope: !141, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagArtificial) +!170 = !DIDerivedType(tag: DW_TAG_member, name: "instructions", scope: !15, file: !5, baseType: !120, size: 128, align: 64, offset: 832, flags: DIFlagPrivate) +!171 = !DIDerivedType(tag: DW_TAG_member, name: "bases", scope: !11, file: !5, baseType: !172, size: 768, align: 64, flags: DIFlagPublic) +!172 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "BaseAddresses", scope: !16, file: !5, size: 768, align: 64, flags: DIFlagPublic, elements: !173, templateParams: !46, identifier: "4f73e7ef799b29fbae067e0be323dcfe") +!173 = !{!174, !193} +!174 = !DIDerivedType(tag: DW_TAG_member, name: "eh_frame_hdr", scope: !172, file: !5, baseType: !175, size: 384, align: 64, flags: DIFlagPublic) +!175 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "SectionBaseAddresses", scope: !16, file: !5, size: 384, align: 64, flags: DIFlagPublic, elements: !176, templateParams: !46, identifier: "78885c23ca9bb0ec15b9d93531201334") +!176 = !{!177, !191, !192} +!177 = !DIDerivedType(tag: DW_TAG_member, name: "section", scope: !175, file: !5, baseType: !178, size: 128, align: 64, flags: DIFlagPublic) +!178 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Option", scope: !39, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !179, templateParams: !46, identifier: "a764e4be4144b599a440b2d3c234bd8f") +!179 = !{!180} +!180 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !178, file: !5, size: 128, align: 64, elements: !181, templateParams: !46, identifier: "5f71a65a6e7dd57c14e50416050c3a90", discriminator: !190) +!181 = !{!182, !186} +!182 = !DIDerivedType(tag: DW_TAG_member, name: "None", scope: !180, file: !5, baseType: !183, size: 128, align: 64, extraData: i128 0) +!183 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "None", scope: !178, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !184, identifier: "fc451b096a948ef431e3a4971f318c0") +!184 = !{!185} +!185 = !DITemplateTypeParameter(name: "T", type: !90) +!186 = !DIDerivedType(tag: DW_TAG_member, name: "Some", scope: !180, file: !5, baseType: !187, size: 128, align: 64, extraData: i128 1) +!187 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Some", scope: !178, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !188, templateParams: !184, identifier: "321068e05ede571e678dd7e02b883f79") +!188 = !{!189} +!189 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !187, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!190 = !DIDerivedType(tag: DW_TAG_member, scope: !178, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagArtificial) +!191 = !DIDerivedType(tag: DW_TAG_member, name: "text", scope: !175, file: !5, baseType: !178, size: 128, align: 64, offset: 128, flags: DIFlagPublic) +!192 = !DIDerivedType(tag: DW_TAG_member, name: "data", scope: !175, file: !5, baseType: !178, size: 128, align: 64, offset: 256, flags: DIFlagPublic) +!193 = !DIDerivedType(tag: DW_TAG_member, name: "eh_frame", scope: !172, file: !5, baseType: !175, size: 384, align: 64, offset: 384, flags: DIFlagPublic) +!194 = !DIDerivedType(tag: DW_TAG_member, name: "eh_frame", scope: !11, file: !5, baseType: !195, size: 192, align: 64, offset: 2112, flags: DIFlagPublic) +!195 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "EhFrame>", scope: !16, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !196, templateParams: !204, identifier: "53e7dc3de0299504e773ad37859e191b") +!196 = !{!197, !198, !199} +!197 = !DIDerivedType(tag: DW_TAG_member, name: "section", scope: !195, file: !5, baseType: !120, size: 128, align: 64, flags: DIFlagPrivate) +!198 = !DIDerivedType(tag: DW_TAG_member, name: "address_size", scope: !195, file: !5, baseType: !26, size: 8, align: 8, offset: 128, flags: DIFlagPrivate) +!199 = !DIDerivedType(tag: DW_TAG_member, name: "vendor", scope: !195, file: !5, baseType: !200, size: 8, align: 8, offset: 136, flags: DIFlagPrivate) +!200 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "Vendor", scope: !25, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagEnumClass, elements: !201) +!201 = !{!202, !203} +!202 = !DIEnumerator(name: "Default", value: 0, isUnsigned: true) +!203 = !DIEnumerator(name: "AArch64", value: 1, isUnsigned: true) +!204 = !{!135} +!205 = !DIDerivedType(tag: DW_TAG_member, name: "row", scope: !4, file: !5, baseType: !206, size: 33216, align: 64, offset: 2304, flags: DIFlagPrivate) +!206 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnwindTableRow", scope: !16, file: !5, size: 33216, align: 64, flags: DIFlagPublic, elements: !207, templateParams: !299, identifier: "82cd368dc604f667d8116583e5f9088f") +!207 = !{!208, !209, !210, !211, !232} +!208 = !DIDerivedType(tag: DW_TAG_member, name: "start_address", scope: !206, file: !5, baseType: !90, size: 64, align: 64, offset: 192, flags: DIFlagPrivate) +!209 = !DIDerivedType(tag: DW_TAG_member, name: "end_address", scope: !206, file: !5, baseType: !90, size: 64, align: 64, offset: 256, flags: DIFlagPrivate) +!210 = !DIDerivedType(tag: DW_TAG_member, name: "saved_args_size", scope: !206, file: !5, baseType: !90, size: 64, align: 64, offset: 320, flags: DIFlagPrivate) +!211 = !DIDerivedType(tag: DW_TAG_member, name: "cfa", scope: !206, file: !5, baseType: !212, size: 192, align: 64, flags: DIFlagPrivate) +!212 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "CfaRule", scope: !16, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !213, templateParams: !46, identifier: "ade6ef3f7e303426a7d52d422a1beefc") +!213 = !{!214} +!214 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !212, file: !5, size: 192, align: 64, elements: !215, templateParams: !46, identifier: "122b00cae98c57f43a7358b8913c043", discriminator: !231) +!215 = !{!216, !223} +!216 = !DIDerivedType(tag: DW_TAG_member, name: "RegisterAndOffset", scope: !214, file: !5, baseType: !217, size: 192, align: 64, extraData: i128 0) +!217 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RegisterAndOffset", scope: !212, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !218, templateParams: !221, identifier: "119bb0cef257ae2dfac36839c7598241") +!218 = !{!219, !220} +!219 = !DIDerivedType(tag: DW_TAG_member, name: "register", scope: !217, file: !5, baseType: !115, size: 16, align: 16, offset: 16, flags: DIFlagPublic) +!220 = !DIDerivedType(tag: DW_TAG_member, name: "offset", scope: !217, file: !5, baseType: !113, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!221 = !{!222} +!222 = !DITemplateTypeParameter(name: "T", type: !21) +!223 = !DIDerivedType(tag: DW_TAG_member, name: "Expression", scope: !214, file: !5, baseType: !224, size: 192, align: 64, extraData: i128 1) +!224 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Expression", scope: !212, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !225, templateParams: !221, identifier: "aaead2b15d3fe770a8c30bba7fd8ad61") +!225 = !{!226} +!226 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !224, file: !5, baseType: !227, size: 128, align: 64, offset: 64, flags: DIFlagPublic) +!227 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnwindExpression", scope: !16, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !228, templateParams: !221, identifier: "83534a13fed1c49912ea150ec14a104b") +!228 = !{!229, !230} +!229 = !DIDerivedType(tag: DW_TAG_member, name: "offset", scope: !227, file: !5, baseType: !21, size: 64, align: 64, flags: DIFlagPublic) +!230 = !DIDerivedType(tag: DW_TAG_member, name: "length", scope: !227, file: !5, baseType: !21, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!231 = !DIDerivedType(tag: DW_TAG_member, scope: !212, file: !5, baseType: !118, size: 16, align: 16, flags: DIFlagArtificial) +!232 = !DIDerivedType(tag: DW_TAG_member, name: "registers", scope: !206, file: !5, baseType: !233, size: 32832, align: 64, offset: 384, flags: DIFlagPrivate) +!233 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RegisterRuleMap", scope: !16, file: !5, size: 32832, align: 64, flags: DIFlagPrivate, elements: !234, templateParams: !299, identifier: "cc473d27e5413589c350ce3df23f43da") +!234 = !{!235} +!235 = !DIDerivedType(tag: DW_TAG_member, name: "rules", scope: !233, file: !5, baseType: !236, size: 32832, align: 64, flags: DIFlagPrivate) +!236 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ArrayVec<[(gimli::common::Register, gimli::read::cfi::RegisterRule); 128]>", scope: !237, file: !5, size: 32832, align: 64, flags: DIFlagProtected, elements: !238, templateParams: !296, identifier: "d22acd2dadf9e1b9a77b71369aacf142") +!237 = !DINamespace(name: "util", scope: !17) +!238 = !{!239, !295} +!239 = !DIDerivedType(tag: DW_TAG_member, name: "storage", scope: !236, file: !5, baseType: !240, size: 32768, align: 64, flags: DIFlagPrivate) +!240 = !DICompositeType(tag: DW_TAG_array_type, baseType: !241, size: 32768, align: 64, elements: !293) +!241 = distinct !DICompositeType(tag: DW_TAG_union_type, name: "MaybeUninit<(gimli::common::Register, gimli::read::cfi::RegisterRule)>", scope: !242, file: !5, size: 256, align: 64, elements: !244, templateParams: !291, identifier: "5969f24240e56f6ba292746e32127a72") +!242 = !DINamespace(name: "maybe_uninit", scope: !243) +!243 = !DINamespace(name: "mem", scope: !40) +!244 = !{!245, !247} +!245 = !DIDerivedType(tag: DW_TAG_member, name: "uninit", scope: !241, file: !5, baseType: !246, align: 8) +!246 = !DIBasicType(name: "()", encoding: DW_ATE_unsigned) +!247 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !241, file: !5, baseType: !248, size: 256, align: 64) +!248 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ManuallyDrop<(gimli::common::Register, gimli::read::cfi::RegisterRule)>", scope: !249, file: !5, size: 256, align: 64, flags: DIFlagPublic, elements: !250, templateParams: !291, identifier: "5694f7bb71f656adeda6ad1c7765e67e") +!249 = !DINamespace(name: "manually_drop", scope: !243) +!250 = !{!251} +!251 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !248, file: !5, baseType: !252, size: 256, align: 64, flags: DIFlagPrivate) +!252 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "(gimli::common::Register, gimli::read::cfi::RegisterRule)", file: !5, size: 256, align: 64, elements: !253, templateParams: !46, identifier: "d5b89cd0eff48be0d57ac79c0fc2d497") +!253 = !{!254, !255} +!254 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !252, file: !5, baseType: !115, size: 16, align: 16) +!255 = !DIDerivedType(tag: DW_TAG_member, name: "__1", scope: !252, file: !5, baseType: !256, size: 192, align: 64, offset: 64) +!256 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RegisterRule", scope: !16, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !257, templateParams: !46, identifier: "279b181cb161e87c468503bd8374c58f") +!257 = !{!258} +!258 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !256, file: !5, size: 192, align: 64, elements: !259, templateParams: !46, identifier: "6368babf0c076b47c26cd741e43d73b1", discriminator: !290) +!259 = !{!260, !262, !264, !268, !272, !276, !280, !284, !286} +!260 = !DIDerivedType(tag: DW_TAG_member, name: "Undefined", scope: !258, file: !5, baseType: !261, size: 192, align: 64, extraData: i128 0) +!261 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Undefined", scope: !256, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !221, identifier: "b6231c923d5de1d6ea3dc67ae4d2b744") +!262 = !DIDerivedType(tag: DW_TAG_member, name: "SameValue", scope: !258, file: !5, baseType: !263, size: 192, align: 64, extraData: i128 1) +!263 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "SameValue", scope: !256, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !221, identifier: "366c56686b859fc982e55b9b99b114b7") +!264 = !DIDerivedType(tag: DW_TAG_member, name: "Offset", scope: !258, file: !5, baseType: !265, size: 192, align: 64, extraData: i128 2) +!265 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Offset", scope: !256, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !266, templateParams: !221, identifier: "cbb6f8da06b5c0ef681c5662cd576261") +!266 = !{!267} +!267 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !265, file: !5, baseType: !113, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!268 = !DIDerivedType(tag: DW_TAG_member, name: "ValOffset", scope: !258, file: !5, baseType: !269, size: 192, align: 64, extraData: i128 3) +!269 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ValOffset", scope: !256, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !270, templateParams: !221, identifier: "9cc23c9ab3b44583f82e31fd655f575d") +!270 = !{!271} +!271 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !269, file: !5, baseType: !113, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!272 = !DIDerivedType(tag: DW_TAG_member, name: "Register", scope: !258, file: !5, baseType: !273, size: 192, align: 64, extraData: i128 4) +!273 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Register", scope: !256, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !274, templateParams: !221, identifier: "801c2836f75f94b250a3dfb037480760") +!274 = !{!275} +!275 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !273, file: !5, baseType: !115, size: 16, align: 16, offset: 16, flags: DIFlagPublic) +!276 = !DIDerivedType(tag: DW_TAG_member, name: "Expression", scope: !258, file: !5, baseType: !277, size: 192, align: 64, extraData: i128 5) +!277 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Expression", scope: !256, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !278, templateParams: !221, identifier: "986350edfa7856f0363c61bb25dba41c") +!278 = !{!279} +!279 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !277, file: !5, baseType: !227, size: 128, align: 64, offset: 64, flags: DIFlagPublic) +!280 = !DIDerivedType(tag: DW_TAG_member, name: "ValExpression", scope: !258, file: !5, baseType: !281, size: 192, align: 64, extraData: i128 6) +!281 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ValExpression", scope: !256, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !282, templateParams: !221, identifier: "3d4759b08ddb382cf045cef4d1c0c0d4") +!282 = !{!283} +!283 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !281, file: !5, baseType: !227, size: 128, align: 64, offset: 64, flags: DIFlagPublic) +!284 = !DIDerivedType(tag: DW_TAG_member, name: "Architectural", scope: !258, file: !5, baseType: !285, size: 192, align: 64, extraData: i128 7) +!285 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Architectural", scope: !256, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !221, identifier: "f12af9617d5705e1d07fb2fcddd9c85b") +!286 = !DIDerivedType(tag: DW_TAG_member, name: "Constant", scope: !258, file: !5, baseType: !287, size: 192, align: 64, extraData: i128 8) +!287 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Constant", scope: !256, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !288, templateParams: !221, identifier: "576df75a63490388e372e15bd69f179d") +!288 = !{!289} +!289 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !287, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!290 = !DIDerivedType(tag: DW_TAG_member, scope: !256, file: !5, baseType: !118, size: 16, align: 16, flags: DIFlagArtificial) +!291 = !{!292} +!292 = !DITemplateTypeParameter(name: "T", type: !252) +!293 = !{!294} +!294 = !DISubrange(count: 128, lowerBound: 0) +!295 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !236, file: !5, baseType: !21, size: 64, align: 64, offset: 32768, flags: DIFlagPrivate) +!296 = !{!297} +!297 = !DITemplateTypeParameter(name: "A", type: !298) +!298 = !DICompositeType(tag: DW_TAG_array_type, baseType: !252, size: 32768, align: 64, elements: !293) +!299 = !{!222, !300} +!300 = !DITemplateTypeParameter(name: "S", type: !301) +!301 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "StoreOnStack", scope: !6, file: !5, align: 8, flags: DIFlagPrivate, elements: !46, identifier: "21dc88df75a1263a13dd24276b92d3e") +!302 = !DISubroutineType(types: !303) +!303 = !{!304, !549, !550, !227} +!304 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Result", scope: !305, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !306, templateParams: !46, identifier: "2930057b85b47f2bef5979de26a87b97") +!305 = !DINamespace(name: "result", scope: !40) +!306 = !{!307} +!307 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !304, file: !5, size: 128, align: 64, elements: !308, templateParams: !46, identifier: "2298ec794572047066c0d72c8d834034", discriminator: !548) +!308 = !{!309, !544} +!309 = !DIDerivedType(tag: DW_TAG_member, name: "Ok", scope: !307, file: !5, baseType: !310, size: 128, align: 64, extraData: i128 77) +!310 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Ok", scope: !304, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !311, templateParams: !313, identifier: "836193d46f427d39e980f444791b92f5") +!311 = !{!312} +!312 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !310, file: !5, baseType: !21, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!313 = !{!222, !314} +!314 = !DITemplateTypeParameter(name: "E", type: !315) +!315 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Error", scope: !17, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !316, templateParams: !46, identifier: "d77646015d26471497f49470c6fe61cb") +!316 = !{!317} +!317 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !315, file: !5, size: 128, align: 64, elements: !318, templateParams: !46, identifier: "ca3f5d09babb12e628f9b9b97696a8e4", discriminator: !543) +!318 = !{!319, !321, !323, !325, !327, !329, !331, !333, !335, !337, !339, !341, !343, !350, !352, !354, !356, !358, !362, !366, !374, !376, !383, !390, !397, !404, !408, !412, !416, !418, !420, !422, !424, !426, !428, !430, !432, !436, !438, !440, !442, !449, !451, !453, !457, !459, !461, !463, !465, !467, !474, !476, !478, !480, !482, !484, !488, !490, !492, !494, !496, !500, !502, !504, !506, !508, !510, !512, !514, !516, !518, !520, !522, !524, !526, !528, !536} +!319 = !DIDerivedType(tag: DW_TAG_member, name: "Io", scope: !317, file: !5, baseType: !320, size: 128, align: 64, extraData: i128 0) +!320 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Io", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "2320550a9c63e2aae32b0db85e194ad6") +!321 = !DIDerivedType(tag: DW_TAG_member, name: "PcRelativePointerButSectionBaseIsUndefined", scope: !317, file: !5, baseType: !322, size: 128, align: 64, extraData: i128 1) +!322 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "PcRelativePointerButSectionBaseIsUndefined", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "8be741069f75ec37c15f7c3a00f5725f") +!323 = !DIDerivedType(tag: DW_TAG_member, name: "TextRelativePointerButTextBaseIsUndefined", scope: !317, file: !5, baseType: !324, size: 128, align: 64, extraData: i128 2) +!324 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "TextRelativePointerButTextBaseIsUndefined", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "378958e13527898498ae80867eb2d180") +!325 = !DIDerivedType(tag: DW_TAG_member, name: "DataRelativePointerButDataBaseIsUndefined", scope: !317, file: !5, baseType: !326, size: 128, align: 64, extraData: i128 3) +!326 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DataRelativePointerButDataBaseIsUndefined", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "f6d90525538ea3822cc7864c7d6e132a") +!327 = !DIDerivedType(tag: DW_TAG_member, name: "FuncRelativePointerInBadContext", scope: !317, file: !5, baseType: !328, size: 128, align: 64, extraData: i128 4) +!328 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "FuncRelativePointerInBadContext", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "b3ef419b95336ce3759c0b0990f112fc") +!329 = !DIDerivedType(tag: DW_TAG_member, name: "CannotParseOmitPointerEncoding", scope: !317, file: !5, baseType: !330, size: 128, align: 64, extraData: i128 5) +!330 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "CannotParseOmitPointerEncoding", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "eb130e7d2deb1502c84e84a2fb5387d") +!331 = !DIDerivedType(tag: DW_TAG_member, name: "BadUnsignedLeb128", scope: !317, file: !5, baseType: !332, size: 128, align: 64, extraData: i128 6) +!332 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "BadUnsignedLeb128", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "90e4e9ce1b5f9ac0ab73ec51465666a9") +!333 = !DIDerivedType(tag: DW_TAG_member, name: "BadSignedLeb128", scope: !317, file: !5, baseType: !334, size: 128, align: 64, extraData: i128 7) +!334 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "BadSignedLeb128", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "3c015a8355d523b8e6fb55a5ad8fdb42") +!335 = !DIDerivedType(tag: DW_TAG_member, name: "AbbreviationTagZero", scope: !317, file: !5, baseType: !336, size: 128, align: 64, extraData: i128 8) +!336 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "AbbreviationTagZero", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "21f316a516256bf01c07a0b30b05f15c") +!337 = !DIDerivedType(tag: DW_TAG_member, name: "AttributeFormZero", scope: !317, file: !5, baseType: !338, size: 128, align: 64, extraData: i128 9) +!338 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "AttributeFormZero", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "f33bf8117b76a81a643250c2d9a8b44f") +!339 = !DIDerivedType(tag: DW_TAG_member, name: "BadHasChildren", scope: !317, file: !5, baseType: !340, size: 128, align: 64, extraData: i128 10) +!340 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "BadHasChildren", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "edc800ff621c7b61d39a6e66a7f2e00") +!341 = !DIDerivedType(tag: DW_TAG_member, name: "BadLength", scope: !317, file: !5, baseType: !342, size: 128, align: 64, extraData: i128 11) +!342 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "BadLength", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "abbcc790b2b7b20eb0bda85a8691aacb") +!343 = !DIDerivedType(tag: DW_TAG_member, name: "UnknownForm", scope: !317, file: !5, baseType: !344, size: 128, align: 64, extraData: i128 12) +!344 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnknownForm", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !345, templateParams: !46, identifier: "bf6f1dc4dab6ba136decfeee45bc099b") +!345 = !{!346} +!346 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !344, file: !5, baseType: !347, size: 16, align: 16, offset: 16, flags: DIFlagPublic) +!347 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DwForm", scope: !61, file: !5, size: 16, align: 16, flags: DIFlagPublic, elements: !348, templateParams: !46, identifier: "48a0ca1754029669f804908ef0889f77") +!348 = !{!349} +!349 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !347, file: !5, baseType: !118, size: 16, align: 16, flags: DIFlagPublic) +!350 = !DIDerivedType(tag: DW_TAG_member, name: "ExpectedZero", scope: !317, file: !5, baseType: !351, size: 128, align: 64, extraData: i128 13) +!351 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ExpectedZero", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "fb26ef4a66c7e07a914b864dd5cbdaf3") +!352 = !DIDerivedType(tag: DW_TAG_member, name: "DuplicateAbbreviationCode", scope: !317, file: !5, baseType: !353, size: 128, align: 64, extraData: i128 14) +!353 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DuplicateAbbreviationCode", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "8fba5777d5e3ba3c664af74dfa9883fa") +!354 = !DIDerivedType(tag: DW_TAG_member, name: "DuplicateArange", scope: !317, file: !5, baseType: !355, size: 128, align: 64, extraData: i128 15) +!355 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DuplicateArange", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "92ad6df4b8eab06a4098fd1ab6fd674a") +!356 = !DIDerivedType(tag: DW_TAG_member, name: "UnknownReservedLength", scope: !317, file: !5, baseType: !357, size: 128, align: 64, extraData: i128 16) +!357 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnknownReservedLength", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "2b13d11aaf1e29e4496a5c786d58e5ad") +!358 = !DIDerivedType(tag: DW_TAG_member, name: "UnknownVersion", scope: !317, file: !5, baseType: !359, size: 128, align: 64, extraData: i128 17) +!359 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnknownVersion", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !360, templateParams: !46, identifier: "af46e087b62d3b17df488fbbae5b6e37") +!360 = !{!361} +!361 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !359, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!362 = !DIDerivedType(tag: DW_TAG_member, name: "UnknownAbbreviation", scope: !317, file: !5, baseType: !363, size: 128, align: 64, extraData: i128 18) +!363 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnknownAbbreviation", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !364, templateParams: !46, identifier: "b3570174fc0c73045fd6de2058159273") +!364 = !{!365} +!365 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !363, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!366 = !DIDerivedType(tag: DW_TAG_member, name: "UnexpectedEof", scope: !317, file: !5, baseType: !367, size: 128, align: 64, extraData: i128 19) +!367 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnexpectedEof", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !368, templateParams: !46, identifier: "c321526e0a5c153ffff82fcf12f05ee5") +!368 = !{!369} +!369 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !367, file: !5, baseType: !370, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!370 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ReaderOffsetId", scope: !371, file: !5, size: 64, align: 64, flags: DIFlagPublic, elements: !372, templateParams: !46, identifier: "10753e39de75edad2b99c864968b4116") +!371 = !DINamespace(name: "reader", scope: !17) +!372 = !{!373} +!373 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !370, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagPublic) +!374 = !DIDerivedType(tag: DW_TAG_member, name: "UnexpectedNull", scope: !317, file: !5, baseType: !375, size: 128, align: 64, extraData: i128 20) +!375 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnexpectedNull", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "a086692abce983283debcb3978720724") +!376 = !DIDerivedType(tag: DW_TAG_member, name: "UnknownStandardOpcode", scope: !317, file: !5, baseType: !377, size: 128, align: 64, extraData: i128 21) +!377 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnknownStandardOpcode", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !378, templateParams: !46, identifier: "d17e9cb4063b64896929e2327bb308ce") +!378 = !{!379} +!379 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !377, file: !5, baseType: !380, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!380 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DwLns", scope: !61, file: !5, size: 8, align: 8, flags: DIFlagPublic, elements: !381, templateParams: !46, identifier: "62ddfcc3d37948b75bdcdd7f8282c4fd") +!381 = !{!382} +!382 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !380, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagPublic) +!383 = !DIDerivedType(tag: DW_TAG_member, name: "UnknownExtendedOpcode", scope: !317, file: !5, baseType: !384, size: 128, align: 64, extraData: i128 22) +!384 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnknownExtendedOpcode", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !385, templateParams: !46, identifier: "fe4bafba0822d26228794fa2925d8c1") +!385 = !{!386} +!386 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !384, file: !5, baseType: !387, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!387 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DwLne", scope: !61, file: !5, size: 8, align: 8, flags: DIFlagPublic, elements: !388, templateParams: !46, identifier: "d9915819558840f5b2e0f12224d88dd4") +!388 = !{!389} +!389 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !387, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagPublic) +!390 = !DIDerivedType(tag: DW_TAG_member, name: "UnknownLocListsEntry", scope: !317, file: !5, baseType: !391, size: 128, align: 64, extraData: i128 23) +!391 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnknownLocListsEntry", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !392, templateParams: !46, identifier: "980da01d1d36b39f8f45cd86f8be0b88") +!392 = !{!393} +!393 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !391, file: !5, baseType: !394, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!394 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DwLle", scope: !61, file: !5, size: 8, align: 8, flags: DIFlagPublic, elements: !395, templateParams: !46, identifier: "a0030f5b581a30602dd91af017afec49") +!395 = !{!396} +!396 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !394, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagPublic) +!397 = !DIDerivedType(tag: DW_TAG_member, name: "UnknownRangeListsEntry", scope: !317, file: !5, baseType: !398, size: 128, align: 64, extraData: i128 24) +!398 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnknownRangeListsEntry", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !399, templateParams: !46, identifier: "b1b22f15da3690a528b596a003d5cedb") +!399 = !{!400} +!400 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !398, file: !5, baseType: !401, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!401 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DwRle", scope: !61, file: !5, size: 8, align: 8, flags: DIFlagPublic, elements: !402, templateParams: !46, identifier: "fb2890de8a376d35eb233acc57542dcd") +!402 = !{!403} +!403 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !401, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagPublic) +!404 = !DIDerivedType(tag: DW_TAG_member, name: "UnsupportedAddressSize", scope: !317, file: !5, baseType: !405, size: 128, align: 64, extraData: i128 25) +!405 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnsupportedAddressSize", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !406, templateParams: !46, identifier: "600d8151955ba8481767c9c43c8868b4") +!406 = !{!407} +!407 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !405, file: !5, baseType: !26, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!408 = !DIDerivedType(tag: DW_TAG_member, name: "UnsupportedOffsetSize", scope: !317, file: !5, baseType: !409, size: 128, align: 64, extraData: i128 26) +!409 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnsupportedOffsetSize", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !410, templateParams: !46, identifier: "34552b1f282c3a7eaf508f4d4757384") +!410 = !{!411} +!411 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !409, file: !5, baseType: !26, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!412 = !DIDerivedType(tag: DW_TAG_member, name: "UnsupportedFieldSize", scope: !317, file: !5, baseType: !413, size: 128, align: 64, extraData: i128 27) +!413 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnsupportedFieldSize", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !414, templateParams: !46, identifier: "bed14b8322ad5b70d0f0b5e56821cc97") +!414 = !{!415} +!415 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !413, file: !5, baseType: !26, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!416 = !DIDerivedType(tag: DW_TAG_member, name: "MinimumInstructionLengthZero", scope: !317, file: !5, baseType: !417, size: 128, align: 64, extraData: i128 28) +!417 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "MinimumInstructionLengthZero", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "fa1fd0b565474fe82ccb893a09da66e5") +!418 = !DIDerivedType(tag: DW_TAG_member, name: "MaximumOperationsPerInstructionZero", scope: !317, file: !5, baseType: !419, size: 128, align: 64, extraData: i128 29) +!419 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "MaximumOperationsPerInstructionZero", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "a35b154691400fb6f961d541241b8c31") +!420 = !DIDerivedType(tag: DW_TAG_member, name: "LineRangeZero", scope: !317, file: !5, baseType: !421, size: 128, align: 64, extraData: i128 30) +!421 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "LineRangeZero", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "3c6bfb38e53333f5f80900903619c1b5") +!422 = !DIDerivedType(tag: DW_TAG_member, name: "OpcodeBaseZero", scope: !317, file: !5, baseType: !423, size: 128, align: 64, extraData: i128 31) +!423 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "OpcodeBaseZero", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "8f3fdd0c06ec5fb1fc8679e4671305a5") +!424 = !DIDerivedType(tag: DW_TAG_member, name: "BadUtf8", scope: !317, file: !5, baseType: !425, size: 128, align: 64, extraData: i128 32) +!425 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "BadUtf8", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "9b9aef385a70fc9dcd57b2e8b5ab6b24") +!426 = !DIDerivedType(tag: DW_TAG_member, name: "NotCieId", scope: !317, file: !5, baseType: !427, size: 128, align: 64, extraData: i128 33) +!427 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NotCieId", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "ebd29b268a6ba10a2b22260f8252bd99") +!428 = !DIDerivedType(tag: DW_TAG_member, name: "NotCiePointer", scope: !317, file: !5, baseType: !429, size: 128, align: 64, extraData: i128 34) +!429 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NotCiePointer", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "22e0182bcdf61321493fc4cd39e9e6db") +!430 = !DIDerivedType(tag: DW_TAG_member, name: "NotFdePointer", scope: !317, file: !5, baseType: !431, size: 128, align: 64, extraData: i128 35) +!431 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NotFdePointer", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "d0b8d1771a76ab5e69aa55743b84d5b8") +!432 = !DIDerivedType(tag: DW_TAG_member, name: "BadBranchTarget", scope: !317, file: !5, baseType: !433, size: 128, align: 64, extraData: i128 36) +!433 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "BadBranchTarget", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !434, templateParams: !46, identifier: "f580dfe27723b7ae4b65f9357871a56e") +!434 = !{!435} +!435 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !433, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!436 = !DIDerivedType(tag: DW_TAG_member, name: "InvalidPushObjectAddress", scope: !317, file: !5, baseType: !437, size: 128, align: 64, extraData: i128 37) +!437 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "InvalidPushObjectAddress", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "269d995e87b5d13c7cb611055fbb1cc") +!438 = !DIDerivedType(tag: DW_TAG_member, name: "NotEnoughStackItems", scope: !317, file: !5, baseType: !439, size: 128, align: 64, extraData: i128 38) +!439 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NotEnoughStackItems", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "20bcdb0491a3e809303636911dbf8cd") +!440 = !DIDerivedType(tag: DW_TAG_member, name: "TooManyIterations", scope: !317, file: !5, baseType: !441, size: 128, align: 64, extraData: i128 39) +!441 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "TooManyIterations", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "ff30adf3a0a0372083d438531902f07c") +!442 = !DIDerivedType(tag: DW_TAG_member, name: "InvalidExpression", scope: !317, file: !5, baseType: !443, size: 128, align: 64, extraData: i128 40) +!443 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "InvalidExpression", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !444, templateParams: !46, identifier: "5651d5c999cb39e0115de3cc6366e2a1") +!444 = !{!445} +!445 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !443, file: !5, baseType: !446, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!446 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DwOp", scope: !61, file: !5, size: 8, align: 8, flags: DIFlagPublic, elements: !447, templateParams: !46, identifier: "7f53682bc0f25d737c4504ffbb705411") +!447 = !{!448} +!448 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !446, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagPublic) +!449 = !DIDerivedType(tag: DW_TAG_member, name: "UnsupportedEvaluation", scope: !317, file: !5, baseType: !450, size: 128, align: 64, extraData: i128 41) +!450 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnsupportedEvaluation", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "f7f5df83d048fac1b6a625fe43495894") +!451 = !DIDerivedType(tag: DW_TAG_member, name: "InvalidPiece", scope: !317, file: !5, baseType: !452, size: 128, align: 64, extraData: i128 42) +!452 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "InvalidPiece", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "b63df519ec7f41efddc9e93b531a6ad9") +!453 = !DIDerivedType(tag: DW_TAG_member, name: "InvalidExpressionTerminator", scope: !317, file: !5, baseType: !454, size: 128, align: 64, extraData: i128 43) +!454 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "InvalidExpressionTerminator", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !455, templateParams: !46, identifier: "3a81ef5c26543c7edcc61e9fc7944fef") +!455 = !{!456} +!456 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !454, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!457 = !DIDerivedType(tag: DW_TAG_member, name: "DivisionByZero", scope: !317, file: !5, baseType: !458, size: 128, align: 64, extraData: i128 44) +!458 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DivisionByZero", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "b76367d376d20e9fbb0ca9f290f2c235") +!459 = !DIDerivedType(tag: DW_TAG_member, name: "TypeMismatch", scope: !317, file: !5, baseType: !460, size: 128, align: 64, extraData: i128 45) +!460 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "TypeMismatch", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "89d807c67453ebabd4929695d8f66096") +!461 = !DIDerivedType(tag: DW_TAG_member, name: "IntegralTypeRequired", scope: !317, file: !5, baseType: !462, size: 128, align: 64, extraData: i128 46) +!462 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "IntegralTypeRequired", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "7b0620dbd2111d443ce6e80003d23fb5") +!463 = !DIDerivedType(tag: DW_TAG_member, name: "UnsupportedTypeOperation", scope: !317, file: !5, baseType: !464, size: 128, align: 64, extraData: i128 47) +!464 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnsupportedTypeOperation", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "d08821c006f73bfca08dc2d771305521") +!465 = !DIDerivedType(tag: DW_TAG_member, name: "InvalidShiftExpression", scope: !317, file: !5, baseType: !466, size: 128, align: 64, extraData: i128 48) +!466 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "InvalidShiftExpression", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "f9d7ea923183442e88981e5113d95cd8") +!467 = !DIDerivedType(tag: DW_TAG_member, name: "UnknownCallFrameInstruction", scope: !317, file: !5, baseType: !468, size: 128, align: 64, extraData: i128 49) +!468 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnknownCallFrameInstruction", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !469, templateParams: !46, identifier: "93dffe49e5f883b92277a0558e3cb1b2") +!469 = !{!470} +!470 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !468, file: !5, baseType: !471, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!471 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DwCfa", scope: !61, file: !5, size: 8, align: 8, flags: DIFlagPublic, elements: !472, templateParams: !46, identifier: "25e8987d4efbed4c58d052b7ad506631") +!472 = !{!473} +!473 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !471, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagPublic) +!474 = !DIDerivedType(tag: DW_TAG_member, name: "InvalidAddressRange", scope: !317, file: !5, baseType: !475, size: 128, align: 64, extraData: i128 50) +!475 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "InvalidAddressRange", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "472535216c273e01cbb038f4e1a46c30") +!476 = !DIDerivedType(tag: DW_TAG_member, name: "CfiInstructionInInvalidContext", scope: !317, file: !5, baseType: !477, size: 128, align: 64, extraData: i128 51) +!477 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "CfiInstructionInInvalidContext", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "eddaee247b191a56aa7bc2dc0985c5da") +!478 = !DIDerivedType(tag: DW_TAG_member, name: "PopWithEmptyStack", scope: !317, file: !5, baseType: !479, size: 128, align: 64, extraData: i128 52) +!479 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "PopWithEmptyStack", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "b820ab2462801a0fc0899bf3654c4b8") +!480 = !DIDerivedType(tag: DW_TAG_member, name: "NoUnwindInfoForAddress", scope: !317, file: !5, baseType: !481, size: 128, align: 64, extraData: i128 53) +!481 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NoUnwindInfoForAddress", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "ae01ce5aaf3d99bcee8d4f5cd8182484") +!482 = !DIDerivedType(tag: DW_TAG_member, name: "UnsupportedOffset", scope: !317, file: !5, baseType: !483, size: 128, align: 64, extraData: i128 54) +!483 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnsupportedOffset", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "2ac7a792140cb6d7bb468e88d6cc2308") +!484 = !DIDerivedType(tag: DW_TAG_member, name: "UnknownPointerEncoding", scope: !317, file: !5, baseType: !485, size: 128, align: 64, extraData: i128 55) +!485 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnknownPointerEncoding", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !486, templateParams: !46, identifier: "81e4dbaa1837b41877cb2650ba0cb059") +!486 = !{!487} +!487 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !485, file: !5, baseType: !60, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!488 = !DIDerivedType(tag: DW_TAG_member, name: "NoEntryAtGivenOffset", scope: !317, file: !5, baseType: !489, size: 128, align: 64, extraData: i128 56) +!489 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NoEntryAtGivenOffset", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "fe3a27c995940427e718d5e3a088265") +!490 = !DIDerivedType(tag: DW_TAG_member, name: "OffsetOutOfBounds", scope: !317, file: !5, baseType: !491, size: 128, align: 64, extraData: i128 57) +!491 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "OffsetOutOfBounds", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "5d4def3cd252d7be8c56a756b8c7d7b") +!492 = !DIDerivedType(tag: DW_TAG_member, name: "UnknownAugmentation", scope: !317, file: !5, baseType: !493, size: 128, align: 64, extraData: i128 58) +!493 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnknownAugmentation", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "dd1c3a83fa13d7501e7c00dbc7ffd4e6") +!494 = !DIDerivedType(tag: DW_TAG_member, name: "UnsupportedPointerEncoding", scope: !317, file: !5, baseType: !495, size: 128, align: 64, extraData: i128 59) +!495 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnsupportedPointerEncoding", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "f23537dcf6caef7aacff71f94f88ad9a") +!496 = !DIDerivedType(tag: DW_TAG_member, name: "UnsupportedRegister", scope: !317, file: !5, baseType: !497, size: 128, align: 64, extraData: i128 60) +!497 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnsupportedRegister", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !498, templateParams: !46, identifier: "69e04d530c2a072b985811e3c0c90332") +!498 = !{!499} +!499 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !497, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!500 = !DIDerivedType(tag: DW_TAG_member, name: "TooManyRegisterRules", scope: !317, file: !5, baseType: !501, size: 128, align: 64, extraData: i128 61) +!501 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "TooManyRegisterRules", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "f74f825fd17a89366d5fbcd594ad371e") +!502 = !DIDerivedType(tag: DW_TAG_member, name: "StackFull", scope: !317, file: !5, baseType: !503, size: 128, align: 64, extraData: i128 62) +!503 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "StackFull", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "649f9201d23349d0547f2bf0aa454d2c") +!504 = !DIDerivedType(tag: DW_TAG_member, name: "VariableLengthSearchTable", scope: !317, file: !5, baseType: !505, size: 128, align: 64, extraData: i128 63) +!505 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "VariableLengthSearchTable", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "c37c43df5d63ae12b1ee17c8b3bac70") +!506 = !DIDerivedType(tag: DW_TAG_member, name: "UnsupportedUnitType", scope: !317, file: !5, baseType: !507, size: 128, align: 64, extraData: i128 64) +!507 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnsupportedUnitType", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "c522143e95508ac586d52dd2a2094233") +!508 = !DIDerivedType(tag: DW_TAG_member, name: "UnsupportedAddressIndex", scope: !317, file: !5, baseType: !509, size: 128, align: 64, extraData: i128 65) +!509 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnsupportedAddressIndex", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "7f9ad238cf1907731ceaa4464f643d59") +!510 = !DIDerivedType(tag: DW_TAG_member, name: "UnsupportedSegmentSize", scope: !317, file: !5, baseType: !511, size: 128, align: 64, extraData: i128 66) +!511 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnsupportedSegmentSize", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "d82bf4bb4842cb1a2d0d0685137bb22") +!512 = !DIDerivedType(tag: DW_TAG_member, name: "MissingUnitDie", scope: !317, file: !5, baseType: !513, size: 128, align: 64, extraData: i128 67) +!513 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "MissingUnitDie", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "bfa91df9d2fb7ed5794259b263898a8") +!514 = !DIDerivedType(tag: DW_TAG_member, name: "UnsupportedAttributeForm", scope: !317, file: !5, baseType: !515, size: 128, align: 64, extraData: i128 68) +!515 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnsupportedAttributeForm", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "b4d57042fdb22adeec228129f57c3bdb") +!516 = !DIDerivedType(tag: DW_TAG_member, name: "MissingFileEntryFormatPath", scope: !317, file: !5, baseType: !517, size: 128, align: 64, extraData: i128 69) +!517 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "MissingFileEntryFormatPath", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "2feb917517f62b9a49da4bec8085de52") +!518 = !DIDerivedType(tag: DW_TAG_member, name: "ExpectedStringAttributeValue", scope: !317, file: !5, baseType: !519, size: 128, align: 64, extraData: i128 70) +!519 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ExpectedStringAttributeValue", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "2e1c89ffcc99bcff26aae384fe90a0b5") +!520 = !DIDerivedType(tag: DW_TAG_member, name: "InvalidImplicitConst", scope: !317, file: !5, baseType: !521, size: 128, align: 64, extraData: i128 71) +!521 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "InvalidImplicitConst", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "aea5e93522c8b1b32186ed286b609796") +!522 = !DIDerivedType(tag: DW_TAG_member, name: "InvalidIndexSectionCount", scope: !317, file: !5, baseType: !523, size: 128, align: 64, extraData: i128 72) +!523 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "InvalidIndexSectionCount", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "588d1fe04fa40bd64d4b9811824daa5a") +!524 = !DIDerivedType(tag: DW_TAG_member, name: "InvalidIndexSlotCount", scope: !317, file: !5, baseType: !525, size: 128, align: 64, extraData: i128 73) +!525 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "InvalidIndexSlotCount", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "6274016f543239a9e591b947785d3205") +!526 = !DIDerivedType(tag: DW_TAG_member, name: "InvalidIndexRow", scope: !317, file: !5, baseType: !527, size: 128, align: 64, extraData: i128 74) +!527 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "InvalidIndexRow", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, identifier: "59ad95d188560365cbe8c5f5359279c9") +!528 = !DIDerivedType(tag: DW_TAG_member, name: "UnknownIndexSection", scope: !317, file: !5, baseType: !529, size: 128, align: 64, extraData: i128 75) +!529 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnknownIndexSection", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !530, templateParams: !46, identifier: "b73e5f323eb887c2778393497e67883f") +!530 = !{!531} +!531 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !529, file: !5, baseType: !532, size: 32, align: 32, offset: 32, flags: DIFlagPublic) +!532 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DwSect", scope: !61, file: !5, size: 32, align: 32, flags: DIFlagPublic, elements: !533, templateParams: !46, identifier: "2076c0f96c14e3f2bddcc281c845b22f") +!533 = !{!534} +!534 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !532, file: !5, baseType: !535, size: 32, align: 32, flags: DIFlagPublic) +!535 = !DIBasicType(name: "u32", size: 32, encoding: DW_ATE_unsigned) +!536 = !DIDerivedType(tag: DW_TAG_member, name: "UnknownIndexSectionV2", scope: !317, file: !5, baseType: !537, size: 128, align: 64, extraData: i128 76) +!537 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnknownIndexSectionV2", scope: !315, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !538, templateParams: !46, identifier: "5ef812c992486c75cad093763c73c88f") +!538 = !{!539} +!539 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !537, file: !5, baseType: !540, size: 32, align: 32, offset: 32, flags: DIFlagPublic) +!540 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DwSectV2", scope: !61, file: !5, size: 32, align: 32, flags: DIFlagPublic, elements: !541, templateParams: !46, identifier: "f456df61651542439b4c0d56ddfa3e2b") +!541 = !{!542} +!542 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !540, file: !5, baseType: !535, size: 32, align: 32, flags: DIFlagPublic) +!543 = !DIDerivedType(tag: DW_TAG_member, scope: !315, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagArtificial) +!544 = !DIDerivedType(tag: DW_TAG_member, name: "Err", scope: !307, file: !5, baseType: !545, size: 128, align: 64) +!545 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Err", scope: !304, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !546, templateParams: !313, identifier: "73d51b53019cec2eb7866e0ccdee2b05") +!546 = !{!547} +!547 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !545, file: !5, baseType: !315, size: 128, align: 64, flags: DIFlagPublic) +!548 = !DIDerivedType(tag: DW_TAG_member, scope: !304, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagArtificial) +!549 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "&unwinding::unwinder::frame::Frame", baseType: !4, size: 64, align: 64, dwarfAddressSpace: 0) +!550 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "&unwinding::unwinder::arch::aarch64::Context", baseType: !551, size: 64, align: 64, dwarfAddressSpace: 0) +!551 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Context", scope: !552, file: !5, size: 4096, align: 64, flags: DIFlagPublic, elements: !554, templateParams: !46, identifier: "8e981de74a115bb4264fb06b8de66f0") +!552 = !DINamespace(name: "aarch64", scope: !553) +!553 = !DINamespace(name: "arch", scope: !7) +!554 = !{!555, !559, !560} +!555 = !DIDerivedType(tag: DW_TAG_member, name: "gp", scope: !551, file: !5, baseType: !556, size: 1984, align: 64, flags: DIFlagPublic) +!556 = !DICompositeType(tag: DW_TAG_array_type, baseType: !21, size: 1984, align: 64, elements: !557) +!557 = !{!558} +!558 = !DISubrange(count: 31, lowerBound: 0) +!559 = !DIDerivedType(tag: DW_TAG_member, name: "sp", scope: !551, file: !5, baseType: !21, size: 64, align: 64, offset: 1984, flags: DIFlagPublic) +!560 = !DIDerivedType(tag: DW_TAG_member, name: "fp", scope: !551, file: !5, baseType: !561, size: 2048, align: 64, offset: 2048, flags: DIFlagPublic) +!561 = !DICompositeType(tag: DW_TAG_array_type, baseType: !21, size: 2048, align: 64, elements: !562) +!562 = !{!563} +!563 = !DISubrange(count: 32, lowerBound: 0) +!564 = distinct !DICompileUnit(language: DW_LANG_Rust, file: !565, producer: "clang LLVM (rustc version 1.82.0-nightly (636d7ff91 2024-08-19))", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !566, globals: !597, splitDebugInlining: false, nameTableKind: None) +!565 = !DIFile(filename: "src/lib.rs/@/unwinding.453513c1ca9c7b65-cgu.0", directory: "/home/dev/ecosystem/unwinding") +!566 = !{!200, !567, !24, !571, !579, !586, !591} +!567 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "CieOffsetEncoding", scope: !16, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagEnumClass, elements: !568) +!568 = !{!569, !570} +!569 = !DIEnumerator(name: "U32", value: 0, isUnsigned: true) +!570 = !DIEnumerator(name: "U64", value: 1, isUnsigned: true) +!571 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "Alignment", scope: !572, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagEnumClass, elements: !574) +!572 = !DINamespace(name: "rt", scope: !573) +!573 = !DINamespace(name: "fmt", scope: !40) +!574 = !{!575, !576, !577, !578} +!575 = !DIEnumerator(name: "Left", value: 0, isUnsigned: true) +!576 = !DIEnumerator(name: "Right", value: 1, isUnsigned: true) +!577 = !DIEnumerator(name: "Center", value: 2, isUnsigned: true) +!578 = !DIEnumerator(name: "Unknown", value: 3, isUnsigned: true) +!579 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "Ordering", scope: !580, file: !5, baseType: !581, size: 8, align: 8, flags: DIFlagEnumClass, elements: !582) +!580 = !DINamespace(name: "cmp", scope: !40) +!581 = !DIBasicType(name: "i8", size: 8, encoding: DW_ATE_signed) +!582 = !{!583, !584, !585} +!583 = !DIEnumerator(name: "Less", value: -1) +!584 = !DIEnumerator(name: "Equal", value: 0) +!585 = !DIEnumerator(name: "Greater", value: 1) +!586 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "c_void", scope: !587, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagEnumClass, elements: !588) +!587 = !DINamespace(name: "ffi", scope: !40) +!588 = !{!589, !590} +!589 = !DIEnumerator(name: "__variant1", value: 0, isUnsigned: true) +!590 = !DIEnumerator(name: "__variant2", value: 1, isUnsigned: true) +!591 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "AssertKind", scope: !592, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagEnumClass, elements: !593) +!592 = !DINamespace(name: "panicking", scope: !40) +!593 = !{!594, !595, !596} +!594 = !DIEnumerator(name: "Eq", value: 0, isUnsigned: true) +!595 = !DIEnumerator(name: "Ne", value: 1, isUnsigned: true) +!596 = !DIEnumerator(name: "Match", value: 2, isUnsigned: true) +!597 = !{!598} +!598 = !DIGlobalVariableExpression(var: !599, expr: !DIExpression()) +!599 = distinct !DIGlobalVariable(name: "::{vtable}", scope: null, file: !5, type: !600, isLocal: true, isDefinition: true) +!600 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "::{vtable_type}", file: !5, size: 256, align: 64, flags: DIFlagArtificial, elements: !601, vtableHolder: !315, templateParams: !46, identifier: "1f97312b991e7e51c27c8ed2941b7252") +!601 = !{!602, !604, !605, !606} +!602 = !DIDerivedType(tag: DW_TAG_member, name: "drop_in_place", scope: !600, file: !5, baseType: !603, size: 64, align: 64) +!603 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "*const ()", baseType: !246, size: 64, align: 64, dwarfAddressSpace: 0) +!604 = !DIDerivedType(tag: DW_TAG_member, name: "size", scope: !600, file: !5, baseType: !21, size: 64, align: 64, offset: 64) +!605 = !DIDerivedType(tag: DW_TAG_member, name: "align", scope: !600, file: !5, baseType: !21, size: 64, align: 64, offset: 128) +!606 = !DIDerivedType(tag: DW_TAG_member, name: "__method3", scope: !600, file: !5, baseType: !603, size: 64, align: 64, offset: 192) +!607 = !DISubprogram(name: "evaluate_expression", linkageName: "_ZN9unwinding8unwinder5frame5Frame19evaluate_expression17h2bd8716b79f71675E", scope: !4, file: !3, line: 79, type: !302, scopeLine: 79, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit, templateParams: !46) +!608 = !{!609, !610, !611, !612, !618, !873, !946, !966, !968, !970, !972, !974, !976, !978, !980, !982, !984, !986, !988, !990, !992, !994, !997} +!609 = !DILocalVariable(name: "self", arg: 1, scope: !2, file: !3, line: 80, type: !549) +!610 = !DILocalVariable(name: "ctx", arg: 2, scope: !2, file: !3, line: 81, type: !550) +!611 = !DILocalVariable(name: "expr", arg: 3, scope: !2, file: !3, line: 82, type: !227) +!612 = !DILocalVariable(name: "expr", scope: !613, file: !3, line: 84, type: !614, align: 8) +!613 = distinct !DILexicalBlock(scope: !2, file: !3, line: 84, column: 9) +!614 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Expression>", scope: !615, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !616, templateParams: !204, identifier: "c37ff0bc75fe37cf7f7a1245102bd107") +!615 = !DINamespace(name: "op", scope: !17) +!616 = !{!617} +!617 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !614, file: !5, baseType: !120, size: 128, align: 64, flags: DIFlagPublic) +!618 = !DILocalVariable(name: "eval", scope: !619, file: !3, line: 85, type: !620, align: 8) +!619 = distinct !DILexicalBlock(scope: !613, file: !3, line: 85, column: 9) +!620 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Evaluation, unwinding::unwinder::frame::StoreOnStack>", scope: !615, file: !5, size: 9728, align: 64, flags: DIFlagPublic, elements: !621, templateParams: !872, identifier: "96ccd7b3bd9690c1bf418466cde67a") +!621 = !{!622, !623, !629, !630, !644, !645, !704, !705, !779, !780, !804, !816} +!622 = !DIDerivedType(tag: DW_TAG_member, name: "bytecode", scope: !620, file: !5, baseType: !120, size: 128, align: 64, offset: 512, flags: DIFlagPrivate) +!623 = !DIDerivedType(tag: DW_TAG_member, name: "encoding", scope: !620, file: !5, baseType: !624, size: 32, align: 16, offset: 9664, flags: DIFlagPrivate) +!624 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Encoding", scope: !25, file: !5, size: 32, align: 16, flags: DIFlagPublic, elements: !625, templateParams: !46, identifier: "1e5c559cf794bf056cbc617988ad2fe8") +!625 = !{!626, !627, !628} +!626 = !DIDerivedType(tag: DW_TAG_member, name: "address_size", scope: !624, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagPublic) +!627 = !DIDerivedType(tag: DW_TAG_member, name: "format", scope: !624, file: !5, baseType: !24, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!628 = !DIDerivedType(tag: DW_TAG_member, name: "version", scope: !624, file: !5, baseType: !118, size: 16, align: 16, offset: 16, flags: DIFlagPublic) +!629 = !DIDerivedType(tag: DW_TAG_member, name: "object_address", scope: !620, file: !5, baseType: !178, size: 128, align: 64, flags: DIFlagPrivate) +!630 = !DIDerivedType(tag: DW_TAG_member, name: "max_iterations", scope: !620, file: !5, baseType: !631, size: 64, align: 32, offset: 320, flags: DIFlagPrivate) +!631 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Option", scope: !39, file: !5, size: 64, align: 32, flags: DIFlagPublic, elements: !632, templateParams: !46, identifier: "ebe42463e4e7e92377731e8e461eca4b") +!632 = !{!633} +!633 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !631, file: !5, size: 64, align: 32, elements: !634, templateParams: !46, identifier: "4e5479196563409542c164f35683db2c", discriminator: !643) +!634 = !{!635, !639} +!635 = !DIDerivedType(tag: DW_TAG_member, name: "None", scope: !633, file: !5, baseType: !636, size: 64, align: 32, extraData: i128 0) +!636 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "None", scope: !631, file: !5, size: 64, align: 32, flags: DIFlagPublic, elements: !46, templateParams: !637, identifier: "1b68f282e961af132516648785d5c5b") +!637 = !{!638} +!638 = !DITemplateTypeParameter(name: "T", type: !535) +!639 = !DIDerivedType(tag: DW_TAG_member, name: "Some", scope: !633, file: !5, baseType: !640, size: 64, align: 32, extraData: i128 1) +!640 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Some", scope: !631, file: !5, size: 64, align: 32, flags: DIFlagPublic, elements: !641, templateParams: !637, identifier: "1174a86fa23a90bb9338798d86b9144b") +!641 = !{!642} +!642 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !640, file: !5, baseType: !535, size: 32, align: 32, offset: 32, flags: DIFlagPublic) +!643 = !DIDerivedType(tag: DW_TAG_member, scope: !631, file: !5, baseType: !535, size: 32, align: 32, flags: DIFlagArtificial) +!644 = !DIDerivedType(tag: DW_TAG_member, name: "iteration", scope: !620, file: !5, baseType: !535, size: 32, align: 32, offset: 9696, flags: DIFlagPrivate) +!645 = !DIDerivedType(tag: DW_TAG_member, name: "state", scope: !620, file: !5, baseType: !646, size: 192, align: 64, offset: 128, flags: DIFlagPrivate) +!646 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "EvaluationState>", scope: !615, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !647, templateParams: !46, identifier: "a87e1097ab6add42183b1a7b5ce2c22a") +!647 = !{!648} +!648 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !646, file: !5, size: 192, align: 64, elements: !649, templateParams: !46, identifier: "964a46dc5f7d0161aef9349b825f4d3c", discriminator: !703) +!649 = !{!650, !654, !656, !660, !662} +!650 = !DIDerivedType(tag: DW_TAG_member, name: "Start", scope: !648, file: !5, baseType: !651, size: 192, align: 64, extraData: i128 13) +!651 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Start", scope: !646, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !652, templateParams: !204, identifier: "676f580c535a7a6db58a5a99c5a2c2d8") +!652 = !{!653} +!653 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !651, file: !5, baseType: !178, size: 128, align: 64, offset: 64, flags: DIFlagPrivate) +!654 = !DIDerivedType(tag: DW_TAG_member, name: "Ready", scope: !648, file: !5, baseType: !655, size: 192, align: 64, extraData: i128 14) +!655 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Ready", scope: !646, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !46, templateParams: !204, identifier: "65ad2c990c0611a1db46a27501104448") +!656 = !DIDerivedType(tag: DW_TAG_member, name: "Error", scope: !648, file: !5, baseType: !657, size: 192, align: 64, extraData: i128 15) +!657 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Error", scope: !646, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !658, templateParams: !204, identifier: "dc65c3743b7b42cd171e919a2e16d7b") +!658 = !{!659} +!659 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !657, file: !5, baseType: !315, size: 128, align: 64, offset: 64, flags: DIFlagPrivate) +!660 = !DIDerivedType(tag: DW_TAG_member, name: "Complete", scope: !648, file: !5, baseType: !661, size: 192, align: 64, extraData: i128 16) +!661 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Complete", scope: !646, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !46, templateParams: !204, identifier: "9bbe3d1f49a3210198c8587f4e96fb03") +!662 = !DIDerivedType(tag: DW_TAG_member, name: "Waiting", scope: !648, file: !5, baseType: !663, size: 192, align: 64) +!663 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Waiting", scope: !646, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !664, templateParams: !204, identifier: "584797001e661d96746ac8ed6d5724a6") +!664 = !{!665} +!665 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !663, file: !5, baseType: !666, size: 192, align: 64, flags: DIFlagPrivate) +!666 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "EvaluationWaiting>", scope: !615, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !667, templateParams: !46, identifier: "54f4ef87ee3afe1d13a2fe921d99fd24") +!667 = !{!668} +!668 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !666, file: !5, size: 192, align: 64, elements: !669, templateParams: !46, identifier: "f00c533ddc4d77e115b3ad4cb5c15280", discriminator: !702) +!669 = !{!670, !672, !676, !680, !682, !684, !686, !688, !690, !692, !694, !698, !700} +!670 = !DIDerivedType(tag: DW_TAG_member, name: "Memory", scope: !668, file: !5, baseType: !671, size: 192, align: 64, extraData: i128 0) +!671 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Memory", scope: !666, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !46, templateParams: !204, identifier: "60f0e96ff64536f4e22d06b39e5a1767") +!672 = !DIDerivedType(tag: DW_TAG_member, name: "Register", scope: !668, file: !5, baseType: !673, size: 192, align: 64, extraData: i128 1) +!673 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Register", scope: !666, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !674, templateParams: !204, identifier: "f6217dc77671182d67f76e991ad0d34") +!674 = !{!675} +!675 = !DIDerivedType(tag: DW_TAG_member, name: "offset", scope: !673, file: !5, baseType: !113, size: 64, align: 64, offset: 64, flags: DIFlagPrivate) +!676 = !DIDerivedType(tag: DW_TAG_member, name: "FrameBase", scope: !668, file: !5, baseType: !677, size: 192, align: 64, extraData: i128 2) +!677 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "FrameBase", scope: !666, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !678, templateParams: !204, identifier: "204f299ba7b55659430baa961a704123") +!678 = !{!679} +!679 = !DIDerivedType(tag: DW_TAG_member, name: "offset", scope: !677, file: !5, baseType: !113, size: 64, align: 64, offset: 64, flags: DIFlagPrivate) +!680 = !DIDerivedType(tag: DW_TAG_member, name: "Tls", scope: !668, file: !5, baseType: !681, size: 192, align: 64, extraData: i128 3) +!681 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Tls", scope: !666, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !46, templateParams: !204, identifier: "f74f40e6e4e01256a41b6afde7f8c13") +!682 = !DIDerivedType(tag: DW_TAG_member, name: "Cfa", scope: !668, file: !5, baseType: !683, size: 192, align: 64, extraData: i128 4) +!683 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Cfa", scope: !666, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !46, templateParams: !204, identifier: "1cc7f11b0e59e14dc1f82774fcaf9f50") +!684 = !DIDerivedType(tag: DW_TAG_member, name: "AtLocation", scope: !668, file: !5, baseType: !685, size: 192, align: 64, extraData: i128 5) +!685 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "AtLocation", scope: !666, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !46, templateParams: !204, identifier: "38d703a8ecd90730b9598d5d108a58c7") +!686 = !DIDerivedType(tag: DW_TAG_member, name: "EntryValue", scope: !668, file: !5, baseType: !687, size: 192, align: 64, extraData: i128 6) +!687 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "EntryValue", scope: !666, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !46, templateParams: !204, identifier: "18ccb8cef0642e8bb7e43041978cd5a2") +!688 = !DIDerivedType(tag: DW_TAG_member, name: "ParameterRef", scope: !668, file: !5, baseType: !689, size: 192, align: 64, extraData: i128 7) +!689 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ParameterRef", scope: !666, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !46, templateParams: !204, identifier: "98799c88bea54fd8e71d4d352afe0a60") +!690 = !DIDerivedType(tag: DW_TAG_member, name: "RelocatedAddress", scope: !668, file: !5, baseType: !691, size: 192, align: 64, extraData: i128 8) +!691 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RelocatedAddress", scope: !666, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !46, templateParams: !204, identifier: "681574cd255ae76c95f580792b7e3324") +!692 = !DIDerivedType(tag: DW_TAG_member, name: "IndexedAddress", scope: !668, file: !5, baseType: !693, size: 192, align: 64, extraData: i128 9) +!693 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "IndexedAddress", scope: !666, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !46, templateParams: !204, identifier: "8ef93144f1a4ce7466f498c65e53f78d") +!694 = !DIDerivedType(tag: DW_TAG_member, name: "TypedLiteral", scope: !668, file: !5, baseType: !695, size: 192, align: 64, extraData: i128 10) +!695 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "TypedLiteral", scope: !666, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !696, templateParams: !204, identifier: "950b11aa2ef5d8eac4d1b8c044c1c8ff") +!696 = !{!697} +!697 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !695, file: !5, baseType: !120, size: 128, align: 64, offset: 64, flags: DIFlagPrivate) +!698 = !DIDerivedType(tag: DW_TAG_member, name: "Convert", scope: !668, file: !5, baseType: !699, size: 192, align: 64, extraData: i128 11) +!699 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Convert", scope: !666, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !46, templateParams: !204, identifier: "ce96d5537bd6c4694efd5485edbf7a81") +!700 = !DIDerivedType(tag: DW_TAG_member, name: "Reinterpret", scope: !668, file: !5, baseType: !701, size: 192, align: 64, extraData: i128 12) +!701 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Reinterpret", scope: !666, file: !5, size: 192, align: 64, flags: DIFlagPrivate, elements: !46, templateParams: !204, identifier: "4ec3c0dfd90d332fd315c26b2bb8be1") +!702 = !DIDerivedType(tag: DW_TAG_member, scope: !666, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagArtificial) +!703 = !DIDerivedType(tag: DW_TAG_member, scope: !646, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagArtificial) +!704 = !DIDerivedType(tag: DW_TAG_member, name: "addr_mask", scope: !620, file: !5, baseType: !90, size: 64, align: 64, offset: 768, flags: DIFlagPrivate) +!705 = !DIDerivedType(tag: DW_TAG_member, name: "stack", scope: !620, file: !5, baseType: !706, size: 8256, align: 64, offset: 832, flags: DIFlagPrivate) +!706 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ArrayVec<[gimli::read::value::Value; 64]>", scope: !237, file: !5, size: 8256, align: 64, flags: DIFlagProtected, elements: !707, templateParams: !776, identifier: "ae126a3705f435911648edbf2c5ecbbc") +!707 = !{!708, !775} +!708 = !DIDerivedType(tag: DW_TAG_member, name: "storage", scope: !706, file: !5, baseType: !709, size: 8192, align: 64, flags: DIFlagPrivate) +!709 = !DICompositeType(tag: DW_TAG_array_type, baseType: !710, size: 8192, align: 64, elements: !773) +!710 = distinct !DICompositeType(tag: DW_TAG_union_type, name: "MaybeUninit", scope: !242, file: !5, size: 128, align: 64, elements: !711, templateParams: !771, identifier: "2f3d34f66e72ebe9405ea41c59f10b3e") +!711 = !{!712, !713} +!712 = !DIDerivedType(tag: DW_TAG_member, name: "uninit", scope: !710, file: !5, baseType: !246, align: 8) +!713 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !710, file: !5, baseType: !714, size: 128, align: 64) +!714 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ManuallyDrop", scope: !249, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !715, templateParams: !771, identifier: "fb28eeb8aae47bc0c4a1c0f3b1cb482b") +!715 = !{!716} +!716 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !714, file: !5, baseType: !717, size: 128, align: 64, flags: DIFlagPrivate) +!717 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Value", scope: !718, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !719, templateParams: !46, identifier: "449f2092324ba7422f77464ef34843c0") +!718 = !DINamespace(name: "value", scope: !17) +!719 = !{!720} +!720 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !717, file: !5, size: 128, align: 64, elements: !721, templateParams: !46, identifier: "68c86d4974102053f5e2c86d31812aa6", discriminator: !770) +!721 = !{!722, !726, !730, !734, !739, !743, !748, !752, !756, !760, !765} +!722 = !DIDerivedType(tag: DW_TAG_member, name: "Generic", scope: !720, file: !5, baseType: !723, size: 128, align: 64, extraData: i128 0) +!723 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Generic", scope: !717, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !724, templateParams: !46, identifier: "aded9ad7d102fa3d3f7c711747aa177f") +!724 = !{!725} +!725 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !723, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!726 = !DIDerivedType(tag: DW_TAG_member, name: "I8", scope: !720, file: !5, baseType: !727, size: 128, align: 64, extraData: i128 1) +!727 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "I8", scope: !717, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !728, templateParams: !46, identifier: "b7e241735c2437539ef217967df198d5") +!728 = !{!729} +!729 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !727, file: !5, baseType: !581, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!730 = !DIDerivedType(tag: DW_TAG_member, name: "U8", scope: !720, file: !5, baseType: !731, size: 128, align: 64, extraData: i128 2) +!731 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "U8", scope: !717, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !732, templateParams: !46, identifier: "235cabb3f8c8ea232e140126fb0f84") +!732 = !{!733} +!733 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !731, file: !5, baseType: !26, size: 8, align: 8, offset: 8, flags: DIFlagPublic) +!734 = !DIDerivedType(tag: DW_TAG_member, name: "I16", scope: !720, file: !5, baseType: !735, size: 128, align: 64, extraData: i128 3) +!735 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "I16", scope: !717, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !736, templateParams: !46, identifier: "dcfa782be57e9cc55e549bb113b04a06") +!736 = !{!737} +!737 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !735, file: !5, baseType: !738, size: 16, align: 16, offset: 16, flags: DIFlagPublic) +!738 = !DIBasicType(name: "i16", size: 16, encoding: DW_ATE_signed) +!739 = !DIDerivedType(tag: DW_TAG_member, name: "U16", scope: !720, file: !5, baseType: !740, size: 128, align: 64, extraData: i128 4) +!740 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "U16", scope: !717, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !741, templateParams: !46, identifier: "f05631058507a1c5a5bf2d6cc5754e47") +!741 = !{!742} +!742 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !740, file: !5, baseType: !118, size: 16, align: 16, offset: 16, flags: DIFlagPublic) +!743 = !DIDerivedType(tag: DW_TAG_member, name: "I32", scope: !720, file: !5, baseType: !744, size: 128, align: 64, extraData: i128 5) +!744 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "I32", scope: !717, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !745, templateParams: !46, identifier: "d2b5ebdf257a9ced33cecf5822df487f") +!745 = !{!746} +!746 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !744, file: !5, baseType: !747, size: 32, align: 32, offset: 32, flags: DIFlagPublic) +!747 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_signed) +!748 = !DIDerivedType(tag: DW_TAG_member, name: "U32", scope: !720, file: !5, baseType: !749, size: 128, align: 64, extraData: i128 6) +!749 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "U32", scope: !717, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !750, templateParams: !46, identifier: "34e90881764c38957273f3906eba341e") +!750 = !{!751} +!751 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !749, file: !5, baseType: !535, size: 32, align: 32, offset: 32, flags: DIFlagPublic) +!752 = !DIDerivedType(tag: DW_TAG_member, name: "I64", scope: !720, file: !5, baseType: !753, size: 128, align: 64, extraData: i128 7) +!753 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "I64", scope: !717, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !754, templateParams: !46, identifier: "30d890c34543c5fdd47c6eb9c24adb3d") +!754 = !{!755} +!755 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !753, file: !5, baseType: !113, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!756 = !DIDerivedType(tag: DW_TAG_member, name: "U64", scope: !720, file: !5, baseType: !757, size: 128, align: 64, extraData: i128 8) +!757 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "U64", scope: !717, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !758, templateParams: !46, identifier: "8c8d09ef3a30b56e8997e64f4a4a569d") +!758 = !{!759} +!759 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !757, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!760 = !DIDerivedType(tag: DW_TAG_member, name: "F32", scope: !720, file: !5, baseType: !761, size: 128, align: 64, extraData: i128 9) +!761 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "F32", scope: !717, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !762, templateParams: !46, identifier: "b561c863896d760d8a61fadefdeec708") +!762 = !{!763} +!763 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !761, file: !5, baseType: !764, size: 32, align: 32, offset: 32, flags: DIFlagPublic) +!764 = !DIBasicType(name: "f32", size: 32, encoding: DW_ATE_float) +!765 = !DIDerivedType(tag: DW_TAG_member, name: "F64", scope: !720, file: !5, baseType: !766, size: 128, align: 64, extraData: i128 10) +!766 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "F64", scope: !717, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !767, templateParams: !46, identifier: "833cddc71cbeff4994a97bcd2953d5e9") +!767 = !{!768} +!768 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !766, file: !5, baseType: !769, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!769 = !DIBasicType(name: "f64", size: 64, encoding: DW_ATE_float) +!770 = !DIDerivedType(tag: DW_TAG_member, scope: !717, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagArtificial) +!771 = !{!772} +!772 = !DITemplateTypeParameter(name: "T", type: !717) +!773 = !{!774} +!774 = !DISubrange(count: 64, lowerBound: 0) +!775 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !706, file: !5, baseType: !21, size: 64, align: 64, offset: 8192, flags: DIFlagPrivate) +!776 = !{!777} +!777 = !DITemplateTypeParameter(name: "A", type: !778) +!778 = !DICompositeType(tag: DW_TAG_array_type, baseType: !717, size: 8192, align: 64, elements: !773) +!779 = !DIDerivedType(tag: DW_TAG_member, name: "pc", scope: !620, file: !5, baseType: !120, size: 128, align: 64, offset: 640, flags: DIFlagPrivate) +!780 = !DIDerivedType(tag: DW_TAG_member, name: "expression_stack", scope: !620, file: !5, baseType: !781, size: 64, align: 64, offset: 9088, flags: DIFlagPrivate) +!781 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ArrayVec<[(gimli::read::endian_slice::EndianSlice, gimli::read::endian_slice::EndianSlice); 0]>", scope: !237, file: !5, size: 64, align: 64, flags: DIFlagProtected, elements: !782, templateParams: !801, identifier: "8d9c2b45a9b65c919587001001717f17") +!782 = !{!783, !800} +!783 = !DIDerivedType(tag: DW_TAG_member, name: "storage", scope: !781, file: !5, baseType: !784, align: 64, flags: DIFlagPrivate) +!784 = !DICompositeType(tag: DW_TAG_array_type, baseType: !785, align: 64, elements: !798) +!785 = distinct !DICompositeType(tag: DW_TAG_union_type, name: "MaybeUninit<(gimli::read::endian_slice::EndianSlice, gimli::read::endian_slice::EndianSlice)>", scope: !242, file: !5, size: 256, align: 64, elements: !786, templateParams: !796, identifier: "b96b05b25060709f1f9ba7dbb105f622") +!786 = !{!787, !788} +!787 = !DIDerivedType(tag: DW_TAG_member, name: "uninit", scope: !785, file: !5, baseType: !246, align: 8) +!788 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !785, file: !5, baseType: !789, size: 256, align: 64) +!789 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ManuallyDrop<(gimli::read::endian_slice::EndianSlice, gimli::read::endian_slice::EndianSlice)>", scope: !249, file: !5, size: 256, align: 64, flags: DIFlagPublic, elements: !790, templateParams: !796, identifier: "5ab52ed8045fcd3b3de870a7f5e8be9c") +!790 = !{!791} +!791 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !789, file: !5, baseType: !792, size: 256, align: 64, flags: DIFlagPrivate) +!792 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "(gimli::read::endian_slice::EndianSlice, gimli::read::endian_slice::EndianSlice)", file: !5, size: 256, align: 64, elements: !793, templateParams: !46, identifier: "120acc42d3a3b94d11c3bb50c5e39835") +!793 = !{!794, !795} +!794 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !792, file: !5, baseType: !120, size: 128, align: 64) +!795 = !DIDerivedType(tag: DW_TAG_member, name: "__1", scope: !792, file: !5, baseType: !120, size: 128, align: 64, offset: 128) +!796 = !{!797} +!797 = !DITemplateTypeParameter(name: "T", type: !792) +!798 = !{!799} +!799 = !DISubrange(count: 0, lowerBound: 0) +!800 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !781, file: !5, baseType: !21, size: 64, align: 64, flags: DIFlagPrivate) +!801 = !{!802} +!802 = !DITemplateTypeParameter(name: "A", type: !803) +!803 = !DICompositeType(tag: DW_TAG_array_type, baseType: !792, align: 64, elements: !798) +!804 = !DIDerivedType(tag: DW_TAG_member, name: "value_result", scope: !620, file: !5, baseType: !805, size: 128, align: 64, offset: 384, flags: DIFlagPrivate) +!805 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Option", scope: !39, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !806, templateParams: !46, identifier: "e1364e1d42e393154265328f988592b1") +!806 = !{!807} +!807 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !805, file: !5, size: 128, align: 64, elements: !808, templateParams: !46, identifier: "2963a62c96890b42de64d3f49ad31868", discriminator: !815) +!808 = !{!809, !811} +!809 = !DIDerivedType(tag: DW_TAG_member, name: "None", scope: !807, file: !5, baseType: !810, size: 128, align: 64, extraData: i128 11) +!810 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "None", scope: !805, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !771, identifier: "2683f935a05e998d96e137521e8b07c3") +!811 = !DIDerivedType(tag: DW_TAG_member, name: "Some", scope: !807, file: !5, baseType: !812, size: 128, align: 64) +!812 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Some", scope: !805, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !813, templateParams: !771, identifier: "5d048e646ac07fd732c4ffd8213bf634") +!813 = !{!814} +!814 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !812, file: !5, baseType: !717, size: 128, align: 64, flags: DIFlagPublic) +!815 = !DIDerivedType(tag: DW_TAG_member, scope: !805, file: !5, baseType: !26, size: 8, align: 8, flags: DIFlagArtificial) +!816 = !DIDerivedType(tag: DW_TAG_member, name: "result", scope: !620, file: !5, baseType: !817, size: 512, align: 64, offset: 9152, flags: DIFlagPrivate) +!817 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ArrayVec<[gimli::read::op::Piece, usize>; 1]>", scope: !237, file: !5, size: 512, align: 64, flags: DIFlagProtected, elements: !818, templateParams: !869, identifier: "a656b8eefdf176ad8e0ebffbfe315302") +!818 = !{!819, !868} +!819 = !DIDerivedType(tag: DW_TAG_member, name: "storage", scope: !817, file: !5, baseType: !820, size: 448, align: 64, flags: DIFlagPrivate) +!820 = !DICompositeType(tag: DW_TAG_array_type, baseType: !821, size: 448, align: 64, elements: !866) +!821 = distinct !DICompositeType(tag: DW_TAG_union_type, name: "MaybeUninit, usize>>", scope: !242, file: !5, size: 448, align: 64, elements: !822, templateParams: !864, identifier: "2530b61c20edfb23a48f57d629ac63e3") +!822 = !{!823, !824} +!823 = !DIDerivedType(tag: DW_TAG_member, name: "uninit", scope: !821, file: !5, baseType: !246, align: 8) +!824 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !821, file: !5, baseType: !825, size: 448, align: 64) +!825 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ManuallyDrop, usize>>", scope: !249, file: !5, size: 448, align: 64, flags: DIFlagPublic, elements: !826, templateParams: !864, identifier: "82751d4c9232c7ab6fbf72d12a97f018") +!826 = !{!827} +!827 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !825, file: !5, baseType: !828, size: 448, align: 64, flags: DIFlagPrivate) +!828 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Piece, usize>", scope: !615, file: !5, size: 448, align: 64, flags: DIFlagPublic, elements: !829, templateParams: !134, identifier: "d1f755cca082fc24287af19e88191dcf") +!829 = !{!830, !831, !832} +!830 = !DIDerivedType(tag: DW_TAG_member, name: "size_in_bits", scope: !828, file: !5, baseType: !178, size: 128, align: 64, flags: DIFlagPublic) +!831 = !DIDerivedType(tag: DW_TAG_member, name: "bit_offset", scope: !828, file: !5, baseType: !178, size: 128, align: 64, offset: 128, flags: DIFlagPublic) +!832 = !DIDerivedType(tag: DW_TAG_member, name: "location", scope: !828, file: !5, baseType: !833, size: 192, align: 64, offset: 256, flags: DIFlagPublic) +!833 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Location, usize>", scope: !615, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !834, templateParams: !46, identifier: "d395133be8e29139e6d036a34ad208b9") +!834 = !{!835} +!835 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !833, file: !5, size: 192, align: 64, elements: !836, templateParams: !46, identifier: "55c2436db36ecc04a2c666eb5b859a4c", discriminator: !863) +!836 = !{!837, !839, !843, !847, !851, !855} +!837 = !DIDerivedType(tag: DW_TAG_member, name: "Empty", scope: !835, file: !5, baseType: !838, size: 192, align: 64, extraData: i128 0) +!838 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Empty", scope: !833, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !134, identifier: "b49e8bb1f2f8602041a87566dbfb91d2") +!839 = !DIDerivedType(tag: DW_TAG_member, name: "Register", scope: !835, file: !5, baseType: !840, size: 192, align: 64, extraData: i128 1) +!840 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Register", scope: !833, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !841, templateParams: !134, identifier: "7eec3de9d20d4cc0862ee3fa2252804e") +!841 = !{!842} +!842 = !DIDerivedType(tag: DW_TAG_member, name: "register", scope: !840, file: !5, baseType: !115, size: 16, align: 16, offset: 16, flags: DIFlagPublic) +!843 = !DIDerivedType(tag: DW_TAG_member, name: "Address", scope: !835, file: !5, baseType: !844, size: 192, align: 64, extraData: i128 2) +!844 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Address", scope: !833, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !845, templateParams: !134, identifier: "ea4da798d514389ff4fefeb6e23e4cb7") +!845 = !{!846} +!846 = !DIDerivedType(tag: DW_TAG_member, name: "address", scope: !844, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!847 = !DIDerivedType(tag: DW_TAG_member, name: "Value", scope: !835, file: !5, baseType: !848, size: 192, align: 64, extraData: i128 3) +!848 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Value", scope: !833, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !849, templateParams: !134, identifier: "d10a76e8b53088f5d90ae0638223103") +!849 = !{!850} +!850 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !848, file: !5, baseType: !717, size: 128, align: 64, offset: 64, flags: DIFlagPublic) +!851 = !DIDerivedType(tag: DW_TAG_member, name: "Bytes", scope: !835, file: !5, baseType: !852, size: 192, align: 64, extraData: i128 4) +!852 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Bytes", scope: !833, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !853, templateParams: !134, identifier: "b8af572c2d30f325beba0759bb7b15bc") +!853 = !{!854} +!854 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !852, file: !5, baseType: !120, size: 128, align: 64, offset: 64, flags: DIFlagPublic) +!855 = !DIDerivedType(tag: DW_TAG_member, name: "ImplicitPointer", scope: !835, file: !5, baseType: !856, size: 192, align: 64, extraData: i128 5) +!856 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "ImplicitPointer", scope: !833, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !857, templateParams: !134, identifier: "bdbf25dabffeb5d0679ee8e169accba1") +!857 = !{!858, !862} +!858 = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: !856, file: !5, baseType: !859, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!859 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DebugInfoOffset", scope: !25, file: !5, size: 64, align: 64, flags: DIFlagPublic, elements: !860, templateParams: !221, identifier: "240ef1e2d1384c4db51fe4b33cb864ae") +!860 = !{!861} +!861 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !859, file: !5, baseType: !21, size: 64, align: 64, flags: DIFlagPublic) +!862 = !DIDerivedType(tag: DW_TAG_member, name: "byte_offset", scope: !856, file: !5, baseType: !113, size: 64, align: 64, offset: 128, flags: DIFlagPublic) +!863 = !DIDerivedType(tag: DW_TAG_member, scope: !833, file: !5, baseType: !118, size: 16, align: 16, flags: DIFlagArtificial) +!864 = !{!865} +!865 = !DITemplateTypeParameter(name: "T", type: !828) +!866 = !{!867} +!867 = !DISubrange(count: 1, lowerBound: 0) +!868 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !817, file: !5, baseType: !21, size: 64, align: 64, offset: 448, flags: DIFlagPrivate) +!869 = !{!870} +!870 = !DITemplateTypeParameter(name: "A", type: !871) +!871 = !DICompositeType(tag: DW_TAG_array_type, baseType: !828, size: 448, align: 64, elements: !866) +!872 = !{!135, !300} +!873 = !DILocalVariable(name: "result", scope: !874, file: !3, line: 87, type: !875, align: 8) +!874 = distinct !DILexicalBlock(scope: !619, file: !3, line: 87, column: 9) +!875 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "EvaluationResult>", scope: !615, file: !5, size: 320, align: 64, flags: DIFlagPublic, elements: !876, templateParams: !46, identifier: "51d4bb2ed321c46272ccbeec740b49c") +!876 = !{!877} +!877 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !875, file: !5, size: 320, align: 64, elements: !878, templateParams: !46, identifier: "b5b0d5dbd4679161fe022116a9af800", discriminator: !945) +!878 = !{!879, !881, !891, !896, !898, !902, !904, !921, !925, !929, !933, !941} +!879 = !DIDerivedType(tag: DW_TAG_member, name: "Complete", scope: !877, file: !5, baseType: !880, size: 320, align: 64, extraData: i128 2) +!880 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Complete", scope: !875, file: !5, size: 320, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !204, identifier: "98b5d1403036cb41e2f44cc6ea0efccd") +!881 = !DIDerivedType(tag: DW_TAG_member, name: "RequiresMemory", scope: !877, file: !5, baseType: !882, size: 320, align: 64) +!882 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RequiresMemory", scope: !875, file: !5, size: 320, align: 64, flags: DIFlagPublic, elements: !883, templateParams: !204, identifier: "8003e489afddfa79b3b73f5fc4a14802") +!883 = !{!884, !885, !886, !887} +!884 = !DIDerivedType(tag: DW_TAG_member, name: "address", scope: !882, file: !5, baseType: !90, size: 64, align: 64, offset: 128, flags: DIFlagPublic) +!885 = !DIDerivedType(tag: DW_TAG_member, name: "size", scope: !882, file: !5, baseType: !26, size: 8, align: 8, offset: 256, flags: DIFlagPublic) +!886 = !DIDerivedType(tag: DW_TAG_member, name: "space", scope: !882, file: !5, baseType: !178, size: 128, align: 64, flags: DIFlagPublic) +!887 = !DIDerivedType(tag: DW_TAG_member, name: "base_type", scope: !882, file: !5, baseType: !888, size: 64, align: 64, offset: 192, flags: DIFlagPublic) +!888 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnitOffset", scope: !17, file: !5, size: 64, align: 64, flags: DIFlagPublic, elements: !889, templateParams: !221, identifier: "da1d24a786a32ca5ac7efb4fa178ae2b") +!889 = !{!890} +!890 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !888, file: !5, baseType: !21, size: 64, align: 64, flags: DIFlagPublic) +!891 = !DIDerivedType(tag: DW_TAG_member, name: "RequiresRegister", scope: !877, file: !5, baseType: !892, size: 320, align: 64, extraData: i128 4) +!892 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RequiresRegister", scope: !875, file: !5, size: 320, align: 64, flags: DIFlagPublic, elements: !893, templateParams: !204, identifier: "1536d1e70f21cd80ea98159552d5b03") +!893 = !{!894, !895} +!894 = !DIDerivedType(tag: DW_TAG_member, name: "register", scope: !892, file: !5, baseType: !115, size: 16, align: 16, offset: 128, flags: DIFlagPublic) +!895 = !DIDerivedType(tag: DW_TAG_member, name: "base_type", scope: !892, file: !5, baseType: !888, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!896 = !DIDerivedType(tag: DW_TAG_member, name: "RequiresFrameBase", scope: !877, file: !5, baseType: !897, size: 320, align: 64, extraData: i128 5) +!897 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RequiresFrameBase", scope: !875, file: !5, size: 320, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !204, identifier: "aa3ffa474f6042aaf55b84c6e95fc29") +!898 = !DIDerivedType(tag: DW_TAG_member, name: "RequiresTls", scope: !877, file: !5, baseType: !899, size: 320, align: 64, extraData: i128 6) +!899 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RequiresTls", scope: !875, file: !5, size: 320, align: 64, flags: DIFlagPublic, elements: !900, templateParams: !204, identifier: "b1e8d9ef29a993fcbf2f73f7de6e296b") +!900 = !{!901} +!901 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !899, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!902 = !DIDerivedType(tag: DW_TAG_member, name: "RequiresCallFrameCfa", scope: !877, file: !5, baseType: !903, size: 320, align: 64, extraData: i128 7) +!903 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RequiresCallFrameCfa", scope: !875, file: !5, size: 320, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !204, identifier: "72816062d26fd7b762fb5e5ed129ff2") +!904 = !DIDerivedType(tag: DW_TAG_member, name: "RequiresAtLocation", scope: !877, file: !5, baseType: !905, size: 320, align: 64, extraData: i128 8) +!905 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RequiresAtLocation", scope: !875, file: !5, size: 320, align: 64, flags: DIFlagPublic, elements: !906, templateParams: !204, identifier: "2af96c961b57c627b47a5a74aa0f23eb") +!906 = !{!907} +!907 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !905, file: !5, baseType: !908, size: 128, align: 64, offset: 64, flags: DIFlagPublic) +!908 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DieReference", scope: !615, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !909, templateParams: !46, identifier: "634c048e6d97d42d69a1dd4c2a2b8d27") +!909 = !{!910} +!910 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !908, file: !5, size: 128, align: 64, elements: !911, templateParams: !46, identifier: "8970939422a637ddea811e213749faa", discriminator: !920) +!911 = !{!912, !916} +!912 = !DIDerivedType(tag: DW_TAG_member, name: "UnitRef", scope: !910, file: !5, baseType: !913, size: 128, align: 64, extraData: i128 0) +!913 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnitRef", scope: !908, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !914, templateParams: !221, identifier: "a26a62911cf741a4d4a44e27f0a5ed51") +!914 = !{!915} +!915 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !913, file: !5, baseType: !888, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!916 = !DIDerivedType(tag: DW_TAG_member, name: "DebugInfoRef", scope: !910, file: !5, baseType: !917, size: 128, align: 64, extraData: i128 1) +!917 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DebugInfoRef", scope: !908, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !918, templateParams: !221, identifier: "301c17503a4b73a819dffa9d3ff4f17") +!918 = !{!919} +!919 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !917, file: !5, baseType: !859, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!920 = !DIDerivedType(tag: DW_TAG_member, scope: !908, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagArtificial) +!921 = !DIDerivedType(tag: DW_TAG_member, name: "RequiresEntryValue", scope: !877, file: !5, baseType: !922, size: 320, align: 64, extraData: i128 9) +!922 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RequiresEntryValue", scope: !875, file: !5, size: 320, align: 64, flags: DIFlagPublic, elements: !923, templateParams: !204, identifier: "faa1a56431d594ba83847c61cba8413e") +!923 = !{!924} +!924 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !922, file: !5, baseType: !614, size: 128, align: 64, offset: 64, flags: DIFlagPublic) +!925 = !DIDerivedType(tag: DW_TAG_member, name: "RequiresParameterRef", scope: !877, file: !5, baseType: !926, size: 320, align: 64, extraData: i128 10) +!926 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RequiresParameterRef", scope: !875, file: !5, size: 320, align: 64, flags: DIFlagPublic, elements: !927, templateParams: !204, identifier: "49d532a26f9036eb3e31efa5492676d5") +!927 = !{!928} +!928 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !926, file: !5, baseType: !888, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!929 = !DIDerivedType(tag: DW_TAG_member, name: "RequiresRelocatedAddress", scope: !877, file: !5, baseType: !930, size: 320, align: 64, extraData: i128 11) +!930 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RequiresRelocatedAddress", scope: !875, file: !5, size: 320, align: 64, flags: DIFlagPublic, elements: !931, templateParams: !204, identifier: "6113feb90ddaa61b8e4c18f58521fe69") +!931 = !{!932} +!932 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !930, file: !5, baseType: !90, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!933 = !DIDerivedType(tag: DW_TAG_member, name: "RequiresIndexedAddress", scope: !877, file: !5, baseType: !934, size: 320, align: 64, extraData: i128 12) +!934 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RequiresIndexedAddress", scope: !875, file: !5, size: 320, align: 64, flags: DIFlagPublic, elements: !935, templateParams: !204, identifier: "c88ebe4f9abcc34adc5bed282975fd47") +!935 = !{!936, !940} +!936 = !DIDerivedType(tag: DW_TAG_member, name: "index", scope: !934, file: !5, baseType: !937, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!937 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "DebugAddrIndex", scope: !25, file: !5, size: 64, align: 64, flags: DIFlagPublic, elements: !938, templateParams: !221, identifier: "ab8b077a231ba172fd0f54a5426fad2b") +!938 = !{!939} +!939 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !937, file: !5, baseType: !21, size: 64, align: 64, flags: DIFlagPublic) +!940 = !DIDerivedType(tag: DW_TAG_member, name: "relocate", scope: !934, file: !5, baseType: !103, size: 8, align: 8, offset: 128, flags: DIFlagPublic) +!941 = !DIDerivedType(tag: DW_TAG_member, name: "RequiresBaseType", scope: !877, file: !5, baseType: !942, size: 320, align: 64, extraData: i128 13) +!942 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "RequiresBaseType", scope: !875, file: !5, size: 320, align: 64, flags: DIFlagPublic, elements: !943, templateParams: !204, identifier: "737c9cc6266a1749293672abd5b69040") +!943 = !{!944} +!944 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !942, file: !5, baseType: !888, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!945 = !DIDerivedType(tag: DW_TAG_member, scope: !875, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagArtificial) +!946 = !DILocalVariable(name: "residual", scope: !947, file: !3, line: 87, type: !948, align: 8) +!947 = distinct !DILexicalBlock(scope: !619, file: !3, line: 87, column: 41) +!948 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Result", scope: !305, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !949, templateParams: !46, identifier: "919ce7a601fb4a13ba9fff7fa5c31214") +!949 = !{!950} +!950 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !948, file: !5, size: 128, align: 64, elements: !951, templateParams: !46, identifier: "4d9c0f1a76ad6640c91b178b0a25cb6d") +!951 = !{!952, !962} +!952 = !DIDerivedType(tag: DW_TAG_member, name: "Ok", scope: !950, file: !5, baseType: !953, size: 128, align: 64) +!953 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Ok", scope: !948, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !954, templateParams: !960, identifier: "80500a1964edcdf9df1c06fd016a020c") +!954 = !{!955} +!955 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !953, file: !5, baseType: !956, align: 8, flags: DIFlagPublic) +!956 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Infallible", scope: !957, file: !5, align: 8, flags: DIFlagPublic, elements: !958, templateParams: !46, identifier: "64765147ab70b22e683668bfcd1e19c6") +!957 = !DINamespace(name: "convert", scope: !40) +!958 = !{!959} +!959 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !956, file: !5, align: 8, elements: !46, identifier: "7ae49c0d49b0241a817f4820926e50a2") +!960 = !{!961, !314} +!961 = !DITemplateTypeParameter(name: "T", type: !956) +!962 = !DIDerivedType(tag: DW_TAG_member, name: "Err", scope: !950, file: !5, baseType: !963, size: 128, align: 64) +!963 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Err", scope: !948, file: !5, size: 128, align: 64, flags: DIFlagPublic, elements: !964, templateParams: !960, identifier: "b0437e745c7777a31897e0e59bf1640b") +!964 = !{!965} +!965 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !963, file: !5, baseType: !315, size: 128, align: 64, flags: DIFlagPublic) +!966 = !DILocalVariable(name: "val", scope: !967, file: !3, line: 87, type: !875, align: 8) +!967 = distinct !DILexicalBlock(scope: !619, file: !3, line: 87, column: 26) +!968 = !DILocalVariable(name: "address", scope: !969, file: !3, line: 91, type: !90, align: 8) +!969 = distinct !DILexicalBlock(scope: !874, file: !3, line: 91, column: 17) +!970 = !DILocalVariable(name: "value", scope: !971, file: !3, line: 92, type: !21, align: 8) +!971 = distinct !DILexicalBlock(scope: !969, file: !3, line: 92, column: 21) +!972 = !DILocalVariable(name: "residual", scope: !973, file: !3, line: 93, type: !948, align: 8) +!973 = distinct !DILexicalBlock(scope: !971, file: !3, line: 93, column: 81) +!974 = !DILocalVariable(name: "val", scope: !975, file: !3, line: 93, type: !875, align: 8) +!975 = distinct !DILexicalBlock(scope: !971, file: !3, line: 93, column: 30) +!976 = !DILocalVariable(name: "register", scope: !977, file: !3, line: 95, type: !115, align: 2) +!977 = distinct !DILexicalBlock(scope: !874, file: !3, line: 95, column: 17) +!978 = !DILocalVariable(name: "value", scope: !979, file: !3, line: 96, type: !21, align: 8) +!979 = distinct !DILexicalBlock(scope: !977, file: !3, line: 96, column: 21) +!980 = !DILocalVariable(name: "residual", scope: !981, file: !3, line: 97, type: !948, align: 8) +!981 = distinct !DILexicalBlock(scope: !979, file: !3, line: 97, column: 83) +!982 = !DILocalVariable(name: "val", scope: !983, file: !3, line: 97, type: !875, align: 8) +!983 = distinct !DILexicalBlock(scope: !979, file: !3, line: 97, column: 30) +!984 = !DILocalVariable(name: "address", scope: !985, file: !3, line: 99, type: !90, align: 8) +!985 = distinct !DILexicalBlock(scope: !874, file: !3, line: 99, column: 17) +!986 = !DILocalVariable(name: "value", scope: !987, file: !3, line: 100, type: !21, align: 8) +!987 = distinct !DILexicalBlock(scope: !985, file: !3, line: 100, column: 21) +!988 = !DILocalVariable(name: "residual", scope: !989, file: !3, line: 101, type: !948, align: 8) +!989 = distinct !DILexicalBlock(scope: !987, file: !3, line: 101, column: 81) +!990 = !DILocalVariable(name: "val", scope: !991, file: !3, line: 101, type: !875, align: 8) +!991 = distinct !DILexicalBlock(scope: !987, file: !3, line: 101, column: 30) +!992 = !DILocalVariable(name: "residual", scope: !993, file: !3, line: 111, type: !948, align: 8) +!993 = distinct !DILexicalBlock(scope: !874, file: !3, line: 111, column: 56) +!994 = !DILocalVariable(name: "val", scope: !995, file: !3, line: 108, type: !996, align: 8) +!995 = distinct !DILexicalBlock(scope: !874, file: !3, line: 108, column: 19) +!996 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "&gimli::read::op::Piece, usize>", baseType: !828, size: 64, align: 64, dwarfAddressSpace: 0) +!997 = !DILocalVariable(name: "address", scope: !998, file: !3, line: 114, type: !90, align: 8) +!998 = distinct !DILexicalBlock(scope: !874, file: !3, line: 114, column: 17) +!999 = !DILocation(line: 1102, column: 23, scope: !1000, inlinedAt: !1038) +!1000 = distinct !DILexicalBlock(scope: !1002, file: !1001, line: 1102, column: 13) +!1001 = !DIFile(filename: "/rustc/636d7ff91b9847d6d43c7bbe023568828f6e3246/library/core/src/result.rs", directory: "", checksumkind: CSK_MD5, checksum: "13dbc19e8bd386b8c9d62247cee85b56") +!1002 = distinct !DISubprogram(name: "unwrap>, gimli::read::Error>", linkageName: "_ZN4core6result19Result$LT$T$C$E$GT$6unwrap17h14fd7c0569eb842aE", scope: !1003, file: !1001, line: 1096, type: !1018, scopeLine: 1096, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !564, templateParams: !1011, declaration: !1032, retainedNodes: !1033) +!1003 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Result>, gimli::read::Error>", scope: !305, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !1004, templateParams: !46, identifier: "769c6b05a4491edd8f1f7ebaabbcd9ce") +!1004 = !{!1005} +!1005 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !1003, file: !5, size: 192, align: 64, elements: !1006, templateParams: !46, identifier: "f07482fa33f1f68430e7cc41a9027a6b", discriminator: !1017) +!1006 = !{!1007, !1013} +!1007 = !DIDerivedType(tag: DW_TAG_member, name: "Ok", scope: !1005, file: !5, baseType: !1008, size: 192, align: 64, extraData: i128 0) +!1008 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Ok", scope: !1003, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !1009, templateParams: !1011, identifier: "b3503abe43c6c1a92f481dfc52138ec2") +!1009 = !{!1010} +!1010 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !1008, file: !5, baseType: !614, size: 128, align: 64, offset: 64, flags: DIFlagPublic) +!1011 = !{!1012, !314} +!1012 = !DITemplateTypeParameter(name: "T", type: !614) +!1013 = !DIDerivedType(tag: DW_TAG_member, name: "Err", scope: !1005, file: !5, baseType: !1014, size: 192, align: 64, extraData: i128 1) +!1014 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Err", scope: !1003, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !1015, templateParams: !1011, identifier: "4538ee170ef87c5e49ce2f27f79f37a2") +!1015 = !{!1016} +!1016 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !1014, file: !5, baseType: !315, size: 128, align: 64, offset: 64, flags: DIFlagPublic) +!1017 = !DIDerivedType(tag: DW_TAG_member, scope: !1003, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagArtificial) +!1018 = !DISubroutineType(types: !1019) +!1019 = !{!614, !1003, !1020} +!1020 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "&core::panic::location::Location", baseType: !1021, size: 64, align: 64, dwarfAddressSpace: 0) +!1021 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Location", scope: !1022, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !1024, templateParams: !46, identifier: "e063870a552be7101e2bcd793a8716b0") +!1022 = !DINamespace(name: "location", scope: !1023) +!1023 = !DINamespace(name: "panic", scope: !40) +!1024 = !{!1025, !1030, !1031} +!1025 = !DIDerivedType(tag: DW_TAG_member, name: "file", scope: !1021, file: !5, baseType: !1026, size: 128, align: 64, flags: DIFlagPrivate) +!1026 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "&str", file: !5, size: 128, align: 64, elements: !1027, templateParams: !46, identifier: "9277eecd40495f85161460476aacc992") +!1027 = !{!1028, !1029} +!1028 = !DIDerivedType(tag: DW_TAG_member, name: "data_ptr", scope: !1026, file: !5, baseType: !127, size: 64, align: 64) +!1029 = !DIDerivedType(tag: DW_TAG_member, name: "length", scope: !1026, file: !5, baseType: !21, size: 64, align: 64, offset: 64) +!1030 = !DIDerivedType(tag: DW_TAG_member, name: "line", scope: !1021, file: !5, baseType: !535, size: 32, align: 32, offset: 128, flags: DIFlagPrivate) +!1031 = !DIDerivedType(tag: DW_TAG_member, name: "col", scope: !1021, file: !5, baseType: !535, size: 32, align: 32, offset: 160, flags: DIFlagPrivate) +!1032 = !DISubprogram(name: "unwrap>, gimli::read::Error>", linkageName: "_ZN4core6result19Result$LT$T$C$E$GT$6unwrap17h14fd7c0569eb842aE", scope: !1003, file: !1001, line: 1096, type: !1018, scopeLine: 1096, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit, templateParams: !1011) +!1033 = !{!1034, !1035, !1037} +!1034 = !DILocalVariable(name: "self", arg: 1, scope: !1002, file: !1001, line: 1096, type: !1003) +!1035 = !DILocalVariable(name: "t", scope: !1036, file: !1001, line: 1101, type: !614, align: 8) +!1036 = distinct !DILexicalBlock(scope: !1002, file: !1001, line: 1101, column: 13) +!1037 = !DILocalVariable(name: "e", scope: !1000, file: !1001, line: 1102, type: !315, align: 8) +!1038 = distinct !DILocation(line: 84, column: 20, scope: !2) +!1039 = distinct !DISubprogram(name: "_Unwind_Resume", scope: !7, file: !1040, line: 346, type: !1041, scopeLine: 346, flags: DIFlagPrototyped | DIFlagNoReturn, spFlags: DISPFlagDefinition, unit: !564, templateParams: !46, retainedNodes: !1112) +!1040 = !DIFile(filename: "src/unwinder/mod.rs", directory: "/home/dev/ecosystem/unwinding", checksumkind: CSK_MD5, checksum: "0b7cd150e86dd087aeaa8e0e18bae6d9") +!1041 = !DISubroutineType(types: !1042) +!1042 = !{null, !1043} +!1043 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "*mut unwinding::unwinder::UnwindException", baseType: !1044, size: 64, align: 64, dwarfAddressSpace: 0) +!1044 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnwindException", scope: !7, file: !5, size: 256, align: 64, flags: DIFlagPublic, elements: !1045, templateParams: !46, identifier: "f6e359707e96b28f68e0123bb3490311") +!1045 = !{!1046, !1047, !1068, !1109, !1110} +!1046 = !DIDerivedType(tag: DW_TAG_member, name: "exception_class", scope: !1044, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagPublic) +!1047 = !DIDerivedType(tag: DW_TAG_member, name: "exception_cleanup", scope: !1044, file: !5, baseType: !1048, size: 64, align: 64, offset: 64, flags: DIFlagPublic) +!1048 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Option", scope: !39, file: !5, size: 64, align: 64, flags: DIFlagPublic, elements: !1049, templateParams: !46, identifier: "55edbca04b7b79406fe597df5da69fb6") +!1049 = !{!1050} +!1050 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !1048, file: !5, size: 64, align: 64, elements: !1051, templateParams: !46, identifier: "d4ba33946a9e213e48833b2948ffc69a", discriminator: !1067) +!1051 = !{!1052, !1063} +!1052 = !DIDerivedType(tag: DW_TAG_member, name: "None", scope: !1050, file: !5, baseType: !1053, size: 64, align: 64, extraData: i128 0) +!1053 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "None", scope: !1048, file: !5, size: 64, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !1054, identifier: "5f49070303e2d908386f0a327220e7") +!1054 = !{!1055} +!1055 = !DITemplateTypeParameter(name: "T", type: !1056) +!1056 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "unsafe extern \22C\22 fn(unwinding::abi::UnwindReasonCode, *mut unwinding::unwinder::UnwindException)", baseType: !1057, size: 64, align: 64, dwarfAddressSpace: 0) +!1057 = !DISubroutineType(types: !1058) +!1058 = !{null, !1059, !1043} +!1059 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnwindReasonCode", scope: !1060, file: !5, size: 32, align: 32, flags: DIFlagPublic, elements: !1061, templateParams: !46, identifier: "78d1c20b6f4c6f13f91e6941a59e3070") +!1060 = !DINamespace(name: "abi", scope: !8) +!1061 = !{!1062} +!1062 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !1059, file: !5, baseType: !747, size: 32, align: 32, flags: DIFlagPublic) +!1063 = !DIDerivedType(tag: DW_TAG_member, name: "Some", scope: !1050, file: !5, baseType: !1064, size: 64, align: 64) +!1064 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Some", scope: !1048, file: !5, size: 64, align: 64, flags: DIFlagPublic, elements: !1065, templateParams: !1054, identifier: "88c5936a7984265e3c9f2ddf1a30acca") +!1065 = !{!1066} +!1066 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !1064, file: !5, baseType: !1056, size: 64, align: 64, flags: DIFlagPublic) +!1067 = !DIDerivedType(tag: DW_TAG_member, scope: !1048, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagArtificial) +!1068 = !DIDerivedType(tag: DW_TAG_member, name: "private_1", scope: !1044, file: !5, baseType: !1069, size: 64, align: 64, offset: 128, flags: DIFlagPrivate) +!1069 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Option unwinding::abi::UnwindReasonCode>", scope: !39, file: !5, size: 64, align: 64, flags: DIFlagPublic, elements: !1070, templateParams: !46, identifier: "3fd0f4ff1cf8b26bfa970433d6b9be1f") +!1070 = !{!1071} +!1071 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !1069, file: !5, size: 64, align: 64, elements: !1072, templateParams: !46, identifier: "c06dd7a3f8e0e4b1f3c073ade268504e", discriminator: !1108) +!1072 = !{!1073, !1104} +!1073 = !DIDerivedType(tag: DW_TAG_member, name: "None", scope: !1071, file: !5, baseType: !1074, size: 64, align: 64, extraData: i128 0) +!1074 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "None", scope: !1069, file: !5, size: 64, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !1075, identifier: "a7907e0a0f03f43538101bc2ae5b0cc9") +!1075 = !{!1076} +!1076 = !DITemplateTypeParameter(name: "T", type: !1077) +!1077 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "unsafe extern \22C\22 fn(i32, unwinding::abi::UnwindAction, u64, *mut unwinding::unwinder::UnwindException, &mut unwinding::unwinder::UnwindContext, *mut core::ffi::c_void) -> unwinding::abi::UnwindReasonCode", baseType: !1078, size: 64, align: 64, dwarfAddressSpace: 0) +!1078 = !DISubroutineType(types: !1079) +!1079 = !{!1059, !747, !1080, !90, !1043, !1083, !1103} +!1080 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnwindAction", scope: !1060, file: !5, size: 32, align: 32, flags: DIFlagPublic, elements: !1081, templateParams: !46, identifier: "364c99c0f0ff127f318feffefcb3c87") +!1081 = !{!1082} +!1082 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !1080, file: !5, baseType: !747, size: 32, align: 32, flags: DIFlagPublic) +!1083 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "&mut unwinding::unwinder::UnwindContext", baseType: !1084, size: 64, align: 64, dwarfAddressSpace: 0) +!1084 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "UnwindContext", scope: !7, file: !5, size: 192, align: 64, flags: DIFlagPublic, elements: !1085, templateParams: !46, identifier: "911f8c19bc1f5e24ad054a625f8be0d6") +!1085 = !{!1086, !1100, !1102} +!1086 = !DIDerivedType(tag: DW_TAG_member, name: "frame", scope: !1084, file: !5, baseType: !1087, size: 64, align: 64, offset: 64, flags: DIFlagPrivate) +!1087 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Option<&unwinding::unwinder::frame::Frame>", scope: !39, file: !5, size: 64, align: 64, flags: DIFlagPublic, elements: !1088, templateParams: !46, identifier: "74fadfe0892d41cd8e0d03eb53ad3e54") +!1088 = !{!1089} +!1089 = distinct !DICompositeType(tag: DW_TAG_variant_part, scope: !1087, file: !5, size: 64, align: 64, elements: !1090, templateParams: !46, identifier: "3f92d1546b9840fa83783ed5018281cd", discriminator: !1099) +!1090 = !{!1091, !1095} +!1091 = !DIDerivedType(tag: DW_TAG_member, name: "None", scope: !1089, file: !5, baseType: !1092, size: 64, align: 64, extraData: i128 0) +!1092 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "None", scope: !1087, file: !5, size: 64, align: 64, flags: DIFlagPublic, elements: !46, templateParams: !1093, identifier: "512ffa16cad01e9d1b32a5885a0360bc") +!1093 = !{!1094} +!1094 = !DITemplateTypeParameter(name: "T", type: !549) +!1095 = !DIDerivedType(tag: DW_TAG_member, name: "Some", scope: !1089, file: !5, baseType: !1096, size: 64, align: 64) +!1096 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Some", scope: !1087, file: !5, size: 64, align: 64, flags: DIFlagPublic, elements: !1097, templateParams: !1093, identifier: "e463cc92afc82dc88438dd3a5d8e906d") +!1097 = !{!1098} +!1098 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !1096, file: !5, baseType: !549, size: 64, align: 64, flags: DIFlagPublic) +!1099 = !DIDerivedType(tag: DW_TAG_member, scope: !1087, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagArtificial) +!1100 = !DIDerivedType(tag: DW_TAG_member, name: "ctx", scope: !1084, file: !5, baseType: !1101, size: 64, align: 64, flags: DIFlagPrivate) +!1101 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "&mut unwinding::unwinder::arch::aarch64::Context", baseType: !551, size: 64, align: 64, dwarfAddressSpace: 0) +!1102 = !DIDerivedType(tag: DW_TAG_member, name: "signal", scope: !1084, file: !5, baseType: !103, size: 8, align: 8, offset: 128, flags: DIFlagPrivate) +!1103 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "*mut core::ffi::c_void", baseType: !586, size: 64, align: 64, dwarfAddressSpace: 0) +!1104 = !DIDerivedType(tag: DW_TAG_member, name: "Some", scope: !1071, file: !5, baseType: !1105, size: 64, align: 64) +!1105 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Some", scope: !1069, file: !5, size: 64, align: 64, flags: DIFlagPublic, elements: !1106, templateParams: !1075, identifier: "757604dfadcc7bc333dd8afe5c3f1b07") +!1106 = !{!1107} +!1107 = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: !1105, file: !5, baseType: !1077, size: 64, align: 64, flags: DIFlagPublic) +!1108 = !DIDerivedType(tag: DW_TAG_member, scope: !1069, file: !5, baseType: !90, size: 64, align: 64, flags: DIFlagArtificial) +!1109 = !DIDerivedType(tag: DW_TAG_member, name: "private_2", scope: !1044, file: !5, baseType: !21, size: 64, align: 64, offset: 192, flags: DIFlagPrivate) +!1110 = !DIDerivedType(tag: DW_TAG_member, name: "private_unused", scope: !1044, file: !5, baseType: !1111, align: 64, offset: 256, flags: DIFlagPrivate) +!1111 = !DICompositeType(tag: DW_TAG_array_type, baseType: !21, align: 64, elements: !798) +!1112 = !{!1113} +!1113 = !DILocalVariable(name: "exception", arg: 1, scope: !1039, file: !1040, line: 346, type: !1043) diff --git a/llvm/test/CodeGen/AArch64/ptrauth-fpac.ll b/llvm/test/CodeGen/AArch64/ptrauth-fpac.ll index 6afe1a93d986e..d5340dcebad57 100644 --- a/llvm/test/CodeGen/AArch64/ptrauth-fpac.ll +++ b/llvm/test/CodeGen/AArch64/ptrauth-fpac.ll @@ -1,12 +1,14 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -mtriple arm64e-apple-darwin -verify-machineinstrs | FileCheck %s --check-prefixes=ALL,NOFPAC -; RUN: llc < %s -mtriple arm64e-apple-darwin -mattr=+fpac -verify-machineinstrs | FileCheck %s --check-prefixes=ALL,FPAC +; RUN: llc < %s -mtriple arm64e-apple-darwin -verify-machineinstrs | FileCheck %s -DL="L" --check-prefixes=ALL,NOFPAC +; RUN: llc < %s -mtriple arm64e-apple-darwin -mattr=+fpac -verify-machineinstrs | FileCheck %s -DL="L" --check-prefixes=ALL,FPAC +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -verify-machineinstrs | FileCheck %s -DL=".L" --check-prefixes=ALL,NOFPAC +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -mattr=+fpac -verify-machineinstrs | FileCheck %s -DL=".L" --check-prefixes=ALL,FPAC target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" define i64 @test_auth_ia(i64 %arg, i64 %arg1) { ; ALL-LABEL: test_auth_ia: -; ALL: ; %bb.0: +; ALL: %bb.0: ; ALL-NEXT: mov x16, x0 ; ALL-NEXT: autia x16, x1 ; ALL-NEXT: mov x0, x16 @@ -17,7 +19,7 @@ define i64 @test_auth_ia(i64 %arg, i64 %arg1) { define i64 @test_auth_ia_zero(i64 %arg) { ; ALL-LABEL: test_auth_ia_zero: -; ALL: ; %bb.0: +; ALL: %bb.0: ; ALL-NEXT: mov x16, x0 ; ALL-NEXT: autiza x16 ; ALL-NEXT: mov x0, x16 @@ -28,7 +30,7 @@ define i64 @test_auth_ia_zero(i64 %arg) { define i64 @test_auth_ib(i64 %arg, i64 %arg1) { ; ALL-LABEL: test_auth_ib: -; ALL: ; %bb.0: +; ALL: %bb.0: ; ALL-NEXT: mov x16, x0 ; ALL-NEXT: autib x16, x1 ; ALL-NEXT: mov x0, x16 @@ -39,7 +41,7 @@ define i64 @test_auth_ib(i64 %arg, i64 %arg1) { define i64 @test_auth_ib_zero(i64 %arg) { ; ALL-LABEL: test_auth_ib_zero: -; ALL: ; %bb.0: +; ALL: %bb.0: ; ALL-NEXT: mov x16, x0 ; ALL-NEXT: autizb x16 ; ALL-NEXT: mov x0, x16 @@ -50,7 +52,7 @@ define i64 @test_auth_ib_zero(i64 %arg) { define i64 @test_auth_da(i64 %arg, i64 %arg1) { ; ALL-LABEL: test_auth_da: -; ALL: ; %bb.0: +; ALL: %bb.0: ; ALL-NEXT: mov x16, x0 ; ALL-NEXT: autda x16, x1 ; ALL-NEXT: mov x0, x16 @@ -61,7 +63,7 @@ define i64 @test_auth_da(i64 %arg, i64 %arg1) { define i64 @test_auth_da_zero(i64 %arg) { ; ALL-LABEL: test_auth_da_zero: -; ALL: ; %bb.0: +; ALL: %bb.0: ; ALL-NEXT: mov x16, x0 ; ALL-NEXT: autdza x16 ; ALL-NEXT: mov x0, x16 @@ -72,7 +74,7 @@ define i64 @test_auth_da_zero(i64 %arg) { define i64 @test_auth_db(i64 %arg, i64 %arg1) { ; ALL-LABEL: test_auth_db: -; ALL: ; %bb.0: +; ALL: %bb.0: ; ALL-NEXT: mov x16, x0 ; ALL-NEXT: autdb x16, x1 ; ALL-NEXT: mov x0, x16 @@ -83,7 +85,7 @@ define i64 @test_auth_db(i64 %arg, i64 %arg1) { define i64 @test_auth_db_zero(i64 %arg) { ; ALL-LABEL: test_auth_db_zero: -; ALL: ; %bb.0: +; ALL: %bb.0: ; ALL-NEXT: mov x16, x0 ; ALL-NEXT: autdzb x16 ; ALL-NEXT: mov x0, x16 @@ -96,15 +98,15 @@ define i64 @test_auth_db_zero(i64 %arg) { ; the validity of a signature. define i64 @test_resign_ia_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-LABEL: test_resign_ia_ia: -; NOFPAC: ; %bb.0: +; NOFPAC: %bb.0: ; NOFPAC-NEXT: mov x16, x0 ; NOFPAC-NEXT: autia x16, x1 ; NOFPAC-NEXT: mov x17, x16 ; NOFPAC-NEXT: xpaci x17 ; NOFPAC-NEXT: cmp x16, x17 -; NOFPAC-NEXT: b.eq Lauth_success_0 +; NOFPAC-NEXT: b.eq [[L]]auth_success_0 ; NOFPAC-NEXT: mov x16, x17 -; NOFPAC-NEXT: b Lresign_end_0 +; NOFPAC-NEXT: b [[L]]resign_end_0 ; NOFPAC-NEXT: Lauth_success_0: ; NOFPAC-NEXT: pacia x16, x2 ; NOFPAC-NEXT: Lresign_end_0: @@ -112,7 +114,7 @@ define i64 @test_resign_ia_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-NEXT: ret ; ; FPAC-LABEL: test_resign_ia_ia: -; FPAC: ; %bb.0: +; FPAC: %bb.0: ; FPAC-NEXT: mov x16, x0 ; FPAC-NEXT: autia x16, x1 ; FPAC-NEXT: pacia x16, x2 @@ -124,15 +126,15 @@ define i64 @test_resign_ia_ia(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_ib_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-LABEL: test_resign_ib_ia: -; NOFPAC: ; %bb.0: +; NOFPAC: %bb.0: ; NOFPAC-NEXT: mov x16, x0 ; NOFPAC-NEXT: autib x16, x1 ; NOFPAC-NEXT: mov x17, x16 ; NOFPAC-NEXT: xpaci x17 ; NOFPAC-NEXT: cmp x16, x17 -; NOFPAC-NEXT: b.eq Lauth_success_1 +; NOFPAC-NEXT: b.eq [[L]]auth_success_1 ; NOFPAC-NEXT: mov x16, x17 -; NOFPAC-NEXT: b Lresign_end_1 +; NOFPAC-NEXT: b [[L]]resign_end_1 ; NOFPAC-NEXT: Lauth_success_1: ; NOFPAC-NEXT: pacia x16, x2 ; NOFPAC-NEXT: Lresign_end_1: @@ -140,7 +142,7 @@ define i64 @test_resign_ib_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-NEXT: ret ; ; FPAC-LABEL: test_resign_ib_ia: -; FPAC: ; %bb.0: +; FPAC: %bb.0: ; FPAC-NEXT: mov x16, x0 ; FPAC-NEXT: autib x16, x1 ; FPAC-NEXT: pacia x16, x2 @@ -152,15 +154,15 @@ define i64 @test_resign_ib_ia(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_da_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-LABEL: test_resign_da_ia: -; NOFPAC: ; %bb.0: +; NOFPAC: %bb.0: ; NOFPAC-NEXT: mov x16, x0 ; NOFPAC-NEXT: autda x16, x1 ; NOFPAC-NEXT: mov x17, x16 ; NOFPAC-NEXT: xpacd x17 ; NOFPAC-NEXT: cmp x16, x17 -; NOFPAC-NEXT: b.eq Lauth_success_2 +; NOFPAC-NEXT: b.eq [[L]]auth_success_2 ; NOFPAC-NEXT: mov x16, x17 -; NOFPAC-NEXT: b Lresign_end_2 +; NOFPAC-NEXT: b [[L]]resign_end_2 ; NOFPAC-NEXT: Lauth_success_2: ; NOFPAC-NEXT: pacia x16, x2 ; NOFPAC-NEXT: Lresign_end_2: @@ -168,7 +170,7 @@ define i64 @test_resign_da_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-NEXT: ret ; ; FPAC-LABEL: test_resign_da_ia: -; FPAC: ; %bb.0: +; FPAC: %bb.0: ; FPAC-NEXT: mov x16, x0 ; FPAC-NEXT: autda x16, x1 ; FPAC-NEXT: pacia x16, x2 @@ -180,15 +182,15 @@ define i64 @test_resign_da_ia(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_db_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-LABEL: test_resign_db_ia: -; NOFPAC: ; %bb.0: +; NOFPAC: %bb.0: ; NOFPAC-NEXT: mov x16, x0 ; NOFPAC-NEXT: autdb x16, x1 ; NOFPAC-NEXT: mov x17, x16 ; NOFPAC-NEXT: xpacd x17 ; NOFPAC-NEXT: cmp x16, x17 -; NOFPAC-NEXT: b.eq Lauth_success_3 +; NOFPAC-NEXT: b.eq [[L]]auth_success_3 ; NOFPAC-NEXT: mov x16, x17 -; NOFPAC-NEXT: b Lresign_end_3 +; NOFPAC-NEXT: b [[L]]resign_end_3 ; NOFPAC-NEXT: Lauth_success_3: ; NOFPAC-NEXT: pacia x16, x2 ; NOFPAC-NEXT: Lresign_end_3: @@ -196,7 +198,7 @@ define i64 @test_resign_db_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-NEXT: ret ; ; FPAC-LABEL: test_resign_db_ia: -; FPAC: ; %bb.0: +; FPAC: %bb.0: ; FPAC-NEXT: mov x16, x0 ; FPAC-NEXT: autdb x16, x1 ; FPAC-NEXT: pacia x16, x2 @@ -208,15 +210,15 @@ define i64 @test_resign_db_ia(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_db_ib(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-LABEL: test_resign_db_ib: -; NOFPAC: ; %bb.0: +; NOFPAC: %bb.0: ; NOFPAC-NEXT: mov x16, x0 ; NOFPAC-NEXT: autdb x16, x1 ; NOFPAC-NEXT: mov x17, x16 ; NOFPAC-NEXT: xpacd x17 ; NOFPAC-NEXT: cmp x16, x17 -; NOFPAC-NEXT: b.eq Lauth_success_4 +; NOFPAC-NEXT: b.eq [[L]]auth_success_4 ; NOFPAC-NEXT: mov x16, x17 -; NOFPAC-NEXT: b Lresign_end_4 +; NOFPAC-NEXT: b [[L]]resign_end_4 ; NOFPAC-NEXT: Lauth_success_4: ; NOFPAC-NEXT: pacib x16, x2 ; NOFPAC-NEXT: Lresign_end_4: @@ -224,7 +226,7 @@ define i64 @test_resign_db_ib(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-NEXT: ret ; ; FPAC-LABEL: test_resign_db_ib: -; FPAC: ; %bb.0: +; FPAC: %bb.0: ; FPAC-NEXT: mov x16, x0 ; FPAC-NEXT: autdb x16, x1 ; FPAC-NEXT: pacib x16, x2 @@ -236,15 +238,15 @@ define i64 @test_resign_db_ib(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_db_da(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-LABEL: test_resign_db_da: -; NOFPAC: ; %bb.0: +; NOFPAC: %bb.0: ; NOFPAC-NEXT: mov x16, x0 ; NOFPAC-NEXT: autdb x16, x1 ; NOFPAC-NEXT: mov x17, x16 ; NOFPAC-NEXT: xpacd x17 ; NOFPAC-NEXT: cmp x16, x17 -; NOFPAC-NEXT: b.eq Lauth_success_5 +; NOFPAC-NEXT: b.eq [[L]]auth_success_5 ; NOFPAC-NEXT: mov x16, x17 -; NOFPAC-NEXT: b Lresign_end_5 +; NOFPAC-NEXT: b [[L]]resign_end_5 ; NOFPAC-NEXT: Lauth_success_5: ; NOFPAC-NEXT: pacda x16, x2 ; NOFPAC-NEXT: Lresign_end_5: @@ -252,7 +254,7 @@ define i64 @test_resign_db_da(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-NEXT: ret ; ; FPAC-LABEL: test_resign_db_da: -; FPAC: ; %bb.0: +; FPAC: %bb.0: ; FPAC-NEXT: mov x16, x0 ; FPAC-NEXT: autdb x16, x1 ; FPAC-NEXT: pacda x16, x2 @@ -264,15 +266,15 @@ define i64 @test_resign_db_da(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_db_db(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-LABEL: test_resign_db_db: -; NOFPAC: ; %bb.0: +; NOFPAC: %bb.0: ; NOFPAC-NEXT: mov x16, x0 ; NOFPAC-NEXT: autdb x16, x1 ; NOFPAC-NEXT: mov x17, x16 ; NOFPAC-NEXT: xpacd x17 ; NOFPAC-NEXT: cmp x16, x17 -; NOFPAC-NEXT: b.eq Lauth_success_6 +; NOFPAC-NEXT: b.eq [[L]]auth_success_6 ; NOFPAC-NEXT: mov x16, x17 -; NOFPAC-NEXT: b Lresign_end_6 +; NOFPAC-NEXT: b [[L]]resign_end_6 ; NOFPAC-NEXT: Lauth_success_6: ; NOFPAC-NEXT: pacdb x16, x2 ; NOFPAC-NEXT: Lresign_end_6: @@ -280,7 +282,7 @@ define i64 @test_resign_db_db(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-NEXT: ret ; ; FPAC-LABEL: test_resign_db_db: -; FPAC: ; %bb.0: +; FPAC: %bb.0: ; FPAC-NEXT: mov x16, x0 ; FPAC-NEXT: autdb x16, x1 ; FPAC-NEXT: pacdb x16, x2 @@ -292,15 +294,15 @@ define i64 @test_resign_db_db(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_iza_db(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-LABEL: test_resign_iza_db: -; NOFPAC: ; %bb.0: +; NOFPAC: %bb.0: ; NOFPAC-NEXT: mov x16, x0 ; NOFPAC-NEXT: autiza x16 ; NOFPAC-NEXT: mov x17, x16 ; NOFPAC-NEXT: xpaci x17 ; NOFPAC-NEXT: cmp x16, x17 -; NOFPAC-NEXT: b.eq Lauth_success_7 +; NOFPAC-NEXT: b.eq [[L]]auth_success_7 ; NOFPAC-NEXT: mov x16, x17 -; NOFPAC-NEXT: b Lresign_end_7 +; NOFPAC-NEXT: b [[L]]resign_end_7 ; NOFPAC-NEXT: Lauth_success_7: ; NOFPAC-NEXT: pacdb x16, x2 ; NOFPAC-NEXT: Lresign_end_7: @@ -308,7 +310,7 @@ define i64 @test_resign_iza_db(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-NEXT: ret ; ; FPAC-LABEL: test_resign_iza_db: -; FPAC: ; %bb.0: +; FPAC: %bb.0: ; FPAC-NEXT: mov x16, x0 ; FPAC-NEXT: autiza x16 ; FPAC-NEXT: pacdb x16, x2 @@ -320,15 +322,15 @@ define i64 @test_resign_iza_db(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_da_dzb(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-LABEL: test_resign_da_dzb: -; NOFPAC: ; %bb.0: +; NOFPAC: %bb.0: ; NOFPAC-NEXT: mov x16, x0 ; NOFPAC-NEXT: autda x16, x1 ; NOFPAC-NEXT: mov x17, x16 ; NOFPAC-NEXT: xpacd x17 ; NOFPAC-NEXT: cmp x16, x17 -; NOFPAC-NEXT: b.eq Lauth_success_8 +; NOFPAC-NEXT: b.eq [[L]]auth_success_8 ; NOFPAC-NEXT: mov x16, x17 -; NOFPAC-NEXT: b Lresign_end_8 +; NOFPAC-NEXT: b [[L]]resign_end_8 ; NOFPAC-NEXT: Lauth_success_8: ; NOFPAC-NEXT: pacdzb x16 ; NOFPAC-NEXT: Lresign_end_8: @@ -336,7 +338,7 @@ define i64 @test_resign_da_dzb(i64 %arg, i64 %arg1, i64 %arg2) { ; NOFPAC-NEXT: ret ; ; FPAC-LABEL: test_resign_da_dzb: -; FPAC: ; %bb.0: +; FPAC: %bb.0: ; FPAC-NEXT: mov x16, x0 ; FPAC-NEXT: autda x16, x1 ; FPAC-NEXT: pacdzb x16 @@ -348,20 +350,20 @@ define i64 @test_resign_da_dzb(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_auth_trap_attribute(i64 %arg, i64 %arg1) "ptrauth-auth-traps" { ; NOFPAC-LABEL: test_auth_trap_attribute: -; NOFPAC: ; %bb.0: +; NOFPAC: %bb.0: ; NOFPAC-NEXT: mov x16, x0 ; NOFPAC-NEXT: autia x16, x1 ; NOFPAC-NEXT: mov x17, x16 ; NOFPAC-NEXT: xpaci x17 ; NOFPAC-NEXT: cmp x16, x17 -; NOFPAC-NEXT: b.eq Lauth_success_9 +; NOFPAC-NEXT: b.eq [[L]]auth_success_9 ; NOFPAC-NEXT: brk #0xc470 ; NOFPAC-NEXT: Lauth_success_9: ; NOFPAC-NEXT: mov x0, x16 ; NOFPAC-NEXT: ret ; ; FPAC-LABEL: test_auth_trap_attribute: -; FPAC: ; %bb.0: +; FPAC: %bb.0: ; FPAC-NEXT: mov x16, x0 ; FPAC-NEXT: autia x16, x1 ; FPAC-NEXT: mov x0, x16 diff --git a/llvm/test/CodeGen/AArch64/ptrauth-intrinsic-auth-resign-with-blend.ll b/llvm/test/CodeGen/AArch64/ptrauth-intrinsic-auth-resign-with-blend.ll index 3b93acd8e46f7..74d2370c74c54 100644 --- a/llvm/test/CodeGen/AArch64/ptrauth-intrinsic-auth-resign-with-blend.ll +++ b/llvm/test/CodeGen/AArch64/ptrauth-intrinsic-auth-resign-with-blend.ll @@ -1,24 +1,39 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel=0 -verify-machineinstrs \ -; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s --check-prefix=UNCHECKED +; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s -DL="L" --check-prefixes=UNCHECKED,UNCHECKED-DARWIN ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel -global-isel-abort=1 -verify-machineinstrs \ -; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s --check-prefix=UNCHECKED +; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s -DL="L" --check-prefixes=UNCHECKED,UNCHECKED-DARWIN ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel=0 -verify-machineinstrs \ -; RUN: | FileCheck %s --check-prefix=CHECKED +; RUN: | FileCheck %s -DL="L" --check-prefixes=CHECKED,CHECKED-DARWIN ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel -global-isel-abort=1 -verify-machineinstrs \ -; RUN: | FileCheck %s --check-prefix=CHECKED +; RUN: | FileCheck %s -DL="L" --check-prefixes=CHECKED,CHECKED-DARWIN ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel=0 -verify-machineinstrs \ -; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s --check-prefix=TRAP +; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s -DL="L" --check-prefixes=TRAP,TRAP-DARWIN ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel -global-isel-abort=1 -verify-machineinstrs \ -; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s --check-prefix=TRAP +; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s -DL="L" --check-prefixes=TRAP,TRAP-DARWIN + +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel=0 -verify-machineinstrs \ +; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s -DL=".L" --check-prefixes=UNCHECKED,UNCHECKED-ELF +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel -global-isel-abort=1 -verify-machineinstrs \ +; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s -DL=".L" --check-prefixes=UNCHECKED,UNCHECKED-ELF + +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel=0 -verify-machineinstrs \ +; RUN: | FileCheck %s -DL=".L" --check-prefixes=CHECKED,CHECKED-ELF +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel -global-isel-abort=1 -verify-machineinstrs \ +; RUN: | FileCheck %s -DL=".L" --check-prefixes=CHECKED,CHECKED-ELF + +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel=0 -verify-machineinstrs \ +; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s -DL=".L" --check-prefixes=TRAP,TRAP-ELF +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel -global-isel-abort=1 -verify-machineinstrs \ +; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s -DL=".L" --check-prefixes=TRAP,TRAP-ELF target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" define i64 @test_auth_blend(i64 %arg, i64 %arg1) { ; UNCHECKED-LABEL: test_auth_blend: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: mov x17, x1 ; UNCHECKED-NEXT: movk x17, #65535, lsl #48 @@ -27,7 +42,7 @@ define i64 @test_auth_blend(i64 %arg, i64 %arg1) { ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_auth_blend: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: mov x17, x1 ; CHECKED-NEXT: movk x17, #65535, lsl #48 @@ -36,7 +51,7 @@ define i64 @test_auth_blend(i64 %arg, i64 %arg1) { ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_auth_blend: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: mov x17, x1 ; TRAP-NEXT: movk x17, #65535, lsl #48 @@ -44,7 +59,7 @@ define i64 @test_auth_blend(i64 %arg, i64 %arg1) { ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpacd x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_0 +; TRAP-NEXT: b.eq [[L]]auth_success_0 ; TRAP-NEXT: brk #0xc472 ; TRAP-NEXT: Lauth_success_0: ; TRAP-NEXT: mov x0, x16 @@ -56,7 +71,7 @@ define i64 @test_auth_blend(i64 %arg, i64 %arg1) { define i64 @test_resign_blend(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-LABEL: test_resign_blend: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: mov x17, x1 ; UNCHECKED-NEXT: movk x17, #12345, lsl #48 @@ -68,7 +83,7 @@ define i64 @test_resign_blend(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_resign_blend: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: mov x17, x1 ; CHECKED-NEXT: movk x17, #12345, lsl #48 @@ -76,9 +91,9 @@ define i64 @test_resign_blend(i64 %arg, i64 %arg1, i64 %arg2) { ; CHECKED-NEXT: mov x17, x16 ; CHECKED-NEXT: xpacd x17 ; CHECKED-NEXT: cmp x16, x17 -; CHECKED-NEXT: b.eq Lauth_success_0 +; CHECKED-NEXT: b.eq [[L]]auth_success_0 ; CHECKED-NEXT: mov x16, x17 -; CHECKED-NEXT: b Lresign_end_0 +; CHECKED-NEXT: b [[L]]resign_end_0 ; CHECKED-NEXT: Lauth_success_0: ; CHECKED-NEXT: mov x17, x2 ; CHECKED-NEXT: movk x17, #56789, lsl #48 @@ -88,7 +103,7 @@ define i64 @test_resign_blend(i64 %arg, i64 %arg1, i64 %arg2) { ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_resign_blend: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: mov x17, x1 ; TRAP-NEXT: movk x17, #12345, lsl #48 @@ -96,7 +111,7 @@ define i64 @test_resign_blend(i64 %arg, i64 %arg1, i64 %arg2) { ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpacd x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_1 +; TRAP-NEXT: b.eq [[L]]auth_success_1 ; TRAP-NEXT: brk #0xc472 ; TRAP-NEXT: Lauth_success_1: ; TRAP-NEXT: mov x17, x2 @@ -112,18 +127,18 @@ define i64 @test_resign_blend(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_blend_and_const(i64 %arg, i64 %arg1) { ; UNCHECKED-LABEL: test_resign_blend_and_const: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: mov x17, x1 ; UNCHECKED-NEXT: movk x17, #12345, lsl #48 ; UNCHECKED-NEXT: autda x16, x17 -; UNCHECKED-NEXT: mov x17, #56789 ; =0xddd5 +; UNCHECKED-NEXT: mov x17, #56789 ; UNCHECKED-NEXT: pacdb x16, x17 ; UNCHECKED-NEXT: mov x0, x16 ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_resign_blend_and_const: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: mov x17, x1 ; CHECKED-NEXT: movk x17, #12345, lsl #48 @@ -131,18 +146,18 @@ define i64 @test_resign_blend_and_const(i64 %arg, i64 %arg1) { ; CHECKED-NEXT: mov x17, x16 ; CHECKED-NEXT: xpacd x17 ; CHECKED-NEXT: cmp x16, x17 -; CHECKED-NEXT: b.eq Lauth_success_1 +; CHECKED-NEXT: b.eq [[L]]auth_success_1 ; CHECKED-NEXT: mov x16, x17 -; CHECKED-NEXT: b Lresign_end_1 +; CHECKED-NEXT: b [[L]]resign_end_1 ; CHECKED-NEXT: Lauth_success_1: -; CHECKED-NEXT: mov x17, #56789 ; =0xddd5 +; CHECKED-NEXT: mov x17, #56789 ; CHECKED-NEXT: pacdb x16, x17 ; CHECKED-NEXT: Lresign_end_1: ; CHECKED-NEXT: mov x0, x16 ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_resign_blend_and_const: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: mov x17, x1 ; TRAP-NEXT: movk x17, #12345, lsl #48 @@ -150,10 +165,10 @@ define i64 @test_resign_blend_and_const(i64 %arg, i64 %arg1) { ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpacd x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_2 +; TRAP-NEXT: b.eq [[L]]auth_success_2 ; TRAP-NEXT: brk #0xc472 ; TRAP-NEXT: Lauth_success_2: -; TRAP-NEXT: mov x17, #56789 ; =0xddd5 +; TRAP-NEXT: mov x17, #56789 ; TRAP-NEXT: pacdb x16, x17 ; TRAP-NEXT: mov x0, x16 ; TRAP-NEXT: ret @@ -164,7 +179,7 @@ define i64 @test_resign_blend_and_const(i64 %arg, i64 %arg1) { define i64 @test_resign_blend_and_addr(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-LABEL: test_resign_blend_and_addr: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: mov x17, x1 ; UNCHECKED-NEXT: movk x17, #12345, lsl #48 @@ -174,7 +189,7 @@ define i64 @test_resign_blend_and_addr(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_resign_blend_and_addr: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: mov x17, x1 ; CHECKED-NEXT: movk x17, #12345, lsl #48 @@ -182,9 +197,9 @@ define i64 @test_resign_blend_and_addr(i64 %arg, i64 %arg1, i64 %arg2) { ; CHECKED-NEXT: mov x17, x16 ; CHECKED-NEXT: xpacd x17 ; CHECKED-NEXT: cmp x16, x17 -; CHECKED-NEXT: b.eq Lauth_success_2 +; CHECKED-NEXT: b.eq [[L]]auth_success_2 ; CHECKED-NEXT: mov x16, x17 -; CHECKED-NEXT: b Lresign_end_2 +; CHECKED-NEXT: b [[L]]resign_end_2 ; CHECKED-NEXT: Lauth_success_2: ; CHECKED-NEXT: pacdb x16, x2 ; CHECKED-NEXT: Lresign_end_2: @@ -192,7 +207,7 @@ define i64 @test_resign_blend_and_addr(i64 %arg, i64 %arg1, i64 %arg2) { ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_resign_blend_and_addr: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: mov x17, x1 ; TRAP-NEXT: movk x17, #12345, lsl #48 @@ -200,7 +215,7 @@ define i64 @test_resign_blend_and_addr(i64 %arg, i64 %arg1, i64 %arg2) { ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpacd x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_3 +; TRAP-NEXT: b.eq [[L]]auth_success_3 ; TRAP-NEXT: brk #0xc472 ; TRAP-NEXT: Lauth_success_3: ; TRAP-NEXT: pacdb x16, x2 @@ -212,38 +227,44 @@ define i64 @test_resign_blend_and_addr(i64 %arg, i64 %arg1, i64 %arg2) { } define i64 @test_auth_too_large_discriminator(i64 %arg, i64 %arg1) { -; UNCHECKED-LABEL: test_auth_too_large_discriminator: -; UNCHECKED: ; %bb.0: -; UNCHECKED-NEXT: mov w8, #65536 ; =0x10000 -; UNCHECKED-NEXT: bfi x1, x8, #48, #16 -; UNCHECKED-NEXT: mov x16, x0 -; UNCHECKED-NEXT: autda x16, x1 -; UNCHECKED-NEXT: mov x0, x16 -; UNCHECKED-NEXT: ret +; UNCHECKED-LABEL: test_auth_too_large_discriminator: +; UNCHECKED: %bb.0: +; UNCHECKED-NEXT: mov w8, #65536 +; UNCHECKED-DARWIN-NEXT: bfi x1, x8, #48, #16 +; UNCHECKED-DARWIN-NEXT: mov x16, x0 +; UNCHECKED-ELF-NEXT: mov x16, x0 +; UNCHECKED-ELF-NEXT: bfi x1, x8, #48, #16 +; UNCHECKED-NEXT: autda x16, x1 +; UNCHECKED-NEXT: mov x0, x16 +; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_auth_too_large_discriminator: -; CHECKED: ; %bb.0: -; CHECKED-NEXT: mov w8, #65536 ; =0x10000 -; CHECKED-NEXT: bfi x1, x8, #48, #16 -; CHECKED-NEXT: mov x16, x0 -; CHECKED-NEXT: autda x16, x1 -; CHECKED-NEXT: mov x0, x16 -; CHECKED-NEXT: ret +; CHECKED: %bb.0: +; CHECKED-NEXT: mov w8, #65536 +; CHECKED-DARWIN-NEXT: bfi x1, x8, #48, #16 +; CHECKED-DARWIN-NEXT: mov x16, x0 +; CHECKED-ELF-NEXT: mov x16, x0 +; CHECKED-ELF-NEXT: bfi x1, x8, #48, #16 +; CHECKED-NEXT: autda x16, x1 +; CHECKED-NEXT: mov x0, x16 +; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_auth_too_large_discriminator: -; TRAP: ; %bb.0: -; TRAP-NEXT: mov w8, #65536 ; =0x10000 -; TRAP-NEXT: bfi x1, x8, #48, #16 -; TRAP-NEXT: mov x16, x0 -; TRAP-NEXT: autda x16, x1 -; TRAP-NEXT: mov x17, x16 -; TRAP-NEXT: xpacd x17 -; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_4 -; TRAP-NEXT: brk #0xc472 -; TRAP-NEXT: Lauth_success_4: -; TRAP-NEXT: mov x0, x16 -; TRAP-NEXT: ret +; TRAP: %bb.0: +; TRAP-NEXT: mov w8, #65536 +; TRAP-DARWIN-NEXT: bfi x1, x8, #48, #16 +; TRAP-DARWIN-NEXT: mov x16, x0 +; TRAP-ELF-NEXT: mov x16, x0 +; TRAP-ELF-NEXT: bfi x1, x8, #48, #16 +; TRAP-NEXT: autda x16, x1 +; TRAP-NEXT: mov x17, x16 +; TRAP-NEXT: xpacd x17 +; TRAP-NEXT: cmp x16, x17 +; TRAP-NEXT: b.eq [[L]]auth_success_4 +; TRAP-NEXT: brk #0xc472 +; TRAP-NEXT: Lauth_success_4: +; TRAP-NEXT: mov x0, x16 +; TRAP-NEXT: ret %tmp0 = call i64 @llvm.ptrauth.blend(i64 %arg1, i64 65536) %tmp1 = call i64 @llvm.ptrauth.auth(i64 %arg, i32 2, i64 %tmp0) ret i64 %tmp1 diff --git a/llvm/test/CodeGen/AArch64/ptrauth-intrinsic-auth-resign.ll b/llvm/test/CodeGen/AArch64/ptrauth-intrinsic-auth-resign.ll index 62c9fba853adb..fdd5ae29f35ea 100644 --- a/llvm/test/CodeGen/AArch64/ptrauth-intrinsic-auth-resign.ll +++ b/llvm/test/CodeGen/AArch64/ptrauth-intrinsic-auth-resign.ll @@ -1,44 +1,59 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel=0 -verify-machineinstrs \ -; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s --check-prefix=UNCHECKED +; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s -DL="L" --check-prefix=UNCHECKED ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel -global-isel-abort=1 -verify-machineinstrs \ -; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s --check-prefix=UNCHECKED +; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s -DL="L" --check-prefix=UNCHECKED ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel=0 -verify-machineinstrs \ -; RUN: | FileCheck %s --check-prefix=CHECKED +; RUN: | FileCheck %s -DL="L" --check-prefix=CHECKED ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel -global-isel-abort=1 -verify-machineinstrs \ -; RUN: | FileCheck %s --check-prefix=CHECKED +; RUN: | FileCheck %s -DL="L" --check-prefix=CHECKED ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel=0 -verify-machineinstrs \ -; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s --check-prefix=TRAP +; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s -DL="L" --check-prefix=TRAP ; RUN: llc < %s -mtriple arm64e-apple-darwin -global-isel -global-isel-abort=1 -verify-machineinstrs \ -; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s --check-prefix=TRAP +; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s -DL="L" --check-prefix=TRAP + +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel=0 -verify-machineinstrs \ +; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s -DL=".L" --check-prefix=UNCHECKED +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel -global-isel-abort=1 -verify-machineinstrs \ +; RUN: -aarch64-ptrauth-auth-checks=none | FileCheck %s -DL=".L" --check-prefix=UNCHECKED + +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel=0 -verify-machineinstrs \ +; RUN: | FileCheck %s -DL=".L" --check-prefix=CHECKED +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel -global-isel-abort=1 -verify-machineinstrs \ +; RUN: | FileCheck %s -DL=".L" --check-prefix=CHECKED + +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel=0 -verify-machineinstrs \ +; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s -DL=".L" --check-prefix=TRAP +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -global-isel -global-isel-abort=1 -verify-machineinstrs \ +; RUN: -aarch64-ptrauth-auth-checks=trap | FileCheck %s -DL=".L" --check-prefix=TRAP target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" define i64 @test_auth_ia(i64 %arg, i64 %arg1) { ; UNCHECKED-LABEL: test_auth_ia: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autia x16, x1 ; UNCHECKED-NEXT: mov x0, x16 ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_auth_ia: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autia x16, x1 ; CHECKED-NEXT: mov x0, x16 ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_auth_ia: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autia x16, x1 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpaci x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_0 +; TRAP-NEXT: b.eq [[L]]auth_success_0 ; TRAP-NEXT: brk #0xc470 ; TRAP-NEXT: Lauth_success_0: ; TRAP-NEXT: mov x0, x16 @@ -49,27 +64,27 @@ define i64 @test_auth_ia(i64 %arg, i64 %arg1) { define i64 @test_auth_ia_zero(i64 %arg) { ; UNCHECKED-LABEL: test_auth_ia_zero: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autiza x16 ; UNCHECKED-NEXT: mov x0, x16 ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_auth_ia_zero: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autiza x16 ; CHECKED-NEXT: mov x0, x16 ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_auth_ia_zero: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autiza x16 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpaci x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_1 +; TRAP-NEXT: b.eq [[L]]auth_success_1 ; TRAP-NEXT: brk #0xc470 ; TRAP-NEXT: Lauth_success_1: ; TRAP-NEXT: mov x0, x16 @@ -80,27 +95,27 @@ define i64 @test_auth_ia_zero(i64 %arg) { define i64 @test_auth_ib(i64 %arg, i64 %arg1) { ; UNCHECKED-LABEL: test_auth_ib: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autib x16, x1 ; UNCHECKED-NEXT: mov x0, x16 ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_auth_ib: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autib x16, x1 ; CHECKED-NEXT: mov x0, x16 ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_auth_ib: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autib x16, x1 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpaci x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_2 +; TRAP-NEXT: b.eq [[L]]auth_success_2 ; TRAP-NEXT: brk #0xc471 ; TRAP-NEXT: Lauth_success_2: ; TRAP-NEXT: mov x0, x16 @@ -111,27 +126,27 @@ define i64 @test_auth_ib(i64 %arg, i64 %arg1) { define i64 @test_auth_ib_zero(i64 %arg) { ; UNCHECKED-LABEL: test_auth_ib_zero: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autizb x16 ; UNCHECKED-NEXT: mov x0, x16 ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_auth_ib_zero: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autizb x16 ; CHECKED-NEXT: mov x0, x16 ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_auth_ib_zero: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autizb x16 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpaci x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_3 +; TRAP-NEXT: b.eq [[L]]auth_success_3 ; TRAP-NEXT: brk #0xc471 ; TRAP-NEXT: Lauth_success_3: ; TRAP-NEXT: mov x0, x16 @@ -142,27 +157,27 @@ define i64 @test_auth_ib_zero(i64 %arg) { define i64 @test_auth_da(i64 %arg, i64 %arg1) { ; UNCHECKED-LABEL: test_auth_da: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autda x16, x1 ; UNCHECKED-NEXT: mov x0, x16 ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_auth_da: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autda x16, x1 ; CHECKED-NEXT: mov x0, x16 ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_auth_da: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autda x16, x1 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpacd x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_4 +; TRAP-NEXT: b.eq [[L]]auth_success_4 ; TRAP-NEXT: brk #0xc472 ; TRAP-NEXT: Lauth_success_4: ; TRAP-NEXT: mov x0, x16 @@ -173,27 +188,27 @@ define i64 @test_auth_da(i64 %arg, i64 %arg1) { define i64 @test_auth_da_zero(i64 %arg) { ; UNCHECKED-LABEL: test_auth_da_zero: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autdza x16 ; UNCHECKED-NEXT: mov x0, x16 ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_auth_da_zero: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autdza x16 ; CHECKED-NEXT: mov x0, x16 ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_auth_da_zero: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autdza x16 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpacd x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_5 +; TRAP-NEXT: b.eq [[L]]auth_success_5 ; TRAP-NEXT: brk #0xc472 ; TRAP-NEXT: Lauth_success_5: ; TRAP-NEXT: mov x0, x16 @@ -204,27 +219,27 @@ define i64 @test_auth_da_zero(i64 %arg) { define i64 @test_auth_db(i64 %arg, i64 %arg1) { ; UNCHECKED-LABEL: test_auth_db: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autdb x16, x1 ; UNCHECKED-NEXT: mov x0, x16 ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_auth_db: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autdb x16, x1 ; CHECKED-NEXT: mov x0, x16 ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_auth_db: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autdb x16, x1 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpacd x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_6 +; TRAP-NEXT: b.eq [[L]]auth_success_6 ; TRAP-NEXT: brk #0xc473 ; TRAP-NEXT: Lauth_success_6: ; TRAP-NEXT: mov x0, x16 @@ -235,27 +250,27 @@ define i64 @test_auth_db(i64 %arg, i64 %arg1) { define i64 @test_auth_db_zero(i64 %arg) { ; UNCHECKED-LABEL: test_auth_db_zero: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autdzb x16 ; UNCHECKED-NEXT: mov x0, x16 ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_auth_db_zero: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autdzb x16 ; CHECKED-NEXT: mov x0, x16 ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_auth_db_zero: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autdzb x16 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpacd x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_7 +; TRAP-NEXT: b.eq [[L]]auth_success_7 ; TRAP-NEXT: brk #0xc473 ; TRAP-NEXT: Lauth_success_7: ; TRAP-NEXT: mov x0, x16 @@ -268,7 +283,7 @@ define i64 @test_auth_db_zero(i64 %arg) { ;; the validity of a signature. define i64 @test_resign_ia_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-LABEL: test_resign_ia_ia: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autia x16, x1 ; UNCHECKED-NEXT: pacia x16, x2 @@ -276,15 +291,15 @@ define i64 @test_resign_ia_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_resign_ia_ia: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autia x16, x1 ; CHECKED-NEXT: mov x17, x16 ; CHECKED-NEXT: xpaci x17 ; CHECKED-NEXT: cmp x16, x17 -; CHECKED-NEXT: b.eq Lauth_success_0 +; CHECKED-NEXT: b.eq [[L]]auth_success_0 ; CHECKED-NEXT: mov x16, x17 -; CHECKED-NEXT: b Lresign_end_0 +; CHECKED-NEXT: b [[L]]resign_end_0 ; CHECKED-NEXT: Lauth_success_0: ; CHECKED-NEXT: pacia x16, x2 ; CHECKED-NEXT: Lresign_end_0: @@ -292,13 +307,13 @@ define i64 @test_resign_ia_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_resign_ia_ia: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autia x16, x1 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpaci x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_8 +; TRAP-NEXT: b.eq [[L]]auth_success_8 ; TRAP-NEXT: brk #0xc470 ; TRAP-NEXT: Lauth_success_8: ; TRAP-NEXT: pacia x16, x2 @@ -310,7 +325,7 @@ define i64 @test_resign_ia_ia(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_ib_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-LABEL: test_resign_ib_ia: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autib x16, x1 ; UNCHECKED-NEXT: pacia x16, x2 @@ -318,15 +333,15 @@ define i64 @test_resign_ib_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_resign_ib_ia: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autib x16, x1 ; CHECKED-NEXT: mov x17, x16 ; CHECKED-NEXT: xpaci x17 ; CHECKED-NEXT: cmp x16, x17 -; CHECKED-NEXT: b.eq Lauth_success_1 +; CHECKED-NEXT: b.eq [[L]]auth_success_1 ; CHECKED-NEXT: mov x16, x17 -; CHECKED-NEXT: b Lresign_end_1 +; CHECKED-NEXT: b [[L]]resign_end_1 ; CHECKED-NEXT: Lauth_success_1: ; CHECKED-NEXT: pacia x16, x2 ; CHECKED-NEXT: Lresign_end_1: @@ -334,13 +349,13 @@ define i64 @test_resign_ib_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_resign_ib_ia: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autib x16, x1 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpaci x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_9 +; TRAP-NEXT: b.eq [[L]]auth_success_9 ; TRAP-NEXT: brk #0xc471 ; TRAP-NEXT: Lauth_success_9: ; TRAP-NEXT: pacia x16, x2 @@ -352,7 +367,7 @@ define i64 @test_resign_ib_ia(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_da_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-LABEL: test_resign_da_ia: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autda x16, x1 ; UNCHECKED-NEXT: pacia x16, x2 @@ -360,15 +375,15 @@ define i64 @test_resign_da_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_resign_da_ia: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autda x16, x1 ; CHECKED-NEXT: mov x17, x16 ; CHECKED-NEXT: xpacd x17 ; CHECKED-NEXT: cmp x16, x17 -; CHECKED-NEXT: b.eq Lauth_success_2 +; CHECKED-NEXT: b.eq [[L]]auth_success_2 ; CHECKED-NEXT: mov x16, x17 -; CHECKED-NEXT: b Lresign_end_2 +; CHECKED-NEXT: b [[L]]resign_end_2 ; CHECKED-NEXT: Lauth_success_2: ; CHECKED-NEXT: pacia x16, x2 ; CHECKED-NEXT: Lresign_end_2: @@ -376,13 +391,13 @@ define i64 @test_resign_da_ia(i64 %arg, i64 %arg1, i64 %arg2) { ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_resign_da_ia: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autda x16, x1 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpacd x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_10 +; TRAP-NEXT: b.eq [[L]]auth_success_10 ; TRAP-NEXT: brk #0xc472 ; TRAP-NEXT: Lauth_success_10: ; TRAP-NEXT: pacia x16, x2 @@ -394,7 +409,7 @@ define i64 @test_resign_da_ia(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_db_da(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-LABEL: test_resign_db_da: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autdb x16, x1 ; UNCHECKED-NEXT: pacda x16, x2 @@ -402,15 +417,15 @@ define i64 @test_resign_db_da(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_resign_db_da: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autdb x16, x1 ; CHECKED-NEXT: mov x17, x16 ; CHECKED-NEXT: xpacd x17 ; CHECKED-NEXT: cmp x16, x17 -; CHECKED-NEXT: b.eq Lauth_success_3 +; CHECKED-NEXT: b.eq [[L]]auth_success_3 ; CHECKED-NEXT: mov x16, x17 -; CHECKED-NEXT: b Lresign_end_3 +; CHECKED-NEXT: b [[L]]resign_end_3 ; CHECKED-NEXT: Lauth_success_3: ; CHECKED-NEXT: pacda x16, x2 ; CHECKED-NEXT: Lresign_end_3: @@ -418,13 +433,13 @@ define i64 @test_resign_db_da(i64 %arg, i64 %arg1, i64 %arg2) { ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_resign_db_da: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autdb x16, x1 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpacd x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_11 +; TRAP-NEXT: b.eq [[L]]auth_success_11 ; TRAP-NEXT: brk #0xc473 ; TRAP-NEXT: Lauth_success_11: ; TRAP-NEXT: pacda x16, x2 @@ -436,7 +451,7 @@ define i64 @test_resign_db_da(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_iza_db(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-LABEL: test_resign_iza_db: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autiza x16 ; UNCHECKED-NEXT: pacdb x16, x2 @@ -444,15 +459,15 @@ define i64 @test_resign_iza_db(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_resign_iza_db: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autiza x16 ; CHECKED-NEXT: mov x17, x16 ; CHECKED-NEXT: xpaci x17 ; CHECKED-NEXT: cmp x16, x17 -; CHECKED-NEXT: b.eq Lauth_success_4 +; CHECKED-NEXT: b.eq [[L]]auth_success_4 ; CHECKED-NEXT: mov x16, x17 -; CHECKED-NEXT: b Lresign_end_4 +; CHECKED-NEXT: b [[L]]resign_end_4 ; CHECKED-NEXT: Lauth_success_4: ; CHECKED-NEXT: pacdb x16, x2 ; CHECKED-NEXT: Lresign_end_4: @@ -460,13 +475,13 @@ define i64 @test_resign_iza_db(i64 %arg, i64 %arg1, i64 %arg2) { ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_resign_iza_db: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autiza x16 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpaci x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_12 +; TRAP-NEXT: b.eq [[L]]auth_success_12 ; TRAP-NEXT: brk #0xc470 ; TRAP-NEXT: Lauth_success_12: ; TRAP-NEXT: pacdb x16, x2 @@ -478,7 +493,7 @@ define i64 @test_resign_iza_db(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_resign_da_dzb(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-LABEL: test_resign_da_dzb: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autda x16, x1 ; UNCHECKED-NEXT: pacdzb x16 @@ -486,15 +501,15 @@ define i64 @test_resign_da_dzb(i64 %arg, i64 %arg1, i64 %arg2) { ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_resign_da_dzb: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autda x16, x1 ; CHECKED-NEXT: mov x17, x16 ; CHECKED-NEXT: xpacd x17 ; CHECKED-NEXT: cmp x16, x17 -; CHECKED-NEXT: b.eq Lauth_success_5 +; CHECKED-NEXT: b.eq [[L]]auth_success_5 ; CHECKED-NEXT: mov x16, x17 -; CHECKED-NEXT: b Lresign_end_5 +; CHECKED-NEXT: b [[L]]resign_end_5 ; CHECKED-NEXT: Lauth_success_5: ; CHECKED-NEXT: pacdzb x16 ; CHECKED-NEXT: Lresign_end_5: @@ -502,13 +517,13 @@ define i64 @test_resign_da_dzb(i64 %arg, i64 %arg1, i64 %arg2) { ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_resign_da_dzb: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autda x16, x1 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpacd x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_13 +; TRAP-NEXT: b.eq [[L]]auth_success_13 ; TRAP-NEXT: brk #0xc472 ; TRAP-NEXT: Lauth_success_13: ; TRAP-NEXT: pacdzb x16 @@ -520,33 +535,33 @@ define i64 @test_resign_da_dzb(i64 %arg, i64 %arg1, i64 %arg2) { define i64 @test_auth_trap_attribute(i64 %arg, i64 %arg1) "ptrauth-auth-traps" { ; UNCHECKED-LABEL: test_auth_trap_attribute: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autia x16, x1 ; UNCHECKED-NEXT: mov x0, x16 ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_auth_trap_attribute: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autia x16, x1 ; CHECKED-NEXT: mov x17, x16 ; CHECKED-NEXT: xpaci x17 ; CHECKED-NEXT: cmp x16, x17 -; CHECKED-NEXT: b.eq Lauth_success_6 +; CHECKED-NEXT: b.eq [[L]]auth_success_6 ; CHECKED-NEXT: brk #0xc470 ; CHECKED-NEXT: Lauth_success_6: ; CHECKED-NEXT: mov x0, x16 ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_auth_trap_attribute: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autia x16, x1 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpaci x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_14 +; TRAP-NEXT: b.eq [[L]]auth_success_14 ; TRAP-NEXT: brk #0xc470 ; TRAP-NEXT: Lauth_success_14: ; TRAP-NEXT: mov x0, x16 @@ -557,30 +572,30 @@ define i64 @test_auth_trap_attribute(i64 %arg, i64 %arg1) "ptrauth-auth-traps" { define i64 @test_auth_ia_constdisc(i64 %arg) { ; UNCHECKED-LABEL: test_auth_ia_constdisc: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 -; UNCHECKED-NEXT: mov x17, #256 ; =0x100 +; UNCHECKED-NEXT: mov x17, #256 ; UNCHECKED-NEXT: autia x16, x17 ; UNCHECKED-NEXT: mov x0, x16 ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_auth_ia_constdisc: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 -; CHECKED-NEXT: mov x17, #256 ; =0x100 +; CHECKED-NEXT: mov x17, #256 ; CHECKED-NEXT: autia x16, x17 ; CHECKED-NEXT: mov x0, x16 ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_auth_ia_constdisc: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 -; TRAP-NEXT: mov x17, #256 ; =0x100 +; TRAP-NEXT: mov x17, #256 ; TRAP-NEXT: autia x16, x17 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpaci x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_15 +; TRAP-NEXT: b.eq [[L]]auth_success_15 ; TRAP-NEXT: brk #0xc470 ; TRAP-NEXT: Lauth_success_15: ; TRAP-NEXT: mov x0, x16 @@ -591,42 +606,42 @@ define i64 @test_auth_ia_constdisc(i64 %arg) { define i64 @test_resign_da_constdisc(i64 %arg, i64 %arg1) { ; UNCHECKED-LABEL: test_resign_da_constdisc: -; UNCHECKED: ; %bb.0: +; UNCHECKED: %bb.0: ; UNCHECKED-NEXT: mov x16, x0 ; UNCHECKED-NEXT: autda x16, x1 -; UNCHECKED-NEXT: mov x17, #256 ; =0x100 +; UNCHECKED-NEXT: mov x17, #256 ; UNCHECKED-NEXT: pacda x16, x17 ; UNCHECKED-NEXT: mov x0, x16 ; UNCHECKED-NEXT: ret ; ; CHECKED-LABEL: test_resign_da_constdisc: -; CHECKED: ; %bb.0: +; CHECKED: %bb.0: ; CHECKED-NEXT: mov x16, x0 ; CHECKED-NEXT: autda x16, x1 ; CHECKED-NEXT: mov x17, x16 ; CHECKED-NEXT: xpacd x17 ; CHECKED-NEXT: cmp x16, x17 -; CHECKED-NEXT: b.eq Lauth_success_7 +; CHECKED-NEXT: b.eq [[L]]auth_success_7 ; CHECKED-NEXT: mov x16, x17 -; CHECKED-NEXT: b Lresign_end_6 +; CHECKED-NEXT: b [[L]]resign_end_6 ; CHECKED-NEXT: Lauth_success_7: -; CHECKED-NEXT: mov x17, #256 ; =0x100 +; CHECKED-NEXT: mov x17, #256 ; CHECKED-NEXT: pacda x16, x17 ; CHECKED-NEXT: Lresign_end_6: ; CHECKED-NEXT: mov x0, x16 ; CHECKED-NEXT: ret ; ; TRAP-LABEL: test_resign_da_constdisc: -; TRAP: ; %bb.0: +; TRAP: %bb.0: ; TRAP-NEXT: mov x16, x0 ; TRAP-NEXT: autda x16, x1 ; TRAP-NEXT: mov x17, x16 ; TRAP-NEXT: xpacd x17 ; TRAP-NEXT: cmp x16, x17 -; TRAP-NEXT: b.eq Lauth_success_16 +; TRAP-NEXT: b.eq [[L]]auth_success_16 ; TRAP-NEXT: brk #0xc472 ; TRAP-NEXT: Lauth_success_16: -; TRAP-NEXT: mov x17, #256 ; =0x100 +; TRAP-NEXT: mov x17, #256 ; TRAP-NEXT: pacda x16, x17 ; TRAP-NEXT: mov x0, x16 ; TRAP-NEXT: ret diff --git a/llvm/test/CodeGen/AArch64/ptrauth-ret-trap.ll b/llvm/test/CodeGen/AArch64/ptrauth-ret-trap.ll new file mode 100644 index 0000000000000..42a3050eda112 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/ptrauth-ret-trap.ll @@ -0,0 +1,98 @@ +; RUN: llc -mtriple aarch64-linux-gnu -mattr=+pauth -asm-verbose=false -disable-post-ra -o - %s | FileCheck %s + +; CHECK-LABEL: test_tailcall: +; CHECK-NEXT: pacibsp +; CHECK-NEXT: str x30, [sp, #-16]! +; CHECK-NEXT: bl bar +; CHECK-NEXT: ldr x30, [sp], #16 +; CHECK-NEXT: autibsp +; CHECK-NEXT: eor x16, x30, x30, lsl #1 +; CHECK-NEXT: tbnz x16, #62, [[BAD:.L.*]] +; CHECK-NEXT: b bar +; CHECK-NEXT: [[BAD]]: +; CHECK-NEXT: brk #0xc471 +define i32 @test_tailcall() #0 { + call i32 @bar() + %c = tail call i32 @bar() + ret i32 %c +} + +; CHECK-LABEL: test_tailcall_noframe: +; CHECK-NEXT: b bar +define i32 @test_tailcall_noframe() #0 { + %c = tail call i32 @bar() + ret i32 %c +} + +; CHECK-LABEL: test_tailcall_indirect: +; CHECK: autibsp +; CHECK: eor x16, x30, x30, lsl #1 +; CHECK: tbnz x16, #62, [[BAD:.L.*]] +; CHECK: br x0 +; CHECK: [[BAD]]: +; CHECK: brk #0xc471 +define void @test_tailcall_indirect(ptr %fptr) #0 { + call i32 @test_tailcall() + tail call void %fptr() + ret void +} + +; CHECK-LABEL: test_tailcall_indirect_in_x9: +; CHECK: autibsp +; CHECK: eor x16, x30, x30, lsl #1 +; CHECK: tbnz x16, #62, [[BAD:.L.*]] +; CHECK: br x9 +; CHECK: [[BAD]]: +; CHECK: brk #0xc471 +define void @test_tailcall_indirect_in_x9(ptr sret(i64) %ret, [8 x i64] %in, ptr %fptr) #0 { + %ptr = alloca i8, i32 16 + call i32 @test_tailcall() + tail call void %fptr(ptr sret(i64) %ret, [8 x i64] %in) + ret void +} + +; CHECK-LABEL: test_auth_tailcall_indirect: +; CHECK: autibsp +; CHECK: eor x16, x30, x30, lsl #1 +; CHECK: tbnz x16, #62, [[BAD:.L.*]] +; CHECK: mov x16, #42 +; CHECK: braa x0, x16 +; CHECK: [[BAD]]: +; CHECK: brk #0xc471 +define void @test_auth_tailcall_indirect(ptr %fptr) #0 { + call i32 @test_tailcall() + tail call void %fptr() [ "ptrauth"(i32 0, i64 42) ] + ret void +} + +; CHECK-LABEL: test_auth_tailcall_indirect_in_x9: +; CHECK: autibsp +; CHECK: eor x16, x30, x30, lsl #1 +; CHECK: tbnz x16, #62, [[BAD:.L.*]] +; CHECK: brabz x9 +; CHECK: [[BAD]]: +; CHECK: brk #0xc471 +define void @test_auth_tailcall_indirect_in_x9(ptr sret(i64) %ret, [8 x i64] %in, ptr %fptr) #0 { + %ptr = alloca i8, i32 16 + call i32 @test_tailcall() + tail call void %fptr(ptr sret(i64) %ret, [8 x i64] %in) [ "ptrauth"(i32 1, i64 0) ] + ret void +} + +; CHECK-LABEL: test_auth_tailcall_indirect_bti: +; CHECK: autibsp +; CHECK: eor x17, x30, x30, lsl #1 +; CHECK: tbnz x17, #62, [[BAD:.L.*]] +; CHECK: brabz x16 +; CHECK: [[BAD]]: +; CHECK: brk #0xc471 +define void @test_auth_tailcall_indirect_bti(ptr sret(i64) %ret, [8 x i64] %in, ptr %fptr) #0 "branch-target-enforcement"="true" { + %ptr = alloca i8, i32 16 + call i32 @test_tailcall() + tail call void %fptr(ptr sret(i64) %ret, [8 x i64] %in) [ "ptrauth"(i32 1, i64 0) ] + ret void +} + +declare i32 @bar() + +attributes #0 = { nounwind "ptrauth-returns" "ptrauth-auth-traps" } diff --git a/llvm/test/CodeGen/AArch64/ptrauth-ret.ll b/llvm/test/CodeGen/AArch64/ptrauth-ret.ll new file mode 100644 index 0000000000000..61f5f6d9d23b7 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/ptrauth-ret.ll @@ -0,0 +1,225 @@ +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -verify-machineinstrs -disable-post-ra \ +; RUN: -global-isel=0 -o - %s | FileCheck %s +; RUN: llc < %s -mtriple aarch64-linux-gnu -mattr=+pauth -verify-machineinstrs -disable-post-ra \ +; RUN: -global-isel=1 -global-isel-abort=1 -o - %s | FileCheck %s + +define i32 @test() #0 { +; CHECK-LABEL: test: +; CHECK: %bb.0: +; CHECK-NEXT: str x19, [sp, #-16]! +; CHECK-NEXT: mov w0, wzr +; CHECK-NEXT: //APP +; CHECK-NEXT: //NO_APP +; CHECK-NEXT: ldr x19, [sp], #16 +; CHECK-NEXT: ret + call void asm sideeffect "", "~{x19}"() + ret i32 0 +} + +define i32 @test_alloca() #0 { +; CHECK-LABEL: test_alloca: +; CHECK: %bb.0: +; CHECK-NEXT: sub sp, sp, #32 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: mov w0, wzr +; CHECK-NEXT: //APP +; CHECK-NEXT: //NO_APP +; CHECK-NEXT: add sp, sp, #32 +; CHECK-NEXT: ret + %p = alloca i8, i32 32 + call void asm sideeffect "", "r"(ptr %p) + ret i32 0 +} + +define i32 @test_realign_alloca() #0 { +; CHECK-LABEL: test_realign_alloca: +; CHECK: %bb.0: +; CHECK-NEXT: pacibsp +; CHECK-NEXT: stp x29, x30, [sp, #-16]! +; CHECK-NEXT: mov x29, sp +; CHECK-NEXT: sub x9, sp, #112 +; CHECK-NEXT: and sp, x9, #0xffffffffffffff80 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: mov w0, wzr +; CHECK-NEXT: //APP +; CHECK-NEXT: //NO_APP +; CHECK-NEXT: mov sp, x29 +; CHECK-NEXT: ldp x29, x30, [sp], #16 +; CHECK-NEXT: retab + %p = alloca i8, i32 32, align 128 + call void asm sideeffect "", "r"(ptr %p) + ret i32 0 +} + +define i32 @test_big_alloca() #0 { +; CHECK-LABEL: test_big_alloca: +; CHECK: %bb.0: +; CHECK-NEXT: str x29, [sp, #-16]! +; CHECK-NEXT: sub sp, sp, #1024 +; CHECK-NEXT: mov x8, sp +; CHECK-NEXT: mov w0, wzr +; CHECK-NEXT: //APP +; CHECK-NEXT: //NO_APP +; CHECK-NEXT: add sp, sp, #1024 +; CHECK-NEXT: ldr x29, [sp], #16 +; CHECK-NEXT: ret + %p = alloca i8, i32 1024 + call void asm sideeffect "", "r"(ptr %p) + ret i32 0 +} + +define i32 @test_var_alloca(i32 %s) #0 { + %p = alloca i8, i32 %s + call void asm sideeffect "", "r"(ptr %p) + ret i32 0 +} + +define i32 @test_noframe_saved(ptr %p) #0 { +; CHECK-LABEL: test_noframe_saved: +; CHECK: %bb.0: + + +; CHECK-NEXT: str x29, [sp, #-96]! +; CHECK-NEXT: stp x28, x27, [sp, #16] +; CHECK-NEXT: stp x26, x25, [sp, #32] +; CHECK-NEXT: stp x24, x23, [sp, #48] +; CHECK-NEXT: stp x22, x21, [sp, #64] +; CHECK-NEXT: stp x20, x19, [sp, #80] +; CHECK-NEXT: ldr w29, [x0] +; CHECK-NEXT: //APP +; CHECK-NEXT: //NO_APP +; CHECK-NEXT: mov w0, w29 +; CHECK-NEXT: ldp x20, x19, [sp, #80] +; CHECK-NEXT: ldp x22, x21, [sp, #64] +; CHECK-NEXT: ldp x24, x23, [sp, #48] +; CHECK-NEXT: ldp x26, x25, [sp, #32] +; CHECK-NEXT: ldp x28, x27, [sp, #16] +; CHECK-NEXT: ldr x29, [sp], #96 +; CHECK-NEXT: ret + %v = load i32, ptr %p + call void asm sideeffect "", "~{x0},~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28}"() + ret i32 %v +} + +define void @test_noframe() #0 { +; CHECK-LABEL: test_noframe: +; CHECK: %bb.0: +; CHECK-NEXT: ret + ret void +} + +; FIXME: Inefficient lowering of @llvm.returnaddress +define ptr @test_returnaddress_0() #0 { +; CHECK-LABEL: test_returnaddress_0: +; CHECK: %bb.0: +; CHECK-NEXT: pacibsp +; CHECK-NEXT: str x30, [sp, #-16]! +; CHECK-NEXT: xpaci x30 +; CHECK-NEXT: mov x0, x30 +; CHECK-NEXT: ldr x30, [sp], #16 +; CHECK-NEXT: retab + %r = call ptr @llvm.returnaddress(i32 0) + ret ptr %r +} + +define ptr @test_returnaddress_1() #0 { +; CHECK-LABEL: test_returnaddress_1: +; CHECK: %bb.0: +; CHECK-NEXT: pacibsp +; CHECK-NEXT: stp x29, x30, [sp, #-16]! +; CHECK-NEXT: mov x29, sp +; CHECK-NEXT: ldr x8, [x29] +; CHECK-NEXT: ldr x0, [x8, #8] +; CHECK-NEXT: xpaci x0 +; CHECK-NEXT: ldp x29, x30, [sp], #16 +; CHECK-NEXT: retab + %r = call ptr @llvm.returnaddress(i32 1) + ret ptr %r +} + +define void @test_noframe_alloca() #0 { +; CHECK-LABEL: test_noframe_alloca: +; CHECK: %bb.0: +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: add x8, sp, #12 +; CHECK-NEXT: //APP +; CHECK-NEXT: //NO_APP +; CHECK-NEXT: add sp, sp, #16 +; CHECK-NEXT: ret + %p = alloca i8, i32 1 + call void asm sideeffect "", "r"(ptr %p) + ret void +} + +define void @test_call() #0 { +; CHECK-LABEL: test_call: +; CHECK: %bb.0: +; CHECK-NEXT: pacibsp +; CHECK-NEXT: str x30, [sp, #-16]! +; CHECK-NEXT: bl bar +; CHECK-NEXT: ldr x30, [sp], #16 +; CHECK-NEXT: retab + call i32 @bar() + ret void +} + +define void @test_call_alloca() #0 { +; CHECK-LABEL: test_call_alloca: +; CHECK: %bb.0: +; CHECK-NEXT: pacibsp +; CHECK-NEXT: str x30, [sp, #-16] +; CHECK-NEXT: bl bar +; CHECK-NEXT: ldr x30, [sp], #16 +; CHECK-NEXT: retab + alloca i8 + call i32 @bar() + ret void +} + +define void @test_call_shrinkwrapping(i1 %c) #0 { +; CHECK-LABEL: test_call_shrinkwrapping: +; CHECK: %bb.0: +; CHECK-NEXT: tbz w0, #0, .LBB12_2 +; CHECK-NEXT: %bb.1: +; CHECK-NEXT: pacibsp +; CHECK-NEXT: str x30, [sp, #-16]! +; CHECK-NEXT: bl bar +; CHECK-NEXT: ldr x30, [sp], #16 +; CHECK-NEXT: autibsp +; CHECK-NEXT: LBB12_2: +; CHECK-NEXT: ret + br i1 %c, label %tbb, label %fbb +tbb: + call i32 @bar() + br label %fbb +fbb: + ret void +} + +define i32 @test_tailcall() #0 { +; CHECK-LABEL: test_tailcall: +; CHECK: %bb.0: +; CHECK-NEXT: pacibsp +; CHECK-NEXT: str x30, [sp, #-16]! +; CHECK-NEXT: bl bar +; CHECK-NEXT: ldr x30, [sp], #16 +; CHECK-NEXT: autibsp +; CHECK-NEXT: b bar + call i32 @bar() + %c = tail call i32 @bar() + ret i32 %c +} + +define i32 @test_tailcall_noframe() #0 { +; CHECK-LABEL: test_tailcall_noframe: +; CHECK: %bb.0: +; CHECK-NEXT: b bar + %c = tail call i32 @bar() + ret i32 %c +} + +declare i32 @bar() + +declare ptr @llvm.returnaddress(i32) + +attributes #0 = { nounwind "ptrauth-returns" } diff --git a/llvm/test/CodeGen/AArch64/sme-vg-to-stack.ll b/llvm/test/CodeGen/AArch64/sme-vg-to-stack.ll index 6264ce0cf4ae6..fa8f92cb0a2c9 100644 --- a/llvm/test/CodeGen/AArch64/sme-vg-to-stack.ll +++ b/llvm/test/CodeGen/AArch64/sme-vg-to-stack.ll @@ -329,27 +329,34 @@ define void @vg_unwind_with_sve_args( %x) #0 { ; CHECK-NEXT: .cfi_offset w29, -32 ; CHECK-NEXT: addvl sp, sp, #-18 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x8f, 0x00, 0x11, 0x20, 0x22, 0x11, 0x90, 0x01, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 32 + 144 * VG -; CHECK-NEXT: str p8, [sp, #11, mul vl] // 2-byte Folded Spill -; CHECK-NEXT: ptrue pn8.b ; CHECK-NEXT: str p15, [sp, #4, mul vl] // 2-byte Folded Spill -; CHECK-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #4, mul vl] // 32-byte Folded Spill -; CHECK-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #8, mul vl] // 32-byte Folded Spill ; CHECK-NEXT: str p14, [sp, #5, mul vl] // 2-byte Folded Spill -; CHECK-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #12, mul vl] // 32-byte Folded Spill -; CHECK-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #16, mul vl] // 32-byte Folded Spill ; CHECK-NEXT: str p13, [sp, #6, mul vl] // 2-byte Folded Spill -; CHECK-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #20, mul vl] // 32-byte Folded Spill -; CHECK-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill ; CHECK-NEXT: str p12, [sp, #7, mul vl] // 2-byte Folded Spill -; CHECK-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #28, mul vl] // 32-byte Folded Spill ; CHECK-NEXT: str p11, [sp, #8, mul vl] // 2-byte Folded Spill ; CHECK-NEXT: str p10, [sp, #9, mul vl] // 2-byte Folded Spill ; CHECK-NEXT: str p9, [sp, #10, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str p8, [sp, #11, mul vl] // 2-byte Folded Spill ; CHECK-NEXT: str p7, [sp, #12, mul vl] // 2-byte Folded Spill ; CHECK-NEXT: str p6, [sp, #13, mul vl] // 2-byte Folded Spill ; CHECK-NEXT: str p5, [sp, #14, mul vl] // 2-byte Folded Spill ; CHECK-NEXT: str p4, [sp, #15, mul vl] // 2-byte Folded Spill -; CHECK-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #32, mul vl] // 32-byte Folded Spill +; CHECK-NEXT: str z23, [sp, #2, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z22, [sp, #3, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z21, [sp, #4, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z20, [sp, #5, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z19, [sp, #6, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z18, [sp, #7, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z17, [sp, #8, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z16, [sp, #9, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z15, [sp, #10, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z14, [sp, #11, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z13, [sp, #12, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z12, [sp, #13, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z11, [sp, #14, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z10, [sp, #15, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z9, [sp, #16, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z8, [sp, #17, mul vl] // 16-byte Folded Spill ; CHECK-NEXT: .cfi_escape 0x10, 0x48, 0x0a, 0x11, 0x60, 0x22, 0x11, 0x78, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d8 @ cfa - 32 - 8 * VG ; CHECK-NEXT: .cfi_escape 0x10, 0x49, 0x0a, 0x11, 0x60, 0x22, 0x11, 0x70, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d9 @ cfa - 32 - 16 * VG ; CHECK-NEXT: .cfi_escape 0x10, 0x4a, 0x0a, 0x11, 0x60, 0x22, 0x11, 0x68, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d10 @ cfa - 32 - 24 * VG @@ -371,16 +378,23 @@ define void @vg_unwind_with_sve_args( %x) #0 { ; CHECK-NEXT: .cfi_restore vg ; CHECK-NEXT: addvl sp, sp, #1 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x8f, 0x00, 0x11, 0x20, 0x22, 0x11, 0x90, 0x01, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 32 + 144 * VG -; CHECK-NEXT: ptrue pn8.b +; CHECK-NEXT: ldr z23, [sp, #2, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z22, [sp, #3, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z21, [sp, #4, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z20, [sp, #5, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z19, [sp, #6, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z18, [sp, #7, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z17, [sp, #8, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z16, [sp, #9, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z15, [sp, #10, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z14, [sp, #11, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z13, [sp, #12, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z12, [sp, #13, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z11, [sp, #14, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z10, [sp, #15, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z9, [sp, #16, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z8, [sp, #17, mul vl] // 16-byte Folded Reload ; CHECK-NEXT: ldr p15, [sp, #4, mul vl] // 2-byte Folded Reload -; CHECK-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #4, mul vl] // 32-byte Folded Reload -; CHECK-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #8, mul vl] // 32-byte Folded Reload -; CHECK-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #12, mul vl] // 32-byte Folded Reload -; CHECK-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #16, mul vl] // 32-byte Folded Reload -; CHECK-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #20, mul vl] // 32-byte Folded Reload -; CHECK-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload -; CHECK-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #28, mul vl] // 32-byte Folded Reload -; CHECK-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #32, mul vl] // 32-byte Folded Reload ; CHECK-NEXT: ldr p14, [sp, #5, mul vl] // 2-byte Folded Reload ; CHECK-NEXT: ldr p13, [sp, #6, mul vl] // 2-byte Folded Reload ; CHECK-NEXT: ldr p12, [sp, #7, mul vl] // 2-byte Folded Reload @@ -424,27 +438,34 @@ define void @vg_unwind_with_sve_args( %x) #0 { ; FP-CHECK-NEXT: .cfi_offset w30, -40 ; FP-CHECK-NEXT: .cfi_offset w29, -48 ; FP-CHECK-NEXT: addvl sp, sp, #-18 -; FP-CHECK-NEXT: str p8, [sp, #11, mul vl] // 2-byte Folded Spill -; FP-CHECK-NEXT: ptrue pn8.b ; FP-CHECK-NEXT: str p15, [sp, #4, mul vl] // 2-byte Folded Spill -; FP-CHECK-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #4, mul vl] // 32-byte Folded Spill -; FP-CHECK-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #8, mul vl] // 32-byte Folded Spill ; FP-CHECK-NEXT: str p14, [sp, #5, mul vl] // 2-byte Folded Spill -; FP-CHECK-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #12, mul vl] // 32-byte Folded Spill -; FP-CHECK-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #16, mul vl] // 32-byte Folded Spill ; FP-CHECK-NEXT: str p13, [sp, #6, mul vl] // 2-byte Folded Spill -; FP-CHECK-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #20, mul vl] // 32-byte Folded Spill -; FP-CHECK-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill ; FP-CHECK-NEXT: str p12, [sp, #7, mul vl] // 2-byte Folded Spill -; FP-CHECK-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #28, mul vl] // 32-byte Folded Spill ; FP-CHECK-NEXT: str p11, [sp, #8, mul vl] // 2-byte Folded Spill ; FP-CHECK-NEXT: str p10, [sp, #9, mul vl] // 2-byte Folded Spill ; FP-CHECK-NEXT: str p9, [sp, #10, mul vl] // 2-byte Folded Spill +; FP-CHECK-NEXT: str p8, [sp, #11, mul vl] // 2-byte Folded Spill ; FP-CHECK-NEXT: str p7, [sp, #12, mul vl] // 2-byte Folded Spill ; FP-CHECK-NEXT: str p6, [sp, #13, mul vl] // 2-byte Folded Spill ; FP-CHECK-NEXT: str p5, [sp, #14, mul vl] // 2-byte Folded Spill ; FP-CHECK-NEXT: str p4, [sp, #15, mul vl] // 2-byte Folded Spill -; FP-CHECK-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #32, mul vl] // 32-byte Folded Spill +; FP-CHECK-NEXT: str z23, [sp, #2, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z22, [sp, #3, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z21, [sp, #4, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z20, [sp, #5, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z19, [sp, #6, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z18, [sp, #7, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z17, [sp, #8, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z16, [sp, #9, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z15, [sp, #10, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z14, [sp, #11, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z13, [sp, #12, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z12, [sp, #13, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z11, [sp, #14, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z10, [sp, #15, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z9, [sp, #16, mul vl] // 16-byte Folded Spill +; FP-CHECK-NEXT: str z8, [sp, #17, mul vl] // 16-byte Folded Spill ; FP-CHECK-NEXT: .cfi_escape 0x10, 0x48, 0x0a, 0x11, 0x50, 0x22, 0x11, 0x78, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d8 @ cfa - 48 - 8 * VG ; FP-CHECK-NEXT: .cfi_escape 0x10, 0x49, 0x0a, 0x11, 0x50, 0x22, 0x11, 0x70, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d9 @ cfa - 48 - 16 * VG ; FP-CHECK-NEXT: .cfi_escape 0x10, 0x4a, 0x0a, 0x11, 0x50, 0x22, 0x11, 0x68, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d10 @ cfa - 48 - 24 * VG @@ -464,16 +485,23 @@ define void @vg_unwind_with_sve_args( %x) #0 { ; FP-CHECK-NEXT: smstart sm ; FP-CHECK-NEXT: .cfi_restore vg ; FP-CHECK-NEXT: addvl sp, sp, #1 -; FP-CHECK-NEXT: ptrue pn8.b +; FP-CHECK-NEXT: ldr z23, [sp, #2, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z22, [sp, #3, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z21, [sp, #4, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z20, [sp, #5, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z19, [sp, #6, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z18, [sp, #7, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z17, [sp, #8, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z16, [sp, #9, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z15, [sp, #10, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z14, [sp, #11, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z13, [sp, #12, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z12, [sp, #13, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z11, [sp, #14, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z10, [sp, #15, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z9, [sp, #16, mul vl] // 16-byte Folded Reload +; FP-CHECK-NEXT: ldr z8, [sp, #17, mul vl] // 16-byte Folded Reload ; FP-CHECK-NEXT: ldr p15, [sp, #4, mul vl] // 2-byte Folded Reload -; FP-CHECK-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #4, mul vl] // 32-byte Folded Reload -; FP-CHECK-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #8, mul vl] // 32-byte Folded Reload -; FP-CHECK-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #12, mul vl] // 32-byte Folded Reload -; FP-CHECK-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #16, mul vl] // 32-byte Folded Reload -; FP-CHECK-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #20, mul vl] // 32-byte Folded Reload -; FP-CHECK-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload -; FP-CHECK-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #28, mul vl] // 32-byte Folded Reload -; FP-CHECK-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #32, mul vl] // 32-byte Folded Reload ; FP-CHECK-NEXT: ldr p14, [sp, #5, mul vl] // 2-byte Folded Reload ; FP-CHECK-NEXT: ldr p13, [sp, #6, mul vl] // 2-byte Folded Reload ; FP-CHECK-NEXT: ldr p12, [sp, #7, mul vl] // 2-byte Folded Reload diff --git a/llvm/test/CodeGen/AArch64/sme2-intrinsics-ld1.ll b/llvm/test/CodeGen/AArch64/sme2-intrinsics-ld1.ll index 29d3d68fc4c3d..013d8a0512b15 100644 --- a/llvm/test/CodeGen/AArch64/sme2-intrinsics-ld1.ll +++ b/llvm/test/CodeGen/AArch64/sme2-intrinsics-ld1.ll @@ -55,31 +55,45 @@ define @ld1_x2_i8_z0_z8( %unused, @ld1_x2_i8_z0_z8( %unused, @ld1_x2_i8_z0_z8( %unused, @ld1_x2_i8_z0_z8_scalar( %unused, @ld1_x2_i8_z0_z8_scalar( %unused, @ld1_x2_i8_z0_z8_scalar( %unused, @ld1_x2_i16_z0_z8( %unused, @ld1_x2_i16_z0_z8( %unused, @ld1_x2_i16_z0_z8( %unused, @ld1_x2_i16_z0_z8_scalar( %unused, ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ld1h { z0.h, z8.h }, pn8/z, [x0, x1, lsl #1] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: mov z1.d, z8.d -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload ; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: mov z1.d, z8.d +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload ; STRIDED-NEXT: ret @@ -477,14 +569,20 @@ define @ld1_x2_i16_z0_z8_scalar( %unused, ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-16 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-2 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -497,15 +595,21 @@ define @ld1_x2_i16_z0_z8_scalar( %unused, ; CONTIGUOUS-NEXT: ldr z0, [sp] ; CONTIGUOUS-NEXT: ldr z1, [sp, #1, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #2 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #16 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -573,31 +677,45 @@ define @ld1_x2_i32_z0_z8( %unused, @ld1_x2_i32_z0_z8( %unused, @ld1_x2_i32_z0_z8( %unused, @ld1_x2_i32_z0_z8_scalar( %unused, < ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ld1w { z0.s, z8.s }, pn8/z, [x0, x1, lsl #2] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: mov z1.d, z8.d -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload ; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: mov z1.d, z8.d +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload ; STRIDED-NEXT: ret @@ -736,14 +880,20 @@ define @ld1_x2_i32_z0_z8_scalar( %unused, < ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-16 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-2 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -756,15 +906,21 @@ define @ld1_x2_i32_z0_z8_scalar( %unused, < ; CONTIGUOUS-NEXT: ldr z0, [sp] ; CONTIGUOUS-NEXT: ldr z1, [sp, #1, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #2 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #16 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -832,31 +988,45 @@ define @ld1_x2_i64_z0_z8( %unused, @ld1_x2_i64_z0_z8( %unused, @ld1_x2_i64_z0_z8( %unused, @ld1_x2_i64_z0_z8_scalar( %unused, < ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ld1d { z0.d, z8.d }, pn8/z, [x0, x1, lsl #3] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: mov z1.d, z8.d -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload ; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: mov z1.d, z8.d +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload ; STRIDED-NEXT: ret @@ -995,14 +1191,20 @@ define @ld1_x2_i64_z0_z8_scalar( %unused, < ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-16 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-2 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -1015,15 +1217,21 @@ define @ld1_x2_i64_z0_z8_scalar( %unused, < ; CONTIGUOUS-NEXT: ldr z0, [sp] ; CONTIGUOUS-NEXT: ldr z1, [sp, #1, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #2 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #16 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1093,32 +1301,46 @@ define @ld1_x4_i8_z0_z4_z8_z12( %unused, @ld1_x4_i8_z0_z4_z8_z12( %unused, @ld1_x4_i8_z0_z4_z8_z12( %unused, @ld1_x4_i8_z0_z4_z8_z12_scalar( %unu ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ld1b { z0.b, z4.b, z8.b, z12.b }, pn8/z, [x0, x1] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1270,14 +1516,19 @@ define @ld1_x4_i8_z0_z4_z8_z12_scalar( %unu ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -1294,15 +1545,20 @@ define @ld1_x4_i8_z0_z4_z8_z12_scalar( %unu ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1376,32 +1632,46 @@ define @ld1_x4_i16_z0_z4_z8_z12( %unused, ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ld1h { z0.h, z4.h, z8.h, z12.h }, pn8/z, [x0] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1412,14 +1682,19 @@ define @ld1_x4_i16_z0_z4_z8_z12( %unused, ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -1436,15 +1711,20 @@ define @ld1_x4_i16_z0_z4_z8_z12( %unused, ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1518,32 +1798,46 @@ define @ld1_x4_i16_z0_z4_z8_z12_scalar( %u ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ld1h { z0.h, z4.h, z8.h, z12.h }, pn8/z, [x0, x1, lsl #1] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1554,14 +1848,19 @@ define @ld1_x4_i16_z0_z4_z8_z12_scalar( %u ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -1578,15 +1877,20 @@ define @ld1_x4_i16_z0_z4_z8_z12_scalar( %u ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1660,32 +1964,46 @@ define @ld1_x4_i32_z0_z4_z8_z12( %unused, ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ld1w { z0.s, z4.s, z8.s, z12.s }, pn8/z, [x0] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1696,14 +2014,19 @@ define @ld1_x4_i32_z0_z4_z8_z12( %unused, ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -1720,15 +2043,20 @@ define @ld1_x4_i32_z0_z4_z8_z12( %unused, ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1802,32 +2130,46 @@ define @ld1_x4_i32_z0_z4_z8_z12_scalar( %u ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ld1w { z0.s, z4.s, z8.s, z12.s }, pn8/z, [x0, x1, lsl #2] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1838,14 +2180,19 @@ define @ld1_x4_i32_z0_z4_z8_z12_scalar( %u ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -1862,15 +2209,20 @@ define @ld1_x4_i32_z0_z4_z8_z12_scalar( %u ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1944,32 +2296,46 @@ define @ld1_x4_i64_z0_z4_z8_z12( %unused, < ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ld1d { z0.d, z4.d, z8.d, z12.d }, pn8/z, [x0] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1980,14 +2346,19 @@ define @ld1_x4_i64_z0_z4_z8_z12( %unused, < ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -2004,15 +2375,20 @@ define @ld1_x4_i64_z0_z4_z8_z12( %unused, < ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -2086,32 +2462,46 @@ define @ld1_x4_i64_z0_z4_z8_z12_scalar( %un ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ld1d { z0.d, z4.d, z8.d, z12.d }, pn8/z, [x0, x1, lsl #3] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -2122,14 +2512,19 @@ define @ld1_x4_i64_z0_z4_z8_z12_scalar( %un ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -2146,15 +2541,20 @@ define @ld1_x4_i64_z0_z4_z8_z12_scalar( %un ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload diff --git a/llvm/test/CodeGen/AArch64/sme2-intrinsics-ldnt1.ll b/llvm/test/CodeGen/AArch64/sme2-intrinsics-ldnt1.ll index 3d3748e101122..eff1260c947dd 100644 --- a/llvm/test/CodeGen/AArch64/sme2-intrinsics-ldnt1.ll +++ b/llvm/test/CodeGen/AArch64/sme2-intrinsics-ldnt1.ll @@ -8,31 +8,45 @@ define @ldnt1_x2_i8_z0_z8( %unused, @ldnt1_x2_i8_z0_z8( %unused, @ldnt1_x2_i8_z0_z8( %unused, @ldnt1_x2_i8_z0_z8_scalar( %unused, ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ldnt1b { z0.b, z8.b }, pn8/z, [x0, x1] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: mov z1.d, z8.d -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload ; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: mov z1.d, z8.d +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload ; STRIDED-NEXT: ret @@ -124,14 +164,20 @@ define @ldnt1_x2_i8_z0_z8_scalar( %unused, ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-16 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-2 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -144,15 +190,21 @@ define @ldnt1_x2_i8_z0_z8_scalar( %unused, ; CONTIGUOUS-NEXT: ldr z0, [sp] ; CONTIGUOUS-NEXT: ldr z1, [sp, #1, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #2 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #16 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -173,31 +225,45 @@ define @ldnt1_x2_i16_z0_z8( %unused, @ldnt1_x2_i16_z0_z8( %unused, @ldnt1_x2_i16_z0_z8( %unused, @ldnt1_x2_i16_z0_z8_scalar( %unused ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ldnt1h { z0.h, z8.h }, pn8/z, [x0, x1, lsl #1] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: mov z1.d, z8.d -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload ; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: mov z1.d, z8.d +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload ; STRIDED-NEXT: ret @@ -289,14 +381,20 @@ define @ldnt1_x2_i16_z0_z8_scalar( %unused ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-16 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-2 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -309,15 +407,21 @@ define @ldnt1_x2_i16_z0_z8_scalar( %unused ; CONTIGUOUS-NEXT: ldr z0, [sp] ; CONTIGUOUS-NEXT: ldr z1, [sp, #1, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #2 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #16 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -338,31 +442,45 @@ define @ldnt1_x2_i32_z0_z8( %unused, @ldnt1_x2_i32_z0_z8( %unused, @ldnt1_x2_i32_z0_z8( %unused, @ldnt1_x2_i32_z0_z8_scalar( %unused, ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ldnt1w { z0.s, z8.s }, pn8/z, [x0, x1, lsl #2] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: mov z1.d, z8.d -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload ; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: mov z1.d, z8.d +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload ; STRIDED-NEXT: ret @@ -454,14 +598,20 @@ define @ldnt1_x2_i32_z0_z8_scalar( %unused, ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-16 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-2 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -474,15 +624,21 @@ define @ldnt1_x2_i32_z0_z8_scalar( %unused, ; CONTIGUOUS-NEXT: ldr z0, [sp] ; CONTIGUOUS-NEXT: ldr z1, [sp, #1, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #2 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #16 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -503,31 +659,45 @@ define @ldnt1_x2_i64_z0_z8( %unused, @ldnt1_x2_i64_z0_z8( %unused, @ldnt1_x2_i64_z0_z8( %unused, @ldnt1_x2_i64_z0_z8_scalar( %unused, ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ldnt1d { z0.d, z8.d }, pn8/z, [x0, x1, lsl #3] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: mov z1.d, z8.d -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload ; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: mov z1.d, z8.d +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload ; STRIDED-NEXT: ret @@ -619,14 +815,20 @@ define @ldnt1_x2_i64_z0_z8_scalar( %unused, ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-16 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-2 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -639,15 +841,21 @@ define @ldnt1_x2_i64_z0_z8_scalar( %unused, ; CONTIGUOUS-NEXT: ldr z0, [sp] ; CONTIGUOUS-NEXT: ldr z1, [sp, #1, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #2 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #16 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -668,32 +876,46 @@ define @ldnt1_x4_i8_z0_z4_z8_z12( %unused, ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ldnt1b { z0.b, z4.b, z8.b, z12.b }, pn8/z, [x0] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -704,14 +926,19 @@ define @ldnt1_x4_i8_z0_z4_z8_z12( %unused, ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -728,15 +955,20 @@ define @ldnt1_x4_i8_z0_z4_z8_z12( %unused, ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -760,32 +992,46 @@ define @ldnt1_x4_i8_z0_z4_z8_z12_scalar( %u ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ldnt1b { z0.b, z4.b, z8.b, z12.b }, pn8/z, [x0, x1] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -796,14 +1042,19 @@ define @ldnt1_x4_i8_z0_z4_z8_z12_scalar( %u ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -820,15 +1071,20 @@ define @ldnt1_x4_i8_z0_z4_z8_z12_scalar( %u ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -853,32 +1109,46 @@ define @ldnt1_x4_i16_z0_z4_z8_z12( %unused ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ldnt1h { z0.h, z4.h, z8.h, z12.h }, pn8/z, [x0] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -889,14 +1159,19 @@ define @ldnt1_x4_i16_z0_z4_z8_z12( %unused ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -913,15 +1188,20 @@ define @ldnt1_x4_i16_z0_z4_z8_z12( %unused ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -945,32 +1225,46 @@ define @ldnt1_x4_i16_z0_z4_z8_z12_scalar( ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ldnt1h { z0.h, z4.h, z8.h, z12.h }, pn8/z, [x0, x1, lsl #1] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -981,14 +1275,19 @@ define @ldnt1_x4_i16_z0_z4_z8_z12_scalar( ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -1005,15 +1304,20 @@ define @ldnt1_x4_i16_z0_z4_z8_z12_scalar( ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1038,32 +1342,46 @@ define @ldnt1_x4_i32_z0_z4_z8_z12( %unused ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ldnt1w { z0.s, z4.s, z8.s, z12.s }, pn8/z, [x0] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1074,14 +1392,19 @@ define @ldnt1_x4_i32_z0_z4_z8_z12( %unused ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -1098,15 +1421,20 @@ define @ldnt1_x4_i32_z0_z4_z8_z12( %unused ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1130,32 +1458,46 @@ define @ldnt1_x4_i32_z0_z4_z8_z12_scalar( ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ldnt1w { z0.s, z4.s, z8.s, z12.s }, pn8/z, [x0, x1, lsl #2] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1166,14 +1508,19 @@ define @ldnt1_x4_i32_z0_z4_z8_z12_scalar( ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -1190,15 +1537,20 @@ define @ldnt1_x4_i32_z0_z4_z8_z12_scalar( ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1223,32 +1575,46 @@ define @ldnt1_x4_i64_z0_z4_z8_z12( %unused, ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ldnt1d { z0.d, z4.d, z8.d, z12.d }, pn8/z, [x0] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1259,14 +1625,19 @@ define @ldnt1_x4_i64_z0_z4_z8_z12( %unused, ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -1283,15 +1654,20 @@ define @ldnt1_x4_i64_z0_z4_z8_z12( %unused, ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1315,32 +1691,46 @@ define @ldnt1_x4_i64_z0_z4_z8_z12_scalar( % ; STRIDED-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; STRIDED-NEXT: addvl sp, sp, #-17 ; STRIDED-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #22, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #26, mul vl] // 32-byte Folded Spill -; STRIDED-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #30, mul vl] // 32-byte Folded Spill ; STRIDED-NEXT: mov p8.b, p0.b +; STRIDED-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z12, [sp, #12, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z11, [sp, #13, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z10, [sp, #14, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z9, [sp, #15, mul vl] // 16-byte Folded Spill +; STRIDED-NEXT: str z8, [sp, #16, mul vl] // 16-byte Folded Spill ; STRIDED-NEXT: ldnt1d { z0.d, z4.d, z8.d, z12.d }, pn8/z, [x0, x1, lsl #3] ; STRIDED-NEXT: //APP ; STRIDED-NEXT: nop ; STRIDED-NEXT: //NO_APP -; STRIDED-NEXT: ptrue pn8.b -; STRIDED-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #26, mul vl] // 32-byte Folded Reload +; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z2.d, z8.d ; STRIDED-NEXT: mov z3.d, z12.d -; STRIDED-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #22, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #30, mul vl] // 32-byte Folded Reload -; STRIDED-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload +; STRIDED-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z12, [sp, #12, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z11, [sp, #13, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z10, [sp, #14, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z9, [sp, #15, mul vl] // 16-byte Folded Reload +; STRIDED-NEXT: ldr z8, [sp, #16, mul vl] // 16-byte Folded Reload ; STRIDED-NEXT: mov z1.d, z4.d ; STRIDED-NEXT: addvl sp, sp, #17 ; STRIDED-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -1351,14 +1741,19 @@ define @ldnt1_x4_i64_z0_z4_z8_z12_scalar( % ; CONTIGUOUS-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-15 ; CONTIGUOUS-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; CONTIGUOUS-NEXT: ptrue pn8.b -; CONTIGUOUS-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #6, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #10, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #14, mul vl] // 32-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #18, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z23, [sp, #1, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z22, [sp, #2, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z21, [sp, #3, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z20, [sp, #4, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z19, [sp, #5, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z18, [sp, #6, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z17, [sp, #7, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z16, [sp, #8, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z15, [sp, #9, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z14, [sp, #10, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z13, [sp, #11, mul vl] // 16-byte Folded Spill -; CONTIGUOUS-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill +; CONTIGUOUS-NEXT: str z11, [sp, #12, mul vl] // 16-byte Folded Spill +; CONTIGUOUS-NEXT: str z10, [sp, #13, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: str z9, [sp, #14, mul vl] // 16-byte Folded Spill ; CONTIGUOUS-NEXT: addvl sp, sp, #-4 ; CONTIGUOUS-NEXT: mov p8.b, p0.b @@ -1375,15 +1770,20 @@ define @ldnt1_x4_i64_z0_z4_z8_z12_scalar( % ; CONTIGUOUS-NEXT: ldr z2, [sp, #2, mul vl] ; CONTIGUOUS-NEXT: ldr z3, [sp, #3, mul vl] ; CONTIGUOUS-NEXT: addvl sp, sp, #4 -; CONTIGUOUS-NEXT: ptrue pn8.b +; CONTIGUOUS-NEXT: ldr z23, [sp, #1, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z22, [sp, #2, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z21, [sp, #3, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z20, [sp, #4, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z19, [sp, #5, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z18, [sp, #6, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z17, [sp, #7, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z16, [sp, #8, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z15, [sp, #9, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z14, [sp, #10, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z13, [sp, #11, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z11, [sp, #12, mul vl] // 16-byte Folded Reload +; CONTIGUOUS-NEXT: ldr z10, [sp, #13, mul vl] // 16-byte Folded Reload ; CONTIGUOUS-NEXT: ldr z9, [sp, #14, mul vl] // 16-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #6, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #10, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #14, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #18, mul vl] // 32-byte Folded Reload -; CONTIGUOUS-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload ; CONTIGUOUS-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload ; CONTIGUOUS-NEXT: addvl sp, sp, #15 ; CONTIGUOUS-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload diff --git a/llvm/test/CodeGen/AArch64/spillfill-sve.mir b/llvm/test/CodeGen/AArch64/spillfill-sve.mir index 11cf388e38531..83c9b73c57570 100644 --- a/llvm/test/CodeGen/AArch64/spillfill-sve.mir +++ b/llvm/test/CodeGen/AArch64/spillfill-sve.mir @@ -11,6 +11,7 @@ define aarch64_sve_vector_pcs void @spills_fills_stack_id_ppr2mul2() #0 { entry: unreachable } define aarch64_sve_vector_pcs void @spills_fills_stack_id_pnr() #1 { entry: unreachable } define aarch64_sve_vector_pcs void @spills_fills_stack_id_virtreg_pnr() #1 { entry: unreachable } + define aarch64_sve_vector_pcs void @spills_fills_stack_id_virtreg_ppr_to_pnr() #1 { entry: unreachable } define aarch64_sve_vector_pcs void @spills_fills_stack_id_zpr() #0 { entry: unreachable } define aarch64_sve_vector_pcs void @spills_fills_stack_id_zpr2() #0 { entry: unreachable } define aarch64_sve_vector_pcs void @spills_fills_stack_id_zpr2strided() #0 { entry: unreachable } @@ -216,7 +217,7 @@ body: | ; EXPAND: STR_PXI killed renamable $pn8, $sp, 7 ; ; EXPAND: renamable $pn8 = LDR_PXI $sp, 7 - ; EXPAND: $p0 = PEXT_PCI_B killed renamable $pn8, 0 + ; EXPAND-NEXT: $p0 = PEXT_PCI_B killed renamable $pn8, 0 %0:pnr_p8to15 = WHILEGE_CXX_B undef $x0, undef $x0, 0, implicit-def dead $nzcv @@ -242,6 +243,40 @@ body: | RET_ReallyLR ... --- +name: spills_fills_stack_id_virtreg_ppr_to_pnr +tracksRegLiveness: true +registers: + - { id: 0, class: ppr } + - { id: 1, class: pnr_p8to15 } +stack: +body: | + bb.0.entry: + liveins: $p0 + + %0:ppr = COPY $p0 + + $pn0 = IMPLICIT_DEF + $pn1 = IMPLICIT_DEF + $pn2 = IMPLICIT_DEF + $pn3 = IMPLICIT_DEF + $pn4 = IMPLICIT_DEF + $pn5 = IMPLICIT_DEF + $pn6 = IMPLICIT_DEF + $pn7 = IMPLICIT_DEF + $pn8 = IMPLICIT_DEF + $pn9 = IMPLICIT_DEF + $pn10 = IMPLICIT_DEF + $pn11 = IMPLICIT_DEF + $pn12 = IMPLICIT_DEF + $pn13 = IMPLICIT_DEF + $pn14 = IMPLICIT_DEF + $pn15 = IMPLICIT_DEF + + %1:pnr_p8to15 = COPY %0 + $p0 = PEXT_PCI_B %1, 0 + RET_ReallyLR +... +--- name: spills_fills_stack_id_zpr tracksRegLiveness: true registers: diff --git a/llvm/test/CodeGen/AArch64/ssve-stack-hazard-remarks.ll b/llvm/test/CodeGen/AArch64/ssve-stack-hazard-remarks.ll new file mode 100644 index 0000000000000..0b6bf3892a0c2 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/ssve-stack-hazard-remarks.ll @@ -0,0 +1,152 @@ +; RUN: llc < %s -mtriple=aarch64 -mattr=+sve2 -pass-remarks-analysis=sme -aarch64-stack-hazard-remark-size=64 -o /dev/null < %s 2>&1 | FileCheck %s --check-prefixes=CHECK +; RUN: llc < %s -mtriple=aarch64 -mattr=+sve2 -pass-remarks-analysis=sme -aarch64-stack-hazard-size=1024 -o /dev/null < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-PADDING + +; Don't emit remarks for non-streaming functions. +define float @csr_x20_stackargs_notsc(float %a, float %b, float %c, float %d, float %e, float %f, float %g, float %h, float %i) { +; CHECK-NOT: remark: :0:0: stack hazard in 'csr_x20_stackargs_notsc': +; CHECK-PADDING-NOT: remark: :0:0: stack hazard in 'csr_x20_stackargs_notsc': +entry: + tail call void asm sideeffect "", "~{x20}"() #1 + ret float %i +} + +; Don't emit remarks for functions that only access GPR stack objects. +define i64 @stackargs_gpr(i64 %a, i64 %b, i64 %c, i64 %d, i64 %e, i64 %f, i64 %g, i64 %h, i64 %i) #2 { +; CHECK-NOT: remark: :0:0: stack hazard in 'csr_x20_stackargs_gpr': +; CHECK-PADDING-NOT: remark: :0:0: stack hazard in 'csr_x20_stackargs_gpr': +entry: + ret i64 %i +} + +; Don't emit remarks for functions that only access FPR stack objects. +define double @stackargs_fpr(double %a, double %b, double %c, double %d, double %e, double %f, double %g, double %h, double %i) #2 { +; CHECK-NOT: remark: :0:0: stack hazard in 'csr_x20_stackargs_fpr': +; CHECK-PADDING-NOT: remark: :0:0: stack hazard in 'csr_x20_stackargs_fpr': +entry: + ret double %i +} + +; As this case is handled by addition of stack hazard padding, only emit remarks when this is not switched on. +define i32 @csr_d8_alloci64(i64 %d) #2 { +; CHECK: remark: :0:0: stack hazard in 'csr_d8_alloci64': FPR stack object at [SP-16] is too close to GPR stack object at [SP-8] +; CHECK-PADDING-NOT: remark: :0:0: stack hazard in 'csr_d8_alloci64': +entry: + %a = alloca i64 + tail call void asm sideeffect "", "~{d8}"() #1 + store i64 %d, ptr %a + ret i32 0 +} + +; As this case is handled by addition of stack hazard padding, only emit remarks when this is not switched on. +define i32 @csr_d8_allocnxv4i32(i64 %d) #2 { +; CHECK: remark: :0:0: stack hazard in 'csr_d8_allocnxv4i32': FPR stack object at [SP-16] is too close to GPR stack object at [SP-8] +; CHECK-PADDING-NOT: remark: :0:0: stack hazard in 'csr_d8_allocnxv4i32': +entry: + %a = alloca + tail call void asm sideeffect "", "~{d8}"() #1 + store zeroinitializer, ptr %a + ret i32 0 +} + +define float @csr_x20_stackargs(float %a, float %b, float %c, float %d, float %e, float %f, float %g, float %h, float %i) #2 { +; CHECK: remark: :0:0: stack hazard in 'csr_x20_stackargs': GPR stack object at [SP-16] is too close to FPR stack object at [SP+0] +; CHECK-PADDING: remark: :0:0: stack hazard in 'csr_x20_stackargs': GPR stack object at [SP-16] is too close to FPR stack object at [SP+0] +entry: + tail call void asm sideeffect "", "~{x20}"() #1 + ret float %i +} + +; In this case, addition of stack hazard padding triggers x29 (fp) spill, so we hazard occurs between FPR argument and GPR spill. +define float @csr_d8_stackargs(float %a, float %b, float %c, float %d, float %e, float %f, float %g, float %h, float %i) #2 { +; CHECK-NOT: remark: :0:0: stack hazard in 'csr_d8_stackargs': +; CHECK-PADDING: remark: :0:0: stack hazard in 'csr_d8_stackargs': GPR stack object at [SP-8] is too close to FPR stack object at [SP+0] +entry: + tail call void asm sideeffect "", "~{d8}"() #1 + ret float %i +} + +; SVE calling conventions +; Predicate register spills end up in FP region, currently. + +define i32 @svecc_call(<4 x i16> %P0, ptr %P1, i32 %P2, %P3, i16 %P4) #2 { +; CHECK: remark: :0:0: stack hazard in 'svecc_call': PPR stack object at [SP-48-258 * vscale] is too close to FPR stack object at [SP-48-256 * vscale] +; CHECK: remark: :0:0: stack hazard in 'svecc_call': FPR stack object at [SP-48-16 * vscale] is too close to GPR stack object at [SP-48] +; CHECK-PADDING: remark: :0:0: stack hazard in 'svecc_call': PPR stack object at [SP-1072-258 * vscale] is too close to FPR stack object at [SP-1072-256 * vscale] +; CHECK-PADDING-NOT: remark: :0:0: stack hazard in 'svecc_call': +entry: + tail call void asm sideeffect "", "~{x0},~{x28},~{x27},~{x3}"() #2 + %call = call ptr @memset(ptr noundef nonnull %P1, i32 noundef 45, i32 noundef 37) + ret i32 -396142473 +} + +define i32 @svecc_alloca_call(<4 x i16> %P0, ptr %P1, i32 %P2, %P3, i16 %P4) #2 { +; CHECK: remark: :0:0: stack hazard in 'svecc_alloca_call': PPR stack object at [SP-48-258 * vscale] is too close to FPR stack object at [SP-48-256 * vscale] +; CHECK: remark: :0:0: stack hazard in 'svecc_alloca_call': FPR stack object at [SP-48-16 * vscale] is too close to GPR stack object at [SP-48] +; CHECK-PADDING: remark: :0:0: stack hazard in 'svecc_alloca_call': PPR stack object at [SP-1072-258 * vscale] is too close to FPR stack object at [SP-1072-256 * vscale] +; CHECK-PADDING-NOT: remark: :0:0: stack hazard in 'svecc_alloca_call': +entry: + tail call void asm sideeffect "", "~{x0},~{x28},~{x27},~{x3}"() #2 + %0 = alloca [37 x i8], align 16 + %call = call ptr @memset(ptr noundef nonnull %0, i32 noundef 45, i32 noundef 37) + ret i32 -396142473 +} +declare ptr @memset(ptr, i32, i32) + +%struct.mixed_struct = type { i32, float } + +define i32 @mixed_stack_object(i32 %a, float %b) #2 { +; CHECK: remark: :0:0: stack hazard in 'mixed_stack_object': Mixed stack object at [SP-8] accessed by both GP and FP instructions +; CHECK-PADDING: remark: :0:0: stack hazard in 'mixed_stack_object': Mixed stack object at [SP-8] accessed by both GP and FP instructions +entry: + %s = alloca %struct.mixed_struct + %s.i = getelementptr %struct.mixed_struct, ptr %s, i32 0, i32 0 + %s.f = getelementptr %struct.mixed_struct, ptr %s, i32 0, i32 1 + store i32 %a, ptr %s.i + store float %b, ptr %s.f + ret i32 %a +} + +define i32 @mixed_stack_objects(i32 %a, float %b) #2 { +; CHECK: remark: :0:0: stack hazard in 'mixed_stack_objects': Mixed stack object at [SP-16] is too close to Mixed stack object at [SP-8] +; CHECK: remark: :0:0: stack hazard in 'mixed_stack_objects': Mixed stack object at [SP-16] accessed by both GP and FP instructions +; CHECK: remark: :0:0: stack hazard in 'mixed_stack_objects': Mixed stack object at [SP-8] accessed by both GP and FP instructions +; CHECK-PADDING: remark: :0:0: stack hazard in 'mixed_stack_objects': Mixed stack object at [SP-16] is too close to Mixed stack object at [SP-8] +; CHECK-PADDING: remark: :0:0: stack hazard in 'mixed_stack_objects': Mixed stack object at [SP-16] accessed by both GP and FP instructions +; CHECK-PADDING: remark: :0:0: stack hazard in 'mixed_stack_objects': Mixed stack object at [SP-8] accessed by both GP and FP instructions +entry: + %s0 = alloca %struct.mixed_struct + %s0.i = getelementptr %struct.mixed_struct, ptr %s0, i32 0, i32 0 + %s0.f = getelementptr %struct.mixed_struct, ptr %s0, i32 0, i32 1 + store i32 %a, ptr %s0.i + store float %b, ptr %s0.f + + %s1 = alloca %struct.mixed_struct + %s1.i = getelementptr %struct.mixed_struct, ptr %s1, i32 0, i32 0 + %s1.f = getelementptr %struct.mixed_struct, ptr %s1, i32 0, i32 1 + store i32 %a, ptr %s1.i + store float %b, ptr %s1.f + + ret i32 %a +} + +; VLA-area stack objects are not separated. +define i32 @csr_d8_allocnxv4i32i32f64_vlai32f64(double %d, i32 %i) #2 { +; CHECK: remark: :0:0: stack hazard in 'csr_d8_allocnxv4i32i32f64_vlai32f64': GPR stack object at [SP-48-16 * vscale] is too close to FPR stack object at [SP-48-16 * vscale] +; CHECK: remark: :0:0: stack hazard in 'csr_d8_allocnxv4i32i32f64_vlai32f64': FPR stack object at [SP-32] is too close to GPR stack object at [SP-24] +; CHECK-PADDING: remark: :0:0: stack hazard in 'csr_d8_allocnxv4i32i32f64_vlai32f64': GPR stack object at [SP-2096-16 * vscale] is too close to FPR stack object at [SP-2096-16 * vscale] +; CHECK-PADDING-NOT: remark: :0:0: stack hazard in 'csr_d8_allocnxv4i32i32f64_vlai32f64': +entry: + %a = alloca + %0 = zext i32 %i to i64 + %vla0 = alloca i32, i64 %0 + %vla1 = alloca double, i64 %0 + %c = alloca double + tail call void asm sideeffect "", "~{d8}"() #1 + store zeroinitializer, ptr %a + store i32 zeroinitializer, ptr %vla0 + store double %d, ptr %vla1 + store double %d, ptr %c + ret i32 0 +} + +attributes #2 = { "aarch64_pstate_sm_compatible" } diff --git a/llvm/test/CodeGen/AArch64/sve-callee-save-restore-pairs.ll b/llvm/test/CodeGen/AArch64/sve-callee-save-restore-pairs.ll index 470c0dd45782c..c0d5d9dfdbb0d 100644 --- a/llvm/test/CodeGen/AArch64/sve-callee-save-restore-pairs.ll +++ b/llvm/test/CodeGen/AArch64/sve-callee-save-restore-pairs.ll @@ -88,27 +88,34 @@ define void @fbyte( %v) { ; PAIR: // %bb.0: ; PAIR-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill ; PAIR-NEXT: addvl sp, sp, #-18 -; PAIR-NEXT: str p8, [sp, #11, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: ptrue pn8.b ; PAIR-NEXT: str p15, [sp, #4, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #4, mul vl] // 32-byte Folded Spill -; PAIR-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #8, mul vl] // 32-byte Folded Spill ; PAIR-NEXT: str p14, [sp, #5, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #12, mul vl] // 32-byte Folded Spill -; PAIR-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #16, mul vl] // 32-byte Folded Spill ; PAIR-NEXT: str p13, [sp, #6, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #20, mul vl] // 32-byte Folded Spill -; PAIR-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill ; PAIR-NEXT: str p12, [sp, #7, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #28, mul vl] // 32-byte Folded Spill ; PAIR-NEXT: str p11, [sp, #8, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str p10, [sp, #9, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str p9, [sp, #10, mul vl] // 2-byte Folded Spill +; PAIR-NEXT: str p8, [sp, #11, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str p7, [sp, #12, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str p6, [sp, #13, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str p5, [sp, #14, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str p4, [sp, #15, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #32, mul vl] // 32-byte Folded Spill +; PAIR-NEXT: str z23, [sp, #2, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z22, [sp, #3, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z21, [sp, #4, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z20, [sp, #5, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z19, [sp, #6, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z18, [sp, #7, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z17, [sp, #8, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z16, [sp, #9, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z15, [sp, #10, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z14, [sp, #11, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z13, [sp, #12, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z12, [sp, #13, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z11, [sp, #14, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z10, [sp, #15, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z9, [sp, #16, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z8, [sp, #17, mul vl] // 16-byte Folded Spill ; PAIR-NEXT: .cfi_escape 0x0f, 0x0d, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x90, 0x01, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 144 * VG ; PAIR-NEXT: .cfi_offset w30, -8 ; PAIR-NEXT: .cfi_offset w29, -16 @@ -121,16 +128,23 @@ define void @fbyte( %v) { ; PAIR-NEXT: .cfi_escape 0x10, 0x4e, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x48, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d14 @ cfa - 16 - 56 * VG ; PAIR-NEXT: .cfi_escape 0x10, 0x4f, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x40, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d15 @ cfa - 16 - 64 * VG ; PAIR-NEXT: bl my_func -; PAIR-NEXT: ptrue pn8.b +; PAIR-NEXT: ldr z23, [sp, #2, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z22, [sp, #3, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z21, [sp, #4, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z20, [sp, #5, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z19, [sp, #6, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z18, [sp, #7, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z17, [sp, #8, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z16, [sp, #9, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z15, [sp, #10, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z14, [sp, #11, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z13, [sp, #12, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z12, [sp, #13, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z11, [sp, #14, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z10, [sp, #15, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z9, [sp, #16, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z8, [sp, #17, mul vl] // 16-byte Folded Reload ; PAIR-NEXT: ldr p15, [sp, #4, mul vl] // 2-byte Folded Reload -; PAIR-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #4, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #8, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #12, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #16, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #20, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #28, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #32, mul vl] // 32-byte Folded Reload ; PAIR-NEXT: ldr p14, [sp, #5, mul vl] // 2-byte Folded Reload ; PAIR-NEXT: ldr p13, [sp, #6, mul vl] // 2-byte Folded Reload ; PAIR-NEXT: ldr p12, [sp, #7, mul vl] // 2-byte Folded Reload @@ -230,27 +244,34 @@ define void @fhalf( %v) { ; PAIR: // %bb.0: ; PAIR-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill ; PAIR-NEXT: addvl sp, sp, #-18 -; PAIR-NEXT: str p8, [sp, #11, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: ptrue pn8.b ; PAIR-NEXT: str p15, [sp, #4, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: st1b { z22.b, z23.b }, pn8, [sp, #4, mul vl] // 32-byte Folded Spill -; PAIR-NEXT: st1b { z20.b, z21.b }, pn8, [sp, #8, mul vl] // 32-byte Folded Spill ; PAIR-NEXT: str p14, [sp, #5, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: st1b { z18.b, z19.b }, pn8, [sp, #12, mul vl] // 32-byte Folded Spill -; PAIR-NEXT: st1b { z16.b, z17.b }, pn8, [sp, #16, mul vl] // 32-byte Folded Spill ; PAIR-NEXT: str p13, [sp, #6, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: st1b { z14.b, z15.b }, pn8, [sp, #20, mul vl] // 32-byte Folded Spill -; PAIR-NEXT: st1b { z12.b, z13.b }, pn8, [sp, #24, mul vl] // 32-byte Folded Spill ; PAIR-NEXT: str p12, [sp, #7, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: st1b { z10.b, z11.b }, pn8, [sp, #28, mul vl] // 32-byte Folded Spill ; PAIR-NEXT: str p11, [sp, #8, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str p10, [sp, #9, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str p9, [sp, #10, mul vl] // 2-byte Folded Spill +; PAIR-NEXT: str p8, [sp, #11, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str p7, [sp, #12, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str p6, [sp, #13, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str p5, [sp, #14, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str p4, [sp, #15, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #32, mul vl] // 32-byte Folded Spill +; PAIR-NEXT: str z23, [sp, #2, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z22, [sp, #3, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z21, [sp, #4, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z20, [sp, #5, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z19, [sp, #6, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z18, [sp, #7, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z17, [sp, #8, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z16, [sp, #9, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z15, [sp, #10, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z14, [sp, #11, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z13, [sp, #12, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z12, [sp, #13, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z11, [sp, #14, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z10, [sp, #15, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z9, [sp, #16, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z8, [sp, #17, mul vl] // 16-byte Folded Spill ; PAIR-NEXT: .cfi_escape 0x0f, 0x0d, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x90, 0x01, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 144 * VG ; PAIR-NEXT: .cfi_offset w30, -8 ; PAIR-NEXT: .cfi_offset w29, -16 @@ -263,16 +284,23 @@ define void @fhalf( %v) { ; PAIR-NEXT: .cfi_escape 0x10, 0x4e, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x48, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d14 @ cfa - 16 - 56 * VG ; PAIR-NEXT: .cfi_escape 0x10, 0x4f, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x40, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d15 @ cfa - 16 - 64 * VG ; PAIR-NEXT: bl my_func -; PAIR-NEXT: ptrue pn8.b +; PAIR-NEXT: ldr z23, [sp, #2, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z22, [sp, #3, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z21, [sp, #4, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z20, [sp, #5, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z19, [sp, #6, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z18, [sp, #7, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z17, [sp, #8, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z16, [sp, #9, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z15, [sp, #10, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z14, [sp, #11, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z13, [sp, #12, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z12, [sp, #13, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z11, [sp, #14, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z10, [sp, #15, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z9, [sp, #16, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z8, [sp, #17, mul vl] // 16-byte Folded Reload ; PAIR-NEXT: ldr p15, [sp, #4, mul vl] // 2-byte Folded Reload -; PAIR-NEXT: ld1b { z22.b, z23.b }, pn8/z, [sp, #4, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z20.b, z21.b }, pn8/z, [sp, #8, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z18.b, z19.b }, pn8/z, [sp, #12, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z16.b, z17.b }, pn8/z, [sp, #16, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z14.b, z15.b }, pn8/z, [sp, #20, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z12.b, z13.b }, pn8/z, [sp, #24, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z10.b, z11.b }, pn8/z, [sp, #28, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #32, mul vl] // 32-byte Folded Reload ; PAIR-NEXT: ldr p14, [sp, #5, mul vl] // 2-byte Folded Reload ; PAIR-NEXT: ldr p13, [sp, #6, mul vl] // 2-byte Folded Reload ; PAIR-NEXT: ldr p12, [sp, #7, mul vl] // 2-byte Folded Reload @@ -323,12 +351,11 @@ define aarch64_sve_vector_pcs void @test_clobbers_z_p_regs() { ; PAIR: // %bb.0: ; PAIR-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; PAIR-NEXT: addvl sp, sp, #-4 -; PAIR-NEXT: str p8, [sp, #5, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: ptrue pn8.b ; PAIR-NEXT: str p5, [sp, #6, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str p4, [sp, #7, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str z10, [sp, #1, mul vl] // 16-byte Folded Spill -; PAIR-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #4, mul vl] // 32-byte Folded Spill +; PAIR-NEXT: str z9, [sp, #2, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z8, [sp, #3, mul vl] // 16-byte Folded Spill ; PAIR-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x20, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 32 * VG ; PAIR-NEXT: .cfi_offset w29, -16 ; PAIR-NEXT: .cfi_escape 0x10, 0x48, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x78, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d8 @ cfa - 16 - 8 * VG @@ -336,10 +363,9 @@ define aarch64_sve_vector_pcs void @test_clobbers_z_p_regs() { ; PAIR-NEXT: .cfi_escape 0x10, 0x4a, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x68, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d10 @ cfa - 16 - 24 * VG ; PAIR-NEXT: //APP ; PAIR-NEXT: //NO_APP -; PAIR-NEXT: ptrue pn8.b ; PAIR-NEXT: ldr z10, [sp, #1, mul vl] // 16-byte Folded Reload -; PAIR-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #4, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ldr p8, [sp, #5, mul vl] // 2-byte Folded Reload +; PAIR-NEXT: ldr z9, [sp, #2, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z8, [sp, #3, mul vl] // 16-byte Folded Reload ; PAIR-NEXT: ldr p5, [sp, #6, mul vl] // 2-byte Folded Reload ; PAIR-NEXT: ldr p4, [sp, #7, mul vl] // 2-byte Folded Reload ; PAIR-NEXT: addvl sp, sp, #4 @@ -381,11 +407,11 @@ define aarch64_sve_vector_pcs void @test_clobbers_z_p_regs2() { ; PAIR: // %bb.0: ; PAIR-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill ; PAIR-NEXT: addvl sp, sp, #-4 -; PAIR-NEXT: str p9, [sp, #7, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: ptrue pn9.b ; PAIR-NEXT: str p10, [sp, #6, mul vl] // 2-byte Folded Spill +; PAIR-NEXT: str p9, [sp, #7, mul vl] // 2-byte Folded Spill ; PAIR-NEXT: str z10, [sp, #1, mul vl] // 16-byte Folded Spill -; PAIR-NEXT: st1b { z8.b, z9.b }, pn9, [sp, #4, mul vl] // 32-byte Folded Spill +; PAIR-NEXT: str z9, [sp, #2, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: str z8, [sp, #3, mul vl] // 16-byte Folded Spill ; PAIR-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x20, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 32 * VG ; PAIR-NEXT: .cfi_offset w29, -16 ; PAIR-NEXT: .cfi_escape 0x10, 0x48, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x78, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d8 @ cfa - 16 - 8 * VG @@ -393,10 +419,10 @@ define aarch64_sve_vector_pcs void @test_clobbers_z_p_regs2() { ; PAIR-NEXT: .cfi_escape 0x10, 0x4a, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x68, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d10 @ cfa - 16 - 24 * VG ; PAIR-NEXT: //APP ; PAIR-NEXT: //NO_APP -; PAIR-NEXT: ptrue pn9.b ; PAIR-NEXT: ldr z10, [sp, #1, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z9, [sp, #2, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: ldr z8, [sp, #3, mul vl] // 16-byte Folded Reload ; PAIR-NEXT: ldr p10, [sp, #6, mul vl] // 2-byte Folded Reload -; PAIR-NEXT: ld1b { z8.b, z9.b }, pn9/z, [sp, #4, mul vl] // 32-byte Folded Reload ; PAIR-NEXT: ldr p9, [sp, #7, mul vl] // 2-byte Folded Reload ; PAIR-NEXT: addvl sp, sp, #4 ; PAIR-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload @@ -429,20 +455,18 @@ define aarch64_sve_vector_pcs void @test_clobbers_z_regs() { ; PAIR-LABEL: test_clobbers_z_regs: ; PAIR: // %bb.0: ; PAIR-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill -; PAIR-NEXT: addvl sp, sp, #-3 -; PAIR-NEXT: str p8, [sp, #7, mul vl] // 2-byte Folded Spill -; PAIR-NEXT: ptrue pn8.b -; PAIR-NEXT: st1b { z8.b, z9.b }, pn8, [sp, #2, mul vl] // 32-byte Folded Spill -; PAIR-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x18, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 24 * VG +; PAIR-NEXT: addvl sp, sp, #-2 +; PAIR-NEXT: str z9, [sp] // 16-byte Folded Spill +; PAIR-NEXT: str z8, [sp, #1, mul vl] // 16-byte Folded Spill +; PAIR-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x10, 0x22, 0x11, 0x10, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 16 + 16 * VG ; PAIR-NEXT: .cfi_offset w29, -16 ; PAIR-NEXT: .cfi_escape 0x10, 0x48, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x78, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d8 @ cfa - 16 - 8 * VG ; PAIR-NEXT: .cfi_escape 0x10, 0x49, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x70, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d9 @ cfa - 16 - 16 * VG ; PAIR-NEXT: //APP ; PAIR-NEXT: //NO_APP -; PAIR-NEXT: ptrue pn8.b -; PAIR-NEXT: ld1b { z8.b, z9.b }, pn8/z, [sp, #2, mul vl] // 32-byte Folded Reload -; PAIR-NEXT: ldr p8, [sp, #7, mul vl] // 2-byte Folded Reload -; PAIR-NEXT: addvl sp, sp, #3 +; PAIR-NEXT: ldr z9, [sp] // 16-byte Folded Reload +; PAIR-NEXT: ldr z8, [sp, #1, mul vl] // 16-byte Folded Reload +; PAIR-NEXT: addvl sp, sp, #2 ; PAIR-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload ; PAIR-NEXT: ret call void asm sideeffect "", "~{z8},~{z9}"() diff --git a/llvm/test/CodeGen/AArch64/sve-stack-frame-layout.ll b/llvm/test/CodeGen/AArch64/sve-stack-frame-layout.ll index 34d85d1f76086..ec94198a08ca7 100644 --- a/llvm/test/CodeGen/AArch64/sve-stack-frame-layout.ll +++ b/llvm/test/CodeGen/AArch64/sve-stack-frame-layout.ll @@ -5,9 +5,9 @@ ; CHECK-FRAMELAYOUT-LABEL: Function: csr_d8_allocnxv4i32i32f64 ; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-8], Type: Spill, Align: 8, Size: 8 ; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16], Type: Spill, Align: 8, Size: 8 -; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-20], Type: Variable, Align: 4, Size: 4 -; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32], Type: Variable, Align: 8, Size: 8 -; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16], Type: Variable, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16-16 x vscale], Type: Variable, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-20-16 x vscale], Type: Variable, Align: 4, Size: 4 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32-16 x vscale], Type: Variable, Align: 8, Size: 8 define i32 @csr_d8_allocnxv4i32i32f64(double %d) "aarch64_pstate_sm_compatible" { ; CHECK-LABEL: csr_d8_allocnxv4i32i32f64: @@ -49,8 +49,8 @@ entry: ; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16], Type: Spill, Align: 8, Size: 8 ; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-20], Type: Variable, Align: 4, Size: 4 ; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32], Type: Spill, Align: 16, Size: 8 -; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-40], Type: Variable, Align: 8, Size: 8 -; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16], Type: Variable, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32-16 x vscale], Type: Variable, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-40-16 x vscale], Type: Variable, Align: 8, Size: 8 define i32 @csr_d8_allocnxv4i32i32f64_fp(double %d) "aarch64_pstate_sm_compatible" "frame-pointer"="all" { ; CHECK-LABEL: csr_d8_allocnxv4i32i32f64_fp: @@ -90,13 +90,174 @@ entry: ret i32 0 } +; In the presence of dynamic stack-realignment we emit correct offsets for +; objects which are not realigned. For realigned objects, e.g. the i32 alloca +; in this test, we emit the correct offset ignoring the re-alignment (i.e. the +; offset if the alignment requirement is already satisfied). + +; CHECK-FRAMELAYOUT-LABEL: Function: csr_d8_allocnxv4i32i32f64_dynamicrealign +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-8], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-24], Type: Variable, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32], Type: Spill, Align: 16, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32-16 x vscale], Type: Variable, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-128-16 x vscale], Type: Variable, Align: 128, Size: 4 + +define i32 @csr_d8_allocnxv4i32i32f64_dynamicrealign(double %d) "aarch64_pstate_sm_compatible" { +; CHECK-LABEL: csr_d8_allocnxv4i32i32f64_dynamicrealign: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: str d8, [sp, #-32]! // 8-byte Folded Spill +; CHECK-NEXT: sub x9, sp, #96 +; CHECK-NEXT: stp x29, x30, [sp, #16] // 16-byte Folded Spill +; CHECK-NEXT: add x29, sp, #16 +; CHECK-NEXT: addvl x9, x9, #-1 +; CHECK-NEXT: and sp, x9, #0xffffffffffffff80 +; CHECK-NEXT: .cfi_def_cfa w29, 16 +; CHECK-NEXT: .cfi_offset w30, -8 +; CHECK-NEXT: .cfi_offset w29, -16 +; CHECK-NEXT: .cfi_offset b8, -32 +; CHECK-NEXT: mov z1.s, #0 // =0x0 +; CHECK-NEXT: ptrue p0.s +; CHECK-NEXT: sub x8, x29, #16 +; CHECK-NEXT: mov w0, wzr +; CHECK-NEXT: //APP +; CHECK-NEXT: //NO_APP +; CHECK-NEXT: str wzr, [sp] +; CHECK-NEXT: stur d0, [x29, #-8] +; CHECK-NEXT: st1w { z1.s }, p0, [x8, #-1, mul vl] +; CHECK-NEXT: sub sp, x29, #16 +; CHECK-NEXT: ldp x29, x30, [sp, #16] // 16-byte Folded Reload +; CHECK-NEXT: ldr d8, [sp], #32 // 8-byte Folded Reload +; CHECK-NEXT: ret +entry: + %a = alloca + %b = alloca i32, align 128 + %c = alloca double + tail call void asm sideeffect "", "~{d8}"() #1 + store zeroinitializer, ptr %a + store i32 zeroinitializer, ptr %b + store double %d, ptr %c + ret i32 0 +} + +; In the presence of VLA-area objects, we emit correct offsets for all objects +; except for these VLA objects. + +; CHECK-FRAMELAYOUT-LABEL: Function: csr_d8_allocnxv4i32i32f64_vla +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-8], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-24], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32-16 x vscale], Type: Variable, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-40-16 x vscale], Type: Variable, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-16 x vscale], Type: VariableSized, Align: 1, Size: 0 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-16 x vscale], Type: VariableSized, Align: 1, Size: 0 + +define i32 @csr_d8_allocnxv4i32i32f64_vla(double %d, i32 %i) "aarch64_pstate_sm_compatible" { +; CHECK-LABEL: csr_d8_allocnxv4i32i32f64_vla: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: str d8, [sp, #-32]! // 8-byte Folded Spill +; CHECK-NEXT: stp x29, x30, [sp, #8] // 16-byte Folded Spill +; CHECK-NEXT: add x29, sp, #8 +; CHECK-NEXT: str x19, [sp, #24] // 8-byte Folded Spill +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: addvl sp, sp, #-1 +; CHECK-NEXT: mov x19, sp +; CHECK-NEXT: .cfi_def_cfa w29, 24 +; CHECK-NEXT: .cfi_offset w19, -8 +; CHECK-NEXT: .cfi_offset w30, -16 +; CHECK-NEXT: .cfi_offset w29, -24 +; CHECK-NEXT: .cfi_offset b8, -32 +; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 +; CHECK-NEXT: ubfiz x8, x0, #2, #32 +; CHECK-NEXT: mov x9, sp +; CHECK-NEXT: add x8, x8, #15 +; CHECK-NEXT: and x8, x8, #0x7fffffff0 +; CHECK-NEXT: sub x9, x9, x8 +; CHECK-NEXT: mov sp, x9 +; CHECK-NEXT: mov x10, sp +; CHECK-NEXT: sub x8, x10, x8 +; CHECK-NEXT: mov sp, x8 +; CHECK-NEXT: mov z1.s, #0 // =0x0 +; CHECK-NEXT: ptrue p0.s +; CHECK-NEXT: //APP +; CHECK-NEXT: //NO_APP +; CHECK-NEXT: str wzr, [x8] +; CHECK-NEXT: sub x8, x29, #8 +; CHECK-NEXT: mov w0, wzr +; CHECK-NEXT: str wzr, [x9] +; CHECK-NEXT: st1w { z1.s }, p0, [x8, #-1, mul vl] +; CHECK-NEXT: str d0, [x19, #8] +; CHECK-NEXT: sub sp, x29, #8 +; CHECK-NEXT: ldp x29, x30, [sp, #8] // 16-byte Folded Reload +; CHECK-NEXT: ldr x19, [sp, #24] // 8-byte Folded Reload +; CHECK-NEXT: ldr d8, [sp], #32 // 8-byte Folded Reload +; CHECK-NEXT: ret +entry: + %a = alloca + %0 = zext i32 %i to i64 + %vla0 = alloca i32, i64 %0 + %vla1 = alloca i32, i64 %0 + %c = alloca double + tail call void asm sideeffect "", "~{d8}"() #1 + store zeroinitializer, ptr %a + store i32 zeroinitializer, ptr %vla0 + store i32 zeroinitializer, ptr %vla1 + store double %d, ptr %c + ret i32 0 +} + +; CHECK-FRAMELAYOUT-LABEL: Function: csr_d8_allocnxv4i32i32f64_stackargsi32f64 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP+8], Type: Fixed, Align: 8, Size: 4 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP+0], Type: Fixed, Align: 16, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-8], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16-16 x vscale], Type: Variable, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-20-16 x vscale], Type: Variable, Align: 4, Size: 4 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32-16 x vscale], Type: Variable, Align: 8, Size: 8 + +define i32 @csr_d8_allocnxv4i32i32f64_stackargsi32f64(double %d0, double %d1, double %d2, double %d3, double %d4, double %d5, double %d6, double %d7, double %d8, i32 %i0, i32 %i1, i32 %i2, i32 %i3, i32 %i4, i32 %i5, i32 %i6, i32 %i7, i32 %i8) "aarch64_pstate_sm_compatible" { +; CHECK-LABEL: csr_d8_allocnxv4i32i32f64_stackargsi32f64: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: str d8, [sp, #-16]! // 8-byte Folded Spill +; CHECK-NEXT: str x29, [sp, #8] // 8-byte Folded Spill +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: addvl sp, sp, #-1 +; CHECK-NEXT: .cfi_escape 0x0f, 0x0c, 0x8f, 0x00, 0x11, 0x20, 0x22, 0x11, 0x08, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 32 + 8 * VG +; CHECK-NEXT: .cfi_offset w29, -8 +; CHECK-NEXT: .cfi_offset b8, -16 +; CHECK-NEXT: mov z1.s, #0 // =0x0 +; CHECK-NEXT: ptrue p0.s +; CHECK-NEXT: add x8, sp, #16 +; CHECK-NEXT: mov w0, wzr +; CHECK-NEXT: //APP +; CHECK-NEXT: //NO_APP +; CHECK-NEXT: str wzr, [sp, #12] +; CHECK-NEXT: str d0, [sp] +; CHECK-NEXT: st1w { z1.s }, p0, [x8] +; CHECK-NEXT: addvl sp, sp, #1 +; CHECK-NEXT: add sp, sp, #16 +; CHECK-NEXT: ldr x29, [sp, #8] // 8-byte Folded Reload +; CHECK-NEXT: ldr d8, [sp], #16 // 8-byte Folded Reload +; CHECK-NEXT: ret +entry: + %a = alloca + %b = alloca i32 + %c = alloca double + tail call void asm sideeffect "", "~{d8}"() #1 + store zeroinitializer, ptr %a + store i32 zeroinitializer, ptr %b + store double %d0, ptr %c + ret i32 0 +} + ; CHECK-FRAMELAYOUT-LABEL: Function: svecc_z8_allocnxv4i32i32f64_fp ; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-8], Type: Spill, Align: 8, Size: 8 ; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16], Type: Spill, Align: 8, Size: 8 -; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-20], Type: Variable, Align: 4, Size: 4 -; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32], Type: Variable, Align: 8, Size: 8 -; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16], Type: Spill, Align: 16, Size: vscale x 16 -; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32], Type: Variable, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16-16 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16-32 x vscale], Type: Variable, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-20-32 x vscale], Type: Variable, Align: 4, Size: 4 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32-32 x vscale], Type: Variable, Align: 8, Size: 8 define i32 @svecc_z8_allocnxv4i32i32f64_fp(double %d, %v) "aarch64_pstate_sm_compatible" "frame-pointer"="all" { ; CHECK-LABEL: svecc_z8_allocnxv4i32i32f64_fp: @@ -133,3 +294,311 @@ entry: store double %d, ptr %c ret i32 0 } + +; CHECK-FRAMELAYOUT-LABEL: Function: svecc_z8_allocnxv4i32i32f64_stackargsi32_fp +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP+0], Type: Fixed, Align: 16, Size: 4 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-8], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16-16 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16-32 x vscale], Type: Variable, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-20-32 x vscale], Type: Variable, Align: 4, Size: 4 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32-32 x vscale], Type: Variable, Align: 8, Size: 8 + +define i32 @svecc_z8_allocnxv4i32i32f64_stackargsi32_fp(double %d, i32 %i0, i32 %i1, i32 %i2, i32 %i3, i32 %i4, i32 %i5, i32 %i6, i32 %i7, i32 %i8, %v) "aarch64_pstate_sm_compatible" "frame-pointer"="all"{ +; CHECK-LABEL: svecc_z8_allocnxv4i32i32f64_stackargsi32_fp: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill +; CHECK-NEXT: mov x29, sp +; CHECK-NEXT: addvl sp, sp, #-1 +; CHECK-NEXT: str z8, [sp] // 16-byte Folded Spill +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: addvl sp, sp, #-1 +; CHECK-NEXT: .cfi_def_cfa w29, 16 +; CHECK-NEXT: .cfi_offset w30, -8 +; CHECK-NEXT: .cfi_offset w29, -16 +; CHECK-NEXT: .cfi_escape 0x10, 0x48, 0x0a, 0x11, 0x70, 0x22, 0x11, 0x78, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d8 @ cfa - 16 - 8 * VG +; CHECK-NEXT: ptrue p0.s +; CHECK-NEXT: mov w0, wzr +; CHECK-NEXT: //APP +; CHECK-NEXT: //NO_APP +; CHECK-NEXT: str wzr, [sp, #12] +; CHECK-NEXT: st1w { z1.s }, p0, [x29, #-2, mul vl] +; CHECK-NEXT: str d0, [sp], #16 +; CHECK-NEXT: addvl sp, sp, #1 +; CHECK-NEXT: ldr z8, [sp] // 16-byte Folded Reload +; CHECK-NEXT: addvl sp, sp, #1 +; CHECK-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload +; CHECK-NEXT: ret +entry: + %a = alloca + %b = alloca i32 + %c = alloca double + tail call void asm sideeffect "", "~{d8}"() #1 + store %v, ptr %a + store i32 zeroinitializer, ptr %b + store double %d, ptr %c + ret i32 0 +} + +; CHECK-FRAMELAYOUT-LABEL: Function: svecc_call +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-8], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-24], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-40], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-16 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-32 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-48 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-64 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-80 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-96 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-112 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-128 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-144 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-160 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-176 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-192 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-208 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-224 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-240 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-256 x vscale], Type: Spill, Align: 16, Size: vscale x 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-258 x vscale], Type: Spill, Align: 2, Size: vscale x 2 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-260 x vscale], Type: Spill, Align: 2, Size: vscale x 2 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-262 x vscale], Type: Spill, Align: 2, Size: vscale x 2 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-264 x vscale], Type: Spill, Align: 2, Size: vscale x 2 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-266 x vscale], Type: Spill, Align: 2, Size: vscale x 2 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-268 x vscale], Type: Spill, Align: 2, Size: vscale x 2 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-270 x vscale], Type: Spill, Align: 2, Size: vscale x 2 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-272 x vscale], Type: Spill, Align: 2, Size: vscale x 2 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-274 x vscale], Type: Spill, Align: 2, Size: vscale x 2 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-276 x vscale], Type: Spill, Align: 2, Size: vscale x 2 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-278 x vscale], Type: Spill, Align: 2, Size: vscale x 2 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48-280 x vscale], Type: Spill, Align: 2, Size: vscale x 2 + +define i32 @svecc_call(<4 x i16> %P0, ptr %P1, i32 %P2, %P3, i16 %P4) "aarch64_pstate_sm_compatible" { +; CHECK-LABEL: svecc_call: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: stp x29, x30, [sp, #-48]! // 16-byte Folded Spill +; CHECK-NEXT: .cfi_def_cfa_offset 48 +; CHECK-NEXT: cntd x9 +; CHECK-NEXT: stp x9, x28, [sp, #16] // 16-byte Folded Spill +; CHECK-NEXT: stp x27, x19, [sp, #32] // 16-byte Folded Spill +; CHECK-NEXT: .cfi_offset w19, -8 +; CHECK-NEXT: .cfi_offset w27, -16 +; CHECK-NEXT: .cfi_offset w28, -24 +; CHECK-NEXT: .cfi_offset w30, -40 +; CHECK-NEXT: .cfi_offset w29, -48 +; CHECK-NEXT: addvl sp, sp, #-18 +; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x8f, 0x00, 0x11, 0x30, 0x22, 0x11, 0x90, 0x01, 0x92, 0x2e, 0x00, 0x1e, 0x22 // sp + 48 + 144 * VG +; CHECK-NEXT: str p15, [sp, #4, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str p14, [sp, #5, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str p13, [sp, #6, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str p12, [sp, #7, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str p11, [sp, #8, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str p10, [sp, #9, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str p9, [sp, #10, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str p8, [sp, #11, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str p7, [sp, #12, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str p6, [sp, #13, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str p5, [sp, #14, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str p4, [sp, #15, mul vl] // 2-byte Folded Spill +; CHECK-NEXT: str z23, [sp, #2, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z22, [sp, #3, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z21, [sp, #4, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z20, [sp, #5, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z19, [sp, #6, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z18, [sp, #7, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z17, [sp, #8, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z16, [sp, #9, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z15, [sp, #10, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z14, [sp, #11, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z13, [sp, #12, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z12, [sp, #13, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z11, [sp, #14, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z10, [sp, #15, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z9, [sp, #16, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: str z8, [sp, #17, mul vl] // 16-byte Folded Spill +; CHECK-NEXT: .cfi_escape 0x10, 0x48, 0x0a, 0x11, 0x50, 0x22, 0x11, 0x78, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d8 @ cfa - 48 - 8 * VG +; CHECK-NEXT: .cfi_escape 0x10, 0x49, 0x0a, 0x11, 0x50, 0x22, 0x11, 0x70, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d9 @ cfa - 48 - 16 * VG +; CHECK-NEXT: .cfi_escape 0x10, 0x4a, 0x0a, 0x11, 0x50, 0x22, 0x11, 0x68, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d10 @ cfa - 48 - 24 * VG +; CHECK-NEXT: .cfi_escape 0x10, 0x4b, 0x0a, 0x11, 0x50, 0x22, 0x11, 0x60, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d11 @ cfa - 48 - 32 * VG +; CHECK-NEXT: .cfi_escape 0x10, 0x4c, 0x0a, 0x11, 0x50, 0x22, 0x11, 0x58, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d12 @ cfa - 48 - 40 * VG +; CHECK-NEXT: .cfi_escape 0x10, 0x4d, 0x0a, 0x11, 0x50, 0x22, 0x11, 0x50, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d13 @ cfa - 48 - 48 * VG +; CHECK-NEXT: .cfi_escape 0x10, 0x4e, 0x0a, 0x11, 0x50, 0x22, 0x11, 0x48, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d14 @ cfa - 48 - 56 * VG +; CHECK-NEXT: .cfi_escape 0x10, 0x4f, 0x0a, 0x11, 0x50, 0x22, 0x11, 0x40, 0x92, 0x2e, 0x00, 0x1e, 0x22 // $d15 @ cfa - 48 - 64 * VG +; CHECK-NEXT: mov x8, x0 +; CHECK-NEXT: //APP +; CHECK-NEXT: //NO_APP +; CHECK-NEXT: bl __arm_sme_state +; CHECK-NEXT: and x19, x0, #0x1 +; CHECK-NEXT: .cfi_offset vg, -32 +; CHECK-NEXT: tbz w19, #0, .LBB7_2 +; CHECK-NEXT: // %bb.1: // %entry +; CHECK-NEXT: smstop sm +; CHECK-NEXT: .LBB7_2: // %entry +; CHECK-NEXT: mov x0, x8 +; CHECK-NEXT: mov w1, #45 // =0x2d +; CHECK-NEXT: mov w2, #37 // =0x25 +; CHECK-NEXT: bl memset +; CHECK-NEXT: tbz w19, #0, .LBB7_4 +; CHECK-NEXT: // %bb.3: // %entry +; CHECK-NEXT: smstart sm +; CHECK-NEXT: .LBB7_4: // %entry +; CHECK-NEXT: mov w0, #22647 // =0x5877 +; CHECK-NEXT: movk w0, #59491, lsl #16 +; CHECK-NEXT: .cfi_restore vg +; CHECK-NEXT: ldr z23, [sp, #2, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z22, [sp, #3, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z21, [sp, #4, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z20, [sp, #5, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z19, [sp, #6, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z18, [sp, #7, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z17, [sp, #8, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z16, [sp, #9, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z15, [sp, #10, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z14, [sp, #11, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z13, [sp, #12, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z12, [sp, #13, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z11, [sp, #14, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z10, [sp, #15, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z9, [sp, #16, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr z8, [sp, #17, mul vl] // 16-byte Folded Reload +; CHECK-NEXT: ldr p15, [sp, #4, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: ldr p14, [sp, #5, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: ldr p13, [sp, #6, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: ldr p12, [sp, #7, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: ldr p11, [sp, #8, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: ldr p10, [sp, #9, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: ldr p9, [sp, #10, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: ldr p8, [sp, #11, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: ldr p7, [sp, #12, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: ldr p6, [sp, #13, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: ldr p5, [sp, #14, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: ldr p4, [sp, #15, mul vl] // 2-byte Folded Reload +; CHECK-NEXT: addvl sp, sp, #18 +; CHECK-NEXT: .cfi_def_cfa wsp, 48 +; CHECK-NEXT: .cfi_restore z8 +; CHECK-NEXT: .cfi_restore z9 +; CHECK-NEXT: .cfi_restore z10 +; CHECK-NEXT: .cfi_restore z11 +; CHECK-NEXT: .cfi_restore z12 +; CHECK-NEXT: .cfi_restore z13 +; CHECK-NEXT: .cfi_restore z14 +; CHECK-NEXT: .cfi_restore z15 +; CHECK-NEXT: ldp x27, x19, [sp, #32] // 16-byte Folded Reload +; CHECK-NEXT: ldr x28, [sp, #24] // 8-byte Folded Reload +; CHECK-NEXT: ldp x29, x30, [sp], #48 // 16-byte Folded Reload +; CHECK-NEXT: .cfi_def_cfa_offset 0 +; CHECK-NEXT: .cfi_restore w19 +; CHECK-NEXT: .cfi_restore w27 +; CHECK-NEXT: .cfi_restore w28 +; CHECK-NEXT: .cfi_restore w30 +; CHECK-NEXT: .cfi_restore w29 +; CHECK-NEXT: ret +entry: + tail call void asm sideeffect "", "~{x0},~{x28},~{x27},~{x3}"() #2 + %call = call ptr @memset(ptr noundef nonnull %P1, i32 noundef 45, i32 noundef 37) + ret i32 -396142473 +} +declare ptr @memset(ptr, i32, i32) + +; The VA register currently ends up in VLA space - in the presence of VLA-area +; objects, we emit correct offsets for all objects except for these VLA objects. + +; CHECK-FRAMELAYOUT-LABEL: Function: vastate +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-8], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-16], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-32], Type: Spill, Align: 16, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-40], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-48], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-56], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-64], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-72], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-80], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-88], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-96], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-104], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-112], Type: Spill, Align: 8, Size: 8 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-128], Type: Variable, Align: 16, Size: 16 +; CHECK-FRAMELAYOUT-NEXT: Offset: [SP-128], Type: VariableSized, Align: 16, Size: 0 + +define i32 @vastate(i32 %x) "aarch64_inout_za" "aarch64_pstate_sm_enabled" "target-features"="+sme" { +; CHECK-LABEL: vastate: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: stp d15, d14, [sp, #-112]! // 16-byte Folded Spill +; CHECK-NEXT: .cfi_def_cfa_offset 112 +; CHECK-NEXT: cntd x9 +; CHECK-NEXT: stp d13, d12, [sp, #16] // 16-byte Folded Spill +; CHECK-NEXT: stp d11, d10, [sp, #32] // 16-byte Folded Spill +; CHECK-NEXT: stp d9, d8, [sp, #48] // 16-byte Folded Spill +; CHECK-NEXT: stp x29, x30, [sp, #64] // 16-byte Folded Spill +; CHECK-NEXT: str x9, [sp, #80] // 8-byte Folded Spill +; CHECK-NEXT: stp x20, x19, [sp, #96] // 16-byte Folded Spill +; CHECK-NEXT: add x29, sp, #64 +; CHECK-NEXT: .cfi_def_cfa w29, 48 +; CHECK-NEXT: .cfi_offset w19, -8 +; CHECK-NEXT: .cfi_offset w20, -16 +; CHECK-NEXT: .cfi_offset w30, -40 +; CHECK-NEXT: .cfi_offset w29, -48 +; CHECK-NEXT: .cfi_offset b8, -56 +; CHECK-NEXT: .cfi_offset b9, -64 +; CHECK-NEXT: .cfi_offset b10, -72 +; CHECK-NEXT: .cfi_offset b11, -80 +; CHECK-NEXT: .cfi_offset b12, -88 +; CHECK-NEXT: .cfi_offset b13, -96 +; CHECK-NEXT: .cfi_offset b14, -104 +; CHECK-NEXT: .cfi_offset b15, -112 +; CHECK-NEXT: sub sp, sp, #16 +; CHECK-NEXT: rdsvl x8, #1 +; CHECK-NEXT: mov x9, sp +; CHECK-NEXT: mov w20, w0 +; CHECK-NEXT: msub x9, x8, x8, x9 +; CHECK-NEXT: mov sp, x9 +; CHECK-NEXT: stur x9, [x29, #-80] +; CHECK-NEXT: sub x9, x29, #80 +; CHECK-NEXT: sturh wzr, [x29, #-70] +; CHECK-NEXT: stur wzr, [x29, #-68] +; CHECK-NEXT: sturh w8, [x29, #-72] +; CHECK-NEXT: msr TPIDR2_EL0, x9 +; CHECK-NEXT: .cfi_offset vg, -32 +; CHECK-NEXT: smstop sm +; CHECK-NEXT: bl other +; CHECK-NEXT: smstart sm +; CHECK-NEXT: .cfi_restore vg +; CHECK-NEXT: smstart za +; CHECK-NEXT: mrs x8, TPIDR2_EL0 +; CHECK-NEXT: sub x0, x29, #80 +; CHECK-NEXT: cbnz x8, .LBB8_2 +; CHECK-NEXT: // %bb.1: // %entry +; CHECK-NEXT: bl __arm_tpidr2_restore +; CHECK-NEXT: .LBB8_2: // %entry +; CHECK-NEXT: mov w0, w20 +; CHECK-NEXT: msr TPIDR2_EL0, xzr +; CHECK-NEXT: sub sp, x29, #64 +; CHECK-NEXT: .cfi_def_cfa wsp, 112 +; CHECK-NEXT: ldp x20, x19, [sp, #96] // 16-byte Folded Reload +; CHECK-NEXT: ldp x29, x30, [sp, #64] // 16-byte Folded Reload +; CHECK-NEXT: ldp d9, d8, [sp, #48] // 16-byte Folded Reload +; CHECK-NEXT: ldp d11, d10, [sp, #32] // 16-byte Folded Reload +; CHECK-NEXT: ldp d13, d12, [sp, #16] // 16-byte Folded Reload +; CHECK-NEXT: ldp d15, d14, [sp], #112 // 16-byte Folded Reload +; CHECK-NEXT: .cfi_def_cfa_offset 0 +; CHECK-NEXT: .cfi_restore w19 +; CHECK-NEXT: .cfi_restore w20 +; CHECK-NEXT: .cfi_restore w30 +; CHECK-NEXT: .cfi_restore w29 +; CHECK-NEXT: .cfi_restore b8 +; CHECK-NEXT: .cfi_restore b9 +; CHECK-NEXT: .cfi_restore b10 +; CHECK-NEXT: .cfi_restore b11 +; CHECK-NEXT: .cfi_restore b12 +; CHECK-NEXT: .cfi_restore b13 +; CHECK-NEXT: .cfi_restore b14 +; CHECK-NEXT: .cfi_restore b15 +; CHECK-NEXT: ret +entry: + tail call void @other() + ret i32 %x +} +declare void @other() diff --git a/llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-reductions.ll b/llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-reductions.ll new file mode 100644 index 0000000000000..00a15f4bcd639 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-reductions.ll @@ -0,0 +1,143 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mattr=+sve < %s | FileCheck %s +; RUN: llc -mattr=+dotprod,+sve < %s | FileCheck %s -check-prefix=DOT +; RUN: llc -mattr=+dotprod,+sve -force-streaming-compatible < %s | FileCheck %s --check-prefix=STREAMING-SVE +; RUN: llc -mattr=+dotprod,+sme -force-streaming < %s | FileCheck %s --check-prefix=STREAMING-SVE + +target triple = "aarch64-unknown-linux-gnu" + +define i32 @reduce_uaddv_v16i8(<32 x i8> %a) { +; CHECK-LABEL: reduce_uaddv_v16i8: +; CHECK: // %bb.0: +; CHECK-NEXT: ushll2 v2.8h, v1.16b, #0 +; CHECK-NEXT: ushll2 v3.8h, v0.16b, #0 +; CHECK-NEXT: ushll v1.8h, v1.8b, #0 +; CHECK-NEXT: ushll v0.8h, v0.8b, #0 +; CHECK-NEXT: uaddl2 v4.4s, v3.8h, v2.8h +; CHECK-NEXT: uaddl v2.4s, v3.4h, v2.4h +; CHECK-NEXT: uaddl2 v5.4s, v0.8h, v1.8h +; CHECK-NEXT: uaddl v0.4s, v0.4h, v1.4h +; CHECK-NEXT: add v1.4s, v5.4s, v4.4s +; CHECK-NEXT: add v0.4s, v0.4s, v2.4s +; CHECK-NEXT: add v0.4s, v0.4s, v1.4s +; CHECK-NEXT: addv s0, v0.4s +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret +; +; DOT-LABEL: reduce_uaddv_v16i8: +; DOT: // %bb.0: +; DOT-NEXT: movi v2.16b, #1 +; DOT-NEXT: movi v3.2d, #0000000000000000 +; DOT-NEXT: udot v3.4s, v1.16b, v2.16b +; DOT-NEXT: udot v3.4s, v0.16b, v2.16b +; DOT-NEXT: addv s0, v3.4s +; DOT-NEXT: fmov w0, s0 +; DOT-NEXT: ret +; +; STREAMING-SVE-LABEL: reduce_uaddv_v16i8: +; STREAMING-SVE: // %bb.0: +; STREAMING-SVE-NEXT: // kill: def $q1 killed $q1 def $z1 +; STREAMING-SVE-NEXT: uunpklo z2.h, z1.b +; STREAMING-SVE-NEXT: // kill: def $q0 killed $q0 def $z0 +; STREAMING-SVE-NEXT: uunpklo z3.h, z0.b +; STREAMING-SVE-NEXT: ptrue p0.s, vl4 +; STREAMING-SVE-NEXT: ext z1.b, z1.b, z1.b, #8 +; STREAMING-SVE-NEXT: ext z0.b, z0.b, z0.b, #8 +; STREAMING-SVE-NEXT: uunpklo z1.h, z1.b +; STREAMING-SVE-NEXT: uunpklo z0.h, z0.b +; STREAMING-SVE-NEXT: uunpklo z4.s, z2.h +; STREAMING-SVE-NEXT: ext z2.b, z2.b, z2.b, #8 +; STREAMING-SVE-NEXT: uunpklo z6.s, z3.h +; STREAMING-SVE-NEXT: ext z3.b, z3.b, z3.b, #8 +; STREAMING-SVE-NEXT: mov z5.d, z1.d +; STREAMING-SVE-NEXT: uunpklo z7.s, z0.h +; STREAMING-SVE-NEXT: ext z0.b, z0.b, z0.b, #8 +; STREAMING-SVE-NEXT: uunpklo z2.s, z2.h +; STREAMING-SVE-NEXT: uunpklo z3.s, z3.h +; STREAMING-SVE-NEXT: add z4.s, z6.s, z4.s +; STREAMING-SVE-NEXT: ext z5.b, z5.b, z1.b, #8 +; STREAMING-SVE-NEXT: uunpklo z1.s, z1.h +; STREAMING-SVE-NEXT: uunpklo z0.s, z0.h +; STREAMING-SVE-NEXT: add z2.s, z3.s, z2.s +; STREAMING-SVE-NEXT: uunpklo z5.s, z5.h +; STREAMING-SVE-NEXT: add z1.s, z7.s, z1.s +; STREAMING-SVE-NEXT: add z0.s, z0.s, z5.s +; STREAMING-SVE-NEXT: add z1.s, z4.s, z1.s +; STREAMING-SVE-NEXT: add z0.s, z2.s, z0.s +; STREAMING-SVE-NEXT: add z0.s, z1.s, z0.s +; STREAMING-SVE-NEXT: uaddv d0, p0, z0.s +; STREAMING-SVE-NEXT: fmov x0, d0 +; STREAMING-SVE-NEXT: // kill: def $w0 killed $w0 killed $x0 +; STREAMING-SVE-NEXT: ret + %1 = zext <32 x i8> %a to <32 x i32> + %2 = call i32 @llvm.vector.reduce.add.v32i32(<32 x i32> %1) + ret i32 %2 +} + +define i32 @reduce_saddv_v16i8(<32 x i8> %a) { +; CHECK-LABEL: reduce_saddv_v16i8: +; CHECK: // %bb.0: +; CHECK-NEXT: sshll2 v2.8h, v1.16b, #0 +; CHECK-NEXT: sshll2 v3.8h, v0.16b, #0 +; CHECK-NEXT: sshll v1.8h, v1.8b, #0 +; CHECK-NEXT: sshll v0.8h, v0.8b, #0 +; CHECK-NEXT: saddl2 v4.4s, v3.8h, v2.8h +; CHECK-NEXT: saddl v2.4s, v3.4h, v2.4h +; CHECK-NEXT: saddl2 v5.4s, v0.8h, v1.8h +; CHECK-NEXT: saddl v0.4s, v0.4h, v1.4h +; CHECK-NEXT: add v1.4s, v5.4s, v4.4s +; CHECK-NEXT: add v0.4s, v0.4s, v2.4s +; CHECK-NEXT: add v0.4s, v0.4s, v1.4s +; CHECK-NEXT: addv s0, v0.4s +; CHECK-NEXT: fmov w0, s0 +; CHECK-NEXT: ret +; +; DOT-LABEL: reduce_saddv_v16i8: +; DOT: // %bb.0: +; DOT-NEXT: movi v2.16b, #1 +; DOT-NEXT: movi v3.2d, #0000000000000000 +; DOT-NEXT: sdot v3.4s, v1.16b, v2.16b +; DOT-NEXT: sdot v3.4s, v0.16b, v2.16b +; DOT-NEXT: addv s0, v3.4s +; DOT-NEXT: fmov w0, s0 +; DOT-NEXT: ret +; +; STREAMING-SVE-LABEL: reduce_saddv_v16i8: +; STREAMING-SVE: // %bb.0: +; STREAMING-SVE-NEXT: // kill: def $q1 killed $q1 def $z1 +; STREAMING-SVE-NEXT: sunpklo z2.h, z1.b +; STREAMING-SVE-NEXT: // kill: def $q0 killed $q0 def $z0 +; STREAMING-SVE-NEXT: sunpklo z3.h, z0.b +; STREAMING-SVE-NEXT: ptrue p0.s, vl4 +; STREAMING-SVE-NEXT: ext z1.b, z1.b, z1.b, #8 +; STREAMING-SVE-NEXT: ext z0.b, z0.b, z0.b, #8 +; STREAMING-SVE-NEXT: sunpklo z1.h, z1.b +; STREAMING-SVE-NEXT: sunpklo z0.h, z0.b +; STREAMING-SVE-NEXT: sunpklo z4.s, z2.h +; STREAMING-SVE-NEXT: ext z2.b, z2.b, z2.b, #8 +; STREAMING-SVE-NEXT: sunpklo z6.s, z3.h +; STREAMING-SVE-NEXT: ext z3.b, z3.b, z3.b, #8 +; STREAMING-SVE-NEXT: mov z5.d, z1.d +; STREAMING-SVE-NEXT: sunpklo z7.s, z0.h +; STREAMING-SVE-NEXT: ext z0.b, z0.b, z0.b, #8 +; STREAMING-SVE-NEXT: sunpklo z2.s, z2.h +; STREAMING-SVE-NEXT: sunpklo z3.s, z3.h +; STREAMING-SVE-NEXT: add z4.s, z6.s, z4.s +; STREAMING-SVE-NEXT: ext z5.b, z5.b, z1.b, #8 +; STREAMING-SVE-NEXT: sunpklo z1.s, z1.h +; STREAMING-SVE-NEXT: sunpklo z0.s, z0.h +; STREAMING-SVE-NEXT: add z2.s, z3.s, z2.s +; STREAMING-SVE-NEXT: sunpklo z5.s, z5.h +; STREAMING-SVE-NEXT: add z1.s, z7.s, z1.s +; STREAMING-SVE-NEXT: add z0.s, z0.s, z5.s +; STREAMING-SVE-NEXT: add z1.s, z4.s, z1.s +; STREAMING-SVE-NEXT: add z0.s, z2.s, z0.s +; STREAMING-SVE-NEXT: add z0.s, z1.s, z0.s +; STREAMING-SVE-NEXT: uaddv d0, p0, z0.s +; STREAMING-SVE-NEXT: fmov x0, d0 +; STREAMING-SVE-NEXT: // kill: def $w0 killed $w0 killed $x0 +; STREAMING-SVE-NEXT: ret + %1 = sext <32 x i8> %a to <32 x i32> + %2 = call i32 @llvm.vector.reduce.add.v32i32(<32 x i32> %1) + ret i32 %2 +} diff --git a/llvm/test/CodeGen/AArch64/trampoline.ll b/llvm/test/CodeGen/AArch64/trampoline.ll new file mode 100644 index 0000000000000..293e538a7459d --- /dev/null +++ b/llvm/test/CodeGen/AArch64/trampoline.ll @@ -0,0 +1,19 @@ +; RUN: llc -mtriple=aarch64-- < %s | FileCheck %s + +declare void @llvm.init.trampoline(ptr, ptr, ptr); +declare ptr @llvm.adjust.trampoline(ptr); + +define i64 @f(ptr nest %c, i64 %x, i64 %y) { + %sum = add i64 %x, %y + ret i64 %sum +} + +define i64 @main() { + %val = alloca i64 + %nval = bitcast ptr %val to ptr + %tramp = alloca [36 x i8], align 8 + ; CHECK: bl __trampoline_setup + call void @llvm.init.trampoline(ptr %tramp, ptr @f, ptr %nval) + %fp = call ptr @llvm.adjust.trampoline(ptr %tramp) + ret i64 0 +} diff --git a/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fadd.ll b/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fadd.ll index 23e8f98a7861b..dc3fc6529e24f 100644 --- a/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fadd.ll +++ b/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fadd.ll @@ -1398,6 +1398,7 @@ define double @buffer_fat_ptr_agent_atomic_fadd_ret_f64__offset__waterfall(ptr a ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_b64 v[13:14], v4, s[4:7], null offen offset:2048 ; GFX12-NEXT: ; implicit-def: $vgpr4 ; GFX12-NEXT: s_xor_b32 exec_lo, exec_lo, s0 @@ -2662,6 +2663,7 @@ define half @buffer_fat_ptr_agent_atomic_fadd_ret_f16__offset__waterfall(ptr add ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_b32 v7, v10, s[4:7], null offen ; GFX12-NEXT: s_xor_b32 exec_lo, exec_lo, s0 ; GFX12-NEXT: s_cbranch_execnz .LBB8_1 @@ -4141,6 +4143,7 @@ define bfloat @buffer_fat_ptr_agent_atomic_fadd_ret_bf16__offset__waterfall(ptr ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_b32 v6, v8, s[4:7], null offen ; GFX12-NEXT: s_xor_b32 exec_lo, exec_lo, s0 ; GFX12-NEXT: s_cbranch_execnz .LBB11_1 diff --git a/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fmax.ll b/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fmax.ll index ec0408236975d..8139f2d2eef3c 100644 --- a/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fmax.ll +++ b/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fmax.ll @@ -1255,6 +1255,7 @@ define double @buffer_fat_ptr_agent_atomic_fmax_ret_f64__offset__waterfall(ptr a ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_b64 v[13:14], v4, s[4:7], null offen offset:2048 ; GFX12-NEXT: ; implicit-def: $vgpr4 ; GFX12-NEXT: s_xor_b32 exec_lo, exec_lo, s0 @@ -2449,6 +2450,7 @@ define half @buffer_fat_ptr_agent_atomic_fmax_ret_f16__offset__waterfall(ptr add ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_b32 v6, v8, s[4:7], null offen ; GFX12-NEXT: s_xor_b32 exec_lo, exec_lo, s0 ; GFX12-NEXT: s_cbranch_execnz .LBB8_1 @@ -3949,6 +3951,7 @@ define bfloat @buffer_fat_ptr_agent_atomic_fmax_ret_bf16__offset__waterfall(ptr ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_b32 v6, v8, s[4:7], null offen ; GFX12-NEXT: s_xor_b32 exec_lo, exec_lo, s0 ; GFX12-NEXT: s_cbranch_execnz .LBB11_1 @@ -5319,6 +5322,7 @@ define <2 x half> @buffer_fat_ptr_agent_atomic_fmax_ret_v2f16__offset__waterfall ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_b32 v6, v4, s[4:7], null offen offset:1024 ; GFX12-NEXT: ; implicit-def: $vgpr4 ; GFX12-NEXT: s_xor_b32 exec_lo, exec_lo, s0 @@ -6812,6 +6816,7 @@ define <2 x bfloat> @buffer_fat_ptr_agent_atomic_fmax_ret_v2bf16__offset__waterf ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_b32 v6, v4, s[4:7], null offen offset:1024 ; GFX12-NEXT: ; implicit-def: $vgpr4 ; GFX12-NEXT: s_xor_b32 exec_lo, exec_lo, s0 diff --git a/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fmin.ll b/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fmin.ll index cd01cc7309fcd..d029aa6769bab 100644 --- a/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fmin.ll +++ b/llvm/test/CodeGen/AMDGPU/buffer-fat-pointer-atomicrmw-fmin.ll @@ -1255,6 +1255,7 @@ define double @buffer_fat_ptr_agent_atomic_fmin_ret_f64__offset__waterfall(ptr a ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_b64 v[13:14], v4, s[4:7], null offen offset:2048 ; GFX12-NEXT: ; implicit-def: $vgpr4 ; GFX12-NEXT: s_xor_b32 exec_lo, exec_lo, s0 @@ -2449,6 +2450,7 @@ define half @buffer_fat_ptr_agent_atomic_fmin_ret_f16__offset__waterfall(ptr add ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_b32 v6, v8, s[4:7], null offen ; GFX12-NEXT: s_xor_b32 exec_lo, exec_lo, s0 ; GFX12-NEXT: s_cbranch_execnz .LBB8_1 @@ -3949,6 +3951,7 @@ define bfloat @buffer_fat_ptr_agent_atomic_fmin_ret_bf16__offset__waterfall(ptr ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_b32 v6, v8, s[4:7], null offen ; GFX12-NEXT: s_xor_b32 exec_lo, exec_lo, s0 ; GFX12-NEXT: s_cbranch_execnz .LBB11_1 @@ -5319,6 +5322,7 @@ define <2 x half> @buffer_fat_ptr_agent_atomic_fmin_ret_v2f16__offset__waterfall ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_b32 v6, v4, s[4:7], null offen offset:1024 ; GFX12-NEXT: ; implicit-def: $vgpr4 ; GFX12-NEXT: s_xor_b32 exec_lo, exec_lo, s0 @@ -6812,6 +6816,7 @@ define <2 x bfloat> @buffer_fat_ptr_agent_atomic_fmin_ret_v2bf16__offset__waterf ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_b32 v6, v4, s[4:7], null offen offset:1024 ; GFX12-NEXT: ; implicit-def: $vgpr4 ; GFX12-NEXT: s_xor_b32 exec_lo, exec_lo, s0 diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.load.format.v3f16.ll b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.load.format.v3f16.ll index 4c1ae4c228adb..0522d5258b9b5 100644 --- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.load.format.v3f16.ll +++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.load.format.v3f16.ll @@ -128,6 +128,7 @@ define amdgpu_gs void @main(<4 x i32> %arg, i32 %arg1) { ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) ; GFX12-NEXT: s_and_b32 s0, vcc_lo, s0 ; GFX12-NEXT: s_and_saveexec_b32 s0, s0 +; GFX12-NEXT: s_wait_loadcnt 0x0 ; GFX12-NEXT: buffer_load_d16_format_xyz v[5:6], v4, s[4:7], null idxen ; GFX12-NEXT: ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3 ; GFX12-NEXT: ; implicit-def: $vgpr4 diff --git a/llvm/test/CodeGen/AMDGPU/load-constant-i16.ll b/llvm/test/CodeGen/AMDGPU/load-constant-i16.ll index 355c296d122ff..22b718935738b 100644 --- a/llvm/test/CodeGen/AMDGPU/load-constant-i16.ll +++ b/llvm/test/CodeGen/AMDGPU/load-constant-i16.ll @@ -745,7 +745,7 @@ define amdgpu_kernel void @constant_load_v16i16_align2(ptr addrspace(4) %ptr0) # ; GFX12-NEXT: s_load_b64 s[0:1], s[2:3], 0x24 ; GFX12-NEXT: v_mov_b32_e32 v8, 0 ; GFX12-NEXT: s_wait_kmcnt 0x0 -; GFX12-NEXT: s_clause 0xf +; GFX12-NEXT: s_clause 0x7 ; GFX12-NEXT: global_load_u16 v3, v8, s[0:1] offset:28 ; GFX12-NEXT: global_load_u16 v2, v8, s[0:1] offset:24 ; GFX12-NEXT: global_load_u16 v1, v8, s[0:1] offset:20 @@ -754,13 +754,21 @@ define amdgpu_kernel void @constant_load_v16i16_align2(ptr addrspace(4) %ptr0) # ; GFX12-NEXT: global_load_u16 v6, v8, s[0:1] offset:8 ; GFX12-NEXT: global_load_u16 v5, v8, s[0:1] offset:4 ; GFX12-NEXT: global_load_u16 v4, v8, s[0:1] +; GFX12-NEXT: s_wait_loadcnt 0x7 ; GFX12-NEXT: global_load_d16_hi_b16 v3, v8, s[0:1] offset:30 +; GFX12-NEXT: s_wait_loadcnt 0x7 ; GFX12-NEXT: global_load_d16_hi_b16 v2, v8, s[0:1] offset:26 +; GFX12-NEXT: s_wait_loadcnt 0x7 ; GFX12-NEXT: global_load_d16_hi_b16 v1, v8, s[0:1] offset:22 +; GFX12-NEXT: s_wait_loadcnt 0x7 ; GFX12-NEXT: global_load_d16_hi_b16 v0, v8, s[0:1] offset:18 +; GFX12-NEXT: s_wait_loadcnt 0x7 ; GFX12-NEXT: global_load_d16_hi_b16 v7, v8, s[0:1] offset:14 +; GFX12-NEXT: s_wait_loadcnt 0x7 ; GFX12-NEXT: global_load_d16_hi_b16 v6, v8, s[0:1] offset:10 +; GFX12-NEXT: s_wait_loadcnt 0x7 ; GFX12-NEXT: global_load_d16_hi_b16 v5, v8, s[0:1] offset:6 +; GFX12-NEXT: s_wait_loadcnt 0x7 ; GFX12-NEXT: global_load_d16_hi_b16 v4, v8, s[0:1] offset:2 ; GFX12-NEXT: s_wait_loadcnt 0x4 ; GFX12-NEXT: global_store_b128 v[0:1], v[0:3], off diff --git a/llvm/test/CodeGen/AMDGPU/load-global-i16.ll b/llvm/test/CodeGen/AMDGPU/load-global-i16.ll index 142bc37fdeb75..4cc47b09d813d 100644 --- a/llvm/test/CodeGen/AMDGPU/load-global-i16.ll +++ b/llvm/test/CodeGen/AMDGPU/load-global-i16.ll @@ -3563,15 +3563,19 @@ define amdgpu_kernel void @global_zextload_v64i16_to_v64i32(ptr addrspace(1) %ou ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[16:19], off, s[0:3], 0 offset:32 ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[23:26], off, s[0:3], 0 offset:48 ; GCN-NOHSA-SI-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:16 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:20 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:24 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:28 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 ; GCN-NOHSA-SI-NEXT: s_waitcnt expcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 offset:16 @@ -4371,8 +4375,10 @@ define amdgpu_kernel void @global_sextload_v64i16_to_v64i32(ptr addrspace(1) %ou ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[8:11], off, s[0:3], 0 offset:48 ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[4:7], off, s[0:3], 0 ; GCN-NOHSA-SI-NEXT: buffer_load_dword v0, off, s[12:15], 0 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 offset:16 @@ -7341,8 +7347,10 @@ define amdgpu_kernel void @global_zextload_v32i16_to_v32i64(ptr addrspace(1) %ou ; GCN-NOHSA-SI-NEXT: buffer_store_dword v15, off, s[12:15], 0 offset:28 ; 4-byte Folded Spill ; GCN-NOHSA-SI-NEXT: s_waitcnt expcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_load_dword v12, off, s[12:15], 0 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_load_dword v13, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: buffer_load_dword v14, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_load_dword v15, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: v_mov_b32_e32 v13, v39 @@ -7364,8 +7372,10 @@ define amdgpu_kernel void @global_zextload_v32i16_to_v32i64(ptr addrspace(1) %ou ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[4:7], off, s[0:3], 0 offset:96 ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[8:11], off, s[0:3], 0 offset:64 ; GCN-NOHSA-SI-NEXT: buffer_load_dword v0, off, s[12:15], 0 offset:16 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_load_dword v1, off, s[12:15], 0 offset:20 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: buffer_load_dword v2, off, s[12:15], 0 offset:24 ; 4-byte Folded Reload +; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_load_dword v3, off, s[12:15], 0 offset:28 ; 4-byte Folded Reload ; GCN-NOHSA-SI-NEXT: s_waitcnt vmcnt(0) ; GCN-NOHSA-SI-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 offset:32 diff --git a/llvm/test/CodeGen/AMDGPU/load-global-i32.ll b/llvm/test/CodeGen/AMDGPU/load-global-i32.ll index c0649322c8195..7cdf270810dea 100644 --- a/llvm/test/CodeGen/AMDGPU/load-global-i32.ll +++ b/llvm/test/CodeGen/AMDGPU/load-global-i32.ll @@ -3091,8 +3091,10 @@ define amdgpu_kernel void @global_sextload_v32i32_to_v32i64(ptr addrspace(1) %ou ; SI-NOHSA-NEXT: buffer_store_dwordx4 v[36:39], off, s[0:3], 0 offset:240 ; SI-NOHSA-NEXT: buffer_store_dwordx4 v[32:35], off, s[0:3], 0 offset:192 ; SI-NOHSA-NEXT: buffer_load_dword v8, off, s[12:15], 0 ; 4-byte Folded Reload +; SI-NOHSA-NEXT: s_waitcnt vmcnt(0) ; SI-NOHSA-NEXT: buffer_load_dword v9, off, s[12:15], 0 offset:4 ; 4-byte Folded Reload ; SI-NOHSA-NEXT: buffer_load_dword v10, off, s[12:15], 0 offset:8 ; 4-byte Folded Reload +; SI-NOHSA-NEXT: s_waitcnt vmcnt(0) ; SI-NOHSA-NEXT: buffer_load_dword v11, off, s[12:15], 0 offset:12 ; 4-byte Folded Reload ; SI-NOHSA-NEXT: s_waitcnt vmcnt(0) ; SI-NOHSA-NEXT: buffer_store_dwordx4 v[8:11], off, s[0:3], 0 offset:208 diff --git a/llvm/test/CodeGen/AMDGPU/mul_int24.ll b/llvm/test/CodeGen/AMDGPU/mul_int24.ll index be77a10380c49..8f4c48fae6fb3 100644 --- a/llvm/test/CodeGen/AMDGPU/mul_int24.ll +++ b/llvm/test/CodeGen/AMDGPU/mul_int24.ll @@ -813,4 +813,102 @@ bb7: ret void } + +define amdgpu_kernel void @test_umul_i24(ptr addrspace(1) %out, i32 %arg) { +; SI-LABEL: test_umul_i24: +; SI: ; %bb.0: +; SI-NEXT: s_load_dword s1, s[2:3], 0xb +; SI-NEXT: v_mov_b32_e32 v0, 0xff803fe1 +; SI-NEXT: s_mov_b32 s0, 0 +; SI-NEXT: s_mov_b32 s3, 0xf000 +; SI-NEXT: s_waitcnt lgkmcnt(0) +; SI-NEXT: s_lshr_b32 s1, s1, 9 +; SI-NEXT: v_mul_hi_u32 v0, s1, v0 +; SI-NEXT: s_mul_i32 s1, s1, 0xff803fe1 +; SI-NEXT: v_alignbit_b32 v0, v0, s1, 1 +; SI-NEXT: s_mov_b32 s2, -1 +; SI-NEXT: s_mov_b32 s1, s0 +; SI-NEXT: buffer_store_dword v0, off, s[0:3], 0 +; SI-NEXT: s_endpgm +; +; VI-LABEL: test_umul_i24: +; VI: ; %bb.0: +; VI-NEXT: s_load_dword s0, s[2:3], 0x2c +; VI-NEXT: v_mov_b32_e32 v0, 0xff803fe1 +; VI-NEXT: s_mov_b32 s3, 0xf000 +; VI-NEXT: s_mov_b32 s2, -1 +; VI-NEXT: s_waitcnt lgkmcnt(0) +; VI-NEXT: s_lshr_b32 s0, s0, 9 +; VI-NEXT: v_mad_u64_u32 v[0:1], s[0:1], s0, v0, 0 +; VI-NEXT: s_mov_b32 s0, 0 +; VI-NEXT: s_mov_b32 s1, s0 +; VI-NEXT: v_alignbit_b32 v0, v1, v0, 1 +; VI-NEXT: s_nop 1 +; VI-NEXT: buffer_store_dword v0, off, s[0:3], 0 +; VI-NEXT: s_endpgm +; +; GFX9-LABEL: test_umul_i24: +; GFX9: ; %bb.0: +; GFX9-NEXT: s_load_dword s1, s[2:3], 0x2c +; GFX9-NEXT: s_mov_b32 s0, 0 +; GFX9-NEXT: s_mov_b32 s3, 0xf000 +; GFX9-NEXT: s_mov_b32 s2, -1 +; GFX9-NEXT: s_waitcnt lgkmcnt(0) +; GFX9-NEXT: s_lshr_b32 s1, s1, 9 +; GFX9-NEXT: s_mul_hi_u32 s4, s1, 0xff803fe1 +; GFX9-NEXT: s_mul_i32 s1, s1, 0xff803fe1 +; GFX9-NEXT: v_mov_b32_e32 v0, s1 +; GFX9-NEXT: v_alignbit_b32 v0, s4, v0, 1 +; GFX9-NEXT: s_mov_b32 s1, s0 +; GFX9-NEXT: buffer_store_dword v0, off, s[0:3], 0 +; GFX9-NEXT: s_endpgm +; +; EG-LABEL: test_umul_i24: +; EG: ; %bb.0: +; EG-NEXT: ALU 8, @4, KC0[CB0:0-32], KC1[] +; EG-NEXT: MEM_RAT_CACHELESS STORE_RAW T0.X, T1.X, 1 +; EG-NEXT: CF_END +; EG-NEXT: PAD +; EG-NEXT: ALU clause starting at 4: +; EG-NEXT: LSHR * T0.W, KC0[2].Z, literal.x, +; EG-NEXT: 9(1.261169e-44), 0(0.000000e+00) +; EG-NEXT: MULHI * T0.X, PV.W, literal.x, +; EG-NEXT: -8372255(nan), 0(0.000000e+00) +; EG-NEXT: MULLO_INT * T0.Y, T0.W, literal.x, +; EG-NEXT: -8372255(nan), 0(0.000000e+00) +; EG-NEXT: BIT_ALIGN_INT T0.X, T0.X, PS, 1, +; EG-NEXT: MOV * T1.X, literal.x, +; EG-NEXT: 0(0.000000e+00), 0(0.000000e+00) +; +; CM-LABEL: test_umul_i24: +; CM: ; %bb.0: +; CM-NEXT: ALU 14, @4, KC0[CB0:0-32], KC1[] +; CM-NEXT: MEM_RAT_CACHELESS STORE_DWORD T0.X, T1.X +; CM-NEXT: CF_END +; CM-NEXT: PAD +; CM-NEXT: ALU clause starting at 4: +; CM-NEXT: LSHR * T0.W, KC0[2].Z, literal.x, +; CM-NEXT: 9(1.261169e-44), 0(0.000000e+00) +; CM-NEXT: MULHI T0.X, T0.W, literal.x, +; CM-NEXT: MULHI T0.Y (MASKED), T0.W, literal.x, +; CM-NEXT: MULHI T0.Z (MASKED), T0.W, literal.x, +; CM-NEXT: MULHI * T0.W (MASKED), T0.W, literal.x, +; CM-NEXT: -8372255(nan), 0(0.000000e+00) +; CM-NEXT: MULLO_INT T0.X (MASKED), T0.W, literal.x, +; CM-NEXT: MULLO_INT T0.Y, T0.W, literal.x, +; CM-NEXT: MULLO_INT T0.Z (MASKED), T0.W, literal.x, +; CM-NEXT: MULLO_INT * T0.W (MASKED), T0.W, literal.x, +; CM-NEXT: -8372255(nan), 0(0.000000e+00) +; CM-NEXT: BIT_ALIGN_INT * T0.X, T0.X, PV.Y, 1, +; CM-NEXT: MOV * T1.X, literal.x, +; CM-NEXT: 0(0.000000e+00), 0(0.000000e+00) + %i = lshr i32 %arg, 9 + %i1 = zext i32 %i to i64 + %i2 = mul i64 %i1, 4286595041 + %i3 = lshr i64 %i2, 1 + %i4 = trunc i64 %i3 to i32 + store i32 %i4, ptr addrspace(1) null, align 4 + ret void +} + attributes #0 = { nounwind } diff --git a/llvm/test/CodeGen/AMDGPU/pseudo-scalar-transcendental.mir b/llvm/test/CodeGen/AMDGPU/pseudo-scalar-transcendental.mir new file mode 100644 index 0000000000000..17bed38bd046d --- /dev/null +++ b/llvm/test/CodeGen/AMDGPU/pseudo-scalar-transcendental.mir @@ -0,0 +1,120 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 +# RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1200 -run-pass=si-fold-operands -verify-machineinstrs -o - %s | FileCheck --check-prefix=GCN %s + +# Do not use inline constants for f16 pseudo scalar transcendentals. +# But allow literal constants. + +--- +name: exp_f16_imm +tracksRegLiveness: true +body: | + bb.0: + ; GCN-LABEL: name: exp_f16_imm + ; GCN: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 15360 + ; GCN-NEXT: [[V_S_EXP_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_EXP_F16_e64 1, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec + %0:sgpr_32 = S_MOV_B32 15360 + %1:sgpr_32 = V_S_EXP_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec +... + +--- +name: exp_f16_literal +tracksRegLiveness: true +body: | + bb.0: + ; GCN-LABEL: name: exp_f16_literal + ; GCN: [[V_S_EXP_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_EXP_F16_e64 1, 16960, 0, 0, implicit $mode, implicit $exec + %0:sgpr_32 = S_MOV_B32 16960 + %1:sgpr_32 = V_S_EXP_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec +... + +--- +name: log_f16_imm +tracksRegLiveness: true +body: | + bb.0: + ; GCN-LABEL: name: log_f16_imm + ; GCN: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 15360 + ; GCN-NEXT: [[V_S_LOG_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_LOG_F16_e64 1, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec + %0:sgpr_32 = S_MOV_B32 15360 + %1:sgpr_32 = V_S_LOG_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec +... + +--- +name: log_f16_literal +tracksRegLiveness: true +body: | + bb.0: + ; GCN-LABEL: name: log_f16_literal + ; GCN: [[V_S_LOG_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_LOG_F16_e64 1, 16960, 0, 0, implicit $mode, implicit $exec + %0:sgpr_32 = S_MOV_B32 16960 + %1:sgpr_32 = V_S_LOG_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec +... + +--- +name: rcp_f16_imm +tracksRegLiveness: true +body: | + bb.0: + ; GCN-LABEL: name: rcp_f16_imm + ; GCN: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 15360 + ; GCN-NEXT: [[V_S_RCP_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_RCP_F16_e64 1, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec + %0:sgpr_32 = S_MOV_B32 15360 + %1:sgpr_32 = V_S_RCP_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec +... + +--- +name: rcp_f16_literal +tracksRegLiveness: true +body: | + bb.0: + ; GCN-LABEL: name: rcp_f16_literal + ; GCN: [[V_S_RCP_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_RCP_F16_e64 1, 16960, 0, 0, implicit $mode, implicit $exec + %0:sgpr_32 = S_MOV_B32 16960 + %1:sgpr_32 = V_S_RCP_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec +... + +--- +name: rsq_f16_imm +tracksRegLiveness: true +body: | + bb.0: + ; GCN-LABEL: name: rsq_f16_imm + ; GCN: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 15360 + ; GCN-NEXT: [[V_S_RSQ_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_RSQ_F16_e64 1, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec + %0:sgpr_32 = S_MOV_B32 15360 + %1:sgpr_32 = V_S_RSQ_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec +... + +--- +name: rsq_f16_literal +tracksRegLiveness: true +body: | + bb.0: + ; GCN-LABEL: name: rsq_f16_literal + ; GCN: [[V_S_RSQ_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_RSQ_F16_e64 1, 16960, 0, 0, implicit $mode, implicit $exec + %0:sgpr_32 = S_MOV_B32 16960 + %1:sgpr_32 = V_S_RSQ_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec +... + +--- +name: sqrt_f16_imm +tracksRegLiveness: true +body: | + bb.0: + ; GCN-LABEL: name: sqrt_f16_imm + ; GCN: [[S_MOV_B32_:%[0-9]+]]:sgpr_32 = S_MOV_B32 15360 + ; GCN-NEXT: [[V_S_SQRT_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_SQRT_F16_e64 1, [[S_MOV_B32_]], 0, 0, implicit $mode, implicit $exec + %0:sgpr_32 = S_MOV_B32 15360 + %1:sgpr_32 = V_S_SQRT_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec +... + +--- +name: sqrt_f16_literal +tracksRegLiveness: true +body: | + bb.0: + ; GCN-LABEL: name: sqrt_f16_literal + ; GCN: [[V_S_SQRT_F16_e64_:%[0-9]+]]:sgpr_32 = V_S_SQRT_F16_e64 1, 16960, 0, 0, implicit $mode, implicit $exec + %0:sgpr_32 = S_MOV_B32 16960 + %1:sgpr_32 = V_S_SQRT_F16_e64 1, %0:sgpr_32, 0, 0, implicit $mode, implicit $exec +... diff --git a/llvm/test/CodeGen/AMDGPU/si-fold-scalar-clamp.mir b/llvm/test/CodeGen/AMDGPU/si-fold-scalar-clamp.mir new file mode 100644 index 0000000000000..1f4d046a8739f --- /dev/null +++ b/llvm/test/CodeGen/AMDGPU/si-fold-scalar-clamp.mir @@ -0,0 +1,26 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 +# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1200 -run-pass=si-fold-operands -verify-machineinstrs -o - %s | FileCheck %s +--- +name: test +tracksRegLiveness: true +body: | + bb.0: + liveins: $sgpr0 + + ; CHECK-LABEL: name: test + ; CHECK: liveins: $sgpr0 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr_32 = COPY $sgpr0 + ; CHECK-NEXT: [[V_S_RSQ_F32_e64_:%[0-9]+]]:sgpr_32 = nofpexcept V_S_RSQ_F32_e64 0, [[COPY]], 1, 0, implicit $mode, implicit $exec + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[V_S_RSQ_F32_e64_]] + ; CHECK-NEXT: [[V_ADD_F32_e32_:%[0-9]+]]:vgpr_32 = nofpexcept V_ADD_F32_e32 [[COPY1]], [[COPY1]], implicit $mode, implicit $exec + ; CHECK-NEXT: $vgpr0 = COPY [[V_ADD_F32_e32_]] + ; CHECK-NEXT: S_ENDPGM 0 + %0:sgpr_32 = COPY $sgpr0 + %1:sgpr_32 = nofpexcept V_S_RSQ_F32_e64 0, %0, 0, 0, implicit $mode, implicit $exec + %2:vgpr_32 = nofpexcept V_MAX_F32_e64 0, %1, 0, %1, -1, 0, implicit $mode, implicit $exec + %3:vgpr_32 = nofpexcept V_ADD_F32_e32 %2:vgpr_32, %2:vgpr_32, implicit $mode, implicit $exec + $vgpr0 = COPY %3 + S_ENDPGM 0 + +... diff --git a/llvm/test/CodeGen/AMDGPU/spill-csr-frame-ptr-reg-copy.ll b/llvm/test/CodeGen/AMDGPU/spill-csr-frame-ptr-reg-copy.ll index b045dd559aac2..34bcc3f02ac66 100644 --- a/llvm/test/CodeGen/AMDGPU/spill-csr-frame-ptr-reg-copy.ll +++ b/llvm/test/CodeGen/AMDGPU/spill-csr-frame-ptr-reg-copy.ll @@ -15,6 +15,7 @@ ; GCN: v_readlane_b32 [[FP_SCRATCH_COPY:s[0-9]+]], v40, 4 ; GCN: s_xor_saveexec_b64 +; GCN-NEXT: s_waitcnt vmcnt(0) ; GCN-NEXT: buffer_load_dword v0, off, s[0:3], s33 offset:12 ; 4-byte Folded Reload ; GCN-NEXT: s_mov_b64 exec, -1 ; GCN-NEXT: buffer_load_dword v40, off, s[0:3], s33 offset:4 ; 4-byte Folded Reload diff --git a/llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir b/llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir index 2417becb7c216..0ddd2aa285b26 100644 --- a/llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir +++ b/llvm/test/CodeGen/AMDGPU/waitcnt-vmcnt-loop.mir @@ -1,5 +1,6 @@ # RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass si-insert-waitcnts -o - %s | FileCheck -check-prefix=GFX9 %s # RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass si-insert-waitcnts -o - %s | FileCheck -check-prefix=GFX10 %s +# RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs -run-pass si-insert-waitcnts -o - %s | FileCheck -check-prefix=GFX12 %s --- @@ -20,6 +21,13 @@ # GFX10-LABEL: bb.1: # GFX10: S_WAITCNT 16 # GFX10-LABEL: bb.2: + +# GFX12-LABEL: waitcnt_vm_loop +# GFX12-LABEL: bb.0: +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: name: waitcnt_vm_loop body: | bb.0: @@ -58,6 +66,13 @@ body: | # GFX10-LABEL: bb.1: # GFX10: S_WAITCNT 16 # GFX10-LABEL: bb.2: + +# GFX12-LABEL: waitcnt_vm_loop_noterm +# GFX12-LABEL: bb.0: +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: name: waitcnt_vm_loop_noterm body: | bb.0: @@ -129,6 +144,13 @@ body: | # GFX10-LABEL: bb.1: # GFX10: S_WAITCNT 16 # GFX10-LABEL: bb.2: + +# GFX12-LABEL: waitcnt_vm_loop_load +# GFX12-LABEL: bb.0: +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: name: waitcnt_vm_loop_load body: | bb.0: @@ -170,6 +192,13 @@ body: | # GFX10-LABEL: bb.1: # GFX10: S_WAITCNT 16 # GFX10-LABEL: bb.2: + +# GFX12-LABEL: waitcnt_vm_loop_no_store +# GFX12-LABEL: bb.0: +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: name: waitcnt_vm_loop_no_store body: | bb.0: @@ -212,6 +241,13 @@ body: | # GFX10-LABEL: bb.1: # GFX10-NOT: S_WAITCNT 16 # GFX10-LABEL: bb.2: + +# GFX12-LABEL: waitcnt_vm_loop_no_use +# GFX12-LABEL: bb.0: +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: name: waitcnt_vm_loop_no_use body: | bb.0: @@ -255,6 +291,14 @@ body: | # GFX10-LABEL: bb.1: # GFX10-NOT: S_WAITCNT 16 # GFX10-LABEL: bb.2: + +# GFX12-LABEL: waitcnt_vm_loop2 +# GFX12-LABEL: bb.0: +# GFX12: BUFFER_LOAD_FORMAT_X_IDXEN +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: name: waitcnt_vm_loop2 body: | bb.0: @@ -294,6 +338,14 @@ body: | # GFX10-LABEL: bb.1: # GFX10-NOT: S_WAITCNT 16 # GFX10-LABEL: bb.2: + +# GFX12-LABEL: waitcnt_vm_loop2_store +# GFX12-LABEL: bb.0: +# GFX12: BUFFER_LOAD_FORMAT_X_IDXEN +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: name: waitcnt_vm_loop2_store body: | bb.0: @@ -334,6 +386,13 @@ body: | # GFX10-LABEL: bb.1: # GFX10: S_WAITCNT 16 # GFX10-LABEL: bb.2: + +# GFX12-LABEL: waitcnt_vm_loop2_use_in_loop +# GFX12-LABEL: bb.0: +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: name: waitcnt_vm_loop2_use_in_loop body: | bb.0: @@ -379,6 +438,15 @@ body: | # GFX10-LABEL: bb.2: # GFX10-NOT: S_WAITCNT 16 # GFX10-LABEL: bb.3: + +# GFX12-LABEL: waitcnt_vm_loop2_nowait +# GFX12-LABEL: bb.0: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.3: name: waitcnt_vm_loop2_nowait body: | bb.0: @@ -427,6 +495,14 @@ body: | # GFX10-LABEL: bb.1: # GFX10-NOT: S_WAITCNT 16 # GFX10-LABEL: bb.2: + +# GFX12-LABEL: waitcnt_vm_loop2_reginterval +# GFX12-LABEL: bb.0: +# GFX12: GLOBAL_LOAD_DWORDX4 +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: name: waitcnt_vm_loop2_reginterval body: | bb.0: @@ -467,6 +543,13 @@ body: | # GFX10-LABEL: bb.1: # GFX10: S_WAITCNT 16 # GFX10-LABEL: bb.2: + +# GFX12-LABEL: waitcnt_vm_loop2_reginterval2 +# GFX12-LABEL: bb.0: +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: name: waitcnt_vm_loop2_reginterval2 body: | bb.0: @@ -513,6 +596,15 @@ body: | # GFX10-NOT: S_WAITCNT 16240 # GFX10-LABEL: bb.2: +# GFX12-LABEL: waitcnt_vm_zero +# GFX12-LABEL: bb.0: +# GFX12: BUFFER_LOAD_FORMAT_X_IDXEN +# GFX12: BUFFER_LOAD_FORMAT_X_IDXEN +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: + name: waitcnt_vm_zero body: | bb.0: @@ -548,6 +640,14 @@ body: | # GFX10-LABEL: bb.1: # GFX10-NOT: S_WAITCNT +# GFX12-LABEL: waitcnt_vm_necessary +# GFX12-LABEL: bb.0: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12: $vgpr4 +# GFX12-NOT: S_WAITCNT +# GFX12-LABEL: bb.1: +# GFX12-NOT: S_WAITCNT + # GFX9-LABEL: waitcnt_vm_necessary # GFX9-LABEL: bb.0: # GFX9: S_WAITCNT 3952 @@ -590,6 +690,13 @@ body: | # GFX10: S_WAITCNT 16 # GFX10-LABEL: bb.2: +# GFX12-LABEL: waitcnt_vm_loop_global_mem +# GFX12-LABEL: bb.0: +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: + name: waitcnt_vm_loop_global_mem body: | bb.0: @@ -631,6 +738,13 @@ body: | # GFX10: S_WAITCNT 16 # GFX10-LABEL: bb.2: +# GFX12-LABEL: waitcnt_vm_loop_scratch_mem +# GFX12-LABEL: bb.0: +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: + name: waitcnt_vm_loop_scratch_mem body: | bb.0: @@ -671,6 +785,14 @@ body: | # GFX10-LABEL: bb.1: # GFX10: S_WAITCNT 11 # GFX10-LABEL: bb.2: + +# GFX12-LABEL: waitcnt_vm_loop_flat_mem +# GFX12-LABEL: bb.0: +# GFX12: FLAT_LOAD_DWORD +# GFX12-NOT: S_WAIT_LOADCNT_DSCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT_DSCNT 0 +# GFX12-LABEL: bb.2: name: waitcnt_vm_loop_flat_mem body: | bb.0: @@ -713,6 +835,13 @@ body: | # GFX10-LABEL: bb.1: # GFX10: S_WAITCNT 16 # GFX10-LABEL: bb.2: + +# GFX12-LABEL: waitcnt_vm_loop_flat_load +# GFX12-LABEL: bb.0: +# GFX12-NOT: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.1: +# GFX12: S_WAIT_LOADCNT 0 +# GFX12-LABEL: bb.2: name: waitcnt_vm_loop_flat_load body: | bb.0: diff --git a/llvm/test/CodeGen/ARM/GlobalISel/arm-irtranslator.ll b/llvm/test/CodeGen/ARM/GlobalISel/arm-irtranslator.ll index 411cf78b621f8..dc1d4b289c2ab 100644 --- a/llvm/test/CodeGen/ARM/GlobalISel/arm-irtranslator.ll +++ b/llvm/test/CodeGen/ARM/GlobalISel/arm-irtranslator.ll @@ -1,5 +1,5 @@ ; RUN: llc -mtriple arm-unknown -mattr=+vfp2,+v4t -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=LITTLE -; RUN: llc -mtriple armeb-unknown -mattr=+vfp2,+v4t -global-isel -global-isel-abort=0 -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=BIG +; RUN: llc -mtriple armeb-unknown -mattr=+vfp2,+v4t -global-isel -global-isel-abort=0 -enable-arm-gisel-bigendian -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=BIG define void @test_void_return() { ; CHECK-LABEL: name: test_void_return diff --git a/llvm/test/CodeGen/ARM/GlobalISel/arm-param-lowering.ll b/llvm/test/CodeGen/ARM/GlobalISel/arm-param-lowering.ll index e8cd182196b62..65586f72c7c19 100644 --- a/llvm/test/CodeGen/ARM/GlobalISel/arm-param-lowering.ll +++ b/llvm/test/CodeGen/ARM/GlobalISel/arm-param-lowering.ll @@ -1,5 +1,5 @@ ; RUN: llc -O0 -mtriple arm-unknown -mattr=+vfp2,+v4t -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=ARM -check-prefix=LITTLE -; RUN: llc -O0 -mtriple armeb-unknown -mattr=+vfp2,+v4t -global-isel -global-isel-abort=0 -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=ARM -check-prefix=BIG +; RUN: llc -O0 -mtriple armeb-unknown -mattr=+vfp2,+v4t -global-isel -global-isel-abort=0 -enable-arm-gisel-bigendian -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=ARM -check-prefix=BIG ; RUN: llc -O0 -mtriple thumb-unknown -mattr=+vfp2,+v6t2 -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=LITTLE -check-prefix=THUMB declare arm_aapcscc ptr @simple_reg_params_target(i32, ptr) diff --git a/llvm/test/CodeGen/ARM/Windows/private-func.ll b/llvm/test/CodeGen/ARM/Windows/private-func.ll new file mode 100644 index 0000000000000..2d030ae3fabbb --- /dev/null +++ b/llvm/test/CodeGen/ARM/Windows/private-func.ll @@ -0,0 +1,17 @@ +; RUN: llc -mtriple thumbv7-windows -filetype asm -o - %s | FileCheck %s + +define dso_local void @func1() { +entry: + call void @func2() + ret void +} + +define private void @func2() { +entry: + ret void +} + +; CHECK: .def .Lfunc2; +; CHECK-NEXT: .scl 3; +; CHECK-NEXT: .type 32; +; CHECK-NEXT: .endef diff --git a/llvm/test/CodeGen/AVR/jmp.ll b/llvm/test/CodeGen/AVR/jmp.ll new file mode 100644 index 0000000000000..95dfff4836b4e --- /dev/null +++ b/llvm/test/CodeGen/AVR/jmp.ll @@ -0,0 +1,25 @@ +; RUN: llc -filetype=obj -mtriple=avr < %s | llvm-objdump -dr --no-show-raw-insn - | FileCheck %s + +define i8 @foo(i8 %a) { +bb0: + %0 = tail call i8 @bar(i8 %a) + %1 = icmp eq i8 %0, 123 + br i1 %1, label %bb1, label %bb2 + +bb1: + ret i8 100 + +bb2: + ret i8 200 +} + +declare i8 @bar(i8); + +; CHECK: rcall .-2 +; CHECK-NEXT: 00000000: R_AVR_13_PCREL bar +; CHECK-NEXT: cpi r24, 0x7b +; CHECK-NEXT: brne .+4 +; CHECK-NEXT: ldi r24, 0x64 +; CHECK-NEXT: ret +; CHECK-NEXT: ldi r24, 0xc8 +; CHECK-NEXT: ret diff --git a/llvm/test/CodeGen/BPF/sockex2.ll b/llvm/test/CodeGen/BPF/sockex2.ll index 4131d9dac31d8..b1264099f64c6 100644 --- a/llvm/test/CodeGen/BPF/sockex2.ll +++ b/llvm/test/CodeGen/BPF/sockex2.ll @@ -311,7 +311,7 @@ flow_dissector.exit.thread: ; preds = %86, %12, %196, %199 ; CHECK-LABEL: bpf_prog2: ; CHECK: r0 = *(u16 *)skb[12] # encoding: [0x28,0x00,0x00,0x00,0x0c,0x00,0x00,0x00] ; CHECK: r0 = *(u16 *)skb[16] # encoding: [0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00] -; CHECK: implicit-def: $r8 +; CHECK: implicit-def: $r7 ; CHECK: r1 = ; CHECK: call 1 # encoding: [0x85,0x00,0x00,0x00,0x01,0x00,0x00,0x00] ; CHECK: call 2 # encoding: [0x85,0x00,0x00,0x00,0x02,0x00,0x00,0x00] diff --git a/llvm/test/CodeGen/Hexagon/cext-opt-block-addr.mir b/llvm/test/CodeGen/Hexagon/cext-opt-block-addr.mir new file mode 100644 index 0000000000000..9f140132dcd6c --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/cext-opt-block-addr.mir @@ -0,0 +1,173 @@ +# REQUIRES: asserts +# RUN: llc -march=hexagon -run-pass hexagon-cext-opt %s -o - | FileCheck %s + +# Check that the HexagonConstantExtenders pass does not assert when block +# addresses from different functions are used +# CHECK-LABEL: name: wibble +# CHECK: A2_tfrsi blockaddress(@baz +# CHECK: A2_tfrsi blockaddress(@wibble + +--- | + target triple = "hexagon" + + define dso_local void @baz() { + bb: + br label %bb1 + + bb1: ; preds = %bb + %call = tail call fastcc i32 @wibble(i32 poison) + ret void + } + + define internal fastcc i32 @wibble(i32 %arg) { + bb: + %call = tail call i32 @eggs(i32 noundef ptrtoint (ptr blockaddress(@baz, %bb1) to i32)) + br label %bb1 + + bb1: ; preds = %bb + tail call void @baz.1(i32 noundef ptrtoint (ptr blockaddress(@wibble, %bb1) to i32)) + ret i32 %call + } + + declare i32 @eggs(i32 noundef) local_unnamed_addr + + declare void @baz.1(i32 noundef) local_unnamed_addr + +... +--- +name: baz +alignment: 16 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +callsEHReturn: false +callsUnwindInit: false +hasEHCatchret: false +hasEHScopes: false +hasEHFunclets: false +isOutlined: false +debugInstrRef: false +failsVerification: false +tracksDebugUserValues: false +registers: + - { id: 0, class: intregs, preferred-register: '' } +liveins: [] +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 1 + adjustsStack: false + hasCalls: false + stackProtector: '' + functionContext: '' + maxCallFrameSize: 4294967295 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + hasTailCall: true + isCalleeSavedInfoValid: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: [] +stack: [] +entry_values: [] +callSites: [] +debugValueSubstitutions: [] +constants: [] +machineFunctionInfo: {} +body: | + bb.0.bb: + successors: %bb.1(0x80000000) + + bb.1.bb1 (ir-block-address-taken %ir-block.bb1): + %0:intregs = IMPLICIT_DEF + $r0 = COPY %0 + PS_tailcall_i @wibble, hexagoncsr, implicit $r0 + +... +--- +name: wibble +alignment: 16 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +callsEHReturn: false +callsUnwindInit: false +hasEHCatchret: false +hasEHScopes: false +hasEHFunclets: false +isOutlined: false +debugInstrRef: false +failsVerification: false +tracksDebugUserValues: false +registers: + - { id: 0, class: intregs, preferred-register: '' } + - { id: 1, class: intregs, preferred-register: '' } + - { id: 2, class: intregs, preferred-register: '' } + - { id: 3, class: intregs, preferred-register: '' } + - { id: 4, class: intregs, preferred-register: '' } +liveins: [] +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 1 + adjustsStack: true + hasCalls: true + stackProtector: '' + functionContext: '' + maxCallFrameSize: 4294967295 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + hasTailCall: false + isCalleeSavedInfoValid: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: [] +stack: [] +entry_values: [] +callSites: [] +debugValueSubstitutions: [] +constants: [] +machineFunctionInfo: {} +body: | + bb.0.bb: + successors: %bb.1(0x80000000) + + %2:intregs = A2_tfrsi blockaddress(@baz, %ir-block.bb1) + ADJCALLSTACKDOWN 0, 0, implicit-def $r29, implicit-def dead $r30, implicit $r31, implicit $r30, implicit $r29 + $r0 = COPY %2 + J2_call @eggs, hexagoncsr, implicit-def dead $pc, implicit-def dead $r31, implicit $r29, implicit $r0, implicit-def $r29, implicit-def $r0 + ADJCALLSTACKUP 0, 0, implicit-def dead $r29, implicit-def dead $r30, implicit-def dead $r31, implicit $r29 + %3:intregs = COPY $r0 + + bb.1.bb1 (ir-block-address-taken %ir-block.bb1): + %4:intregs = A2_tfrsi blockaddress(@wibble, %ir-block.bb1) + ADJCALLSTACKDOWN 0, 0, implicit-def $r29, implicit-def dead $r30, implicit $r31, implicit $r30, implicit $r29 + $r0 = COPY %4 + J2_call @baz.1, hexagoncsr, implicit-def dead $pc, implicit-def dead $r31, implicit $r29, implicit $r0, implicit-def $r29 + ADJCALLSTACKUP 0, 0, implicit-def dead $r29, implicit-def dead $r30, implicit-def dead $r31, implicit $r29 + $r0 = COPY %3 + PS_jmpret $r31, implicit-def dead $pc, implicit $r0 + +... diff --git a/llvm/test/CodeGen/Hexagon/swp-ws-fail-2.mir b/llvm/test/CodeGen/Hexagon/swp-ws-fail-2.mir index 601b98dca8e20..be75301b016ed 100644 --- a/llvm/test/CodeGen/Hexagon/swp-ws-fail-2.mir +++ b/llvm/test/CodeGen/Hexagon/swp-ws-fail-2.mir @@ -3,6 +3,7 @@ # RUN: -window-sched=force -filetype=null -verify-machineinstrs 2>&1 \ # RUN: | FileCheck %s +# CHECK: Physical registers are not supported in window scheduling! # CHECK: The WindowScheduler failed to initialize! --- diff --git a/llvm/test/CodeGen/Hexagon/swp-ws-live-intervals.mir b/llvm/test/CodeGen/Hexagon/swp-ws-live-intervals.mir new file mode 100644 index 0000000000000..7fa3cdf62d090 --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/swp-ws-live-intervals.mir @@ -0,0 +1,217 @@ +# REQUIRES: asserts +# +# RUN: llc --march=hexagon %s -run-pass=pipeliner -debug-only=pipeliner \ +# RUN: -window-sched=force -filetype=null -window-search-num=100 \ +# RUN: -window-search-ratio=100 -window-diff-limit=0 -verify-machineinstrs \ +# RUN: 2>&1 | FileCheck %s + +# The bug was reported at https://github.com/llvm/llvm-project/pull/99454. +# It is caused by the corruption of live intervals in certain scenarios. +# +# We check the newly generated MBBs after successful scheduling here. +# CHECK: Best window offset is {{[0-9]+}} and Best II is {{[0-9]+}}. +# CHECK: prolog: +# CHECK: bb.5: +# CHECK: New block +# CHECK: bb.6: +# CHECK: epilog: +# CHECK: bb.7: +# CHECK: Best window offset is {{[0-9]+}} and Best II is {{[0-9]+}}. +# CHECK: prolog: +# CHECK: bb.8: +# CHECK: New block +# CHECK: bb.9: +# CHECK: epilog: +# CHECK: bb.10: + +--- | + target triple = "hexagon" + + @_dp_ctrl_calc_tu_temp2_fp = global i64 0 + @_dp_ctrl_calc_tu_temp1_fp = global i32 0 + @dp_panel_update_tu_timings___trans_tmp_5 = global i64 0 + @_dp_ctrl_calc_tu___trans_tmp_8 = global i64 0 + + declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) + declare i8 @div64_u64_rem(i32, ptr) + declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) + + define void @dp_ctrl_calc_tu_parameters() { + if.end.i: + %rem.i11.i = alloca i64, align 8 + %rem.i.i = alloca i64, align 8 + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %rem.i11.i) + %call.i.i = call i8 @div64_u64_rem(i32 0, ptr nonnull %rem.i11.i) + %conv1.i.i = zext i8 %call.i.i to i64 + %rem.promoted.i.i = load i64, ptr %rem.i11.i, align 8 + br label %do.body.i.i + + do.body.i.i: + %lsr.iv1 = phi i32 [ %lsr.iv.next2, %do.body.i.i ], [ -32, %if.end.i ] + %sub9.i.i = phi i64 [ %rem.promoted.i.i, %if.end.i ], [ %sub8.i.i.7, %do.body.i.i ] + %res_abs.0.i.i = phi i64 [ %conv1.i.i, %if.end.i ], [ %res_abs.1.i.i.7, %do.body.i.i ] + %cmp.not.i.i = icmp ne i64 %sub9.i.i, 0 + %sub.i.neg.i = sext i1 %cmp.not.i.i to i64 + %sub8.i.i = add i64 %sub9.i.i, %sub.i.neg.i + %0 = shl i64 %res_abs.0.i.i, 2 + %1 = select i1 %cmp.not.i.i, i64 2, i64 0 + %shl.i.i.5 = or disjoint i64 %0, %1 + %cmp.not.i.i.5 = icmp ne i64 %sub8.i.i, 0 + %sub.i.neg.i.5 = sext i1 %cmp.not.i.i.5 to i64 + %sub8.i.i.5 = add i64 %sub8.i.i, %sub.i.neg.i.5 + %or.i.i.5 = zext i1 %cmp.not.i.i.5 to i64 + %res_abs.1.i.i.5 = or disjoint i64 %shl.i.i.5, %or.i.i.5 + %cmp.not.i.i.6 = icmp ne i64 %sub8.i.i.5, 0 + %sub.i.neg.i.6 = sext i1 %cmp.not.i.i.6 to i64 + %sub8.i.i.6 = add i64 %sub8.i.i.5, %sub.i.neg.i.6 + %2 = shl i64 %res_abs.1.i.i.5, 2 + %3 = select i1 %cmp.not.i.i.6, i64 2, i64 0 + %shl.i.i.7 = or disjoint i64 %2, %3 + %cmp.not.i.i.7 = icmp ne i64 %sub8.i.i.6, 0 + %sub.i.neg.i.7 = sext i1 %cmp.not.i.i.7 to i64 + %sub8.i.i.7 = add i64 %sub8.i.i.6, %sub.i.neg.i.7 + %or.i.i.7 = zext i1 %cmp.not.i.i.7 to i64 + %res_abs.1.i.i.7 = or disjoint i64 %shl.i.i.7, %or.i.i.7 + %lsr.iv.next2 = add nsw i32 %lsr.iv1, 8 + %tobool.not.i.i.7 = icmp eq i32 %lsr.iv.next2, 0 + br i1 %tobool.not.i.i.7, label %fec_check.i, label %do.body.i.i + + fec_check.i: + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %rem.i11.i) + store i64 %res_abs.1.i.i.7, ptr @_dp_ctrl_calc_tu_temp2_fp, align 8 + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %rem.i11.i) + %call.i12.i = call i8 @div64_u64_rem(i32 0, ptr nonnull %rem.i11.i) + %conv1.i13.i = zext i8 %call.i12.i to i64 + %rem.promoted.i14.i = load i64, ptr %rem.i11.i, align 8 + br label %do.body.i15.i + + do.body.i15.i: + %lsr.iv = phi i32 [ %lsr.iv.next, %do.body.i15.i ], [ -32, %fec_check.i ] + %sub9.i16.i = phi i64 [ %rem.promoted.i14.i, %fec_check.i ], [ %sub8.i22.i.7, %do.body.i15.i ] + %res_abs.0.i17.i = phi i64 [ %conv1.i13.i, %fec_check.i ], [ %res_abs.1.i24.i.7, %do.body.i15.i ] + %cmp.not.i20.i = icmp ugt i64 %sub9.i16.i, 999 + %sub.i21.neg.i = select i1 %cmp.not.i20.i, i64 -1000, i64 0 + %sub8.i22.i = add i64 %sub.i21.neg.i, %sub9.i16.i + %4 = shl i64 %res_abs.0.i17.i, 2 + %5 = select i1 %cmp.not.i20.i, i64 2, i64 0 + %shl.i19.i.7 = or disjoint i64 %4, %5 + %cmp.not.i20.i.7 = icmp ugt i64 %sub8.i22.i, 999 + %sub.i21.neg.i.7 = select i1 %cmp.not.i20.i.7, i64 -1000, i64 0 + %sub8.i22.i.7 = add i64 %sub.i21.neg.i.7, %sub8.i22.i + %or.i23.i.7 = zext i1 %cmp.not.i20.i.7 to i64 + %res_abs.1.i24.i.7 = or disjoint i64 %shl.i19.i.7, %or.i23.i.7 + %lsr.iv.next = add nsw i32 %lsr.iv, 8 + %tobool.not.i26.i.7 = icmp eq i32 %lsr.iv.next, 0 + br i1 %tobool.not.i26.i.7, label %_dp_ctrl_calc_tu.exit, label %do.body.i15.i + + _dp_ctrl_calc_tu.exit: + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %rem.i11.i) + %conv.i = trunc i64 %res_abs.1.i24.i.7 to i32 + store i32 %conv.i, ptr @_dp_ctrl_calc_tu_temp1_fp, align 4 + %conv5.i = and i64 %res_abs.1.i24.i.7, 4294967295 + store i64 %conv5.i, ptr @dp_panel_update_tu_timings___trans_tmp_5, align 8 + store i64 %res_abs.1.i.i.7, ptr @_dp_ctrl_calc_tu___trans_tmp_8, align 8 + ret void + } + +... +--- +name: dp_ctrl_calc_tu_parameters +tracksRegLiveness: true +stack: + - { id: 0, name: rem.i11.i, type: default, offset: 0, size: 8, alignment: 8} +body: | + bb.0: + successors: %bb.1(0x80000000) + + %0:intregs = A2_tfrsi 0 + %1:intregs = PS_fi %stack.0.rem.i11.i, 0 + %2:intregs = A2_tfrsi 0 + %3:doubleregs = A4_combineir 0, %2 + %4:doubleregs = L2_loadrd_io %stack.0.rem.i11.i, 0 + %5:doubleregs = A2_tfrpi 0 + J2_loop0i %bb.1, 4, implicit-def $lc0, implicit-def $sa0, implicit-def $usr + + bb.1 (machine-block-address-taken): + successors: %bb.2(0x04000000), %bb.1(0x7c000000) + + %6:doubleregs = PHI %4, %bb.0, %7, %bb.1 + %8:doubleregs = PHI %3, %bb.0, %9, %bb.1 + %10:predregs = C2_cmpeqp %6, %5 + %11:intregs = C2_muxii %10, 0, -1 + %12:doubleregs = A2_addsp %11, %6 + %13:doubleregs = S2_asl_i_p %8, 2 + %14:intregs = S2_setbit_i %13.isub_lo, 1 + %15:intregs = C2_mux %10, %13.isub_lo, %14 + %16:predregs = C2_cmpeqp %12, %5 + %17:intregs = C2_muxii %16, 0, -1 + %18:doubleregs = A2_addsp %17, %12 + %19:intregs = S2_setbit_i %15, 0 + %20:intregs = C2_mux %16, %15, %19 + %21:predregs = C2_cmpeqp %18, %5 + %22:intregs = C2_muxii %21, 0, -1 + %23:doubleregs = A2_addsp %22, %18 + %24:intregs = S2_asl_i_r %20, 2 + %25:intregs = S2_extractu %8.isub_lo, 2, 28 + %26:intregs = S2_asl_i_r_or %25, %13.isub_hi, 2 + %27:intregs = S2_setbit_i %24, 1 + %28:intregs = C2_mux %21, %24, %27 + %29:predregs = C2_cmpeqp %23, %5 + %30:intregs = C2_muxii %29, 0, -1 + %7:doubleregs = A2_addsp %30, %23 + %31:intregs = S2_setbit_i %28, 0 + %32:intregs = C2_mux %29, %28, %31 + %9:doubleregs = REG_SEQUENCE %26, %subreg.isub_hi, %32, %subreg.isub_lo + ENDLOOP0 %bb.1, implicit-def $pc, implicit-def $lc0, implicit $sa0, implicit $lc0 + J2_jump %bb.2, implicit-def dead $pc + + bb.2: + successors: %bb.3(0x80000000) + + S2_storerdgp @_dp_ctrl_calc_tu_temp2_fp, %9, implicit $gp + %33:intregs = A2_tfrsi 0 + %34:intregs = PS_fi %stack.0.rem.i11.i, 0 + %35:intregs = A2_tfrsi 0 + %36:doubleregs = L2_loadrd_io %stack.0.rem.i11.i, 0 + %37:doubleregs = A2_tfrpi 124 + %38:intregs = A2_tfrsi -1000 + %39:intregs = A2_tfrsi -1 + J2_loop0i %bb.3, 4, implicit-def $lc0, implicit-def $sa0, implicit-def $usr + + bb.3 (machine-block-address-taken): + successors: %bb.4(0x04000000), %bb.3(0x7c000000) + + %40:doubleregs = PHI %36, %bb.2, %41, %bb.3 + %42:intregs = PHI %35, %bb.2, %43, %bb.3 + %44:intregs = PHI %33, %bb.2, %45, %bb.3 + %46:doubleregs = S2_lsr_i_p %40, 3 + %47:predregs = C2_cmpgtup %46, %37 + %48:intregs = C2_mux %47, %38, %33 + %49:intregs = C2_mux %47, %39, %33 + %50:doubleregs = REG_SEQUENCE %49, %subreg.isub_hi, %48, %subreg.isub_lo + %51:doubleregs = A2_addp %50, %40 + %52:intregs = S2_asl_i_r %42, 2 + %53:intregs = S2_extractu %42, 2, 30 + %45:intregs = S2_asl_i_r_or %53, %44, 2 + %54:intregs = S2_setbit_i %52, 1 + %55:intregs = C2_mux %47, %54, %52 + %56:doubleregs = S2_lsr_i_p %51, 3 + %57:predregs = C2_cmpgtup %56, %37 + %58:intregs = C2_mux %57, %38, %33 + %59:intregs = C2_mux %57, %39, %33 + %60:doubleregs = REG_SEQUENCE %59, %subreg.isub_hi, %58, %subreg.isub_lo + %41:doubleregs = A2_addp %60, %51 + %61:intregs = S2_setbit_i %55, 0 + %43:intregs = C2_mux %57, %61, %55 + ENDLOOP0 %bb.3, implicit-def $pc, implicit-def $lc0, implicit $sa0, implicit $lc0 + J2_jump %bb.4, implicit-def dead $pc + + bb.4: + S2_storerigp @_dp_ctrl_calc_tu_temp1_fp, %43, implicit $gp + %62:intregs = A2_tfrsi 0 + %63:doubleregs = REG_SEQUENCE %43, %subreg.isub_lo, %62, %subreg.isub_hi + S2_storerdgp @dp_panel_update_tu_timings___trans_tmp_5, %63, implicit $gp + S2_storerdgp @_dp_ctrl_calc_tu___trans_tmp_8, %9, implicit $gp + PS_jmpret $r31, implicit-def dead $pc + +... diff --git a/llvm/test/CodeGen/Hexagon/swp-ws-pragma-initiation-interval-fail.mir b/llvm/test/CodeGen/Hexagon/swp-ws-pragma-initiation-interval-fail.mir new file mode 100644 index 0000000000000..6e69a76290fb1 --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/swp-ws-pragma-initiation-interval-fail.mir @@ -0,0 +1,83 @@ +# RUN: llc --march=hexagon %s -run-pass=pipeliner -debug-only=pipeliner \ +# RUN: -window-sched=force -filetype=null -verify-machineinstrs 2>&1 \ +# RUN: | FileCheck %s +# REQUIRES: asserts + +# Test that checks no window scheduler is performed if the II set by pragma was +# enabled + +# CHECK: Window scheduling is disabled when llvm.loop.pipeline.initiationinterval is set. + +--- | + define void @test_pragma_ii_fail(ptr %a0, i32 %a1) { + b0: + %v0 = icmp sgt i32 %a1, 1 + br i1 %v0, label %b1, label %b4 + + b1: ; preds = %b0 + %v1 = load i32, ptr %a0, align 4 + %v2 = add i32 %v1, 10 + %v4 = add i32 %a1, -1 + %cgep = getelementptr i32, ptr %a0, i32 1 + br label %b2 + + b2: ; preds = %b2, %b1 + %v5 = phi i32 [ %v12, %b2 ], [ %v4, %b1 ] + %v6 = phi ptr [ %cgep2, %b2 ], [ %cgep, %b1 ] + %v7 = phi i32 [ %v10, %b2 ], [ %v2, %b1 ] + store i32 %v7, ptr %v6, align 4 + %v8 = add i32 %v7, 10 + %cgep1 = getelementptr i32, ptr %v6, i32 -1 + store i32 %v8, ptr %cgep1, align 4 + %v10 = add i32 %v7, 10 + %v12 = add i32 %v5, -1 + %v13 = icmp eq i32 %v12, 0 + %cgep2 = getelementptr i32, ptr %v6, i32 1 + br i1 %v13, label %b4, label %b2, !llvm.loop !0 + + b4: ; preds = %b2, %b0 + ret void + } + + !0 = distinct !{!0, !1} + !1 = !{!"llvm.loop.pipeline.initiationinterval", i32 2} +... +--- +name: test_pragma_ii_fail +tracksRegLiveness: true +body: | + bb.0.b0: + successors: %bb.1(0x40000000), %bb.3(0x40000000) + liveins: $r0, $r1 + + %0:intregs = COPY $r1 + %1:intregs = COPY $r0 + %2:predregs = C2_cmpgti %0, 1 + J2_jumpf %2, %bb.3, implicit-def dead $pc + J2_jump %bb.1, implicit-def dead $pc + + bb.1.b1: + successors: %bb.2(0x80000000) + + %3:intregs, %4:intregs = L2_loadri_pi %1, 4 + %5:intregs = A2_addi killed %3, 10 + %6:intregs = A2_addi %0, -1 + %7:intregs = COPY %6 + J2_loop0r %bb.2, %7, implicit-def $lc0, implicit-def $sa0, implicit-def $usr + + bb.2.b2 (machine-block-address-taken): + successors: %bb.3(0x04000000), %bb.2(0x7c000000) + + %8:intregs = PHI %4, %bb.1, %9, %bb.2 + %10:intregs = PHI %5, %bb.1, %11, %bb.2 + S2_storeri_io %8, 0, %10 + %11:intregs = A2_addi %10, 10 + S2_storeri_io %8, -4, %11 + %9:intregs = A2_addi %8, 4 + ENDLOOP0 %bb.2, implicit-def $pc, implicit-def $lc0, implicit $sa0, implicit $lc0 + J2_jump %bb.3, implicit-def dead $pc + + bb.3.b4: + PS_jmpret $r31, implicit-def dead $pc + +... diff --git a/llvm/test/CodeGen/Hexagon/swp-ws-resource-reserve.mir b/llvm/test/CodeGen/Hexagon/swp-ws-resource-reserve.mir new file mode 100644 index 0000000000000..4a9a09c4148cb --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/swp-ws-resource-reserve.mir @@ -0,0 +1,100 @@ +# REQUIRES: asserts +# RUN: llc --march=hexagon %s -run-pass=pipeliner -debug-only=pipeliner \ +# RUN: -window-sched=force -filetype=null -verify-machineinstrs 2>&1 \ +# RUN: -window-search-ratio=100 -window-search-num=100 -window-diff-limit=1 \ +# RUN: | FileCheck %s + +# We want to verify that all three V6_vaddw instructions are emitted in the same cycle. +# CHECK-LABEL: Current window Offset is 2 +# CHECK: Cycle [[CycleNum:[0-9]+]] [{{S.[0-9]+}}]: {{%[0-9]+}}:hvxvr = V6_vaddw {{%[0-9]+}}:hvxvr, {{%[0-9]+}}:hvxvr +# CHECK: Cycle [[CycleNum]] [{{S.[0-9]+}}]: {{%[0-9]+}}:hvxvr = V6_vaddw {{%[0-9]+}}:hvxvr, {{%[0-9]+}}:hvxvr +# CHECK: Cycle [[CycleNum]] [{{S.[0-9]+}}]: {{%[0-9]+}}:hvxvr = V6_vaddw {{%[0-9]+}}:hvxvr, {{%[0-9]+}}:hvxvr +# CHECK-LABEL: Current window Offset is 3 + +--- | + define void @add_parallel(i32 %N, ptr noalias %x, ptr noalias %y) { + entry: + %isZeroLength = icmp eq i32 %N, 0 + br i1 %isZeroLength, label %loop.exit, label %loop.preheader + + loop.preheader: ; preds = %entry + %half_splat = tail call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1056964608) + %one_splat = tail call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1065353216) + %two_splat = tail call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1073741824) + br label %loop.body + + loop.exit: ; preds = %loop.body, %entry + ret void + + loop.body: ; preds = %loop.body, %loop.preheader + %lsr.iv1 = phi ptr [ %cgep2, %loop.body ], [ %x, %loop.preheader ] + %lsr.iv = phi ptr [ %cgep1, %loop.body ], [ %y, %loop.preheader ] + %index = phi i32 [ 0, %loop.preheader ], [ %index.next, %loop.body ] + %vec_x1 = load <32 x i32>, ptr %lsr.iv1, align 128 + %vec_add_1 = tail call <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32> %one_splat, <32 x i32> %vec_x1) + %vec_add_2 = tail call <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32> %half_splat, <32 x i32> %vec_x1) + %vec_add_3 = tail call <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32> %two_splat, <32 x i32> %vec_x1) + %vec_add_4 = tail call <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32> %vec_add_1, <32 x i32> %vec_add_2) + %vec_add_5 = tail call <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32> %vec_add_1, <32 x i32> %vec_add_3) + %vec_add_6 = tail call <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32> %vec_add_5, <32 x i32> %vec_add_4) + store <32 x i32> %vec_add_6, ptr %lsr.iv, align 128 + %index.next = add nuw i32 %index, 32 + %continue = icmp ult i32 %index.next, %N + %cgep1 = getelementptr i8, ptr %lsr.iv, i32 128 + %cgep2 = getelementptr i8, ptr %lsr.iv1, i32 128 + br i1 %continue, label %loop.body, label %loop.exit + } + + declare <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32) + declare <32 x i32> @llvm.hexagon.V6.vaddw.128B(<32 x i32>, <32 x i32>) +... +--- +name: add_parallel +tracksRegLiveness: true +body: | + bb.0.entry: + successors: %bb.2(0x30000000), %bb.1(0x50000000) + liveins: $r0, $r1, $r2 + + %0:intregs = COPY $r2 + %1:intregs = COPY $r1 + %2:intregs = COPY $r0 + %3:predregs = C2_cmpeqi %2, 0 + J2_jumpt killed %3, %bb.2, implicit-def dead $pc + J2_jump %bb.1, implicit-def dead $pc + + bb.1.loop.preheader: + successors: %bb.3(0x80000000) + + %4:intregs = A2_tfrsi 1056964608 + %5:hvxvr = V6_lvsplatw killed %4 + %6:intregs = A2_tfrsi 1065353216 + %7:hvxvr = V6_lvsplatw killed %6 + %8:intregs = A2_tfrsi 1073741824 + %9:hvxvr = V6_lvsplatw killed %8 + %10:intregs = A2_addi %2, 31 + %11:intregs = S2_lsr_i_r %10, 5 + %12:intregs = COPY %11 + J2_loop0r %bb.3, %12, implicit-def $lc0, implicit-def $sa0, implicit-def $usr + J2_jump %bb.3, implicit-def dead $pc + + bb.2.loop.exit: + PS_jmpret $r31, implicit-def dead $pc + + bb.3.loop.body (machine-block-address-taken): + successors: %bb.3(0x7c000000), %bb.2(0x04000000) + + %13:intregs = PHI %1, %bb.1, %14, %bb.3 + %15:intregs = PHI %0, %bb.1, %16, %bb.3 + %17:hvxvr, %14:intregs = V6_vL32b_pi %13, 128 :: (load (s1024) from %ir.lsr.iv1) + %18:hvxvr = V6_vaddw %7, %17 + %19:hvxvr = V6_vaddw %5, %17 + %20:hvxvr = V6_vaddw %9, %17 + %21:hvxvr = V6_vaddw %18, killed %19 + %22:hvxvr = V6_vaddw %18, killed %20 + %23:hvxvr = V6_vaddw killed %22, killed %21 + %16:intregs = V6_vS32b_pi %15, 128, killed %23 :: (store (s1024) into %ir.lsr.iv) + ENDLOOP0 %bb.3, implicit-def $pc, implicit-def $lc0, implicit $sa0, implicit $lc0 + J2_jump %bb.2, implicit-def dead $pc + +... diff --git a/llvm/test/CodeGen/Hexagon/swp-ws-stall-cycle.mir b/llvm/test/CodeGen/Hexagon/swp-ws-stall-cycle.mir new file mode 100644 index 0000000000000..ddba67d78eb58 --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/swp-ws-stall-cycle.mir @@ -0,0 +1,59 @@ +# REQUIRES: asserts +# RUN: llc --march=hexagon %s -run-pass=pipeliner -debug-only=pipeliner \ +# RUN: -window-sched=force -filetype=null -verify-machineinstrs \ +# RUN: -window-region-limit=1 -window-search-ratio=100 -window-diff-limit=0 \ +# RUN: 2>&1 | FileCheck %s + +# CHECK-LABEL: Start analyzing II +# CHECK: MaxStallCycle is 0 +# CHECK-LABEL: Start analyzing II +# CHECK: MaxStallCycle is 0 +# CHECK-LABEL: Start analyzing II +# CHECK: MaxStallCycle is 0 + +--- +name: test_window_stall_cycle +tracksRegLiveness: true +body: | + bb.0: + successors: %bb.3(0x40000000), %bb.1(0x40000000) + liveins: $r0, $r1 + + %0:intregs = COPY $r1 + %1:intregs = COPY $r0 + %2:intregs = nsw A2_add %0, %1 + %3:intregs = S2_lsr_i_r_acc %2, %2, 31 + %4:intregs = S2_asr_i_r killed %3, 1 + %5:predregs = C2_cmpgt %1, %4 + %6:intregs = A2_tfrsi 0 + J2_jumpt killed %5, %bb.3, implicit-def dead $pc + J2_jump %bb.1, implicit-def dead $pc + + bb.1: + successors: %bb.2(0x80000000) + + %7:intregs = A2_addi %4, 2 + %8:intregs = A2_tfrsi 0 + %9:intregs = A2_sub %4, %1 + %10:intregs = A2_addi %9, 1 + %11:intregs = COPY %10 + J2_loop0r %bb.2, %11, implicit-def $lc0, implicit-def $sa0, implicit-def $usr + + bb.2 (machine-block-address-taken): + successors: %bb.3(0x04000000), %bb.2(0x7c000000) + + %12:intregs = PHI %7, %bb.1, %13, %bb.2 + %14:intregs = PHI %8, %bb.1, %15, %bb.2 + %16:intregs = PHI %8, %bb.1, %17, %bb.2 + %18:intregs, %13:intregs = L2_loadri_pi %12, -4 + %17:intregs = nsw A2_add killed %18, %16 + %15:intregs = A2_max %17, %14 + ENDLOOP0 %bb.2, implicit-def $pc, implicit-def $lc0, implicit $sa0, implicit $lc0 + J2_jump %bb.3, implicit-def dead $pc + + bb.3: + %19:intregs = PHI %6, %bb.0, %15, %bb.2 + $r0 = COPY %19 + PS_jmpret $r31, implicit-def dead $pc, implicit $r0 + +... diff --git a/llvm/test/CodeGen/Hexagon/swp-ws-zero-cost.mir b/llvm/test/CodeGen/Hexagon/swp-ws-zero-cost.mir new file mode 100644 index 0000000000000..ecf49a83c69e1 --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/swp-ws-zero-cost.mir @@ -0,0 +1,45 @@ +# REQUIRES: asserts +# RUN: llc --march=hexagon %s -run-pass=pipeliner -debug-only=pipeliner \ +# RUN: -window-sched=force -filetype=null -verify-machineinstrs 2>&1 \ +# RUN: | FileCheck %s + +# CHECK-NOT: Can't find a valid II. Keep searching... +# CHECK: Start analyzing II +# CHECK: Start scheduling Phis +# CHECK: Current window Offset is {{[0-9]+}} and II is {{[0-9]+}} + +--- +name: relu +tracksRegLiveness: true +body: | + bb.0: + successors: %bb.2(0x30000000), %bb.1(0x50000000) + liveins: $r0, $r1, $r2 + %0:intregs = COPY $r2 + %1:intregs = COPY $r1 + %2:intregs = COPY $r0 + %3:predregs = C2_cmpeqi %2, 0 + J2_jumpt killed %3, %bb.2, implicit-def dead $pc + J2_jump %bb.1, implicit-def dead $pc + bb.1: + successors: %bb.3(0x80000000) + %4:hvxvr = V6_vd0 + %5:intregs = A2_addi %2, 31 + %6:intregs = S2_lsr_i_r %5, 5 + %7:intregs = COPY %6 + J2_loop0r %bb.3, %7, implicit-def $lc0, implicit-def $sa0, implicit-def $usr + J2_jump %bb.3, implicit-def dead $pc + bb.2: + PS_jmpret $r31, implicit-def dead $pc + bb.3 (machine-block-address-taken): + successors: %bb.3(0x7c000000), %bb.2(0x04000000) + %8:intregs = PHI %1, %bb.1, %9, %bb.3 + %10:intregs = PHI %0, %bb.1, %14, %bb.3 + %11:hvxvr, %9:intregs = V6_vL32b_pi %8, 128 + %12:intregs = COPY %10 + %13:hvxvr = V6_vmaxw killed %11, %4 + %14:intregs = V6_vS32b_pi %12, 128, killed %13 + ENDLOOP0 %bb.3, implicit-def $pc, implicit-def $lc0, implicit $sa0, implicit $lc0 + J2_jump %bb.2, implicit-def dead $pc +... + diff --git a/llvm/test/CodeGen/LoongArch/rotl-rotr.ll b/llvm/test/CodeGen/LoongArch/rotl-rotr.ll index b2d46f5c088ba..75461f5820984 100644 --- a/llvm/test/CodeGen/LoongArch/rotl-rotr.ll +++ b/llvm/test/CodeGen/LoongArch/rotl-rotr.ll @@ -504,6 +504,42 @@ define i64 @rotr_64_mask_or_128_or_64(i64 %x, i64 %y) nounwind { ret i64 %f } +define signext i32 @rotr_64_trunc_32(i64 %x, i64 %y) nounwind { +; LA32-LABEL: rotr_64_trunc_32: +; LA32: # %bb.0: +; LA32-NEXT: srl.w $a3, $a0, $a2 +; LA32-NEXT: xori $a4, $a2, 31 +; LA32-NEXT: slli.w $a5, $a1, 1 +; LA32-NEXT: sll.w $a4, $a5, $a4 +; LA32-NEXT: or $a3, $a3, $a4 +; LA32-NEXT: addi.w $a4, $a2, -32 +; LA32-NEXT: slti $a5, $a4, 0 +; LA32-NEXT: maskeqz $a3, $a3, $a5 +; LA32-NEXT: srl.w $a1, $a1, $a4 +; LA32-NEXT: masknez $a1, $a1, $a5 +; LA32-NEXT: or $a1, $a3, $a1 +; LA32-NEXT: sub.w $a3, $zero, $a2 +; LA32-NEXT: sll.w $a0, $a0, $a3 +; LA32-NEXT: ori $a3, $zero, 32 +; LA32-NEXT: sub.w $a2, $a3, $a2 +; LA32-NEXT: srai.w $a2, $a2, 31 +; LA32-NEXT: and $a0, $a2, $a0 +; LA32-NEXT: or $a0, $a1, $a0 +; LA32-NEXT: ret +; +; LA64-LABEL: rotr_64_trunc_32: +; LA64: # %bb.0: +; LA64-NEXT: rotr.d $a0, $a0, $a1 +; LA64-NEXT: addi.w $a0, $a0, 0 +; LA64-NEXT: ret + %z = sub i64 64, %y + %b = lshr i64 %x, %y + %c = shl i64 %x, %z + %d = or i64 %b, %c + %e = trunc i64 %d to i32 + ret i32 %e +} + define signext i32 @rotri_i32(i32 signext %a) nounwind { ; LA32-LABEL: rotri_i32: ; LA32: # %bb.0: diff --git a/llvm/test/CodeGen/Mips/Fast-ISel/bswap1.ll b/llvm/test/CodeGen/Mips/Fast-ISel/bswap1.ll index bd762a0e1d741..ce664c78e86c2 100644 --- a/llvm/test/CodeGen/Mips/Fast-ISel/bswap1.ll +++ b/llvm/test/CodeGen/Mips/Fast-ISel/bswap1.ll @@ -21,8 +21,8 @@ define void @b16() { ; 32R1: sll $[[TMP1:[0-9]+]], $[[A_VAL]], 8 ; 32R1: srl $[[TMP2:[0-9]+]], $[[A_VAL]], 8 - ; 32R1: or $[[TMP3:[0-9]+]], $[[TMP1]], $[[TMP2]] - ; 32R1: andi $[[TMP4:[0-9]+]], $[[TMP3]], 65535 + ; 32R1: andi $[[TMP3:[0-9]+]], $[[TMP2]], 255 + ; 32R1: or $[[RESULT:[0-9]+]], $[[TMP1]], $[[TMP3]] ; 32R2: wsbh $[[RESULT:[0-9]+]], $[[A_VAL]] diff --git a/llvm/test/CodeGen/NVPTX/indirect_byval.ll b/llvm/test/CodeGen/NVPTX/indirect_byval.ll new file mode 100644 index 0000000000000..ac6c4e262fd60 --- /dev/null +++ b/llvm/test/CodeGen/NVPTX/indirect_byval.ll @@ -0,0 +1,94 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 +; RUN: llc < %s -march=nvptx64 -mcpu=sm_52 -mattr=+ptx64 | FileCheck %s +; RUN: %if ptxas %{ llc < %s -march=nvptx64 -mcpu=sm_52 -mattr=+ptx64 | %ptxas-verify %} + +target triple = "nvptx64-nvidia-cuda" + +%struct.S = type { i8 } +%struct.U = type { i64 } + +@ptr = external global ptr, align 8 + +define internal i32 @foo() { +; CHECK-LABEL: foo( +; CHECK: { +; CHECK-NEXT: .local .align 1 .b8 __local_depot0[2]; +; CHECK-NEXT: .reg .b64 %SP; +; CHECK-NEXT: .reg .b64 %SPL; +; CHECK-NEXT: .reg .b16 %rs<2>; +; CHECK-NEXT: .reg .b32 %r<3>; +; CHECK-NEXT: .reg .b64 %rd<3>; +; CHECK-EMPTY: +; CHECK-NEXT: // %bb.0: // %entry +; CHECK-NEXT: mov.u64 %SPL, __local_depot0; +; CHECK-NEXT: cvta.local.u64 %SP, %SPL; +; CHECK-NEXT: ld.global.u64 %rd1, [ptr]; +; CHECK-NEXT: ld.u8 %rs1, [%SP+1]; +; CHECK-NEXT: add.u64 %rd2, %SP, 0; +; CHECK-NEXT: { // callseq 0, 0 +; CHECK-NEXT: .param .align 1 .b8 param0[1]; +; CHECK-NEXT: st.param.b8 [param0+0], %rs1; +; CHECK-NEXT: .param .b64 param1; +; CHECK-NEXT: st.param.b64 [param1+0], %rd2; +; CHECK-NEXT: .param .b32 retval0; +; CHECK-NEXT: prototype_0 : .callprototype (.param .b32 _) _ (.param .align 1 .b8 _[1], .param .b64 _); +; CHECK-NEXT: call (retval0), +; CHECK-NEXT: %rd1, +; CHECK-NEXT: ( +; CHECK-NEXT: param0, +; CHECK-NEXT: param1 +; CHECK-NEXT: ) +; CHECK-NEXT: , prototype_0; +; CHECK-NEXT: ld.param.b32 %r1, [retval0+0]; +; CHECK-NEXT: } // callseq 0 +; CHECK-NEXT: st.param.b32 [func_retval0+0], %r1; +; CHECK-NEXT: ret; +entry: + %s = alloca %struct.S, align 1 + %agg.tmp = alloca %struct.S, align 1 + %0 = load ptr, ptr @ptr, align 8 + %call = call i32 %0(ptr byval(%struct.S) align 1 %agg.tmp, ptr noundef %s) + ret i32 %call +} + +define internal i32 @bar() { +; CHECK-LABEL: bar( +; CHECK: // @bar +; CHECK-NEXT: { +; CHECK-NEXT: .local .align 8 .b8 __local_depot1[16]; +; CHECK-NEXT: .reg .b64 %SP; +; CHECK-NEXT: .reg .b64 %SPL; +; CHECK-NEXT: .reg .b32 %r<3>; +; CHECK-NEXT: .reg .b64 %rd<4>; +; CHECK-EMPTY: +; CHECK-NEXT: // %bb.0: // %entry +; CHECK-NEXT: mov.u64 %SPL, __local_depot1; +; CHECK-NEXT: cvta.local.u64 %SP, %SPL; +; CHECK-NEXT: ld.global.u64 %rd1, [ptr]; +; CHECK-NEXT: ld.u64 %rd2, [%SP+8]; +; CHECK-NEXT: add.u64 %rd3, %SP, 0; +; CHECK-NEXT: { // callseq 1, 0 +; CHECK-NEXT: .param .align 8 .b8 param0[8]; +; CHECK-NEXT: st.param.b64 [param0+0], %rd2; +; CHECK-NEXT: .param .b64 param1; +; CHECK-NEXT: st.param.b64 [param1+0], %rd3; +; CHECK-NEXT: .param .b32 retval0; +; CHECK-NEXT: prototype_1 : .callprototype (.param .b32 _) _ (.param .align 8 .b8 _[8], .param .b64 _); +; CHECK-NEXT: call (retval0), +; CHECK-NEXT: %rd1, +; CHECK-NEXT: ( +; CHECK-NEXT: param0, +; CHECK-NEXT: param1 +; CHECK-NEXT: ) +; CHECK-NEXT: , prototype_1; +; CHECK-NEXT: ld.param.b32 %r1, [retval0+0]; +; CHECK-NEXT: } // callseq 1 +; CHECK-NEXT: st.param.b32 [func_retval0+0], %r1; +; CHECK-NEXT: ret; +entry: + %s = alloca %struct.U, align 8 + %agg.tmp = alloca %struct.U, align 8 + %0 = load ptr, ptr @ptr, align 8 + %call = call noundef i32 %0(ptr byval(%struct.U) align 8 %agg.tmp, ptr %s) + ret i32 %call +} diff --git a/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll b/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll index ab222d770360c..5e66e5ec27638 100644 --- a/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll +++ b/llvm/test/CodeGen/PowerPC/aix-base-pointer.ll @@ -6,6 +6,7 @@ ; Use an overaligned buffer to force base-pointer usage. Test verifies: ; - base pointer register (r30) is saved/defined/restored. +; - frame pointer register (r31) is saved/defined/restored. ; - stack frame is allocated with correct alignment. ; - Address of %AlignedBuffer is calculated based off offset from the stack ; pointer. @@ -25,7 +26,9 @@ declare void @callee(ptr) ; 32BIT: subfic 0, 0, -224 ; 32BIT: stwux 1, 1, 0 ; 32BIT: addi 3, 1, 64 +; 32BIT: stw 31, -12(30) ; 32BIT: bl .callee +; 32BIT: lwz 31, -12(30) ; 32BIT: mr 1, 30 ; 32BIT: lwz 30, -16(1) @@ -36,6 +39,8 @@ declare void @callee(ptr) ; 64BIT: subfic 0, 0, -288 ; 64BIT: stdux 1, 1, 0 ; 64BIT: addi 3, 1, 128 +; 64BIT: std 31, -16(30) ; 64BIT: bl .callee +; 64BIT: ld 31, -16(30) ; 64BIT: mr 1, 30 ; 64BIT: ld 30, -24(1) diff --git a/llvm/test/CodeGen/PowerPC/aix-vec_insert_elt.ll b/llvm/test/CodeGen/PowerPC/aix-vec_insert_elt.ll index aae23265710ce..afc7a39e18dc8 100644 --- a/llvm/test/CodeGen/PowerPC/aix-vec_insert_elt.ll +++ b/llvm/test/CodeGen/PowerPC/aix-vec_insert_elt.ll @@ -750,25 +750,21 @@ entry: define <2 x double> @testDoubleImm1(<2 x double> %a, double %b) { ; CHECK-64-LABEL: testDoubleImm1: ; CHECK-64: # %bb.0: # %entry -; CHECK-64-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-64-NEXT: xxpermdi 34, 1, 34, 1 ; CHECK-64-NEXT: blr ; ; CHECK-32-LABEL: testDoubleImm1: ; CHECK-32: # %bb.0: # %entry -; CHECK-32-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-32-NEXT: xxpermdi 34, 1, 34, 1 ; CHECK-32-NEXT: blr ; ; CHECK-64-P10-LABEL: testDoubleImm1: ; CHECK-64-P10: # %bb.0: # %entry -; CHECK-64-P10-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-64-P10-NEXT: xxpermdi 34, 1, 34, 1 ; CHECK-64-P10-NEXT: blr ; ; CHECK-32-P10-LABEL: testDoubleImm1: ; CHECK-32-P10: # %bb.0: # %entry -; CHECK-32-P10-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-32-P10-NEXT: xxpermdi 34, 1, 34, 1 ; CHECK-32-P10-NEXT: blr entry: diff --git a/llvm/test/CodeGen/PowerPC/aix32-p8-scalar_vector_conversions.ll b/llvm/test/CodeGen/PowerPC/aix32-p8-scalar_vector_conversions.ll index 19e298a633e0b..2f543da9b29a0 100644 --- a/llvm/test/CodeGen/PowerPC/aix32-p8-scalar_vector_conversions.ll +++ b/llvm/test/CodeGen/PowerPC/aix32-p8-scalar_vector_conversions.ll @@ -1099,7 +1099,6 @@ define double @getd1(<2 x double> %vd) { ; CHECK-LABEL: getd1: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: xxswapd 1, 34 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: blr entry: %vecext = extractelement <2 x double> %vd, i32 1 @@ -1115,7 +1114,6 @@ define double @getveld(<2 x double> %vd, i32 signext %i) { ; CHECK-NEXT: lvsl 3, 0, 3 ; CHECK-NEXT: vperm 2, 2, 2, 3 ; CHECK-NEXT: xxlor 1, 34, 34 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: blr entry: %vecext = extractelement <2 x double> %vd, i32 %i diff --git a/llvm/test/CodeGen/PowerPC/build-vector-tests.ll b/llvm/test/CodeGen/PowerPC/build-vector-tests.ll index f729018dd4106..91431ed15f6a7 100644 --- a/llvm/test/CodeGen/PowerPC/build-vector-tests.ll +++ b/llvm/test/CodeGen/PowerPC/build-vector-tests.ll @@ -1319,11 +1319,7 @@ entry: define <4 x i32> @fromRegsConvftoi(float %a, float %b, float %c, float %d) { ; P9BE-LABEL: fromRegsConvftoi: ; P9BE: # %bb.0: # %entry -; P9BE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P9BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 ; P9BE-NEXT: xxmrghd vs0, vs2, vs4 -; P9BE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P9BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9BE-NEXT: xvcvdpsxws v2, vs0 ; P9BE-NEXT: xxmrghd vs0, vs1, vs3 ; P9BE-NEXT: xvcvdpsxws v3, vs0 @@ -1332,11 +1328,7 @@ define <4 x i32> @fromRegsConvftoi(float %a, float %b, float %c, float %d) { ; ; P9LE-LABEL: fromRegsConvftoi: ; P9LE: # %bb.0: # %entry -; P9LE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P9LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9LE-NEXT: xxmrghd vs0, vs3, vs1 -; P9LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P9LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 ; P9LE-NEXT: xvcvdpsxws v2, vs0 ; P9LE-NEXT: xxmrghd vs0, vs4, vs2 ; P9LE-NEXT: xvcvdpsxws v3, vs0 @@ -1345,10 +1337,6 @@ define <4 x i32> @fromRegsConvftoi(float %a, float %b, float %c, float %d) { ; ; P8BE-LABEL: fromRegsConvftoi: ; P8BE: # %bb.0: # %entry -; P8BE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P8BE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P8BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8BE-NEXT: xxmrghd vs0, vs2, vs4 ; P8BE-NEXT: xxmrghd vs1, vs1, vs3 ; P8BE-NEXT: xvcvdpsxws v2, vs0 @@ -1358,10 +1346,6 @@ define <4 x i32> @fromRegsConvftoi(float %a, float %b, float %c, float %d) { ; ; P8LE-LABEL: fromRegsConvftoi: ; P8LE: # %bb.0: # %entry -; P8LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P8LE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P8LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8LE-NEXT: xxmrghd vs0, vs3, vs1 ; P8LE-NEXT: xxmrghd vs1, vs4, vs2 ; P8LE-NEXT: xvcvdpsxws v2, vs0 @@ -1773,11 +1757,7 @@ entry: define <4 x i32> @fromRegsConvdtoi(double %a, double %b, double %c, double %d) { ; P9BE-LABEL: fromRegsConvdtoi: ; P9BE: # %bb.0: # %entry -; P9BE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P9BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 ; P9BE-NEXT: xxmrghd vs0, vs2, vs4 -; P9BE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P9BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9BE-NEXT: xvcvdpsxws v2, vs0 ; P9BE-NEXT: xxmrghd vs0, vs1, vs3 ; P9BE-NEXT: xvcvdpsxws v3, vs0 @@ -1786,11 +1766,7 @@ define <4 x i32> @fromRegsConvdtoi(double %a, double %b, double %c, double %d) { ; ; P9LE-LABEL: fromRegsConvdtoi: ; P9LE: # %bb.0: # %entry -; P9LE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P9LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9LE-NEXT: xxmrghd vs0, vs3, vs1 -; P9LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P9LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 ; P9LE-NEXT: xvcvdpsxws v2, vs0 ; P9LE-NEXT: xxmrghd vs0, vs4, vs2 ; P9LE-NEXT: xvcvdpsxws v3, vs0 @@ -1799,10 +1775,6 @@ define <4 x i32> @fromRegsConvdtoi(double %a, double %b, double %c, double %d) { ; ; P8BE-LABEL: fromRegsConvdtoi: ; P8BE: # %bb.0: # %entry -; P8BE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P8BE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P8BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8BE-NEXT: xxmrghd vs0, vs2, vs4 ; P8BE-NEXT: xxmrghd vs1, vs1, vs3 ; P8BE-NEXT: xvcvdpsxws v2, vs0 @@ -1812,10 +1784,6 @@ define <4 x i32> @fromRegsConvdtoi(double %a, double %b, double %c, double %d) { ; ; P8LE-LABEL: fromRegsConvdtoi: ; P8LE: # %bb.0: # %entry -; P8LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P8LE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P8LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8LE-NEXT: xxmrghd vs0, vs3, vs1 ; P8LE-NEXT: xxmrghd vs1, vs4, vs2 ; P8LE-NEXT: xvcvdpsxws v2, vs0 @@ -2839,11 +2807,7 @@ entry: define <4 x i32> @fromRegsConvftoui(float %a, float %b, float %c, float %d) { ; P9BE-LABEL: fromRegsConvftoui: ; P9BE: # %bb.0: # %entry -; P9BE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P9BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 ; P9BE-NEXT: xxmrghd vs0, vs2, vs4 -; P9BE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P9BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9BE-NEXT: xvcvdpuxws v2, vs0 ; P9BE-NEXT: xxmrghd vs0, vs1, vs3 ; P9BE-NEXT: xvcvdpuxws v3, vs0 @@ -2852,11 +2816,7 @@ define <4 x i32> @fromRegsConvftoui(float %a, float %b, float %c, float %d) { ; ; P9LE-LABEL: fromRegsConvftoui: ; P9LE: # %bb.0: # %entry -; P9LE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P9LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9LE-NEXT: xxmrghd vs0, vs3, vs1 -; P9LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P9LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 ; P9LE-NEXT: xvcvdpuxws v2, vs0 ; P9LE-NEXT: xxmrghd vs0, vs4, vs2 ; P9LE-NEXT: xvcvdpuxws v3, vs0 @@ -2865,10 +2825,6 @@ define <4 x i32> @fromRegsConvftoui(float %a, float %b, float %c, float %d) { ; ; P8BE-LABEL: fromRegsConvftoui: ; P8BE: # %bb.0: # %entry -; P8BE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P8BE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P8BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8BE-NEXT: xxmrghd vs0, vs2, vs4 ; P8BE-NEXT: xxmrghd vs1, vs1, vs3 ; P8BE-NEXT: xvcvdpuxws v2, vs0 @@ -2878,10 +2834,6 @@ define <4 x i32> @fromRegsConvftoui(float %a, float %b, float %c, float %d) { ; ; P8LE-LABEL: fromRegsConvftoui: ; P8LE: # %bb.0: # %entry -; P8LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P8LE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P8LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8LE-NEXT: xxmrghd vs0, vs3, vs1 ; P8LE-NEXT: xxmrghd vs1, vs4, vs2 ; P8LE-NEXT: xvcvdpuxws v2, vs0 @@ -3294,11 +3246,7 @@ entry: define <4 x i32> @fromRegsConvdtoui(double %a, double %b, double %c, double %d) { ; P9BE-LABEL: fromRegsConvdtoui: ; P9BE: # %bb.0: # %entry -; P9BE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P9BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 ; P9BE-NEXT: xxmrghd vs0, vs2, vs4 -; P9BE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P9BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9BE-NEXT: xvcvdpuxws v2, vs0 ; P9BE-NEXT: xxmrghd vs0, vs1, vs3 ; P9BE-NEXT: xvcvdpuxws v3, vs0 @@ -3307,11 +3255,7 @@ define <4 x i32> @fromRegsConvdtoui(double %a, double %b, double %c, double %d) ; ; P9LE-LABEL: fromRegsConvdtoui: ; P9LE: # %bb.0: # %entry -; P9LE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P9LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9LE-NEXT: xxmrghd vs0, vs3, vs1 -; P9LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P9LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 ; P9LE-NEXT: xvcvdpuxws v2, vs0 ; P9LE-NEXT: xxmrghd vs0, vs4, vs2 ; P9LE-NEXT: xvcvdpuxws v3, vs0 @@ -3320,10 +3264,6 @@ define <4 x i32> @fromRegsConvdtoui(double %a, double %b, double %c, double %d) ; ; P8BE-LABEL: fromRegsConvdtoui: ; P8BE: # %bb.0: # %entry -; P8BE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P8BE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P8BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8BE-NEXT: xxmrghd vs0, vs2, vs4 ; P8BE-NEXT: xxmrghd vs1, vs1, vs3 ; P8BE-NEXT: xvcvdpuxws v2, vs0 @@ -3333,10 +3273,6 @@ define <4 x i32> @fromRegsConvdtoui(double %a, double %b, double %c, double %d) ; ; P8LE-LABEL: fromRegsConvdtoui: ; P8LE: # %bb.0: # %entry -; P8LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; P8LE-NEXT: # kill: def $f3 killed $f3 def $vsl3 -; P8LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8LE-NEXT: xxmrghd vs0, vs3, vs1 ; P8LE-NEXT: xxmrghd vs1, vs4, vs2 ; P8LE-NEXT: xvcvdpuxws v2, vs0 @@ -4269,32 +4205,24 @@ entry: define <2 x i64> @fromRegsConvftoll(float %a, float %b) { ; P9BE-LABEL: fromRegsConvftoll: ; P9BE: # %bb.0: # %entry -; P9BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P9BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9BE-NEXT: xxmrghd vs0, vs1, vs2 ; P9BE-NEXT: xvcvdpsxds v2, vs0 ; P9BE-NEXT: blr ; ; P9LE-LABEL: fromRegsConvftoll: ; P9LE: # %bb.0: # %entry -; P9LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P9LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9LE-NEXT: xxmrghd vs0, vs2, vs1 ; P9LE-NEXT: xvcvdpsxds v2, vs0 ; P9LE-NEXT: blr ; ; P8BE-LABEL: fromRegsConvftoll: ; P8BE: # %bb.0: # %entry -; P8BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8BE-NEXT: xxmrghd vs0, vs1, vs2 ; P8BE-NEXT: xvcvdpsxds v2, vs0 ; P8BE-NEXT: blr ; ; P8LE-LABEL: fromRegsConvftoll: ; P8LE: # %bb.0: # %entry -; P8LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8LE-NEXT: xxmrghd vs0, vs2, vs1 ; P8LE-NEXT: xvcvdpsxds v2, vs0 ; P8LE-NEXT: blr @@ -4630,32 +4558,24 @@ entry: define <2 x i64> @fromRegsConvdtoll(double %a, double %b) { ; P9BE-LABEL: fromRegsConvdtoll: ; P9BE: # %bb.0: # %entry -; P9BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P9BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9BE-NEXT: xxmrghd vs0, vs1, vs2 ; P9BE-NEXT: xvcvdpsxds v2, vs0 ; P9BE-NEXT: blr ; ; P9LE-LABEL: fromRegsConvdtoll: ; P9LE: # %bb.0: # %entry -; P9LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P9LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9LE-NEXT: xxmrghd vs0, vs2, vs1 ; P9LE-NEXT: xvcvdpsxds v2, vs0 ; P9LE-NEXT: blr ; ; P8BE-LABEL: fromRegsConvdtoll: ; P8BE: # %bb.0: # %entry -; P8BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8BE-NEXT: xxmrghd vs0, vs1, vs2 ; P8BE-NEXT: xvcvdpsxds v2, vs0 ; P8BE-NEXT: blr ; ; P8LE-LABEL: fromRegsConvdtoll: ; P8LE: # %bb.0: # %entry -; P8LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8LE-NEXT: xxmrghd vs0, vs2, vs1 ; P8LE-NEXT: xvcvdpsxds v2, vs0 ; P8LE-NEXT: blr @@ -5451,32 +5371,24 @@ entry: define <2 x i64> @fromRegsConvftoull(float %a, float %b) { ; P9BE-LABEL: fromRegsConvftoull: ; P9BE: # %bb.0: # %entry -; P9BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P9BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9BE-NEXT: xxmrghd vs0, vs1, vs2 ; P9BE-NEXT: xvcvdpuxds v2, vs0 ; P9BE-NEXT: blr ; ; P9LE-LABEL: fromRegsConvftoull: ; P9LE: # %bb.0: # %entry -; P9LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P9LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9LE-NEXT: xxmrghd vs0, vs2, vs1 ; P9LE-NEXT: xvcvdpuxds v2, vs0 ; P9LE-NEXT: blr ; ; P8BE-LABEL: fromRegsConvftoull: ; P8BE: # %bb.0: # %entry -; P8BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8BE-NEXT: xxmrghd vs0, vs1, vs2 ; P8BE-NEXT: xvcvdpuxds v2, vs0 ; P8BE-NEXT: blr ; ; P8LE-LABEL: fromRegsConvftoull: ; P8LE: # %bb.0: # %entry -; P8LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8LE-NEXT: xxmrghd vs0, vs2, vs1 ; P8LE-NEXT: xvcvdpuxds v2, vs0 ; P8LE-NEXT: blr @@ -5812,32 +5724,24 @@ entry: define <2 x i64> @fromRegsConvdtoull(double %a, double %b) { ; P9BE-LABEL: fromRegsConvdtoull: ; P9BE: # %bb.0: # %entry -; P9BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P9BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9BE-NEXT: xxmrghd vs0, vs1, vs2 ; P9BE-NEXT: xvcvdpuxds v2, vs0 ; P9BE-NEXT: blr ; ; P9LE-LABEL: fromRegsConvdtoull: ; P9LE: # %bb.0: # %entry -; P9LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P9LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9LE-NEXT: xxmrghd vs0, vs2, vs1 ; P9LE-NEXT: xvcvdpuxds v2, vs0 ; P9LE-NEXT: blr ; ; P8BE-LABEL: fromRegsConvdtoull: ; P8BE: # %bb.0: # %entry -; P8BE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8BE-NEXT: xxmrghd vs0, vs1, vs2 ; P8BE-NEXT: xvcvdpuxds v2, vs0 ; P8BE-NEXT: blr ; ; P8LE-LABEL: fromRegsConvdtoull: ; P8LE: # %bb.0: # %entry -; P8LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; P8LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8LE-NEXT: xxmrghd vs0, vs2, vs1 ; P8LE-NEXT: xvcvdpuxds v2, vs0 ; P8LE-NEXT: blr diff --git a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond-64bit-only.ll b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond-64bit-only.ll index ddfdcda7a61a7..d765f0845641c 100644 --- a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond-64bit-only.ll +++ b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond-64bit-only.ll @@ -26,7 +26,7 @@ define dso_local i64 @test_stdcx(ptr %a, i64 %b) { ; CHECK-NEXT: stdcx. 4, 0, 3 ; CHECK-NEXT: mfocrf 3, 128 ; CHECK-NEXT: srwi 3, 3, 28 -; CHECK-NEXT: extsw 3, 3 +; CHECK-NEXT: rlwinm 3, 3, 31, 31, 31 ; CHECK-NEXT: blr entry: %0 = tail call i32 @llvm.ppc.stdcx(ptr %a, i64 %b) diff --git a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond.ll b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond.ll index 8d90c5cb88206..778fd0a37a1ed 100644 --- a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond.ll +++ b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-LoadReserve-StoreCond.ll @@ -36,7 +36,7 @@ define dso_local signext i32 @test_stwcx(ptr %a, i32 signext %b) { ; CHECK-64-NEXT: stwcx. 4, 0, 3 ; CHECK-64-NEXT: mfocrf 3, 128 ; CHECK-64-NEXT: srwi 3, 3, 28 -; CHECK-64-NEXT: extsw 3, 3 +; CHECK-64-NEXT: rlwinm 3, 3, 31, 31, 31 ; CHECK-64-NEXT: blr ; ; CHECK-32-LABEL: test_stwcx: @@ -44,6 +44,7 @@ define dso_local signext i32 @test_stwcx(ptr %a, i32 signext %b) { ; CHECK-32-NEXT: stwcx. 4, 0, 3 ; CHECK-32-NEXT: mfocrf 3, 128 ; CHECK-32-NEXT: srwi 3, 3, 28 +; CHECK-32-NEXT: rlwinm 3, 3, 31, 31, 31 ; CHECK-32-NEXT: blr entry: %0 = tail call i32 @llvm.ppc.stwcx(ptr %a, i32 %b) @@ -57,7 +58,7 @@ define dso_local signext i32 @test_sthcx(ptr %a, i16 signext %val) { ; CHECK-64-NEXT: sthcx. 4, 0, 3 ; CHECK-64-NEXT: mfocrf 3, 128 ; CHECK-64-NEXT: srwi 3, 3, 28 -; CHECK-64-NEXT: extsw 3, 3 +; CHECK-64-NEXT: rlwinm 3, 3, 31, 31, 31 ; CHECK-64-NEXT: blr ; ; CHECK-32-LABEL: test_sthcx: @@ -65,6 +66,7 @@ define dso_local signext i32 @test_sthcx(ptr %a, i16 signext %val) { ; CHECK-32-NEXT: sthcx. 4, 0, 3 ; CHECK-32-NEXT: mfocrf 3, 128 ; CHECK-32-NEXT: srwi 3, 3, 28 +; CHECK-32-NEXT: rlwinm 3, 3, 31, 31, 31 ; CHECK-32-NEXT: blr entry: %0 = sext i16 %val to i32 @@ -79,7 +81,7 @@ define signext i32 @test_stbcx(ptr %addr, i8 signext %val) { ; CHECK-64-NEXT: stbcx. 4, 0, 3 ; CHECK-64-NEXT: mfocrf 3, 128 ; CHECK-64-NEXT: srwi 3, 3, 28 -; CHECK-64-NEXT: extsw 3, 3 +; CHECK-64-NEXT: rlwinm 3, 3, 31, 31, 31 ; CHECK-64-NEXT: blr ; ; CHECK-32-LABEL: test_stbcx: @@ -87,6 +89,7 @@ define signext i32 @test_stbcx(ptr %addr, i8 signext %val) { ; CHECK-32-NEXT: stbcx. 4, 0, 3 ; CHECK-32-NEXT: mfocrf 3, 128 ; CHECK-32-NEXT: srwi 3, 3, 28 +; CHECK-32-NEXT: rlwinm 3, 3, 31, 31, 31 ; CHECK-32-NEXT: blr entry: %conv = sext i8 %val to i32 diff --git a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-pwr9-64bit.ll b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-pwr9-64bit.ll index 7aa8b0e7e8327..798c23cd6b961 100644 --- a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-pwr9-64bit.ll +++ b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-pwr9-64bit.ll @@ -22,7 +22,6 @@ define dso_local double @insert_exp(double %d, i64 %ull) { ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: mffprd 3, 1 ; CHECK-NEXT: xsiexpdp 1, 3, 4 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: blr entry: %0 = tail call double @llvm.ppc.insert.exp(double %d, i64 %ull) diff --git a/llvm/test/CodeGen/PowerPC/canonical-merge-shuffles.ll b/llvm/test/CodeGen/PowerPC/canonical-merge-shuffles.ll index f2bd4c7f40a46..c26f98c5b0495 100644 --- a/llvm/test/CodeGen/PowerPC/canonical-merge-shuffles.ll +++ b/llvm/test/CodeGen/PowerPC/canonical-merge-shuffles.ll @@ -565,7 +565,6 @@ define dso_local void @no_crash_elt0_from_RHS(ptr noalias nocapture dereferencea ; CHECK-P8-NEXT: bl dummy ; CHECK-P8-NEXT: nop ; CHECK-P8-NEXT: xxlxor f0, f0, f0 -; CHECK-P8-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-P8-NEXT: xxmrghd vs0, vs1, vs0 ; CHECK-P8-NEXT: xxswapd vs0, vs0 ; CHECK-P8-NEXT: stxvd2x vs0, 0, r30 @@ -580,7 +579,6 @@ define dso_local void @no_crash_elt0_from_RHS(ptr noalias nocapture dereferencea ; CHECK-P9-NEXT: bl dummy ; CHECK-P9-NEXT: nop ; CHECK-P9-NEXT: xxlxor f0, f0, f0 -; CHECK-P9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-P9-NEXT: xxmrghd vs0, vs1, vs0 ; CHECK-P9-NEXT: stxv vs0, 0(r30) ; @@ -594,7 +592,6 @@ define dso_local void @no_crash_elt0_from_RHS(ptr noalias nocapture dereferencea ; CHECK-P9-BE-NEXT: bl dummy ; CHECK-P9-BE-NEXT: nop ; CHECK-P9-BE-NEXT: xxlxor f0, f0, f0 -; CHECK-P9-BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-P9-BE-NEXT: xxmrghd vs0, vs0, vs1 ; CHECK-P9-BE-NEXT: stxv vs0, 0(r30) ; @@ -621,7 +618,6 @@ define dso_local void @no_crash_elt0_from_RHS(ptr noalias nocapture dereferencea ; CHECK-P7-NEXT: bl dummy ; CHECK-P7-NEXT: nop ; CHECK-P7-NEXT: xxlxor f0, f0, f0 -; CHECK-P7-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-P7-NEXT: xxmrghd vs0, vs1, vs0 ; CHECK-P7-NEXT: xxswapd vs0, vs0 ; CHECK-P7-NEXT: stxvd2x vs0, 0, r30 @@ -636,7 +632,6 @@ define dso_local void @no_crash_elt0_from_RHS(ptr noalias nocapture dereferencea ; P8-AIX-64-NEXT: bl .dummy[PR] ; P8-AIX-64-NEXT: nop ; P8-AIX-64-NEXT: xxlxor f0, f0, f0 -; P8-AIX-64-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8-AIX-64-NEXT: xxmrghd vs0, vs0, vs1 ; P8-AIX-64-NEXT: stxvd2x vs0, 0, r31 ; @@ -650,7 +645,6 @@ define dso_local void @no_crash_elt0_from_RHS(ptr noalias nocapture dereferencea ; P8-AIX-32-NEXT: bl .dummy[PR] ; P8-AIX-32-NEXT: nop ; P8-AIX-32-NEXT: xxlxor f0, f0, f0 -; P8-AIX-32-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8-AIX-32-NEXT: xxmrghd vs0, vs0, vs1 ; P8-AIX-32-NEXT: stxvd2x vs0, 0, r31 test_entry: diff --git a/llvm/test/CodeGen/PowerPC/check-cpu.ll b/llvm/test/CodeGen/PowerPC/check-cpu.ll index e1a201427a410..1dc532cb428f4 100644 --- a/llvm/test/CodeGen/PowerPC/check-cpu.ll +++ b/llvm/test/CodeGen/PowerPC/check-cpu.ll @@ -3,6 +3,10 @@ ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \ ; RUN: -mcpu=future < %s 2>&1 | FileCheck %s ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \ +; RUN: -mcpu=pwr11 < %s 2>&1 | FileCheck %s +; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \ +; RUN: -mcpu=pwr11 < %s 2>&1 | FileCheck %s +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \ ; RUN: -mcpu=pwr10 < %s 2>&1 | FileCheck %s ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \ ; RUN: -mcpu=pwr10 < %s 2>&1 | FileCheck %s @@ -13,7 +17,7 @@ -; Test -mcpu=[pwr9|pwr10|future] is recognized on PowerPC. +; Test -mcpu=[pwr9|pwr10|pwr11|future] is recognized on PowerPC. ; CHECK-NOT: is not a recognized processor for this target ; CHECK: .text diff --git a/llvm/test/CodeGen/PowerPC/combine-fneg.ll b/llvm/test/CodeGen/PowerPC/combine-fneg.ll index a72abf7007e8d..04af0947c7a33 100644 --- a/llvm/test/CodeGen/PowerPC/combine-fneg.ll +++ b/llvm/test/CodeGen/PowerPC/combine-fneg.ll @@ -6,7 +6,6 @@ define <4 x double> @fneg_fdiv_splat(double %a0, <4 x double> %a1) { ; CHECK-LABEL: fneg_fdiv_splat: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: addis 3, 2, .LCPI0_0@toc@ha -; CHECK-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-NEXT: xxspltd 0, 1, 0 ; CHECK-NEXT: addi 3, 3, .LCPI0_0@toc@l ; CHECK-NEXT: xvredp 1, 0 diff --git a/llvm/test/CodeGen/PowerPC/common-chain.ll b/llvm/test/CodeGen/PowerPC/common-chain.ll index ccf0e4520f468..5f8c21e30f8fd 100644 --- a/llvm/test/CodeGen/PowerPC/common-chain.ll +++ b/llvm/test/CodeGen/PowerPC/common-chain.ll @@ -642,8 +642,8 @@ define i64 @two_chain_two_bases_succ(ptr %p, i64 %offset, i64 %base1, i64 %base2 ; CHECK-NEXT: cmpdi r7, 0 ; CHECK-NEXT: ble cr0, .LBB6_4 ; CHECK-NEXT: # %bb.1: # %for.body.preheader -; CHECK-NEXT: add r5, r5, r4 ; CHECK-NEXT: add r6, r6, r4 +; CHECK-NEXT: add r5, r5, r4 ; CHECK-NEXT: mtctr r7 ; CHECK-NEXT: sldi r4, r4, 1 ; CHECK-NEXT: add r5, r3, r5 @@ -743,219 +743,214 @@ define signext i32 @spill_reduce_succ(ptr %input1, ptr %input2, ptr %output, i64 ; CHECK-NEXT: std r9, -184(r1) # 8-byte Folded Spill ; CHECK-NEXT: std r8, -176(r1) # 8-byte Folded Spill ; CHECK-NEXT: std r7, -168(r1) # 8-byte Folded Spill -; CHECK-NEXT: std r4, -160(r1) # 8-byte Folded Spill +; CHECK-NEXT: std r3, -160(r1) # 8-byte Folded Spill ; CHECK-NEXT: ble cr0, .LBB7_7 ; CHECK-NEXT: # %bb.1: # %for.body.preheader -; CHECK-NEXT: sldi r4, r6, 2 -; CHECK-NEXT: li r6, 1 -; CHECK-NEXT: mr r0, r10 -; CHECK-NEXT: std r10, -192(r1) # 8-byte Folded Spill -; CHECK-NEXT: cmpdi r4, 1 -; CHECK-NEXT: iselgt r4, r4, r6 -; CHECK-NEXT: addi r7, r4, -1 -; CHECK-NEXT: clrldi r6, r4, 63 -; CHECK-NEXT: cmpldi r7, 3 +; CHECK-NEXT: sldi r6, r6, 2 +; CHECK-NEXT: li r7, 1 +; CHECK-NEXT: mr r30, r10 +; CHECK-NEXT: cmpdi r6, 1 +; CHECK-NEXT: iselgt r7, r6, r7 +; CHECK-NEXT: addi r8, r7, -1 +; CHECK-NEXT: clrldi r6, r7, 63 +; CHECK-NEXT: cmpldi r8, 3 ; CHECK-NEXT: blt cr0, .LBB7_4 ; CHECK-NEXT: # %bb.2: # %for.body.preheader.new -; CHECK-NEXT: ld r0, -192(r1) # 8-byte Folded Reload -; CHECK-NEXT: ld r30, -184(r1) # 8-byte Folded Reload -; CHECK-NEXT: ld r8, -176(r1) # 8-byte Folded Reload -; CHECK-NEXT: rldicl r7, r4, 62, 2 -; CHECK-NEXT: ld r9, -168(r1) # 8-byte Folded Reload -; CHECK-NEXT: add r11, r0, r30 -; CHECK-NEXT: add r4, r0, r0 -; CHECK-NEXT: mulli r23, r0, 24 -; CHECK-NEXT: add r14, r0, r8 -; CHECK-NEXT: sldi r12, r0, 5 -; CHECK-NEXT: add r31, r0, r9 -; CHECK-NEXT: sldi r9, r9, 3 -; CHECK-NEXT: sldi r18, r0, 4 -; CHECK-NEXT: sldi r8, r8, 3 -; CHECK-NEXT: add r10, r4, r4 -; CHECK-NEXT: sldi r4, r30, 3 -; CHECK-NEXT: sldi r11, r11, 3 -; CHECK-NEXT: add r26, r12, r9 -; CHECK-NEXT: add r16, r18, r9 -; CHECK-NEXT: add r29, r12, r8 -; CHECK-NEXT: add r19, r18, r8 -; CHECK-NEXT: add r30, r12, r4 -; CHECK-NEXT: mr r20, r4 -; CHECK-NEXT: std r4, -200(r1) # 8-byte Folded Spill -; CHECK-NEXT: ld r4, -160(r1) # 8-byte Folded Reload -; CHECK-NEXT: add r15, r5, r11 -; CHECK-NEXT: sldi r11, r14, 3 -; CHECK-NEXT: add r29, r5, r29 -; CHECK-NEXT: add r28, r3, r26 -; CHECK-NEXT: add r19, r5, r19 -; CHECK-NEXT: add r21, r23, r9 -; CHECK-NEXT: add r24, r23, r8 -; CHECK-NEXT: add r14, r5, r11 -; CHECK-NEXT: sldi r11, r31, 3 -; CHECK-NEXT: add r25, r23, r20 -; CHECK-NEXT: add r20, r18, r20 -; CHECK-NEXT: add r30, r5, r30 -; CHECK-NEXT: add r18, r3, r16 -; CHECK-NEXT: add r24, r5, r24 -; CHECK-NEXT: add r23, r3, r21 -; CHECK-NEXT: add r27, r4, r26 -; CHECK-NEXT: add r22, r4, r21 -; CHECK-NEXT: add r17, r4, r16 -; CHECK-NEXT: add r2, r4, r11 -; CHECK-NEXT: rldicl r4, r7, 2, 1 -; CHECK-NEXT: sub r7, r8, r9 -; CHECK-NEXT: ld r8, -200(r1) # 8-byte Folded Reload +; CHECK-NEXT: ld r14, -168(r1) # 8-byte Folded Reload +; CHECK-NEXT: mulli r24, r30, 24 +; CHECK-NEXT: ld r16, -184(r1) # 8-byte Folded Reload +; CHECK-NEXT: ld r15, -176(r1) # 8-byte Folded Reload +; CHECK-NEXT: ld r3, -160(r1) # 8-byte Folded Reload +; CHECK-NEXT: rldicl r0, r7, 62, 2 +; CHECK-NEXT: sldi r11, r30, 5 +; CHECK-NEXT: sldi r19, r30, 4 +; CHECK-NEXT: sldi r7, r14, 3 +; CHECK-NEXT: add r14, r30, r14 +; CHECK-NEXT: sldi r10, r16, 3 +; CHECK-NEXT: sldi r12, r15, 3 +; CHECK-NEXT: add r16, r30, r16 +; CHECK-NEXT: add r15, r30, r15 +; CHECK-NEXT: add r27, r11, r7 +; CHECK-NEXT: add r22, r24, r7 +; CHECK-NEXT: add r17, r19, r7 +; CHECK-NEXT: sldi r2, r14, 3 +; CHECK-NEXT: add r26, r24, r10 +; CHECK-NEXT: add r25, r24, r12 +; CHECK-NEXT: add r21, r19, r10 +; CHECK-NEXT: add r20, r19, r12 +; CHECK-NEXT: add r8, r11, r10 +; CHECK-NEXT: sldi r16, r16, 3 +; CHECK-NEXT: add r29, r5, r27 +; CHECK-NEXT: add r28, r4, r27 +; CHECK-NEXT: add r27, r3, r27 +; CHECK-NEXT: add r24, r5, r22 +; CHECK-NEXT: add r23, r4, r22 +; CHECK-NEXT: add r22, r3, r22 +; CHECK-NEXT: add r19, r5, r17 +; CHECK-NEXT: add r18, r4, r17 +; CHECK-NEXT: add r17, r3, r17 +; CHECK-NEXT: add r14, r5, r2 +; CHECK-NEXT: add r31, r4, r2 +; CHECK-NEXT: add r2, r3, r2 +; CHECK-NEXT: add r9, r5, r8 +; CHECK-NEXT: add r8, r11, r12 ; CHECK-NEXT: add r26, r5, r26 ; CHECK-NEXT: add r25, r5, r25 ; CHECK-NEXT: add r21, r5, r21 ; CHECK-NEXT: add r20, r5, r20 ; CHECK-NEXT: add r16, r5, r16 -; CHECK-NEXT: add r31, r5, r11 -; CHECK-NEXT: add r11, r3, r11 -; CHECK-NEXT: addi r4, r4, -4 -; CHECK-NEXT: rldicl r4, r4, 62, 2 -; CHECK-NEXT: sub r8, r8, r9 -; CHECK-NEXT: li r9, 0 -; CHECK-NEXT: addi r4, r4, 1 -; CHECK-NEXT: mtctr r4 +; CHECK-NEXT: add r8, r5, r8 +; CHECK-NEXT: rldicl r3, r0, 2, 1 +; CHECK-NEXT: addi r3, r3, -4 +; CHECK-NEXT: sub r0, r12, r7 +; CHECK-NEXT: sub r12, r10, r7 +; CHECK-NEXT: li r7, 0 +; CHECK-NEXT: mr r10, r30 +; CHECK-NEXT: sldi r15, r15, 3 +; CHECK-NEXT: add r15, r5, r15 +; CHECK-NEXT: rldicl r3, r3, 62, 2 +; CHECK-NEXT: addi r3, r3, 1 +; CHECK-NEXT: mtctr r3 ; CHECK-NEXT: .p2align 4 ; CHECK-NEXT: .LBB7_3: # %for.body ; CHECK-NEXT: # -; CHECK-NEXT: lfd f0, 0(r11) -; CHECK-NEXT: lfd f1, 0(r2) -; CHECK-NEXT: add r0, r0, r10 -; CHECK-NEXT: xsmuldp f0, f0, f1 +; CHECK-NEXT: lfd f0, 0(r2) ; CHECK-NEXT: lfd f1, 0(r31) +; CHECK-NEXT: add r3, r10, r30 +; CHECK-NEXT: add r3, r3, r30 +; CHECK-NEXT: xsmuldp f0, f0, f1 +; CHECK-NEXT: lfd f1, 0(r14) +; CHECK-NEXT: add r3, r3, r30 +; CHECK-NEXT: add r10, r3, r30 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfd f0, 0(r31) -; CHECK-NEXT: add r31, r31, r12 -; CHECK-NEXT: lfdx f0, r11, r7 -; CHECK-NEXT: lfdx f1, r2, r7 +; CHECK-NEXT: stfd f0, 0(r14) +; CHECK-NEXT: add r14, r14, r11 +; CHECK-NEXT: lfdx f0, r2, r0 +; CHECK-NEXT: lfdx f1, r31, r0 ; CHECK-NEXT: xsmuldp f0, f0, f1 -; CHECK-NEXT: lfdx f1, r14, r9 +; CHECK-NEXT: lfdx f1, r15, r7 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfdx f0, r14, r9 -; CHECK-NEXT: lfdx f0, r11, r8 -; CHECK-NEXT: lfdx f1, r2, r8 -; CHECK-NEXT: add r11, r11, r12 -; CHECK-NEXT: add r2, r2, r12 +; CHECK-NEXT: stfdx f0, r15, r7 +; CHECK-NEXT: lfdx f0, r2, r12 +; CHECK-NEXT: lfdx f1, r31, r12 +; CHECK-NEXT: add r2, r2, r11 +; CHECK-NEXT: add r31, r31, r11 ; CHECK-NEXT: xsmuldp f0, f0, f1 -; CHECK-NEXT: lfdx f1, r15, r9 +; CHECK-NEXT: lfdx f1, r16, r7 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfdx f0, r15, r9 -; CHECK-NEXT: lfd f0, 0(r18) -; CHECK-NEXT: lfd f1, 0(r17) +; CHECK-NEXT: stfdx f0, r16, r7 +; CHECK-NEXT: lfd f0, 0(r17) +; CHECK-NEXT: lfd f1, 0(r18) ; CHECK-NEXT: xsmuldp f0, f0, f1 -; CHECK-NEXT: lfdx f1, r16, r9 +; CHECK-NEXT: lfdx f1, r19, r7 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfdx f0, r16, r9 -; CHECK-NEXT: lfdx f0, r18, r7 -; CHECK-NEXT: lfdx f1, r17, r7 +; CHECK-NEXT: stfdx f0, r19, r7 +; CHECK-NEXT: lfdx f0, r17, r0 +; CHECK-NEXT: lfdx f1, r18, r0 ; CHECK-NEXT: xsmuldp f0, f0, f1 -; CHECK-NEXT: lfdx f1, r19, r9 +; CHECK-NEXT: lfdx f1, r20, r7 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfdx f0, r19, r9 -; CHECK-NEXT: lfdx f0, r18, r8 -; CHECK-NEXT: lfdx f1, r17, r8 -; CHECK-NEXT: add r18, r18, r12 -; CHECK-NEXT: add r17, r17, r12 +; CHECK-NEXT: stfdx f0, r20, r7 +; CHECK-NEXT: lfdx f0, r17, r12 +; CHECK-NEXT: lfdx f1, r18, r12 +; CHECK-NEXT: add r17, r17, r11 +; CHECK-NEXT: add r18, r18, r11 ; CHECK-NEXT: xsmuldp f0, f0, f1 -; CHECK-NEXT: lfdx f1, r20, r9 +; CHECK-NEXT: lfdx f1, r21, r7 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfdx f0, r20, r9 -; CHECK-NEXT: lfd f0, 0(r23) -; CHECK-NEXT: lfd f1, 0(r22) +; CHECK-NEXT: stfdx f0, r21, r7 +; CHECK-NEXT: lfd f0, 0(r22) +; CHECK-NEXT: lfd f1, 0(r23) ; CHECK-NEXT: xsmuldp f0, f0, f1 -; CHECK-NEXT: lfdx f1, r21, r9 +; CHECK-NEXT: lfdx f1, r24, r7 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfdx f0, r21, r9 -; CHECK-NEXT: lfdx f0, r23, r7 -; CHECK-NEXT: lfdx f1, r22, r7 +; CHECK-NEXT: stfdx f0, r24, r7 +; CHECK-NEXT: lfdx f0, r22, r0 +; CHECK-NEXT: lfdx f1, r23, r0 ; CHECK-NEXT: xsmuldp f0, f0, f1 -; CHECK-NEXT: lfdx f1, r24, r9 +; CHECK-NEXT: lfdx f1, r25, r7 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfdx f0, r24, r9 -; CHECK-NEXT: lfdx f0, r23, r8 -; CHECK-NEXT: lfdx f1, r22, r8 -; CHECK-NEXT: add r23, r23, r12 -; CHECK-NEXT: add r22, r22, r12 +; CHECK-NEXT: stfdx f0, r25, r7 +; CHECK-NEXT: lfdx f0, r22, r12 +; CHECK-NEXT: lfdx f1, r23, r12 +; CHECK-NEXT: add r22, r22, r11 +; CHECK-NEXT: add r23, r23, r11 ; CHECK-NEXT: xsmuldp f0, f0, f1 -; CHECK-NEXT: lfdx f1, r25, r9 +; CHECK-NEXT: lfdx f1, r26, r7 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfdx f0, r25, r9 -; CHECK-NEXT: lfd f0, 0(r28) -; CHECK-NEXT: lfd f1, 0(r27) +; CHECK-NEXT: stfdx f0, r26, r7 +; CHECK-NEXT: lfd f0, 0(r27) +; CHECK-NEXT: lfd f1, 0(r28) ; CHECK-NEXT: xsmuldp f0, f0, f1 -; CHECK-NEXT: lfdx f1, r26, r9 +; CHECK-NEXT: lfdx f1, r29, r7 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfdx f0, r26, r9 -; CHECK-NEXT: lfdx f0, r28, r7 -; CHECK-NEXT: lfdx f1, r27, r7 +; CHECK-NEXT: stfdx f0, r29, r7 +; CHECK-NEXT: lfdx f0, r27, r0 +; CHECK-NEXT: lfdx f1, r28, r0 ; CHECK-NEXT: xsmuldp f0, f0, f1 -; CHECK-NEXT: lfdx f1, r29, r9 +; CHECK-NEXT: lfdx f1, r8, r7 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfdx f0, r29, r9 -; CHECK-NEXT: lfdx f0, r28, r8 -; CHECK-NEXT: lfdx f1, r27, r8 -; CHECK-NEXT: add r28, r28, r12 -; CHECK-NEXT: add r27, r27, r12 +; CHECK-NEXT: stfdx f0, r8, r7 +; CHECK-NEXT: lfdx f0, r27, r12 +; CHECK-NEXT: lfdx f1, r28, r12 +; CHECK-NEXT: add r27, r27, r11 +; CHECK-NEXT: add r28, r28, r11 ; CHECK-NEXT: xsmuldp f0, f0, f1 -; CHECK-NEXT: lfdx f1, r30, r9 +; CHECK-NEXT: lfdx f1, r9, r7 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfdx f0, r30, r9 -; CHECK-NEXT: add r9, r9, r12 +; CHECK-NEXT: stfdx f0, r9, r7 +; CHECK-NEXT: add r7, r7, r11 ; CHECK-NEXT: bdnz .LBB7_3 ; CHECK-NEXT: .LBB7_4: # %for.cond.cleanup.loopexit.unr-lcssa -; CHECK-NEXT: ld r7, -192(r1) # 8-byte Folded Reload ; CHECK-NEXT: cmpldi r6, 0 ; CHECK-NEXT: beq cr0, .LBB7_7 ; CHECK-NEXT: # %bb.5: # %for.body.epil.preheader -; CHECK-NEXT: ld r4, -184(r1) # 8-byte Folded Reload -; CHECK-NEXT: ld r29, -160(r1) # 8-byte Folded Reload -; CHECK-NEXT: mr r30, r3 -; CHECK-NEXT: sldi r7, r7, 3 -; CHECK-NEXT: add r4, r0, r4 -; CHECK-NEXT: sldi r4, r4, 3 -; CHECK-NEXT: add r3, r5, r4 -; CHECK-NEXT: add r8, r29, r4 -; CHECK-NEXT: add r9, r30, r4 -; CHECK-NEXT: ld r4, -176(r1) # 8-byte Folded Reload -; CHECK-NEXT: add r4, r0, r4 -; CHECK-NEXT: sldi r4, r4, 3 -; CHECK-NEXT: add r10, r5, r4 -; CHECK-NEXT: add r11, r29, r4 -; CHECK-NEXT: add r12, r30, r4 -; CHECK-NEXT: ld r4, -168(r1) # 8-byte Folded Reload -; CHECK-NEXT: add r4, r0, r4 -; CHECK-NEXT: sldi r0, r4, 3 -; CHECK-NEXT: add r5, r5, r0 -; CHECK-NEXT: add r4, r29, r0 -; CHECK-NEXT: add r30, r30, r0 -; CHECK-NEXT: li r0, 0 +; CHECK-NEXT: ld r3, -184(r1) # 8-byte Folded Reload +; CHECK-NEXT: ld r0, -160(r1) # 8-byte Folded Reload +; CHECK-NEXT: sldi r8, r30, 3 +; CHECK-NEXT: add r3, r10, r3 +; CHECK-NEXT: sldi r3, r3, 3 +; CHECK-NEXT: add r7, r5, r3 +; CHECK-NEXT: add r9, r4, r3 +; CHECK-NEXT: add r11, r0, r3 +; CHECK-NEXT: ld r3, -176(r1) # 8-byte Folded Reload +; CHECK-NEXT: add r3, r10, r3 +; CHECK-NEXT: sldi r3, r3, 3 +; CHECK-NEXT: add r12, r5, r3 +; CHECK-NEXT: add r30, r4, r3 +; CHECK-NEXT: add r29, r0, r3 +; CHECK-NEXT: ld r3, -168(r1) # 8-byte Folded Reload +; CHECK-NEXT: add r3, r10, r3 +; CHECK-NEXT: li r10, 0 +; CHECK-NEXT: sldi r3, r3, 3 +; CHECK-NEXT: add r5, r5, r3 +; CHECK-NEXT: add r4, r4, r3 +; CHECK-NEXT: add r3, r0, r3 ; CHECK-NEXT: .p2align 4 ; CHECK-NEXT: .LBB7_6: # %for.body.epil ; CHECK-NEXT: # -; CHECK-NEXT: lfdx f0, r30, r0 -; CHECK-NEXT: lfdx f1, r4, r0 +; CHECK-NEXT: lfdx f0, r3, r10 +; CHECK-NEXT: lfdx f1, r4, r10 ; CHECK-NEXT: addi r6, r6, -1 ; CHECK-NEXT: cmpldi r6, 0 ; CHECK-NEXT: xsmuldp f0, f0, f1 ; CHECK-NEXT: lfd f1, 0(r5) ; CHECK-NEXT: xsadddp f0, f1, f0 ; CHECK-NEXT: stfd f0, 0(r5) -; CHECK-NEXT: add r5, r5, r7 -; CHECK-NEXT: lfdx f0, r12, r0 -; CHECK-NEXT: lfdx f1, r11, r0 +; CHECK-NEXT: add r5, r5, r8 +; CHECK-NEXT: lfdx f0, r29, r10 +; CHECK-NEXT: lfdx f1, r30, r10 ; CHECK-NEXT: xsmuldp f0, f0, f1 -; CHECK-NEXT: lfdx f1, r10, r0 +; CHECK-NEXT: lfdx f1, r12, r10 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfdx f0, r10, r0 -; CHECK-NEXT: lfdx f0, r9, r0 -; CHECK-NEXT: lfdx f1, r8, r0 +; CHECK-NEXT: stfdx f0, r12, r10 +; CHECK-NEXT: lfdx f0, r11, r10 +; CHECK-NEXT: lfdx f1, r9, r10 ; CHECK-NEXT: xsmuldp f0, f0, f1 -; CHECK-NEXT: lfdx f1, r3, r0 +; CHECK-NEXT: lfdx f1, r7, r10 ; CHECK-NEXT: xsadddp f0, f1, f0 -; CHECK-NEXT: stfdx f0, r3, r0 -; CHECK-NEXT: add r0, r0, r7 +; CHECK-NEXT: stfdx f0, r7, r10 +; CHECK-NEXT: add r10, r10, r8 ; CHECK-NEXT: bne cr0, .LBB7_6 ; CHECK-NEXT: .LBB7_7: # %for.cond.cleanup ; CHECK-NEXT: ld r2, -152(r1) # 8-byte Folded Reload diff --git a/llvm/test/CodeGen/PowerPC/constant-pool.ll b/llvm/test/CodeGen/PowerPC/constant-pool.ll index a9feb93627b06..2ded7215d8fd6 100644 --- a/llvm/test/CodeGen/PowerPC/constant-pool.ll +++ b/llvm/test/CodeGen/PowerPC/constant-pool.ll @@ -11,7 +11,6 @@ ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: xxsplti32dx vs1, 0, 940572664 ; CHECK-NEXT: xxsplti32dx vs1, 1, 1073741824 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: blr ; ; CHECK-P9-LABEL: FloatConstantPool: @@ -28,7 +27,6 @@ entry: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: xxsplti32dx vs1, 0, 1048574 ; CHECK-NEXT: xxsplti32dx vs1, 1, 780229072 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: blr ; ; CHECK-P9-LABEL: DoubleConstantPool: @@ -47,8 +45,6 @@ entry: ; CHECK-NEXT: xxsplti32dx vs2, 0, -2146625897 ; CHECK-NEXT: xxsplti32dx vs1, 1, -609716532 ; CHECK-NEXT: xxsplti32dx vs2, 1, 1339675259 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; CHECK-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; CHECK-NEXT: blr ; ; CHECK-P9-LABEL: LongDoubleConstantPool: @@ -224,13 +220,11 @@ define double @two_constants_two_bb(i32 %m, double %a) { ; CHECK-NEXT: # %bb.1: ; CHECK-NEXT: xxsplti32dx vs1, 0, 1074935889 ; CHECK-NEXT: xxsplti32dx vs1, 1, -343597384 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: blr ; CHECK-NEXT: .LBB12_2: # %if.end ; CHECK-NEXT: xxsplti32dx vs0, 0, 1076085391 ; CHECK-NEXT: xxsplti32dx vs0, 1, 1546188227 ; CHECK-NEXT: xsadddp f1, f1, f0 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: blr ; ; CHECK-P9-LABEL: two_constants_two_bb: @@ -369,12 +363,10 @@ define ppc_fp128 @three_constants_ppcf128(ppc_fp128 %a, ppc_fp128 %c) { ; CHECK-NEXT: stxv vs63, 32(r1) # 16-byte Folded Spill ; CHECK-NEXT: xxsplti32dx vs63, 0, 1074935889 ; CHECK-NEXT: xxsplti32dx vs3, 1, -343597384 -; CHECK-NEXT: # kill: def $f3 killed $f3 killed $vsl3 ; CHECK-NEXT: bl __gcc_qadd@notoc ; CHECK-NEXT: xxsplti32dx vs3, 0, 1074935889 ; CHECK-NEXT: xxlxor f4, f4, f4 ; CHECK-NEXT: xxsplti32dx vs3, 1, -1719329096 -; CHECK-NEXT: # kill: def $f3 killed $f3 killed $vsl3 ; CHECK-NEXT: bl __gcc_qadd@notoc ; CHECK-NEXT: xxsplti32dx vs63, 1, 8724152 ; CHECK-NEXT: xxlxor f4, f4, f4 diff --git a/llvm/test/CodeGen/PowerPC/elf64-byval-cc.ll b/llvm/test/CodeGen/PowerPC/elf64-byval-cc.ll index fc0bfef11d7a6..9d537d89c009d 100644 --- a/llvm/test/CodeGen/PowerPC/elf64-byval-cc.ll +++ b/llvm/test/CodeGen/PowerPC/elf64-byval-cc.ll @@ -403,11 +403,10 @@ define void @call_test_byval_mem32_2() #0 { ; CHECK-NEXT: std 0, 48(1) ; CHECK-NEXT: .cfi_def_cfa_offset 32 ; CHECK-NEXT: .cfi_offset lr, 16 -; CHECK-NEXT: addis 3, 2, .LC5@toc@ha ; CHECK-NEXT: vspltisw 2, 1 +; CHECK-NEXT: addis 3, 2, .LC5@toc@ha ; CHECK-NEXT: ld 3, .LC5@toc@l(3) ; CHECK-NEXT: xvcvsxwdp 1, 34 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: ld 7, 24(3) ; CHECK-NEXT: ld 6, 16(3) ; CHECK-NEXT: ld 5, 8(3) @@ -453,9 +452,7 @@ define void @call_test_byval_mem32_3() #0 { ; CHECK-NEXT: li 7, 2 ; CHECK-NEXT: ld 3, .LC5@toc@l(3) ; CHECK-NEXT: xvcvsxwdp 1, 34 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: xvcvsxwdp 2, 35 -; CHECK-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; CHECK-NEXT: lxvd2x 0, 3, 4 ; CHECK-NEXT: li 4, 88 ; CHECK-NEXT: stxvd2x 0, 1, 4 diff --git a/llvm/test/CodeGen/PowerPC/f128-aggregates.ll b/llvm/test/CodeGen/PowerPC/f128-aggregates.ll index b3d2457d31eeb..4be855e30ea1d 100644 --- a/llvm/test/CodeGen/PowerPC/f128-aggregates.ll +++ b/llvm/test/CodeGen/PowerPC/f128-aggregates.ll @@ -283,7 +283,7 @@ define fp128 @testMixedAggregate([3 x i128] %a.coerce) { ; ; CHECK-BE-LABEL: testMixedAggregate: ; CHECK-BE: # %bb.0: # %entry -; CHECK-BE-NEXT: mtvsrdd v2, r8, r7 +; CHECK-BE-NEXT: mtvsrdd v2, r7, r8 ; CHECK-BE-NEXT: blr ; ; CHECK-P8-LABEL: testMixedAggregate: @@ -310,7 +310,7 @@ define fp128 @testMixedAggregate_02([4 x i128] %a.coerce) { ; ; CHECK-BE-LABEL: testMixedAggregate_02: ; CHECK-BE: # %bb.0: # %entry -; CHECK-BE-NEXT: mtvsrdd v2, r6, r5 +; CHECK-BE-NEXT: mtvsrdd v2, r5, r6 ; CHECK-BE-NEXT: blr ; ; CHECK-P8-LABEL: testMixedAggregate_02: @@ -344,7 +344,7 @@ define fp128 @testMixedAggregate_03([4 x i128] %sa.coerce) { ; CHECK-BE-LABEL: testMixedAggregate_03: ; CHECK-BE: # %bb.0: # %entry ; CHECK-BE-NEXT: mtvsrwa v2, r4 -; CHECK-BE-NEXT: mtvsrdd v3, r6, r5 +; CHECK-BE-NEXT: mtvsrdd v3, r5, r6 ; CHECK-BE-NEXT: xscvsdqp v2, v2 ; CHECK-BE-NEXT: xsaddqp v2, v3, v2 ; CHECK-BE-NEXT: mtvsrd v3, r9 @@ -467,7 +467,7 @@ define fp128 @testUnion_01([1 x i128] %a.coerce) { ; ; CHECK-BE-LABEL: testUnion_01: ; CHECK-BE: # %bb.0: # %entry -; CHECK-BE-NEXT: mtvsrdd v2, r4, r3 +; CHECK-BE-NEXT: mtvsrdd v2, r3, r4 ; CHECK-BE-NEXT: blr ; ; CHECK-P8-LABEL: testUnion_01: @@ -494,7 +494,7 @@ define fp128 @testUnion_02([1 x i128] %a.coerce) { ; ; CHECK-BE-LABEL: testUnion_02: ; CHECK-BE: # %bb.0: # %entry -; CHECK-BE-NEXT: mtvsrdd v2, r4, r3 +; CHECK-BE-NEXT: mtvsrdd v2, r3, r4 ; CHECK-BE-NEXT: blr ; ; CHECK-P8-LABEL: testUnion_02: @@ -521,7 +521,7 @@ define fp128 @testUnion_03([4 x i128] %a.coerce) { ; ; CHECK-BE-LABEL: testUnion_03: ; CHECK-BE: # %bb.0: # %entry -; CHECK-BE-NEXT: mtvsrdd v2, r8, r7 +; CHECK-BE-NEXT: mtvsrdd v2, r7, r8 ; CHECK-BE-NEXT: blr ; ; CHECK-P8-LABEL: testUnion_03: diff --git a/llvm/test/CodeGen/PowerPC/f128-bitcast.ll b/llvm/test/CodeGen/PowerPC/f128-bitcast.ll index ffbfbd0c64ff3..55ba3cb1e0538 100644 --- a/llvm/test/CodeGen/PowerPC/f128-bitcast.ll +++ b/llvm/test/CodeGen/PowerPC/f128-bitcast.ll @@ -86,3 +86,25 @@ entry: ret i64 %1 } +define <4 x i32> @truncBitcast(i512 %a) { +; CHECK-LABEL: truncBitcast: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: mtvsrdd v2, r4, r3 +; CHECK-NEXT: blr +; +; CHECK-BE-LABEL: truncBitcast: +; CHECK-BE: # %bb.0: # %entry +; CHECK-BE-NEXT: mtvsrdd v2, r9, r10 +; CHECK-BE-NEXT: blr +; +; CHECK-P8-LABEL: truncBitcast: +; CHECK-P8: # %bb.0: # %entry +; CHECK-P8-NEXT: mtfprd f0, r3 +; CHECK-P8-NEXT: mtfprd f1, r4 +; CHECK-P8-NEXT: xxmrghd v2, vs1, vs0 +; CHECK-P8-NEXT: blr +entry: + %0 = trunc i512 %a to i128 + %1 = bitcast i128 %0 to <4 x i32> + ret <4 x i32> %1 +} diff --git a/llvm/test/CodeGen/PowerPC/fma-combine.ll b/llvm/test/CodeGen/PowerPC/fma-combine.ll index b39c9327bc8ab..3d45e9a3a509c 100644 --- a/llvm/test/CodeGen/PowerPC/fma-combine.ll +++ b/llvm/test/CodeGen/PowerPC/fma-combine.ll @@ -202,7 +202,6 @@ define dso_local double @getNegatedExpression_crash(double %x, double %y) { ; CHECK-FAST-NEXT: xvcvsxwdp 4, 34 ; CHECK-FAST-NEXT: lfs 3, .LCPI5_0@toc@l(3) ; CHECK-FAST-NEXT: xssubdp 0, 1, 4 -; CHECK-FAST-NEXT: # kill: def $f4 killed $f4 killed $vsl4 ; CHECK-FAST-NEXT: xsmaddadp 4, 1, 3 ; CHECK-FAST-NEXT: xsmaddadp 0, 4, 2 ; CHECK-FAST-NEXT: fmr 1, 0 @@ -226,7 +225,6 @@ define dso_local double @getNegatedExpression_crash(double %x, double %y) { ; CHECK-NEXT: xvcvsxwdp 4, 34 ; CHECK-NEXT: lfs 3, .LCPI5_0@toc@l(3) ; CHECK-NEXT: xssubdp 0, 1, 4 -; CHECK-NEXT: # kill: def $f4 killed $f4 killed $vsl4 ; CHECK-NEXT: xsmaddadp 4, 1, 3 ; CHECK-NEXT: xsmaddadp 0, 4, 2 ; CHECK-NEXT: fmr 1, 0 diff --git a/llvm/test/CodeGen/PowerPC/fp-strict-round.ll b/llvm/test/CodeGen/PowerPC/fp-strict-round.ll index 4c8729b9f43a5..eac4fb6f98bf7 100644 --- a/llvm/test/CodeGen/PowerPC/fp-strict-round.ll +++ b/llvm/test/CodeGen/PowerPC/fp-strict-round.ll @@ -229,7 +229,6 @@ define <4 x float> @nearbyint_v4f32(<4 x float> %vf1, <4 x float> %vf2) strictfp ; P8-NEXT: xscvspdpn f1, vs0 ; P8-NEXT: bl nearbyintf ; P8-NEXT: nop -; P8-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8-NEXT: xxmrghd vs0, vs1, v30 ; P8-NEXT: xscvspdpn f1, v31 ; P8-NEXT: xvcvdpsp v29, vs0 @@ -240,7 +239,6 @@ define <4 x float> @nearbyint_v4f32(<4 x float> %vf1, <4 x float> %vf2) strictfp ; P8-NEXT: xscvspdpn f1, vs0 ; P8-NEXT: bl nearbyintf ; P8-NEXT: nop -; P8-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8-NEXT: xxmrghd vs0, v30, vs1 ; P8-NEXT: li r3, 160 ; P8-NEXT: xvcvdpsp v2, vs0 @@ -278,7 +276,6 @@ define <4 x float> @nearbyint_v4f32(<4 x float> %vf1, <4 x float> %vf2) strictfp ; P9-NEXT: xscvspdpn f1, vs0 ; P9-NEXT: bl nearbyintf ; P9-NEXT: nop -; P9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9-NEXT: xxmrghd vs0, vs1, v30 ; P9-NEXT: xscvspdpn f1, v31 ; P9-NEXT: xvcvdpsp v29, vs0 @@ -289,7 +286,6 @@ define <4 x float> @nearbyint_v4f32(<4 x float> %vf1, <4 x float> %vf2) strictfp ; P9-NEXT: xscvspdpn f1, vs0 ; P9-NEXT: bl nearbyintf ; P9-NEXT: nop -; P9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9-NEXT: xxmrghd vs0, v30, vs1 ; P9-NEXT: lxv v31, 64(r1) # 16-byte Folded Reload ; P9-NEXT: lxv v30, 48(r1) # 16-byte Folded Reload @@ -327,11 +323,9 @@ define <2 x double> @nearbyint_v2f64(<2 x double> %vf1, <2 x double> %vf2) stric ; P8-NEXT: nop ; P8-NEXT: xxlor v30, f1, f1 ; P8-NEXT: xxswapd vs1, v31 -; P8-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; P8-NEXT: bl nearbyint ; P8-NEXT: nop ; P8-NEXT: li r3, 144 -; P8-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8-NEXT: xxmrghd v2, v30, vs1 ; P8-NEXT: lxvd2x v31, r1, r3 # 16-byte Folded Reload ; P8-NEXT: li r3, 128 @@ -358,10 +352,8 @@ define <2 x double> @nearbyint_v2f64(<2 x double> %vf1, <2 x double> %vf2) stric ; P9-NEXT: nop ; P9-NEXT: xscpsgndp v30, f1, f1 ; P9-NEXT: xxswapd vs1, v31 -; P9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; P9-NEXT: bl nearbyint ; P9-NEXT: nop -; P9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P9-NEXT: xxmrghd v2, v30, vs1 ; P9-NEXT: lxv v31, 48(r1) # 16-byte Folded Reload ; P9-NEXT: lxv v30, 32(r1) # 16-byte Folded Reload diff --git a/llvm/test/CodeGen/PowerPC/frem.ll b/llvm/test/CodeGen/PowerPC/frem.ll index 8cb68e60f7f9b..19b4b1c9cdf95 100644 --- a/llvm/test/CodeGen/PowerPC/frem.ll +++ b/llvm/test/CodeGen/PowerPC/frem.ll @@ -70,7 +70,6 @@ define <4 x float> @frem4x32(<4 x float> %a, <4 x float> %b) { ; CHECK-NEXT: xscvspdpn 2, 0 ; CHECK-NEXT: bl fmodf ; CHECK-NEXT: nop -; CHECK-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-NEXT: xxmrghd 0, 1, 61 ; CHECK-NEXT: xscvspdpn 1, 62 ; CHECK-NEXT: xscvspdpn 2, 63 @@ -84,7 +83,6 @@ define <4 x float> @frem4x32(<4 x float> %a, <4 x float> %b) { ; CHECK-NEXT: xscvspdpn 2, 0 ; CHECK-NEXT: bl fmodf ; CHECK-NEXT: nop -; CHECK-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-NEXT: xxmrghd 0, 61, 1 ; CHECK-NEXT: lxv 63, 80(1) # 16-byte Folded Reload ; CHECK-NEXT: lxv 62, 64(1) # 16-byte Folded Reload @@ -124,11 +122,8 @@ define <2 x double> @frem2x64(<2 x double> %a, <2 x double> %b) { ; CHECK-NEXT: xscpsgndp 61, 1, 1 ; CHECK-NEXT: xxswapd 1, 62 ; CHECK-NEXT: xxswapd 2, 63 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; CHECK-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; CHECK-NEXT: bl fmod ; CHECK-NEXT: nop -; CHECK-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-NEXT: xxmrghd 34, 61, 1 ; CHECK-NEXT: lxv 63, 64(1) # 16-byte Folded Reload ; CHECK-NEXT: lxv 62, 48(1) # 16-byte Folded Reload diff --git a/llvm/test/CodeGen/PowerPC/handle-f16-storage-type.ll b/llvm/test/CodeGen/PowerPC/handle-f16-storage-type.ll index 13f70f420400b..4256933300243 100644 --- a/llvm/test/CodeGen/PowerPC/handle-f16-storage-type.ll +++ b/llvm/test/CodeGen/PowerPC/handle-f16-storage-type.ll @@ -666,7 +666,6 @@ define <4 x float> @test_extend32_vec4(ptr %p) #0 { ; P8-NEXT: bl __gnu_h2f_ieee ; P8-NEXT: nop ; P8-NEXT: li r3, 80 -; P8-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8-NEXT: xxmrghd vs0, vs61, vs1 ; P8-NEXT: xxmrghd vs1, vs63, vs62 ; P8-NEXT: ld r30, 96(r1) # 8-byte Folded Reload @@ -776,7 +775,6 @@ define <4 x double> @test_extend64_vec4(ptr %p) #0 { ; P8-NEXT: nop ; P8-NEXT: li r3, 80 ; P8-NEXT: xxmrghd vs35, vs63, vs62 -; P8-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; P8-NEXT: xxmrghd vs34, vs61, vs1 ; P8-NEXT: ld r30, 96(r1) # 8-byte Folded Reload ; P8-NEXT: lxvd2x vs63, r1, r3 # 16-byte Folded Reload @@ -1005,11 +1003,10 @@ define void @test_trunc64_vec4(<4 x double> %a, ptr %p) #0 { ; P8-NEXT: stdu r1, -128(r1) ; P8-NEXT: li r3, 48 ; P8-NEXT: std r0, 144(r1) -; P8-NEXT: std r27, 88(r1) # 8-byte Folded Spill ; P8-NEXT: xxswapd vs1, vs34 +; P8-NEXT: std r27, 88(r1) # 8-byte Folded Spill ; P8-NEXT: std r28, 96(r1) # 8-byte Folded Spill ; P8-NEXT: std r29, 104(r1) # 8-byte Folded Spill -; P8-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; P8-NEXT: std r30, 112(r1) # 8-byte Folded Spill ; P8-NEXT: mr r30, r7 ; P8-NEXT: stxvd2x vs62, r1, r3 # 16-byte Folded Spill @@ -1019,9 +1016,8 @@ define void @test_trunc64_vec4(<4 x double> %a, ptr %p) #0 { ; P8-NEXT: vmr v31, v3 ; P8-NEXT: bl __truncdfhf2 ; P8-NEXT: nop -; P8-NEXT: mr r29, r3 ; P8-NEXT: xxswapd vs1, vs63 -; P8-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; P8-NEXT: mr r29, r3 ; P8-NEXT: bl __truncdfhf2 ; P8-NEXT: nop ; P8-NEXT: xxlor f1, vs62, vs62 @@ -1238,7 +1234,6 @@ define half @PR40273(half) #0 { ; P8-NEXT: vspltisw v2, 1 ; P8-NEXT: xvcvsxwdp vs1, vs34 ; P8-NEXT: .LBB20_2: -; P8-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; P8-NEXT: addi r1, r1, 32 ; P8-NEXT: ld r0, 16(r1) ; P8-NEXT: mtlr r0 @@ -1253,12 +1248,10 @@ define half @PR40273(half) #0 { ; CHECK-NEXT: mtfprwz f0, r3 ; CHECK-NEXT: xscvhpdp f0, f0 ; CHECK-NEXT: fcmpu cr0, f0, f1 -; CHECK-NEXT: beq cr0, .LBB20_2 +; CHECK-NEXT: beqlr cr0 ; CHECK-NEXT: # %bb.1: ; CHECK-NEXT: vspltisw v2, 1 ; CHECK-NEXT: xvcvsxwdp vs1, vs34 -; CHECK-NEXT: .LBB20_2: -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: blr ; ; SOFT-LABEL: PR40273: diff --git a/llvm/test/CodeGen/PowerPC/huge-frame-size.ll b/llvm/test/CodeGen/PowerPC/huge-frame-size.ll index f1039df6f549a..78bdac021ac8a 100644 --- a/llvm/test/CodeGen/PowerPC/huge-frame-size.ll +++ b/llvm/test/CodeGen/PowerPC/huge-frame-size.ll @@ -18,7 +18,7 @@ define void @foo(i8 %x) { ; CHECK-LE-NEXT: oris 0, 0, 65535 ; CHECK-LE-NEXT: ori 0, 0, 65504 ; CHECK-LE-NEXT: stdux 1, 1, 0 -; CHECK-LE-NEXT: .cfi_def_cfa_offset 32 +; CHECK-LE-NEXT: .cfi_def_cfa_offset 4294967328 ; CHECK-LE-NEXT: li 4, 1 ; CHECK-LE-NEXT: addi 5, 1, 32 ; CHECK-LE-NEXT: stb 3, 32(1) diff --git a/llvm/test/CodeGen/PowerPC/ldexp.ll b/llvm/test/CodeGen/PowerPC/ldexp.ll index ed8089b4b303e..151df6096b30b 100644 --- a/llvm/test/CodeGen/PowerPC/ldexp.ll +++ b/llvm/test/CodeGen/PowerPC/ldexp.ll @@ -13,7 +13,6 @@ define float @ldexp_f32(i8 zeroext %x) { ; CHECK-NEXT: vspltisw v2, 1 ; CHECK-NEXT: mr r4, r3 ; CHECK-NEXT: xvcvsxwdp vs1, v2 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl ldexpf ; CHECK-NEXT: nop ; CHECK-NEXT: addi r1, r1, 32 @@ -36,7 +35,6 @@ define double @ldexp_f64(i8 zeroext %x) { ; CHECK-NEXT: vspltisw v2, 1 ; CHECK-NEXT: mr r4, r3 ; CHECK-NEXT: xvcvsxwdp vs1, v2 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl ldexp ; CHECK-NEXT: nop ; CHECK-NEXT: addi r1, r1, 32 @@ -120,7 +118,6 @@ define <4 x float> @ldexp_v4f32(<4 x float> %val, <4 x i32> %exp) { ; CHECK-NEXT: vextuwrx r4, r3, v31 ; CHECK-NEXT: bl ldexpf ; CHECK-NEXT: nop -; CHECK-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-NEXT: xxmrghd vs0, v29, vs1 ; CHECK-NEXT: li r3, 0 ; CHECK-NEXT: vextuwrx r4, r3, v31 @@ -135,7 +132,6 @@ define <4 x float> @ldexp_v4f32(<4 x float> %val, <4 x i32> %exp) { ; CHECK-NEXT: xscvspdpn f1, vs0 ; CHECK-NEXT: bl ldexpf ; CHECK-NEXT: nop -; CHECK-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-NEXT: xxmrghd vs0, vs1, v29 ; CHECK-NEXT: lxv v31, 80(r1) # 16-byte Folded Reload ; CHECK-NEXT: lxv v30, 64(r1) # 16-byte Folded Reload diff --git a/llvm/test/CodeGen/PowerPC/mma-acc-spill.ll b/llvm/test/CodeGen/PowerPC/mma-acc-spill.ll index 8d03594fe1bfd..681f81d74794d 100644 --- a/llvm/test/CodeGen/PowerPC/mma-acc-spill.ll +++ b/llvm/test/CodeGen/PowerPC/mma-acc-spill.ll @@ -6,6 +6,13 @@ ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -disable-auto-paired-vec-st=false \ ; RUN: -ppc-vsr-nums-as-vr < %s | FileCheck %s --check-prefix=CHECK-BE +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \ +; RUN: -mcpu=pwr11 -ppc-asm-full-reg-names -disable-auto-paired-vec-st=false \ +; RUN: -ppc-vsr-nums-as-vr < %s | FileCheck %s +; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \ +; RUN: -mcpu=pwr11 -ppc-asm-full-reg-names -disable-auto-paired-vec-st=false \ +; RUN: -ppc-vsr-nums-as-vr < %s | FileCheck %s --check-prefix=CHECK-BE + declare <512 x i1> @llvm.ppc.mma.xvf16ger2pp(<512 x i1>, <16 x i8>, <16 x i8>) declare <512 x i1> @llvm.ppc.mma.assemble.acc(<16 x i8>, <16 x i8>, <16 x i8>, <16 x i8>) declare void @foo() diff --git a/llvm/test/CodeGen/PowerPC/p10-constants.ll b/llvm/test/CodeGen/PowerPC/p10-p11-constants.ll similarity index 94% rename from llvm/test/CodeGen/PowerPC/p10-constants.ll rename to llvm/test/CodeGen/PowerPC/p10-p11-constants.ll index 77472afd9c3d4..5f6a345bdd938 100644 --- a/llvm/test/CodeGen/PowerPC/p10-constants.ll +++ b/llvm/test/CodeGen/PowerPC/p10-p11-constants.ll @@ -8,7 +8,17 @@ ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \ ; RUN: FileCheck %s --check-prefix=CHECK32 -; These test cases aim to test constant materialization using the pli instruction on Power10. +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \ +; RUN: -mcpu=pwr11 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \ +; RUN: FileCheck %s +; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \ +; RUN: -mcpu=pwr11 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \ +; RUN: FileCheck %s +; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-linux-gnu \ +; RUN: -mcpu=pwr11 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \ +; RUN: FileCheck %s --check-prefix=CHECK32 + +; These test cases aim to test constant materialization using the pli instruction on Power10 and Power11. define signext i32 @t_16BitsMinRequiring34Bits() { ; CHECK-LABEL: t_16BitsMinRequiring34Bits: diff --git a/llvm/test/CodeGen/PowerPC/p10-spill-crlt.ll b/llvm/test/CodeGen/PowerPC/p10-spill-crlt.ll index c733a01950603..4b032781c3764 100644 --- a/llvm/test/CodeGen/PowerPC/p10-spill-crlt.ll +++ b/llvm/test/CodeGen/PowerPC/p10-spill-crlt.ll @@ -30,16 +30,14 @@ define dso_local void @P10_Spill_CR_LT() local_unnamed_addr { ; CHECK-NEXT: mflr r0 ; CHECK-NEXT: std r0, 16(r1) ; CHECK-NEXT: stw r12, 8(r1) -; CHECK-NEXT: stdu r1, -64(r1) -; CHECK-NEXT: .cfi_def_cfa_offset 64 +; CHECK-NEXT: stdu r1, -48(r1) +; CHECK-NEXT: .cfi_def_cfa_offset 48 ; CHECK-NEXT: .cfi_offset lr, 16 -; CHECK-NEXT: .cfi_offset r29, -24 ; CHECK-NEXT: .cfi_offset r30, -16 ; CHECK-NEXT: .cfi_offset cr2, 8 ; CHECK-NEXT: .cfi_offset cr3, 8 ; CHECK-NEXT: .cfi_offset cr4, 8 -; CHECK-NEXT: std r29, 40(r1) # 8-byte Folded Spill -; CHECK-NEXT: std r30, 48(r1) # 8-byte Folded Spill +; CHECK-NEXT: std r30, 32(r1) # 8-byte Folded Spill ; CHECK-NEXT: bl call_2@notoc ; CHECK-NEXT: bc 12, 4*cr5+lt, .LBB0_13 ; CHECK-NEXT: # %bb.1: # %bb @@ -67,11 +65,10 @@ define dso_local void @P10_Spill_CR_LT() local_unnamed_addr { ; CHECK-NEXT: bc 12, 4*cr3+eq, .LBB0_11 ; CHECK-NEXT: # %bb.6: # %bb32 ; CHECK-NEXT: # +; CHECK-NEXT: rlwinm r30, r30, 0, 24, 22 ; CHECK-NEXT: andi. r3, r30, 2 -; CHECK-NEXT: rlwinm r29, r30, 0, 24, 22 ; CHECK-NEXT: mcrf cr2, cr0 ; CHECK-NEXT: bl call_4@notoc -; CHECK-NEXT: mr r30, r29 ; CHECK-NEXT: beq+ cr2, .LBB0_3 ; CHECK-NEXT: # %bb.7: # %bb37 ; CHECK-NEXT: .LBB0_8: # %bb22 @@ -92,13 +89,11 @@ define dso_local void @P10_Spill_CR_LT() local_unnamed_addr { ; CHECK-BE-NEXT: stdu r1, -144(r1) ; CHECK-BE-NEXT: .cfi_def_cfa_offset 144 ; CHECK-BE-NEXT: .cfi_offset lr, 16 -; CHECK-BE-NEXT: .cfi_offset r28, -32 ; CHECK-BE-NEXT: .cfi_offset r29, -24 ; CHECK-BE-NEXT: .cfi_offset r30, -16 ; CHECK-BE-NEXT: .cfi_offset cr2, 8 ; CHECK-BE-NEXT: .cfi_offset cr2, 8 ; CHECK-BE-NEXT: .cfi_offset cr2, 8 -; CHECK-BE-NEXT: std r28, 112(r1) # 8-byte Folded Spill ; CHECK-BE-NEXT: std r29, 120(r1) # 8-byte Folded Spill ; CHECK-BE-NEXT: std r30, 128(r1) # 8-byte Folded Spill ; CHECK-BE-NEXT: bl call_2 @@ -131,12 +126,11 @@ define dso_local void @P10_Spill_CR_LT() local_unnamed_addr { ; CHECK-BE-NEXT: bc 12, 4*cr3+eq, .LBB0_11 ; CHECK-BE-NEXT: # %bb.6: # %bb32 ; CHECK-BE-NEXT: # +; CHECK-BE-NEXT: rlwinm r29, r29, 0, 24, 22 ; CHECK-BE-NEXT: andi. r3, r29, 2 -; CHECK-BE-NEXT: rlwinm r28, r29, 0, 24, 22 ; CHECK-BE-NEXT: mcrf cr2, cr0 ; CHECK-BE-NEXT: bl call_4 ; CHECK-BE-NEXT: nop -; CHECK-BE-NEXT: mr r29, r28 ; CHECK-BE-NEXT: beq+ cr2, .LBB0_3 ; CHECK-BE-NEXT: # %bb.7: # %bb37 ; CHECK-BE-NEXT: .LBB0_8: # %bb22 diff --git a/llvm/test/CodeGen/PowerPC/p10-splatImm-CPload-pcrel.ll b/llvm/test/CodeGen/PowerPC/p10-splatImm-CPload-pcrel.ll index 7373a328a4f05..842cb929541cf 100644 --- a/llvm/test/CodeGen/PowerPC/p10-splatImm-CPload-pcrel.ll +++ b/llvm/test/CodeGen/PowerPC/p10-splatImm-CPload-pcrel.ll @@ -124,21 +124,18 @@ define dso_local double @testDoubleNonRepresentableScalar() local_unnamed_addr { ; CHECK-LE: # %bb.0: # %entry ; CHECK-LE-NEXT: xxsplti32dx vs1, 0, 1081435463 ; CHECK-LE-NEXT: xxsplti32dx vs1, 1, -1374389535 -; CHECK-LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-LE-NEXT: blr ; ; CHECK-NOPCREL-BE-LABEL: testDoubleNonRepresentableScalar: ; CHECK-NOPCREL-BE: # %bb.0: # %entry ; CHECK-NOPCREL-BE-NEXT: xxsplti32dx vs1, 0, 1081435463 ; CHECK-NOPCREL-BE-NEXT: xxsplti32dx vs1, 1, -1374389535 -; CHECK-NOPCREL-BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NOPCREL-BE-NEXT: blr ; ; CHECK-NOPCREL-LE-LABEL: testDoubleNonRepresentableScalar: ; CHECK-NOPCREL-LE: # %bb.0: # %entry ; CHECK-NOPCREL-LE-NEXT: xxsplti32dx vs1, 0, 1081435463 ; CHECK-NOPCREL-LE-NEXT: xxsplti32dx vs1, 1, -1374389535 -; CHECK-NOPCREL-LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NOPCREL-LE-NEXT: blr ; ; CHECK-NOPREFIX-LABEL: testDoubleNonRepresentableScalar: @@ -151,7 +148,6 @@ define dso_local double @testDoubleNonRepresentableScalar() local_unnamed_addr { ; CHECK-BE: # %bb.0: # %entry ; CHECK-BE-NEXT: xxsplti32dx vs1, 0, 1081435463 ; CHECK-BE-NEXT: xxsplti32dx vs1, 1, -1374389535 -; CHECK-BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-BE-NEXT: blr entry: ret double 3.423300e+02 @@ -162,21 +158,18 @@ define dso_local float @testFloatDenormScalar() local_unnamed_addr { ; CHECK-LE: # %bb.0: # %entry ; CHECK-LE-NEXT: xxsplti32dx vs1, 0, 940259579 ; CHECK-LE-NEXT: xxsplti32dx vs1, 1, -2147483648 -; CHECK-LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-LE-NEXT: blr ; ; CHECK-NOPCREL-BE-LABEL: testFloatDenormScalar: ; CHECK-NOPCREL-BE: # %bb.0: # %entry ; CHECK-NOPCREL-BE-NEXT: xxsplti32dx vs1, 0, 940259579 ; CHECK-NOPCREL-BE-NEXT: xxsplti32dx vs1, 1, -2147483648 -; CHECK-NOPCREL-BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NOPCREL-BE-NEXT: blr ; ; CHECK-NOPCREL-LE-LABEL: testFloatDenormScalar: ; CHECK-NOPCREL-LE: # %bb.0: # %entry ; CHECK-NOPCREL-LE-NEXT: xxsplti32dx vs1, 0, 940259579 ; CHECK-NOPCREL-LE-NEXT: xxsplti32dx vs1, 1, -2147483648 -; CHECK-NOPCREL-LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NOPCREL-LE-NEXT: blr ; ; CHECK-NOPREFIX-LABEL: testFloatDenormScalar: @@ -189,7 +182,6 @@ define dso_local float @testFloatDenormScalar() local_unnamed_addr { ; CHECK-BE: # %bb.0: # %entry ; CHECK-BE-NEXT: xxsplti32dx vs1, 0, 940259579 ; CHECK-BE-NEXT: xxsplti32dx vs1, 1, -2147483648 -; CHECK-BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-BE-NEXT: blr entry: ret float 0x380B38FB80000000 @@ -200,21 +192,18 @@ define dso_local double @testFloatDenormToDoubleScalar() local_unnamed_addr { ; CHECK-LE: # %bb.0: # %entry ; CHECK-LE-NEXT: xxsplti32dx vs1, 0, 940259579 ; CHECK-LE-NEXT: xxsplti32dx vs1, 1, -2147483648 -; CHECK-LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-LE-NEXT: blr ; ; CHECK-NOPCREL-BE-LABEL: testFloatDenormToDoubleScalar: ; CHECK-NOPCREL-BE: # %bb.0: # %entry ; CHECK-NOPCREL-BE-NEXT: xxsplti32dx vs1, 0, 940259579 ; CHECK-NOPCREL-BE-NEXT: xxsplti32dx vs1, 1, -2147483648 -; CHECK-NOPCREL-BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NOPCREL-BE-NEXT: blr ; ; CHECK-NOPCREL-LE-LABEL: testFloatDenormToDoubleScalar: ; CHECK-NOPCREL-LE: # %bb.0: # %entry ; CHECK-NOPCREL-LE-NEXT: xxsplti32dx vs1, 0, 940259579 ; CHECK-NOPCREL-LE-NEXT: xxsplti32dx vs1, 1, -2147483648 -; CHECK-NOPCREL-LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NOPCREL-LE-NEXT: blr ; ; CHECK-NOPREFIX-LABEL: testFloatDenormToDoubleScalar: @@ -227,7 +216,6 @@ define dso_local double @testFloatDenormToDoubleScalar() local_unnamed_addr { ; CHECK-BE: # %bb.0: # %entry ; CHECK-BE-NEXT: xxsplti32dx vs1, 0, 940259579 ; CHECK-BE-NEXT: xxsplti32dx vs1, 1, -2147483648 -; CHECK-BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-BE-NEXT: blr entry: ret double 0x380B38FB80000000 diff --git a/llvm/test/CodeGen/PowerPC/p8-scalar_vector_conversions.ll b/llvm/test/CodeGen/PowerPC/p8-scalar_vector_conversions.ll index 87b8a64cc67bd..8f12b182283f5 100644 --- a/llvm/test/CodeGen/PowerPC/p8-scalar_vector_conversions.ll +++ b/llvm/test/CodeGen/PowerPC/p8-scalar_vector_conversions.ll @@ -2416,7 +2416,6 @@ define double @getd0(<2 x double> %vd) { ; CHECK-LE-LABEL: getd0: ; CHECK-LE: # %bb.0: # %entry ; CHECK-LE-NEXT: xxswapd vs1, v2 -; CHECK-LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-LE-NEXT: blr ; ; CHECK-AIX-LABEL: getd0: @@ -2435,7 +2434,6 @@ define double @getd1(<2 x double> %vd) { ; CHECK-LABEL: getd1: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: xxswapd vs1, v2 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: blr ; ; CHECK-LE-LABEL: getd1: @@ -2446,7 +2444,6 @@ define double @getd1(<2 x double> %vd) { ; CHECK-AIX-LABEL: getd1: ; CHECK-AIX: # %bb.0: # %entry ; CHECK-AIX-NEXT: xxswapd 1, 34 -; CHECK-AIX-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-AIX-NEXT: blr entry: %vecext = extractelement <2 x double> %vd, i32 1 @@ -2462,7 +2459,6 @@ define double @getveld(<2 x double> %vd, i32 signext %i) { ; CHECK-NEXT: lvsl v3, 0, r3 ; CHECK-NEXT: vperm v2, v2, v2, v3 ; CHECK-NEXT: xxlor vs1, v2, v2 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: blr ; ; CHECK-LE-LABEL: getveld: @@ -2474,7 +2470,6 @@ define double @getveld(<2 x double> %vd, i32 signext %i) { ; CHECK-LE-NEXT: lvsl v3, 0, r3 ; CHECK-LE-NEXT: vperm v2, v2, v2, v3 ; CHECK-LE-NEXT: xxlor vs1, v2, v2 -; CHECK-LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-LE-NEXT: blr ; ; CHECK-AIX-LABEL: getveld: @@ -2484,7 +2479,6 @@ define double @getveld(<2 x double> %vd, i32 signext %i) { ; CHECK-AIX-NEXT: lvsl 3, 0, 3 ; CHECK-AIX-NEXT: vperm 2, 2, 2, 3 ; CHECK-AIX-NEXT: xxlor 1, 34, 34 -; CHECK-AIX-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-AIX-NEXT: blr entry: %vecext = extractelement <2 x double> %vd, i32 %i diff --git a/llvm/test/CodeGen/PowerPC/pcrel-call-linkage-leaf.ll b/llvm/test/CodeGen/PowerPC/pcrel-call-linkage-leaf.ll index 541b2c46dd395..0b1047bb6cfbe 100644 --- a/llvm/test/CodeGen/PowerPC/pcrel-call-linkage-leaf.ll +++ b/llvm/test/CodeGen/PowerPC/pcrel-call-linkage-leaf.ll @@ -175,7 +175,6 @@ define dso_local double @UsesX2AsConstPoolTOC() local_unnamed_addr { ; CHECK-ALL: # %bb.0: # %entry ; CHECK-S-NEXT: xxsplti32dx vs1, 0, 1078011044 ; CHECK-S-NEXT: xxsplti32dx vs1, 1, -337824948 -; CHECK-S-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-S-NEXT: blr entry: ret double 0x404124A4EBDD334C diff --git a/llvm/test/CodeGen/PowerPC/select_const.ll b/llvm/test/CodeGen/PowerPC/select_const.ll index ca4be83cc16ac..a48d6968aafbf 100644 --- a/llvm/test/CodeGen/PowerPC/select_const.ll +++ b/llvm/test/CodeGen/PowerPC/select_const.ll @@ -845,12 +845,10 @@ define double @sel_constants_frem_constant(i1 %cond) { ; ALL-NEXT: # %bb.1: ; ALL-NEXT: addis 3, 2, .LCPI48_0@toc@ha ; ALL-NEXT: lfd 1, .LCPI48_0@toc@l(3) -; ALL-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; ALL-NEXT: blr ; ALL-NEXT: .LBB48_2: ; ALL-NEXT: vspltisw 2, -4 ; ALL-NEXT: xvcvsxwdp 1, 34 -; ALL-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; ALL-NEXT: blr %sel = select i1 %cond, double -4.0, double 23.3 %bo = frem double %sel, 5.1 diff --git a/llvm/test/CodeGen/PowerPC/subreg-coalescer.mir b/llvm/test/CodeGen/PowerPC/subreg-coalescer.mir new file mode 100644 index 0000000000000..31407e0d44cfb --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/subreg-coalescer.mir @@ -0,0 +1,33 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 +# RUN: llc -mtriple powerpc64le-unknown-linux-gnu -mcpu=pwr8 %s \ +# RUN: -verify-coalescing --run-pass=register-coalescer -o - | FileCheck %s + +# Check that the register coalescer correctly handles merging live ranges over +# SUBREG_TO_REG on PowerPC. The -verify-coalescing option will give an error if +# this is incorrect. + +--- +name: check_subregs +alignment: 16 +tracksRegLiveness: true +body: | + bb.0: + liveins: $x3 + + ; CHECK-LABEL: name: check_subregs + ; CHECK: liveins: $x3 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:g8rc_and_g8rc_nox0 = COPY $x3 + ; CHECK-NEXT: [[LFSUX:%[0-9]+]]:f8rc, dead [[LFSUX1:%[0-9]+]]:g8rc_and_g8rc_nox0 = LFSUX [[COPY]], [[COPY]] + ; CHECK-NEXT: undef [[FRSP:%[0-9]+]].sub_64:vslrc = FRSP [[LFSUX]], implicit $rm + ; CHECK-NEXT: [[XVCVDPSP:%[0-9]+]]:vrrc = XVCVDPSP [[FRSP]], implicit $rm + ; CHECK-NEXT: $v2 = COPY [[XVCVDPSP]] + ; CHECK-NEXT: BLR8 implicit $lr8, implicit $rm, implicit $v2 + %0:g8rc_and_g8rc_nox0 = COPY $x3 + %1:f8rc, %2:g8rc_and_g8rc_nox0 = LFSUX %0, %0 + %3:f4rc = FRSP killed %1, implicit $rm + %4:vslrc = SUBREG_TO_REG 1, %3, %subreg.sub_64 + %5:vrrc = XVCVDPSP killed %4, implicit $rm + $v2 = COPY %5 + BLR8 implicit $lr8, implicit $rm, implicit $v2 +... diff --git a/llvm/test/CodeGen/PowerPC/subreg-lanemasks.mir b/llvm/test/CodeGen/PowerPC/subreg-lanemasks.mir index e1fd6180b2662..cf69d3ad09878 100644 --- a/llvm/test/CodeGen/PowerPC/subreg-lanemasks.mir +++ b/llvm/test/CodeGen/PowerPC/subreg-lanemasks.mir @@ -5,21 +5,18 @@ # Keep track of all of the lanemasks for various subregsiters. # -# TODO: The mask for %6.sub_vsx1:accrc is the same as the mask for %10.sub_vsx1_then_sub_64:accrc. -# Ideally on PowerPC these masks should be different. To be addressed in a later patch. -# -# CHECK: %3 [80r,80d:0) 0@80r L0000000000000004 [80r,80d:0) 0@80r weight:0.000000e+00 -# CHECK: %4 [96r,96d:0) 0@96r L0000000000000800 [96r,96d:0) 0@96r weight:0.000000e+00 -# CHECK: %5 [112r,112d:0) 0@112r L0000000000000004 [112r,112d:0) 0@112r weight:0.000000e+00 -# CHECK: %6 [128r,128d:0) 0@128r L0000000000000800 [128r,128d:0) 0@128r weight:0.000000e+00 +# CHECK: %3 [80r,80d:0) 0@80r L000000000000000C [80r,80d:0) 0@80r weight:0.000000e+00 +# CHECK: %4 [96r,96d:0) 0@96r L0000000000003000 [96r,96d:0) 0@96r weight:0.000000e+00 +# CHECK: %5 [112r,112d:0) 0@112r L000000000000000C [112r,112d:0) 0@112r weight:0.000000e+00 +# CHECK: %6 [128r,128d:0) 0@128r L0000000000003000 [128r,128d:0) 0@128r weight:0.000000e+00 # CHECK: %7 [144r,144d:0) 0@144r L0000000000000004 [144r,144d:0) 0@144r weight:0.000000e+00 -# CHECK: %8 [160r,160d:0) 0@160r L0000000000000800 [160r,160d:0) 0@160r weight:0.000000e+00 +# CHECK: %8 [160r,160d:0) 0@160r L0000000000001000 [160r,160d:0) 0@160r weight:0.000000e+00 # CHECK: %9 [176r,176d:0) 0@176r L0000000000000004 [176r,176d:0) 0@176r weight:0.000000e+00 -# CHECK: %10 [192r,192d:0) 0@192r L0000000000000800 [192r,192d:0) 0@192r weight:0.000000e+00 -# CHECK: %11 [208r,208d:0) 0@208r L0000000000001000 [208r,208d:0) 0@208r weight:0.000000e+00 -# CHECK: %12 [224r,224d:0) 0@224r L0000000000002000 [224r,224d:0) 0@224r weight:0.000000e+00 -# CHECK: %13 [240r,240d:0) 0@240r L0000000000000804 [240r,240d:0) 0@240r weight:0.000000e+00 -# CHECK: %14 [256r,256d:0) 0@256r L0000000000003000 [256r,256d:0) 0@256r weight:0.000000e+00 +# CHECK: %10 [192r,192d:0) 0@192r L0000000000001000 [192r,192d:0) 0@192r weight:0.000000e+00 +# CHECK: %11 [208r,208d:0) 0@208r L0000000000004000 [208r,208d:0) 0@208r weight:0.000000e+00 +# CHECK: %12 [224r,224d:0) 0@224r L0000000000010000 [224r,224d:0) 0@224r weight:0.000000e+00 +# CHECK: %13 [240r,240d:0) 0@240r L000000000000300C [240r,240d:0) 0@240r weight:0.000000e+00 +# CHECK: %14 [256r,256d:0) 0@256r L000000000003C000 [256r,256d:0) 0@256r weight:0.000000e+00 # CHECK: 0B bb.0 diff --git a/llvm/test/CodeGen/PowerPC/toc-float.ll b/llvm/test/CodeGen/PowerPC/toc-float.ll index 1d6f1f71a2383..943edd5948429 100644 --- a/llvm/test/CodeGen/PowerPC/toc-float.ll +++ b/llvm/test/CodeGen/PowerPC/toc-float.ll @@ -9,14 +9,12 @@ define double @doubleConstant1() { ; CHECK-P9: # %bb.0: ; CHECK-P9-NEXT: vspltisw 2, 14 ; CHECK-P9-NEXT: xvcvsxwdp 1, 34 -; CHECK-P9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-P9-NEXT: blr ; ; CHECK-P8-LABEL: doubleConstant1: ; CHECK-P8: # %bb.0: ; CHECK-P8-NEXT: vspltisw 2, 14 ; CHECK-P8-NEXT: xvcvsxwdp 1, 34 -; CHECK-P8-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-P8-NEXT: blr ret double 1.400000e+01 } diff --git a/llvm/test/CodeGen/PowerPC/variable_elem_vec_extracts.ll b/llvm/test/CodeGen/PowerPC/variable_elem_vec_extracts.ll index 49c80a91f8f99..d0dda1a071754 100644 --- a/llvm/test/CodeGen/PowerPC/variable_elem_vec_extracts.ll +++ b/llvm/test/CodeGen/PowerPC/variable_elem_vec_extracts.ll @@ -122,7 +122,6 @@ define double @getd(<2 x double> %a, i32 zeroext %b) { ; CHECK-NEXT: lvsl 3, 0, 3 ; CHECK-NEXT: vperm 2, 2, 2, 3 ; CHECK-NEXT: xxlor 1, 34, 34 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: blr ; ; CHECK-BE-LABEL: getd: @@ -132,7 +131,6 @@ define double @getd(<2 x double> %a, i32 zeroext %b) { ; CHECK-BE-NEXT: lvsl 3, 0, 3 ; CHECK-BE-NEXT: vperm 2, 2, 2, 3 ; CHECK-BE-NEXT: xxlor 1, 34, 34 -; CHECK-BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-BE-NEXT: blr ; ; CHECK-P7-LABEL: getd: @@ -142,7 +140,6 @@ define double @getd(<2 x double> %a, i32 zeroext %b) { ; CHECK-P7-NEXT: lvsl 3, 0, 3 ; CHECK-P7-NEXT: vperm 2, 2, 2, 3 ; CHECK-P7-NEXT: xxlor 1, 34, 34 -; CHECK-P7-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-P7-NEXT: blr entry: %vecext = extractelement <2 x double> %a, i32 %b diff --git a/llvm/test/CodeGen/PowerPC/vec_insert_elt.ll b/llvm/test/CodeGen/PowerPC/vec_insert_elt.ll index b98aed8616509..291a9c1f978da 100644 --- a/llvm/test/CodeGen/PowerPC/vec_insert_elt.ll +++ b/llvm/test/CodeGen/PowerPC/vec_insert_elt.ll @@ -940,25 +940,21 @@ entry: define <2 x double> @testDoubleImm1(<2 x double> %a, double %b) { ; CHECK-LABEL: testDoubleImm1: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-NEXT: xxmrghd v2, v2, vs1 ; CHECK-NEXT: blr ; ; CHECK-BE-LABEL: testDoubleImm1: ; CHECK-BE: # %bb.0: # %entry -; CHECK-BE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-BE-NEXT: xxpermdi v2, vs1, v2, 1 ; CHECK-BE-NEXT: blr ; ; CHECK-P9-LABEL: testDoubleImm1: ; CHECK-P9: # %bb.0: # %entry -; CHECK-P9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; CHECK-P9-NEXT: xxpermdi v2, vs1, v2, 1 ; CHECK-P9-NEXT: blr ; ; AIX-P8-LABEL: testDoubleImm1: ; AIX-P8: # %bb.0: # %entry -; AIX-P8-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; AIX-P8-NEXT: xxpermdi v2, vs1, v2, 1 ; AIX-P8-NEXT: blr entry: diff --git a/llvm/test/CodeGen/PowerPC/vector-constrained-fp-intrinsics.ll b/llvm/test/CodeGen/PowerPC/vector-constrained-fp-intrinsics.ll index f217162782bfd..aedb1a9c65cf8 100644 --- a/llvm/test/CodeGen/PowerPC/vector-constrained-fp-intrinsics.ll +++ b/llvm/test/CodeGen/PowerPC/vector-constrained-fp-intrinsics.ll @@ -107,32 +107,20 @@ entry: define <3 x double> @constrained_vector_fdiv_v3f64(<3 x double> %x, <3 x double> %y) #0 { ; PC64LE-LABEL: constrained_vector_fdiv_v3f64: ; PC64LE: # %bb.0: # %entry -; PC64LE-NEXT: # kill: def $f5 killed $f5 def $vsl5 -; PC64LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; PC64LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 0, 5, 4 ; PC64LE-NEXT: xxmrghd 1, 2, 1 ; PC64LE-NEXT: xsdivdp 3, 3, 6 ; PC64LE-NEXT: xvdivdp 2, 1, 0 ; PC64LE-NEXT: xxswapd 1, 2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: blr ; ; PC64LE9-LABEL: constrained_vector_fdiv_v3f64: ; PC64LE9: # %bb.0: # %entry -; PC64LE9-NEXT: # kill: def $f5 killed $f5 def $vsl5 -; PC64LE9-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 0, 5, 4 ; PC64LE9-NEXT: xxmrghd 1, 2, 1 ; PC64LE9-NEXT: xsdivdp 3, 3, 6 ; PC64LE9-NEXT: xvdivdp 2, 1, 0 ; PC64LE9-NEXT: xxswapd 1, 2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: blr entry: %div = call <3 x double> @llvm.experimental.constrained.fdiv.v3f64( @@ -217,13 +205,10 @@ define <2 x double> @constrained_vector_frem_v2f64(<2 x double> %x, <2 x double> ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 62 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: xxswapd 2, 63 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: bl fmod ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 80 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 34, 61, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 64 @@ -252,11 +237,8 @@ define <2 x double> @constrained_vector_frem_v2f64(<2 x double> %x, <2 x double> ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 62 ; PC64LE9-NEXT: xxswapd 2, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: bl fmod ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 34, 61, 1 ; PC64LE9-NEXT: lxv 63, 64(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lxv 62, 48(1) # 16-byte Folded Reload @@ -408,7 +390,6 @@ define <3 x double> @constrained_vector_frem_v3f64(<3 x double> %x, <3 x double> ; PC64LE-NEXT: fmr 2, 30 ; PC64LE-NEXT: bl fmod ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 63, 1, 63 ; PC64LE-NEXT: fmr 1, 29 ; PC64LE-NEXT: fmr 2, 31 @@ -423,7 +404,6 @@ define <3 x double> @constrained_vector_frem_v3f64(<3 x double> %x, <3 x double> ; PC64LE-NEXT: lfd 29, 72(1) # 8-byte Folded Reload ; PC64LE-NEXT: lfd 28, 64(1) # 8-byte Folded Reload ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: addi 1, 1, 96 ; PC64LE-NEXT: ld 0, 16(1) ; PC64LE-NEXT: mtlr 0 @@ -451,7 +431,6 @@ define <3 x double> @constrained_vector_frem_v3f64(<3 x double> %x, <3 x double> ; PC64LE9-NEXT: fmr 2, 30 ; PC64LE9-NEXT: bl fmod ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 63, 1, 63 ; PC64LE9-NEXT: fmr 1, 29 ; PC64LE9-NEXT: fmr 2, 31 @@ -462,7 +441,6 @@ define <3 x double> @constrained_vector_frem_v3f64(<3 x double> %x, <3 x double> ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lfd 31, 72(1) # 8-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: lfd 30, 64(1) # 8-byte Folded Reload ; PC64LE9-NEXT: lfd 29, 56(1) # 8-byte Folded Reload ; PC64LE9-NEXT: lfd 28, 48(1) # 8-byte Folded Reload @@ -505,12 +483,9 @@ define <4 x double> @constrained_vector_frem_v4f64(<4 x double> %x, <4 x double> ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 59, 1, 1 ; PC64LE-NEXT: xxswapd 1, 60 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: xxswapd 2, 62 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: bl fmod ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 62, 59, 1 ; PC64LE-NEXT: xxlor 1, 61, 61 ; PC64LE-NEXT: xxlor 2, 63, 63 @@ -518,14 +493,11 @@ define <4 x double> @constrained_vector_frem_v4f64(<4 x double> %x, <4 x double> ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 60, 1, 1 ; PC64LE-NEXT: xxswapd 1, 61 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: xxswapd 2, 63 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: bl fmod ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 112 ; PC64LE-NEXT: vmr 2, 30 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 35, 60, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 96 @@ -562,11 +534,8 @@ define <4 x double> @constrained_vector_frem_v4f64(<4 x double> %x, <4 x double> ; PC64LE9-NEXT: xscpsgndp 59, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 60 ; PC64LE9-NEXT: xxswapd 2, 62 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: bl fmod ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 62, 59, 1 ; PC64LE9-NEXT: xscpsgndp 1, 61, 61 ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 @@ -575,11 +544,8 @@ define <4 x double> @constrained_vector_frem_v4f64(<4 x double> %x, <4 x double> ; PC64LE9-NEXT: xscpsgndp 60, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 61 ; PC64LE9-NEXT: xxswapd 2, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: bl fmod ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 35, 60, 1 ; PC64LE9-NEXT: vmr 2, 30 ; PC64LE9-NEXT: lxv 63, 96(1) # 16-byte Folded Reload @@ -704,32 +670,20 @@ entry: define <3 x double> @constrained_vector_fmul_v3f64(<3 x double> %x, <3 x double> %y) #0 { ; PC64LE-LABEL: constrained_vector_fmul_v3f64: ; PC64LE: # %bb.0: # %entry -; PC64LE-NEXT: # kill: def $f5 killed $f5 def $vsl5 -; PC64LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; PC64LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 0, 5, 4 ; PC64LE-NEXT: xxmrghd 1, 2, 1 ; PC64LE-NEXT: xsmuldp 3, 3, 6 ; PC64LE-NEXT: xvmuldp 2, 1, 0 ; PC64LE-NEXT: xxswapd 1, 2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: blr ; ; PC64LE9-LABEL: constrained_vector_fmul_v3f64: ; PC64LE9: # %bb.0: # %entry -; PC64LE9-NEXT: # kill: def $f5 killed $f5 def $vsl5 -; PC64LE9-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 0, 5, 4 ; PC64LE9-NEXT: xxmrghd 1, 2, 1 ; PC64LE9-NEXT: xsmuldp 3, 3, 6 ; PC64LE9-NEXT: xvmuldp 2, 1, 0 ; PC64LE9-NEXT: xxswapd 1, 2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: blr entry: %mul = call <3 x double> @llvm.experimental.constrained.fmul.v3f64( @@ -866,32 +820,20 @@ entry: define <3 x double> @constrained_vector_fadd_v3f64(<3 x double> %x, <3 x double> %y) #0 { ; PC64LE-LABEL: constrained_vector_fadd_v3f64: ; PC64LE: # %bb.0: # %entry -; PC64LE-NEXT: # kill: def $f5 killed $f5 def $vsl5 -; PC64LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; PC64LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 0, 5, 4 ; PC64LE-NEXT: xxmrghd 1, 2, 1 ; PC64LE-NEXT: xsadddp 3, 3, 6 ; PC64LE-NEXT: xvadddp 2, 1, 0 ; PC64LE-NEXT: xxswapd 1, 2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: blr ; ; PC64LE9-LABEL: constrained_vector_fadd_v3f64: ; PC64LE9: # %bb.0: # %entry -; PC64LE9-NEXT: # kill: def $f5 killed $f5 def $vsl5 -; PC64LE9-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 0, 5, 4 ; PC64LE9-NEXT: xxmrghd 1, 2, 1 ; PC64LE9-NEXT: xsadddp 3, 3, 6 ; PC64LE9-NEXT: xvadddp 2, 1, 0 ; PC64LE9-NEXT: xxswapd 1, 2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: blr entry: %add = call <3 x double> @llvm.experimental.constrained.fadd.v3f64( @@ -1028,32 +970,20 @@ entry: define <3 x double> @constrained_vector_fsub_v3f64(<3 x double> %x, <3 x double> %y) #0 { ; PC64LE-LABEL: constrained_vector_fsub_v3f64: ; PC64LE: # %bb.0: # %entry -; PC64LE-NEXT: # kill: def $f5 killed $f5 def $vsl5 -; PC64LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; PC64LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 0, 5, 4 ; PC64LE-NEXT: xxmrghd 1, 2, 1 ; PC64LE-NEXT: xssubdp 3, 3, 6 ; PC64LE-NEXT: xvsubdp 2, 1, 0 ; PC64LE-NEXT: xxswapd 1, 2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: blr ; ; PC64LE9-LABEL: constrained_vector_fsub_v3f64: ; PC64LE9: # %bb.0: # %entry -; PC64LE9-NEXT: # kill: def $f5 killed $f5 def $vsl5 -; PC64LE9-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 0, 5, 4 ; PC64LE9-NEXT: xxmrghd 1, 2, 1 ; PC64LE9-NEXT: xssubdp 3, 3, 6 ; PC64LE9-NEXT: xvsubdp 2, 1, 0 ; PC64LE9-NEXT: xxswapd 1, 2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: blr entry: %sub = call <3 x double> @llvm.experimental.constrained.fsub.v3f64( @@ -1175,26 +1105,18 @@ entry: define <3 x double> @constrained_vector_sqrt_v3f64(<3 x double> %x) #0 { ; PC64LE-LABEL: constrained_vector_sqrt_v3f64: ; PC64LE: # %bb.0: # %entry -; PC64LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 0, 2, 1 ; PC64LE-NEXT: xssqrtdp 3, 3 ; PC64LE-NEXT: xvsqrtdp 2, 0 ; PC64LE-NEXT: xxswapd 1, 2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: blr ; ; PC64LE9-LABEL: constrained_vector_sqrt_v3f64: ; PC64LE9: # %bb.0: # %entry -; PC64LE9-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 0, 2, 1 ; PC64LE9-NEXT: xssqrtdp 3, 3 ; PC64LE9-NEXT: xvsqrtdp 2, 0 ; PC64LE9-NEXT: xxswapd 1, 2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: blr entry: %sqrt = call <3 x double> @llvm.experimental.constrained.sqrt.v3f64( @@ -1277,13 +1199,10 @@ define <2 x double> @constrained_vector_pow_v2f64(<2 x double> %x, <2 x double> ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 62 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: xxswapd 2, 63 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: bl pow ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 80 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 34, 61, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 64 @@ -1312,11 +1231,8 @@ define <2 x double> @constrained_vector_pow_v2f64(<2 x double> %x, <2 x double> ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 62 ; PC64LE9-NEXT: xxswapd 2, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: bl pow ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 34, 61, 1 ; PC64LE9-NEXT: lxv 63, 64(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lxv 62, 48(1) # 16-byte Folded Reload @@ -1468,7 +1384,6 @@ define <3 x double> @constrained_vector_pow_v3f64(<3 x double> %x, <3 x double> ; PC64LE-NEXT: fmr 2, 30 ; PC64LE-NEXT: bl pow ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 63, 1, 63 ; PC64LE-NEXT: fmr 1, 29 ; PC64LE-NEXT: fmr 2, 31 @@ -1483,7 +1398,6 @@ define <3 x double> @constrained_vector_pow_v3f64(<3 x double> %x, <3 x double> ; PC64LE-NEXT: lfd 29, 72(1) # 8-byte Folded Reload ; PC64LE-NEXT: lfd 28, 64(1) # 8-byte Folded Reload ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: addi 1, 1, 96 ; PC64LE-NEXT: ld 0, 16(1) ; PC64LE-NEXT: mtlr 0 @@ -1511,7 +1425,6 @@ define <3 x double> @constrained_vector_pow_v3f64(<3 x double> %x, <3 x double> ; PC64LE9-NEXT: fmr 2, 30 ; PC64LE9-NEXT: bl pow ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 63, 1, 63 ; PC64LE9-NEXT: fmr 1, 29 ; PC64LE9-NEXT: fmr 2, 31 @@ -1522,7 +1435,6 @@ define <3 x double> @constrained_vector_pow_v3f64(<3 x double> %x, <3 x double> ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lfd 31, 72(1) # 8-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: lfd 30, 64(1) # 8-byte Folded Reload ; PC64LE9-NEXT: lfd 29, 56(1) # 8-byte Folded Reload ; PC64LE9-NEXT: lfd 28, 48(1) # 8-byte Folded Reload @@ -1565,12 +1477,9 @@ define <4 x double> @constrained_vector_pow_v4f64(<4 x double> %x, <4 x double> ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 59, 1, 1 ; PC64LE-NEXT: xxswapd 1, 60 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: xxswapd 2, 62 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: bl pow ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 62, 59, 1 ; PC64LE-NEXT: xxlor 1, 61, 61 ; PC64LE-NEXT: xxlor 2, 63, 63 @@ -1578,14 +1487,11 @@ define <4 x double> @constrained_vector_pow_v4f64(<4 x double> %x, <4 x double> ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 60, 1, 1 ; PC64LE-NEXT: xxswapd 1, 61 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: xxswapd 2, 63 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: bl pow ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 112 ; PC64LE-NEXT: vmr 2, 30 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 35, 60, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 96 @@ -1622,11 +1528,8 @@ define <4 x double> @constrained_vector_pow_v4f64(<4 x double> %x, <4 x double> ; PC64LE9-NEXT: xscpsgndp 59, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 60 ; PC64LE9-NEXT: xxswapd 2, 62 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: bl pow ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 62, 59, 1 ; PC64LE9-NEXT: xscpsgndp 1, 61, 61 ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 @@ -1635,11 +1538,8 @@ define <4 x double> @constrained_vector_pow_v4f64(<4 x double> %x, <4 x double> ; PC64LE9-NEXT: xscpsgndp 60, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 61 ; PC64LE9-NEXT: xxswapd 2, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: bl pow ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 35, 60, 1 ; PC64LE9-NEXT: vmr 2, 30 ; PC64LE9-NEXT: lxv 63, 96(1) # 16-byte Folded Reload @@ -1712,14 +1612,12 @@ define <2 x double> @constrained_vector_powi_v2f64(<2 x double> %x, i32 %y) #0 { ; PC64LE-NEXT: xxlor 1, 63, 63 ; PC64LE-NEXT: bl __powidf2 ; PC64LE-NEXT: nop -; PC64LE-NEXT: mr 4, 30 ; PC64LE-NEXT: xxlor 62, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; PC64LE-NEXT: mr 4, 30 ; PC64LE-NEXT: bl __powidf2 ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 64 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 34, 62, 1 ; PC64LE-NEXT: ld 30, 80(1) # 8-byte Folded Reload ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload @@ -1744,13 +1642,11 @@ define <2 x double> @constrained_vector_powi_v2f64(<2 x double> %x, i32 %y) #0 { ; PC64LE9-NEXT: mr 4, 30 ; PC64LE9-NEXT: bl __powidf2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: mr 4, 30 ; PC64LE9-NEXT: xscpsgndp 62, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; PC64LE9-NEXT: mr 4, 30 ; PC64LE9-NEXT: bl __powidf2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 34, 62, 1 ; PC64LE9-NEXT: lxv 63, 48(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lxv 62, 32(1) # 16-byte Folded Reload @@ -1894,7 +1790,6 @@ define <3 x double> @constrained_vector_powi_v3f64(<3 x double> %x, i32 %y) #0 { ; PC64LE-NEXT: mr 4, 30 ; PC64LE-NEXT: bl __powidf2 ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 63, 1, 63 ; PC64LE-NEXT: fmr 1, 31 ; PC64LE-NEXT: mr 4, 30 @@ -1907,7 +1802,6 @@ define <3 x double> @constrained_vector_powi_v3f64(<3 x double> %x, i32 %y) #0 { ; PC64LE-NEXT: xxlor 2, 63, 63 ; PC64LE-NEXT: lfd 30, 80(1) # 8-byte Folded Reload ; PC64LE-NEXT: ld 30, 64(1) # 8-byte Folded Reload -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: addi 1, 1, 96 ; PC64LE-NEXT: ld 0, 16(1) @@ -1934,7 +1828,6 @@ define <3 x double> @constrained_vector_powi_v3f64(<3 x double> %x, i32 %y) #0 { ; PC64LE9-NEXT: mr 4, 30 ; PC64LE9-NEXT: bl __powidf2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 63, 1, 63 ; PC64LE9-NEXT: fmr 1, 31 ; PC64LE9-NEXT: mr 4, 30 @@ -1945,7 +1838,6 @@ define <3 x double> @constrained_vector_powi_v3f64(<3 x double> %x, i32 %y) #0 { ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lfd 31, 72(1) # 8-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: ld 30, 48(1) # 8-byte Folded Reload ; PC64LE9-NEXT: lfd 30, 64(1) # 8-byte Folded Reload ; PC64LE9-NEXT: addi 1, 1, 80 @@ -1981,27 +1873,23 @@ define <4 x double> @constrained_vector_powi_v4f64(<4 x double> %x, i32 %y) #0 { ; PC64LE-NEXT: vmr 31, 3 ; PC64LE-NEXT: bl __powidf2 ; PC64LE-NEXT: nop -; PC64LE-NEXT: mr 4, 30 ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 62 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; PC64LE-NEXT: mr 4, 30 ; PC64LE-NEXT: bl __powidf2 ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 62, 61, 1 ; PC64LE-NEXT: xxlor 1, 63, 63 ; PC64LE-NEXT: mr 4, 30 ; PC64LE-NEXT: bl __powidf2 ; PC64LE-NEXT: nop -; PC64LE-NEXT: mr 4, 30 ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; PC64LE-NEXT: mr 4, 30 ; PC64LE-NEXT: bl __powidf2 ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 80 ; PC64LE-NEXT: vmr 2, 30 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 35, 61, 1 ; PC64LE-NEXT: ld 30, 96(1) # 8-byte Folded Reload ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload @@ -2030,25 +1918,21 @@ define <4 x double> @constrained_vector_powi_v4f64(<4 x double> %x, i32 %y) #0 { ; PC64LE9-NEXT: vmr 31, 3 ; PC64LE9-NEXT: bl __powidf2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: mr 4, 30 ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 62 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; PC64LE9-NEXT: mr 4, 30 ; PC64LE9-NEXT: bl __powidf2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 62, 61, 1 ; PC64LE9-NEXT: xscpsgndp 1, 63, 63 ; PC64LE9-NEXT: mr 4, 30 ; PC64LE9-NEXT: bl __powidf2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: mr 4, 30 ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; PC64LE9-NEXT: mr 4, 30 ; PC64LE9-NEXT: bl __powidf2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 35, 61, 1 ; PC64LE9-NEXT: vmr 2, 30 ; PC64LE9-NEXT: lxv 63, 64(1) # 16-byte Folded Reload @@ -2116,11 +2000,9 @@ define <2 x double> @constrained_vector_sin_v2f64(<2 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 62, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl sin ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 64 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 34, 62, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 48 @@ -2143,10 +2025,8 @@ define <2 x double> @constrained_vector_sin_v2f64(<2 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 62, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl sin ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 34, 62, 1 ; PC64LE9-NEXT: lxv 63, 48(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lxv 62, 32(1) # 16-byte Folded Reload @@ -2269,7 +2149,6 @@ define <3 x double> @constrained_vector_sin_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: fmr 1, 30 ; PC64LE-NEXT: bl sin ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 63, 1, 63 ; PC64LE-NEXT: fmr 1, 31 ; PC64LE-NEXT: bl sin @@ -2280,7 +2159,6 @@ define <3 x double> @constrained_vector_sin_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: lfd 31, 72(1) # 8-byte Folded Reload ; PC64LE-NEXT: xxlor 2, 63, 63 ; PC64LE-NEXT: lfd 30, 64(1) # 8-byte Folded Reload -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: addi 1, 1, 80 ; PC64LE-NEXT: ld 0, 16(1) @@ -2303,7 +2181,6 @@ define <3 x double> @constrained_vector_sin_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: fmr 1, 30 ; PC64LE9-NEXT: bl sin ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 63, 1, 63 ; PC64LE9-NEXT: fmr 1, 31 ; PC64LE9-NEXT: bl sin @@ -2313,7 +2190,6 @@ define <3 x double> @constrained_vector_sin_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lfd 31, 56(1) # 8-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: lfd 30, 48(1) # 8-byte Folded Reload ; PC64LE9-NEXT: addi 1, 1, 64 ; PC64LE9-NEXT: ld 0, 16(1) @@ -2346,22 +2222,18 @@ define <4 x double> @constrained_vector_sin_v4f64(<4 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 62 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl sin ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 62, 61, 1 ; PC64LE-NEXT: xxlor 1, 63, 63 ; PC64LE-NEXT: bl sin ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl sin ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 80 ; PC64LE-NEXT: vmr 2, 30 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 35, 61, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 64 @@ -2388,20 +2260,16 @@ define <4 x double> @constrained_vector_sin_v4f64(<4 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 62 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl sin ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 62, 61, 1 ; PC64LE9-NEXT: xscpsgndp 1, 63, 63 ; PC64LE9-NEXT: bl sin ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl sin ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 35, 61, 1 ; PC64LE9-NEXT: vmr 2, 30 ; PC64LE9-NEXT: lxv 63, 64(1) # 16-byte Folded Reload @@ -2467,11 +2335,9 @@ define <2 x double> @constrained_vector_cos_v2f64(<2 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 62, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl cos ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 64 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 34, 62, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 48 @@ -2494,10 +2360,8 @@ define <2 x double> @constrained_vector_cos_v2f64(<2 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 62, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl cos ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 34, 62, 1 ; PC64LE9-NEXT: lxv 63, 48(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lxv 62, 32(1) # 16-byte Folded Reload @@ -2620,7 +2484,6 @@ define <3 x double> @constrained_vector_cos_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: fmr 1, 30 ; PC64LE-NEXT: bl cos ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 63, 1, 63 ; PC64LE-NEXT: fmr 1, 31 ; PC64LE-NEXT: bl cos @@ -2631,7 +2494,6 @@ define <3 x double> @constrained_vector_cos_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: lfd 31, 72(1) # 8-byte Folded Reload ; PC64LE-NEXT: xxlor 2, 63, 63 ; PC64LE-NEXT: lfd 30, 64(1) # 8-byte Folded Reload -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: addi 1, 1, 80 ; PC64LE-NEXT: ld 0, 16(1) @@ -2654,7 +2516,6 @@ define <3 x double> @constrained_vector_cos_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: fmr 1, 30 ; PC64LE9-NEXT: bl cos ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 63, 1, 63 ; PC64LE9-NEXT: fmr 1, 31 ; PC64LE9-NEXT: bl cos @@ -2664,7 +2525,6 @@ define <3 x double> @constrained_vector_cos_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lfd 31, 56(1) # 8-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: lfd 30, 48(1) # 8-byte Folded Reload ; PC64LE9-NEXT: addi 1, 1, 64 ; PC64LE9-NEXT: ld 0, 16(1) @@ -2697,22 +2557,18 @@ define <4 x double> @constrained_vector_cos_v4f64(<4 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 62 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl cos ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 62, 61, 1 ; PC64LE-NEXT: xxlor 1, 63, 63 ; PC64LE-NEXT: bl cos ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl cos ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 80 ; PC64LE-NEXT: vmr 2, 30 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 35, 61, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 64 @@ -2739,20 +2595,16 @@ define <4 x double> @constrained_vector_cos_v4f64(<4 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 62 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl cos ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 62, 61, 1 ; PC64LE9-NEXT: xscpsgndp 1, 63, 63 ; PC64LE9-NEXT: bl cos ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl cos ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 35, 61, 1 ; PC64LE9-NEXT: vmr 2, 30 ; PC64LE9-NEXT: lxv 63, 64(1) # 16-byte Folded Reload @@ -2818,11 +2670,9 @@ define <2 x double> @constrained_vector_exp_v2f64(<2 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 62, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl exp ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 64 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 34, 62, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 48 @@ -2845,10 +2695,8 @@ define <2 x double> @constrained_vector_exp_v2f64(<2 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 62, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl exp ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 34, 62, 1 ; PC64LE9-NEXT: lxv 63, 48(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lxv 62, 32(1) # 16-byte Folded Reload @@ -2971,7 +2819,6 @@ define <3 x double> @constrained_vector_exp_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: fmr 1, 30 ; PC64LE-NEXT: bl exp ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 63, 1, 63 ; PC64LE-NEXT: fmr 1, 31 ; PC64LE-NEXT: bl exp @@ -2982,7 +2829,6 @@ define <3 x double> @constrained_vector_exp_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: lfd 31, 72(1) # 8-byte Folded Reload ; PC64LE-NEXT: xxlor 2, 63, 63 ; PC64LE-NEXT: lfd 30, 64(1) # 8-byte Folded Reload -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: addi 1, 1, 80 ; PC64LE-NEXT: ld 0, 16(1) @@ -3005,7 +2851,6 @@ define <3 x double> @constrained_vector_exp_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: fmr 1, 30 ; PC64LE9-NEXT: bl exp ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 63, 1, 63 ; PC64LE9-NEXT: fmr 1, 31 ; PC64LE9-NEXT: bl exp @@ -3015,7 +2860,6 @@ define <3 x double> @constrained_vector_exp_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lfd 31, 56(1) # 8-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: lfd 30, 48(1) # 8-byte Folded Reload ; PC64LE9-NEXT: addi 1, 1, 64 ; PC64LE9-NEXT: ld 0, 16(1) @@ -3048,22 +2892,18 @@ define <4 x double> @constrained_vector_exp_v4f64(<4 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 62 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl exp ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 62, 61, 1 ; PC64LE-NEXT: xxlor 1, 63, 63 ; PC64LE-NEXT: bl exp ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl exp ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 80 ; PC64LE-NEXT: vmr 2, 30 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 35, 61, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 64 @@ -3090,20 +2930,16 @@ define <4 x double> @constrained_vector_exp_v4f64(<4 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 62 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl exp ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 62, 61, 1 ; PC64LE9-NEXT: xscpsgndp 1, 63, 63 ; PC64LE9-NEXT: bl exp ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl exp ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 35, 61, 1 ; PC64LE9-NEXT: vmr 2, 30 ; PC64LE9-NEXT: lxv 63, 64(1) # 16-byte Folded Reload @@ -3169,11 +3005,9 @@ define <2 x double> @constrained_vector_exp2_v2f64(<2 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 62, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl exp2 ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 64 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 34, 62, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 48 @@ -3196,10 +3030,8 @@ define <2 x double> @constrained_vector_exp2_v2f64(<2 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 62, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl exp2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 34, 62, 1 ; PC64LE9-NEXT: lxv 63, 48(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lxv 62, 32(1) # 16-byte Folded Reload @@ -3322,7 +3154,6 @@ define <3 x double> @constrained_vector_exp2_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: fmr 1, 30 ; PC64LE-NEXT: bl exp2 ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 63, 1, 63 ; PC64LE-NEXT: fmr 1, 31 ; PC64LE-NEXT: bl exp2 @@ -3333,7 +3164,6 @@ define <3 x double> @constrained_vector_exp2_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: lfd 31, 72(1) # 8-byte Folded Reload ; PC64LE-NEXT: xxlor 2, 63, 63 ; PC64LE-NEXT: lfd 30, 64(1) # 8-byte Folded Reload -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: addi 1, 1, 80 ; PC64LE-NEXT: ld 0, 16(1) @@ -3356,7 +3186,6 @@ define <3 x double> @constrained_vector_exp2_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: fmr 1, 30 ; PC64LE9-NEXT: bl exp2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 63, 1, 63 ; PC64LE9-NEXT: fmr 1, 31 ; PC64LE9-NEXT: bl exp2 @@ -3366,7 +3195,6 @@ define <3 x double> @constrained_vector_exp2_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lfd 31, 56(1) # 8-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: lfd 30, 48(1) # 8-byte Folded Reload ; PC64LE9-NEXT: addi 1, 1, 64 ; PC64LE9-NEXT: ld 0, 16(1) @@ -3399,22 +3227,18 @@ define <4 x double> @constrained_vector_exp2_v4f64(<4 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 62 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl exp2 ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 62, 61, 1 ; PC64LE-NEXT: xxlor 1, 63, 63 ; PC64LE-NEXT: bl exp2 ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl exp2 ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 80 ; PC64LE-NEXT: vmr 2, 30 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 35, 61, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 64 @@ -3441,20 +3265,16 @@ define <4 x double> @constrained_vector_exp2_v4f64(<4 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 62 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl exp2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 62, 61, 1 ; PC64LE9-NEXT: xscpsgndp 1, 63, 63 ; PC64LE9-NEXT: bl exp2 ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl exp2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 35, 61, 1 ; PC64LE9-NEXT: vmr 2, 30 ; PC64LE9-NEXT: lxv 63, 64(1) # 16-byte Folded Reload @@ -3520,11 +3340,9 @@ define <2 x double> @constrained_vector_log_v2f64(<2 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 62, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl log ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 64 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 34, 62, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 48 @@ -3547,10 +3365,8 @@ define <2 x double> @constrained_vector_log_v2f64(<2 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 62, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl log ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 34, 62, 1 ; PC64LE9-NEXT: lxv 63, 48(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lxv 62, 32(1) # 16-byte Folded Reload @@ -3673,7 +3489,6 @@ define <3 x double> @constrained_vector_log_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: fmr 1, 30 ; PC64LE-NEXT: bl log ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 63, 1, 63 ; PC64LE-NEXT: fmr 1, 31 ; PC64LE-NEXT: bl log @@ -3684,7 +3499,6 @@ define <3 x double> @constrained_vector_log_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: lfd 31, 72(1) # 8-byte Folded Reload ; PC64LE-NEXT: xxlor 2, 63, 63 ; PC64LE-NEXT: lfd 30, 64(1) # 8-byte Folded Reload -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: addi 1, 1, 80 ; PC64LE-NEXT: ld 0, 16(1) @@ -3707,7 +3521,6 @@ define <3 x double> @constrained_vector_log_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: fmr 1, 30 ; PC64LE9-NEXT: bl log ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 63, 1, 63 ; PC64LE9-NEXT: fmr 1, 31 ; PC64LE9-NEXT: bl log @@ -3717,7 +3530,6 @@ define <3 x double> @constrained_vector_log_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lfd 31, 56(1) # 8-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: lfd 30, 48(1) # 8-byte Folded Reload ; PC64LE9-NEXT: addi 1, 1, 64 ; PC64LE9-NEXT: ld 0, 16(1) @@ -3750,22 +3562,18 @@ define <4 x double> @constrained_vector_log_v4f64(<4 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 62 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl log ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 62, 61, 1 ; PC64LE-NEXT: xxlor 1, 63, 63 ; PC64LE-NEXT: bl log ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl log ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 80 ; PC64LE-NEXT: vmr 2, 30 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 35, 61, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 64 @@ -3792,20 +3600,16 @@ define <4 x double> @constrained_vector_log_v4f64(<4 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 62 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl log ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 62, 61, 1 ; PC64LE9-NEXT: xscpsgndp 1, 63, 63 ; PC64LE9-NEXT: bl log ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl log ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 35, 61, 1 ; PC64LE9-NEXT: vmr 2, 30 ; PC64LE9-NEXT: lxv 63, 64(1) # 16-byte Folded Reload @@ -3871,11 +3675,9 @@ define <2 x double> @constrained_vector_log10_v2f64(<2 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 62, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl log10 ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 64 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 34, 62, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 48 @@ -3898,10 +3700,8 @@ define <2 x double> @constrained_vector_log10_v2f64(<2 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 62, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl log10 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 34, 62, 1 ; PC64LE9-NEXT: lxv 63, 48(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lxv 62, 32(1) # 16-byte Folded Reload @@ -4024,7 +3824,6 @@ define <3 x double> @constrained_vector_log10_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: fmr 1, 30 ; PC64LE-NEXT: bl log10 ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 63, 1, 63 ; PC64LE-NEXT: fmr 1, 31 ; PC64LE-NEXT: bl log10 @@ -4035,7 +3834,6 @@ define <3 x double> @constrained_vector_log10_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: lfd 31, 72(1) # 8-byte Folded Reload ; PC64LE-NEXT: xxlor 2, 63, 63 ; PC64LE-NEXT: lfd 30, 64(1) # 8-byte Folded Reload -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: addi 1, 1, 80 ; PC64LE-NEXT: ld 0, 16(1) @@ -4058,7 +3856,6 @@ define <3 x double> @constrained_vector_log10_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: fmr 1, 30 ; PC64LE9-NEXT: bl log10 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 63, 1, 63 ; PC64LE9-NEXT: fmr 1, 31 ; PC64LE9-NEXT: bl log10 @@ -4068,7 +3865,6 @@ define <3 x double> @constrained_vector_log10_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lfd 31, 56(1) # 8-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: lfd 30, 48(1) # 8-byte Folded Reload ; PC64LE9-NEXT: addi 1, 1, 64 ; PC64LE9-NEXT: ld 0, 16(1) @@ -4101,22 +3897,18 @@ define <4 x double> @constrained_vector_log10_v4f64(<4 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 62 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl log10 ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 62, 61, 1 ; PC64LE-NEXT: xxlor 1, 63, 63 ; PC64LE-NEXT: bl log10 ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl log10 ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 80 ; PC64LE-NEXT: vmr 2, 30 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 35, 61, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 64 @@ -4143,20 +3935,16 @@ define <4 x double> @constrained_vector_log10_v4f64(<4 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 62 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl log10 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 62, 61, 1 ; PC64LE9-NEXT: xscpsgndp 1, 63, 63 ; PC64LE9-NEXT: bl log10 ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl log10 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 35, 61, 1 ; PC64LE9-NEXT: vmr 2, 30 ; PC64LE9-NEXT: lxv 63, 64(1) # 16-byte Folded Reload @@ -4222,11 +4010,9 @@ define <2 x double> @constrained_vector_log2_v2f64(<2 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 62, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl log2 ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 64 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 34, 62, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 48 @@ -4249,10 +4035,8 @@ define <2 x double> @constrained_vector_log2_v2f64(<2 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 62, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl log2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 34, 62, 1 ; PC64LE9-NEXT: lxv 63, 48(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lxv 62, 32(1) # 16-byte Folded Reload @@ -4375,7 +4159,6 @@ define <3 x double> @constrained_vector_log2_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: fmr 1, 30 ; PC64LE-NEXT: bl log2 ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 63, 1, 63 ; PC64LE-NEXT: fmr 1, 31 ; PC64LE-NEXT: bl log2 @@ -4386,7 +4169,6 @@ define <3 x double> @constrained_vector_log2_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: lfd 31, 72(1) # 8-byte Folded Reload ; PC64LE-NEXT: xxlor 2, 63, 63 ; PC64LE-NEXT: lfd 30, 64(1) # 8-byte Folded Reload -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: addi 1, 1, 80 ; PC64LE-NEXT: ld 0, 16(1) @@ -4409,7 +4191,6 @@ define <3 x double> @constrained_vector_log2_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: fmr 1, 30 ; PC64LE9-NEXT: bl log2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 63, 1, 63 ; PC64LE9-NEXT: fmr 1, 31 ; PC64LE9-NEXT: bl log2 @@ -4419,7 +4200,6 @@ define <3 x double> @constrained_vector_log2_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lfd 31, 56(1) # 8-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: lfd 30, 48(1) # 8-byte Folded Reload ; PC64LE9-NEXT: addi 1, 1, 64 ; PC64LE9-NEXT: ld 0, 16(1) @@ -4452,22 +4232,18 @@ define <4 x double> @constrained_vector_log2_v4f64(<4 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 62 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl log2 ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 62, 61, 1 ; PC64LE-NEXT: xxlor 1, 63, 63 ; PC64LE-NEXT: bl log2 ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl log2 ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 80 ; PC64LE-NEXT: vmr 2, 30 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 35, 61, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 64 @@ -4494,20 +4270,16 @@ define <4 x double> @constrained_vector_log2_v4f64(<4 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 62 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl log2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 62, 61, 1 ; PC64LE9-NEXT: xscpsgndp 1, 63, 63 ; PC64LE9-NEXT: bl log2 ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl log2 ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 35, 61, 1 ; PC64LE9-NEXT: vmr 2, 30 ; PC64LE9-NEXT: lxv 63, 64(1) # 16-byte Folded Reload @@ -4615,26 +4387,18 @@ define <3 x float> @constrained_vector_rint_v3f32(<3 x float> %x) #0 { define <3 x double> @constrained_vector_rint_v3f64(<3 x double> %x) #0 { ; PC64LE-LABEL: constrained_vector_rint_v3f64: ; PC64LE: # %bb.0: # %entry -; PC64LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 0, 2, 1 ; PC64LE-NEXT: xsrdpic 3, 3 ; PC64LE-NEXT: xvrdpic 2, 0 ; PC64LE-NEXT: xxswapd 1, 2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: blr ; ; PC64LE9-LABEL: constrained_vector_rint_v3f64: ; PC64LE9: # %bb.0: # %entry -; PC64LE9-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 0, 2, 1 ; PC64LE9-NEXT: xsrdpic 3, 3 ; PC64LE9-NEXT: xvrdpic 2, 0 ; PC64LE9-NEXT: xxswapd 1, 2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: blr entry: %rint = call <3 x double> @llvm.experimental.constrained.rint.v3f64( @@ -4712,11 +4476,9 @@ define <2 x double> @constrained_vector_nearbyint_v2f64(<2 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 62, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl nearbyint ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 64 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 34, 62, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 48 @@ -4739,10 +4501,8 @@ define <2 x double> @constrained_vector_nearbyint_v2f64(<2 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 62, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl nearbyint ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 34, 62, 1 ; PC64LE9-NEXT: lxv 63, 48(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lxv 62, 32(1) # 16-byte Folded Reload @@ -4865,7 +4625,6 @@ define <3 x double> @constrained_vector_nearby_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: fmr 1, 30 ; PC64LE-NEXT: bl nearbyint ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 63, 1, 63 ; PC64LE-NEXT: fmr 1, 31 ; PC64LE-NEXT: bl nearbyint @@ -4876,7 +4635,6 @@ define <3 x double> @constrained_vector_nearby_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: lfd 31, 72(1) # 8-byte Folded Reload ; PC64LE-NEXT: xxlor 2, 63, 63 ; PC64LE-NEXT: lfd 30, 64(1) # 8-byte Folded Reload -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: addi 1, 1, 80 ; PC64LE-NEXT: ld 0, 16(1) @@ -4899,7 +4657,6 @@ define <3 x double> @constrained_vector_nearby_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: fmr 1, 30 ; PC64LE9-NEXT: bl nearbyint ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 63, 1, 63 ; PC64LE9-NEXT: fmr 1, 31 ; PC64LE9-NEXT: bl nearbyint @@ -4909,7 +4666,6 @@ define <3 x double> @constrained_vector_nearby_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lfd 31, 56(1) # 8-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: lfd 30, 48(1) # 8-byte Folded Reload ; PC64LE9-NEXT: addi 1, 1, 64 ; PC64LE9-NEXT: ld 0, 16(1) @@ -4942,22 +4698,18 @@ define <4 x double> @constrained_vector_nearbyint_v4f64(<4 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 62 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl nearbyint ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 62, 61, 1 ; PC64LE-NEXT: xxlor 1, 63, 63 ; PC64LE-NEXT: bl nearbyint ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl nearbyint ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 80 ; PC64LE-NEXT: vmr 2, 30 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 35, 61, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 64 @@ -4984,20 +4736,16 @@ define <4 x double> @constrained_vector_nearbyint_v4f64(<4 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 62 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl nearbyint ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 62, 61, 1 ; PC64LE9-NEXT: xscpsgndp 1, 63, 63 ; PC64LE9-NEXT: bl nearbyint ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl nearbyint ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 35, 61, 1 ; PC64LE9-NEXT: vmr 2, 30 ; PC64LE9-NEXT: lxv 63, 64(1) # 16-byte Folded Reload @@ -5179,10 +4927,6 @@ define <3 x double> @constrained_vector_max_v3f64(<3 x double> %x, <3 x double> ; PC64LE-NEXT: mflr 0 ; PC64LE-NEXT: stdu 1, -64(1) ; PC64LE-NEXT: li 3, 48 -; PC64LE-NEXT: # kill: def $f5 killed $f5 def $vsl5 -; PC64LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; PC64LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 0, 5, 4 ; PC64LE-NEXT: xxmrghd 1, 2, 1 ; PC64LE-NEXT: std 0, 80(1) @@ -5195,7 +4939,6 @@ define <3 x double> @constrained_vector_max_v3f64(<3 x double> %x, <3 x double> ; PC64LE-NEXT: li 3, 48 ; PC64LE-NEXT: fmr 3, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: xxlor 2, 63, 63 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: addi 1, 1, 64 @@ -5207,10 +4950,6 @@ define <3 x double> @constrained_vector_max_v3f64(<3 x double> %x, <3 x double> ; PC64LE9: # %bb.0: # %entry ; PC64LE9-NEXT: mflr 0 ; PC64LE9-NEXT: stdu 1, -48(1) -; PC64LE9-NEXT: # kill: def $f5 killed $f5 def $vsl5 -; PC64LE9-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 0, 5, 4 ; PC64LE9-NEXT: xxmrghd 1, 2, 1 ; PC64LE9-NEXT: std 0, 64(1) @@ -5224,7 +4963,6 @@ define <3 x double> @constrained_vector_max_v3f64(<3 x double> %x, <3 x double> ; PC64LE9-NEXT: xxswapd 1, 63 ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: addi 1, 1, 48 ; PC64LE9-NEXT: ld 0, 16(1) ; PC64LE9-NEXT: mtlr 0 @@ -5421,10 +5159,6 @@ define <3 x double> @constrained_vector_min_v3f64(<3 x double> %x, <3 x double> ; PC64LE-NEXT: mflr 0 ; PC64LE-NEXT: stdu 1, -64(1) ; PC64LE-NEXT: li 3, 48 -; PC64LE-NEXT: # kill: def $f5 killed $f5 def $vsl5 -; PC64LE-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; PC64LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 0, 5, 4 ; PC64LE-NEXT: xxmrghd 1, 2, 1 ; PC64LE-NEXT: std 0, 80(1) @@ -5437,7 +5171,6 @@ define <3 x double> @constrained_vector_min_v3f64(<3 x double> %x, <3 x double> ; PC64LE-NEXT: li 3, 48 ; PC64LE-NEXT: fmr 3, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: xxlor 2, 63, 63 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: addi 1, 1, 64 @@ -5449,10 +5182,6 @@ define <3 x double> @constrained_vector_min_v3f64(<3 x double> %x, <3 x double> ; PC64LE9: # %bb.0: # %entry ; PC64LE9-NEXT: mflr 0 ; PC64LE9-NEXT: stdu 1, -48(1) -; PC64LE9-NEXT: # kill: def $f5 killed $f5 def $vsl5 -; PC64LE9-NEXT: # kill: def $f4 killed $f4 def $vsl4 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 0, 5, 4 ; PC64LE9-NEXT: xxmrghd 1, 2, 1 ; PC64LE9-NEXT: std 0, 64(1) @@ -5466,7 +5195,6 @@ define <3 x double> @constrained_vector_min_v3f64(<3 x double> %x, <3 x double> ; PC64LE9-NEXT: xxswapd 1, 63 ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: addi 1, 1, 48 ; PC64LE9-NEXT: ld 0, 16(1) ; PC64LE9-NEXT: mtlr 0 @@ -6792,26 +6520,18 @@ entry: define <3 x double> @constrained_vector_ceil_v3f64(<3 x double> %x) #0 { ; PC64LE-LABEL: constrained_vector_ceil_v3f64: ; PC64LE: # %bb.0: # %entry -; PC64LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 0, 2, 1 ; PC64LE-NEXT: xsrdpip 3, 3 ; PC64LE-NEXT: xvrdpip 2, 0 ; PC64LE-NEXT: xxswapd 1, 2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: blr ; ; PC64LE9-LABEL: constrained_vector_ceil_v3f64: ; PC64LE9: # %bb.0: # %entry -; PC64LE9-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 0, 2, 1 ; PC64LE9-NEXT: xsrdpip 3, 3 ; PC64LE9-NEXT: xvrdpip 2, 0 ; PC64LE9-NEXT: xxswapd 1, 2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: blr entry: %ceil = call <3 x double> @llvm.experimental.constrained.ceil.v3f64( @@ -6908,26 +6628,18 @@ entry: define <3 x double> @constrained_vector_floor_v3f64(<3 x double> %x) #0 { ; PC64LE-LABEL: constrained_vector_floor_v3f64: ; PC64LE: # %bb.0: # %entry -; PC64LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 0, 2, 1 ; PC64LE-NEXT: xsrdpim 3, 3 ; PC64LE-NEXT: xvrdpim 2, 0 ; PC64LE-NEXT: xxswapd 1, 2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: blr ; ; PC64LE9-LABEL: constrained_vector_floor_v3f64: ; PC64LE9: # %bb.0: # %entry -; PC64LE9-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 0, 2, 1 ; PC64LE9-NEXT: xsrdpim 3, 3 ; PC64LE9-NEXT: xvrdpim 2, 0 ; PC64LE9-NEXT: xxswapd 1, 2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: blr entry: %floor = call <3 x double> @llvm.experimental.constrained.floor.v3f64( @@ -7024,26 +6736,18 @@ entry: define <3 x double> @constrained_vector_round_v3f64(<3 x double> %x) #0 { ; PC64LE-LABEL: constrained_vector_round_v3f64: ; PC64LE: # %bb.0: # %entry -; PC64LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 0, 2, 1 ; PC64LE-NEXT: xsrdpi 3, 3 ; PC64LE-NEXT: xvrdpi 2, 0 ; PC64LE-NEXT: xxswapd 1, 2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: blr ; ; PC64LE9-LABEL: constrained_vector_round_v3f64: ; PC64LE9: # %bb.0: # %entry -; PC64LE9-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 0, 2, 1 ; PC64LE9-NEXT: xsrdpi 3, 3 ; PC64LE9-NEXT: xvrdpi 2, 0 ; PC64LE9-NEXT: xxswapd 1, 2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: blr entry: %round = call <3 x double> @llvm.experimental.constrained.round.v3f64( @@ -7139,26 +6843,18 @@ entry: define <3 x double> @constrained_vector_trunc_v3f64(<3 x double> %x) #0 { ; PC64LE-LABEL: constrained_vector_trunc_v3f64: ; PC64LE: # %bb.0: # %entry -; PC64LE-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 0, 2, 1 ; PC64LE-NEXT: xsrdpiz 3, 3 ; PC64LE-NEXT: xvrdpiz 2, 0 ; PC64LE-NEXT: xxswapd 1, 2 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE-NEXT: blr ; ; PC64LE9-LABEL: constrained_vector_trunc_v3f64: ; PC64LE9: # %bb.0: # %entry -; PC64LE9-NEXT: # kill: def $f2 killed $f2 def $vsl2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 0, 2, 1 ; PC64LE9-NEXT: xsrdpiz 3, 3 ; PC64LE9-NEXT: xvrdpiz 2, 0 ; PC64LE9-NEXT: xxswapd 1, 2 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PC64LE9-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PC64LE9-NEXT: blr entry: %trunc = call <3 x double> @llvm.experimental.constrained.trunc.v3f64( @@ -8350,11 +8046,9 @@ define <2 x double> @constrained_vector_tan_v2f64(<2 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 62, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl tan ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 64 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 34, 62, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 48 @@ -8377,10 +8071,8 @@ define <2 x double> @constrained_vector_tan_v2f64(<2 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 62, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl tan ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 34, 62, 1 ; PC64LE9-NEXT: lxv 63, 48(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lxv 62, 32(1) # 16-byte Folded Reload @@ -8503,7 +8195,6 @@ define <3 x double> @constrained_vector_tan_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: fmr 1, 30 ; PC64LE-NEXT: bl tan ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 63, 1, 63 ; PC64LE-NEXT: fmr 1, 31 ; PC64LE-NEXT: bl tan @@ -8514,7 +8205,6 @@ define <3 x double> @constrained_vector_tan_v3f64(<3 x double> %x) #0 { ; PC64LE-NEXT: lfd 31, 72(1) # 8-byte Folded Reload ; PC64LE-NEXT: xxlor 2, 63, 63 ; PC64LE-NEXT: lfd 30, 64(1) # 8-byte Folded Reload -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: addi 1, 1, 80 ; PC64LE-NEXT: ld 0, 16(1) @@ -8537,7 +8227,6 @@ define <3 x double> @constrained_vector_tan_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: fmr 1, 30 ; PC64LE9-NEXT: bl tan ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 63, 1, 63 ; PC64LE9-NEXT: fmr 1, 31 ; PC64LE9-NEXT: bl tan @@ -8547,7 +8236,6 @@ define <3 x double> @constrained_vector_tan_v3f64(<3 x double> %x) #0 { ; PC64LE9-NEXT: xscpsgndp 2, 63, 63 ; PC64LE9-NEXT: lxv 63, 32(1) # 16-byte Folded Reload ; PC64LE9-NEXT: lfd 31, 56(1) # 8-byte Folded Reload -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: lfd 30, 48(1) # 8-byte Folded Reload ; PC64LE9-NEXT: addi 1, 1, 64 ; PC64LE9-NEXT: ld 0, 16(1) @@ -8580,22 +8268,18 @@ define <4 x double> @constrained_vector_tan_v4f64(<4 x double> %x) #0 { ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 62 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl tan ; PC64LE-NEXT: nop -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 62, 61, 1 ; PC64LE-NEXT: xxlor 1, 63, 63 ; PC64LE-NEXT: bl tan ; PC64LE-NEXT: nop ; PC64LE-NEXT: xxlor 61, 1, 1 ; PC64LE-NEXT: xxswapd 1, 63 -; PC64LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE-NEXT: bl tan ; PC64LE-NEXT: nop ; PC64LE-NEXT: li 3, 80 ; PC64LE-NEXT: vmr 2, 30 -; PC64LE-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE-NEXT: xxmrghd 35, 61, 1 ; PC64LE-NEXT: lxvd2x 63, 1, 3 # 16-byte Folded Reload ; PC64LE-NEXT: li 3, 64 @@ -8622,20 +8306,16 @@ define <4 x double> @constrained_vector_tan_v4f64(<4 x double> %x) #0 { ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 62 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl tan ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 62, 61, 1 ; PC64LE9-NEXT: xscpsgndp 1, 63, 63 ; PC64LE9-NEXT: bl tan ; PC64LE9-NEXT: nop ; PC64LE9-NEXT: xscpsgndp 61, 1, 1 ; PC64LE9-NEXT: xxswapd 1, 63 -; PC64LE9-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PC64LE9-NEXT: bl tan ; PC64LE9-NEXT: nop -; PC64LE9-NEXT: # kill: def $f1 killed $f1 def $vsl1 ; PC64LE9-NEXT: xxmrghd 35, 61, 1 ; PC64LE9-NEXT: vmr 2, 30 ; PC64LE9-NEXT: lxv 63, 64(1) # 16-byte Folded Reload diff --git a/llvm/test/CodeGen/PowerPC/vector-llrint.ll b/llvm/test/CodeGen/PowerPC/vector-llrint.ll index 4321b213b631c..190cf6fe1eaad 100644 --- a/llvm/test/CodeGen/PowerPC/vector-llrint.ll +++ b/llvm/test/CodeGen/PowerPC/vector-llrint.ll @@ -4465,9 +4465,8 @@ define <2 x i64> @llrint_v2i64_v2f64(<2 x double> %x) { ; BE-NEXT: xxlor f1, v31, v31 ; BE-NEXT: bl llrint ; BE-NEXT: nop -; BE-NEXT: std r3, 128(r1) ; BE-NEXT: xxswapd vs1, v31 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 128(r1) ; BE-NEXT: bl llrint ; BE-NEXT: nop ; BE-NEXT: std r3, 136(r1) @@ -4496,7 +4495,6 @@ define <2 x i64> @llrint_v2i64_v2f64(<2 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v31 ; CHECK-NEXT: mtvsrd v31, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl llrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 @@ -4544,18 +4542,16 @@ define <4 x i64> @llrint_v4i64_v4f64(<4 x double> %x) { ; BE-NEXT: vmr v31, v3 ; BE-NEXT: bl llrint ; BE-NEXT: nop -; BE-NEXT: std r3, 128(r1) ; BE-NEXT: xxswapd vs1, v30 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 128(r1) ; BE-NEXT: bl llrint ; BE-NEXT: nop ; BE-NEXT: xxlor f1, v31, v31 ; BE-NEXT: std r3, 136(r1) ; BE-NEXT: bl llrint ; BE-NEXT: nop -; BE-NEXT: std r3, 144(r1) ; BE-NEXT: xxswapd vs1, v31 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 144(r1) ; BE-NEXT: bl llrint ; BE-NEXT: nop ; BE-NEXT: std r3, 152(r1) @@ -4592,7 +4588,6 @@ define <4 x i64> @llrint_v4i64_v4f64(<4 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v30 ; CHECK-NEXT: mtvsrd v30, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl llrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 @@ -4602,7 +4597,6 @@ define <4 x i64> @llrint_v4i64_v4f64(<4 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v31 ; CHECK-NEXT: mtvsrd v31, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl llrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 @@ -4670,36 +4664,32 @@ define <8 x i64> @llrint_v8i64_v8f64(<8 x double> %x) { ; BE-NEXT: vmr v31, v5 ; BE-NEXT: bl llrint ; BE-NEXT: nop -; BE-NEXT: std r3, 128(r1) ; BE-NEXT: xxswapd vs1, v28 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 128(r1) ; BE-NEXT: bl llrint ; BE-NEXT: nop ; BE-NEXT: xxlor f1, v29, v29 ; BE-NEXT: std r3, 136(r1) ; BE-NEXT: bl llrint ; BE-NEXT: nop -; BE-NEXT: std r3, 144(r1) ; BE-NEXT: xxswapd vs1, v29 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 144(r1) ; BE-NEXT: bl llrint ; BE-NEXT: nop ; BE-NEXT: xxlor f1, v30, v30 ; BE-NEXT: std r3, 152(r1) ; BE-NEXT: bl llrint ; BE-NEXT: nop -; BE-NEXT: std r3, 160(r1) ; BE-NEXT: xxswapd vs1, v30 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 160(r1) ; BE-NEXT: bl llrint ; BE-NEXT: nop ; BE-NEXT: xxlor f1, v31, v31 ; BE-NEXT: std r3, 168(r1) ; BE-NEXT: bl llrint ; BE-NEXT: nop -; BE-NEXT: std r3, 176(r1) ; BE-NEXT: xxswapd vs1, v31 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 176(r1) ; BE-NEXT: bl llrint ; BE-NEXT: nop ; BE-NEXT: std r3, 184(r1) @@ -4752,7 +4742,6 @@ define <8 x i64> @llrint_v8i64_v8f64(<8 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v28 ; CHECK-NEXT: mtvsrd v28, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl llrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 @@ -4762,7 +4751,6 @@ define <8 x i64> @llrint_v8i64_v8f64(<8 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v29 ; CHECK-NEXT: mtvsrd v29, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl llrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 @@ -4772,7 +4760,6 @@ define <8 x i64> @llrint_v8i64_v8f64(<8 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v30 ; CHECK-NEXT: mtvsrd v30, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl llrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 @@ -4782,7 +4769,6 @@ define <8 x i64> @llrint_v8i64_v8f64(<8 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v31 ; CHECK-NEXT: mtvsrd v31, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl llrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 diff --git a/llvm/test/CodeGen/PowerPC/vector-lrint.ll b/llvm/test/CodeGen/PowerPC/vector-lrint.ll index 9667a26120149..b6d0bd5c05894 100644 --- a/llvm/test/CodeGen/PowerPC/vector-lrint.ll +++ b/llvm/test/CodeGen/PowerPC/vector-lrint.ll @@ -4476,9 +4476,8 @@ define <2 x i64> @lrint_v2f64(<2 x double> %x) { ; BE-NEXT: xxlor f1, v31, v31 ; BE-NEXT: bl lrint ; BE-NEXT: nop -; BE-NEXT: std r3, 128(r1) ; BE-NEXT: xxswapd vs1, v31 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 128(r1) ; BE-NEXT: bl lrint ; BE-NEXT: nop ; BE-NEXT: std r3, 136(r1) @@ -4507,7 +4506,6 @@ define <2 x i64> @lrint_v2f64(<2 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v31 ; CHECK-NEXT: mtvsrd v31, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl lrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 @@ -4555,18 +4553,16 @@ define <4 x i64> @lrint_v4f64(<4 x double> %x) { ; BE-NEXT: vmr v31, v3 ; BE-NEXT: bl lrint ; BE-NEXT: nop -; BE-NEXT: std r3, 128(r1) ; BE-NEXT: xxswapd vs1, v30 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 128(r1) ; BE-NEXT: bl lrint ; BE-NEXT: nop ; BE-NEXT: xxlor f1, v31, v31 ; BE-NEXT: std r3, 136(r1) ; BE-NEXT: bl lrint ; BE-NEXT: nop -; BE-NEXT: std r3, 144(r1) ; BE-NEXT: xxswapd vs1, v31 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 144(r1) ; BE-NEXT: bl lrint ; BE-NEXT: nop ; BE-NEXT: std r3, 152(r1) @@ -4603,7 +4599,6 @@ define <4 x i64> @lrint_v4f64(<4 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v30 ; CHECK-NEXT: mtvsrd v30, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl lrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 @@ -4613,7 +4608,6 @@ define <4 x i64> @lrint_v4f64(<4 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v31 ; CHECK-NEXT: mtvsrd v31, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl lrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 @@ -4681,36 +4675,32 @@ define <8 x i64> @lrint_v8f64(<8 x double> %x) { ; BE-NEXT: vmr v31, v5 ; BE-NEXT: bl lrint ; BE-NEXT: nop -; BE-NEXT: std r3, 128(r1) ; BE-NEXT: xxswapd vs1, v28 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 128(r1) ; BE-NEXT: bl lrint ; BE-NEXT: nop ; BE-NEXT: xxlor f1, v29, v29 ; BE-NEXT: std r3, 136(r1) ; BE-NEXT: bl lrint ; BE-NEXT: nop -; BE-NEXT: std r3, 144(r1) ; BE-NEXT: xxswapd vs1, v29 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 144(r1) ; BE-NEXT: bl lrint ; BE-NEXT: nop ; BE-NEXT: xxlor f1, v30, v30 ; BE-NEXT: std r3, 152(r1) ; BE-NEXT: bl lrint ; BE-NEXT: nop -; BE-NEXT: std r3, 160(r1) ; BE-NEXT: xxswapd vs1, v30 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 160(r1) ; BE-NEXT: bl lrint ; BE-NEXT: nop ; BE-NEXT: xxlor f1, v31, v31 ; BE-NEXT: std r3, 168(r1) ; BE-NEXT: bl lrint ; BE-NEXT: nop -; BE-NEXT: std r3, 176(r1) ; BE-NEXT: xxswapd vs1, v31 -; BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 +; BE-NEXT: std r3, 176(r1) ; BE-NEXT: bl lrint ; BE-NEXT: nop ; BE-NEXT: std r3, 184(r1) @@ -4763,7 +4753,6 @@ define <8 x i64> @lrint_v8f64(<8 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v28 ; CHECK-NEXT: mtvsrd v28, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl lrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 @@ -4773,7 +4762,6 @@ define <8 x i64> @lrint_v8f64(<8 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v29 ; CHECK-NEXT: mtvsrd v29, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl lrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 @@ -4783,7 +4771,6 @@ define <8 x i64> @lrint_v8f64(<8 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v30 ; CHECK-NEXT: mtvsrd v30, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl lrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 @@ -4793,7 +4780,6 @@ define <8 x i64> @lrint_v8f64(<8 x double> %x) { ; CHECK-NEXT: nop ; CHECK-NEXT: xxswapd vs1, v31 ; CHECK-NEXT: mtvsrd v31, r3 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: bl lrint ; CHECK-NEXT: nop ; CHECK-NEXT: mtfprd f0, r3 diff --git a/llvm/test/CodeGen/PowerPC/vector-reduce-fadd.ll b/llvm/test/CodeGen/PowerPC/vector-reduce-fadd.ll index edd3fb7b1754b..4a036a7868c1a 100644 --- a/llvm/test/CodeGen/PowerPC/vector-reduce-fadd.ll +++ b/llvm/test/CodeGen/PowerPC/vector-reduce-fadd.ll @@ -1081,14 +1081,12 @@ define dso_local double @v2f64_fast(<2 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs0, v2 ; PWR9LE-NEXT: xvadddp vs0, v2, vs0 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v2f64_fast: ; PWR9BE: # %bb.0: # %entry ; PWR9BE-NEXT: xxswapd vs0, v2 ; PWR9BE-NEXT: xvadddp vs1, v2, vs0 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v2f64_fast: @@ -1096,14 +1094,12 @@ define dso_local double @v2f64_fast(<2 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs0, v2 ; PWR10LE-NEXT: xvadddp vs0, v2, vs0 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v2f64_fast: ; PWR10BE: # %bb.0: # %entry ; PWR10BE-NEXT: xxswapd vs0, v2 ; PWR10BE-NEXT: xvadddp vs1, v2, vs0 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fadd.v2f64(double -0.000000e+00, <2 x double> %a) @@ -1203,7 +1199,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvadddp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v4f64_fast: @@ -1211,7 +1206,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvadddp vs0, v2, v3 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvadddp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v4f64_fast: @@ -1220,7 +1214,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvadddp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v4f64_fast: @@ -1228,7 +1221,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvadddp vs0, v2, v3 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvadddp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fadd.v4f64(double -0.000000e+00, <4 x double> %a) @@ -1378,7 +1370,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvadddp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v8f64_fast: @@ -1388,7 +1379,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvadddp vs0, vs1, vs0 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvadddp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v8f64_fast: @@ -1399,7 +1389,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvadddp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v8f64_fast: @@ -1409,7 +1398,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvadddp vs0, vs1, vs0 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvadddp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fadd.v8f64(double -0.000000e+00, <8 x double> %a) @@ -1659,7 +1647,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvadddp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v16f64_fast: @@ -1673,7 +1660,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvadddp vs0, vs0, vs2 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvadddp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v16f64_fast: @@ -1688,7 +1674,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvadddp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v16f64_fast: @@ -1702,7 +1687,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvadddp vs0, vs0, vs2 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvadddp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fadd.v16f64(double -0.000000e+00, <16 x double> %a) @@ -2188,7 +2172,6 @@ define dso_local double @v32f64_fast(<32 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvadddp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v32f64_fast: @@ -2214,7 +2197,6 @@ define dso_local double @v32f64_fast(<32 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvadddp vs0, vs0, vs2 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvadddp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v32f64_fast: @@ -2241,7 +2223,6 @@ define dso_local double @v32f64_fast(<32 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvadddp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v32f64_fast: @@ -2267,7 +2248,6 @@ define dso_local double @v32f64_fast(<32 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvadddp vs0, vs0, vs2 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvadddp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fadd.v32f64(double -0.000000e+00, <32 x double> %a) @@ -3297,7 +3277,6 @@ define dso_local double @v64f64_fast(<64 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvadddp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v64f64_fast: @@ -3355,7 +3334,6 @@ define dso_local double @v64f64_fast(<64 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvadddp vs0, vs1, vs0 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvadddp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v64f64_fast: @@ -3414,7 +3392,6 @@ define dso_local double @v64f64_fast(<64 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvadddp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v64f64_fast: @@ -3472,7 +3449,6 @@ define dso_local double @v64f64_fast(<64 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvadddp vs0, vs1, vs0 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvadddp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fadd.v64f64(double -0.000000e+00, <64 x double> %a) @@ -3660,8 +3636,6 @@ define dso_local ppc_fp128 @v2ppcf128_fast(<2 x ppc_fp128> %a) local_unnamed_add ; PWR9LE-NEXT: stfd f1, 32(r1) ; PWR9LE-NEXT: lxv vs1, 32(r1) ; PWR9LE-NEXT: xxswapd vs2, vs1 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PWR9LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PWR9LE-NEXT: addi r1, r1, 64 ; PWR9LE-NEXT: ld r0, 16(r1) ; PWR9LE-NEXT: mtlr r0 @@ -3678,8 +3652,6 @@ define dso_local ppc_fp128 @v2ppcf128_fast(<2 x ppc_fp128> %a) local_unnamed_add ; PWR9BE-NEXT: stfd f1, 112(r1) ; PWR9BE-NEXT: lxv vs1, 112(r1) ; PWR9BE-NEXT: xxswapd vs2, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PWR9BE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PWR9BE-NEXT: addi r1, r1, 144 ; PWR9BE-NEXT: ld r0, 16(r1) ; PWR9BE-NEXT: mtlr r0 @@ -3695,8 +3667,6 @@ define dso_local ppc_fp128 @v2ppcf128_fast(<2 x ppc_fp128> %a) local_unnamed_add ; PWR10LE-NEXT: stfd f1, 32(r1) ; PWR10LE-NEXT: lxv vs1, 32(r1) ; PWR10LE-NEXT: xxswapd vs2, vs1 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PWR10LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PWR10LE-NEXT: addi r1, r1, 64 ; PWR10LE-NEXT: ld r0, 16(r1) ; PWR10LE-NEXT: mtlr r0 @@ -3713,8 +3683,6 @@ define dso_local ppc_fp128 @v2ppcf128_fast(<2 x ppc_fp128> %a) local_unnamed_add ; PWR10BE-NEXT: stfd f1, 112(r1) ; PWR10BE-NEXT: lxv vs1, 112(r1) ; PWR10BE-NEXT: xxswapd vs2, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PWR10BE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PWR10BE-NEXT: addi r1, r1, 144 ; PWR10BE-NEXT: ld r0, 16(r1) ; PWR10BE-NEXT: mtlr r0 @@ -4077,8 +4045,6 @@ define dso_local ppc_fp128 @v4ppcf128_fast(<4 x ppc_fp128> %a) local_unnamed_add ; PWR9LE-NEXT: stfd f1, 32(r1) ; PWR9LE-NEXT: lxv vs1, 32(r1) ; PWR9LE-NEXT: xxswapd vs2, vs1 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PWR9LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PWR9LE-NEXT: addi r1, r1, 96 ; PWR9LE-NEXT: ld r0, 16(r1) ; PWR9LE-NEXT: lfd f31, -8(r1) # 8-byte Folded Reload @@ -4133,8 +4099,6 @@ define dso_local ppc_fp128 @v4ppcf128_fast(<4 x ppc_fp128> %a) local_unnamed_add ; PWR9BE-NEXT: lfd f28, 144(r1) # 8-byte Folded Reload ; PWR9BE-NEXT: lfd f27, 136(r1) # 8-byte Folded Reload ; PWR9BE-NEXT: lfd f26, 128(r1) # 8-byte Folded Reload -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PWR9BE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PWR9BE-NEXT: addi r1, r1, 176 ; PWR9BE-NEXT: ld r0, 16(r1) ; PWR9BE-NEXT: mtlr r0 @@ -4174,8 +4138,6 @@ define dso_local ppc_fp128 @v4ppcf128_fast(<4 x ppc_fp128> %a) local_unnamed_add ; PWR10LE-NEXT: stfd f1, 32(r1) ; PWR10LE-NEXT: lxv vs1, 32(r1) ; PWR10LE-NEXT: xxswapd vs2, vs1 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PWR10LE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PWR10LE-NEXT: addi r1, r1, 96 ; PWR10LE-NEXT: ld r0, 16(r1) ; PWR10LE-NEXT: lfd f31, -8(r1) # 8-byte Folded Reload @@ -4230,8 +4192,6 @@ define dso_local ppc_fp128 @v4ppcf128_fast(<4 x ppc_fp128> %a) local_unnamed_add ; PWR10BE-NEXT: lfd f26, 128(r1) # 8-byte Folded Reload ; PWR10BE-NEXT: lxv vs1, 112(r1) ; PWR10BE-NEXT: xxswapd vs2, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 -; PWR10BE-NEXT: # kill: def $f2 killed $f2 killed $vsl2 ; PWR10BE-NEXT: addi r1, r1, 176 ; PWR10BE-NEXT: ld r0, 16(r1) ; PWR10BE-NEXT: mtlr r0 diff --git a/llvm/test/CodeGen/PowerPC/vector-reduce-fmax.ll b/llvm/test/CodeGen/PowerPC/vector-reduce-fmax.ll index b1f72f694aea5..7d024144b7c32 100644 --- a/llvm/test/CodeGen/PowerPC/vector-reduce-fmax.ll +++ b/llvm/test/CodeGen/PowerPC/vector-reduce-fmax.ll @@ -635,14 +635,12 @@ define dso_local double @v2f64_fast(<2 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs0, v2 ; PWR9LE-NEXT: xvmaxdp vs0, v2, vs0 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v2f64_fast: ; PWR9BE: # %bb.0: # %entry ; PWR9BE-NEXT: xxswapd vs0, v2 ; PWR9BE-NEXT: xvmaxdp vs1, v2, vs0 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v2f64_fast: @@ -650,14 +648,12 @@ define dso_local double @v2f64_fast(<2 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs0, v2 ; PWR10LE-NEXT: xvmaxdp vs0, v2, vs0 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v2f64_fast: ; PWR10BE: # %bb.0: # %entry ; PWR10BE-NEXT: xxswapd vs0, v2 ; PWR10BE-NEXT: xvmaxdp vs1, v2, vs0 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmax.v2f64(<2 x double> %a) @@ -704,7 +700,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvmaxdp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v4f64_fast: @@ -712,7 +707,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvmaxdp vs0, v2, v3 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvmaxdp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v4f64_fast: @@ -721,7 +715,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvmaxdp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v4f64_fast: @@ -729,7 +722,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvmaxdp vs0, v2, v3 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvmaxdp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmax.v4f64(<4 x double> %a) @@ -786,7 +778,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvmaxdp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v8f64_fast: @@ -796,7 +787,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvmaxdp vs0, vs1, vs0 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvmaxdp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v8f64_fast: @@ -807,7 +797,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvmaxdp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v8f64_fast: @@ -817,7 +806,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvmaxdp vs0, vs1, vs0 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvmaxdp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmax.v8f64(<8 x double> %a) @@ -894,7 +882,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvmaxdp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v16f64_fast: @@ -908,7 +895,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvmaxdp vs0, vs0, vs2 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvmaxdp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v16f64_fast: @@ -923,7 +909,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvmaxdp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v16f64_fast: @@ -937,7 +922,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvmaxdp vs0, vs0, vs2 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvmaxdp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmax.v16f64(<16 x double> %a) @@ -1074,7 +1058,6 @@ define dso_local double @v32f64_fast(<32 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvmaxdp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v32f64_fast: @@ -1100,7 +1083,6 @@ define dso_local double @v32f64_fast(<32 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvmaxdp vs0, vs0, vs2 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvmaxdp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v32f64_fast: @@ -1127,7 +1109,6 @@ define dso_local double @v32f64_fast(<32 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvmaxdp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v32f64_fast: @@ -1153,7 +1134,6 @@ define dso_local double @v32f64_fast(<32 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvmaxdp vs0, vs0, vs2 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvmaxdp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmax.v32f64(<32 x double> %a) diff --git a/llvm/test/CodeGen/PowerPC/vector-reduce-fmin.ll b/llvm/test/CodeGen/PowerPC/vector-reduce-fmin.ll index e806a702cd62b..9b01889b91f6e 100644 --- a/llvm/test/CodeGen/PowerPC/vector-reduce-fmin.ll +++ b/llvm/test/CodeGen/PowerPC/vector-reduce-fmin.ll @@ -635,14 +635,12 @@ define dso_local double @v2f64_fast(<2 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs0, v2 ; PWR9LE-NEXT: xvmindp vs0, v2, vs0 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v2f64_fast: ; PWR9BE: # %bb.0: # %entry ; PWR9BE-NEXT: xxswapd vs0, v2 ; PWR9BE-NEXT: xvmindp vs1, v2, vs0 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v2f64_fast: @@ -650,14 +648,12 @@ define dso_local double @v2f64_fast(<2 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs0, v2 ; PWR10LE-NEXT: xvmindp vs0, v2, vs0 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v2f64_fast: ; PWR10BE: # %bb.0: # %entry ; PWR10BE-NEXT: xxswapd vs0, v2 ; PWR10BE-NEXT: xvmindp vs1, v2, vs0 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmin.v2f64(<2 x double> %a) @@ -704,7 +700,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvmindp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v4f64_fast: @@ -712,7 +707,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvmindp vs0, v2, v3 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvmindp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v4f64_fast: @@ -721,7 +715,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvmindp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v4f64_fast: @@ -729,7 +722,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvmindp vs0, v2, v3 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvmindp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmin.v4f64(<4 x double> %a) @@ -786,7 +778,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvmindp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v8f64_fast: @@ -796,7 +787,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvmindp vs0, vs1, vs0 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvmindp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v8f64_fast: @@ -807,7 +797,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvmindp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v8f64_fast: @@ -817,7 +806,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvmindp vs0, vs1, vs0 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvmindp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmin.v8f64(<8 x double> %a) @@ -894,7 +882,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvmindp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v16f64_fast: @@ -908,7 +895,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvmindp vs0, vs0, vs2 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvmindp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v16f64_fast: @@ -923,7 +909,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvmindp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v16f64_fast: @@ -937,7 +922,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvmindp vs0, vs0, vs2 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvmindp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmin.v16f64(<16 x double> %a) @@ -1074,7 +1058,6 @@ define dso_local double @v32f64_fast(<32 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvmindp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v32f64_fast: @@ -1100,7 +1083,6 @@ define dso_local double @v32f64_fast(<32 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvmindp vs0, vs0, vs2 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvmindp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v32f64_fast: @@ -1127,7 +1109,6 @@ define dso_local double @v32f64_fast(<32 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvmindp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v32f64_fast: @@ -1153,7 +1134,6 @@ define dso_local double @v32f64_fast(<32 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvmindp vs0, vs0, vs2 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvmindp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmin.v32f64(<32 x double> %a) diff --git a/llvm/test/CodeGen/PowerPC/vector-reduce-fmul.ll b/llvm/test/CodeGen/PowerPC/vector-reduce-fmul.ll index e123f5c2056d6..b566bb9d2d911 100644 --- a/llvm/test/CodeGen/PowerPC/vector-reduce-fmul.ll +++ b/llvm/test/CodeGen/PowerPC/vector-reduce-fmul.ll @@ -1081,14 +1081,12 @@ define dso_local double @v2f64_fast(<2 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs0, v2 ; PWR9LE-NEXT: xvmuldp vs0, v2, vs0 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v2f64_fast: ; PWR9BE: # %bb.0: # %entry ; PWR9BE-NEXT: xxswapd vs0, v2 ; PWR9BE-NEXT: xvmuldp vs1, v2, vs0 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v2f64_fast: @@ -1096,14 +1094,12 @@ define dso_local double @v2f64_fast(<2 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs0, v2 ; PWR10LE-NEXT: xvmuldp vs0, v2, vs0 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v2f64_fast: ; PWR10BE: # %bb.0: # %entry ; PWR10BE-NEXT: xxswapd vs0, v2 ; PWR10BE-NEXT: xvmuldp vs1, v2, vs0 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmul.v2f64(double 1.000000e+00, <2 x double> %a) @@ -1203,7 +1199,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvmuldp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v4f64_fast: @@ -1211,7 +1206,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvmuldp vs0, v2, v3 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvmuldp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v4f64_fast: @@ -1220,7 +1214,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvmuldp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v4f64_fast: @@ -1228,7 +1221,6 @@ define dso_local double @v4f64_fast(<4 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvmuldp vs0, v2, v3 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvmuldp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmul.v4f64(double 1.000000e+00, <4 x double> %a) @@ -1378,7 +1370,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvmuldp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v8f64_fast: @@ -1388,7 +1379,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvmuldp vs0, vs1, vs0 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvmuldp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v8f64_fast: @@ -1399,7 +1389,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvmuldp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v8f64_fast: @@ -1409,7 +1398,6 @@ define dso_local double @v8f64_fast(<8 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvmuldp vs0, vs1, vs0 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvmuldp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmul.v8f64(double 1.000000e+00, <8 x double> %a) @@ -1659,7 +1647,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR9LE-NEXT: xxswapd vs1, vs0 ; PWR9LE-NEXT: xvmuldp vs0, vs0, vs1 ; PWR9LE-NEXT: xxswapd vs1, vs0 -; PWR9LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9LE-NEXT: blr ; ; PWR9BE-LABEL: v16f64_fast: @@ -1673,7 +1660,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR9BE-NEXT: xvmuldp vs0, vs0, vs2 ; PWR9BE-NEXT: xxswapd vs1, vs0 ; PWR9BE-NEXT: xvmuldp vs1, vs0, vs1 -; PWR9BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR9BE-NEXT: blr ; ; PWR10LE-LABEL: v16f64_fast: @@ -1688,7 +1674,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR10LE-NEXT: xxswapd vs1, vs0 ; PWR10LE-NEXT: xvmuldp vs0, vs0, vs1 ; PWR10LE-NEXT: xxswapd vs1, vs0 -; PWR10LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10LE-NEXT: blr ; ; PWR10BE-LABEL: v16f64_fast: @@ -1702,7 +1687,6 @@ define dso_local double @v16f64_fast(<16 x double> %a) local_unnamed_addr #0 { ; PWR10BE-NEXT: xvmuldp vs0, vs0, vs2 ; PWR10BE-NEXT: xxswapd vs1, vs0 ; PWR10BE-NEXT: xvmuldp vs1, vs0, vs1 -; PWR10BE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; PWR10BE-NEXT: blr entry: %0 = call fast double @llvm.vector.reduce.fmul.v16f64(double 1.000000e+00, <16 x double> %a) diff --git a/llvm/test/CodeGen/PowerPC/vsx.ll b/llvm/test/CodeGen/PowerPC/vsx.ll index 32cbfd6d810ac..d1d29a0f884c6 100644 --- a/llvm/test/CodeGen/PowerPC/vsx.ll +++ b/llvm/test/CodeGen/PowerPC/vsx.ll @@ -1993,7 +1993,6 @@ define double @test63(<2 x double> %a) { ; CHECK-LE-LABEL: test63: ; CHECK-LE: # %bb.0: ; CHECK-LE-NEXT: xxswapd vs1, v2 -; CHECK-LE-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-LE-NEXT: blr %v = extractelement <2 x double> %a, i32 0 ret double %v @@ -2006,13 +2005,11 @@ define double @test64(<2 x double> %a) { ; CHECK-LABEL: test64: ; CHECK: # %bb.0: ; CHECK-NEXT: xxswapd vs1, v2 -; CHECK-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-NEXT: blr ; ; CHECK-REG-LABEL: test64: ; CHECK-REG: # %bb.0: ; CHECK-REG-NEXT: xxswapd vs1, v2 -; CHECK-REG-NEXT: # kill: def $f1 killed $f1 killed $vsl1 ; CHECK-REG-NEXT: blr ; ; CHECK-FISL-LABEL: test64: diff --git a/llvm/test/CodeGen/RISCV/inline-asm-mem-constraint.ll b/llvm/test/CodeGen/RISCV/inline-asm-mem-constraint.ll index 52d0dabf18839..6666d92feaac2 100644 --- a/llvm/test/CodeGen/RISCV/inline-asm-mem-constraint.ll +++ b/llvm/test/CodeGen/RISCV/inline-asm-mem-constraint.ll @@ -2252,3 +2252,53 @@ label: call void asm "lw zero, $0", "*A"(ptr elementtype(i32) getelementptr (i8, ptr blockaddress(@constraint_A_with_local_3, %label), i32 2000)) ret void } + +@_ZN5repro9MY_BUFFER17hb0f674501d5980a6E = external global <{ [16 x i8] }> + +; Address is not used by a memory constraint. +define void @should_not_fold() { +; RV32I-LABEL: should_not_fold: +; RV32I: # %bb.0: # %start +; RV32I-NEXT: .cfi_def_cfa_offset 0 +; RV32I-NEXT: lui a0, %hi(_ZN5repro9MY_BUFFER17hb0f674501d5980a6E) +; RV32I-NEXT: addi a0, a0, %lo(_ZN5repro9MY_BUFFER17hb0f674501d5980a6E) +; RV32I-NEXT: #APP +; RV32I-NEXT: ecall +; RV32I-NEXT: #NO_APP +; RV32I-NEXT: ret +; +; RV64I-LABEL: should_not_fold: +; RV64I: # %bb.0: # %start +; RV64I-NEXT: .cfi_def_cfa_offset 0 +; RV64I-NEXT: lui a0, %hi(_ZN5repro9MY_BUFFER17hb0f674501d5980a6E) +; RV64I-NEXT: addi a0, a0, %lo(_ZN5repro9MY_BUFFER17hb0f674501d5980a6E) +; RV64I-NEXT: #APP +; RV64I-NEXT: ecall +; RV64I-NEXT: #NO_APP +; RV64I-NEXT: ret +; +; RV32I-MEDIUM-LABEL: should_not_fold: +; RV32I-MEDIUM: # %bb.0: # %start +; RV32I-MEDIUM-NEXT: .cfi_def_cfa_offset 0 +; RV32I-MEDIUM-NEXT: .Lpcrel_hi39: +; RV32I-MEDIUM-NEXT: auipc a0, %pcrel_hi(_ZN5repro9MY_BUFFER17hb0f674501d5980a6E) +; RV32I-MEDIUM-NEXT: addi a0, a0, %pcrel_lo(.Lpcrel_hi39) +; RV32I-MEDIUM-NEXT: #APP +; RV32I-MEDIUM-NEXT: ecall +; RV32I-MEDIUM-NEXT: #NO_APP +; RV32I-MEDIUM-NEXT: ret +; +; RV64I-MEDIUM-LABEL: should_not_fold: +; RV64I-MEDIUM: # %bb.0: # %start +; RV64I-MEDIUM-NEXT: .cfi_def_cfa_offset 0 +; RV64I-MEDIUM-NEXT: .Lpcrel_hi39: +; RV64I-MEDIUM-NEXT: auipc a0, %pcrel_hi(_ZN5repro9MY_BUFFER17hb0f674501d5980a6E) +; RV64I-MEDIUM-NEXT: addi a0, a0, %pcrel_lo(.Lpcrel_hi39) +; RV64I-MEDIUM-NEXT: #APP +; RV64I-MEDIUM-NEXT: ecall +; RV64I-MEDIUM-NEXT: #NO_APP +; RV64I-MEDIUM-NEXT: ret +start: + %0 = tail call ptr asm sideeffect alignstack "ecall", "=&{x10},0,~{vtype},~{vl},~{vxsat},~{vxrm},~{memory}"(ptr @_ZN5repro9MY_BUFFER17hb0f674501d5980a6E) + ret void +} diff --git a/llvm/test/CodeGen/RISCV/machineoutliner-pcrel-lo.mir b/llvm/test/CodeGen/RISCV/machineoutliner-pcrel-lo.mir index 8a83543b0280f..fd3630bcfad25 100644 --- a/llvm/test/CodeGen/RISCV/machineoutliner-pcrel-lo.mir +++ b/llvm/test/CodeGen/RISCV/machineoutliner-pcrel-lo.mir @@ -18,6 +18,9 @@ define i32 @foo2(i32 %a, i32 %b) comdat { ret i32 0 } define i32 @foo3(i32 %a, i32 %b) section ".abc" { ret i32 0 } + + define i32 @foo4(i32 %a, i32 %b) !section_prefix !0 { ret i32 0 } + !0 = !{!"function_section_prefix", !"myprefix"} ... --- name: foo @@ -27,23 +30,24 @@ body: | ; CHECK: bb.0: ; CHECK-NEXT: liveins: $x10, $x11, $x13 ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11, implicit $x13 + ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_1, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11, implicit $x13 ; CHECK-NEXT: PseudoBR %bb.3 ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: bb.1: ; CHECK-NEXT: liveins: $x10, $x11, $x13 ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11, implicit $x13 + ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_1, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11, implicit $x13 ; CHECK-NEXT: PseudoBR %bb.3 ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: bb.2: ; CHECK-NEXT: liveins: $x10, $x11, $x13 ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11, implicit $x13 + ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_1, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11, implicit $x13 ; CHECK-NEXT: PseudoBR %bb.3 ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: bb.3: ; CHECK-NEXT: PseudoRET + ; ; CHECK-FS-LABEL: name: foo ; CHECK-FS: bb.0: ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13 @@ -109,26 +113,27 @@ body: | ; CHECK: bb.0: ; CHECK-NEXT: liveins: $x10, $x11, $x13 ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_1, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11 + ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11 ; CHECK-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) :: (dereferenceable load (s32) from @bar) ; CHECK-NEXT: PseudoBR %bb.3 ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: bb.1: ; CHECK-NEXT: liveins: $x10, $x11, $x13 ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_1, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11 + ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11 ; CHECK-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) :: (dereferenceable load (s32) from @bar) ; CHECK-NEXT: PseudoBR %bb.3 ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: bb.2: ; CHECK-NEXT: liveins: $x10, $x11, $x13 ; CHECK-NEXT: {{ $}} - ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_1, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11 + ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11 ; CHECK-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) :: (dereferenceable load (s32) from @bar) ; CHECK-NEXT: PseudoBR %bb.3 ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: bb.3: ; CHECK-NEXT: PseudoRET + ; ; CHECK-FS-LABEL: name: foo2 ; CHECK-FS: bb.0: ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13 @@ -223,6 +228,7 @@ body: | ; CHECK-NEXT: {{ $}} ; CHECK-NEXT: bb.3: ; CHECK-NEXT: PseudoRET + ; ; CHECK-FS-LABEL: name: foo3 ; CHECK-FS: bb.0: ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13 @@ -289,3 +295,89 @@ body: | bb.3: PseudoRET ... +--- +name: foo4 +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: foo4 + ; CHECK: bb.0: + ; CHECK-NEXT: liveins: $x10, $x11, $x13 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11 + ; CHECK-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) :: (dereferenceable load (s32) from @bar) + ; CHECK-NEXT: PseudoBR %bb.3 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: liveins: $x10, $x11, $x13 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11 + ; CHECK-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) :: (dereferenceable load (s32) from @bar) + ; CHECK-NEXT: PseudoBR %bb.3 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.2: + ; CHECK-NEXT: liveins: $x10, $x11, $x13 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11 + ; CHECK-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) :: (dereferenceable load (s32) from @bar) + ; CHECK-NEXT: PseudoBR %bb.3 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.3: + ; CHECK-NEXT: PseudoRET + ; + ; CHECK-FS-LABEL: name: foo4 + ; CHECK-FS: bb.0: + ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13 + ; CHECK-FS-NEXT: {{ $}} + ; CHECK-FS-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11 + ; CHECK-FS-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) :: (dereferenceable load (s32) from @bar) + ; CHECK-FS-NEXT: PseudoBR %bb.3 + ; CHECK-FS-NEXT: {{ $}} + ; CHECK-FS-NEXT: bb.1: + ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13 + ; CHECK-FS-NEXT: {{ $}} + ; CHECK-FS-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11 + ; CHECK-FS-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) :: (dereferenceable load (s32) from @bar) + ; CHECK-FS-NEXT: PseudoBR %bb.3 + ; CHECK-FS-NEXT: {{ $}} + ; CHECK-FS-NEXT: bb.2: + ; CHECK-FS-NEXT: liveins: $x10, $x11, $x13 + ; CHECK-FS-NEXT: {{ $}} + ; CHECK-FS-NEXT: $x5 = PseudoCALLReg target-flags(riscv-call) @OUTLINED_FUNCTION_0, implicit-def $x5, implicit-def $x10, implicit-def $x11, implicit-def $x12, implicit $x10, implicit $x11 + ; CHECK-FS-NEXT: $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) :: (dereferenceable load (s32) from @bar) + ; CHECK-FS-NEXT: PseudoBR %bb.3 + ; CHECK-FS-NEXT: {{ $}} + ; CHECK-FS-NEXT: bb.3: + ; CHECK-FS-NEXT: PseudoRET + bb.0: + liveins: $x10, $x11, $x13 + + $x11 = ORI $x11, 1023 + $x12 = ADDI $x10, 17 + $x11 = AND $x12, $x11 + $x10 = SUB $x10, $x11 + $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) :: (dereferenceable load (s32) from @bar) + PseudoBR %bb.3 + + bb.1: + liveins: $x10, $x11, $x13 + + $x11 = ORI $x11, 1023 + $x12 = ADDI $x10, 17 + $x11 = AND $x12, $x11 + $x10 = SUB $x10, $x11 + $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) :: (dereferenceable load (s32) from @bar) + PseudoBR %bb.3 + + bb.2: + liveins: $x10, $x11, $x13 + + $x11 = ORI $x11, 1023 + $x12 = ADDI $x10, 17 + $x11 = AND $x12, $x11 + $x10 = SUB $x10, $x11 + $x11 = LW killed renamable $x13, target-flags(riscv-pcrel-lo) :: (dereferenceable load (s32) from @bar) + PseudoBR %bb.3 + + bb.3: + PseudoRET +... diff --git a/llvm/test/CodeGen/RISCV/pr88365.ll b/llvm/test/CodeGen/RISCV/pr88365.ll index 73010fdf40447..4e4dead98ee69 100644 --- a/llvm/test/CodeGen/RISCV/pr88365.ll +++ b/llvm/test/CodeGen/RISCV/pr88365.ll @@ -10,7 +10,7 @@ define void @foo() { ; CHECK-NEXT: .cfi_offset ra, -4 ; CHECK-NEXT: li a0, -2048 ; CHECK-NEXT: sub sp, sp, a0 -; CHECK-NEXT: .cfi_def_cfa_offset -16 +; CHECK-NEXT: .cfi_def_cfa_offset 4294967280 ; CHECK-NEXT: addi a0, sp, 4 ; CHECK-NEXT: call use ; CHECK-NEXT: li a0, -2048 diff --git a/llvm/test/CodeGen/RISCV/rvv/combine-vmv.ll b/llvm/test/CodeGen/RISCV/rvv/combine-vmv.ll index ec03f773c7108..dfc2b2bdda026 100644 --- a/llvm/test/CodeGen/RISCV/rvv/combine-vmv.ll +++ b/llvm/test/CodeGen/RISCV/rvv/combine-vmv.ll @@ -168,3 +168,17 @@ define @unfoldable_vredsum( %passthru, @llvm.riscv.vmv.v.v.nxv2i32( %passthru, %a, iXLen 1) ret %b } + +define @unfoldable_mismatched_sew( %passthru, %x, %y, iXLen %avl) { +; CHECK-LABEL: unfoldable_mismatched_sew: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma +; CHECK-NEXT: vadd.vv v9, v9, v10 +; CHECK-NEXT: vsetvli zero, a0, e32, m1, tu, ma +; CHECK-NEXT: vmv.v.v v8, v9 +; CHECK-NEXT: ret + %a = call @llvm.riscv.vadd.nxv1i64.nxv1i64( poison, %x, %y, iXLen %avl) + %a.bitcast = bitcast %a to + %b = call @llvm.riscv.vmv.v.v.nxv2i32( %passthru, %a.bitcast, iXLen %avl) + ret %b +} diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-vpload.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-vpload.ll index b8c7037580c46..849f98c26f459 100644 --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-vpload.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-strided-vpload.ll @@ -638,14 +638,14 @@ declare <33 x double> @llvm.experimental.vp.strided.load.v33f64.p0.i64(ptr, i64, define <4 x i8> @zero_strided_unmasked_vpload_4i8_i8(ptr %ptr) { ; CHECK-OPT-LABEL: zero_strided_unmasked_vpload_4i8_i8: ; CHECK-OPT: # %bb.0: -; CHECK-OPT-NEXT: vsetivli zero, 4, e8, mf4, ta, ma +; CHECK-OPT-NEXT: vsetivli zero, 3, e8, mf4, ta, ma ; CHECK-OPT-NEXT: vlse8.v v8, (a0), zero ; CHECK-OPT-NEXT: ret ; ; CHECK-NO-OPT-LABEL: zero_strided_unmasked_vpload_4i8_i8: ; CHECK-NO-OPT: # %bb.0: ; CHECK-NO-OPT-NEXT: lbu a0, 0(a0) -; CHECK-NO-OPT-NEXT: vsetivli zero, 4, e8, mf4, ta, ma +; CHECK-NO-OPT-NEXT: vsetivli zero, 3, e8, mf4, ta, ma ; CHECK-NO-OPT-NEXT: vmv.v.x v8, a0 ; CHECK-NO-OPT-NEXT: ret %load = call <4 x i8> @llvm.experimental.vp.strided.load.4i8.p0.i8(ptr %ptr, i8 0, <4 x i1> splat (i1 true), i32 3) @@ -657,14 +657,14 @@ define <4 x i8> @zero_strided_unmasked_vpload_4i8_i8(ptr %ptr) { define <4 x half> @zero_strided_unmasked_vpload_4f16(ptr %ptr) { ; CHECK-OPT-LABEL: zero_strided_unmasked_vpload_4f16: ; CHECK-OPT: # %bb.0: -; CHECK-OPT-NEXT: vsetivli zero, 4, e16, mf2, ta, ma +; CHECK-OPT-NEXT: vsetivli zero, 3, e16, mf2, ta, ma ; CHECK-OPT-NEXT: vlse16.v v8, (a0), zero ; CHECK-OPT-NEXT: ret ; ; CHECK-NO-OPT-LABEL: zero_strided_unmasked_vpload_4f16: ; CHECK-NO-OPT: # %bb.0: ; CHECK-NO-OPT-NEXT: flh fa5, 0(a0) -; CHECK-NO-OPT-NEXT: vsetivli zero, 4, e16, mf2, ta, ma +; CHECK-NO-OPT-NEXT: vsetivli zero, 3, e16, mf2, ta, ma ; CHECK-NO-OPT-NEXT: vfmv.v.f v8, fa5 ; CHECK-NO-OPT-NEXT: ret %load = call <4 x half> @llvm.experimental.vp.strided.load.4f16.p0.i32(ptr %ptr, i32 0, <4 x i1> splat (i1 true), i32 3) diff --git a/llvm/test/CodeGen/RISCV/rvv/rvv-peephole-vmerge-vops.ll b/llvm/test/CodeGen/RISCV/rvv/rvv-peephole-vmerge-vops.ll index a08bcae074b9b..259515f160048 100644 --- a/llvm/test/CodeGen/RISCV/rvv/rvv-peephole-vmerge-vops.ll +++ b/llvm/test/CodeGen/RISCV/rvv/rvv-peephole-vmerge-vops.ll @@ -1196,3 +1196,24 @@ define @true_mask_vmerge_implicit_passthru( ) ret %b } + + +define @unfoldable_mismatched_sew( %passthru, %x, %y, %mask, i64 %avl) { +; CHECK-LABEL: unfoldable_mismatched_sew: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma +; CHECK-NEXT: vadd.vv v9, v9, v10 +; CHECK-NEXT: vsetvli zero, a0, e32, m1, tu, ma +; CHECK-NEXT: vmv.v.v v8, v9 +; CHECK-NEXT: ret + %a = call @llvm.riscv.vadd.nxv1i64.nxv1i64( poison, %x, %y, i64 %avl) + %a.bitcast = bitcast %a to + %b = call @llvm.riscv.vmerge.nxv2i32.nxv2i32( + %passthru, + %passthru, + %a.bitcast, + splat (i1 true), + i64 %avl + ) + ret %b +} diff --git a/llvm/test/CodeGen/RISCV/rvv/strided-vpload.ll b/llvm/test/CodeGen/RISCV/rvv/strided-vpload.ll index 0010f64a93fd6..14976f21b7dbb 100644 --- a/llvm/test/CodeGen/RISCV/rvv/strided-vpload.ll +++ b/llvm/test/CodeGen/RISCV/rvv/strided-vpload.ll @@ -1,16 +1,16 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -mtriple=riscv32 -mattr=+m,+d,+zfh,+v,+zvfh,+optimized-zero-stride-load \ ; RUN: -verify-machineinstrs < %s \ -; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-RV32,CHECK-OPT +; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-RV32,CHECK-OPT,CHECK-OPT-RV32 ; RUN: llc -mtriple=riscv64 -mattr=+m,+d,+zfh,+v,+zvfh,+optimized-zero-stride-load \ ; RUN: -verify-machineinstrs < %s \ -; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-RV64,CHECK-OPT +; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-RV64,CHECK-OPT,CHECK-OPT-RV64 ; RUN: llc -mtriple=riscv32 -mattr=+m,+d,+zfh,+v,+zvfh \ ; RUN: -verify-machineinstrs < %s \ -; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-RV32,CHECK-NO-OPT +; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-RV32,CHECK-NO-OPT,CHECK-NO-OPT-RV32 ; RUN: llc -mtriple=riscv64 -mattr=+m,+d,+zfh,+v,+zvfh \ ; RUN: -verify-machineinstrs < %s \ -; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-RV64,CHECK-NO-OPT +; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-RV64,CHECK-NO-OPT,CHECK-NO-OPT-RV64 declare @llvm.experimental.vp.strided.load.nxv1i8.p0.i8(ptr, i8, , i32) @@ -823,15 +823,15 @@ define @zero_strided_unmasked_vpload_nxv1f16(ptr %ptr) { ret %load } -define @zero_strided_vadd.vx( %v, ptr %ptr) { -; CHECK-RV32-LABEL: zero_strided_vadd.vx: +define @zero_strided_vadd_nxv1i64( %v, ptr %ptr) { +; CHECK-RV32-LABEL: zero_strided_vadd_nxv1i64: ; CHECK-RV32: # %bb.0: ; CHECK-RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma ; CHECK-RV32-NEXT: vlse64.v v9, (a0), zero ; CHECK-RV32-NEXT: vadd.vv v8, v8, v9 ; CHECK-RV32-NEXT: ret ; -; CHECK-RV64-LABEL: zero_strided_vadd.vx: +; CHECK-RV64-LABEL: zero_strided_vadd_nxv1i64: ; CHECK-RV64: # %bb.0: ; CHECK-RV64-NEXT: ld a0, 0(a0) ; CHECK-RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma @@ -842,3 +842,69 @@ define @zero_strided_vadd.vx( %v, ptr %ptr) %w = add %v, %load ret %w } + +define @zero_strided_vadd_nxv16i64( %v, ptr %ptr) { +; CHECK-RV32-LABEL: zero_strided_vadd_nxv16i64: +; CHECK-RV32: # %bb.0: +; CHECK-RV32-NEXT: csrr a1, vlenb +; CHECK-RV32-NEXT: srli a2, a1, 3 +; CHECK-RV32-NEXT: sub a3, a2, a1 +; CHECK-RV32-NEXT: sltu a4, a2, a3 +; CHECK-RV32-NEXT: addi a4, a4, -1 +; CHECK-RV32-NEXT: and a3, a4, a3 +; CHECK-RV32-NEXT: vsetvli zero, a3, e64, m8, ta, ma +; CHECK-RV32-NEXT: vlse64.v v24, (a0), zero +; CHECK-RV32-NEXT: bltu a2, a1, .LBB55_2 +; CHECK-RV32-NEXT: # %bb.1: +; CHECK-RV32-NEXT: mv a2, a1 +; CHECK-RV32-NEXT: .LBB55_2: +; CHECK-RV32-NEXT: vsetvli zero, a2, e64, m8, ta, ma +; CHECK-RV32-NEXT: vlse64.v v0, (a0), zero +; CHECK-RV32-NEXT: vsetvli a0, zero, e64, m8, ta, ma +; CHECK-RV32-NEXT: vadd.vv v16, v16, v24 +; CHECK-RV32-NEXT: vadd.vv v8, v8, v0 +; CHECK-RV32-NEXT: ret +; +; CHECK-RV64-LABEL: zero_strided_vadd_nxv16i64: +; CHECK-RV64: # %bb.0: +; CHECK-RV64-NEXT: ld a0, 0(a0) +; CHECK-RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma +; CHECK-RV64-NEXT: vadd.vx v8, v8, a0 +; CHECK-RV64-NEXT: vadd.vx v16, v16, a0 +; CHECK-RV64-NEXT: ret + %vscale = call i32 @llvm.vscale() + %load = call @llvm.experimental.vp.strided.load.nxv16i64.p0.i32(ptr %ptr, i32 0, splat (i1 true), i32 %vscale) + %w = add %v, %load + ret %w +} + +define @zero_strided_vadd_nxv1p0( %v, ptr %ptr) { +; CHECK-OPT-RV32-LABEL: zero_strided_vadd_nxv1p0: +; CHECK-OPT-RV32: # %bb.0: +; CHECK-OPT-RV32-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; CHECK-OPT-RV32-NEXT: vlse32.v v8, (a0), zero +; CHECK-OPT-RV32-NEXT: ret +; +; CHECK-OPT-RV64-LABEL: zero_strided_vadd_nxv1p0: +; CHECK-OPT-RV64: # %bb.0: +; CHECK-OPT-RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma +; CHECK-OPT-RV64-NEXT: vlse64.v v8, (a0), zero +; CHECK-OPT-RV64-NEXT: ret +; +; CHECK-NO-OPT-RV32-LABEL: zero_strided_vadd_nxv1p0: +; CHECK-NO-OPT-RV32: # %bb.0: +; CHECK-NO-OPT-RV32-NEXT: lw a0, 0(a0) +; CHECK-NO-OPT-RV32-NEXT: vsetvli a1, zero, e32, mf2, ta, ma +; CHECK-NO-OPT-RV32-NEXT: vmv.v.x v8, a0 +; CHECK-NO-OPT-RV32-NEXT: ret +; +; CHECK-NO-OPT-RV64-LABEL: zero_strided_vadd_nxv1p0: +; CHECK-NO-OPT-RV64: # %bb.0: +; CHECK-NO-OPT-RV64-NEXT: ld a0, 0(a0) +; CHECK-NO-OPT-RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma +; CHECK-NO-OPT-RV64-NEXT: vmv.v.x v8, a0 +; CHECK-NO-OPT-RV64-NEXT: ret + %vscale = call i32 @llvm.vscale() + %load = call @llvm.experimental.vp.strided.load.nxv1p0.p0.i32(ptr %ptr, i32 0, splat (i1 true), i32 %vscale) + ret %load +} diff --git a/llvm/test/CodeGen/SPARC/inlineasm.ll b/llvm/test/CodeGen/SPARC/inlineasm.ll index 14ea0a2a12602..e2853f03a002e 100644 --- a/llvm/test/CodeGen/SPARC/inlineasm.ll +++ b/llvm/test/CodeGen/SPARC/inlineasm.ll @@ -152,3 +152,13 @@ define i64 @test_twinword(){ %1 = tail call i64 asm sideeffect "rd %asr5, ${0:L} \0A\09 srlx ${0:L}, 32, ${0:H}", "={i0}"() ret i64 %1 } + +; CHECK-LABEL: test_symbol: +; CHECK: ba,a brtarget +define void @test_symbol() { +Entry: + call void asm sideeffect "ba,a ${0}", "X"(ptr @brtarget) + unreachable +} + +declare void @brtarget() diff --git a/llvm/test/CodeGen/WinEH/wineh-empty-seh-scope.ll b/llvm/test/CodeGen/WinEH/wineh-empty-seh-scope.ll new file mode 100644 index 0000000000000..5f382f10f180b --- /dev/null +++ b/llvm/test/CodeGen/WinEH/wineh-empty-seh-scope.ll @@ -0,0 +1,18 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 +; RUN: llc -mtriple=x86_64-pc-windows-msvc19.41.34120 < %s | FileCheck %s + +define void @foo() personality ptr @__CxxFrameHandler3 { +; CHECK-LABEL: foo: +; CHECK: # %bb.0: +; CHECK-NEXT: nop # avoids zero-length function + call void @llvm.seh.scope.begin() + unreachable +} + +declare i32 @__CxxFrameHandler3(...) + +declare void @llvm.seh.scope.begin() + +!llvm.module.flags = !{!0} + +!0 = !{i32 2, !"eh-asynch", i32 1} diff --git a/llvm/test/CodeGen/X86/bypass-slow-division-64.ll b/llvm/test/CodeGen/X86/bypass-slow-division-64.ll index 6e0cfdd26a786..b0ca0069a526b 100644 --- a/llvm/test/CodeGen/X86/bypass-slow-division-64.ll +++ b/llvm/test/CodeGen/X86/bypass-slow-division-64.ll @@ -23,6 +23,7 @@ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver2 | FileCheck %s --check-prefixes=CHECK,SLOW-DIVQ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver3 | FileCheck %s --check-prefixes=CHECK,SLOW-DIVQ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver4 | FileCheck %s --check-prefixes=CHECK,SLOW-DIVQ +; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver5 | FileCheck %s --check-prefixes=CHECK,SLOW-DIVQ ; Additional tests for 64-bit divide bypass diff --git a/llvm/test/CodeGen/X86/cmp16.ll b/llvm/test/CodeGen/X86/cmp16.ll index fa9e75ff16a5c..8c14a78d9e113 100644 --- a/llvm/test/CodeGen/X86/cmp16.ll +++ b/llvm/test/CodeGen/X86/cmp16.ll @@ -13,6 +13,7 @@ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver2 | FileCheck %s --check-prefixes=X64,X64-FAST ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver3 | FileCheck %s --check-prefixes=X64,X64-FAST ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver4 | FileCheck %s --check-prefixes=X64,X64-FAST +; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver5 | FileCheck %s --check-prefixes=X64,X64-FAST define i1 @cmp16_reg_eq_reg(i16 %a0, i16 %a1) { ; X86-GENERIC-LABEL: cmp16_reg_eq_reg: diff --git a/llvm/test/CodeGen/X86/cpus-amd.ll b/llvm/test/CodeGen/X86/cpus-amd.ll index 228a00428c457..33b2cf3731478 100644 --- a/llvm/test/CodeGen/X86/cpus-amd.ll +++ b/llvm/test/CodeGen/X86/cpus-amd.ll @@ -29,6 +29,7 @@ ; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=znver2 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty ; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=znver3 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty ; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=znver4 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty +; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=znver5 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty define void @foo() { ret void diff --git a/llvm/test/CodeGen/X86/huge-stack.ll b/llvm/test/CodeGen/X86/huge-stack.ll index a7ceb4a4ee6fe..920033ba1182c 100644 --- a/llvm/test/CodeGen/X86/huge-stack.ll +++ b/llvm/test/CodeGen/X86/huge-stack.ll @@ -7,7 +7,7 @@ define void @foo() unnamed_addr #0 { ; CHECK: # %bb.0: ; CHECK-NEXT: movabsq $8589934462, %rax # imm = 0x1FFFFFF7E ; CHECK-NEXT: subq %rax, %rsp -; CHECK-NEXT: .cfi_def_cfa_offset -122 +; CHECK-NEXT: .cfi_def_cfa_offset 8589934470 ; CHECK-NEXT: movb $42, -129(%rsp) ; CHECK-NEXT: movb $43, -128(%rsp) ; CHECK-NEXT: movabsq $8589934462, %rax # imm = 0x1FFFFFF7E diff --git a/llvm/test/CodeGen/X86/pr99396.ll b/llvm/test/CodeGen/X86/pr99396.ll new file mode 100644 index 0000000000000..f534d32038c22 --- /dev/null +++ b/llvm/test/CodeGen/X86/pr99396.ll @@ -0,0 +1,56 @@ +; RUN: llc < %s -mtriple=i386-unknown-freebsd -enable-misched -relocation-model=pic | FileCheck %s + +@c = external local_unnamed_addr global ptr + +declare i32 @fn2() local_unnamed_addr + +declare i32 @fn3() local_unnamed_addr + +define noundef i32 @fn4() #0 { +entry: + %tmp0 = load i32, ptr @fn4, align 4 +; CHECK: movl fn4@GOT(%ebx), %edi +; CHECK-NEXT: movl (%edi), %edx + %tmp1 = load ptr, ptr @c, align 4 +; CHECK: movl c@GOT(%ebx), %eax +; CHECK-NEXT: movl (%eax), %esi +; CHECK-NEXT: testl %esi, %esi + %cmp.g = icmp eq ptr %tmp1, null + br i1 %cmp.g, label %if.then.g, label %if.end3.g + +if.then.g: ; preds = %entry + %tmp2 = load i32, ptr inttoptr (i32 1 to ptr), align 4 + %cmp1.g = icmp slt i32 %tmp2, 0 + br i1 %cmp1.g, label %if.then2.g, label %if.end3.g + +if.then2.g: ; preds = %if.then.g + %.g = load volatile i32, ptr null, align 2147483648 + br label %f.exit + +if.end3.g: ; preds = %if.then.g, %entry + %h.i.g = icmp eq i32 %tmp0, 0 + br i1 %h.i.g, label %f.exit, label %while.body.g + +while.body.g: ; preds = %if.end3.g, %if.end8.g + %buff.addr.019.g = phi ptr [ %incdec.ptr.g, %if.end8.g ], [ @fn4, %if.end3.g ] + %g.addr.018.g = phi i32 [ %dec.g, %if.end8.g ], [ %tmp0, %if.end3.g ] + %call4.g = tail call i32 @fn3(ptr %tmp1, ptr %buff.addr.019.g, i32 %g.addr.018.g) + %cmp5.g = icmp slt i32 %call4.g, 0 + br i1 %cmp5.g, label %if.then6.g, label %if.end8.g + +if.then6.g: ; preds = %while.body.g + %call7.g = tail call i32 @fn2(ptr null) + br label %f.exit + +if.end8.g: ; preds = %while.body.g + %dec.g = add i32 %g.addr.018.g, 1 + %incdec.ptr.g = getelementptr i32, ptr %buff.addr.019.g, i32 1 + store i64 0, ptr %tmp1, align 4 + %h.not.g = icmp eq i32 %dec.g, 0 + br i1 %h.not.g, label %f.exit, label %while.body.g + +f.exit: ; preds = %if.end8.g, %if.then6.g, %if.end3.g, %if.then2.g + ret i32 0 +} + +attributes #0 = { "frame-pointer"="all" "tune-cpu"="generic" } diff --git a/llvm/test/CodeGen/X86/rdpru.ll b/llvm/test/CodeGen/X86/rdpru.ll index 7771f52653cb5..be79a4499a338 100644 --- a/llvm/test/CodeGen/X86/rdpru.ll +++ b/llvm/test/CodeGen/X86/rdpru.ll @@ -6,6 +6,7 @@ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver2 | FileCheck %s --check-prefix=X64 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver3 -fast-isel | FileCheck %s --check-prefix=X64 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver4 -fast-isel | FileCheck %s --check-prefix=X64 +; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver5 -fast-isel | FileCheck %s --check-prefix=X64 define void @rdpru_asm() { ; X86-LABEL: rdpru_asm: diff --git a/llvm/test/CodeGen/X86/scatter-schedule.ll b/llvm/test/CodeGen/X86/scatter-schedule.ll index c841e23eab76b..762a050247a87 100644 --- a/llvm/test/CodeGen/X86/scatter-schedule.ll +++ b/llvm/test/CodeGen/X86/scatter-schedule.ll @@ -10,8 +10,8 @@ define void @test(i64 %x272, <16 x ptr> %x335, <16 x i32> %x270) { ; CHECK-LABEL: test: ; CHECK: # %bb.0: ; CHECK-NEXT: kxnorw %k0, %k0, %k1 -; CHECK-NEXT: kxnorw %k0, %k0, %k2 -; CHECK-NEXT: vpscatterqd %ymm2, (,%zmm0) {%k2} +; CHECK-NEXT: vpscatterqd %ymm2, (,%zmm0) {%k1} +; CHECK-NEXT: kxnorw %k0, %k0, %k1 ; CHECK-NEXT: vextracti64x4 $1, %zmm2, %ymm0 ; CHECK-NEXT: vpscatterqd %ymm0, (,%zmm1) {%k1} ; CHECK-NEXT: vzeroupper diff --git a/llvm/test/CodeGen/X86/shuffle-as-shifts.ll b/llvm/test/CodeGen/X86/shuffle-as-shifts.ll index e89197f5b42c3..9c8729b3ea505 100644 --- a/llvm/test/CodeGen/X86/shuffle-as-shifts.ll +++ b/llvm/test/CodeGen/X86/shuffle-as-shifts.ll @@ -3,6 +3,7 @@ ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=icelake-server | FileCheck %s --check-prefixes=CHECK,CHECK-ICX ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64-v4 | FileCheck %s --check-prefixes=CHECK,CHECK-V4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver4 | FileCheck %s --check-prefixes=CHECK,CHECK-ZNVER4 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver5 | FileCheck %s --check-prefixes=CHECK,CHECK-ZNVER4 define <4 x i32> @shuf_rot_v4i32_1032(<4 x i32> %x) { diff --git a/llvm/test/CodeGen/X86/slow-unaligned-mem.ll b/llvm/test/CodeGen/X86/slow-unaligned-mem.ll index d74d195439bda..ceef3fb4bb188 100644 --- a/llvm/test/CodeGen/X86/slow-unaligned-mem.ll +++ b/llvm/test/CodeGen/X86/slow-unaligned-mem.ll @@ -50,6 +50,7 @@ ; RUN: llc < %s -mtriple=i386-unknown-unknown -mcpu=znver2 2>&1 | FileCheck %s --check-prefixes=FAST,FAST-AVX256 ; RUN: llc < %s -mtriple=i386-unknown-unknown -mcpu=znver3 2>&1 | FileCheck %s --check-prefixes=FAST,FAST-AVX256 ; RUN: llc < %s -mtriple=i386-unknown-unknown -mcpu=znver4 2>&1 | FileCheck %s --check-prefixes=FAST,FAST-AVX512 +; RUN: llc < %s -mtriple=i386-unknown-unknown -mcpu=znver5 2>&1 | FileCheck %s --check-prefixes=FAST,FAST-AVX512 ; Other chips with slow unaligned memory accesses diff --git a/llvm/test/CodeGen/X86/sqrt-fastmath-tune.ll b/llvm/test/CodeGen/X86/sqrt-fastmath-tune.ll index 9f2071ff14b87..2b78a70ebcc26 100644 --- a/llvm/test/CodeGen/X86/sqrt-fastmath-tune.ll +++ b/llvm/test/CodeGen/X86/sqrt-fastmath-tune.ll @@ -6,6 +6,7 @@ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver1 | FileCheck %s --check-prefixes=FAST-SCALAR,FAST-VECTOR ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver3 | FileCheck %s --check-prefixes=FAST-SCALAR,FAST-VECTOR ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver4 | FileCheck %s --check-prefixes=FAST-SCALAR,FAST-VECTOR +; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver5 | FileCheck %s --check-prefixes=FAST-SCALAR,FAST-VECTOR ; RUN: llc < %s -mtriple=x86_64-- -mcpu=x86-64 | FileCheck %s --check-prefixes=X86-64 define float @f32_no_daz(float %f) #0 { diff --git a/llvm/test/CodeGen/X86/stack-frame-layout-remarks.ll b/llvm/test/CodeGen/X86/stack-frame-layout-remarks.ll index cd5edcf2ae502..d8ce5b041042e 100644 --- a/llvm/test/CodeGen/X86/stack-frame-layout-remarks.ll +++ b/llvm/test/CodeGen/X86/stack-frame-layout-remarks.ll @@ -35,7 +35,7 @@ entry: declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 ; BOTH: Function: cleanup_array -; BOTH-NEXT: Offset: [SP+4], Type: Protector, Align: 16, Size: 4 +; BOTH-NEXT: Offset: [SP+4], Type: Fixed, Align: 16, Size: 4 ; DEBUG: a @ dot.c:13 ; STRIPPED-NOT: a @ dot.c:13 ; BOTH: Offset: [SP-4], Type: Spill, Align: 8, Size: 4 @@ -47,7 +47,7 @@ define void @cleanup_array(ptr %0) #1 { } ; BOTH: Function: cleanup_result -; BOTH: Offset: [SP+4], Type: Protector, Align: 16, Size: 4 +; BOTH: Offset: [SP+4], Type: Fixed, Align: 16, Size: 4 ; DEBUG: res @ dot.c:21 ; STRIPPED-NOT: res @ dot.c:21 ; BOTH: Offset: [SP-4], Type: Spill, Align: 8, Size: 4 @@ -59,11 +59,11 @@ define void @cleanup_result(ptr %0) #1 { } ; BOTH: Function: do_work -; BOTH: Offset: [SP+12], Type: Variable, Align: 8, Size: 4 +; BOTH: Offset: [SP+12], Type: Fixed, Align: 8, Size: 4 ; DEBUG: out @ dot.c:32 ; STRIPPED-NOT: out @ dot.c:32 -; BOTH: Offset: [SP+8], Type: Variable, Align: 4, Size: 4 -; BOTH: Offset: [SP+4], Type: Protector, Align: 16, Size: 4 +; BOTH: Offset: [SP+8], Type: Fixed, Align: 4, Size: 4 +; BOTH: Offset: [SP+4], Type: Fixed, Align: 16, Size: 4 ; DEBUG: A @ dot.c:32 ; STRIPPED-NOT: A @ dot.c:32 ; BOTH: Offset: [SP-4], Type: Spill, Align: 8, Size: 4 @@ -125,7 +125,7 @@ define i32 @do_work(ptr %0, ptr %1, ptr %2) #2 { } ; BOTH: Function: gen_array -; BOTH: Offset: [SP+4], Type: Protector, Align: 16, Size: 4 +; BOTH: Offset: [SP+4], Type: Fixed, Align: 16, Size: 4 ; DEBUG: size @ dot.c:62 ; STRIPPED-NOT: size @ dot.c:62 ; BOTH: Offset: [SP-4], Type: Spill, Align: 8, Size: 4 diff --git a/llvm/test/CodeGen/X86/subreg-fail.mir b/llvm/test/CodeGen/X86/subreg-fail.mir new file mode 100644 index 0000000000000..c8146f099b814 --- /dev/null +++ b/llvm/test/CodeGen/X86/subreg-fail.mir @@ -0,0 +1,37 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 +# RUN: llc -mtriple x86_64-unknown-unknown %s \ +# RUN: -verify-coalescing -enable-subreg-liveness \ +# RUN: --run-pass=register-coalescer -o - | FileCheck %s + +# Check that the register coalescer correctly handles merging live ranges over +# SUBREG_TO_REG on X86. The -verify-coalescing option will give an error if +# this is incorrect. + +--- +name: test1 +alignment: 16 +tracksRegLiveness: true +body: | + bb.0: + ; CHECK-LABEL: name: test1 + ; CHECK: undef [[MOV32rm:%[0-9]+]].sub_32bit:gr64_nosp = MOV32rm undef %1:gr64, 1, $noreg, 0, $noreg :: (volatile load (s32) from `ptr undef`) + ; CHECK-NEXT: undef [[MOV32rm1:%[0-9]+]].sub_32bit:gr64_with_sub_8bit = MOV32rm undef %4:gr64, 1, $noreg, 0, $noreg :: (volatile load (s32) from `ptr undef`) + ; CHECK-NEXT: [[MOV32rm1:%[0-9]+]]:gr64_with_sub_8bit = SHL64ri [[MOV32rm1]], 32, implicit-def dead $eflags + ; CHECK-NEXT: [[LEA64r:%[0-9]+]]:gr64_with_sub_8bit = LEA64r [[MOV32rm1]], 1, [[MOV32rm]], 256, $noreg + ; CHECK-NEXT: [[LEA64r:%[0-9]+]]:gr64_with_sub_8bit = SHR64ri [[LEA64r]], 8, implicit-def dead $eflags + ; CHECK-NEXT: MOV32mr undef %10:gr64, 1, $noreg, 0, $noreg, [[LEA64r]].sub_32bit :: (volatile store (s32) into `ptr undef`) + ; CHECK-NEXT: RET 0, undef $eax + %0:gr32 = MOV32rm undef %1:gr64, 1, $noreg, 0, $noreg :: (volatile load (s32) from `ptr undef`) + %2:gr64_nosp = SUBREG_TO_REG 0, killed %0, %subreg.sub_32bit + %3:gr32 = MOV32rm undef %4:gr64, 1, $noreg, 0, $noreg :: (volatile load (s32) from `ptr undef`) + %5:gr64 = SUBREG_TO_REG 0, killed %3, %subreg.sub_32bit + %6:gr64 = COPY killed %5 + %6:gr64 = SHL64ri %6, 32, implicit-def dead $eflags + %7:gr64 = LEA64r killed %6, 1, killed %2, 256, $noreg + %8:gr64 = COPY killed %7 + %8:gr64 = SHR64ri %8, 8, implicit-def dead $eflags + %9:gr32 = COPY killed %8.sub_32bit + MOV32mr undef %10:gr64, 1, $noreg, 0, $noreg, killed %9 :: (volatile store (s32) into `ptr undef`) + RET 0, undef $eax + +... diff --git a/llvm/test/CodeGen/X86/tuning-shuffle-permilpd-avx512.ll b/llvm/test/CodeGen/X86/tuning-shuffle-permilpd-avx512.ll index 7d8bb567c09b3..162ab71fc00d4 100644 --- a/llvm/test/CodeGen/X86/tuning-shuffle-permilpd-avx512.ll +++ b/llvm/test/CodeGen/X86/tuning-shuffle-permilpd-avx512.ll @@ -4,6 +4,7 @@ ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64-v4 | FileCheck %s --check-prefixes=CHECK,CHECK-V4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl,+avx512bw,+avx512dq | FileCheck %s --check-prefixes=CHECK,CHECK-AVX512 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver4 | FileCheck %s --check-prefixes=CHECK,CHECK-ZNVER4 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver5 | FileCheck %s --check-prefixes=CHECK,CHECK-ZNVER4 define <8 x double> @transform_VPERMILPSZrr(<8 x double> %a) nounwind { ; CHECK-LABEL: transform_VPERMILPSZrr: diff --git a/llvm/test/CodeGen/X86/tuning-shuffle-permilps-avx512.ll b/llvm/test/CodeGen/X86/tuning-shuffle-permilps-avx512.ll index 5d031f6017c77..cd97946da248f 100644 --- a/llvm/test/CodeGen/X86/tuning-shuffle-permilps-avx512.ll +++ b/llvm/test/CodeGen/X86/tuning-shuffle-permilps-avx512.ll @@ -4,6 +4,7 @@ ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64-v4 | FileCheck %s --check-prefixes=CHECK,CHECK-V4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl,+avx512bw,+avx512dq | FileCheck %s --check-prefixes=CHECK,CHECK-AVX512 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver4 | FileCheck %s --check-prefixes=CHECK,CHECK-ZNVER4 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver5 | FileCheck %s --check-prefixes=CHECK,CHECK-ZNVER4 define <16 x float> @transform_VPERMILPSZrr(<16 x float> %a) nounwind { ; CHECK-LABEL: transform_VPERMILPSZrr: diff --git a/llvm/test/CodeGen/X86/tuning-shuffle-unpckpd-avx512.ll b/llvm/test/CodeGen/X86/tuning-shuffle-unpckpd-avx512.ll index 4a160bc9debc7..5ea991f85523e 100644 --- a/llvm/test/CodeGen/X86/tuning-shuffle-unpckpd-avx512.ll +++ b/llvm/test/CodeGen/X86/tuning-shuffle-unpckpd-avx512.ll @@ -5,6 +5,7 @@ ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64-v4 | FileCheck %s --check-prefixes=CHECK,CHECK-V4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl,+avx512bw,+avx512dq | FileCheck %s --check-prefixes=CHECK,CHECK-AVX512 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver4 | FileCheck %s --check-prefixes=CHECK,CHECK-ZNVER4 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver5 | FileCheck %s --check-prefixes=CHECK,CHECK-ZNVER4 define <16 x float> @transform_VUNPCKLPDZrr(<16 x float> %a, <16 x float> %b) nounwind { diff --git a/llvm/test/CodeGen/X86/tuning-shuffle-unpckps-avx512.ll b/llvm/test/CodeGen/X86/tuning-shuffle-unpckps-avx512.ll index d0e3ad9b19086..96155f0300d2d 100644 --- a/llvm/test/CodeGen/X86/tuning-shuffle-unpckps-avx512.ll +++ b/llvm/test/CodeGen/X86/tuning-shuffle-unpckps-avx512.ll @@ -5,6 +5,7 @@ ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64-v4 | FileCheck %s --check-prefixes=CHECK,CHECK-V4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl,+avx512bw,+avx512dq | FileCheck %s --check-prefixes=CHECK,CHECK-AVX512 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver4 | FileCheck %s --check-prefixes=CHECK,CHECK-ZNVER4 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver5 | FileCheck %s --check-prefixes=CHECK,CHECK-ZNVER4 define <16 x float> @transform_VUNPCKLPSZrr(<16 x float> %a, <16 x float> %b) nounwind { ; CHECK-LABEL: transform_VUNPCKLPSZrr: diff --git a/llvm/test/CodeGen/X86/vector-shuffle-fast-per-lane.ll b/llvm/test/CodeGen/X86/vector-shuffle-fast-per-lane.ll index e59532d4fef30..4021b1bf292bb 100644 --- a/llvm/test/CodeGen/X86/vector-shuffle-fast-per-lane.ll +++ b/llvm/test/CodeGen/X86/vector-shuffle-fast-per-lane.ll @@ -8,6 +8,7 @@ ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=znver2 | FileCheck %s --check-prefixes=FAST ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=znver3 | FileCheck %s --check-prefixes=FAST ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=znver4 | FileCheck %s --check-prefixes=FAST +; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=znver5 | FileCheck %s --check-prefixes=FAST ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=haswell | FileCheck %s --check-prefixes=FAST ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=skx | FileCheck %s --check-prefixes=FAST diff --git a/llvm/test/CodeGen/X86/vpdpwssd.ll b/llvm/test/CodeGen/X86/vpdpwssd.ll index e6a07b4aeb271..3c1eb92e9e3c3 100644 --- a/llvm/test/CodeGen/X86/vpdpwssd.ll +++ b/llvm/test/CodeGen/X86/vpdpwssd.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver4 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=znver5 | FileCheck %s ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vnni,+fast-dpwssd | FileCheck %s define <16 x i32> @vpdpwssd_test(<16 x i32> %0, <16 x i32> %1, <16 x i32> %2) { diff --git a/llvm/test/CodeGen/X86/x86-64-double-shifts-var.ll b/llvm/test/CodeGen/X86/x86-64-double-shifts-var.ll index af6fbdc9f60de..bbaa414924707 100644 --- a/llvm/test/CodeGen/X86/x86-64-double-shifts-var.ll +++ b/llvm/test/CodeGen/X86/x86-64-double-shifts-var.ll @@ -16,6 +16,7 @@ ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver2 | FileCheck %s ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver3 | FileCheck %s ; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver4 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-- -mcpu=znver5 | FileCheck %s ; Verify that for the X86_64 processors that are known to have poor latency ; double precision shift instructions we do not generate 'shld' or 'shrd' diff --git a/llvm/test/DebugInfo/Symbolize/ELF/arm-mapping-symbol.s b/llvm/test/DebugInfo/Symbolize/ELF/arm-mapping-symbol.s index 6e17ef29ae577..27310c09fb07c 100644 --- a/llvm/test/DebugInfo/Symbolize/ELF/arm-mapping-symbol.s +++ b/llvm/test/DebugInfo/Symbolize/ELF/arm-mapping-symbol.s @@ -5,19 +5,19 @@ ## Verify that mapping symbols are actually present in the object at expected ## addresses. -# RUN: llvm-nm --special-syms %t | FileCheck %s -check-prefix MAPPING_A +# RUN: llvm-nm --special-syms %t | FileCheck %s --check-prefix=MAPPING_A --match-full-lines -# MAPPING_A: 00000004 t $a.1 -# MAPPING_A-NEXT: 00000000 t $d.0 -# MAPPING_A-NEXT: 00000008 t $d.2 +# MAPPING_A: 00000004 t $a +# MAPPING_A-NEXT: 00000000 t $d +# MAPPING_A-NEXT: 00000008 t $d # MAPPING_A-NEXT: 00000000 T foo # RUN: llvm-mc -filetype=obj -triple=thumbv7-none-linux %s -o %tthumb -# RUN: llvm-nm --special-syms %tthumb | FileCheck %s -check-prefix MAPPING_T +# RUN: llvm-nm --special-syms %tthumb | FileCheck %s --check-prefix=MAPPING_T --match-full-lines -# MAPPING_T: 00000000 t $d.0 -# MAPPING_T-NEXT: 00000006 t $d.2 -# MAPPING_T-NEXT: 00000004 t $t.1 +# MAPPING_T: 00000000 t $d +# MAPPING_T-NEXT: 00000006 t $d +# MAPPING_T-NEXT: 00000004 t $t # MAPPING_T-NEXT: 00000000 T foo # RUN: llvm-symbolizer --obj=%t 4 8 | FileCheck %s -check-prefix SYMBOL diff --git a/llvm/test/DebugInfo/type-finder-w-dbg-records.ll b/llvm/test/DebugInfo/type-finder-w-dbg-records.ll new file mode 100644 index 0000000000000..8259b4a9f1c3a --- /dev/null +++ b/llvm/test/DebugInfo/type-finder-w-dbg-records.ll @@ -0,0 +1,51 @@ +; RUN: opt --passes=verify %s -o - -S | FileCheck %s + +;; Test that the type definitions are discovered when serialising to LLVM-IR, +;; even if they're only present inside a DbgRecord, and thus not normally +;; visible. + +; CHECK: %union.anon = type { %struct.a } +; CHECK: %struct.a = type { i32 } +; CHECK: %union.anon2 = type { %struct.a2 } +; CHECK: %struct.a2 = type { i32 } + +; ModuleID = 'bbi-98372.ll' +source_filename = "bbi-98372.ll" + +%union.anon = type { %struct.a } +%struct.a = type { i32 } +%union.anon2 = type { %struct.a2 } +%struct.a2 = type { i32 } + +@d = global [1 x { i16, i16 }] [{ i16, i16 } { i16 0, i16 undef }], align 1 +@e = global [1 x { i16, i16 }] [{ i16, i16 } { i16 0, i16 undef }], align 1 + +define void @f() { +entry: + #dbg_value(ptr getelementptr inbounds ([1 x %union.anon], ptr @d, i32 0, i32 3), !7, !DIExpression(), !14) + #dbg_assign(ptr null, !7, !DIExpression(), !16, ptr getelementptr inbounds ([1 x %union.anon2], ptr @e, i32 0, i32 3), !17, !14) + ret void, !dbg !15 +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!2, !3, !4, !5} +!llvm.ident = !{!6} + +!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) +!1 = !DIFile(filename: "foo.c", directory: "/bar") +!2 = !{i32 7, !"Dwarf Version", i32 4} +!3 = !{i32 2, !"Debug Info Version", i32 3} +!4 = !{i32 1, !"wchar_size", i32 1} +!5 = !{i32 7, !"frame-pointer", i32 2} +!6 = !{!"clang"} +!7 = !DILocalVariable(name: "f", scope: !8, file: !1, line: 8, type: !12) +!8 = distinct !DISubprogram(name: "e", scope: !1, file: !1, line: 8, type: !9, scopeLine: 8, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11) +!9 = !DISubroutineType(types: !10) +!10 = !{null} +!11 = !{!7} +!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 16) +!13 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed) +!14 = !DILocation(line: 0, scope: !8) +!15 = !DILocation(line: 8, column: 28, scope: !8) +!16 = distinct !DIAssignID() +!17 = !DIExpression() diff --git a/llvm/test/MC/AArch64/arm64-system-encoding.s b/llvm/test/MC/AArch64/arm64-system-encoding.s index 313ec91177460..c58a8f0cb841c 100644 --- a/llvm/test/MC/AArch64/arm64-system-encoding.s +++ b/llvm/test/MC/AArch64/arm64-system-encoding.s @@ -1,5 +1,5 @@ ; RUN: not llvm-mc -triple arm64-apple-darwin -show-encoding < %s 2> %t | FileCheck %s -; RUN: not llvm-mc -triple arm64-apple-darwin -mattr=+v8.3a -show-encoding < %s 2> %t | FileCheck %s --check-prefix=CHECK-V83 +; RUN: not llvm-mc -triple arm64-apple-darwin -mattr=+ccidx -show-encoding < %s 2> %t | FileCheck %s --check-prefix=CHECK-V83 ; RUN: FileCheck --check-prefix=CHECK-ERRORS < %t %s foo: diff --git a/llvm/test/MC/AArch64/armv8.5a-ssbs-error.s b/llvm/test/MC/AArch64/armv8.5a-ssbs-error.s index a7c9f4c4fbb5c..cd5ab43046c79 100644 --- a/llvm/test/MC/AArch64/armv8.5a-ssbs-error.s +++ b/llvm/test/MC/AArch64/armv8.5a-ssbs-error.s @@ -1,5 +1,5 @@ // RUN: not llvm-mc -triple aarch64 -show-encoding -mattr=+ssbs < %s 2>&1 | FileCheck %s -// RUN: not llvm-mc -triple aarch64 -show-encoding -mattr=+v8.5a < %s 2>&1 | FileCheck %s +// RUN: not llvm-mc -triple aarch64 -show-encoding -mattr=+v8.5a < %s 2>&1 | FileCheck %s --check-prefix=NOSPECID // RUN: not llvm-mc -triple aarch64 -show-encoding -mattr=-ssbs < %s 2>&1 | FileCheck %s --check-prefix=NOSPECID msr SSBS, #16 diff --git a/llvm/test/MC/AArch64/armv8.5a-ssbs.s b/llvm/test/MC/AArch64/armv8.5a-ssbs.s index ec6670f8ecc34..2a8b7b000646a 100644 --- a/llvm/test/MC/AArch64/armv8.5a-ssbs.s +++ b/llvm/test/MC/AArch64/armv8.5a-ssbs.s @@ -1,5 +1,5 @@ // RUN: llvm-mc -triple aarch64 -show-encoding -mattr=+ssbs < %s | FileCheck %s -// RUN: llvm-mc -triple aarch64 -show-encoding -mattr=+v8.5a < %s | FileCheck %s +// RUN: not llvm-mc -triple aarch64 -show-encoding -mattr=+v8.5a < %s 2>&1 | FileCheck %s --check-prefix=NOSPECID // RUN: llvm-mc -triple aarch64 -show-encoding -mcpu=cortex-a65 < %s | FileCheck %s // RUN: llvm-mc -triple aarch64 -show-encoding -mcpu=cortex-a65ae < %s | FileCheck %s // RUN: llvm-mc -triple aarch64 -show-encoding -mcpu=cortex-a76 < %s | FileCheck %s diff --git a/llvm/test/MC/ARM/CheckDataSymbol.s b/llvm/test/MC/ARM/CheckDataSymbol.s index 14ea92a943a1e..ec421f51395af 100644 --- a/llvm/test/MC/ARM/CheckDataSymbol.s +++ b/llvm/test/MC/ARM/CheckDataSymbol.s @@ -1,7 +1,7 @@ # RUN: llvm-mc -filetype=obj -assemble \ # RUN: -triple=arm-arm-none-eabi -mcpu=cortex-a9 %s -o - \ # RUN: | llvm-readobj -S --symbols - | FileCheck %s -# CHECK: Name: $d.1 ({{[1-9][0-9]+}}) +# CHECK: Name: $d # CHECK-NEXT: Value: 0x4 # CHECK-NEXT: Size: 0 # CHECK-NEXT: Binding: Local (0x0) diff --git a/llvm/test/MC/ARM/Windows/branch-reloc-offset.s b/llvm/test/MC/ARM/Windows/branch-reloc-offset.s new file mode 100644 index 0000000000000..2e70a723ccf78 --- /dev/null +++ b/llvm/test/MC/ARM/Windows/branch-reloc-offset.s @@ -0,0 +1,57 @@ +// RUN: llvm-mc -triple thumbv7-windows-gnu -filetype obj %s -o - | llvm-objdump -D -r - | FileCheck %s + + .text +main: + nop + b .Ltarget + b .Lother_target + +// A private label target in the same section + .def .Ltarget + .scl 3 + .type 32 + .endef + .p2align 2 +.Ltarget: + bx lr + +// A private label target in another section + .section "other", "xr" + nop + nop + nop + nop + nop + nop + nop + nop + .def .Lother_target + .scl 3 + .type 32 + .endef + .p2align 2 +.Lother_target: + bx lr + +// Check that both branches have a relocation with a zero offset. +// +// CHECK: 00000000
: +// CHECK: 0: bf00 nop +// CHECK: 2: f000 b800 b.w 0x6 @ imm = #0x0 +// CHECK: 00000002: IMAGE_REL_ARM_BRANCH24T .Ltarget +// CHECK: 6: f000 b800 b.w 0xa @ imm = #0x0 +// CHECK: 00000006: IMAGE_REL_ARM_BRANCH24T .Lother_target +// CHECK: a: bf00 nop +// CHECK: 0000000c <.Ltarget>: +// CHECK: c: 4770 bx lr +// CHECK: 00000000 : +// CHECK: 0: bf00 nop +// CHECK: 2: bf00 nop +// CHECK: 4: bf00 nop +// CHECK: 6: bf00 nop +// CHECK: 8: bf00 nop +// CHECK: a: bf00 nop +// CHECK: c: bf00 nop +// CHECK: e: bf00 nop +// CHECK: 00000010 <.Lother_target>: +// CHECK: 10: 4770 bx lr diff --git a/llvm/test/MC/ARM/data-in-code.ll b/llvm/test/MC/ARM/data-in-code.ll index 2e107f250e05d..b755c3bb5cad4 100644 --- a/llvm/test/MC/ARM/data-in-code.ll +++ b/llvm/test/MC/ARM/data-in-code.ll @@ -72,7 +72,7 @@ exit: ;; TMB-NEXT: Section: [[MIXED_SECT:[^ ]+]] ;; TMB: Symbol { -;; TMB: Name: $d.1 +;; TMB: Name: $d ;; TMB-NEXT: Value: 0x{{[0-9A-F]+}} ;; TMB-NEXT: Size: 0 ;; TMB-NEXT: Binding: Local diff --git a/llvm/test/MC/ARM/directive-arm-thumb-alignment.s b/llvm/test/MC/ARM/directive-arm-thumb-alignment.s index b90c76d2b121c..0e798f67b48aa 100644 --- a/llvm/test/MC/ARM/directive-arm-thumb-alignment.s +++ b/llvm/test/MC/ARM/directive-arm-thumb-alignment.s @@ -10,12 +10,12 @@ @ CHECK: Num: Value Size Type Bind Vis Ndx Name @ CHECK-NEXT: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND @ CHECK-NEXT: 1: 00000001 0 FUNC LOCAL DEFAULT 2 aligned_thumb -@ CHECK-NEXT: 2: 00000000 0 NOTYPE LOCAL DEFAULT 2 $t.0 +@ CHECK-NEXT: 2: 00000000 0 NOTYPE LOCAL DEFAULT 2 $t @ CHECK-NEXT: 3: 00000004 0 FUNC LOCAL DEFAULT 2 thumb_to_arm -@ CHECK-NEXT: 4: 00000004 0 NOTYPE LOCAL DEFAULT 2 $a.1 -@ CHECK-NEXT: 5: 00000008 0 NOTYPE LOCAL DEFAULT 2 $d.2 +@ CHECK-NEXT: 4: 00000004 0 NOTYPE LOCAL DEFAULT 2 $a +@ CHECK-NEXT: 5: 00000008 0 NOTYPE LOCAL DEFAULT 2 $d @ CHECK-NEXT: 6: 0000000b 0 FUNC LOCAL DEFAULT 2 unaligned_arm_to_thumb -@ CHECK-NEXT: 7: 0000000a 0 NOTYPE LOCAL DEFAULT 2 $t.3 +@ CHECK-NEXT: 7: 0000000a 0 NOTYPE LOCAL DEFAULT 2 $t .thumb diff --git a/llvm/test/MC/ARM/multi-section-mapping.s b/llvm/test/MC/ARM/multi-section-mapping.s index 6107f262b0b8c..ed531306042aa 100644 --- a/llvm/test/MC/ARM/multi-section-mapping.s +++ b/llvm/test/MC/ARM/multi-section-mapping.s @@ -1,4 +1,4 @@ -@ RUN: llvm-mc -triple=armv7-linux-gnueabi -filetype=obj < %s | llvm-objdump -t - | FileCheck %s +@ RUN: llvm-mc -triple=armv7-linux-gnueabi -filetype=obj < %s | llvm-objdump -t - | FileCheck %s --match-full-lines .text add r0, r0, r0 @@ -42,10 +42,10 @@ @ + .starts_thumb to have $t at 0 @ + .starts_data to have $d at 0 -@ CHECK: 00000000 l .text 00000000 $a.0 -@ CHECK-NEXT: 00000000 l .wibble 00000000 $a.1 -@ CHECK-NEXT: 00000000 l .starts_thumb 00000000 $t.2 -@ CHECK-NEXT: 00000008 l .text 00000000 $t.3 -@ CHECK-NEXT: 0000000a l .text 00000000 $d.4 +@ CHECK: 00000000 l .text 00000000 $a +@ CHECK-NEXT: 00000000 l .wibble 00000000 $a +@ CHECK-NEXT: 00000000 l .starts_thumb 00000000 $t +@ CHECK-NEXT: 00000008 l .text 00000000 $t +@ CHECK-NEXT: 0000000a l .text 00000000 $d @ CHECK-NOT: ${{[adt]}} diff --git a/llvm/test/MC/ARM/thumb-function-address.s b/llvm/test/MC/ARM/thumb-function-address.s index 753a049137bbf..d69dcb6724019 100644 --- a/llvm/test/MC/ARM/thumb-function-address.s +++ b/llvm/test/MC/ARM/thumb-function-address.s @@ -35,8 +35,8 @@ label: @ CHECK-NEXT: 00000000 0 NOTYPE LOCAL DEFAULT UND @ CHECK-NEXT: 00000001 0 FUNC LOCAL DEFAULT 2 func_label @ CHECK-NEXT: 00000001 0 FUNC LOCAL DEFAULT 2 foo_impl -@ CHECK-NEXT: 00000000 0 NOTYPE LOCAL DEFAULT 2 $t.0 +@ CHECK-NEXT: 00000000 0 NOTYPE LOCAL DEFAULT 2 $t @ CHECK-NEXT: 00000003 0 FUNC LOCAL DEFAULT 2 foo_resolver @ CHECK-NEXT: 00000003 0 IFUNC LOCAL DEFAULT 2 foo @ CHECK-NEXT: 00000004 0 FUNC LOCAL DEFAULT 2 label -@ CHECK-NEXT: 00000008 0 NOTYPE LOCAL DEFAULT 2 $a.1 +@ CHECK-NEXT: 00000008 0 NOTYPE LOCAL DEFAULT 2 $a diff --git a/llvm/test/MC/ARM/thumb-types.s b/llvm/test/MC/ARM/thumb-types.s index cb1b47e1fa7fb..b965cd8accf05 100644 --- a/llvm/test/MC/ARM/thumb-types.s +++ b/llvm/test/MC/ARM/thumb-types.s @@ -3,22 +3,22 @@ @ CHECK: Num: Value Size Type Bind Vis Ndx Name @ CHECK-NEXT: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND @ CHECK-NEXT: 1: 00000001 0 FUNC LOCAL DEFAULT 2 implicit_function -@ CHECK-NEXT: 2: 00000000 0 NOTYPE LOCAL DEFAULT 2 $t.0 +@ CHECK-NEXT: 2: 00000000 0 NOTYPE LOCAL DEFAULT 2 $t @ CHECK-NEXT: 3: 00000002 0 OBJECT LOCAL DEFAULT 2 implicit_data -@ CHECK-NEXT: 4: 00000002 0 NOTYPE LOCAL DEFAULT 2 $d.1 +@ CHECK-NEXT: 4: 00000002 0 NOTYPE LOCAL DEFAULT 2 $d @ CHECK-NEXT: 5: 00000008 0 FUNC LOCAL DEFAULT 2 arm_function -@ CHECK-NEXT: 6: 00000008 0 NOTYPE LOCAL DEFAULT 2 $a.2 +@ CHECK-NEXT: 6: 00000008 0 NOTYPE LOCAL DEFAULT 2 $a @ CHECK-NEXT: 7: 0000000c 0 NOTYPE LOCAL DEFAULT 2 untyped_text_label -@ CHECK-NEXT: 8: 0000000c 0 NOTYPE LOCAL DEFAULT 2 $t.3 +@ CHECK-NEXT: 8: 0000000c 0 NOTYPE LOCAL DEFAULT 2 $t @ CHECK-NEXT: 9: 0000000f 0 FUNC LOCAL DEFAULT 2 explicit_function -@ CHECK-NEXT: 10: 00000010 0 NOTYPE LOCAL DEFAULT 2 $d.4 +@ CHECK-NEXT: 10: 00000010 0 NOTYPE LOCAL DEFAULT 2 $d @ CHECK-NEXT: 11: 00000000 4 TLS LOCAL DEFAULT 5 tls @ CHECK-NEXT: 12: 00000015 0 IFUNC LOCAL DEFAULT 2 indirect_function -@ CHECK-NEXT: 13: 00000014 0 NOTYPE LOCAL DEFAULT 2 $t.5 +@ CHECK-NEXT: 13: 00000014 0 NOTYPE LOCAL DEFAULT 2 $t @ CHECK-NEXT: 14: 00000000 0 NOTYPE LOCAL DEFAULT 4 untyped_data_label -@ CHECK-NEXT: 15: 00000000 0 NOTYPE LOCAL DEFAULT 4 $t.6 +@ CHECK-NEXT: 15: 00000000 0 NOTYPE LOCAL DEFAULT 4 $t @ CHECK-NEXT: 16: 00000002 0 OBJECT LOCAL DEFAULT 4 explicit_data -@ CHECK-NEXT: 17: 00000002 0 NOTYPE LOCAL DEFAULT 4 $d.7 +@ CHECK-NEXT: 17: 00000002 0 NOTYPE LOCAL DEFAULT 4 $d .syntax unified diff --git a/llvm/test/MC/ARM/thumb_set.s b/llvm/test/MC/ARM/thumb_set.s index 4bb7b599aaf11..836eb0b62e0fa 100644 --- a/llvm/test/MC/ARM/thumb_set.s +++ b/llvm/test/MC/ARM/thumb_set.s @@ -6,12 +6,12 @@ @ CHECK: Num: Value Size Type Bind Vis Ndx Name @ CHECK-NEXT: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND @ CHECK-NEXT: 1: 00000000 0 FUNC LOCAL DEFAULT 2 arm_func -@ CHECK-NEXT: 2: 00000000 0 NOTYPE LOCAL DEFAULT 2 $a.0 +@ CHECK-NEXT: 2: 00000000 0 NOTYPE LOCAL DEFAULT 2 $a @ CHECK-NEXT: 3: 00000001 0 FUNC LOCAL DEFAULT 2 alias_arm_func @ CHECK-NEXT: 4: 00000001 0 FUNC LOCAL DEFAULT 2 alias_arm_func2 @ CHECK-NEXT: 5: 00000001 0 FUNC LOCAL DEFAULT 2 alias_arm_func3 @ CHECK-NEXT: 6: 00000005 0 FUNC LOCAL DEFAULT 2 thumb_func -@ CHECK-NEXT: 7: 00000004 0 NOTYPE LOCAL DEFAULT 2 $t.1 +@ CHECK-NEXT: 7: 00000004 0 NOTYPE LOCAL DEFAULT 2 $t @ CHECK-NEXT: 8: 00000005 0 FUNC LOCAL DEFAULT 2 alias_thumb_func @ CHECK-NEXT: 9: 5eed1e55 0 FUNC LOCAL DEFAULT ABS seedless @ CHECK-NEXT: 10: e665a1ad 0 FUNC LOCAL DEFAULT ABS eggsalad diff --git a/llvm/test/MC/AVR/inst-brbc.s b/llvm/test/MC/AVR/inst-brbc.s index 4d7d684da4468..3ef3664cf07bf 100644 --- a/llvm/test/MC/AVR/inst-brbc.s +++ b/llvm/test/MC/AVR/inst-brbc.s @@ -3,7 +3,6 @@ ; RUN: | llvm-objdump -d - | FileCheck --check-prefix=INST %s foo: - brbc 3, .+8 brbc 0, .-16 .short 0xf759 @@ -11,14 +10,16 @@ foo: .short 0xf74c .short 0xf4c7 -; CHECK: brvc .Ltmp0+8 ; encoding: [0bAAAAA011,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp0+8, kind: fixup_7_pcrel -; CHECK: brcc .Ltmp1-16 ; encoding: [0bAAAAA000,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp1-16, kind: fixup_7_pcrel +; CHECK: brvc (.Ltmp0+8)+2 ; encoding: [0bAAAAA011,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+8)+2, kind: fixup_7_pcrel +; +; CHECK: brcc (.Ltmp1-16)+2 ; encoding: [0bAAAAA000,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1-16)+2, kind: fixup_7_pcrel -; INST: 23 f4 brvc .+8 -; INST: c0 f7 brsh .-16 -; INST: 59 f7 brne .-42 -; INST: 52 f7 brpl .-44 -; INST: 4c f7 brge .-46 -; INST: c7 f4 brid .+48 +; INST-LABEL: : +; INST-NEXT: 23 f4 brvc .+8 +; INST-NEXT: c0 f7 brsh .-16 +; INST-NEXT: 59 f7 brne .-42 +; INST-NEXT: 52 f7 brpl .-44 +; INST-NEXT: 4c f7 brge .-46 +; INST-NEXT: c7 f4 brid .+48 diff --git a/llvm/test/MC/AVR/inst-brbs.s b/llvm/test/MC/AVR/inst-brbs.s index 7987feeec654a..f15a779a53654 100644 --- a/llvm/test/MC/AVR/inst-brbs.s +++ b/llvm/test/MC/AVR/inst-brbs.s @@ -3,7 +3,6 @@ ; RUN: | llvm-objdump -d - | FileCheck --check-prefix=INST %s foo: - brbs 3, .+8 brbs 0, .-12 .short 0xf359 @@ -11,14 +10,15 @@ foo: .short 0xf34c .short 0xf077 -; CHECK: brvs .Ltmp0+8 ; encoding: [0bAAAAA011,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp0+8, kind: fixup_7_pcrel -; CHECK: brcs .Ltmp1-12 ; encoding: [0bAAAAA000,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp1-12, kind: fixup_7_pcrel +; CHECK: brvs (.Ltmp0+8)+2 ; encoding: [0bAAAAA011,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+8)+2, kind: fixup_7_pcrel +; CHECK: brcs (.Ltmp1-12)+2 ; encoding: [0bAAAAA000,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1-12)+2, kind: fixup_7_pcrel -; INST: 23 f0 brvs .+8 -; INST: d0 f3 brlo .-12 -; INST: 59 f3 breq .-42 -; INST: 52 f3 brmi .-44 -; INST: 4c f3 brlt .-46 -; INST: 77 f0 brie .+28 +; INST-LABEL: : +; INST-NEXT: 23 f0 brvs .+8 +; INST-NEXT: d0 f3 brlo .-12 +; INST-NEXT: 59 f3 breq .-42 +; INST-NEXT: 52 f3 brmi .-44 +; INST-NEXT: 4c f3 brlt .-46 +; INST-NEXT: 77 f0 brie .+28 diff --git a/llvm/test/MC/AVR/inst-brcc.s b/llvm/test/MC/AVR/inst-brcc.s new file mode 100644 index 0000000000000..d9218bc61e787 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brcc.s @@ -0,0 +1,28 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brcc .+66 + brcc .-22 + brbc 0, .+66 + brbc 0, bar + +bar: + +; CHECK: brcc (.Ltmp0+66)+2 ; encoding: [0bAAAAA000,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+66)+2, kind: fixup_7_pcrel +; CHECK: brcc (.Ltmp1-22)+2 ; encoding: [0bAAAAA000,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1-22)+2, kind: fixup_7_pcrel +; CHECK: brcc (.Ltmp2+66)+2 ; encoding: [0bAAAAA000,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp2+66)+2, kind: fixup_7_pcrel +; CHECK: brcc bar ; encoding: [0bAAAAA000,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: 08 f5 brsh .+66 +; INST-NEXT: a8 f7 brsh .-22 +; INST-NEXT: 08 f5 brsh .+66 +; INST-NEXT: 00 f4 brsh .+0 diff --git a/llvm/test/MC/AVR/inst-brcs.s b/llvm/test/MC/AVR/inst-brcs.s new file mode 100644 index 0000000000000..0012cb31f6126 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brcs.s @@ -0,0 +1,28 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brcs .+8 + brcs .+4 + brbs 0, .+8 + brbs 0, bar + +bar: + +; CHECK: brcs (.Ltmp0+8)+2 ; encoding: [0bAAAAA000,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+8)+2, kind: fixup_7_pcrel +; CHECK: brcs (.Ltmp1+4)+2 ; encoding: [0bAAAAA000,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+4)+2, kind: fixup_7_pcrel +; CHECK: brcs (.Ltmp2+8)+2 ; encoding: [0bAAAAA000,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp2+8)+2, kind: fixup_7_pcrel +; CHECK: brcs bar ; encoding: [0bAAAAA000,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: 20 f0 brlo .+8 +; INST-NEXT: 10 f0 brlo .+4 +; INST-NEXT: 20 f0 brlo .+8 +; INST-NEXT: 00 f0 brlo .+0 diff --git a/llvm/test/MC/AVR/inst-breq.s b/llvm/test/MC/AVR/inst-breq.s new file mode 100644 index 0000000000000..f82010f02ba61 --- /dev/null +++ b/llvm/test/MC/AVR/inst-breq.s @@ -0,0 +1,28 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + breq .-18 + breq .-12 + brbs 1, .-18 + brbs 1, bar + +bar: + +; CHECK: breq (.Ltmp0-18)+2 ; encoding: [0bAAAAA001,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0-18)+2, kind: fixup_7_pcrel +; CHECK: breq (.Ltmp1-12)+2 ; encoding: [0bAAAAA001,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1-12)+2, kind: fixup_7_pcrel +; CHECK: brbs 1, (.Ltmp2-18)+2 ; encoding: [0bAAAAA001,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp2-18)+2, kind: fixup_7_pcrel +; CHECK: brbs 1, bar ; encoding: [0bAAAAA001,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: b9 f3 breq .-18 +; INST-NEXT: d1 f3 breq .-12 +; INST-NEXT: b9 f3 breq .-18 +; INST-NEXT: 01 f0 breq .+0 diff --git a/llvm/test/MC/AVR/inst-brge.s b/llvm/test/MC/AVR/inst-brge.s new file mode 100644 index 0000000000000..1121284a11468 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brge.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brge .+50 + brge .+42 + brge bar + +bar: + +; CHECK: brge (.Ltmp0+50)+2 ; encoding: [0bAAAAA100,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+50)+2, kind: fixup_7_pcrel +; CHECK: brge (.Ltmp1+42)+2 ; encoding: [0bAAAAA100,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+42)+2, kind: fixup_7_pcrel +; CHECK: brge bar ; encoding: [0bAAAAA100,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: cc f4 brge .+50 +; INST-NEXT: ac f4 brge .+42 +; INST-NEXT: 04 f4 brge .+0 diff --git a/llvm/test/MC/AVR/inst-brhc.s b/llvm/test/MC/AVR/inst-brhc.s new file mode 100644 index 0000000000000..eb16ac2ef7a64 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brhc.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brhc .+12 + brhc .+14 + brhc bar + +bar: + +; CHECK: brhc (.Ltmp0+12)+2 ; encoding: [0bAAAAA101,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+12)+2, kind: fixup_7_pcrel +; CHECK: brhc (.Ltmp1+14)+2 ; encoding: [0bAAAAA101,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+14)+2, kind: fixup_7_pcrel +; CHECK: brhc bar ; encoding: [0bAAAAA101,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: 35 f4 brhc .+12 +; INST-NEXT: 3d f4 brhc .+14 +; INST-NEXT: 05 f4 brhc .+0 diff --git a/llvm/test/MC/AVR/inst-brhs.s b/llvm/test/MC/AVR/inst-brhs.s new file mode 100644 index 0000000000000..77c49596b3b0b --- /dev/null +++ b/llvm/test/MC/AVR/inst-brhs.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brhs .-66 + brhs .+14 + brhs bar + +bar: + +; CHECK: brhs (.Ltmp0-66)+2 ; encoding: [0bAAAAA101,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0-66)+2, kind: fixup_7_pcrel +; CHECK: brhs (.Ltmp1+14)+2 ; encoding: [0bAAAAA101,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+14)+2, kind: fixup_7_pcrel +; CHECK: brhs bar ; encoding: [0bAAAAA101,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: fd f2 brhs .-66 +; INST-NEXT: 3d f0 brhs .+14 +; INST-NEXT: 05 f0 brhs .+0 diff --git a/llvm/test/MC/AVR/inst-brid.s b/llvm/test/MC/AVR/inst-brid.s new file mode 100644 index 0000000000000..70d0ea83c49b2 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brid.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brid .+42 + brid .+62 + brid bar + +bar: + +; CHECK: brid (.Ltmp0+42)+2 ; encoding: [0bAAAAA111,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+42)+2, kind: fixup_7_pcrel +; CHECK: brid (.Ltmp1+62)+2 ; encoding: [0bAAAAA111,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+62)+2, kind: fixup_7_pcrel +; CHECK: brid bar ; encoding: [0bAAAAA111,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: af f4 brid .+42 +; INST-NEXT: ff f4 brid .+62 +; INST-NEXT: 07 f4 brid .+0 diff --git a/llvm/test/MC/AVR/inst-brie.s b/llvm/test/MC/AVR/inst-brie.s new file mode 100644 index 0000000000000..717c686e2ed44 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brie.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brie .+20 + brie .+40 + brie bar + +bar: + +; CHECK: brie (.Ltmp0+20)+2 ; encoding: [0bAAAAA111,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+20)+2, kind: fixup_7_pcrel +; CHECK: brie (.Ltmp1+40)+2 ; encoding: [0bAAAAA111,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+40)+2, kind: fixup_7_pcrel +; CHECK: brie bar ; encoding: [0bAAAAA111,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: 57 f0 brie .+20 +; INST-NEXT: a7 f0 brie .+40 +; INST-NEXT: 07 f0 brie .+0 diff --git a/llvm/test/MC/AVR/inst-brlo.s b/llvm/test/MC/AVR/inst-brlo.s new file mode 100644 index 0000000000000..4b56d66ffdfe0 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brlo.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brlo .+12 + brlo .+28 + brlo bar + +bar: + +; CHECK: brlo (.Ltmp0+12)+2 ; encoding: [0bAAAAA000,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+12)+2, kind: fixup_7_pcrel +; CHECK: brlo (.Ltmp1+28)+2 ; encoding: [0bAAAAA000,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+28)+2, kind: fixup_7_pcrel +; CHECK: brlo bar ; encoding: [0bAAAAA000,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: 30 f0 brlo .+12 +; INST-NEXT: 70 f0 brlo .+28 +; INST-NEXT: 00 f0 brlo .+0 diff --git a/llvm/test/MC/AVR/inst-brlt.s b/llvm/test/MC/AVR/inst-brlt.s new file mode 100644 index 0000000000000..8a7c543f9444b --- /dev/null +++ b/llvm/test/MC/AVR/inst-brlt.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brlt .+16 + brlt .+2 + brlt bar + +bar: + +; CHECK: brlt (.Ltmp0+16)+2 ; encoding: [0bAAAAA100,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+16)+2, kind: fixup_7_pcrel +; CHECK: brlt (.Ltmp1+2)+2 ; encoding: [0bAAAAA100,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+2)+2, kind: fixup_7_pcrel +; CHECK: brlt bar ; encoding: [0bAAAAA100,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: 44 f0 brlt .+16 +; INST-NEXT: 0c f0 brlt .+2 +; INST-NEXT: 04 f0 brlt .+0 diff --git a/llvm/test/MC/AVR/inst-brmi.s b/llvm/test/MC/AVR/inst-brmi.s new file mode 100644 index 0000000000000..878612d294dd9 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brmi.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brmi .+66 + brmi .+58 + brmi bar + +bar: + +; CHECK: brmi (.Ltmp0+66)+2 ; encoding: [0bAAAAA010,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+66)+2, kind: fixup_7_pcrel +; CHECK: brmi (.Ltmp1+58)+2 ; encoding: [0bAAAAA010,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+58)+2, kind: fixup_7_pcrel +; CHECK: brmi bar ; encoding: [0bAAAAA010,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: 0a f1 brmi .+66 +; INST-NEXT: ea f0 brmi .+58 +; INST-NEXT: 02 f0 brmi .+0 diff --git a/llvm/test/MC/AVR/inst-brne.s b/llvm/test/MC/AVR/inst-brne.s new file mode 100644 index 0000000000000..9d6bee4b754d9 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brne.s @@ -0,0 +1,28 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brne .+10 + brne .+2 + brbc 1, .+10 + brbc 1, bar + +bar: + +; CHECK: brne (.Ltmp0+10)+2 ; encoding: [0bAAAAA001,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+10)+2, kind: fixup_7_pcrel +; CHECK: brne (.Ltmp1+2)+2 ; encoding: [0bAAAAA001,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+2)+2, kind: fixup_7_pcrel +; CHECK: brbc 1, (.Ltmp2+10)+2 ; encoding: [0bAAAAA001,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp2+10)+2, kind: fixup_7_pcrel +; CHECK: brbc 1, bar ; encoding: [0bAAAAA001,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: 29 f4 brne .+10 +; INST-NEXT: 09 f4 brne .+2 +; INST-NEXT: 29 f4 brne .+10 +; INST-NEXT: 01 f4 brne .+0 diff --git a/llvm/test/MC/AVR/inst-brpl.s b/llvm/test/MC/AVR/inst-brpl.s new file mode 100644 index 0000000000000..393365ee35339 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brpl.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brpl .-12 + brpl .+18 + brpl bar + +bar: + +; CHECK: brpl (.Ltmp0-12)+2 ; encoding: [0bAAAAA010,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0-12)+2, kind: fixup_7_pcrel +; CHECK: brpl (.Ltmp1+18)+2 ; encoding: [0bAAAAA010,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+18)+2, kind: fixup_7_pcrel +; CHECK: brpl bar ; encoding: [0bAAAAA010,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: d2 f7 brpl .-12 +; INST-NEXT: 4a f4 brpl .+18 +; INST-NEXT: 02 f4 brpl .+0 diff --git a/llvm/test/MC/AVR/inst-brsh.s b/llvm/test/MC/AVR/inst-brsh.s new file mode 100644 index 0000000000000..0bacd64d3d8d0 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brsh.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brsh .+32 + brsh .+70 + brsh bar + +bar: + +; CHECK: brsh (.Ltmp0+32)+2 ; encoding: [0bAAAAA000,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+32)+2, kind: fixup_7_pcrel +; CHECK: brsh (.Ltmp1+70)+2 ; encoding: [0bAAAAA000,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+70)+2, kind: fixup_7_pcrel +; CHECK: brsh bar ; encoding: [0bAAAAA000,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: 80 f4 brsh .+32 +; INST-NEXT: 18 f5 brsh .+70 +; INST-NEXT: 00 f4 brsh .+0 diff --git a/llvm/test/MC/AVR/inst-brtc.s b/llvm/test/MC/AVR/inst-brtc.s new file mode 100644 index 0000000000000..eb4ee21162872 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brtc.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brtc .+52 + brtc .+50 + brtc bar + +bar: + +; CHECK: brtc (.Ltmp0+52)+2 ; encoding: [0bAAAAA110,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+52)+2, kind: fixup_7_pcrel +; CHECK: brtc (.Ltmp1+50)+2 ; encoding: [0bAAAAA110,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+50)+2, kind: fixup_7_pcrel +; CHECK: brtc bar ; encoding: [0bAAAAA110,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: d6 f4 brtc .+52 +; INST-NEXT: ce f4 brtc .+50 +; INST-NEXT: 06 f4 brtc .+0 diff --git a/llvm/test/MC/AVR/inst-brts.s b/llvm/test/MC/AVR/inst-brts.s new file mode 100644 index 0000000000000..ccd794a922589 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brts.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brts .+18 + brts .+22 + brts bar + +bar: + +; CHECK: brts (.Ltmp0+18)+2 ; encoding: [0bAAAAA110,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+18)+2, kind: fixup_7_pcrel +; CHECK: brts (.Ltmp1+22)+2 ; encoding: [0bAAAAA110,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+22)+2, kind: fixup_7_pcrel +; CHECK: brts bar ; encoding: [0bAAAAA110,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: 4e f0 brts .+18 +; INST-NEXT: 5e f0 brts .+22 +; INST-NEXT: 06 f0 brts .+0 diff --git a/llvm/test/MC/AVR/inst-brvc.s b/llvm/test/MC/AVR/inst-brvc.s new file mode 100644 index 0000000000000..573f779c0dcd6 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brvc.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brvc .-28 + brvc .-62 + brvc bar + +bar: + +; CHECK: brvc (.Ltmp0-28)+2 ; encoding: [0bAAAAA011,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0-28)+2, kind: fixup_7_pcrel +; CHECK: brvc (.Ltmp1-62)+2 ; encoding: [0bAAAAA011,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1-62)+2, kind: fixup_7_pcrel +; CHECK: brvc bar ; encoding: [0bAAAAA011,0b111101AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: 93 f7 brvc .-28 +; INST-NEXT: 0b f7 brvc .-62 +; INST-NEXT: 03 f4 brvc .+0 diff --git a/llvm/test/MC/AVR/inst-brvs.s b/llvm/test/MC/AVR/inst-brvs.s new file mode 100644 index 0000000000000..d50a1a9ec5b62 --- /dev/null +++ b/llvm/test/MC/AVR/inst-brvs.s @@ -0,0 +1,24 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; +; RUN: llvm-mc -filetype=obj -triple avr < %s \ +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s + +foo: + brvs .+18 + brvs .+32 + brvs bar + +bar: + +; CHECK: brvs (.Ltmp0+18)+2 ; encoding: [0bAAAAA011,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+18)+2, kind: fixup_7_pcrel +; CHECK: brvs (.Ltmp1+32)+2 ; encoding: [0bAAAAA011,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1+32)+2, kind: fixup_7_pcrel +; CHECK: brvs bar ; encoding: [0bAAAAA011,0b111100AA] +; CHECK-NEXT: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +; INST-LABEL: : +; INST-NEXT: 4b f0 brvs .+18 +; INST-NEXT: 83 f0 brvs .+32 +; INST-NEXT: 03 f0 brvs .+0 diff --git a/llvm/test/MC/AVR/inst-family-cond-branch.s b/llvm/test/MC/AVR/inst-family-cond-branch.s deleted file mode 100644 index dc36425a884f3..0000000000000 --- a/llvm/test/MC/AVR/inst-family-cond-branch.s +++ /dev/null @@ -1,321 +0,0 @@ -; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s -; RUN: llvm-mc -filetype=obj -triple avr < %s \ -; RUN: | llvm-objdump -d - | FileCheck --check-prefix=INST %s - - -foo: - ; BREQ - breq .-18 - breq .-12 - brbs 1, .-18 - brbs 1, baz - -; CHECK: breq .Ltmp0-18 ; encoding: [0bAAAAA001,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp0-18, kind: fixup_7_pcrel -; CHECK: breq .Ltmp1-12 ; encoding: [0bAAAAA001,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp1-12, kind: fixup_7_pcrel -; CHECK: brbs 1, .Ltmp2-18 ; encoding: [0bAAAAA001,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp2-18, kind: fixup_7_pcrel -; CHECK: brbs 1, baz ; encoding: [0bAAAAA001,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: baz, kind: fixup_7_pcrel - -; INST-LABEL: : -; INST: breq .-18 -; INST: breq .-12 -; INST: breq .-18 -; INST: breq .+0 - - ; BRNE - brne .+10 - brne .+2 - brbc 1, .+10 - brbc 1, bar - -; CHECK: brne .Ltmp3+10 ; encoding: [0bAAAAA001,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp3+10, kind: fixup_7_pcrel -; CHECK: brne .Ltmp4+2 ; encoding: [0bAAAAA001,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp4+2, kind: fixup_7_pcrel -; CHECK: brbc 1, .Ltmp5+10 ; encoding: [0bAAAAA001,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp5+10, kind: fixup_7_pcrel -; CHECK: brbc 1, bar ; encoding: [0bAAAAA001,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel - -; INST: brne .+10 -; INST: brne .+2 -; INST: brne .+10 -; INST: brne .+0 - -bar: - ; BRCS - brcs .+8 - brcs .+4 - brbs 0, .+8 - brbs 0, end - -; CHECK: brcs .Ltmp6+8 ; encoding: [0bAAAAA000,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp6+8, kind: fixup_7_pcrel -; CHECK: brcs .Ltmp7+4 ; encoding: [0bAAAAA000,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp7+4, kind: fixup_7_pcrel -; CHECK: brcs .Ltmp8+8 ; encoding: [0bAAAAA000,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp8+8, kind: fixup_7_pcrel -; CHECK: brcs end ; encoding: [0bAAAAA000,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel - -; INST-LABEL: : -; INST: brlo .+8 -; INST: brlo .+4 -; INST: brlo .+8 -; INST: brlo .+0 - - ; BRCC - brcc .+66 - brcc .-22 - brbc 0, .+66 - brbc 0, baz - -; CHECK: brcc .Ltmp9+66 ; encoding: [0bAAAAA000,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp9+66, kind: fixup_7_pcrel -; CHECK: brcc .Ltmp10-22 ; encoding: [0bAAAAA000,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp10-22, kind: fixup_7_pcrel -; CHECK: brcc .Ltmp11+66 ; encoding: [0bAAAAA000,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp11+66, kind: fixup_7_pcrel -; CHECK: brcc baz ; encoding: [0bAAAAA000,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: baz, kind: fixup_7_pcrel - -; INST: brsh .+66 -; INST: brsh .-22 -; INST: brsh .+66 -; INST: brsh .+0 - -; BRSH - brsh .+32 - brsh .+70 - brsh car - -; CHECK: brsh .Ltmp12+32 ; encoding: [0bAAAAA000,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp12+32, kind: fixup_7_pcrel -; CHECK: brsh .Ltmp13+70 ; encoding: [0bAAAAA000,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp13+70, kind: fixup_7_pcrel -; CHECK: brsh car ; encoding: [0bAAAAA000,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel - -; INST: brsh .+32 -; INST: brsh .+70 -; INST: brsh .+0 - -baz: - - ; BRLO - brlo .+12 - brlo .+28 - brlo car - -; CHECK: brlo .Ltmp14+12 ; encoding: [0bAAAAA000,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp14+12, kind: fixup_7_pcrel -; CHECK: brlo .Ltmp15+28 ; encoding: [0bAAAAA000,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp15+28, kind: fixup_7_pcrel -; CHECK: brlo car ; encoding: [0bAAAAA000,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel - -; INST-LABEL: : -; INST: brlo .+12 -; INST: brlo .+28 -; INST: brlo .+0 - - ; BRMI - brmi .+66 - brmi .+58 - brmi car - -; CHECK: brmi .Ltmp16+66 ; encoding: [0bAAAAA010,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp16+66, kind: fixup_7_pcrel -; CHECK: brmi .Ltmp17+58 ; encoding: [0bAAAAA010,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp17+58, kind: fixup_7_pcrel -; CHECK: brmi car ; encoding: [0bAAAAA010,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel - -; INST: brmi .+66 -; INST: brmi .+58 -; INST: brmi .+0 - - ; BRPL - brpl .-12 - brpl .+18 - brpl car - -; CHECK: brpl .Ltmp18-12 ; encoding: [0bAAAAA010,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp18-12, kind: fixup_7_pcrel -; CHECK: brpl .Ltmp19+18 ; encoding: [0bAAAAA010,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp19+18, kind: fixup_7_pcrel -; CHECK: brpl car ; encoding: [0bAAAAA010,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel - -; INST: brpl .-12 -; INST: brpl .+18 -; INST: brpl .+0 - -; BRGE - brge .+50 - brge .+42 - brge car - -; CHECK: brge .Ltmp20+50 ; encoding: [0bAAAAA100,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp20+50, kind: fixup_7_pcrel -; CHECK: brge .Ltmp21+42 ; encoding: [0bAAAAA100,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp21+42, kind: fixup_7_pcrel -; CHECK: brge car ; encoding: [0bAAAAA100,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel - -; INST: brge .+50 -; INST: brge .+42 -; INST: brge .+0 - -car: - ; BRLT - brlt .+16 - brlt .+2 - brlt end - -; CHECK: brlt .Ltmp22+16 ; encoding: [0bAAAAA100,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp22+16, kind: fixup_7_pcrel -; CHECK: brlt .Ltmp23+2 ; encoding: [0bAAAAA100,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp23+2, kind: fixup_7_pcrel -; CHECK: brlt end ; encoding: [0bAAAAA100,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel - -; INST-LABEL: : -; INST: brlt .+16 -; INST: brlt .+2 -; INST: brlt .+0 - - ; BRHS - brhs .-66 - brhs .+14 - brhs just_another_label - -; CHECK: brhs .Ltmp24-66 ; encoding: [0bAAAAA101,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp24-66, kind: fixup_7_pcrel -; CHECK: brhs .Ltmp25+14 ; encoding: [0bAAAAA101,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp25+14, kind: fixup_7_pcrel -; CHECK: brhs just_another_label ; encoding: [0bAAAAA101,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: just_another_label, kind: fixup_7_pcrel - -; INST: brhs .-66 -; INST: brhs .+14 -; INST: brhs .+0 - - ; BRHC - brhc .+12 - brhc .+14 - brhc just_another_label - -; CHECK: brhc .Ltmp26+12 ; encoding: [0bAAAAA101,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp26+12, kind: fixup_7_pcrel -; CHECK: brhc .Ltmp27+14 ; encoding: [0bAAAAA101,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp27+14, kind: fixup_7_pcrel -; CHECK: brhc just_another_label ; encoding: [0bAAAAA101,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: just_another_label, kind: fixup_7_pcrel - -; INST: brhc .+12 -; INST: brhc .+14 -; INST: brhc .+0 - - ; BRTS - brts .+18 - brts .+22 - brts just_another_label - -; CHECK: brts .Ltmp28+18 ; encoding: [0bAAAAA110,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp28+18, kind: fixup_7_pcrel -; CHECK: brts .Ltmp29+22 ; encoding: [0bAAAAA110,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp29+22, kind: fixup_7_pcrel -; CHECK: brts just_another_label ; encoding: [0bAAAAA110,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: just_another_label, kind: fixup_7_pcrel - -; INST: brts .+18 -; INST: brts .+22 -; INST: brts .+0 - -just_another_label: - ; BRTC - brtc .+52 - brtc .+50 - brtc end - -; CHECK: brtc .Ltmp30+52 ; encoding: [0bAAAAA110,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp30+52, kind: fixup_7_pcrel -; CHECK: brtc .Ltmp31+50 ; encoding: [0bAAAAA110,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp31+50, kind: fixup_7_pcrel -; CHECK: brtc end ; encoding: [0bAAAAA110,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel - -; INST-LABEL: : -; INST: brtc .+52 -; INST: brtc .+50 -; INST: brtc .+0 - - ; BRVS - brvs .+18 - brvs .+32 - brvs end - -; CHECK: brvs .Ltmp32+18 ; encoding: [0bAAAAA011,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp32+18, kind: fixup_7_pcrel -; CHECK: brvs .Ltmp33+32 ; encoding: [0bAAAAA011,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp33+32, kind: fixup_7_pcrel -; CHECK: brvs end ; encoding: [0bAAAAA011,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel - -; INST: brvs .+18 -; INST: brvs .+32 -; INST: brvs .+0 - - ; BRVC - brvc .-28 - brvc .-62 - brvc end - -; CHECK: brvc .Ltmp34-28 ; encoding: [0bAAAAA011,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp34-28, kind: fixup_7_pcrel -; CHECK: brvc .Ltmp35-62 ; encoding: [0bAAAAA011,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp35-62, kind: fixup_7_pcrel -; CHECK: brvc end ; encoding: [0bAAAAA011,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel - -; INST: brvc .-28 -; INST: brvc .-62 -; INST: brvc .+0 - - ; BRIE - brie .+20 - brie .+40 - brie end - -; CHECK: brie .Ltmp36+20 ; encoding: [0bAAAAA111,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp36+20, kind: fixup_7_pcrel -; CHECK: brie .Ltmp37+40 ; encoding: [0bAAAAA111,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp37+40, kind: fixup_7_pcrel -; CHECK: brie end ; encoding: [0bAAAAA111,0b111100AA] -; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel - -; INST: brie .+20 -; INST: brie .+40 -; INST: brie .+0 - - ; BRID - brid .+42 - brid .+62 - brid end - -; CHECK: brid .Ltmp38+42 ; encoding: [0bAAAAA111,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp38+42, kind: fixup_7_pcrel -; CHECK: brid .Ltmp39+62 ; encoding: [0bAAAAA111,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp39+62, kind: fixup_7_pcrel -; CHECK: brid end ; encoding: [0bAAAAA111,0b111101AA] -; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel - -; INST: brid .+42 -; INST: brid .+62 -; INST: brid .+0 - -end: diff --git a/llvm/test/MC/AVR/inst-rcall.s b/llvm/test/MC/AVR/inst-rcall.s index 006013aa6ea94..a4ec32d05b1a4 100644 --- a/llvm/test/MC/AVR/inst-rcall.s +++ b/llvm/test/MC/AVR/inst-rcall.s @@ -1,27 +1,28 @@ ; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; ; RUN: llvm-mc -filetype=obj -triple avr < %s \ -; RUN: | llvm-objdump -d - | FileCheck --check-prefix=INST %s - +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s foo: - rcall .+0 rcall .-8 rcall .+12 rcall .+46 .short 0xdfea -; CHECK: rcall .Ltmp0+0 ; encoding: [A,0b1101AAAA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp0+0, kind: fixup_13_pcrel -; CHECK: rcall .Ltmp1-8 ; encoding: [A,0b1101AAAA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp1-8, kind: fixup_13_pcrel -; CHECK: rcall .Ltmp2+12 ; encoding: [A,0b1101AAAA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp2+12, kind: fixup_13_pcrel -; CHECK: rcall .Ltmp3+46 ; encoding: [A,0b1101AAAA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp3+46, kind: fixup_13_pcrel +; CHECK: rcall (.Ltmp0+0)+2 ; encoding: [A,0b1101AAAA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+0)+2, kind: fixup_13_pcrel +; CHECK: rcall (.Ltmp1-8)+2 ; encoding: [A,0b1101AAAA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1-8)+2, kind: fixup_13_pcrel +; CHECK: rcall (.Ltmp2+12)+2 ; encoding: [A,0b1101AAAA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp2+12)+2, kind: fixup_13_pcrel +; CHECK: rcall (.Ltmp3+46)+2 ; encoding: [A,0b1101AAAA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp3+46)+2, kind: fixup_13_pcrel -; INST: 00 d0 rcall .+0 -; INST: fc df rcall .-8 -; INST: 06 d0 rcall .+12 -; INST: 17 d0 rcall .+46 -; INST: ea df rcall .-44 +; INST-LABEL: : +; INST-NEXT: 00 d0 rcall .+0 +; INST-NEXT: fc df rcall .-8 +; INST-NEXT: 06 d0 rcall .+12 +; INST-NEXT: 17 d0 rcall .+46 +; INST-NEXT: ea df rcall .-44 diff --git a/llvm/test/MC/AVR/inst-rjmp.s b/llvm/test/MC/AVR/inst-rjmp.s index 3dbac39e055dd..cc843a58b55d2 100644 --- a/llvm/test/MC/AVR/inst-rjmp.s +++ b/llvm/test/MC/AVR/inst-rjmp.s @@ -1,49 +1,56 @@ ; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s +; ; RUN: llvm-mc -filetype=obj -triple avr < %s \ -; RUN: | llvm-objdump -d - | FileCheck --check-prefix=INST %s - +; RUN: | llvm-objdump -d - \ +; RUN: | FileCheck --check-prefix=INST %s foo: - rjmp .+2 rjmp .-2 rjmp foo rjmp .+8 rjmp end rjmp .+0 + end: rjmp .-4 rjmp .-6 + x: rjmp x .short 0xc00f -; CHECK: rjmp .Ltmp0+2 ; encoding: [A,0b1100AAAA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp0+2, kind: fixup_13_pcrel -; CHECK: rjmp .Ltmp1-2 ; encoding: [A,0b1100AAAA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp1-2, kind: fixup_13_pcrel -; CHECK: rjmp foo ; encoding: [A,0b1100AAAA] -; CHECK: ; fixup A - offset: 0, value: foo, kind: fixup_13_pcrel -; CHECK: rjmp .Ltmp2+8 ; encoding: [A,0b1100AAAA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp2+8, kind: fixup_13_pcrel -; CHECK: rjmp end ; encoding: [A,0b1100AAAA] -; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_13_pcrel -; CHECK: rjmp .Ltmp3+0 ; encoding: [A,0b1100AAAA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp3+0, kind: fixup_13_pcrel -; CHECK: rjmp .Ltmp4-4 ; encoding: [A,0b1100AAAA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp4-4, kind: fixup_13_pcrel -; CHECK: rjmp .Ltmp5-6 ; encoding: [A,0b1100AAAA] -; CHECK: ; fixup A - offset: 0, value: .Ltmp5-6, kind: fixup_13_pcrel -; CHECK: rjmp x ; encoding: [A,0b1100AAAA] -; CHECK: ; fixup A - offset: 0, value: x, kind: fixup_13_pcrel +; CHECK: rjmp (.Ltmp0+2)+2 ; encoding: [A,0b1100AAAA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp0+2)+2, kind: fixup_13_pcrel +; CHECK: rjmp (.Ltmp1-2)+2 ; encoding: [A,0b1100AAAA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp1-2)+2, kind: fixup_13_pcrel +; CHECK: rjmp foo ; encoding: [A,0b1100AAAA] +; CHECK-NEXT: ; fixup A - offset: 0, value: foo, kind: fixup_13_pcrel +; CHECK: rjmp (.Ltmp2+8)+2 ; encoding: [A,0b1100AAAA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp2+8)+2, kind: fixup_13_pcrel +; CHECK: rjmp end ; encoding: [A,0b1100AAAA] +; CHECK-NEXT: ; fixup A - offset: 0, value: end, kind: fixup_13_pcrel +; CHECK: rjmp (.Ltmp3+0)+2 ; encoding: [A,0b1100AAAA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp3+0)+2, kind: fixup_13_pcrel +; CHECK: rjmp (.Ltmp4-4)+2 ; encoding: [A,0b1100AAAA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp4-4)+2, kind: fixup_13_pcrel +; CHECK: rjmp (.Ltmp5-6)+2 ; encoding: [A,0b1100AAAA] +; CHECK-NEXT: ; fixup A - offset: 0, value: (.Ltmp5-6)+2, kind: fixup_13_pcrel +; CHECK: rjmp x ; encoding: [A,0b1100AAAA] +; CHECK-NEXT: ; fixup A - offset: 0, value: x, kind: fixup_13_pcrel -; INST: 01 c0 rjmp .+2 -; INST: ff cf rjmp .-2 -; INST: 00 c0 rjmp .+0 -; INST: 04 c0 rjmp .+8 -; INST: 00 c0 rjmp .+0 -; INST: 00 c0 rjmp .+0 -; INST: fe cf rjmp .-4 -; INST: fd cf rjmp .-6 -; INST: 00 c0 rjmp .+0 -; INST: 0f c0 rjmp .+30 +; INST-LABEL: : +; INST-NEXT: 01 c0 rjmp .+2 +; INST-NEXT: ff cf rjmp .-2 +; INST-NEXT: fd cf rjmp .-6 +; INST-NEXT: 04 c0 rjmp .+8 +; INST-NEXT: 01 c0 rjmp .+2 +; INST-NEXT: 00 c0 rjmp .+0 +; INST-EMPTY: +; INST-LABEL: : +; INST-NEXT: fe cf rjmp .-4 +; INST-NEXT: fd cf rjmp .-6 +; INST-EMPTY: +; INST-LABEL: : +; INST-NEXT: ff cf rjmp .-2 +; INST-NEXT: 0f c0 rjmp .+30 diff --git a/llvm/test/MC/Disassembler/AArch64/armv8.5a-ssbs.txt b/llvm/test/MC/Disassembler/AArch64/armv8.5a-ssbs.txt index 7698751c88076..84d4fa6accccf 100644 --- a/llvm/test/MC/Disassembler/AArch64/armv8.5a-ssbs.txt +++ b/llvm/test/MC/Disassembler/AArch64/armv8.5a-ssbs.txt @@ -1,5 +1,5 @@ # RUN: llvm-mc -triple=aarch64 -mattr=+ssbs -disassemble < %s | FileCheck %s -# RUN: llvm-mc -triple=aarch64 -mattr=+v8.5a -disassemble < %s | FileCheck %s +# RUN: llvm-mc -triple=aarch64 -mattr=+v8.5a -disassemble < %s | FileCheck %s --check-prefix=NOSPECID # RUN: llvm-mc -triple=aarch64 -mcpu=cortex-a76 -disassemble < %s | FileCheck %s # RUN: llvm-mc -triple=aarch64 -mcpu=cortex-a76ae -disassemble < %s | FileCheck %s # RUN: llvm-mc -triple=aarch64 -mattr=+v8r -disassemble < %s | FileCheck %s --check-prefix=NOSPECID diff --git a/llvm/test/MC/Disassembler/AArch64/basic-a64-instructions.txt b/llvm/test/MC/Disassembler/AArch64/basic-a64-instructions.txt index c76bb0b902096..f46301e8c1c15 100644 --- a/llvm/test/MC/Disassembler/AArch64/basic-a64-instructions.txt +++ b/llvm/test/MC/Disassembler/AArch64/basic-a64-instructions.txt @@ -2,7 +2,7 @@ # RUN: llvm-mc -triple=arm64 -mattr=+v8a,+fp-armv8 -disassemble < %s | FileCheck %s # RUN: llvm-mc -triple=arm64 -mattr=+v8a,+fp-armv8,+fullfp16 -disassemble < %s | FileCheck %s --check-prefix=CHECK --check-prefix=FP16 # RUN: llvm-mc -triple=arm64 -mattr=+v8.2a -disassemble < %s | FileCheck %s --check-prefix=CHECK-V82 -# RUN: llvm-mc -triple=arm64 -mattr=+v8.3a -disassemble < %s | FileCheck %s --check-prefix=CHECK-V83 +# RUN: llvm-mc -triple=arm64 -mattr=+ccidx -disassemble < %s | FileCheck %s --check-prefix=CHECK-V83 #------------------------------------------------------------------------------ # Add/sub (immediate) diff --git a/llvm/test/MC/ELF/ARM/execute-only-section.s b/llvm/test/MC/ELF/ARM/execute-only-section.s index 12020e030cc04..ac5e31f70dba0 100644 --- a/llvm/test/MC/ELF/ARM/execute-only-section.s +++ b/llvm/test/MC/ELF/ARM/execute-only-section.s @@ -18,7 +18,7 @@ foo: // CHECK: Section { -// CHECK: Name: .text (16) +// CHECK: Name: .text // CHECK-NEXT: Type: SHT_PROGBITS (0x1) // CHECK-NEXT: Flags [ (0x20000006) // CHECK-NEXT: SHF_ALLOC (0x2) @@ -29,7 +29,7 @@ foo: // CHECK: } // CHECK: Section { -// CHECK: Name: .text (16) +// CHECK: Name: .text // CHECK-NEXT: Type: SHT_PROGBITS (0x1) // CHECK-NEXT: Flags [ (0x20000006) // CHECK-NEXT: SHF_ALLOC (0x2) @@ -40,6 +40,6 @@ foo: // CHECK: } // CHECK: Symbol { -// CHECK: Name: foo (22) +// CHECK: Name: foo // CHECK: Section: .text (0x3) // CHECK: } diff --git a/llvm/test/MC/LoongArch/Basic/Integer/invalid.s b/llvm/test/MC/LoongArch/Basic/Integer/invalid.s index 958d5cab6f2f3..08a131d4d43f9 100644 --- a/llvm/test/MC/LoongArch/Basic/Integer/invalid.s +++ b/llvm/test/MC/LoongArch/Basic/Integer/invalid.s @@ -99,11 +99,13 @@ jirl $a0, $a0, 0x20000 # CHECK: :[[#@LINE-1]]:16: error: operand must be a symbol with modifier (e.g. %b16) or an integer in the range [-131072, 131068] ## simm20 -pcaddi $a0, -0x80001 -# CHECK: :[[#@LINE-1]]:13: error: immediate must be an integer in the range [-524288, 524287] pcaddu12i $a0, 0x80000 # CHECK: :[[#@LINE-1]]:16: error: immediate must be an integer in the range [-524288, 524287] +## simm20_pcaddi +pcaddi $a0, -0x80001 +# CHECK: :[[#@LINE-1]]:13: error: operand must be a symbol with modifier (e.g. %pcrel_20) or an integer in the range [-524288, 524287] + ## simm20_lu12iw lu12i.w $a0, -0x80001 # CHECK: :[[#@LINE-1]]:14: error: operand must be a symbol with modifier (e.g. %abs_hi20) or an integer in the range [-524288, 524287] diff --git a/llvm/test/MC/LoongArch/Relocations/relocations.s b/llvm/test/MC/LoongArch/Relocations/relocations.s index e83b67199e656..091dce200b7de 100644 --- a/llvm/test/MC/LoongArch/Relocations/relocations.s +++ b/llvm/test/MC/LoongArch/Relocations/relocations.s @@ -288,3 +288,23 @@ addi.d $t1, $a2, %le_lo12_r(foo) # RELOC: R_LARCH_TLS_LE_LO12_R foo 0x0 # INSTR: addi.d $t1, $a2, %le_lo12_r(foo) # FIXUP: fixup A - offset: 0, value: %le_lo12_r(foo), kind: FK_NONE + +pcaddi $t1, %pcrel_20(foo) +# RELOC: R_LARCH_PCREL20_S2 foo 0x0 +# INSTR: pcaddi $t1, %pcrel_20(foo) +# FIXUP: fixup A - offset: 0, value: %pcrel_20(foo), kind: FK_NONE + +pcaddi $t1, %ld_pcrel_20(foo) +# RELOC: R_LARCH_TLS_LD_PCREL20_S2 foo 0x0 +# INSTR: pcaddi $t1, %ld_pcrel_20(foo) +# FIXUP: fixup A - offset: 0, value: %ld_pcrel_20(foo), kind: FK_NONE + +pcaddi $t1, %gd_pcrel_20(foo) +# RELOC: R_LARCH_TLS_GD_PCREL20_S2 foo 0x0 +# INSTR: pcaddi $t1, %gd_pcrel_20(foo) +# FIXUP: fixup A - offset: 0, value: %gd_pcrel_20(foo), kind: FK_NONE + +pcaddi $t1, %desc_pcrel_20(foo) +# RELOC: R_LARCH_TLS_DESC_PCREL20_S2 foo 0x0 +# INSTR: pcaddi $t1, %desc_pcrel_20(foo) +# FIXUP: fixup A - offset: 0, value: %desc_pcrel_20(foo), kind: FK_NONE diff --git a/llvm/test/MC/RISCV/insn_c.s b/llvm/test/MC/RISCV/insn_c.s index 19169e8b08c94..c63e8ab33aef9 100644 --- a/llvm/test/MC/RISCV/insn_c.s +++ b/llvm/test/MC/RISCV/insn_c.s @@ -31,6 +31,16 @@ target: # CHECK-OBJ: c.addi a0, 0xd .insn ci C1, 0, a0, 13 +# CHECK-ASM: .insn ci 1, 0, a6, 13 +# CHECK-ASM: encoding: [0x35,0x08] +# CHECK-OBJ: c.addi a6, 0xd +.insn ci 1, 0, a6, 13 + +# CHECK-ASM: .insn ci 1, 0, a6, 13 +# CHECK-ASM: encoding: [0x35,0x08] +# CHECK-OBJ: c.addi a6, 0xd +.insn ci C1, 0, a6, 13 + # CHECK-ASM: .insn ciw 0, 0, a0, 13 # CHECK-ASM: encoding: [0xa8,0x01] # CHECK-OBJ: c.addi4spn a0, sp, 0xc8 diff --git a/llvm/test/MC/X86/x86_long_nop.s b/llvm/test/MC/X86/x86_long_nop.s index 6136c3db9a3da..b79403bb5f1ec 100644 --- a/llvm/test/MC/X86/x86_long_nop.s +++ b/llvm/test/MC/X86/x86_long_nop.s @@ -19,6 +19,8 @@ # RUN: llvm-mc -filetype=obj -arch=x86 -triple=i686-pc-linux-gnu %s -mcpu=znver3 | llvm-objdump -d --no-show-raw-insn - | FileCheck %s --check-prefix=LNOP15 # RUN: llvm-mc -filetype=obj -arch=x86 -triple=x86_64-pc-linux-gnu -mcpu=znver4 %s | llvm-objdump -d --no-show-raw-insn - | FileCheck %s --check-prefix=LNOP15 # RUN: llvm-mc -filetype=obj -arch=x86 -triple=i686-pc-linux-gnu %s -mcpu=znver4 | llvm-objdump -d --no-show-raw-insn - | FileCheck %s --check-prefix=LNOP15 +# RUN: llvm-mc -filetype=obj -arch=x86 -triple=x86_64-pc-linux-gnu -mcpu=znver5 %s | llvm-objdump -d --no-show-raw-insn - | FileCheck %s --check-prefix=LNOP15 +# RUN: llvm-mc -filetype=obj -arch=x86 -triple=i686-pc-linux-gnu %s -mcpu=znver5 | llvm-objdump -d --no-show-raw-insn - | FileCheck %s --check-prefix=LNOP15 # RUN: llvm-mc -filetype=obj -arch=x86 -triple=i686-pc-linux-gnu -mcpu=nehalem %s | llvm-objdump -d --no-show-raw-insn - | FileCheck --check-prefix=LNOP10 %s # RUN: llvm-mc -filetype=obj -arch=x86 -triple=i686-pc-linux-gnu -mcpu=westmere %s | llvm-objdump -d --no-show-raw-insn - | FileCheck --check-prefix=LNOP10 %s # RUN: llvm-mc -filetype=obj -arch=x86 -triple=i686-pc-linux-gnu -mcpu=sandybridge %s | llvm-objdump -d --no-show-raw-insn - | FileCheck --check-prefix=LNOP15 %s diff --git a/llvm/test/Transforms/ConstraintElimination/pr105785.ll b/llvm/test/Transforms/ConstraintElimination/pr105785.ll new file mode 100644 index 0000000000000..6c340a11dd2e2 --- /dev/null +++ b/llvm/test/Transforms/ConstraintElimination/pr105785.ll @@ -0,0 +1,46 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s + +define void @pr105785(ptr %p) { +; CHECK-LABEL: define void @pr105785( +; CHECK-SAME: ptr [[P:%.*]]) { +; CHECK-NEXT: [[ENTRY:.*]]: +; CHECK-NEXT: br label %[[FOR_COND:.*]] +; CHECK: [[FOR_COND]]: +; CHECK-NEXT: [[FOR_IND:%.*]] = phi i32 [ 0, %[[ENTRY]] ], [ 1, %[[FOR_COND1:.*]] ] +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[FOR_IND]], 0 +; CHECK-NEXT: br i1 [[CMP]], label %[[FOR_COND1]], label %[[FOR_END6:.*]] +; CHECK: [[FOR_COND1]]: +; CHECK-NEXT: [[FOR_IND2:%.*]] = phi i32 [ [[INC:%.*]], %[[FOR_BODY3:.*]] ], [ 0, %[[FOR_COND]] ] +; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[FOR_IND2]], 3 +; CHECK-NEXT: br i1 [[CMP2]], label %[[FOR_BODY3]], label %[[FOR_COND]] +; CHECK: [[FOR_BODY3]]: +; CHECK-NEXT: [[SCMP:%.*]] = call i32 @llvm.scmp.i32.i32(i32 [[FOR_IND]], i32 1) +; CHECK-NEXT: store i32 [[SCMP]], ptr [[P]], align 4 +; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[FOR_IND2]], 1 +; CHECK-NEXT: br label %[[FOR_COND1]] +; CHECK: [[FOR_END6]]: +; CHECK-NEXT: ret void +; +entry: + br label %for.cond + +for.cond: ; preds = %for.cond1, %entry + %for.ind = phi i32 [ 0, %entry ], [ 1, %for.cond1 ] + %cmp = icmp eq i32 %for.ind, 0 + br i1 %cmp, label %for.cond1, label %for.end6 + +for.cond1: ; preds = %for.cond, %for.body3 + %for.ind2 = phi i32 [ %inc, %for.body3 ], [ 0, %for.cond ] + %cmp2 = icmp ult i32 %for.ind2, 3 + br i1 %cmp2, label %for.body3, label %for.cond + +for.body3: ; preds = %for.cond1 + %scmp = call i32 @llvm.scmp.i32.i32(i32 %for.ind, i32 1) + store i32 %scmp, ptr %p, align 4 + %inc = add nuw nsw i32 %for.ind2, 1 + br label %for.cond1 + +for.end6: + ret void +} diff --git a/llvm/test/Transforms/Coroutines/coro-pgo-setbranchweights.ll b/llvm/test/Transforms/Coroutines/coro-pgo-setbranchweights.ll new file mode 100644 index 0000000000000..4f5f936606ca3 --- /dev/null +++ b/llvm/test/Transforms/Coroutines/coro-pgo-setbranchweights.ll @@ -0,0 +1,42 @@ +; RUN: rm -rf %t && split-file %s %t + +; RUN: llvm-profdata merge %t/a.proftext -o %t/a.profdata +; RUN: opt < %t/a.ll --passes=pgo-instr-use -pgo-test-profile-file=%t/a.profdata + +;--- a.ll +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" +target triple = "x86_64-redhat-linux-gnu" + +define void @_bar() presplitcoroutine personality ptr null { + %1 = call token @llvm.coro.save(ptr null) + %2 = call i8 @llvm.coro.suspend(token none, i1 false) + switch i8 %2, label %5 [ + i8 0, label %3 + i8 1, label %4 + ] + +3: ; preds = %0 + ret void + +4: ; preds = %0 + ret void + +5: ; preds = %0 + ret void +} + +declare token @llvm.coro.save(ptr) + +declare i8 @llvm.coro.suspend(token, i1) + +;--- a.proftext +# IR level Instrumentation Flag +:ir + +_bar +# Func Hash: +1063705160175073211 +# Num Counters: +2 +1 +0 diff --git a/llvm/test/Transforms/DCE/intrinsics-bpf.ll b/llvm/test/Transforms/DCE/intrinsics-bpf.ll new file mode 100644 index 0000000000000..135588ba21cbb --- /dev/null +++ b/llvm/test/Transforms/DCE/intrinsics-bpf.ll @@ -0,0 +1,33 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -S < %s -passes=dce | FileCheck %s + +declare i64 @llvm.bpf.load.half(ptr, i64) +declare i64 @llvm.bpf.load.word(ptr, i64) +declare i64 @llvm.bpf.load.byte(ptr, i64) + +define void @test_bpf_load_half(ptr %a, i64 %b) { +; CHECK-LABEL: define void @test_bpf_load_half( +; CHECK-SAME: ptr [[A:%.*]], i64 [[B:%.*]]) { +; CHECK-NEXT: ret void +; + %v = call i64 @llvm.bpf.load.half(ptr %a, i64 %b) + ret void +} + +define void @test_bpf_load_word(ptr %a, i64 %b) { +; CHECK-LABEL: define void @test_bpf_load_word( +; CHECK-SAME: ptr [[A:%.*]], i64 [[B:%.*]]) { +; CHECK-NEXT: ret void +; + %v = call i64 @llvm.bpf.load.word(ptr %a, i64 %b) + ret void +} + +define void @test_bpf_load_byte(ptr %a, i64 %b) { +; CHECK-LABEL: define void @test_bpf_load_byte( +; CHECK-SAME: ptr [[A:%.*]], i64 [[B:%.*]]) { +; CHECK-NEXT: ret void +; + %v = call i64 @llvm.bpf.load.byte(ptr %a, i64 %b) + ret void +} diff --git a/llvm/test/Transforms/GVN/merge-range.ll b/llvm/test/Transforms/GVN/merge-range.ll new file mode 100644 index 0000000000000..ad1fa4cae5662 --- /dev/null +++ b/llvm/test/Transforms/GVN/merge-range.ll @@ -0,0 +1,20 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -passes=gvn -S < %s | FileCheck %s + +define i8 @foo(ptr %arg, i8 %arg1) { +; CHECK-LABEL: define i8 @foo( +; CHECK-SAME: ptr [[ARG:%.*]], i8 [[ARG1:%.*]]) { +; CHECK-NEXT: [[BB:.*:]] +; CHECK-NEXT: [[I:%.*]] = load i8, ptr [[ARG]], align 1, !range [[RNG0:![0-9]+]] +; CHECK-NEXT: [[I3:%.*]] = add i8 [[I]], [[I]] +; CHECK-NEXT: ret i8 [[I3]] +; +bb: + %i = load i8, ptr %arg, align 1, !range !{i8 127, i8 -20} + %i2 = load i8, ptr %arg, align 1, !range !{i8 -27, i8 -24, i8 -20, i8 -17} + %i3 = add i8 %i, %i2 + ret i8 %i3 +} +;. +; CHECK: [[RNG0]] = !{i8 127, i8 -17} +;. diff --git a/llvm/test/Transforms/IndVarSimplify/pr106239.ll b/llvm/test/Transforms/IndVarSimplify/pr106239.ll new file mode 100644 index 0000000000000..8d5aa99539a5a --- /dev/null +++ b/llvm/test/Transforms/IndVarSimplify/pr106239.ll @@ -0,0 +1,36 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -S -passes=indvars < %s | FileCheck %s + +target datalayout = "n8:16:32:64" + +; Make sure it does not crash. + +define i32 @m() { +; CHECK-LABEL: define i32 @m() { +; CHECK-NEXT: [[ENTRY:.*:]] +; CHECK-NEXT: br label %[[FOR_BODY_I6:.*]] +; CHECK: [[FOR_BODY_I6]]: +; CHECK-NEXT: br i1 true, label %[[I_EXIT:.*]], label %[[IF_END_I:.*]] +; CHECK: [[IF_END_I]]: +; CHECK-NEXT: store i64 0, ptr null, align 8 +; CHECK-NEXT: br label %[[FOR_BODY_I6]] +; CHECK: [[I_EXIT]]: +; CHECK-NEXT: ret i32 0 +; +entry: + %div.i4 = sdiv i32 1, 0 + br label %for.body.i6 + +for.body.i6: ; preds = %if.end.i, %entry + %add57.i = phi i32 [ %add.i7, %if.end.i ], [ 0, %entry ] + br i1 true, label %i.exit, label %if.end.i + +if.end.i: ; preds = %for.body.i6 + %add.i7 = add i32 %add57.i, %div.i4 + %conv.i = zext i32 %add57.i to i64 + store i64 %conv.i, ptr null, align 8 + br label %for.body.i6 + +i.exit: ; preds = %for.body.i6 + ret i32 0 +} diff --git a/llvm/test/Transforms/InferAddressSpaces/AMDGPU/store-pointer-to-self.ll b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/store-pointer-to-self.ll new file mode 100644 index 0000000000000..bce0e4ec1fe16 --- /dev/null +++ b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/store-pointer-to-self.ll @@ -0,0 +1,71 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=infer-address-spaces %s | FileCheck %s + +; Make sure memory instructions where the pointer appears in both a +; pointer and value operand work correctly. + +declare void @user(ptr) + +; Make sure only the pointer operand use of the store is replaced +define void @store_flat_pointer_to_self() { +; CHECK-LABEL: define void @store_flat_pointer_to_self() { +; CHECK-NEXT: [[ALLOCA:%.*]] = alloca ptr, align 8, addrspace(5) +; CHECK-NEXT: [[FLAT:%.*]] = addrspacecast ptr addrspace(5) [[ALLOCA]] to ptr +; CHECK-NEXT: store ptr [[FLAT]], ptr addrspace(5) [[ALLOCA]], align 8 +; CHECK-NEXT: call void @user(ptr [[FLAT]]) +; CHECK-NEXT: ret void +; + %alloca = alloca ptr, align 8, addrspace(5) + %flat = addrspacecast ptr addrspace(5) %alloca to ptr + store ptr %flat, ptr %flat, align 8 + call void @user(ptr %flat) + ret void +} + +; FIXME: Should be able to optimize the pointer operand to flat. +define ptr @atomicrmw_xchg_flat_pointer_to_self() { +; CHECK-LABEL: define ptr @atomicrmw_xchg_flat_pointer_to_self() { +; CHECK-NEXT: [[ALLOCA:%.*]] = alloca ptr, align 8, addrspace(5) +; CHECK-NEXT: [[FLAT:%.*]] = addrspacecast ptr addrspace(5) [[ALLOCA]] to ptr +; CHECK-NEXT: [[XCHG:%.*]] = atomicrmw xchg ptr [[FLAT]], ptr [[FLAT]] seq_cst, align 8 +; CHECK-NEXT: call void @user(ptr [[FLAT]]) +; CHECK-NEXT: ret ptr [[XCHG]] +; + %alloca = alloca ptr, align 8, addrspace(5) + %flat = addrspacecast ptr addrspace(5) %alloca to ptr + %xchg = atomicrmw xchg ptr %flat, ptr %flat seq_cst, align 8 + call void @user(ptr %flat) + ret ptr %xchg +} + +define { ptr, i1 } @cmpxchg_flat_pointer_new_to_self(ptr %cmp) { +; CHECK-LABEL: define { ptr, i1 } @cmpxchg_flat_pointer_new_to_self( +; CHECK-SAME: ptr [[CMP:%.*]]) { +; CHECK-NEXT: [[ALLOCA:%.*]] = alloca ptr, align 8, addrspace(5) +; CHECK-NEXT: [[FLAT:%.*]] = addrspacecast ptr addrspace(5) [[ALLOCA]] to ptr +; CHECK-NEXT: [[CMPX:%.*]] = cmpxchg ptr [[FLAT]], ptr [[CMP]], ptr [[FLAT]] seq_cst seq_cst, align 8 +; CHECK-NEXT: call void @user(ptr [[FLAT]]) +; CHECK-NEXT: ret { ptr, i1 } [[CMPX]] +; + %alloca = alloca ptr, align 8, addrspace(5) + %flat = addrspacecast ptr addrspace(5) %alloca to ptr + %cmpx = cmpxchg ptr %flat, ptr %cmp, ptr %flat seq_cst seq_cst, align 8 + call void @user(ptr %flat) + ret { ptr, i1 } %cmpx +} + +define { ptr, i1 } @cmpxchg_flat_pointer_cmp_to_self(ptr %new) { +; CHECK-LABEL: define { ptr, i1 } @cmpxchg_flat_pointer_cmp_to_self( +; CHECK-SAME: ptr [[NEW:%.*]]) { +; CHECK-NEXT: [[ALLOCA:%.*]] = alloca ptr, align 8, addrspace(5) +; CHECK-NEXT: [[FLAT:%.*]] = addrspacecast ptr addrspace(5) [[ALLOCA]] to ptr +; CHECK-NEXT: [[CMPX:%.*]] = cmpxchg ptr [[FLAT]], ptr [[FLAT]], ptr [[NEW]] seq_cst seq_cst, align 8 +; CHECK-NEXT: call void @user(ptr [[FLAT]]) +; CHECK-NEXT: ret { ptr, i1 } [[CMPX]] +; + %alloca = alloca ptr, align 8, addrspace(5) + %flat = addrspacecast ptr addrspace(5) %alloca to ptr + %cmpx = cmpxchg ptr %flat, ptr %flat, ptr %new seq_cst seq_cst, align 8 + call void @user(ptr %flat) + ret { ptr, i1 } %cmpx +} diff --git a/llvm/test/Transforms/Inline/AArch64/sme-pstateza-attrs.ll b/llvm/test/Transforms/Inline/AArch64/sme-pstateza-attrs.ll index 816492768cc0f..5e638103a2b06 100644 --- a/llvm/test/Transforms/Inline/AArch64/sme-pstateza-attrs.ll +++ b/llvm/test/Transforms/Inline/AArch64/sme-pstateza-attrs.ll @@ -231,6 +231,51 @@ define void @shared_za_caller_private_za_callee_call_tpidr2_restore_dont_inline( ret void } +define void @nonzt0_callee() { +; CHECK-LABEL: define void @nonzt0_callee +; CHECK-SAME: () #[[ATTR0]] { +; CHECK-NEXT: call void asm sideeffect " +; CHECK-NEXT: call void @inlined_body() +; CHECK-NEXT: ret void +; + call void asm sideeffect "; inlineasm", ""() + call void @inlined_body() + ret void +} + +define void @shared_zt0_caller_nonzt0_callee_dont_inline() "aarch64_inout_zt0" { +; CHECK-LABEL: define void @shared_zt0_caller_nonzt0_callee_dont_inline +; CHECK-SAME: () #[[ATTR3:[0-9]+]] { +; CHECK-NEXT: call void @nonzt0_callee() +; CHECK-NEXT: ret void +; + call void @nonzt0_callee() + ret void +} + +define void @shared_zt0_callee() "aarch64_inout_zt0" { +; CHECK-LABEL: define void @shared_zt0_callee +; CHECK-SAME: () #[[ATTR3]] { +; CHECK-NEXT: call void asm sideeffect " +; CHECK-NEXT: call void @inlined_body() +; CHECK-NEXT: ret void +; + call void asm sideeffect "; inlineasm", ""() + call void @inlined_body() + ret void +} + +define void @shared_zt0_caller_shared_zt0_callee_inline() "aarch64_inout_zt0" { +; CHECK-LABEL: define void @shared_zt0_caller_shared_zt0_callee_inline +; CHECK-SAME: () #[[ATTR3]] { +; CHECK-NEXT: call void asm sideeffect " +; CHECK-NEXT: call void @inlined_body() +; CHECK-NEXT: ret void +; + call void @shared_zt0_callee() + ret void +} + declare void @__arm_za_disable() declare void @__arm_tpidr2_save() declare void @__arm_tpidr2_restore(ptr) diff --git a/llvm/test/Transforms/InstCombine/pr100298.ll b/llvm/test/Transforms/InstCombine/pr100298.ll new file mode 100644 index 0000000000000..6cf2a71bb916e --- /dev/null +++ b/llvm/test/Transforms/InstCombine/pr100298.ll @@ -0,0 +1,39 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -S -passes=instcombine < %s | FileCheck %s + +; Make sure that the result of computeKnownBits for %indvar is correct. + +define i16 @pr100298() { +; CHECK-LABEL: define i16 @pr100298() { +; CHECK-NEXT: [[ENTRY:.*]]: +; CHECK-NEXT: br label %[[FOR_INC:.*]] +; CHECK: [[FOR_INC]]: +; CHECK-NEXT: [[INDVAR:%.*]] = phi i32 [ -15, %[[ENTRY]] ], [ [[MASK:%.*]], %[[FOR_INC]] ] +; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[INDVAR]], 9 +; CHECK-NEXT: [[MASK]] = and i32 [[ADD]], 65535 +; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i32 [[MASK]], 5 +; CHECK-NEXT: br i1 [[CMP1]], label %[[FOR_INC]], label %[[FOR_END:.*]] +; CHECK: [[FOR_END]]: +; CHECK-NEXT: [[CONV:%.*]] = trunc i32 [[ADD]] to i16 +; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i32 [[MASK]], 3 +; CHECK-NEXT: [[SHL:%.*]] = shl nuw i16 [[CONV]], 14 +; CHECK-NEXT: [[RES:%.*]] = select i1 [[CMP2]], i16 [[CONV]], i16 [[SHL]] +; CHECK-NEXT: ret i16 [[RES]] +; +entry: + br label %for.inc + +for.inc: + %indvar = phi i32 [ -15, %entry ], [ %mask, %for.inc ] + %add = add nsw i32 %indvar, 9 + %mask = and i32 %add, 65535 + %cmp1 = icmp ugt i32 %mask, 5 + br i1 %cmp1, label %for.inc, label %for.end + +for.end: + %conv = trunc i32 %add to i16 + %cmp2 = icmp ugt i32 %mask, 3 + %shl = shl nuw i16 %conv, 14 + %res = select i1 %cmp2, i16 %conv, i16 %shl + ret i16 %res +} diff --git a/llvm/test/Transforms/InstCombine/struct-assign-tbaa-2.ll b/llvm/test/Transforms/InstCombine/struct-assign-tbaa-2.ll new file mode 100644 index 0000000000000..b52a062fc6404 --- /dev/null +++ b/llvm/test/Transforms/InstCombine/struct-assign-tbaa-2.ll @@ -0,0 +1,48 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals +; RUN: opt -passes=instcombine -S < %s | FileCheck %s + +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" + +declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind + +%struct.T = type { %struct.Wrapper, %struct.Wrapper } +%struct.Wrapper = type { i16 } + +define void @test1(ptr %a1, ptr %a2) { +; CHECK-LABEL: @test1( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[B:%.*]] = getelementptr inbounds i8, ptr [[A2:%.*]], i64 2 +; CHECK-NEXT: [[TMP0:%.*]] = load i16, ptr [[A2]], align 2, !tbaa [[TBAA0:![0-9]+]] +; CHECK-NEXT: store i16 [[TMP0]], ptr [[A1:%.*]], align 2, !tbaa [[TBAA0]] +; CHECK-NEXT: [[B2:%.*]] = getelementptr inbounds i8, ptr [[A1]], i64 2 +; CHECK-NEXT: [[TMP1:%.*]] = load i16, ptr [[B]], align 2, !tbaa [[TBAA6:![0-9]+]] +; CHECK-NEXT: store i16 [[TMP1]], ptr [[B2]], align 2, !tbaa [[TBAA6]] +; CHECK-NEXT: ret void +; +entry: + %b = getelementptr inbounds i8, ptr %a2, i64 2 + call void @llvm.memcpy.p0.p0.i64(ptr align 2 %a1, ptr align 2 %a2, i64 2, i1 false), !tbaa !0, !tbaa.struct !6 + %b2 = getelementptr inbounds %struct.T, ptr %a1, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i64(ptr align 2 %b2, ptr align 2 %b, i64 2, i1 false), !tbaa !8, !tbaa.struct !6 + ret void +} + +!0 = !{!1, !4, i64 0, i64 2} +!1 = !{!2, i64 4, !"_ZTS1T", !4, i64 0, i64 2, !4, i64 2, i64 2} +!2 = !{!3, i64 1, !"omnipotent char"} +!3 = !{!"Simple C++ TBAA"} +!4 = !{!2, i64 2, !"_ZTS7Wrapper", !5, i64 0, i64 2} +!5 = !{!2, i64 2, !"short"} +!6 = !{i64 0, i64 2, !7} +!7 = !{!5, !5, i64 0, i64 2} +!8 = !{!1, !4, i64 2, i64 2} + +;. +; CHECK: [[TBAA0]] = !{[[META1:![0-9]+]], [[META4:![0-9]+]], i64 0, i64 2} +; CHECK: [[META1]] = !{[[META2:![0-9]+]], i64 4, !"_ZTS1T", [[META4]], i64 0, i64 2, [[META4]], i64 2, i64 2} +; CHECK: [[META2]] = !{[[META3:![0-9]+]], i64 1, !"omnipotent char"} +; CHECK: [[META3]] = !{!"Simple C++ TBAA"} +; CHECK: [[META4]] = !{[[META2]], i64 2, !"_ZTS7Wrapper", [[META5:![0-9]+]], i64 0, i64 2} +; CHECK: [[META5]] = !{[[META2]], i64 2, !"short"} +; CHECK: [[TBAA6]] = !{[[META1]], [[META4]], i64 2, i64 2} +;. diff --git a/llvm/test/Transforms/InstCombine/struct-assign-tbaa.ll b/llvm/test/Transforms/InstCombine/struct-assign-tbaa.ll index 996d2c0e67e16..e96452a3cebc8 100644 --- a/llvm/test/Transforms/InstCombine/struct-assign-tbaa.ll +++ b/llvm/test/Transforms/InstCombine/struct-assign-tbaa.ll @@ -38,8 +38,8 @@ define ptr @test2() { define void @test3_multiple_fields(ptr nocapture %a, ptr nocapture %b) { ; CHECK-LABEL: @test3_multiple_fields( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr [[B:%.*]], align 4, !tbaa.struct [[TBAA_STRUCT3:![0-9]+]] -; CHECK-NEXT: store i64 [[TMP0]], ptr [[A:%.*]], align 4, !tbaa.struct [[TBAA_STRUCT3]] +; CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr [[B:%.*]], align 4 +; CHECK-NEXT: store i64 [[TMP0]], ptr [[A:%.*]], align 4 ; CHECK-NEXT: ret void ; entry: @@ -50,8 +50,8 @@ entry: define void @test4_multiple_copy_first_field(ptr nocapture %a, ptr nocapture %b) { ; CHECK-LABEL: @test4_multiple_copy_first_field( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[B:%.*]], align 4 -; CHECK-NEXT: store i32 [[TMP0]], ptr [[A:%.*]], align 4 +; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[B:%.*]], align 4, !tbaa [[TBAA0]] +; CHECK-NEXT: store i32 [[TMP0]], ptr [[A:%.*]], align 4, !tbaa [[TBAA0]] ; CHECK-NEXT: ret void ; entry: @@ -86,5 +86,4 @@ entry: ; CHECK: [[TBAA0]] = !{[[META1:![0-9]+]], [[META1]], i64 0} ; CHECK: [[META1]] = !{!"float", [[META2:![0-9]+]]} ; CHECK: [[META2]] = !{!"Simple C/C++ TBAA"} -; CHECK: [[TBAA_STRUCT3]] = !{i64 0, i64 4, [[TBAA0]], i64 4, i64 4, [[TBAA0]]} ;. diff --git a/llvm/test/Transforms/LICM/hoist-binop.ll b/llvm/test/Transforms/LICM/hoist-binop.ll deleted file mode 100644 index 1fae3561e7809..0000000000000 --- a/llvm/test/Transforms/LICM/hoist-binop.ll +++ /dev/null @@ -1,99 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -S -passes=licm < %s | FileCheck %s - -; Adapted from: -; for(long i = 0; i < n; ++i) -; a[i] = (i*k) * v; -define void @test(i64 %n, i64 %k) { -; CHECK-LABEL: @test( -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_PH:%.*]] -; CHECK: for.ph: -; CHECK-NEXT: [[K_2:%.*]] = shl nuw nsw i64 [[K:%.*]], 1 -; CHECK-NEXT: [[VEC_INIT:%.*]] = insertelement <2 x i64> zeroinitializer, i64 [[K]], i64 1 -; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <2 x i64> poison, i64 [[K_2]], i64 0 -; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <2 x i64> [[DOTSPLATINSERT]], <2 x i64> poison, <2 x i32> zeroinitializer -; CHECK-NEXT: [[INVARIANT_OP:%.*]] = add <2 x i64> [[DOTSPLAT]], [[DOTSPLAT]] -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[FOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[VEC_IND:%.*]] = phi <2 x i64> [ [[VEC_INIT]], [[FOR_PH]] ], [ [[VEC_IND_NEXT_REASS:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[STEP_ADD:%.*]] = add <2 x i64> [[VEC_IND]], [[DOTSPLAT]] -; CHECK-NEXT: call void @use(<2 x i64> [[STEP_ADD]]) -; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 -; CHECK-NEXT: [[VEC_IND_NEXT_REASS]] = add <2 x i64> [[VEC_IND]], [[INVARIANT_OP]] -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N:%.*]] -; CHECK-NEXT: br i1 [[CMP]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - br label %for.ph - -for.ph: - %k.2 = shl nuw nsw i64 %k, 1 - %vec.init = insertelement <2 x i64> zeroinitializer, i64 %k, i64 1 - %.splatinsert = insertelement <2 x i64> poison, i64 %k.2, i64 0 - %.splat = shufflevector <2 x i64> %.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer - br label %for.body - -for.body: - %index = phi i64 [ 0, %for.ph ], [ %index.next, %for.body ] - %vec.ind = phi <2 x i64> [ %vec.init, %for.ph ], [ %vec.ind.next, %for.body ] - %step.add = add <2 x i64> %vec.ind, %.splat - call void @use(<2 x i64> %step.add) - %index.next = add nuw i64 %index, 4 - %vec.ind.next = add <2 x i64> %step.add, %.splat - %cmp = icmp eq i64 %index.next, %n - br i1 %cmp, label %for.end, label %for.body - -for.end: - ret void -} - -; Same as above but `%step.add` is unused and thus removed. -define void @test_single_use(i64 %n, i64 %k) { -; CHECK-LABEL: @test_single_use( -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[FOR_PH:%.*]] -; CHECK: for.ph: -; CHECK-NEXT: [[K_2:%.*]] = shl nuw nsw i64 [[K:%.*]], 1 -; CHECK-NEXT: [[VEC_INIT:%.*]] = insertelement <2 x i64> zeroinitializer, i64 [[K]], i64 1 -; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <2 x i64> poison, i64 [[K_2]], i64 0 -; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <2 x i64> [[DOTSPLATINSERT]], <2 x i64> poison, <2 x i32> zeroinitializer -; CHECK-NEXT: [[INVARIANT_OP:%.*]] = add <2 x i64> [[DOTSPLAT]], [[DOTSPLAT]] -; CHECK-NEXT: br label [[FOR_BODY:%.*]] -; CHECK: for.body: -; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[FOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[VEC_IND:%.*]] = phi <2 x i64> [ [[VEC_INIT]], [[FOR_PH]] ], [ [[VEC_IND_NEXT_REASS:%.*]], [[FOR_BODY]] ] -; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 -; CHECK-NEXT: [[VEC_IND_NEXT_REASS]] = add <2 x i64> [[VEC_IND]], [[INVARIANT_OP]] -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N:%.*]] -; CHECK-NEXT: br i1 [[CMP]], label [[FOR_END:%.*]], label [[FOR_BODY]] -; CHECK: for.end: -; CHECK-NEXT: ret void -; -entry: - br label %for.ph - -for.ph: - %k.2 = shl nuw nsw i64 %k, 1 - %vec.init = insertelement <2 x i64> zeroinitializer, i64 %k, i64 1 - %.splatinsert = insertelement <2 x i64> poison, i64 %k.2, i64 0 - %.splat = shufflevector <2 x i64> %.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer - br label %for.body - -for.body: - %index = phi i64 [ 0, %for.ph ], [ %index.next, %for.body ] - %vec.ind = phi <2 x i64> [ %vec.init, %for.ph ], [ %vec.ind.next, %for.body ] - %step.add = add <2 x i64> %vec.ind, %.splat - %index.next = add nuw i64 %index, 4 - %vec.ind.next = add <2 x i64> %step.add, %.splat - %cmp = icmp eq i64 %index.next, %n - br i1 %cmp, label %for.end, label %for.body - -for.end: - ret void -} - -declare void @use(<2 x i64>) diff --git a/llvm/test/Transforms/LICM/sink-foldable.ll b/llvm/test/Transforms/LICM/sink-foldable.ll index b0130dfbb0713..38577a5a12563 100644 --- a/llvm/test/Transforms/LICM/sink-foldable.ll +++ b/llvm/test/Transforms/LICM/sink-foldable.ll @@ -79,7 +79,7 @@ define ptr @test2(i32 %j, ptr readonly %P, ptr readnone %Q) { ; CHECK-NEXT: entry: ; CHECK-NEXT: br label [[FOR_BODY:%.*]] ; CHECK: for.cond: -; CHECK-NEXT: [[I_ADDR_0:%.*]] = phi i32 [ [[ADD_REASS:%.*]], [[IF_END:%.*]] ] +; CHECK-NEXT: [[I_ADDR_0:%.*]] = phi i32 [ [[ADD:%.*]], [[IF_END:%.*]] ] ; CHECK-NEXT: [[P_ADDR_0:%.*]] = phi ptr [ [[ADD_PTR:%.*]], [[IF_END]] ] ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_ADDR_0]], [[J:%.*]] ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[LOOPEXIT0:%.*]] @@ -97,7 +97,7 @@ define ptr @test2(i32 %j, ptr readonly %P, ptr readnone %Q) { ; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds ptr, ptr [[ADD_PTR]], i64 [[IDX2_EXT]] ; CHECK-NEXT: [[L1:%.*]] = load ptr, ptr [[ARRAYIDX2]], align 8 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt ptr [[L1]], [[Q]] -; CHECK-NEXT: [[ADD_REASS]] = add nsw i32 [[I_ADDR]], 2 +; CHECK-NEXT: [[ADD]] = add nsw i32 [[ADD_I]], 1 ; CHECK-NEXT: br i1 [[CMP2]], label [[LOOPEXIT2:%.*]], label [[FOR_COND]] ; CHECK: loopexit0: ; CHECK-NEXT: [[P0:%.*]] = phi ptr [ null, [[FOR_COND]] ] diff --git a/llvm/test/Transforms/LICM/update-scev-after-hoist.ll b/llvm/test/Transforms/LICM/update-scev-after-hoist.ll index f01008036e9da..fc45b8fce1766 100644 --- a/llvm/test/Transforms/LICM/update-scev-after-hoist.ll +++ b/llvm/test/Transforms/LICM/update-scev-after-hoist.ll @@ -2,7 +2,7 @@ define i16 @main() { ; SCEV-EXPR: Classifying expressions for: @main -; SCEV-EXPR-NEXT: %mul = phi i16 [ 1, %entry ], [ %mul.n.3.reass, %loop ] +; SCEV-EXPR-NEXT: %mul = phi i16 [ 1, %entry ], [ %mul.n.3, %loop ] ; SCEV-EXPR-NEXT: --> %mul U: [0,-15) S: [-32768,32753) Exits: 4096 LoopDispositions: { %loop: Variant } ; SCEV-EXPR-NEXT: %div = phi i16 [ 32767, %entry ], [ %div.n.3, %loop ] ; SCEV-EXPR-NEXT: --> %div U: [-2048,-32768) S: [-2048,-32768) Exits: 7 LoopDispositions: { %loop: Variant } diff --git a/llvm/test/Transforms/LoopStrengthReduce/AArch64/vscale-fixups.ll b/llvm/test/Transforms/LoopStrengthReduce/AArch64/vscale-fixups.ll index 483955c1c57a0..588696d20227f 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/AArch64/vscale-fixups.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/AArch64/vscale-fixups.ll @@ -384,4 +384,55 @@ for.exit: ret void } +;; Here are two writes that should be `16 * vscale * vscale` apart, so MUL VL +;; addressing cannot be used to offset the second write, as for example, +;; `#4, mul vl` would only be an offset of `16 * vscale` (dropping a vscale). +define void @vscale_squared_offset(ptr %alloc) #0 { +; COMMON-LABEL: vscale_squared_offset: +; COMMON: // %bb.0: // %entry +; COMMON-NEXT: rdvl x9, #1 +; COMMON-NEXT: fmov z0.s, #4.00000000 +; COMMON-NEXT: mov x8, xzr +; COMMON-NEXT: lsr x9, x9, #4 +; COMMON-NEXT: fmov z1.s, #8.00000000 +; COMMON-NEXT: cntw x10 +; COMMON-NEXT: ptrue p0.s, vl1 +; COMMON-NEXT: umull x9, w9, w9 +; COMMON-NEXT: lsl x9, x9, #6 +; COMMON-NEXT: cmp x8, x10 +; COMMON-NEXT: b.ge .LBB6_2 +; COMMON-NEXT: .LBB6_1: // %for.body +; COMMON-NEXT: // =>This Inner Loop Header: Depth=1 +; COMMON-NEXT: add x11, x0, x9 +; COMMON-NEXT: st1w { z0.s }, p0, [x0] +; COMMON-NEXT: add x8, x8, #1 +; COMMON-NEXT: st1w { z1.s }, p0, [x11] +; COMMON-NEXT: addvl x0, x0, #1 +; COMMON-NEXT: cmp x8, x10 +; COMMON-NEXT: b.lt .LBB6_1 +; COMMON-NEXT: .LBB6_2: // %for.exit +; COMMON-NEXT: ret +entry: + %vscale = call i64 @llvm.vscale.i64() + %c4_vscale = mul i64 %vscale, 4 + br label %for.check +for.check: + %i = phi i64 [ %next_i, %for.body ], [ 0, %entry ] + %is_lt = icmp slt i64 %i, %c4_vscale + br i1 %is_lt, label %for.body, label %for.exit +for.body: + %mask = call @llvm.aarch64.sve.whilelt.nxv4i1.i64(i64 0, i64 1) + %upper_offset = mul i64 %i, %c4_vscale + %upper_ptr = getelementptr float, ptr %alloc, i64 %upper_offset + call void @llvm.masked.store.nxv4f32.p0( shufflevector ( insertelement ( poison, float 4.000000e+00, i64 0), poison, zeroinitializer), ptr %upper_ptr, i32 4, %mask) + %lower_i = add i64 %i, %c4_vscale + %lower_offset = mul i64 %lower_i, %c4_vscale + %lower_ptr = getelementptr float, ptr %alloc, i64 %lower_offset + call void @llvm.masked.store.nxv4f32.p0( shufflevector ( insertelement ( poison, float 8.000000e+00, i64 0), poison, zeroinitializer), ptr %lower_ptr, i32 4, %mask) + %next_i = add i64 %i, 1 + br label %for.check +for.exit: + ret void +} + attributes #0 = { "target-features"="+sve2" vscale_range(1,16) } diff --git a/llvm/test/Transforms/LoopUnroll/X86/call-remark.ll b/llvm/test/Transforms/LoopUnroll/X86/call-remark.ll index abdcfcf7e0742..b05994ddfa35e 100644 --- a/llvm/test/Transforms/LoopUnroll/X86/call-remark.ll +++ b/llvm/test/Transforms/LoopUnroll/X86/call-remark.ll @@ -1,6 +1,7 @@ ; RUN: opt -passes=debugify,loop-unroll -mcpu=znver3 -pass-remarks=loop-unroll -pass-remarks-analysis=loop-unroll < %s -S 2>&1 | FileCheck --check-prefixes=ALL,UNROLL %s ; RUN: opt -passes=debugify,loop-unroll -mcpu=znver3 -pass-remarks=TTI -pass-remarks-analysis=TTI < %s -S 2>&1 | FileCheck --check-prefixes=ALL,TTI %s ; RUN: opt -passes=debugify,loop-unroll -mcpu=znver4 -pass-remarks=loop-unroll -pass-remarks-analysis=loop-unroll < %s -S 2>&1 | FileCheck --check-prefixes=ALL,UNROLL %s +; RUN: opt -passes=debugify,loop-unroll -mcpu=znver5 -pass-remarks=loop-unroll -pass-remarks-analysis=loop-unroll < %s -S 2>&1 | FileCheck --check-prefixes=ALL,UNROLL %s ; RUN: opt -passes=debugify,loop-unroll -mcpu=znver3 -pass-remarks=loop-unroll -pass-remarks-analysis=loop-unroll < %s -S 2>&1 --try-experimental-debuginfo-iterators | FileCheck --check-prefixes=ALL,UNROLL %s diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/streaming-vectorization.ll b/llvm/test/Transforms/LoopVectorize/AArch64/streaming-vectorization.ll new file mode 100644 index 0000000000000..924d4bfb7836a --- /dev/null +++ b/llvm/test/Transforms/LoopVectorize/AArch64/streaming-vectorization.ll @@ -0,0 +1,56 @@ +; REQUIRES: asserts +; RUN: opt -S -passes=loop-vectorize -debug-only=loop-vectorize < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,NOVEC +; RUN: opt -S -passes=loop-vectorize -debug-only=loop-vectorize -enable-scalable-autovec-in-streaming-mode < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,VEC + +target triple = "aarch64-unknown-linux-gnu" + +define void @normal_function(ptr %a, ptr %b, ptr %c) #0 { +; CHECK: LV: Checking a loop in 'normal_function' +; CHECK: LV: Scalable vectorization is available +entry: + br label %loop + +loop: + %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ] + %arrayidx = getelementptr inbounds i32, ptr %c, i64 %iv + %0 = load i32, ptr %arrayidx, align 4 + %arrayidx2 = getelementptr inbounds i8, ptr %b, i64 %iv + %1 = load i8, ptr %arrayidx2, align 4 + %zext = zext i8 %1 to i32 + %add = add nsw i32 %zext, %0 + %arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %iv + store i32 %add, ptr %arrayidx5, align 4 + %iv.next = add nuw nsw i64 %iv, 1 + %exitcond.not = icmp eq i64 %iv.next, 1024 + br i1 %exitcond.not, label %exit, label %loop + +exit: + ret void +} + +define void @streaming_function(ptr %a, ptr %b, ptr %c) #0 "aarch64_pstate_sm_enabled" { +; CHECK: LV: Checking a loop in 'streaming_function' +; VEC: LV: Scalable vectorization is available +; NOVEC: LV: Scalable vectorization is explicitly disabled +entry: + br label %loop + +loop: + %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ] + %arrayidx = getelementptr inbounds i32, ptr %c, i64 %iv + %0 = load i32, ptr %arrayidx, align 4 + %arrayidx2 = getelementptr inbounds i8, ptr %b, i64 %iv + %1 = load i8, ptr %arrayidx2, align 4 + %zext = zext i8 %1 to i32 + %add = add nsw i32 %zext, %0 + %arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %iv + store i32 %add, ptr %arrayidx5, align 4 + %iv.next = add nuw nsw i64 %iv, 1 + %exitcond.not = icmp eq i64 %iv.next, 1024 + br i1 %exitcond.not, label %exit, label %loop + +exit: + ret void +} + +attributes #0 = { vscale_range(1, 16) "target-features"="+sve,+sme" } diff --git a/llvm/test/Transforms/LoopVectorize/RISCV/riscv-vector-reverse.ll b/llvm/test/Transforms/LoopVectorize/RISCV/riscv-vector-reverse.ll index fc310f4163082..1a78eaf644723 100644 --- a/llvm/test/Transforms/LoopVectorize/RISCV/riscv-vector-reverse.ll +++ b/llvm/test/Transforms/LoopVectorize/RISCV/riscv-vector-reverse.ll @@ -135,7 +135,6 @@ define void @vector_reverse_i64(ptr nocapture noundef writeonly %A, ptr nocaptur ; CHECK-NEXT: LV: Interleaving is not beneficial. ; CHECK-NEXT: LV: Found a vectorizable loop (vscale x 4) in ; CHECK-NEXT: LEV: Epilogue vectorization is not profitable for this loop -; CHECK-NEXT: VF picked by VPlan cost model: vscale x 4 ; CHECK-NEXT: Executing best plan with VF=vscale x 4, UF=1 ; CHECK-NEXT: VPlan 'Final VPlan for VF={vscale x 4},UF>=1' { ; CHECK-NEXT: Live-in vp<%0> = VF * UF @@ -339,7 +338,6 @@ define void @vector_reverse_f32(ptr nocapture noundef writeonly %A, ptr nocaptur ; CHECK-NEXT: LV: Interleaving is not beneficial. ; CHECK-NEXT: LV: Found a vectorizable loop (vscale x 4) in ; CHECK-NEXT: LEV: Epilogue vectorization is not profitable for this loop -; CHECK-NEXT: VF picked by VPlan cost model: vscale x 4 ; CHECK-NEXT: Executing best plan with VF=vscale x 4, UF=1 ; CHECK-NEXT: VPlan 'Final VPlan for VF={vscale x 4},UF>=1' { ; CHECK-NEXT: Live-in vp<%0> = VF * UF diff --git a/llvm/test/Transforms/SLPVectorizer/X86/minbw-user-non-sizable.ll b/llvm/test/Transforms/SLPVectorizer/X86/minbw-user-non-sizable.ll new file mode 100644 index 0000000000000..7e7d4352e2773 --- /dev/null +++ b/llvm/test/Transforms/SLPVectorizer/X86/minbw-user-non-sizable.ll @@ -0,0 +1,31 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu < %s -slp-threshold=-100 | FileCheck %s + +define void @test(ptr %i) { +; CHECK-LABEL: define void @test( +; CHECK-SAME: ptr [[I:%.*]]) { +; CHECK-NEXT: [[BB:.*]]: +; CHECK-NEXT: br label %[[BB2:.*]] +; CHECK: [[BB2]]: +; CHECK-NEXT: [[TMP0:%.*]] = phi <2 x i32> [ [[TMP3:%.*]], %[[BB2]] ], [ zeroinitializer, %[[BB]] ] +; CHECK-NEXT: store <2 x i32> [[TMP0]], ptr [[I]], align 4 +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x i32> [[TMP0]], <2 x i32> , <2 x i32> +; CHECK-NEXT: [[TMP2:%.*]] = trunc <2 x i32> [[TMP1]] to <2 x i1> +; CHECK-NEXT: [[TMP3]] = select <2 x i1> [[TMP2]], <2 x i32> zeroinitializer, <2 x i32> zeroinitializer +; CHECK-NEXT: br label %[[BB2]] +; +bb: + %i1 = getelementptr i8, ptr %i, i64 4 + br label %bb2 + +bb2: + %i3 = phi i32 [ %i6, %bb2 ], [ 0, %bb ] + %i4 = phi i32 [ %i8, %bb2 ], [ 0, %bb ] + store i32 %i3, ptr %i + store i32 %i4, ptr %i1 + %i5 = trunc i32 0 to i1 + %i6 = select i1 %i5, i32 0, i32 0 + %i7 = trunc i32 %i4 to i1 + %i8 = select i1 %i7, i32 0, i32 0 + br label %bb2 +} diff --git a/llvm/test/Transforms/SLPVectorizer/X86/operand-is-reduced-val.ll b/llvm/test/Transforms/SLPVectorizer/X86/operand-is-reduced-val.ll new file mode 100644 index 0000000000000..5fcac3fbf3baf --- /dev/null +++ b/llvm/test/Transforms/SLPVectorizer/X86/operand-is-reduced-val.ll @@ -0,0 +1,49 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux < %s -slp-threshold=-10 | FileCheck %s + +define i64 @src(i32 %a) { +; CHECK-LABEL: define i64 @src( +; CHECK-SAME: i32 [[A:%.*]]) { +; CHECK-NEXT: [[ENTRY:.*:]] +; CHECK-NEXT: [[TMP17:%.*]] = sext i32 [[A]] to i64 +; CHECK-NEXT: [[TMP1:%.*]] = insertelement <4 x i32> poison, i32 [[A]], i32 0 +; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> poison, <4 x i32> zeroinitializer +; CHECK-NEXT: [[TMP3:%.*]] = sext <4 x i32> [[TMP2]] to <4 x i64> +; CHECK-NEXT: [[TMP4:%.*]] = add nsw <4 x i64> [[TMP3]], +; CHECK-NEXT: [[TMP6:%.*]] = and <4 x i64> [[TMP4]], +; CHECK-NEXT: [[TMP18:%.*]] = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> [[TMP6]]) +; CHECK-NEXT: [[TMP16:%.*]] = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> [[TMP4]]) +; CHECK-NEXT: [[TMP8:%.*]] = insertelement <2 x i64> poison, i64 [[TMP16]], i32 0 +; CHECK-NEXT: [[TMP9:%.*]] = insertelement <2 x i64> [[TMP8]], i64 [[TMP18]], i32 1 +; CHECK-NEXT: [[TMP10:%.*]] = insertelement <2 x i64> , i64 [[TMP17]], i32 0 +; CHECK-NEXT: [[TMP11:%.*]] = add <2 x i64> [[TMP9]], [[TMP10]] +; CHECK-NEXT: [[TMP12:%.*]] = extractelement <2 x i64> [[TMP11]], i32 0 +; CHECK-NEXT: [[TMP13:%.*]] = extractelement <2 x i64> [[TMP11]], i32 1 +; CHECK-NEXT: [[TMP21:%.*]] = add i64 [[TMP12]], [[TMP13]] +; CHECK-NEXT: ret i64 [[TMP21]] +; +entry: + %0 = sext i32 %a to i64 + %1 = add nsw i64 %0, 4294967297 + %2 = sext i32 %a to i64 + %3 = add nsw i64 %2, 4294967297 + %4 = add i64 %3, %1 + %5 = and i64 %3, 1 + %6 = add i64 %4, %5 + %7 = sext i32 %a to i64 + %8 = add nsw i64 %7, 4294967297 + %9 = add i64 %8, %6 + %10 = and i64 %8, 1 + %11 = add i64 %9, %10 + %12 = sext i32 %a to i64 + %13 = add nsw i64 %12, 4294967297 + %14 = add i64 %13, %11 + %15 = and i64 %13, 1 + %16 = add i64 %14, %15 + %17 = sext i32 %a to i64 + %18 = add nsw i64 %17, 4294967297 + %19 = add i64 %18, %16 + %20 = and i64 %18, 1 + %21 = add i64 %19, %20 + ret i64 %21 +} diff --git a/llvm/test/Transforms/SLPVectorizer/X86/pr63668.ll b/llvm/test/Transforms/SLPVectorizer/X86/pr63668.ll index 391771e06cab8..037e073de9d59 100644 --- a/llvm/test/Transforms/SLPVectorizer/X86/pr63668.ll +++ b/llvm/test/Transforms/SLPVectorizer/X86/pr63668.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3 ; RUN: opt -passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu -mcpu=znver4 -S < %s | FileCheck %s +; RUN: opt -passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu -mcpu=znver5 -S < %s | FileCheck %s define internal i32 @testfunc() { ; CHECK-LABEL: define internal i32 @testfunc diff --git a/llvm/test/Transforms/SLPVectorizer/X86/pr98978.ll b/llvm/test/Transforms/SLPVectorizer/X86/pr98978.ll new file mode 100644 index 0000000000000..429bf13b2b87a --- /dev/null +++ b/llvm/test/Transforms/SLPVectorizer/X86/pr98978.ll @@ -0,0 +1,106 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -S -passes=slp-vectorizer < %s | FileCheck %s + +target triple = "x86_64-redhat-linux-gnu" + +; The load+store sequence inside bb10 should not get vectorized. Previously, +; we incorrectly determined that the pointers do not alias, because a cache +; entry based indirectly on a disproven NoAlias assumption was not cleared +; from the BatchAA cache. +define void @test(ptr %p1, i64 %arg1, i64 %arg2) { +; CHECK-LABEL: define void @test( +; CHECK-SAME: ptr [[P1:%.*]], i64 [[ARG1:%.*]], i64 [[ARG2:%.*]]) { +; CHECK-NEXT: [[_PREHEADER48_PREHEADER_1:.*]]: +; CHECK-NEXT: br label %[[_LOOPEXIT49_1:.*]] +; CHECK: [[_LOOPEXIT49_1]]: +; CHECK-NEXT: [[I:%.*]] = phi ptr [ [[I21:%.*]], %[[BB20:.*]] ], [ [[P1]], %[[_PREHEADER48_PREHEADER_1]] ] +; CHECK-NEXT: br i1 false, label %[[BB22:.*]], label %[[DOTPREHEADER48_PREHEADER_1:.*]] +; CHECK: [[DEAD:.*]]: +; CHECK-NEXT: br label %[[DOTPREHEADER48_PREHEADER_1]] +; CHECK: [[_PREHEADER48_PREHEADER_2:.*:]] +; CHECK-NEXT: [[I5:%.*]] = phi ptr [ [[I]], %[[DEAD]] ], [ [[I]], %[[_LOOPEXIT49_1]] ] +; CHECK-NEXT: br label %[[DOTLOOPEXIT49_1:.*]] +; CHECK: [[DEAD1:.*]]: +; CHECK-NEXT: br i1 false, label %[[DOTLOOPEXIT49_1]], label %[[BB20]] +; CHECK: [[_LOOPEXIT49_2:.*:]] +; CHECK-NEXT: [[I6:%.*]] = phi ptr [ [[I5]], %[[DEAD1]] ], [ [[I5]], %[[DOTPREHEADER48_PREHEADER_1]] ] +; CHECK-NEXT: [[I7:%.*]] = getelementptr i8, ptr [[I6]], i64 [[ARG1]] +; CHECK-NEXT: br label %[[BB10:.*]] +; CHECK: [[DEAD2:.*]]: +; CHECK-NEXT: br label %[[BB10]] +; CHECK: [[BB10]]: +; CHECK-NEXT: [[I11:%.*]] = phi ptr [ [[I7]], %[[DOTLOOPEXIT49_1]] ], [ null, %[[DEAD2]] ] +; CHECK-NEXT: [[I16:%.*]] = getelementptr i8, ptr [[I11]], i64 8 +; CHECK-NEXT: [[I17:%.*]] = load i64, ptr [[I16]], align 1 +; CHECK-NEXT: store i64 [[I17]], ptr [[I6]], align 1 +; CHECK-NEXT: [[I18:%.*]] = getelementptr i8, ptr [[I6]], i64 8 +; CHECK-NEXT: [[I19:%.*]] = load i64, ptr [[I11]], align 1 +; CHECK-NEXT: store i64 [[I19]], ptr [[I18]], align 1 +; CHECK-NEXT: br label %[[BB20]] +; CHECK: [[BB20]]: +; CHECK-NEXT: [[I21]] = phi ptr [ [[I5]], %[[DEAD1]] ], [ [[I6]], %[[BB10]] ] +; CHECK-NEXT: br label %[[_LOOPEXIT49_1]] +; CHECK: [[BB22]]: +; CHECK-NEXT: [[I23:%.*]] = getelementptr i8, ptr [[I]], i64 [[ARG2]] +; CHECK-NEXT: [[I25:%.*]] = getelementptr i8, ptr [[I23]], i64 8 +; CHECK-NEXT: br label %[[BB26:.*]] +; CHECK: [[BB26]]: +; CHECK-NEXT: [[I27:%.*]] = phi ptr [ null, %[[BB26]] ], [ [[I25]], %[[BB22]] ] +; CHECK-NEXT: store i64 0, ptr [[I27]], align 1 +; CHECK-NEXT: [[I28:%.*]] = getelementptr i8, ptr [[I27]], i64 8 +; CHECK-NEXT: [[I29:%.*]] = load i64, ptr [[I23]], align 1 +; CHECK-NEXT: store i64 0, ptr [[I28]], align 1 +; CHECK-NEXT: br label %[[BB26]] +; +entry: + br label %loop1 + +loop1: ; preds = %bb20, %entry + %i = phi ptr [ %i21, %bb20 ], [ %p1, %entry ] + br i1 false, label %bb22, label %.preheader48.preheader.1 + +dead: ; No predecessors! + br label %.preheader48.preheader.1 + +.preheader48.preheader.1: ; preds = %dead, %loop1 + %i5 = phi ptr [ %i, %dead ], [ %i, %loop1 ] + br label %.loopexit49.1 + +dead1: ; No predecessors! + br i1 false, label %.loopexit49.1, label %bb20 + +.loopexit49.1: ; preds = %dead1, %.preheader48.preheader.1 + %i6 = phi ptr [ %i5, %dead1 ], [ %i5, %.preheader48.preheader.1 ] + %i7 = getelementptr i8, ptr %i6, i64 %arg1 + br label %bb10 + +dead2: ; No predecessors! + br label %bb10 + +bb10: ; preds = %dead2, %.loopexit49.1 + %i11 = phi ptr [ %i7, %.loopexit49.1 ], [ null, %dead2 ] + %i16 = getelementptr i8, ptr %i11, i64 8 + %i17 = load i64, ptr %i16, align 1 + store i64 %i17, ptr %i6, align 1 + %i18 = getelementptr i8, ptr %i6, i64 8 + %i19 = load i64, ptr %i11, align 1 + store i64 %i19, ptr %i18, align 1 + br label %bb20 + +bb20: ; preds = %bb10, %dead1 + %i21 = phi ptr [ %i5, %dead1 ], [ %i6, %bb10 ] + br label %loop1 + +bb22: ; preds = %loop1 + %i23 = getelementptr i8, ptr %i, i64 %arg2 + %i25 = getelementptr i8, ptr %i23, i64 8 + br label %bb26 + +bb26: ; preds = %bb26, %bb22 + %i27 = phi ptr [ null, %bb26 ], [ %i25, %bb22 ] + store i64 0, ptr %i27, align 1 + %i28 = getelementptr i8, ptr %i27, i64 8 + %i29 = load i64, ptr %i23, align 1 + store i64 0, ptr %i28, align 1 + br label %bb26 +} diff --git a/llvm/test/Transforms/SROA/tbaa-struct.ll b/llvm/test/Transforms/SROA/tbaa-struct.ll deleted file mode 100644 index 29892cb84d8ef..0000000000000 --- a/llvm/test/Transforms/SROA/tbaa-struct.ll +++ /dev/null @@ -1,41 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals -; RUN: opt -S -passes='sroa' %s | FileCheck %s --check-prefixes=CHECK,CHECK-PRESERVE-CFG -; RUN: opt -S -passes='sroa' %s | FileCheck %s --check-prefixes=CHECK,CHECK-MODIFY-CFG - -; SROA should keep `!tbaa.struct` metadata - -%vector = type { float, float } -declare void @llvm.memcpy.p0.p0.i64(ptr writeonly, ptr readonly, i64, i1 immarg) -declare <2 x float> @foo(ptr %0) - -define void @bar(ptr %y2) { -; CHECK-LABEL: @bar( -; CHECK-NEXT: [[X14:%.*]] = call <2 x float> @foo(ptr [[Y2:%.*]]) -; CHECK-NEXT: store <2 x float> [[X14]], ptr [[Y2]], align 4, !tbaa.struct [[TBAA_STRUCT0:![0-9]+]] -; CHECK-NEXT: ret void -; - %x7 = alloca %vector - %x14 = call <2 x float> @foo(ptr %y2) - store <2 x float> %x14, ptr %x7 - call void @llvm.memcpy.p0.p0.i64(ptr align 4 %y2, ptr align 4 %x7, i64 8, i1 false), !tbaa.struct !10 - ret void -} - -!4 = !{!"omnipotent char", !5, i64 0} -!5 = !{!"Simple C++ TBAA"} -!7 = !{!"vector", !8, i64 0, !8, i64 4} -!8 = !{!"float", !4, i64 0} -!10 = !{i64 0, i64 4, !11, i64 4, i64 4, !11} -!11 = !{!8, !8, i64 0} -;. -; CHECK: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -;. -; CHECK: [[TBAA_STRUCT0]] = !{i64 0, i64 4, !1, i64 4, i64 4, !1} -; CHECK: [[META1:![0-9]+]] = !{!2, !2, i64 0} -; CHECK: [[META2:![0-9]+]] = !{!"float", !3, i64 0} -; CHECK: [[META3:![0-9]+]] = !{!"omnipotent char", !4, i64 0} -; CHECK: [[META4:![0-9]+]] = !{!"Simple C++ TBAA"} -;. -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; CHECK-MODIFY-CFG: {{.*}} -; CHECK-PRESERVE-CFG: {{.*}} diff --git a/llvm/test/Transforms/SROA/tbaa-struct3.ll b/llvm/test/Transforms/SROA/tbaa-struct3.ll index 0fcd787fef976..6a1a23728d3c7 100644 --- a/llvm/test/Transforms/SROA/tbaa-struct3.ll +++ b/llvm/test/Transforms/SROA/tbaa-struct3.ll @@ -56,7 +56,7 @@ define void @memcpy_transfer_tbaa_field_and_size_do_not_align(ptr dereferenceabl ; CHECK-NEXT: [[TMP_SROA_2_0_L_PTR_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[L_PTR]], i64 4 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast float [[B]] to i32 ; CHECK-NEXT: [[TMP_SROA_2_0_EXTRACT_TRUNC:%.*]] = trunc i32 [[TMP0]] to i16 -; CHECK-NEXT: store i16 [[TMP_SROA_2_0_EXTRACT_TRUNC]], ptr [[TMP_SROA_2_0_L_PTR_SROA_IDX]], align 1, !tbaa.struct [[TBAA_STRUCT4:![0-9]+]] +; CHECK-NEXT: store i16 [[TMP_SROA_2_0_EXTRACT_TRUNC]], ptr [[TMP_SROA_2_0_L_PTR_SROA_IDX]], align 1 ; CHECK-NEXT: ret void ; entry: @@ -77,8 +77,8 @@ define void @load_store_transfer_split_struct_tbaa_2_i31(ptr dereferenceable(24) ; CHECK-NEXT: store i31 [[A]], ptr [[TMP]], align 4 ; CHECK-NEXT: [[TMP_4_TMP_4_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[TMP]], i64 4 ; CHECK-NEXT: store i31 [[B]], ptr [[TMP_4_TMP_4_SROA_IDX]], align 4 -; CHECK-NEXT: [[TMP_0_L1:%.*]] = load i62, ptr [[TMP]], align 4, !tbaa.struct [[TBAA_STRUCT5:![0-9]+]] -; CHECK-NEXT: store i62 [[TMP_0_L1]], ptr [[RES]], align 4, !tbaa.struct [[TBAA_STRUCT5]] +; CHECK-NEXT: [[TMP_0_L1:%.*]] = load i62, ptr [[TMP]], align 4, !tbaa.struct [[TBAA_STRUCT4:![0-9]+]] +; CHECK-NEXT: store i62 [[TMP_0_L1]], ptr [[RES]], align 4, !tbaa.struct [[TBAA_STRUCT4]] ; CHECK-NEXT: ret void ; entry: @@ -98,7 +98,7 @@ define void @store_vector_part_first(ptr %y2, float %f) { ; CHECK-LABEL: define void @store_vector_part_first( ; CHECK-SAME: ptr [[Y2:%.*]], float [[F:%.*]]) { ; CHECK-NEXT: [[V_1:%.*]] = call <2 x float> @foo(ptr [[Y2]]) -; CHECK-NEXT: store <2 x float> [[V_1]], ptr [[Y2]], align 8, !tbaa [[TBAA6:![0-9]+]] +; CHECK-NEXT: store <2 x float> [[V_1]], ptr [[Y2]], align 8, !tbaa [[TBAA5:![0-9]+]] ; CHECK-NEXT: [[X7_SROA_2_0_Y2_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[Y2]], i64 8 ; CHECK-NEXT: store float [[F]], ptr [[X7_SROA_2_0_Y2_SROA_IDX]], align 8, !tbaa [[TBAA0]] ; CHECK-NEXT: ret void @@ -118,7 +118,7 @@ define void @store_vector_part_second(ptr %y2, float %f) { ; CHECK-NEXT: [[V_1:%.*]] = call <2 x float> @foo(ptr [[Y2]]) ; CHECK-NEXT: store float [[F]], ptr [[Y2]], align 8, !tbaa [[TBAA0]] ; CHECK-NEXT: [[X7_SROA_2_0_Y2_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[Y2]], i64 4 -; CHECK-NEXT: store <2 x float> [[V_1]], ptr [[X7_SROA_2_0_Y2_SROA_IDX]], align 4, !tbaa [[TBAA6]] +; CHECK-NEXT: store <2 x float> [[V_1]], ptr [[X7_SROA_2_0_Y2_SROA_IDX]], align 4, !tbaa [[TBAA5]] ; CHECK-NEXT: ret void ; %x7 = alloca { float, float, float, float } @@ -134,7 +134,7 @@ define void @store_vector_single(ptr %y2, float %f) { ; CHECK-LABEL: define void @store_vector_single( ; CHECK-SAME: ptr [[Y2:%.*]], float [[F:%.*]]) { ; CHECK-NEXT: [[V_1:%.*]] = call <2 x float> @foo(ptr [[Y2]]) -; CHECK-NEXT: store <2 x float> [[V_1]], ptr [[Y2]], align 4, !tbaa [[TBAA6]] +; CHECK-NEXT: store <2 x float> [[V_1]], ptr [[Y2]], align 4, !tbaa [[TBAA5]] ; CHECK-NEXT: ret void ; %x7 = alloca { float, float } @@ -161,7 +161,7 @@ define void @memset(ptr %dst, ptr align 8 %src) { ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[A_SROA_4]], ptr align 1 [[A_SROA_4_0_SRC_SROA_IDX]], i32 10, i1 false) ; CHECK-NEXT: store i16 1, ptr [[A_SROA_3]], align 2 ; CHECK-NEXT: [[A_SROA_0_1_A_1_SROA_IDX2:%.*]] = getelementptr inbounds i8, ptr [[A_SROA_0]], i64 1 -; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr align 1 [[A_SROA_0_1_A_1_SROA_IDX2]], i8 42, i32 6, i1 false), !tbaa.struct [[TBAA_STRUCT8:![0-9]+]] +; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr align 1 [[A_SROA_0_1_A_1_SROA_IDX2]], i8 42, i32 6, i1 false) ; CHECK-NEXT: store i16 10794, ptr [[A_SROA_3]], align 2, !tbaa [[TBAA0]] ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[DST]], ptr align 1 [[A_SROA_0]], i32 7, i1 true) ; CHECK-NEXT: [[A_SROA_3_0_DST_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 7 @@ -199,8 +199,8 @@ define void @memset2(ptr %dst, ptr align 8 %src) { ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[A_SROA_4]], ptr align 2 [[A_SROA_4_0_SRC_SROA_IDX]], i32 90, i1 false) ; CHECK-NEXT: store i8 1, ptr [[A_SROA_3]], align 1 ; CHECK-NEXT: [[A_SROA_0_202_A_202_SROA_IDX2:%.*]] = getelementptr inbounds i8, ptr [[A_SROA_0]], i64 202 -; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr align 1 [[A_SROA_0_202_A_202_SROA_IDX2]], i8 42, i32 7, i1 false), !tbaa [[TBAA6]] -; CHECK-NEXT: store i8 42, ptr [[A_SROA_3]], align 1, !tbaa [[TBAA6]] +; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr align 1 [[A_SROA_0_202_A_202_SROA_IDX2]], i8 42, i32 7, i1 false), !tbaa [[TBAA5]] +; CHECK-NEXT: store i8 42, ptr [[A_SROA_3]], align 1, !tbaa [[TBAA5]] ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[DST]], ptr align 1 [[A_SROA_0]], i32 209, i1 true) ; CHECK-NEXT: [[A_SROA_3_0_DST_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 209 ; CHECK-NEXT: [[A_SROA_3_0_A_SROA_3_0_COPYLOAD1:%.*]] = load volatile i8, ptr [[A_SROA_3]], align 1 @@ -240,7 +240,7 @@ define void @slice_store_v2i8_1(ptr %dst, ptr %dst.2, ptr %src) { ; CHECK-NEXT: [[A_SROA_2_0_SRC_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i64 6 ; CHECK-NEXT: [[A_SROA_2_SROA_0_0_COPYLOAD:%.*]] = load <2 x i8>, ptr [[A_SROA_2_0_SRC_SROA_IDX]], align 2 ; CHECK-NEXT: store <2 x i8> [[A_SROA_2_SROA_0_0_COPYLOAD]], ptr [[A_SROA_2_SROA_0]], align 4 -; CHECK-NEXT: store <2 x i8> bitcast (<1 x i16> to <2 x i8>), ptr [[A_SROA_2_SROA_0]], align 4, !tbaa [[TBAA0]] +; CHECK-NEXT: store <2 x i8> bitcast (<1 x i16> to <2 x i8>), ptr [[A_SROA_2_SROA_0]], align 4 ; CHECK-NEXT: [[A_SROA_2_SROA_0_0_A_SROA_2_SROA_0_0_A_SROA_2_6_V_4:%.*]] = load <2 x i8>, ptr [[A_SROA_2_SROA_0]], align 4 ; CHECK-NEXT: store <2 x i8> [[A_SROA_2_SROA_0_0_A_SROA_2_SROA_0_0_A_SROA_2_6_V_4]], ptr [[DST_2]], align 2 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[DST]], ptr align 1 [[A_SROA_0]], i32 6, i1 true) @@ -279,8 +279,8 @@ define void @slice_store_v2i8_2(ptr %dst, ptr %dst.2, ptr %src) { ; CHECK-NEXT: store i8 [[A_SROA_0_SROA_4_1_COPYLOAD]], ptr [[A_SROA_0_SROA_4]], align 1 ; CHECK-NEXT: [[A_SROA_4_1_SRC_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i64 3 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[A_SROA_4]], ptr align 1 [[A_SROA_4_1_SRC_SROA_IDX]], i32 5, i1 false) -; CHECK-NEXT: store <2 x i8> zeroinitializer, ptr [[A_SROA_0_SROA_1]], align 2, !tbaa.struct [[TBAA_STRUCT9:![0-9]+]] -; CHECK-NEXT: store i8 0, ptr [[A_SROA_0_SROA_4]], align 1, !tbaa [[TBAA0]] +; CHECK-NEXT: store <2 x i8> zeroinitializer, ptr [[A_SROA_0_SROA_1]], align 2 +; CHECK-NEXT: store i8 0, ptr [[A_SROA_0_SROA_4]], align 1 ; CHECK-NEXT: [[A_SROA_0_SROA_1_0_A_SROA_0_SROA_1_1_A_SROA_0_1_V_4:%.*]] = load <2 x i8>, ptr [[A_SROA_0_SROA_1]], align 2 ; CHECK-NEXT: store <2 x i8> [[A_SROA_0_SROA_1_0_A_SROA_0_SROA_1_1_A_SROA_0_1_V_4]], ptr [[DST_2]], align 2 ; CHECK-NEXT: [[A_SROA_0_SROA_1_0_A_SROA_0_SROA_1_1_COPYLOAD3:%.*]] = load volatile <2 x i8>, ptr [[A_SROA_0_SROA_1]], align 2 @@ -317,7 +317,7 @@ define double @tbaa_struct_load(ptr %src, ptr %dst) { ; CHECK-NEXT: [[TMP_SROA_3_0_SRC_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i64 8 ; CHECK-NEXT: [[TMP_SROA_3_0_COPYLOAD:%.*]] = load i64, ptr [[TMP_SROA_3_0_SRC_SROA_IDX]], align 8 ; CHECK-NEXT: store i64 [[TMP_SROA_3_0_COPYLOAD]], ptr [[TMP_SROA_3]], align 8 -; CHECK-NEXT: [[TMP_SROA_0_0_TMP_SROA_0_0_LG:%.*]] = load double, ptr [[TMP_SROA_0]], align 8, !tbaa [[TBAA6]] +; CHECK-NEXT: [[TMP_SROA_0_0_TMP_SROA_0_0_LG:%.*]] = load double, ptr [[TMP_SROA_0]], align 8, !tbaa [[TBAA5]] ; CHECK-NEXT: [[TMP_SROA_0_0_TMP_SROA_0_0_COPYLOAD1:%.*]] = load volatile double, ptr [[TMP_SROA_0]], align 8 ; CHECK-NEXT: store volatile double [[TMP_SROA_0_0_TMP_SROA_0_0_COPYLOAD1]], ptr [[DST]], align 8 ; CHECK-NEXT: [[TMP_SROA_3_0_DST_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 8 @@ -356,7 +356,7 @@ define i32 @shorten_integer_store_multiple_fields(ptr %dst, ptr %dst.2, ptr %src ; CHECK-SAME: ptr [[DST:%.*]], ptr [[DST_2:%.*]], ptr [[SRC:%.*]]) { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[A_SROA_0:%.*]] = alloca i32, align 4 -; CHECK-NEXT: store i32 123, ptr [[A_SROA_0]], align 4, !tbaa [[TBAA6]] +; CHECK-NEXT: store i32 123, ptr [[A_SROA_0]], align 4, !tbaa [[TBAA5]] ; CHECK-NEXT: [[A_SROA_0_0_A_SROA_0_0_L:%.*]] = load i32, ptr [[A_SROA_0]], align 4 ; CHECK-NEXT: [[A_SROA_0_0_A_SROA_0_0_COPYLOAD:%.*]] = load volatile i32, ptr [[A_SROA_0]], align 4 ; CHECK-NEXT: store volatile i32 [[A_SROA_0_0_A_SROA_0_0_COPYLOAD]], ptr [[DST]], align 1 @@ -375,7 +375,7 @@ define <2 x i16> @shorten_vector_store_multiple_fields(ptr %dst, ptr %dst.2, ptr ; CHECK-SAME: ptr [[DST:%.*]], ptr [[DST_2:%.*]], ptr [[SRC:%.*]]) { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[A_SROA_0:%.*]] = alloca <2 x i32>, align 8 -; CHECK-NEXT: store <2 x i32> , ptr [[A_SROA_0]], align 8, !tbaa.struct [[TBAA_STRUCT5]] +; CHECK-NEXT: store <2 x i32> , ptr [[A_SROA_0]], align 8 ; CHECK-NEXT: [[A_SROA_0_0_A_SROA_0_0_L:%.*]] = load <2 x i16>, ptr [[A_SROA_0]], align 8 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[DST]], ptr align 8 [[A_SROA_0]], i32 4, i1 true) ; CHECK-NEXT: ret <2 x i16> [[A_SROA_0_0_A_SROA_0_0_L]] @@ -393,7 +393,7 @@ define <2 x i16> @shorten_vector_store_single_fields(ptr %dst, ptr %dst.2, ptr % ; CHECK-SAME: ptr [[DST:%.*]], ptr [[DST_2:%.*]], ptr [[SRC:%.*]]) { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[A_SROA_0:%.*]] = alloca <2 x i32>, align 8 -; CHECK-NEXT: store <2 x i32> , ptr [[A_SROA_0]], align 8, !tbaa.struct [[TBAA_STRUCT10:![0-9]+]] +; CHECK-NEXT: store <2 x i32> , ptr [[A_SROA_0]], align 8 ; CHECK-NEXT: [[A_SROA_0_0_A_SROA_0_0_L:%.*]] = load <2 x i16>, ptr [[A_SROA_0]], align 8 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[DST]], ptr align 8 [[A_SROA_0]], i32 4, i1 true) ; CHECK-NEXT: ret <2 x i16> [[A_SROA_0_0_A_SROA_0_0_L]] @@ -429,11 +429,11 @@ define i32 @split_load_with_tbaa_struct(i32 %x, ptr %src, ptr %dst) { ; CHECK-NEXT: [[A3_SROA_5_0_SRC_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i64 9 ; CHECK-NEXT: [[A3_SROA_5_0_COPYLOAD:%.*]] = load i8, ptr [[A3_SROA_5_0_SRC_SROA_IDX]], align 1 ; CHECK-NEXT: store i8 [[A3_SROA_5_0_COPYLOAD]], ptr [[A3_SROA_5]], align 1 -; CHECK-NEXT: [[A3_SROA_0_0_A3_SROA_0_0_LOAD4_FCA_0_LOAD:%.*]] = load i16, ptr [[A3_SROA_0]], align 8, !tbaa [[TBAA6]] +; CHECK-NEXT: [[A3_SROA_0_0_A3_SROA_0_0_LOAD4_FCA_0_LOAD:%.*]] = load i16, ptr [[A3_SROA_0]], align 8, !tbaa [[TBAA5]] ; CHECK-NEXT: [[LOAD4_FCA_0_INSERT:%.*]] = insertvalue { i16, float, i8 } poison, i16 [[A3_SROA_0_0_A3_SROA_0_0_LOAD4_FCA_0_LOAD]], 0 -; CHECK-NEXT: [[A3_SROA_33_0_A3_SROA_33_4_LOAD4_FCA_1_LOAD:%.*]] = load float, ptr [[A3_SROA_33]], align 4, !tbaa [[TBAA6]] +; CHECK-NEXT: [[A3_SROA_33_0_A3_SROA_33_4_LOAD4_FCA_1_LOAD:%.*]] = load float, ptr [[A3_SROA_33]], align 4, !tbaa [[TBAA5]] ; CHECK-NEXT: [[LOAD4_FCA_1_INSERT:%.*]] = insertvalue { i16, float, i8 } [[LOAD4_FCA_0_INSERT]], float [[A3_SROA_33_0_A3_SROA_33_4_LOAD4_FCA_1_LOAD]], 1 -; CHECK-NEXT: [[A3_SROA_4_0_A3_SROA_4_8_LOAD4_FCA_2_LOAD:%.*]] = load i8, ptr [[A3_SROA_4]], align 8, !tbaa [[TBAA6]] +; CHECK-NEXT: [[A3_SROA_4_0_A3_SROA_4_8_LOAD4_FCA_2_LOAD:%.*]] = load i8, ptr [[A3_SROA_4]], align 8, !tbaa [[TBAA5]] ; CHECK-NEXT: [[LOAD4_FCA_2_INSERT:%.*]] = insertvalue { i16, float, i8 } [[LOAD4_FCA_1_INSERT]], i8 [[A3_SROA_4_0_A3_SROA_4_8_LOAD4_FCA_2_LOAD]], 2 ; CHECK-NEXT: [[UNWRAP2:%.*]] = extractvalue { i16, float, i8 } [[LOAD4_FCA_2_INSERT]], 1 ; CHECK-NEXT: [[VALCAST2:%.*]] = bitcast float [[UNWRAP2]] to i32 @@ -492,11 +492,11 @@ define i32 @split_store_with_tbaa_struct(i32 %x, ptr %src, ptr %dst) { ; CHECK-NEXT: [[I_2:%.*]] = insertvalue { i16, float, i8 } [[I_1]], float 3.000000e+00, 1 ; CHECK-NEXT: [[I_3:%.*]] = insertvalue { i16, float, i8 } [[I_2]], i8 99, 2 ; CHECK-NEXT: [[I_3_FCA_0_EXTRACT:%.*]] = extractvalue { i16, float, i8 } [[I_3]], 0 -; CHECK-NEXT: store i16 [[I_3_FCA_0_EXTRACT]], ptr [[A3_SROA_0]], align 8, !tbaa [[TBAA6]] +; CHECK-NEXT: store i16 [[I_3_FCA_0_EXTRACT]], ptr [[A3_SROA_0]], align 8, !tbaa [[TBAA5]] ; CHECK-NEXT: [[I_3_FCA_1_EXTRACT:%.*]] = extractvalue { i16, float, i8 } [[I_3]], 1 -; CHECK-NEXT: store float [[I_3_FCA_1_EXTRACT]], ptr [[A3_SROA_33]], align 4, !tbaa [[TBAA6]] +; CHECK-NEXT: store float [[I_3_FCA_1_EXTRACT]], ptr [[A3_SROA_33]], align 4, !tbaa [[TBAA5]] ; CHECK-NEXT: [[I_3_FCA_2_EXTRACT:%.*]] = extractvalue { i16, float, i8 } [[I_3]], 2 -; CHECK-NEXT: store i8 [[I_3_FCA_2_EXTRACT]], ptr [[A3_SROA_4]], align 8, !tbaa [[TBAA6]] +; CHECK-NEXT: store i8 [[I_3_FCA_2_EXTRACT]], ptr [[A3_SROA_4]], align 8, !tbaa [[TBAA5]] ; CHECK-NEXT: [[A3_SROA_0_0_A3_SROA_0_0_COPYLOAD1:%.*]] = load volatile i16, ptr [[A3_SROA_0]], align 8 ; CHECK-NEXT: store volatile i16 [[A3_SROA_0_0_A3_SROA_0_0_COPYLOAD1]], ptr [[DST]], align 1 ; CHECK-NEXT: [[A3_SROA_3_0_DST_SROA_IDX:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 2 @@ -552,11 +552,7 @@ declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias ; CHECK: [[META1]] = !{!"float", [[META2:![0-9]+]], i64 0} ; CHECK: [[META2]] = !{!"omnipotent char", [[META3:![0-9]+]], i64 0} ; CHECK: [[META3]] = !{!"Simple C++ TBAA"} -; CHECK: [[TBAA_STRUCT4]] = !{i64 0, i64 4, [[TBAA0]]} -; CHECK: [[TBAA_STRUCT5]] = !{i64 0, i64 4, [[TBAA0]], i64 4, i64 4, [[TBAA0]]} -; CHECK: [[TBAA6]] = !{[[META7:![0-9]+]], [[META7]], i64 0} -; CHECK: [[META7]] = !{!"v2f32", [[META2]], i64 0} -; CHECK: [[TBAA_STRUCT8]] = !{i64 0, i64 2, [[TBAA0]], i64 2, i64 6, [[TBAA0]]} -; CHECK: [[TBAA_STRUCT9]] = !{i64 0, i64 3, [[TBAA0]]} -; CHECK: [[TBAA_STRUCT10]] = !{i64 0, i64 4, [[TBAA6]]} +; CHECK: [[TBAA_STRUCT4]] = !{i64 0, i64 4, [[TBAA0]], i64 4, i64 4, [[TBAA0]]} +; CHECK: [[TBAA5]] = !{[[META6:![0-9]+]], [[META6]], i64 0} +; CHECK: [[META6]] = !{!"v2f32", [[META2]], i64 0} ;. diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py index b6431fcaf459f..fe1262893212f 100644 --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -180,7 +180,6 @@ def get_asan_rtlib(): "llvm-addr2line", "llvm-bcanalyzer", "llvm-bitcode-strip", - "llvm-cgdata", "llvm-config", "llvm-cov", "llvm-cxxdump", diff --git a/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-loopvectorize-costmodel.ll.expected b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-loopvectorize-costmodel.ll.expected index 5aa270e76f4c8..e862bf87d265c 100644 --- a/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-loopvectorize-costmodel.ll.expected +++ b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-loopvectorize-costmodel.ll.expected @@ -17,7 +17,6 @@ define void @test() { ; CHECK: LV: Found an estimated cost of 5 for VF 16 For instruction: %v0 = load float, ptr %in0, align 4 ; CHECK: LV: Found an estimated cost of 22 for VF 32 For instruction: %v0 = load float, ptr %in0, align 4 ; CHECK: LV: Found an estimated cost of 92 for VF 64 For instruction: %v0 = load float, ptr %in0, align 4 -; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: %v0 = load float, ptr %in0, align 4 ; entry: br label %for.body diff --git a/llvm/test/tools/llvm-cgdata/dump.test b/llvm/test/tools/llvm-cgdata/dump.test deleted file mode 100644 index 20e0b654973c2..0000000000000 --- a/llvm/test/tools/llvm-cgdata/dump.test +++ /dev/null @@ -1,32 +0,0 @@ -# Test dump between the binary and text formats. - -RUN: split-file %s %t - -RUN: llvm-cgdata dump -binary %t/dump.cgtext -o %t/dump.cgdata -RUN: llvm-cgdata dump -text %t/dump.cgdata -o %t/dump-round.cgtext -RUN: llvm-cgdata dump -binary %t/dump-round.cgtext -o %t/dump-round.cgdata -RUN: llvm-cgdata dump -text %t/dump-round.cgtext -o %t/dump-round-round.cgtext -RUN: diff %t/dump.cgdata %t/dump-round.cgdata -RUN: diff %t/dump-round.cgtext %t/dump-round-round.cgtext - -;--- dump.cgtext -# Outlined stable hash tree -:outlined_hash_tree ---- -0: - Hash: 0x0 - Terminals: 0 - SuccessorIds: [ 1 ] -1: - Hash: 0x1 - Terminals: 0 - SuccessorIds: [ 2, 3 ] -2: - Hash: 0x3 - Terminals: 5 - SuccessorIds: [ ] -3: - Hash: 0x2 - Terminals: 4 - SuccessorIds: [ ] -... diff --git a/llvm/test/tools/llvm-cgdata/empty.test b/llvm/test/tools/llvm-cgdata/empty.test deleted file mode 100644 index 6e41f33ade9c3..0000000000000 --- a/llvm/test/tools/llvm-cgdata/empty.test +++ /dev/null @@ -1,35 +0,0 @@ -# Test no input file -RUN: not llvm-cgdata dump -o - 2>&1 | FileCheck %s --check-prefix=NOFILE --ignore-case -NOFILE: error: No such file or directory - -# Test for empty cgdata file, which is invalid. -RUN: touch %t_emptyfile.cgtext -RUN: not llvm-cgdata dump %t_emptyfile.cgtext -text 2>&1 | FileCheck %s --check-prefix=EMPTY -EMPTY: {{.}}emptyfile.cgtext: empty codegen data - -# Test for empty header in the text format. It can be converted to a valid binary file. -RUN: printf '#' > %t_emptyheader.cgtext -RUN: llvm-cgdata dump %t_emptyheader.cgtext -binary -o %t_emptyheader.cgdata - -# Without any cgdata other than the header, no data shows by default. -RUN: llvm-cgdata show %t_emptyheader.cgdata | count 0 - -# The version number appears when asked, as it's in the header -RUN: llvm-cgdata show --cgdata-version %t_emptyheader.cgdata | FileCheck %s --check-prefix=VERSION -VERSION: Version: 1 - -# When converting a binary file (w/ the header only) to a text file, it's an empty file as the text format does not have an explicit header. -RUN: llvm-cgdata dump %t_emptyheader.cgdata -text | count 0 - -# Synthesize a header only cgdata. -# struct Header { -# uint64_t Magic; -# uint32_t Version; -# uint32_t DataKind; -# uint64_t OutlinedHashTreeOffset; -# } -RUN: printf '\xffcgdata\x81' > %t_header.cgdata -RUN: printf '\x01\x00\x00\x00' >> %t_header.cgdata -RUN: printf '\x00\x00\x00\x00' >> %t_header.cgdata -RUN: printf '\x18\x00\x00\x00\x00\x00\x00\x00' >> %t_header.cgdata -RUN: diff %t_header.cgdata %t_emptyheader.cgdata diff --git a/llvm/test/tools/llvm-cgdata/error.test b/llvm/test/tools/llvm-cgdata/error.test deleted file mode 100644 index 4da22498ea390..0000000000000 --- a/llvm/test/tools/llvm-cgdata/error.test +++ /dev/null @@ -1,38 +0,0 @@ -# Test various error cases - -# Synthesize a header only cgdata. -# struct Header { -# uint64_t Magic; -# uint32_t Version; -# uint32_t DataKind; -# uint64_t OutlinedHashTreeOffset; -# } -RUN: touch %t_empty.cgdata -RUN: not llvm-cgdata show %t_empty.cgdata 2>&1 | FileCheck %s --check-prefix=EMPTY -EMPTY: {{.}}cgdata: empty codegen data - -# Not a magic. -RUN: printf '\xff' > %t_malformed.cgdata -RUN: not llvm-cgdata show %t_malformed.cgdata 2>&1 | FileCheck %s --check-prefix=MALFORMED -MALFORMED: {{.}}cgdata: malformed codegen data - -# The minimum header size is 24. -RUN: printf '\xffcgdata\x81' > %t_corrupt.cgdata -RUN: not llvm-cgdata show %t_corrupt.cgdata 2>&1 | FileCheck %s --check-prefix=CORRUPT -CORRUPT: {{.}}cgdata: invalid codegen data (file header is corrupt) - -# The current version 1 while the header says 2. -RUN: printf '\xffcgdata\x81' > %t_version.cgdata -RUN: printf '\x02\x00\x00\x00' >> %t_version.cgdata -RUN: printf '\x00\x00\x00\x00' >> %t_version.cgdata -RUN: printf '\x18\x00\x00\x00\x00\x00\x00\x00' >> %t_version.cgdata -RUN: not llvm-cgdata show %t_version.cgdata 2>&1 | FileCheck %s --check-prefix=BAD_VERSION -BAD_VERSION: {{.}}cgdata: unsupported codegen data version - -# Header says an outlined hash tree, but the file ends after the header. -RUN: printf '\xffcgdata\x81' > %t_eof.cgdata -RUN: printf '\x01\x00\x00\x00' >> %t_eof.cgdata -RUN: printf '\x01\x00\x00\x00' >> %t_eof.cgdata -RUN: printf '\x18\x00\x00\x00\x00\x00\x00\x00' >> %t_eof.cgdata -RUN: not llvm-cgdata show %t_eof.cgdata 2>&1 | FileCheck %s --check-prefix=EOF -EOF: {{.}}cgdata: end of File diff --git a/llvm/test/tools/llvm-cgdata/merge-archive.test b/llvm/test/tools/llvm-cgdata/merge-archive.test deleted file mode 100644 index e17422fdcd140..0000000000000 --- a/llvm/test/tools/llvm-cgdata/merge-archive.test +++ /dev/null @@ -1,90 +0,0 @@ -# REQUIRES: shell, aarch64-registered-target -# UNSUPPORTED: system-windows - -# Merge an archive that has two object files having cgdata (__llvm_outline) - -RUN: split-file %s %t - -# Synthesize raw cgdata without the header (24 byte) from the indexed cgdata. -RUN: llvm-cgdata dump -binary %t/raw-1.cgtext -o %t/raw-1.cgdata -RUN: od -t x1 -j 24 -An %t/raw-1.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' > %t/raw-1-bytes.txt -RUN: sed -ie "s//$(cat %t/raw-1-bytes.txt)/g" %t/merge-1.ll -RUN: llc -filetype=obj -mtriple arm64-apple-darwin %t/merge-1.ll -o %t/merge-1.o - -# Synthesize raw cgdata without the header (24 byte) from the indexed cgdata. -RUN: llvm-cgdata dump -binary %t/raw-2.cgtext -o %t/raw-2.cgdata -RUN: od -t x1 -j 24 -An %t/raw-2.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' > %t/raw-2-bytes.txt -RUN: sed -ie "s//$(cat %t/raw-2-bytes.txt)/g" %t/merge-2.ll -RUN: llc -filetype=obj -mtriple arm64-apple-darwin %t/merge-2.ll -o %t/merge-2.o - -# Make an archive from two object files -RUN: llvm-ar rcs %t/merge-archive.a %t/merge-1.o %t/merge-2.o - -# Merge the archive into the codegen data file. -RUN: llvm-cgdata merge %t/merge-archive.a -o %t/merge-archive.cgdata -RUN: llvm-cgdata show %t/merge-archive.cgdata | FileCheck %s -CHECK: Outlined hash tree: -CHECK-NEXT: Total Node Count: 4 -CHECK-NEXT: Terminal Node Count: 2 -CHECK-NEXT: Depth: 2 - -RUN: llvm-cgdata dump %t/merge-archive.cgdata | FileCheck %s --check-prefix=TREE -TREE: # Outlined stable hash tree -TREE-NEXT: :outlined_hash_tree -TREE-NEXT: --- -TREE-NEXT: 0: -TREE-NEXT: Hash: 0x0 -TREE-NEXT: Terminals: 0 -TREE-NEXT: SuccessorIds: [ 1 ] -TREE-NEXT: 1: -TREE-NEXT: Hash: 0x1 -TREE-NEXT: Terminals: 0 -TREE-NEXT: SuccessorIds: [ 2, 3 ] -TREE-NEXT: 2: -TREE-NEXT: Hash: 0x3 -TREE-NEXT: Terminals: 5 -TREE-NEXT: SuccessorIds: [ ] -TREE-NEXT: 3: -TREE-NEXT: Hash: 0x2 -TREE-NEXT: Terminals: 4 -TREE-NEXT: SuccessorIds: [ ] -TREE-NEXT: ... - -;--- raw-1.cgtext -:outlined_hash_tree -0: - Hash: 0x0 - Terminals: 0 - SuccessorIds: [ 1 ] -1: - Hash: 0x1 - Terminals: 0 - SuccessorIds: [ 2 ] -2: - Hash: 0x2 - Terminals: 4 - SuccessorIds: [ ] -... - -;--- merge-1.ll -@.data = private unnamed_addr constant [72 x i8] c"", section "__DATA,__llvm_outline" - - -;--- raw-2.cgtext -:outlined_hash_tree -0: - Hash: 0x0 - Terminals: 0 - SuccessorIds: [ 1 ] -1: - Hash: 0x1 - Terminals: 0 - SuccessorIds: [ 2 ] -2: - Hash: 0x3 - Terminals: 5 - SuccessorIds: [ ] -... - -;--- merge-2.ll -@.data = private unnamed_addr constant [72 x i8] c"", section "__DATA,__llvm_outline" diff --git a/llvm/test/tools/llvm-cgdata/merge-concat.test b/llvm/test/tools/llvm-cgdata/merge-concat.test deleted file mode 100644 index 68ce20503e58d..0000000000000 --- a/llvm/test/tools/llvm-cgdata/merge-concat.test +++ /dev/null @@ -1,83 +0,0 @@ -# REQUIRES: shell, aarch64-registered-target -# UNSUPPORTED: system-windows - -# Merge a binary file (e.g., a linked executable) having concatenated cgdata (__llvm_outline) - -RUN: split-file %s %t - -# Synthesize two sets of raw cgdata without the header (24 byte) from the indexed cgdata. -# Concatenate them in merge-concat.ll -RUN: llvm-cgdata dump -binary %t/raw-1.cgtext -o %t/raw-1.cgdata -RUN: od -t x1 -j 24 -An %t/raw-1.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' > %t/raw-1-bytes.txt -RUN: sed -ie "s//$(cat %t/raw-1-bytes.txt)/g" %t/merge-concat.ll -RUN: llvm-cgdata dump -binary %t/raw-2.cgtext -o %t/raw-2.cgdata -RUN: od -t x1 -j 24 -An %t/raw-2.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' > %t/raw-2-bytes.txt -RUN: sed -ie "s//$(cat %t/raw-2-bytes.txt)/g" %t/merge-concat.ll - -RUN: llc -filetype=obj -mtriple arm64-apple-darwin %t/merge-concat.ll -o %t/merge-concat.o -RUN: llvm-cgdata merge %t/merge-concat.o -o %t/merge-concat.cgdata -RUN: llvm-cgdata show %t/merge-concat.cgdata | FileCheck %s -CHECK: Outlined hash tree: -CHECK-NEXT: Total Node Count: 4 -CHECK-NEXT: Terminal Node Count: 2 -CHECK-NEXT: Depth: 2 - -RUN: llvm-cgdata dump %t/merge-concat.cgdata | FileCheck %s --check-prefix=TREE -TREE: # Outlined stable hash tree -TREE-NEXT: :outlined_hash_tree -TREE-NEXT: --- -TREE-NEXT: 0: -TREE-NEXT: Hash: 0x0 -TREE-NEXT: Terminals: 0 -TREE-NEXT: SuccessorIds: [ 1 ] -TREE-NEXT: 1: -TREE-NEXT: Hash: 0x1 -TREE-NEXT: Terminals: 0 -TREE-NEXT: SuccessorIds: [ 2, 3 ] -TREE-NEXT: 2: -TREE-NEXT: Hash: 0x3 -TREE-NEXT: Terminals: 5 -TREE-NEXT: SuccessorIds: [ ] -TREE-NEXT: 3: -TREE-NEXT: Hash: 0x2 -TREE-NEXT: Terminals: 4 -TREE-NEXT: SuccessorIds: [ ] -TREE-NEXT: ... - -;--- raw-1.cgtext -:outlined_hash_tree -0: - Hash: 0x0 - Terminals: 0 - SuccessorIds: [ 1 ] -1: - Hash: 0x1 - Terminals: 0 - SuccessorIds: [ 2 ] -2: - Hash: 0x2 - Terminals: 4 - SuccessorIds: [ ] -... - -;--- raw-2.cgtext -:outlined_hash_tree -0: - Hash: 0x0 - Terminals: 0 - SuccessorIds: [ 1 ] -1: - Hash: 0x1 - Terminals: 0 - SuccessorIds: [ 2 ] -2: - Hash: 0x3 - Terminals: 5 - SuccessorIds: [ ] -... - -;--- merge-concat.ll - -; In an linked executable (as opposed to an object file), cgdata in __llvm_outline might be concatenated. Although this is not a typical workflow, we simply support this case to parse cgdata that is concatenated. In other words, the following two trees are encoded back-to-back in a binary format. -@.data1 = private unnamed_addr constant [72 x i8] c"", section "__DATA,__llvm_outline" -@.data2 = private unnamed_addr constant [72 x i8] c"", section "__DATA,__llvm_outline" diff --git a/llvm/test/tools/llvm-cgdata/merge-double.test b/llvm/test/tools/llvm-cgdata/merge-double.test deleted file mode 100644 index c88e95ba68ea4..0000000000000 --- a/llvm/test/tools/llvm-cgdata/merge-double.test +++ /dev/null @@ -1,87 +0,0 @@ -# REQUIRES: shell, aarch64-registered-target -# UNSUPPORTED: system-windows - -# Merge two object files having cgdata (__llvm_outline) - -RUN: split-file %s %t - -# Synthesize raw cgdata without the header (24 byte) from the indexed cgdata. -RUN: llvm-cgdata dump -binary %t/raw-1.cgtext -o %t/raw-1.cgdata -RUN: od -t x1 -j 24 -An %t/raw-1.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' > %t/raw-1-bytes.txt -RUN: sed -ie "s//$(cat %t/raw-1-bytes.txt)/g" %t/merge-1.ll -RUN: llc -filetype=obj -mtriple arm64-apple-darwin %t/merge-1.ll -o %t/merge-1.o - -# Synthesize raw cgdata without the header (24 byte) from the indexed cgdata. -RUN: llvm-cgdata dump -binary %t/raw-2.cgtext -o %t/raw-2.cgdata -RUN: od -t x1 -j 24 -An %t/raw-2.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' > %t/raw-2-bytes.txt -RUN: sed -ie "s//$(cat %t/raw-2-bytes.txt)/g" %t/merge-2.ll -RUN: llc -filetype=obj -mtriple arm64-apple-darwin %t/merge-2.ll -o %t/merge-2.o - -# Merge two object files into the codegen data file. -RUN: llvm-cgdata merge %t/merge-1.o %t/merge-2.o -o %t/merge.cgdata - -RUN: llvm-cgdata show %t/merge.cgdata | FileCheck %s -CHECK: Outlined hash tree: -CHECK-NEXT: Total Node Count: 4 -CHECK-NEXT: Terminal Node Count: 2 -CHECK-NEXT: Depth: 2 - -RUN: llvm-cgdata dump %t/merge.cgdata | FileCheck %s --check-prefix=TREE -TREE: # Outlined stable hash tree -TREE-NEXT: :outlined_hash_tree -TREE-NEXT: --- -TREE-NEXT: 0: -TREE-NEXT: Hash: 0x0 -TREE-NEXT: Terminals: 0 -TREE-NEXT: SuccessorIds: [ 1 ] -TREE-NEXT: 1: -TREE-NEXT: Hash: 0x1 -TREE-NEXT: Terminals: 0 -TREE-NEXT: SuccessorIds: [ 2, 3 ] -TREE-NEXT: 2: -TREE-NEXT: Hash: 0x3 -TREE-NEXT: Terminals: 5 -TREE-NEXT: SuccessorIds: [ ] -TREE-NEXT: 3: -TREE-NEXT: Hash: 0x2 -TREE-NEXT: Terminals: 4 -TREE-NEXT: SuccessorIds: [ ] -TREE-NEXT: ... - -;--- raw-1.cgtext -:outlined_hash_tree -0: - Hash: 0x0 - Terminals: 0 - SuccessorIds: [ 1 ] -1: - Hash: 0x1 - Terminals: 0 - SuccessorIds: [ 2 ] -2: - Hash: 0x2 - Terminals: 4 - SuccessorIds: [ ] -... - -;--- merge-1.ll -@.data = private unnamed_addr constant [72 x i8] c"", section "__DATA,__llvm_outline" - -;--- raw-2.cgtext -:outlined_hash_tree -0: - Hash: 0x0 - Terminals: 0 - SuccessorIds: [ 1 ] -1: - Hash: 0x1 - Terminals: 0 - SuccessorIds: [ 2 ] -2: - Hash: 0x3 - Terminals: 5 - SuccessorIds: [ ] -... - -;--- merge-2.ll -@.data = private unnamed_addr constant [72 x i8] c"", section "__DATA,__llvm_outline" diff --git a/llvm/test/tools/llvm-cgdata/merge-single.test b/llvm/test/tools/llvm-cgdata/merge-single.test deleted file mode 100644 index 37532eff6b9c8..0000000000000 --- a/llvm/test/tools/llvm-cgdata/merge-single.test +++ /dev/null @@ -1,49 +0,0 @@ -# REQUIRES: shell, aarch64-registered-target -# UNSUPPORTED: system-windows - -# Test merge a single object file into a cgdata - -RUN: split-file %s %t - -# Merge an object file that has no cgdata (__llvm_outline). It still produces a header only cgdata. -RUN: llc -filetype=obj -mtriple arm64-apple-darwin %t/merge-empty.ll -o %t/merge-empty.o -RUN: llvm-cgdata merge %t/merge-empty.o -o %t/merge-empty.cgdata -# No summary appear with the header only cgdata. -RUN: llvm-cgdata show %t/merge-empty.cgdata | count 0 - -# Synthesize raw cgdata without the header (24 byte) from the indexed cgdata. -RUN: llvm-cgdata dump -binary %t/raw-single.cgtext -o %t/raw-single.cgdata -RUN: od -t x1 -j 24 -An %t/raw-single.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' > %t/raw-single-bytes.txt - -RUN: sed -ie "s//$(cat %t/raw-single-bytes.txt)/g" %t/merge-single.ll -RUN: llc -filetype=obj -mtriple arm64-apple-darwin %t/merge-single.ll -o %t/merge-single.o - -# Merge an object file having cgdata (__llvm_outline) -RUN: llvm-cgdata merge %t/merge-single.o -o %t/merge-single.cgdata -RUN: llvm-cgdata show %t/merge-single.cgdata | FileCheck %s -CHECK: Outlined hash tree: -CHECK-NEXT: Total Node Count: 3 -CHECK-NEXT: Terminal Node Count: 1 -CHECK-NEXT: Depth: 2 - -;--- merge-empty.ll -@.data = private unnamed_addr constant [1 x i8] c"\01" - -;--- raw-single.cgtext -:outlined_hash_tree -0: - Hash: 0x0 - Terminals: 0 - SuccessorIds: [ 1 ] -1: - Hash: 0x1 - Terminals: 0 - SuccessorIds: [ 2 ] -2: - Hash: 0x2 - Terminals: 4 - SuccessorIds: [ ] -... - -;--- merge-single.ll -@.data = private unnamed_addr constant [72 x i8] c"", section "__DATA,__llvm_outline" diff --git a/llvm/test/tools/llvm-cgdata/show.test b/llvm/test/tools/llvm-cgdata/show.test deleted file mode 100644 index accb4b77ede24..0000000000000 --- a/llvm/test/tools/llvm-cgdata/show.test +++ /dev/null @@ -1,30 +0,0 @@ -# Test show - -RUN: split-file %s %t -RUN: llvm-cgdata show %t/show.cgtext | FileCheck %s - -CHECK: Outlined hash tree: -CHECK-NEXT: Total Node Count: 3 -CHECK-NEXT: Terminal Node Count: 1 -CHECK-NEXT: Depth: 2 - -# Convert the text file to the binary file -RUN: llvm-cgdata dump -binary %t/show.cgtext -o %t/show.cgdata -RUN: llvm-cgdata show %t/show.cgdata | FileCheck %s - -;--- show.cgtext -:outlined_hash_tree ---- -0: - Hash: 0x0 - Terminals: 0 - SuccessorIds: [ 1 ] -1: - Hash: 0x1 - Terminals: 0 - SuccessorIds: [ 2 ] -2: - Hash: 0x2 - Terminals: 3 - SuccessorIds: [ ] -... diff --git a/llvm/test/tools/llvm-mca/X86/Generic/resources-avx512.s b/llvm/test/tools/llvm-mca/X86/Generic/resources-avx512.s index a8937f7dcfd11..c3453d890d76d 100644 --- a/llvm/test/tools/llvm-mca/X86/Generic/resources-avx512.s +++ b/llvm/test/tools/llvm-mca/X86/Generic/resources-avx512.s @@ -298,6 +298,9 @@ vdivps %zmm16, %zmm17, %zmm19 {z}{k1} vdivps (%rax), %zmm17, %zmm19 {z}{k1} vdivps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} +{evex} vextractps $1, %xmm0, %rcx +{evex} vextractps $1, %xmm0, (%rax) + vfmadd132pd %zmm16, %zmm17, %zmm19 vfmadd132pd (%rax), %zmm17, %zmm19 vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -811,6 +814,11 @@ vpermq %zmm16, %zmm17, %zmm19 {z}{k1} vpermq (%rax), %zmm17, %zmm19 {z}{k1} vpermq (%rax){1to8}, %zmm17, %zmm19 {z}{k1} +vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} + vpshufd $0, %zmm16, %zmm19 vpshufd $0, (%rax), %zmm19 vpshufd $0, (%rax){1to16}, %zmm19 @@ -881,6 +889,11 @@ vpunpcklqdq %zmm16, %zmm17, %zmm19 {z}{k1} vpunpcklqdq (%rax), %zmm17, %zmm19 {z}{k1} vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {z}{k1} +vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} + vshuff32x4 $0, %zmm16, %zmm17, %zmm19 vshuff32x4 $0, (%rax), %zmm17, %zmm19 vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 @@ -1334,6 +1347,8 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 3 29 28.00 vdivps %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 4 36 28.00 * vdivps (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 4 36 28.00 * vdivps (%rax){1to16}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 2 3 1.00 {evex} vextractps $1, %xmm0, %ecx +# CHECK-NEXT: 3 5 1.00 * {evex} vextractps $1, %xmm0, (%rax) # CHECK-NEXT: 1 5 0.50 vfmadd132pd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 10 0.50 * vfmadd132pd (%rax), %zmm17, %zmm19 # CHECK-NEXT: 2 10 0.50 * vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -1787,6 +1802,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 1 1 1.00 vpermq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpermq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpermq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 1 1 1.00 * vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: 1 1 1.00 vpshufd $0, %zmm16, %zmm19 # CHECK-NEXT: 2 8 1.00 * vpshufd $0, (%rax), %zmm19 # CHECK-NEXT: 2 8 1.00 * vpshufd $0, (%rax){1to16}, %zmm19 @@ -1850,6 +1869,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 1 1 1.00 vpunpcklqdq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpcklqdq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 1 1 1.00 * vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: 1 1 1.00 vshuff32x4 $0, %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 8 1.00 * vshuff32x4 $0, (%rax), %zmm17, %zmm19 # CHECK-NEXT: 2 8 1.00 * vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 @@ -2027,7 +2050,7 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6.0] [6.1] -# CHECK-NEXT: - 1506.00 197.00 334.00 16.00 522.00 299.50 299.50 +# CHECK-NEXT: - 1506.00 198.00 335.00 25.00 523.00 304.00 304.00 # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions: @@ -2290,6 +2313,8 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - 28.00 2.50 - - 0.50 - - vdivps %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - 28.00 2.50 - - 0.50 0.50 0.50 vdivps (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - 28.00 2.50 - - 0.50 0.50 0.50 vdivps (%rax){1to16}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: - - 1.00 0.50 - 0.50 - - {evex} vextractps $1, %xmm0, %ecx +# CHECK-NEXT: - - - 0.50 1.00 0.50 0.50 0.50 {evex} vextractps $1, %xmm0, (%rax) # CHECK-NEXT: - - 0.50 0.50 - - - - vfmadd132pd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - 0.50 0.50 - - 0.50 0.50 vfmadd132pd (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - 0.50 0.50 - - 0.50 0.50 vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -2743,6 +2768,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - - - - - 1.00 - - vpermq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpermq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpermq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: - - - - - 1.00 - - vpshufd $0, %zmm16, %zmm19 # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpshufd $0, (%rax), %zmm19 # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpshufd $0, (%rax){1to16}, %zmm19 @@ -2806,6 +2835,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - - - - - 1.00 - - vpunpcklqdq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpcklqdq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: - - - - - 1.00 - - vshuff32x4 $0, %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vshuff32x4 $0, (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 diff --git a/llvm/test/tools/llvm-mca/X86/Generic/resources-avx512vl.s b/llvm/test/tools/llvm-mca/X86/Generic/resources-avx512vl.s index e8e7a80f690bf..4a4f77826437b 100644 --- a/llvm/test/tools/llvm-mca/X86/Generic/resources-avx512vl.s +++ b/llvm/test/tools/llvm-mca/X86/Generic/resources-avx512vl.s @@ -1344,6 +1344,16 @@ vpmulld %ymm16, %ymm17, %ymm19 {z}{k1} vpmulld (%rax), %ymm17, %ymm19 {z}{k1} vpmulld (%rax){1to8}, %ymm17, %ymm19 {z}{k1} +vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} + +vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} + vpshufd $0, %xmm16, %xmm19 vpshufd $0, (%rax), %xmm19 vpshufd $0, (%rax){1to4}, %xmm19 @@ -1500,6 +1510,16 @@ vpunpckldq %ymm16, %ymm17, %ymm19 {z}{k1} vpunpckldq (%rax), %ymm17, %ymm19 {z}{k1} vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {z}{k1} +vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} + +vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} + vshuff32x4 $0, %ymm16, %ymm17, %ymm19 vshuff32x4 $0, (%rax), %ymm17, %ymm19 vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 @@ -2897,6 +2917,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: 1 5 1.00 vpmulld %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 2 12 1.00 * vpmulld (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 2 12 1.00 * vpmulld (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 1 1 1.00 * vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: 1 1 0.50 vpshufd $0, %xmm16, %xmm19 # CHECK-NEXT: 2 7 0.50 * vpshufd $0, (%rax), %xmm19 # CHECK-NEXT: 2 7 0.50 * vpshufd $0, (%rax){1to4}, %xmm19 @@ -3035,6 +3063,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: 1 1 1.00 vpunpckldq %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpckldq (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 1 1 1.00 * vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: 1 1 1.00 vshuff32x4 $0, %ymm16, %ymm17, %ymm19 # CHECK-NEXT: 2 8 1.00 * vshuff32x4 $0, (%rax), %ymm17, %ymm19 # CHECK-NEXT: 2 8 1.00 * vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 @@ -3228,7 +3264,7 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6.0] [6.1] -# CHECK-NEXT: - 1935.00 278.00 579.50 32.00 738.50 486.50 486.50 +# CHECK-NEXT: - 1935.00 278.00 579.50 48.00 738.50 494.50 494.50 # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions: @@ -4420,6 +4456,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: - - 1.00 - - - - - vpmulld %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 vpmulld (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - 1.00 - - - 0.50 0.50 vpmulld (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpshufd $0, %xmm16, %xmm19 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpshufd $0, (%rax), %xmm19 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpshufd $0, (%rax){1to4}, %xmm19 @@ -4558,6 +4602,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: - - - - - 1.00 - - vpunpckldq %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpckldq (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - - - 1.00 - 0.50 0.50 vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: - - - - - 1.00 - - vshuff32x4 $0, %ymm16, %ymm17, %ymm19 # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vshuff32x4 $0, (%rax), %ymm17, %ymm19 # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 diff --git a/llvm/test/tools/llvm-mca/X86/IceLakeServer/resources-avx512.s b/llvm/test/tools/llvm-mca/X86/IceLakeServer/resources-avx512.s index 5c12c520b04af..c509e766540b1 100644 --- a/llvm/test/tools/llvm-mca/X86/IceLakeServer/resources-avx512.s +++ b/llvm/test/tools/llvm-mca/X86/IceLakeServer/resources-avx512.s @@ -298,6 +298,9 @@ vdivps %zmm16, %zmm17, %zmm19 {z}{k1} vdivps (%rax), %zmm17, %zmm19 {z}{k1} vdivps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} +{evex} vextractps $1, %xmm0, %rcx +{evex} vextractps $1, %xmm0, (%rax) + vfmadd132pd %zmm16, %zmm17, %zmm19 vfmadd132pd (%rax), %zmm17, %zmm19 vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -811,6 +814,11 @@ vpermq %zmm16, %zmm17, %zmm19 {z}{k1} vpermq (%rax), %zmm17, %zmm19 {z}{k1} vpermq (%rax){1to8}, %zmm17, %zmm19 {z}{k1} +vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} + vpshufd $0, %zmm16, %zmm19 vpshufd $0, (%rax), %zmm19 vpshufd $0, (%rax){1to16}, %zmm19 @@ -881,6 +889,11 @@ vpunpcklqdq %zmm16, %zmm17, %zmm19 {z}{k1} vpunpcklqdq (%rax), %zmm17, %zmm19 {z}{k1} vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {z}{k1} +vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} + vshuff32x4 $0, %zmm16, %zmm17, %zmm19 vshuff32x4 $0, (%rax), %zmm17, %zmm19 vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 @@ -1334,6 +1347,8 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 3 18 10.00 vdivps %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 4 25 10.00 * vdivps (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 4 25 10.00 * vdivps (%rax){1to16}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 2 3 1.00 {evex} vextractps $1, %xmm0, %ecx +# CHECK-NEXT: 3 2 1.00 * {evex} vextractps $1, %xmm0, (%rax) # CHECK-NEXT: 1 4 1.00 vfmadd132pd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 11 1.00 * vfmadd132pd (%rax), %zmm17, %zmm19 # CHECK-NEXT: 2 11 1.00 * vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -1787,6 +1802,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 1 3 1.00 vpermq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 10 1.00 * vpermq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 10 1.00 * vpermq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 36 8 8.00 * vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 19 7 4.00 * vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 19 7 4.00 * vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 19 7 4.00 * vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: 1 1 1.00 vpshufd $0, %zmm16, %zmm19 # CHECK-NEXT: 2 8 1.00 * vpshufd $0, (%rax), %zmm19 # CHECK-NEXT: 2 8 1.00 * vpshufd $0, (%rax){1to16}, %zmm19 @@ -1850,6 +1869,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 1 1 1.00 vpunpcklqdq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpcklqdq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 36 7 8.00 * vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 19 7 4.00 * vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 19 7 4.00 * vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 19 7 4.00 * vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: 1 3 1.00 vshuff32x4 $0, %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 10 1.00 * vshuff32x4 $0, (%rax), %zmm17, %zmm19 # CHECK-NEXT: 2 10 1.00 * vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 @@ -2031,7 +2054,7 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] -# CHECK-NEXT: - 612.00 398.17 99.67 327.50 327.50 8.00 585.17 2.00 8.00 8.00 8.00 +# CHECK-NEXT: - 612.00 411.17 103.67 327.50 327.50 48.50 593.17 6.00 48.50 48.50 48.50 # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] Instructions: @@ -2294,6 +2317,8 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - 10.00 2.00 - - - - 1.00 - - - - vdivps %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - 10.00 2.00 - 0.50 0.50 - 1.00 - - - - vdivps (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - 10.00 2.00 - 0.50 0.50 - 1.00 - - - - vdivps (%rax){1to16}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: - - 1.00 - - - - 1.00 - - - - {evex} vextractps $1, %xmm0, %ecx +# CHECK-NEXT: - - - - - - 0.50 1.00 - 0.50 0.50 0.50 {evex} vextractps $1, %xmm0, (%rax) # CHECK-NEXT: - - 1.00 - - - - - - - - - vfmadd132pd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - - - vfmadd132pd (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - 1.00 - 0.50 0.50 - - - - - - vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -2747,6 +2772,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - - - - - - - 1.00 - - - - vpermq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vpermq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vpermq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: - - 1.50 0.50 - - 8.00 1.50 0.50 8.00 8.00 8.00 vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 4.00 0.50 0.50 4.00 4.00 4.00 vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 4.00 0.50 0.50 4.00 4.00 4.00 vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 4.00 0.50 0.50 4.00 4.00 4.00 vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: - - - - - - - 1.00 - - - - vpshufd $0, %zmm16, %zmm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vpshufd $0, (%rax), %zmm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vpshufd $0, (%rax){1to16}, %zmm19 @@ -2810,6 +2839,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - - - - - - - 1.00 - - - - vpunpcklqdq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vpunpcklqdq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: - - 1.50 0.50 - - 8.00 1.50 0.50 8.00 8.00 8.00 vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 4.00 0.50 0.50 4.00 4.00 4.00 vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 4.00 0.50 0.50 4.00 4.00 4.00 vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 4.00 0.50 0.50 4.00 4.00 4.00 vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: - - - - - - - 1.00 - - - - vshuff32x4 $0, %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vshuff32x4 $0, (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 diff --git a/llvm/test/tools/llvm-mca/X86/IceLakeServer/resources-avx512vl.s b/llvm/test/tools/llvm-mca/X86/IceLakeServer/resources-avx512vl.s index 375087ae0cfe4..00e5c3b03f6f5 100644 --- a/llvm/test/tools/llvm-mca/X86/IceLakeServer/resources-avx512vl.s +++ b/llvm/test/tools/llvm-mca/X86/IceLakeServer/resources-avx512vl.s @@ -1344,6 +1344,16 @@ vpmulld %ymm16, %ymm17, %ymm19 {z}{k1} vpmulld (%rax), %ymm17, %ymm19 {z}{k1} vpmulld (%rax){1to8}, %ymm17, %ymm19 {z}{k1} +vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} + +vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} + vpshufd $0, %xmm16, %xmm19 vpshufd $0, (%rax), %xmm19 vpshufd $0, (%rax){1to4}, %xmm19 @@ -1500,6 +1510,16 @@ vpunpckldq %ymm16, %ymm17, %ymm19 {z}{k1} vpunpckldq (%rax), %ymm17, %ymm19 {z}{k1} vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {z}{k1} +vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} + +vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} + vshuff32x4 $0, %ymm16, %ymm17, %ymm19 vshuff32x4 $0, (%rax), %ymm17, %ymm19 vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 @@ -2897,6 +2917,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: 2 10 1.00 vpmulld %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 3 17 1.00 * vpmulld (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 3 17 1.00 * vpmulld (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 12 8 2.00 * vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 7 1.00 * vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 8 8 1.00 * vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 7 1.00 * vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 20 8 4.00 * vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 11 7 2.00 * vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 8 8 1.00 * vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 11 7 2.00 * vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: 1 1 0.50 vpshufd $0, %xmm16, %xmm19 # CHECK-NEXT: 2 7 0.50 * vpshufd $0, (%rax), %xmm19 # CHECK-NEXT: 2 7 0.50 * vpshufd $0, (%rax){1to4}, %xmm19 @@ -3035,6 +3063,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: 1 1 0.50 vpunpckldq %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 2 8 0.50 * vpunpckldq (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 2 8 0.50 * vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 12 8 2.00 * vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 7 1.00 * vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 8 8 1.00 * vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 7 1.00 * vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 20 8 4.00 * vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 11 7 2.00 * vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 8 8 1.00 * vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 11 7 2.00 * vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: 1 3 1.00 vshuff32x4 $0, %ymm16, %ymm17, %ymm19 # CHECK-NEXT: 2 10 1.00 * vshuff32x4 $0, (%rax), %ymm17, %ymm19 # CHECK-NEXT: 2 10 1.00 * vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 @@ -3232,7 +3268,7 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] -# CHECK-NEXT: - 423.00 438.33 413.33 492.50 492.50 16.00 722.33 4.00 16.00 16.00 16.00 +# CHECK-NEXT: - 423.00 462.33 421.33 492.50 492.50 44.00 738.33 12.00 44.00 44.00 44.00 # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] Instructions: @@ -4424,6 +4460,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: - - 1.00 1.00 - - - - - - - - vpmulld %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - - - vpmulld (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - - - vpmulld (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: - - 1.50 0.50 - - 2.00 1.50 0.50 2.00 2.00 2.00 vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 1.00 0.50 0.50 1.00 1.00 1.00 vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 1.00 1.50 0.50 1.00 1.00 1.00 vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 1.00 0.50 0.50 1.00 1.00 1.00 vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 4.00 1.50 0.50 4.00 4.00 4.00 vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 2.00 0.50 0.50 2.00 2.00 2.00 vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 1.00 1.50 0.50 1.00 1.00 1.00 vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 2.00 0.50 0.50 2.00 2.00 2.00 vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: - - - 0.50 - - - 0.50 - - - - vpshufd $0, %xmm16, %xmm19 # CHECK-NEXT: - - - 0.50 0.50 0.50 - 0.50 - - - - vpshufd $0, (%rax), %xmm19 # CHECK-NEXT: - - - 0.50 0.50 0.50 - 0.50 - - - - vpshufd $0, (%rax){1to4}, %xmm19 @@ -4562,6 +4606,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: - - - 0.50 - - - 0.50 - - - - vpunpckldq %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 0.50 0.50 - 0.50 - - - - vpunpckldq (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 0.50 0.50 - 0.50 - - - - vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: - - 1.50 0.50 - - 2.00 1.50 0.50 2.00 2.00 2.00 vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 1.00 0.50 0.50 1.00 1.00 1.00 vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 1.00 1.50 0.50 1.00 1.00 1.00 vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 1.00 0.50 0.50 1.00 1.00 1.00 vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 4.00 1.50 0.50 4.00 4.00 4.00 vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 2.00 0.50 0.50 2.00 2.00 2.00 vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 1.00 1.50 0.50 1.00 1.00 1.00 vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 - - 2.00 0.50 0.50 2.00 2.00 2.00 vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: - - - - - - - 1.00 - - - - vshuff32x4 $0, %ymm16, %ymm17, %ymm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vshuff32x4 $0, (%rax), %ymm17, %ymm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - - - vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 diff --git a/llvm/test/tools/llvm-mca/X86/SapphireRapids/resources-avx512.s b/llvm/test/tools/llvm-mca/X86/SapphireRapids/resources-avx512.s index b34ccaacc11a3..b2fde3929106a 100644 --- a/llvm/test/tools/llvm-mca/X86/SapphireRapids/resources-avx512.s +++ b/llvm/test/tools/llvm-mca/X86/SapphireRapids/resources-avx512.s @@ -298,6 +298,9 @@ vdivps %zmm16, %zmm17, %zmm19 {z}{k1} vdivps (%rax), %zmm17, %zmm19 {z}{k1} vdivps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} +{evex} vextractps $1, %xmm0, %rcx +{evex} vextractps $1, %xmm0, (%rax) + vfmadd132pd %zmm16, %zmm17, %zmm19 vfmadd132pd (%rax), %zmm17, %zmm19 vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -811,6 +814,11 @@ vpermq %zmm16, %zmm17, %zmm19 {z}{k1} vpermq (%rax), %zmm17, %zmm19 {z}{k1} vpermq (%rax){1to8}, %zmm17, %zmm19 {z}{k1} +vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} + vpshufd $0, %zmm16, %zmm19 vpshufd $0, (%rax), %zmm19 vpshufd $0, (%rax){1to16}, %zmm19 @@ -881,6 +889,11 @@ vpunpcklqdq %zmm16, %zmm17, %zmm19 {z}{k1} vpunpcklqdq (%rax), %zmm17, %zmm19 {z}{k1} vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {z}{k1} +vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} + vshuff32x4 $0, %zmm16, %zmm17, %zmm19 vshuff32x4 $0, (%rax), %zmm17, %zmm19 vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 @@ -1334,6 +1347,8 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 3 18 2.00 vdivps %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 4 25 2.00 * vdivps (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 4 25 2.00 * vdivps (%rax){1to16}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 2 4 1.00 {evex} vextractps $1, %xmm0, %ecx +# CHECK-NEXT: 3 12 1.00 * {evex} vextractps $1, %xmm0, (%rax) # CHECK-NEXT: 1 4 1.00 vfmadd132pd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 12 1.00 * vfmadd132pd (%rax), %zmm17, %zmm19 # CHECK-NEXT: 2 12 1.00 * vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -1787,6 +1802,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 1 3 1.00 vpermq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 11 1.00 * vpermq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 11 1.00 * vpermq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 35 19 8.00 * vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 19 12 4.00 * vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 19 12 4.00 * vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 19 12 4.00 * vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: 1 1 1.00 vpshufd $0, %zmm16, %zmm19 # CHECK-NEXT: 2 9 1.00 * vpshufd $0, (%rax), %zmm19 # CHECK-NEXT: 2 9 1.00 * vpshufd $0, (%rax){1to16}, %zmm19 @@ -1850,6 +1869,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 1 1 1.00 vpunpcklqdq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 9 1.00 * vpunpcklqdq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 9 1.00 * vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 35 19 8.00 * vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 19 12 4.00 * vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 19 12 4.00 * vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 19 12 4.00 * vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: 1 3 1.00 vshuff32x4 $0, %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 11 1.00 * vshuff32x4 $0, (%rax), %zmm17, %zmm19 # CHECK-NEXT: 2 11 1.00 * vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 @@ -2032,7 +2055,7 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] -# CHECK-NEXT: 490.00 12.00 218.33 218.33 8.00 575.00 - 8.00 8.00 8.00 - 218.33 - +# CHECK-NEXT: 508.60 13.60 218.33 218.33 48.50 578.60 1.60 48.50 48.50 48.50 1.60 218.33 - # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] Instructions: @@ -2295,6 +2318,8 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 2.50 - - - - 0.50 - - - - - - - vdivps %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2.50 - 0.33 0.33 - 0.50 - - - - - 0.33 - vdivps (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2.50 - 0.33 0.33 - 0.50 - - - - - 0.33 - vdivps (%rax){1to16}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 1.00 - - - - 1.00 - - - - - - - {evex} vextractps $1, %xmm0, %ecx +# CHECK-NEXT: - - - - 0.50 1.00 - 0.50 0.50 0.50 - - - {evex} vextractps $1, %xmm0, (%rax) # CHECK-NEXT: 1.00 - - - - - - - - - - - - vfmadd132pd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 1.00 - 0.33 0.33 - - - - - - - 0.33 - vfmadd132pd (%rax), %zmm17, %zmm19 # CHECK-NEXT: 1.00 - 0.33 0.33 - - - - - - - 0.33 - vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -2748,6 +2773,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - - - - - 1.00 - - - - - - - vpermq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - 0.33 0.33 - 1.00 - - - - - 0.33 - vpermq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - 0.33 0.33 - 1.00 - - - - - 0.33 - vpermq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 2.20 0.20 - - 8.00 0.20 0.20 8.00 8.00 8.00 0.20 - - vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 2.20 0.20 - - 4.00 0.20 0.20 4.00 4.00 4.00 0.20 - - vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 2.20 0.20 - - 4.00 0.20 0.20 4.00 4.00 4.00 0.20 - - vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 2.20 0.20 - - 4.00 0.20 0.20 4.00 4.00 4.00 0.20 - - vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: - - - - - 1.00 - - - - - - - vpshufd $0, %zmm16, %zmm19 # CHECK-NEXT: - - 0.33 0.33 - 1.00 - - - - - 0.33 - vpshufd $0, (%rax), %zmm19 # CHECK-NEXT: - - 0.33 0.33 - 1.00 - - - - - 0.33 - vpshufd $0, (%rax){1to16}, %zmm19 @@ -2811,6 +2840,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - - - - - 1.00 - - - - - - - vpunpcklqdq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - 0.33 0.33 - 1.00 - - - - - 0.33 - vpunpcklqdq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - 0.33 0.33 - 1.00 - - - - - 0.33 - vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 2.20 0.20 - - 8.00 0.20 0.20 8.00 8.00 8.00 0.20 - - vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 2.20 0.20 - - 4.00 0.20 0.20 4.00 4.00 4.00 0.20 - - vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 2.20 0.20 - - 4.00 0.20 0.20 4.00 4.00 4.00 0.20 - - vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 2.20 0.20 - - 4.00 0.20 0.20 4.00 4.00 4.00 0.20 - - vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: - - - - - 1.00 - - - - - - - vshuff32x4 $0, %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - 0.33 0.33 - 1.00 - - - - - 0.33 - vshuff32x4 $0, (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - 0.33 0.33 - 1.00 - - - - - 0.33 - vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 diff --git a/llvm/test/tools/llvm-mca/X86/SapphireRapids/resources-avx512vl.s b/llvm/test/tools/llvm-mca/X86/SapphireRapids/resources-avx512vl.s index 3ad66f1c3d712..d8c76832d38d3 100644 --- a/llvm/test/tools/llvm-mca/X86/SapphireRapids/resources-avx512vl.s +++ b/llvm/test/tools/llvm-mca/X86/SapphireRapids/resources-avx512vl.s @@ -1344,6 +1344,16 @@ vpmulld %ymm16, %ymm17, %ymm19 {z}{k1} vpmulld (%rax), %ymm17, %ymm19 {z}{k1} vpmulld (%rax){1to8}, %ymm17, %ymm19 {z}{k1} +vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} + +vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} + vpshufd $0, %xmm16, %xmm19 vpshufd $0, (%rax), %xmm19 vpshufd $0, (%rax){1to4}, %xmm19 @@ -1500,6 +1510,16 @@ vpunpckldq %ymm16, %ymm17, %ymm19 {z}{k1} vpunpckldq (%rax), %ymm17, %ymm19 {z}{k1} vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {z}{k1} +vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} + +vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} + vshuff32x4 $0, %ymm16, %ymm17, %ymm19 vshuff32x4 $0, (%rax), %ymm17, %ymm19 vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 @@ -2897,6 +2917,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: 2 10 1.00 vpmulld %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 3 18 1.00 * vpmulld (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 3 18 1.00 * vpmulld (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 11 12 2.00 * vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 12 1.00 * vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 12 1.00 * vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 12 1.00 * vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 19 12 4.00 * vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 11 12 2.00 * vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 11 12 2.00 * vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 11 12 2.00 * vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: 1 1 0.50 vpshufd $0, %xmm16, %xmm19 # CHECK-NEXT: 2 8 0.50 * vpshufd $0, (%rax), %xmm19 # CHECK-NEXT: 2 8 0.50 * vpshufd $0, (%rax){1to4}, %xmm19 @@ -3035,6 +3063,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: 1 1 0.50 vpunpckldq %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 2 9 0.50 * vpunpckldq (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 2 9 0.50 * vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 11 12 2.00 * vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 12 1.00 * vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 12 1.00 * vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 12 1.00 * vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 19 12 4.00 * vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 11 12 2.00 * vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 11 12 2.00 * vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 11 12 2.00 * vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: 1 3 1.00 vshuff32x4 $0, %ymm16, %ymm17, %ymm19 # CHECK-NEXT: 2 11 1.00 * vshuff32x4 $0, (%rax), %ymm17, %ymm19 # CHECK-NEXT: 2 11 1.00 * vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 @@ -3233,7 +3269,7 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] -# CHECK-NEXT: 377.33 401.33 328.33 328.33 16.00 794.33 - 16.00 16.00 16.00 - 328.33 - +# CHECK-NEXT: 404.53 412.53 328.33 328.33 46.00 797.53 3.20 46.00 46.00 46.00 3.20 328.33 - # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] Instructions: @@ -4425,6 +4461,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: 1.00 1.00 - - - - - - - - - - - vpmulld %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 1.00 1.00 0.33 0.33 - - - - - - - 0.33 - vpmulld (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 1.00 1.00 0.33 0.33 - - - - - - - 0.33 - vpmulld (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 1.70 0.70 - - 2.00 0.20 0.20 2.00 2.00 2.00 0.20 - - vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 1.00 0.20 0.20 1.00 1.00 1.00 0.20 - - vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 1.00 0.20 0.20 1.00 1.00 1.00 0.20 - - vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 1.00 0.20 0.20 1.00 1.00 1.00 0.20 - - vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 4.00 0.20 0.20 4.00 4.00 4.00 0.20 - - vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 2.00 0.20 0.20 2.00 2.00 2.00 0.20 - - vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 2.00 0.20 0.20 2.00 2.00 2.00 0.20 - - vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 2.00 0.20 0.20 2.00 2.00 2.00 0.20 - - vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: - 0.50 - - - 0.50 - - - - - - - vpshufd $0, %xmm16, %xmm19 # CHECK-NEXT: - 0.50 0.33 0.33 - 0.50 - - - - - 0.33 - vpshufd $0, (%rax), %xmm19 # CHECK-NEXT: - 0.50 0.33 0.33 - 0.50 - - - - - 0.33 - vpshufd $0, (%rax){1to4}, %xmm19 @@ -4563,6 +4607,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: - 0.50 - - - 0.50 - - - - - - - vpunpckldq %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - 0.50 0.33 0.33 - 0.50 - - - - - 0.33 - vpunpckldq (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - 0.50 0.33 0.33 - 0.50 - - - - - 0.33 - vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 1.70 0.70 - - 2.00 0.20 0.20 2.00 2.00 2.00 0.20 - - vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 1.00 0.20 0.20 1.00 1.00 1.00 0.20 - - vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 1.00 0.20 0.20 1.00 1.00 1.00 0.20 - - vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 1.00 0.20 0.20 1.00 1.00 1.00 0.20 - - vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 4.00 0.20 0.20 4.00 4.00 4.00 0.20 - - vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 2.00 0.20 0.20 2.00 2.00 2.00 0.20 - - vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 2.00 0.20 0.20 2.00 2.00 2.00 0.20 - - vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1.70 0.70 - - 2.00 0.20 0.20 2.00 2.00 2.00 0.20 - - vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: - - - - - 1.00 - - - - - - - vshuff32x4 $0, %ymm16, %ymm17, %ymm19 # CHECK-NEXT: - - 0.33 0.33 - 1.00 - - - - - 0.33 - vshuff32x4 $0, (%rax), %ymm17, %ymm19 # CHECK-NEXT: - - 0.33 0.33 - 1.00 - - - - - 0.33 - vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 diff --git a/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-avx512.s b/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-avx512.s index b1bfd7a9ec448..9c006d4ebb077 100644 --- a/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-avx512.s +++ b/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-avx512.s @@ -298,6 +298,9 @@ vdivps %zmm16, %zmm17, %zmm19 {z}{k1} vdivps (%rax), %zmm17, %zmm19 {z}{k1} vdivps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} +{evex} vextractps $1, %xmm0, %rcx +{evex} vextractps $1, %xmm0, (%rax) + vfmadd132pd %zmm16, %zmm17, %zmm19 vfmadd132pd (%rax), %zmm17, %zmm19 vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -811,6 +814,11 @@ vpermq %zmm16, %zmm17, %zmm19 {z}{k1} vpermq (%rax), %zmm17, %zmm19 {z}{k1} vpermq (%rax){1to8}, %zmm17, %zmm19 {z}{k1} +vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} + vpshufd $0, %zmm16, %zmm19 vpshufd $0, (%rax), %zmm19 vpshufd $0, (%rax){1to16}, %zmm19 @@ -881,6 +889,11 @@ vpunpcklqdq %zmm16, %zmm17, %zmm19 {z}{k1} vpunpcklqdq (%rax), %zmm17, %zmm19 {z}{k1} vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {z}{k1} +vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} + vshuff32x4 $0, %zmm16, %zmm17, %zmm19 vshuff32x4 $0, (%rax), %zmm17, %zmm19 vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 @@ -1334,6 +1347,8 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 3 18 10.00 vdivps %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 4 25 10.00 * vdivps (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 4 25 10.00 * vdivps (%rax){1to16}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 2 3 1.00 {evex} vextractps $1, %xmm0, %ecx +# CHECK-NEXT: 3 2 1.00 * {evex} vextractps $1, %xmm0, (%rax) # CHECK-NEXT: 1 4 0.50 vfmadd132pd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 11 0.50 * vfmadd132pd (%rax), %zmm17, %zmm19 # CHECK-NEXT: 2 11 0.50 * vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -1787,6 +1802,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 1 3 1.00 vpermq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 10 1.00 * vpermq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 10 1.00 * vpermq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 36 8 16.00 * vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 19 7 8.00 * vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 19 7 8.00 * vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 19 7 8.00 * vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: 1 1 1.00 vpshufd $0, %zmm16, %zmm19 # CHECK-NEXT: 2 8 1.00 * vpshufd $0, (%rax), %zmm19 # CHECK-NEXT: 2 8 1.00 * vpshufd $0, (%rax){1to16}, %zmm19 @@ -1850,6 +1869,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 1 1 1.00 vpunpcklqdq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpcklqdq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 36 7 16.00 * vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 19 7 8.00 * vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 19 7 8.00 * vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 19 7 8.00 * vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: 1 3 1.00 vshuff32x4 $0, %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 10 1.00 * vshuff32x4 $0, (%rax), %zmm17, %zmm19 # CHECK-NEXT: 2 10 1.00 * vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 @@ -2029,7 +2052,7 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] -# CHECK-NEXT: - 612.00 339.67 99.67 332.83 332.83 16.00 643.67 2.00 5.33 +# CHECK-NEXT: - 612.00 352.67 103.67 359.83 359.83 97.00 651.67 6.00 32.33 # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] Instructions: @@ -2292,6 +2315,8 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - 10.00 2.00 - - - - 1.00 - - vdivps %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - 10.00 2.00 - 0.50 0.50 - 1.00 - - vdivps (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - 10.00 2.00 - 0.50 0.50 - 1.00 - - vdivps (%rax){1to16}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: - - 1.00 - - - - 1.00 - - {evex} vextractps $1, %xmm0, %ecx +# CHECK-NEXT: - - - - 0.33 0.33 1.00 1.00 - 0.33 {evex} vextractps $1, %xmm0, (%rax) # CHECK-NEXT: - - 0.50 - - - - 0.50 - - vfmadd132pd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - 0.50 - 0.50 0.50 - 0.50 - - vfmadd132pd (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - 0.50 - 0.50 0.50 - 0.50 - - vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -2745,6 +2770,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - - - - - - - 1.00 - - vpermq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vpermq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vpermq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: - - 1.50 0.50 5.33 5.33 16.00 1.50 0.50 5.33 vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 2.67 2.67 8.00 0.50 0.50 2.67 vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 2.67 2.67 8.00 0.50 0.50 2.67 vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 2.67 2.67 8.00 0.50 0.50 2.67 vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: - - - - - - - 1.00 - - vpshufd $0, %zmm16, %zmm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vpshufd $0, (%rax), %zmm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vpshufd $0, (%rax){1to16}, %zmm19 @@ -2808,6 +2837,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - - - - - - - 1.00 - - vpunpcklqdq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vpunpcklqdq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: - - 1.50 0.50 5.33 5.33 16.00 1.50 0.50 5.33 vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 2.67 2.67 8.00 0.50 0.50 2.67 vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 2.67 2.67 8.00 0.50 0.50 2.67 vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 2.67 2.67 8.00 0.50 0.50 2.67 vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: - - - - - - - 1.00 - - vshuff32x4 $0, %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vshuff32x4 $0, (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 diff --git a/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-avx512vl.s b/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-avx512vl.s index 2ad91ea514aa2..b4b18101a67b8 100644 --- a/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-avx512vl.s +++ b/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-avx512vl.s @@ -1344,6 +1344,16 @@ vpmulld %ymm16, %ymm17, %ymm19 {z}{k1} vpmulld (%rax), %ymm17, %ymm19 {z}{k1} vpmulld (%rax){1to8}, %ymm17, %ymm19 {z}{k1} +vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} + +vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} + vpshufd $0, %xmm16, %xmm19 vpshufd $0, (%rax), %xmm19 vpshufd $0, (%rax){1to4}, %xmm19 @@ -1500,6 +1510,16 @@ vpunpckldq %ymm16, %ymm17, %ymm19 {z}{k1} vpunpckldq (%rax), %ymm17, %ymm19 {z}{k1} vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {z}{k1} +vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} + +vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} + vshuff32x4 $0, %ymm16, %ymm17, %ymm19 vshuff32x4 $0, (%rax), %ymm17, %ymm19 vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 @@ -2897,6 +2917,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: 2 10 1.00 vpmulld %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 3 17 1.00 * vpmulld (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 3 17 1.00 * vpmulld (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 12 8 4.00 * vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 7 2.00 * vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 8 8 2.00 * vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 7 2.00 * vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 20 8 8.00 * vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 11 7 4.00 * vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 8 8 2.00 * vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 11 7 4.00 * vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: 1 1 1.00 vpshufd $0, %xmm16, %xmm19 # CHECK-NEXT: 2 7 1.00 * vpshufd $0, (%rax), %xmm19 # CHECK-NEXT: 2 7 1.00 * vpshufd $0, (%rax){1to4}, %xmm19 @@ -3035,6 +3063,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: 1 1 1.00 vpunpckldq %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpckldq (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 12 8 4.00 * vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 7 2.00 * vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 8 8 2.00 * vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 7 7 2.00 * vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 20 8 8.00 * vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 11 7 4.00 * vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 8 8 2.00 * vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 11 7 4.00 * vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: 1 3 1.00 vshuff32x4 $0, %ymm16, %ymm17, %ymm19 # CHECK-NEXT: 2 10 1.00 * vshuff32x4 $0, (%rax), %ymm17, %ymm19 # CHECK-NEXT: 2 10 1.00 * vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 @@ -3230,7 +3266,7 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] -# CHECK-NEXT: - 423.00 438.33 350.33 503.17 503.17 32.00 785.33 4.00 10.67 +# CHECK-NEXT: - 423.00 462.33 358.33 521.83 521.83 88.00 801.33 12.00 29.33 # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] Instructions: @@ -4422,6 +4458,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: - - 1.00 1.00 - - - - - - vpmulld %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - vpmulld (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - 1.00 1.00 0.50 0.50 - - - - vpmulld (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: - - 1.50 0.50 1.33 1.33 4.00 1.50 0.50 1.33 vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 0.67 0.67 2.00 0.50 0.50 0.67 vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 0.67 0.67 2.00 1.50 0.50 0.67 vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 0.67 0.67 2.00 0.50 0.50 0.67 vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 2.67 2.67 8.00 1.50 0.50 2.67 vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 1.33 1.33 4.00 0.50 0.50 1.33 vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 0.67 0.67 2.00 1.50 0.50 0.67 vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 1.33 1.33 4.00 0.50 0.50 1.33 vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: - - - - - - - 1.00 - - vpshufd $0, %xmm16, %xmm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vpshufd $0, (%rax), %xmm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vpshufd $0, (%rax){1to4}, %xmm19 @@ -4560,6 +4604,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: - - - - - - - 1.00 - - vpunpckldq %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vpunpckldq (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: - - 1.50 0.50 1.33 1.33 4.00 1.50 0.50 1.33 vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 0.67 0.67 2.00 0.50 0.50 0.67 vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 0.67 0.67 2.00 1.50 0.50 0.67 vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 0.67 0.67 2.00 0.50 0.50 0.67 vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 2.67 2.67 8.00 1.50 0.50 2.67 vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 1.33 1.33 4.00 0.50 0.50 1.33 vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 0.67 0.67 2.00 1.50 0.50 0.67 vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: - - 1.50 0.50 1.33 1.33 4.00 0.50 0.50 1.33 vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: - - - - - - - 1.00 - - vshuff32x4 $0, %ymm16, %ymm17, %ymm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vshuff32x4 $0, (%rax), %ymm17, %ymm19 # CHECK-NEXT: - - - - 0.50 0.50 - 1.00 - - vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 diff --git a/llvm/test/tools/llvm-mca/X86/Znver4/resources-avx512.s b/llvm/test/tools/llvm-mca/X86/Znver4/resources-avx512.s index 6742cfccb2d00..6e52eddd9a8f5 100644 --- a/llvm/test/tools/llvm-mca/X86/Znver4/resources-avx512.s +++ b/llvm/test/tools/llvm-mca/X86/Znver4/resources-avx512.s @@ -298,6 +298,9 @@ vdivps %zmm16, %zmm17, %zmm19 {z}{k1} vdivps (%rax), %zmm17, %zmm19 {z}{k1} vdivps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} +{evex} vextractps $1, %xmm0, %rcx +{evex} vextractps $1, %xmm0, (%rax) + vfmadd132pd %zmm16, %zmm17, %zmm19 vfmadd132pd (%rax), %zmm17, %zmm19 vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -811,6 +814,11 @@ vpermq %zmm16, %zmm17, %zmm19 {z}{k1} vpermq (%rax), %zmm17, %zmm19 {z}{k1} vpermq (%rax){1to8}, %zmm17, %zmm19 {z}{k1} +vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} + vpshufd $0, %zmm16, %zmm19 vpshufd $0, (%rax), %zmm19 vpshufd $0, (%rax){1to16}, %zmm19 @@ -881,6 +889,11 @@ vpunpcklqdq %zmm16, %zmm17, %zmm19 {z}{k1} vpunpcklqdq (%rax), %zmm17, %zmm19 {z}{k1} vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {z}{k1} +vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} + vshuff32x4 $0, %zmm16, %zmm17, %zmm19 vshuff32x4 $0, (%rax), %zmm17, %zmm19 vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 @@ -1334,6 +1347,8 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 1 11 6.00 vdivps %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 1 18 6.00 * vdivps (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 1 18 6.00 * vdivps (%rax){1to16}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 2 1 1.00 {evex} vextractps $1, %xmm0, %ecx +# CHECK-NEXT: 2 2 1.00 * {evex} vextractps $1, %xmm0, (%rax) # CHECK-NEXT: 1 4 1.00 vfmadd132pd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 1 11 1.00 * vfmadd132pd (%rax), %zmm17, %zmm19 # CHECK-NEXT: 1 11 1.00 * vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -1787,6 +1802,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 2 1 0.50 vpermq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 0.50 * vpermq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 0.50 * vpermq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 1 1 1.00 * vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: 1 1 1.00 vpshufd $0, %zmm16, %zmm19 # CHECK-NEXT: 1 8 1.00 * vpshufd $0, (%rax), %zmm19 # CHECK-NEXT: 1 8 1.00 * vpshufd $0, (%rax){1to16}, %zmm19 @@ -1850,6 +1869,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: 1 1 1.00 vpunpcklqdq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 1 8 1.00 * vpunpcklqdq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 1 8 1.00 * vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 1 1 1.00 * vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: 1 2 1.00 vshuff32x4 $0, %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 3 9 1.00 * vshuff32x4 $0, (%rax), %zmm17, %zmm19 # CHECK-NEXT: 3 9 1.00 * vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 @@ -2042,7 +2065,7 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12.0] [12.1] [13] [14.0] [14.1] [14.2] [15.0] [15.1] [15.2] [16.0] [16.1] -# CHECK-NEXT: 2.67 2.67 2.67 - - - - - 221.00 1060.50 618.00 352.50 295.50 295.50 16.00 199.67 199.67 199.67 194.33 194.33 194.33 8.00 8.00 +# CHECK-NEXT: 5.33 5.33 5.33 - - - - - 221.00 1060.50 618.00 352.50 297.00 297.00 17.00 205.33 205.33 205.33 194.33 194.33 194.33 16.50 16.50 # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12.0] [12.1] [13] [14.0] [14.1] [14.2] [15.0] [15.1] [15.2] [16.0] [16.1] Instructions: @@ -2305,6 +2328,8 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - - - - - - - - - 6.00 - - - - - - - - - - - - - vdivps %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - - - - - 6.00 - - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vdivps (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - - - - - 6.00 - - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vdivps (%rax){1to16}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: - - - - - - - - - - - - 1.00 1.00 - - - - - - - - - {evex} vextractps $1, %xmm0, %ecx +# CHECK-NEXT: - - - - - - - - - - - - 0.50 0.50 1.00 0.33 0.33 0.33 - - - 0.50 0.50 {evex} vextractps $1, %xmm0, (%rax) # CHECK-NEXT: - - - - - - - - 1.00 1.00 - - - - - - - - - - - - - vfmadd132pd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - - - - - - 1.00 1.00 - - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vfmadd132pd (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - - - - - - 1.00 1.00 - - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vfmadd132pd (%rax){1to8}, %zmm17, %zmm19 @@ -2758,6 +2783,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - - - - - - - - - 0.50 0.50 - - - - - - - - - - - - vpermq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - - - - - 0.50 0.50 - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vpermq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - - - - - 0.50 0.50 - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vpermq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vpscatterdd %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vpscatterdq %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vpscatterqd %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vpscatterqq %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: - - - - - - - - - 1.00 1.00 - - - - - - - - - - - - vpshufd $0, %zmm16, %zmm19 # CHECK-NEXT: - - - - - - - - - 1.00 1.00 - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vpshufd $0, (%rax), %zmm19 # CHECK-NEXT: - - - - - - - - - 1.00 1.00 - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vpshufd $0, (%rax){1to16}, %zmm19 @@ -2821,6 +2850,10 @@ vunpcklps (%rax){1to16}, %zmm17, %zmm19 {z}{k1} # CHECK-NEXT: - - - - - - - - - 1.00 1.00 - - - - - - - - - - - - vpunpcklqdq %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - - - - - 1.00 1.00 - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vpunpcklqdq (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - - - - - 1.00 1.00 - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vpunpcklqdq (%rax){1to8}, %zmm17, %zmm19 {%k1} {z} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vscatterdps %zmm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vscatterdpd %zmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vscatterqps %ymm1, (%rdx,%zmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vscatterqpd %zmm1, (%rdx,%zmm0,4) {%k1} # CHECK-NEXT: - - - - - - - - - 1.00 - - - - - - - - - - - - - vshuff32x4 $0, %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - - - - - - - 1.00 - - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vshuff32x4 $0, (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - - - - - - - 1.00 - - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vshuff32x4 $0, (%rax){1to16}, %zmm17, %zmm19 diff --git a/llvm/test/tools/llvm-mca/X86/Znver4/resources-avx512vl.s b/llvm/test/tools/llvm-mca/X86/Znver4/resources-avx512vl.s index 2d26eb50351a0..4636e23d9df3e 100644 --- a/llvm/test/tools/llvm-mca/X86/Znver4/resources-avx512vl.s +++ b/llvm/test/tools/llvm-mca/X86/Znver4/resources-avx512vl.s @@ -1344,6 +1344,16 @@ vpmulld %ymm16, %ymm17, %ymm19 {z}{k1} vpmulld (%rax), %ymm17, %ymm19 {z}{k1} vpmulld (%rax){1to8}, %ymm17, %ymm19 {z}{k1} +vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} + +vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} + vpshufd $0, %xmm16, %xmm19 vpshufd $0, (%rax), %xmm19 vpshufd $0, (%rax){1to4}, %xmm19 @@ -1500,6 +1510,16 @@ vpunpckldq %ymm16, %ymm17, %ymm19 {z}{k1} vpunpckldq (%rax), %ymm17, %ymm19 {z}{k1} vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {z}{k1} +vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} + +vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} + vshuff32x4 $0, %ymm16, %ymm17, %ymm19 vshuff32x4 $0, (%rax), %ymm17, %ymm19 vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 @@ -2897,6 +2917,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: 1 3 0.50 vpmulld %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 1 10 0.50 * vpmulld (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 1 10 0.50 * vpmulld (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 1 1 1.00 * vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: 1 1 0.50 vpshufd $0, %xmm16, %xmm19 # CHECK-NEXT: 1 8 0.50 * vpshufd $0, (%rax), %xmm19 # CHECK-NEXT: 1 8 0.50 * vpshufd $0, (%rax){1to4}, %xmm19 @@ -3035,6 +3063,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: 1 1 0.50 vpunpckldq %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 1 8 0.50 * vpunpckldq (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: 1 8 0.50 * vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 1 1 1.00 * vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 1 1 1.00 * vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: 1 2 1.00 vshuff32x4 $0, %ymm16, %ymm17, %ymm19 # CHECK-NEXT: 3 9 1.00 * vshuff32x4 $0, (%rax), %ymm17, %ymm19 # CHECK-NEXT: 3 9 1.00 * vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 @@ -3243,7 +3279,7 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12.0] [12.1] [13] [14.0] [14.1] [14.2] [15.0] [15.1] [15.2] [16.0] [16.1] -# CHECK-NEXT: 5.33 5.33 5.33 - - - - - 208.00 948.00 501.50 261.50 478.50 478.50 32.00 324.33 324.33 324.33 313.67 313.67 313.67 16.00 16.00 +# CHECK-NEXT: 10.67 10.67 10.67 - - - - - 208.00 948.00 501.50 261.50 478.50 478.50 32.00 335.00 335.00 335.00 313.67 313.67 313.67 32.00 32.00 # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12.0] [12.1] [13] [14.0] [14.1] [14.2] [15.0] [15.1] [15.2] [16.0] [16.1] Instructions: @@ -4435,6 +4471,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: - - - - - - - - 0.50 - - 0.50 - - - - - - - - - - - vpmulld %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - - - - - - - 0.50 - - 0.50 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vpmulld (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - - - - - - - 0.50 - - 0.50 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vpmulld (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vpscatterdd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vpscatterdq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vpscatterqd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vpscatterqq %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vpscatterdd %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vpscatterdq %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vpscatterqd %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vpscatterqq %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: - - - - - - - - - 0.50 0.50 - - - - - - - - - - - - vpshufd $0, %xmm16, %xmm19 # CHECK-NEXT: - - - - - - - - - 0.50 0.50 - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vpshufd $0, (%rax), %xmm19 # CHECK-NEXT: - - - - - - - - - 0.50 0.50 - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vpshufd $0, (%rax){1to4}, %xmm19 @@ -4573,6 +4617,14 @@ vunpcklps (%rax){1to8}, %ymm17, %ymm19 {z}{k1} # CHECK-NEXT: - - - - - - - - - 0.50 0.50 - - - - - - - - - - - - vpunpckldq %ymm16, %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - - - - - - - - 0.50 0.50 - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vpunpckldq (%rax), %ymm17, %ymm19 {%k1} {z} # CHECK-NEXT: - - - - - - - - - 0.50 0.50 - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vpunpckldq (%rax){1to8}, %ymm17, %ymm19 {%k1} {z} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vscatterdps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vscatterdpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vscatterqps %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vscatterqpd %xmm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vscatterdps %ymm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vscatterdpd %ymm1, (%rdx,%xmm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vscatterqps %xmm1, (%rdx,%ymm0,4) {%k1} +# CHECK-NEXT: 0.33 0.33 0.33 - - - - - - - - - - - - 0.67 0.67 0.67 - - - 1.00 1.00 vscatterqpd %ymm1, (%rdx,%ymm0,4) {%k1} # CHECK-NEXT: - - - - - - - - - 1.00 - - - - - - - - - - - - - vshuff32x4 $0, %ymm16, %ymm17, %ymm19 # CHECK-NEXT: - - - - - - - - - 1.00 - - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vshuff32x4 $0, (%rax), %ymm17, %ymm19 # CHECK-NEXT: - - - - - - - - - 1.00 - - 0.50 0.50 - 0.33 0.33 0.33 0.33 0.33 0.33 - - vshuff32x4 $0, (%rax){1to8}, %ymm17, %ymm19 diff --git a/llvm/test/tools/llvm-objdump/multiple-symbols.s b/llvm/test/tools/llvm-objdump/multiple-symbols.s index 24c169e32147b..1b13f099ae98c 100644 --- a/llvm/test/tools/llvm-objdump/multiple-symbols.s +++ b/llvm/test/tools/llvm-objdump/multiple-symbols.s @@ -26,13 +26,13 @@ @ HEAD: Disassembly of section .text: @ HEAD-EMPTY: -@ AMAP-NEXT: 00000000 <$a.0>: +@ AMAP-NEXT: 00000000 <$a>: @ AAAA-NEXT: 00000000 : @ BBBB-NEXT: 00000000 : @ AABB-NEXT: 0: e0800080 add r0, r0, r0, lsl #1 @ AABB-NEXT: 4: e12fff1e bx lr @ BOTH-EMPTY: -@ TMAP-NEXT: 00000008 <$t.1>: +@ TMAP-NEXT: 00000008 <$t>: @ CCCC-NEXT: 00000008 : @ DDDD-NEXT: 00000008 : @ CCDD-NEXT: 8: eb00 0080 add.w r0, r0, r0, lsl #2 diff --git a/llvm/tools/llvm-cgdata/CMakeLists.txt b/llvm/tools/llvm-cgdata/CMakeLists.txt deleted file mode 100644 index 4f1f7ff635bc3..0000000000000 --- a/llvm/tools/llvm-cgdata/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -set(LLVM_LINK_COMPONENTS - CodeGen - CodeGenData - Core - Object - Support - ) - -add_llvm_tool(llvm-cgdata - llvm-cgdata.cpp - - DEPENDS - intrinsics_gen - GENERATE_DRIVER - ) diff --git a/llvm/tools/llvm-cgdata/llvm-cgdata.cpp b/llvm/tools/llvm-cgdata/llvm-cgdata.cpp deleted file mode 100644 index 3303ffd9d863b..0000000000000 --- a/llvm/tools/llvm-cgdata/llvm-cgdata.cpp +++ /dev/null @@ -1,268 +0,0 @@ -//===-- llvm-cgdata.cpp - LLVM CodeGen Data Tool --------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// llvm-cgdata parses raw codegen data embedded in compiled binary files, and -// merges them into a single .cgdata file. It can also inspect and maninuplate -// a .cgdata file. This .cgdata can contain various codegen data like outlining -// information, and it can be used to optimize the code in the subsequent build. -// -//===----------------------------------------------------------------------===// -#include "llvm/ADT/StringRef.h" -#include "llvm/CodeGenData/CodeGenDataReader.h" -#include "llvm/CodeGenData/CodeGenDataWriter.h" -#include "llvm/IR/LLVMContext.h" -#include "llvm/Object/Archive.h" -#include "llvm/Support/CommandLine.h" -#include "llvm/Support/LLVMDriver.h" -#include "llvm/Support/Path.h" -#include "llvm/Support/VirtualFileSystem.h" -#include "llvm/Support/WithColor.h" -#include "llvm/Support/raw_ostream.h" - -using namespace llvm; -using namespace llvm::object; - -// TODO: https://llvm.org/docs/CommandGuide/llvm-cgdata.html has documentations -// on each subcommand. -cl::SubCommand DumpSubcommand( - "dump", - "Dump the (indexed) codegen data file in either text or binary format."); -cl::SubCommand MergeSubcommand( - "merge", "Takes binary files having raw codegen data in custom sections, " - "and merge them into an index codegen data file."); -cl::SubCommand - ShowSubcommand("show", "Show summary of the (indexed) codegen data file."); - -enum CGDataFormat { - CD_None = 0, - CD_Text, - CD_Binary, -}; - -cl::opt OutputFilename("output", cl::value_desc("output"), - cl::init("-"), cl::desc("Output file"), - cl::sub(DumpSubcommand), - cl::sub(MergeSubcommand)); -cl::alias OutputFilenameA("o", cl::desc("Alias for --output"), - cl::aliasopt(OutputFilename)); - -cl::opt Filename(cl::Positional, cl::desc(""), - cl::sub(DumpSubcommand), cl::sub(ShowSubcommand)); -cl::list InputFilenames(cl::Positional, cl::sub(MergeSubcommand), - cl::desc("")); -cl::opt OutputFormat( - cl::desc("Format of output data"), cl::sub(DumpSubcommand), - cl::init(CD_Text), - cl::values(clEnumValN(CD_Text, "text", "Text encoding"), - clEnumValN(CD_Binary, "binary", "Binary encoding"))); - -cl::opt ShowCGDataVersion("cgdata-version", - cl::desc("Show cgdata version."), - cl::sub(ShowSubcommand)); - -static void exitWithError(Twine Message, std::string Whence = "", - std::string Hint = "") { - WithColor::error(); - if (!Whence.empty()) - errs() << Whence << ": "; - errs() << Message << "\n"; - if (!Hint.empty()) - WithColor::note() << Hint << "\n"; - ::exit(1); -} - -static void exitWithError(Error E, StringRef Whence = "") { - if (E.isA()) { - handleAllErrors(std::move(E), [&](const CGDataError &IPE) { - exitWithError(IPE.message(), std::string(Whence)); - }); - return; - } - - exitWithError(toString(std::move(E)), std::string(Whence)); -} - -static void exitWithErrorCode(std::error_code EC, StringRef Whence = "") { - exitWithError(EC.message(), std::string(Whence)); -} - -static int dump_main(int argc, const char *argv[]) { - if (Filename == OutputFilename) { - errs() << sys::path::filename(argv[0]) << " " << argv[1] - << ": Input file name cannot be the same as the output file name!\n"; - return 1; - } - - std::error_code EC; - raw_fd_ostream OS(OutputFilename.data(), EC, - OutputFormat == CD_Text ? sys::fs::OF_TextWithCRLF - : sys::fs::OF_None); - if (EC) - exitWithErrorCode(EC, OutputFilename); - - auto FS = vfs::getRealFileSystem(); - auto ReaderOrErr = CodeGenDataReader::create(Filename, *FS); - if (Error E = ReaderOrErr.takeError()) - exitWithError(std::move(E), Filename); - - CodeGenDataWriter Writer; - auto Reader = ReaderOrErr->get(); - if (Reader->hasOutlinedHashTree()) { - OutlinedHashTreeRecord Record(Reader->releaseOutlinedHashTree()); - Writer.addRecord(Record); - } - - if (OutputFormat == CD_Text) { - if (Error E = Writer.writeText(OS)) - exitWithError(std::move(E)); - } else { - if (Error E = Writer.write(OS)) - exitWithError(std::move(E)); - } - - return 0; -} - -static bool handleBuffer(StringRef Filename, MemoryBufferRef Buffer, - OutlinedHashTreeRecord &GlobalOutlineRecord); - -static bool handleArchive(StringRef Filename, Archive &Arch, - OutlinedHashTreeRecord &GlobalOutlineRecord) { - bool Result = true; - Error Err = Error::success(); - for (const auto &Child : Arch.children(Err)) { - auto BuffOrErr = Child.getMemoryBufferRef(); - if (Error E = BuffOrErr.takeError()) - exitWithError(std::move(E), Filename); - auto NameOrErr = Child.getName(); - if (Error E = NameOrErr.takeError()) - exitWithError(std::move(E), Filename); - std::string Name = (Filename + "(" + NameOrErr.get() + ")").str(); - Result &= handleBuffer(Name, BuffOrErr.get(), GlobalOutlineRecord); - } - if (Err) - exitWithError(std::move(Err), Filename); - return Result; -} - -static bool handleBuffer(StringRef Filename, MemoryBufferRef Buffer, - OutlinedHashTreeRecord &GlobalOutlineRecord) { - Expected> BinOrErr = object::createBinary(Buffer); - if (Error E = BinOrErr.takeError()) - exitWithError(std::move(E), Filename); - - bool Result = true; - if (auto *Obj = dyn_cast(BinOrErr->get())) { - if (Error E = - CodeGenDataReader::mergeFromObjectFile(Obj, GlobalOutlineRecord)) - exitWithError(std::move(E), Filename); - } else if (auto *Arch = dyn_cast(BinOrErr->get())) { - Result &= handleArchive(Filename, *Arch, GlobalOutlineRecord); - } else { - // TODO: Support for the MachO universal binary format. - errs() << "Error: unsupported binary file: " << Filename << "\n"; - Result = false; - } - - return Result; -} - -static bool handleFile(StringRef Filename, - OutlinedHashTreeRecord &GlobalOutlineRecord) { - ErrorOr> BuffOrErr = - MemoryBuffer::getFileOrSTDIN(Filename); - if (std::error_code EC = BuffOrErr.getError()) - exitWithErrorCode(EC, Filename); - return handleBuffer(Filename, *BuffOrErr.get(), GlobalOutlineRecord); -} - -static int merge_main(int argc, const char *argv[]) { - bool Result = true; - OutlinedHashTreeRecord GlobalOutlineRecord; - for (auto &Filename : InputFilenames) - Result &= handleFile(Filename, GlobalOutlineRecord); - - if (!Result) { - errs() << "Error: failed to merge codegen data files.\n"; - return 1; - } - - CodeGenDataWriter Writer; - if (!GlobalOutlineRecord.empty()) - Writer.addRecord(GlobalOutlineRecord); - - std::error_code EC; - raw_fd_ostream Output(OutputFilename, EC, sys::fs::OF_None); - if (EC) - exitWithErrorCode(EC, OutputFilename); - - if (auto E = Writer.write(Output)) - exitWithError(std::move(E)); - - return 0; -} - -static int show_main(int argc, const char *argv[]) { - if (Filename == OutputFilename) { - errs() << sys::path::filename(argv[0]) << " " << argv[1] - << ": Input file name cannot be the same as the output file name!\n"; - return 1; - } - - std::error_code EC; - raw_fd_ostream OS(OutputFilename.data(), EC, sys::fs::OF_TextWithCRLF); - if (EC) - exitWithErrorCode(EC, OutputFilename); - - auto FS = vfs::getRealFileSystem(); - auto ReaderOrErr = CodeGenDataReader::create(Filename, *FS); - if (Error E = ReaderOrErr.takeError()) - exitWithError(std::move(E), Filename); - - auto Reader = ReaderOrErr->get(); - if (ShowCGDataVersion) - OS << "Version: " << Reader->getVersion() << "\n"; - - if (Reader->hasOutlinedHashTree()) { - auto Tree = Reader->releaseOutlinedHashTree(); - OS << "Outlined hash tree:\n"; - OS << " Total Node Count: " << Tree->size() << "\n"; - OS << " Terminal Node Count: " << Tree->size(/*GetTerminalCountOnly=*/true) - << "\n"; - OS << " Depth: " << Tree->depth() << "\n"; - } - - return 0; -} - -int llvm_cgdata_main(int argc, char **argvNonConst, const llvm::ToolContext &) { - const char **argv = const_cast(argvNonConst); - - StringRef ProgName(sys::path::filename(argv[0])); - - if (argc < 2) { - errs() << ProgName - << ": No subcommand specified! Run llvm-cgdata --help for usage.\n"; - return 1; - } - - cl::ParseCommandLineOptions(argc, argv, "LLVM codegen data\n"); - - if (DumpSubcommand) - return dump_main(argc, argv); - - if (MergeSubcommand) - return merge_main(argc, argv); - - if (ShowSubcommand) - return show_main(argc, argv); - - errs() << ProgName - << ": Unknown command. Run llvm-cgdata --help for usage.\n"; - return 1; -} diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp index d5b76b1bb6c16..f23b4a8d5c342 100644 --- a/llvm/tools/llvm-config/llvm-config.cpp +++ b/llvm/tools/llvm-config/llvm-config.cpp @@ -510,7 +510,9 @@ int main(int argc, char **argv) { if (Arg.starts_with("-")) { HasAnyOption = true; if (Arg == "--version") { - OS << PACKAGE_VERSION << '\n'; + OS << PACKAGE_VERSION << "-mono" << '\n'; + } else if (Arg == "--mono-api-version") { + OS << MONO_API_VERSION << '\n'; } else if (Arg == "--prefix") { OS << ActivePrefix << '\n'; } else if (Arg == "--bindir") { diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp index ed53f8fabb175..adee869967d98 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -466,9 +466,20 @@ class SubProcessFunctionExecutorImpl // segfaults in the program. Unregister the rseq region so that we can safely // unmap it later #ifdef GLIBC_INITS_RSEQ + unsigned int RseqStructSize = __rseq_size; + + // Glibc v2.40 (the change is also expected to be backported to v2.35) + // changes the definition of __rseq_size to be the usable area of the struct + // rather than the actual size of the struct. v2.35 uses only 20 bytes of + // the 32 byte struct. For now, it should be safe to assume that if the + // usable size is less than 32, the actual size of the struct will be 32 + // bytes given alignment requirements. + if (__rseq_size < 32) + RseqStructSize = 32; + long RseqDisableOutput = syscall(SYS_rseq, (intptr_t)__builtin_thread_pointer() + __rseq_offset, - __rseq_size, RSEQ_FLAG_UNREGISTER, RSEQ_SIG); + RseqStructSize, RSEQ_FLAG_UNREGISTER, RSEQ_SIG); if (RseqDisableOutput != 0) exit(ChildProcessExitCodeE::RSeqDisableFailed); #endif // GLIBC_INITS_RSEQ diff --git a/llvm/unittests/BinaryFormat/MachOTest.cpp b/llvm/unittests/BinaryFormat/MachOTest.cpp index 391298ff38d76..78b20c28a9549 100644 --- a/llvm/unittests/BinaryFormat/MachOTest.cpp +++ b/llvm/unittests/BinaryFormat/MachOTest.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/bit.h" #include "llvm/BinaryFormat/MachO.h" #include "llvm/TargetParser/Triple.h" #include "gtest/gtest.h" @@ -13,7 +14,15 @@ using namespace llvm; using namespace llvm::MachO; -TEST(MachOTest, UnalignedLC) { +#if BYTE_ORDER == BIG_ENDIAN +// As discussed in Issue #86793, this test cannot work on a strict-alignment +// targets like SPARC. Besides, it's undefined behaviour on big-endian hosts. +#define MAYBE_UnalignedLC DISABLED_UnalignedLC +#else +#define MAYBE_UnalignedLC UnalignedLC +#endif + +TEST(MachOTest, MAYBE_UnalignedLC) { unsigned char Valid32BitMachO[] = { 0xCE, 0xFA, 0xED, 0xFE, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, diff --git a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp index 91a0745a0cc76..5ce14d3f6b9ce 100644 --- a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp +++ b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp @@ -141,11 +141,11 @@ TEST(BasicBlockDbgInfoTest, SplitBasicBlockBefore) { Function *F = M->getFunction("func"); BasicBlock &BB = F->getEntryBlock(); - auto I = std::prev(BB.end(), 2); + auto I = std::prev(BB.end(), 2); // store i32 2, ptr %1. BB.splitBasicBlockBefore(I, "before"); BasicBlock &BBBefore = F->getEntryBlock(); - auto I2 = std::prev(BBBefore.end(), 2); + auto I2 = std::prev(BBBefore.end()); // br label %1 (new). ASSERT_TRUE(I2->hasDbgRecords()); } @@ -1525,4 +1525,56 @@ TEST(BasicBlockDbgInfoTest, DbgMoveToEnd) { EXPECT_FALSE(Ret->hasDbgRecords()); } +TEST(BasicBlockDbgInfoTest, CloneTrailingRecordsToEmptyBlock) { + LLVMContext C; + std::unique_ptr M = parseIR(C, R"( + define i16 @foo(i16 %a) !dbg !6 { + entry: + %b = add i16 %a, 0 + #dbg_value(i16 %b, !9, !DIExpression(), !11) + ret i16 0, !dbg !11 + } + + !llvm.dbg.cu = !{!0} + !llvm.module.flags = !{!5} + + !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) + !1 = !DIFile(filename: "t.ll", directory: "/") + !2 = !{} + !5 = !{i32 2, !"Debug Info Version", i32 3} + !6 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !1, line: 1, type: !7, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8) + !7 = !DISubroutineType(types: !2) + !8 = !{!9} + !9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10) + !10 = !DIBasicType(name: "ty16", size: 16, encoding: DW_ATE_unsigned) + !11 = !DILocation(line: 1, column: 1, scope: !6) +)"); + ASSERT_TRUE(M); + + Function *F = M->getFunction("foo"); + BasicBlock &BB = F->getEntryBlock(); + // Start with no trailing records. + ASSERT_FALSE(BB.getTrailingDbgRecords()); + + BasicBlock::iterator Ret = std::prev(BB.end()); + BasicBlock::iterator B = std::prev(Ret); + + // Delete terminator which has debug records: we now get trailing records. + Ret->eraseFromParent(); + EXPECT_TRUE(BB.getTrailingDbgRecords()); + + BasicBlock *NewBB = BasicBlock::Create(C, "NewBB", F); + NewBB->splice(NewBB->end(), &BB, B, BB.end()); + + // The trailing records should've been absorbed into NewBB. + EXPECT_FALSE(BB.getTrailingDbgRecords()); + EXPECT_TRUE(NewBB->getTrailingDbgRecords()); + if (DbgMarker *Trailing = NewBB->getTrailingDbgRecords()) { + EXPECT_EQ(llvm::range_size(Trailing->getDbgRecordRange()), 1u); + // Drop the trailing records now, to prevent a cleanup assertion. + Trailing->eraseFromParent(); + NewBB->deleteTrailingDbgRecords(); + } +} + } // End anonymous namespace. diff --git a/llvm/unittests/IR/VPIntrinsicTest.cpp b/llvm/unittests/IR/VPIntrinsicTest.cpp index eab2850ca4e1e..cf0a10d1f2e95 100644 --- a/llvm/unittests/IR/VPIntrinsicTest.cpp +++ b/llvm/unittests/IR/VPIntrinsicTest.cpp @@ -367,6 +367,59 @@ TEST_F(VPIntrinsicTest, IntrinsicIDRoundTrip) { ASSERT_NE(FullTripCounts, 0u); } +/// Check that going from intrinsic to VP intrinsic and back results in the same +/// intrinsic. +TEST_F(VPIntrinsicTest, IntrinsicToVPRoundTrip) { + bool IsFullTrip = false; + Intrinsic::ID IntrinsicID = Intrinsic::not_intrinsic + 1; + for (; IntrinsicID < Intrinsic::num_intrinsics; IntrinsicID++) { + Intrinsic::ID VPID = VPIntrinsic::getForIntrinsic(IntrinsicID); + // No equivalent VP intrinsic available. + if (VPID == Intrinsic::not_intrinsic) + continue; + + // Return itself if passed intrinsic ID is VP intrinsic. + if (VPIntrinsic::isVPIntrinsic(IntrinsicID)) { + ASSERT_EQ(IntrinsicID, VPID); + continue; + } + + std::optional RoundTripIntrinsicID = + VPIntrinsic::getFunctionalIntrinsicIDForVP(VPID); + // No equivalent non-predicated intrinsic available. + if (!RoundTripIntrinsicID) + continue; + + ASSERT_EQ(*RoundTripIntrinsicID, IntrinsicID); + IsFullTrip = true; + } + ASSERT_TRUE(IsFullTrip); +} + +/// Check that going from VP intrinsic to equivalent non-predicated intrinsic +/// and back results in the same intrinsic. +TEST_F(VPIntrinsicTest, VPToNonPredIntrinsicRoundTrip) { + std::unique_ptr M = createVPDeclarationModule(); + assert(M); + + bool IsFullTrip = false; + for (const auto &VPDecl : *M) { + auto VPID = VPDecl.getIntrinsicID(); + std::optional NonPredID = + VPIntrinsic::getFunctionalIntrinsicIDForVP(VPID); + + // No equivalent non-predicated intrinsic available + if (!NonPredID) + continue; + + Intrinsic::ID RoundTripVPID = VPIntrinsic::getForIntrinsic(*NonPredID); + + ASSERT_EQ(RoundTripVPID, VPID); + IsFullTrip = true; + } + ASSERT_TRUE(IsFullTrip); +} + /// Check that VPIntrinsic::getDeclarationForParams works. TEST_F(VPIntrinsicTest, VPIntrinsicDeclarationForParams) { std::unique_ptr M = createVPDeclarationModule(); diff --git a/llvm/unittests/TargetParser/Host.cpp b/llvm/unittests/TargetParser/Host.cpp index 61921a99e1711..f8dd1d3a60a00 100644 --- a/llvm/unittests/TargetParser/Host.cpp +++ b/llvm/unittests/TargetParser/Host.cpp @@ -536,6 +536,7 @@ TEST(HostTest, AIXHostCPUDetect) { .Case("POWER 8\n", "pwr8") .Case("POWER 9\n", "pwr9") .Case("POWER 10\n", "pwr10") + .Case("POWER 11\n", "pwr11") .Default("unknown"); StringRef HostCPU = sys::getHostCPUName(); diff --git a/llvm/unittests/TargetParser/TargetParserTest.cpp b/llvm/unittests/TargetParser/TargetParserTest.cpp index 3d55b0309d26f..11a2860367413 100644 --- a/llvm/unittests/TargetParser/TargetParserTest.cpp +++ b/llvm/unittests/TargetParser/TargetParserTest.cpp @@ -1141,7 +1141,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_FP16, AArch64::AEK_FP16FML, AArch64::AEK_SB, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PERFMON, - AArch64::AEK_ETE, AArch64::AEK_AM}), + AArch64::AEK_ETE, AArch64::AEK_AM, + AArch64::AEK_CCIDX}), AArch64CPUTestParams("cortex-a520", "armv9.2-a", {AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_SVE, AArch64::AEK_SVE2, @@ -1156,7 +1157,7 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_PERFMON, AArch64::AEK_PREDRES, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PERFMON, AArch64::AEK_AM, - AArch64::AEK_ETE}), + AArch64::AEK_ETE, AArch64::AEK_CCIDX}), AArch64CPUTestParams("cortex-a520ae", "armv9.2-a", {AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_SVE, AArch64::AEK_SVE2, @@ -1171,7 +1172,7 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_PERFMON, AArch64::AEK_PREDRES, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PERFMON, AArch64::AEK_AM, - AArch64::AEK_ETE}), + AArch64::AEK_ETE, AArch64::AEK_CCIDX}), AArch64CPUTestParams("cortex-a57", "armv8-a", {AArch64::AEK_CRC, AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_FP, @@ -1256,7 +1257,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_SVE2, AArch64::AEK_SVE2BITPERM, AArch64::AEK_PAUTH, AArch64::AEK_FLAGM, AArch64::AEK_SB, AArch64::AEK_I8MM, AArch64::AEK_BF16, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, - AArch64::AEK_PERFMON, AArch64::AEK_ETE}), + AArch64::AEK_PERFMON, AArch64::AEK_ETE, AArch64::AEK_CCIDX, + AArch64::AEK_SSBS}), AArch64CPUTestParams("cortex-a715", "armv9-a", {AArch64::AEK_CRC, AArch64::AEK_FP, AArch64::AEK_BF16, AArch64::AEK_SIMD, @@ -1271,7 +1273,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_FP16FML, AArch64::AEK_FP16, AArch64::AEK_FLAGM, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PERFMON, - AArch64::AEK_ETE, AArch64::AEK_TRBE}), + AArch64::AEK_ETE, AArch64::AEK_TRBE, + AArch64::AEK_CCIDX}), AArch64CPUTestParams("cortex-a720", "armv9.2-a", {AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_SVE, AArch64::AEK_SVE2, @@ -1287,7 +1290,7 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_PROFILE, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PERFMON, AArch64::AEK_ETE, AArch64::AEK_SPE_EEF, - AArch64::AEK_TRBE}), + AArch64::AEK_TRBE, AArch64::AEK_CCIDX}), AArch64CPUTestParams("cortex-a720ae", "armv9.2-a", {AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_SVE, AArch64::AEK_SVE2, @@ -1303,7 +1306,7 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_PROFILE, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PERFMON, AArch64::AEK_ETE, AArch64::AEK_SPE_EEF, - AArch64::AEK_TRBE}), + AArch64::AEK_TRBE, AArch64::AEK_CCIDX}), AArch64CPUTestParams("cortex-a725", "armv9.2-a", {AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_SVE, AArch64::AEK_SVE2, @@ -1318,7 +1321,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_PERFMON, AArch64::AEK_PREDRES, AArch64::AEK_PROFILE, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_ETE, - AArch64::AEK_SPE_EEF, AArch64::AEK_TRBE}), + AArch64::AEK_SPE_EEF, AArch64::AEK_TRBE, + AArch64::AEK_CCIDX}), AArch64CPUTestParams( "neoverse-v1", "armv8.4-a", {AArch64::AEK_RAS, AArch64::AEK_SVE, AArch64::AEK_SSBS, @@ -1329,7 +1333,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_SM4, AArch64::AEK_FP16, AArch64::AEK_BF16, AArch64::AEK_PROFILE, AArch64::AEK_RAND, AArch64::AEK_FP16FML, AArch64::AEK_I8MM, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, - AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_CCDP}), + AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_CCDP, + AArch64::AEK_CCIDX}), AArch64CPUTestParams("neoverse-v2", "armv9-a", {AArch64::AEK_RAS, AArch64::AEK_SVE, AArch64::AEK_SSBS, AArch64::AEK_RCPC, @@ -1343,7 +1348,7 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_SVE2BITPERM, AArch64::AEK_RAND, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, - AArch64::AEK_ETE}), + AArch64::AEK_ETE, AArch64::AEK_CCIDX}), AArch64CPUTestParams("neoverse-v3", "armv9.2-a", {AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_SVE, AArch64::AEK_SVE2, @@ -1361,7 +1366,7 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_PROFILE, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PERFMON, AArch64::AEK_ETE, AArch64::AEK_SPE_EEF, - AArch64::AEK_RME}), + AArch64::AEK_RME, AArch64::AEK_CCIDX}), AArch64CPUTestParams("neoverse-v3ae", "armv9.2-a", {AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_SVE, AArch64::AEK_SVE2, @@ -1379,7 +1384,7 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_PROFILE, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PERFMON, AArch64::AEK_ETE, AArch64::AEK_SPE_EEF, - AArch64::AEK_RME}), + AArch64::AEK_RME, AArch64::AEK_CCIDX}), AArch64CPUTestParams( "cortex-r82", "armv8-r", {AArch64::AEK_CRC, AArch64::AEK_RDM, AArch64::AEK_SSBS, @@ -1427,7 +1432,7 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_FP16FML, AArch64::AEK_FLAGM, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PERFMON, AArch64::AEK_AM, - AArch64::AEK_ETE}), + AArch64::AEK_ETE, AArch64::AEK_CCIDX}), AArch64CPUTestParams("cortex-x3", "armv9-a", {AArch64::AEK_CRC, AArch64::AEK_FP, AArch64::AEK_BF16, AArch64::AEK_SIMD, @@ -1442,7 +1447,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_PREDRES, AArch64::AEK_FLAGM, AArch64::AEK_SSBS, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PERFMON, - AArch64::AEK_ETE, AArch64::AEK_TRBE}), + AArch64::AEK_ETE, AArch64::AEK_TRBE, + AArch64::AEK_CCIDX}), AArch64CPUTestParams("cortex-x4", "armv9.2-a", {AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_SVE, AArch64::AEK_SVE2, @@ -1458,7 +1464,7 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_PROFILE, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PERFMON, AArch64::AEK_ETE, AArch64::AEK_SPE_EEF, - AArch64::AEK_TRBE}), + AArch64::AEK_TRBE, AArch64::AEK_CCIDX}), AArch64CPUTestParams("cortex-x925", "armv9.2-a", {AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_SVE, AArch64::AEK_SVE2, @@ -1473,7 +1479,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_PERFMON, AArch64::AEK_PREDRES, AArch64::AEK_PROFILE, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_ETE, - AArch64::AEK_SPE_EEF, AArch64::AEK_TRBE}), + AArch64::AEK_SPE_EEF, AArch64::AEK_TRBE, + AArch64::AEK_CCIDX}), AArch64CPUTestParams("cyclone", "armv8-a", {AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_FP, AArch64::AEK_SIMD, @@ -1591,7 +1598,7 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_RCPC, AArch64::AEK_DOTPROD, AArch64::AEK_FP16, AArch64::AEK_FP16FML, AArch64::AEK_SHA3, AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, - AArch64::AEK_PAUTH, AArch64::AEK_PERFMON}), + AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_SSBS}), AArch64CPUTestParams( "apple-m2", "armv8.6-a", {AArch64::AEK_CRC, AArch64::AEK_AES, AArch64::AEK_SHA2, @@ -1600,7 +1607,7 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_RCPC, AArch64::AEK_DOTPROD, AArch64::AEK_FP16, AArch64::AEK_FP16FML, AArch64::AEK_SHA3, AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, - AArch64::AEK_PAUTH, AArch64::AEK_PERFMON}), + AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_SSBS}), AArch64CPUTestParams( "apple-a16", "armv8.6-a", {AArch64::AEK_CRC, AArch64::AEK_AES, AArch64::AEK_SHA2, @@ -1609,7 +1616,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_RCPC, AArch64::AEK_DOTPROD, AArch64::AEK_FP16, AArch64::AEK_FP16FML, AArch64::AEK_SHA3, AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, - AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_HCX}), + AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_HCX, + AArch64::AEK_SSBS}), AArch64CPUTestParams( "apple-m3", "armv8.6-a", {AArch64::AEK_CRC, AArch64::AEK_AES, AArch64::AEK_SHA2, @@ -1618,7 +1626,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_RCPC, AArch64::AEK_DOTPROD, AArch64::AEK_FP16, AArch64::AEK_FP16FML, AArch64::AEK_SHA3, AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, - AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_HCX}), + AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_HCX, + AArch64::AEK_SSBS}), AArch64CPUTestParams( "apple-a17", "armv8.6-a", {AArch64::AEK_CRC, AArch64::AEK_AES, AArch64::AEK_SHA2, @@ -1627,8 +1636,9 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_RCPC, AArch64::AEK_DOTPROD, AArch64::AEK_FP16, AArch64::AEK_FP16FML, AArch64::AEK_SHA3, AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, - AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_HCX}), - AArch64CPUTestParams("apple-m4", "armv9.2-a", + AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_HCX, + AArch64::AEK_SSBS}), + AArch64CPUTestParams("apple-m4", "armv8.7-a", {AArch64::AEK_CRC, AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_SHA3, AArch64::AEK_FP, AArch64::AEK_SIMD, @@ -1692,7 +1702,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_I8MM, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PAUTH, AArch64::AEK_FP16FML, AArch64::AEK_PERFMON, - AArch64::AEK_ETE, AArch64::AEK_TRBE}), + AArch64::AEK_ETE, AArch64::AEK_TRBE, + AArch64::AEK_CCIDX}), AArch64CPUTestParams("neoverse-n3", "armv9.2-a", {AArch64::AEK_BF16, AArch64::AEK_I8MM, AArch64::AEK_SVE, AArch64::AEK_SVE2, @@ -1708,7 +1719,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_RAND, AArch64::AEK_SVE2BITPERM, AArch64::AEK_FP16FML, AArch64::AEK_PROFILE, AArch64::AEK_JSCVT, AArch64::AEK_PERFMON, - AArch64::AEK_ETE, AArch64::AEK_SPE_EEF}), + AArch64::AEK_ETE, AArch64::AEK_SPE_EEF, + AArch64::AEK_CCIDX}), AArch64CPUTestParams( "ampere1", "armv8.6-a", {AArch64::AEK_CRC, AArch64::AEK_FP, AArch64::AEK_FP16, @@ -1717,17 +1729,18 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_SHA3, AArch64::AEK_BF16, AArch64::AEK_SHA2, AArch64::AEK_AES, AArch64::AEK_I8MM, AArch64::AEK_SSBS, AArch64::AEK_SB, AArch64::AEK_RAND, AArch64::AEK_JSCVT, - AArch64::AEK_FCMA, AArch64::AEK_PAUTH, AArch64::AEK_PERFMON}), + AArch64::AEK_FCMA, AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, + AArch64::AEK_CCIDX}), AArch64CPUTestParams( "ampere1a", "armv8.6-a", - {AArch64::AEK_CRC, AArch64::AEK_FP, AArch64::AEK_FP16, - AArch64::AEK_SIMD, AArch64::AEK_RAS, AArch64::AEK_LSE, - AArch64::AEK_RDM, AArch64::AEK_RCPC, AArch64::AEK_DOTPROD, - AArch64::AEK_SM4, AArch64::AEK_SHA3, AArch64::AEK_BF16, - AArch64::AEK_SHA2, AArch64::AEK_AES, AArch64::AEK_I8MM, - AArch64::AEK_SSBS, AArch64::AEK_SB, AArch64::AEK_RAND, - AArch64::AEK_MTE, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, - AArch64::AEK_PAUTH, AArch64::AEK_PERFMON}), + {AArch64::AEK_CRC, AArch64::AEK_FP, AArch64::AEK_FP16, + AArch64::AEK_SIMD, AArch64::AEK_RAS, AArch64::AEK_LSE, + AArch64::AEK_RDM, AArch64::AEK_RCPC, AArch64::AEK_DOTPROD, + AArch64::AEK_SM4, AArch64::AEK_SHA3, AArch64::AEK_BF16, + AArch64::AEK_SHA2, AArch64::AEK_AES, AArch64::AEK_I8MM, + AArch64::AEK_SSBS, AArch64::AEK_SB, AArch64::AEK_RAND, + AArch64::AEK_MTE, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, + AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_CCIDX}), AArch64CPUTestParams( "ampere1b", "armv8.7-a", {AArch64::AEK_CRC, AArch64::AEK_FP, AArch64::AEK_FP16, @@ -1738,7 +1751,7 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_SSBS, AArch64::AEK_SB, AArch64::AEK_RAND, AArch64::AEK_MTE, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PAUTH, AArch64::AEK_CSSC, AArch64::AEK_PERFMON, - AArch64::AEK_WFXT}), + AArch64::AEK_WFXT, AArch64::AEK_CCIDX}), AArch64CPUTestParams( "neoverse-512tvb", "armv8.4-a", {AArch64::AEK_RAS, AArch64::AEK_SVE, AArch64::AEK_SSBS, @@ -1749,7 +1762,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_SM4, AArch64::AEK_FP16, AArch64::AEK_BF16, AArch64::AEK_PROFILE, AArch64::AEK_RAND, AArch64::AEK_FP16FML, AArch64::AEK_I8MM, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, - AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_CCDP}), + AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_CCDP, + AArch64::AEK_CCIDX}), AArch64CPUTestParams("thunderx2t99", "armv8.1-a", {AArch64::AEK_CRC, AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_LSE, @@ -1762,7 +1776,7 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_SIMD, AArch64::AEK_RAS, AArch64::AEK_RCPC, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_PAUTH, - AArch64::AEK_PERFMON}), + AArch64::AEK_PERFMON, AArch64::AEK_CCIDX}), AArch64CPUTestParams("thunderx", "armv8-a", {AArch64::AEK_CRC, AArch64::AEK_AES, AArch64::AEK_SHA2, AArch64::AEK_SIMD, @@ -1805,7 +1819,7 @@ INSTANTIATE_TEST_SUITE_P( {AArch64::AEK_AES, AArch64::AEK_FP, AArch64::AEK_SIMD, AArch64::AEK_PERFMON, AArch64::AEK_SHA2, AArch64::AEK_PROFILE, AArch64::AEK_CRC, AArch64::AEK_LSE, AArch64::AEK_RDM, - AArch64::AEK_RAS, AArch64::AEK_RCPC}), + AArch64::AEK_RAS, AArch64::AEK_RCPC, AArch64::AEK_CCIDX}), AArch64CPUTestParams( "oryon-1", "armv8.6-a", {AArch64::AEK_CRC, AArch64::AEK_FP, AArch64::AEK_PAUTH, @@ -1814,7 +1828,8 @@ INSTANTIATE_TEST_SUITE_P( AArch64::AEK_RCPC, AArch64::AEK_DOTPROD, AArch64::AEK_SM4, AArch64::AEK_SHA3, AArch64::AEK_BF16, AArch64::AEK_SHA2, AArch64::AEK_AES, AArch64::AEK_I8MM, AArch64::AEK_RAND, - AArch64::AEK_PROFILE, AArch64::AEK_PERFMON})), + AArch64::AEK_PROFILE, AArch64::AEK_PERFMON, AArch64::AEK_CCIDX, + AArch64::AEK_SSBS})), AArch64CPUTestParams::PrintToStringParamName); @@ -2005,6 +2020,7 @@ TEST(TargetParserTest, AArch64ExtensionFeatures) { AArch64::AEK_CPA, AArch64::AEK_PAUTHLR, AArch64::AEK_TLBIW, AArch64::AEK_JSCVT, AArch64::AEK_FCMA, AArch64::AEK_FP8, + AArch64::AEK_SMEB16B16, AArch64::AEK_SVEB16B16, }; @@ -2043,6 +2059,7 @@ TEST(TargetParserTest, AArch64ExtensionFeatures) { EXPECT_TRUE(llvm::is_contained(Features, "+sve2-sha3")); EXPECT_TRUE(llvm::is_contained(Features, "+sve2-bitperm")); EXPECT_TRUE(llvm::is_contained(Features, "+sve2p1")); + EXPECT_TRUE(llvm::is_contained(Features, "+sve-b16b16")); EXPECT_TRUE(llvm::is_contained(Features, "+b16b16")); EXPECT_TRUE(llvm::is_contained(Features, "+rcpc")); EXPECT_TRUE(llvm::is_contained(Features, "+rand")); @@ -2063,6 +2080,7 @@ TEST(TargetParserTest, AArch64ExtensionFeatures) { EXPECT_TRUE(llvm::is_contained(Features, "+sme-f64f64")); EXPECT_TRUE(llvm::is_contained(Features, "+sme-i16i64")); EXPECT_TRUE(llvm::is_contained(Features, "+sme-f16f16")); + EXPECT_TRUE(llvm::is_contained(Features, "+sme-b16b16")); EXPECT_TRUE(llvm::is_contained(Features, "+sme2")); EXPECT_TRUE(llvm::is_contained(Features, "+sme2p1")); EXPECT_TRUE(llvm::is_contained(Features, "+hbc")); @@ -2188,6 +2206,7 @@ TEST(TargetParserTest, AArch64ArchExtFeature) { {"lse", "nolse", "+lse", "-lse"}, {"rdm", "nordm", "+rdm", "-rdm"}, {"sve", "nosve", "+sve", "-sve"}, + {"sve-b16b16", "nosve-b16b16", "+sve-b16b16", "-sve-b16b16"}, {"sve2", "nosve2", "+sve2", "-sve2"}, {"sve2-aes", "nosve2-aes", "+sve2-aes", "-sve2-aes"}, {"sve2-sm4", "nosve2-sm4", "+sve2-sm4", "-sve2-sm4"}, @@ -2212,6 +2231,7 @@ TEST(TargetParserTest, AArch64ArchExtFeature) { {"sme-f64f64", "nosme-f64f64", "+sme-f64f64", "-sme-f64f64"}, {"sme-i16i64", "nosme-i16i64", "+sme-i16i64", "-sme-i16i64"}, {"sme-f16f16", "nosme-f16f16", "+sme-f16f16", "-sme-f16f16"}, + {"sme-b16b16", "nosme-b16b16", "+sme-b16b16", "-sme-b16b16"}, {"sme2", "nosme2", "+sme2", "-sme2"}, {"sme2p1", "nosme2p1", "+sme2p1", "-sme2p1"}, {"hbc", "nohbc", "+hbc", "-hbc"}, @@ -2243,9 +2263,9 @@ TEST(TargetParserTest, AArch64ArchExtFeature) { } TEST(TargetParserTest, AArch64PrintSupportedExtensions) { - std::string expected = - "All available -march extensions for AArch64\n\n" - " Name Architecture Feature(s) Description\n"; + std::string expected = "All available -march extensions for AArch64\n\n" + " Name Architecture Feature(s) " + " Description\n"; outs().flush(); testing::internal::CaptureStdout(); @@ -2452,6 +2472,12 @@ AArch64ExtensionDependenciesBaseArchTestParams {AArch64::ARMV8A, {"nobf16", "b16b16"}, {"bf16", "b16b16"}, {}}, {AArch64::ARMV8A, {"b16b16", "nobf16"}, {}, {"bf16", "b16b16"}}, + // b16b16 -> {sve-b16b16, sme-b16b16} + {AArch64::ARMV8A, {"nob16b16", "sve-b16b16"}, {"b16b16", "sve-b16b16"}, {}}, + {AArch64::ARMV8A, {"sve-b16b16", "nob16b16"}, {}, {"sve-b16b16", "b16b16"}}, + {AArch64::ARMV8A, {"nob16b16", "sme-b16b16"}, {"b16b16", "sme-b16b16"}, {}}, + {AArch64::ARMV8A, {"sme-b16b16", "nob16b16"}, {}, {"b16b16", "sme-b16b16"}}, + // sve -> {sve2, f32mm, f64mm} {AArch64::ARMV8A, {"nosve", "sve2"}, {"sve", "sve2"}, {}}, {AArch64::ARMV8A, {"sve2", "nosve"}, {}, {"sve", "sve2"}}, @@ -2491,7 +2517,7 @@ AArch64ExtensionDependenciesBaseArchTestParams {AArch64::ARMV8A, {"sme-fa64", "nosme"}, {}, {"sme", "sme-fa64"}}, // sme2 -> {sme2p1, ssve-fp8fma, ssve-fp8dot2, ssve-fp8dot4, sme-f8f16, - // sme-f8f32} + // sme-f8f32, sme-b16b16} {AArch64::ARMV8A, {"nosme2", "sme2p1"}, {"sme2", "sme2p1"}, {}}, {AArch64::ARMV8A, {"sme2p1", "nosme2"}, {}, {"sme2", "sme2p1"}}, {AArch64::ARMV8A, @@ -2522,6 +2548,8 @@ AArch64ExtensionDependenciesBaseArchTestParams {AArch64::ARMV8A, {"sme-f8f16", "nosme2"}, {}, {"sme2", "sme-f8f16"}}, {AArch64::ARMV8A, {"nosme2", "sme-f8f32"}, {"sme2", "sme-f8f32"}, {}}, {AArch64::ARMV8A, {"sme-f8f32", "nosme2"}, {}, {"sme2", "sme-f8f32"}}, + {AArch64::ARMV8A, {"nosme2", "sme-b16b16"}, {"sme2", "sme-b16b16"}, {}}, + {AArch64::ARMV8A, {"sme-b16b16", "nosme2"}, {}, {"sme2", "sme-b16b16"}}, // fp8 -> {sme-f8f16, sme-f8f32} {AArch64::ARMV8A, {"nofp8", "sme-f8f16"}, {"fp8", "sme-f8f16"}, {}}, diff --git a/llvm/unittests/tools/llvm-exegesis/X86/SubprocessMemoryTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/SubprocessMemoryTest.cpp index 7c23e7b7e9c5a..f61254ac74e14 100644 --- a/llvm/unittests/tools/llvm-exegesis/X86/SubprocessMemoryTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/X86/SubprocessMemoryTest.cpp @@ -24,7 +24,8 @@ namespace llvm { namespace exegesis { -#if defined(__linux__) && !defined(__ANDROID__) +#if defined(__linux__) && !defined(__ANDROID__) && \ + !(defined(__powerpc__) || defined(__s390x__) || defined(__sparc__)) // This needs to be updated anytime a test is added or removed from the test // suite. @@ -77,20 +78,12 @@ class SubprocessMemoryTest : public X86TestBase { // memory calls not working in some cases, so they have been disabled. // TODO(boomanaiden154): Investigate and fix this issue on PPC. -#if defined(__powerpc__) || defined(__s390x__) -TEST_F(SubprocessMemoryTest, DISABLED_OneDefinition) { -#else TEST_F(SubprocessMemoryTest, OneDefinition) { -#endif testCommon({{"test1", {APInt(8, 0xff), 4096, 0}}}, 0); checkSharedMemoryDefinition(getSharedMemoryName(0, 0), 4096, {0xff}); } -#if defined(__powerpc__) || defined(__s390x__) -TEST_F(SubprocessMemoryTest, DISABLED_MultipleDefinitions) { -#else TEST_F(SubprocessMemoryTest, MultipleDefinitions) { -#endif testCommon({{"test1", {APInt(8, 0xaa), 4096, 0}}, {"test2", {APInt(8, 0xbb), 4096, 1}}, {"test3", {APInt(8, 0xcc), 4096, 2}}}, @@ -100,11 +93,7 @@ TEST_F(SubprocessMemoryTest, MultipleDefinitions) { checkSharedMemoryDefinition(getSharedMemoryName(1, 2), 4096, {0xcc}); } -#if defined(__powerpc__) || defined(__s390x__) -TEST_F(SubprocessMemoryTest, DISABLED_DefinitionFillsCompletely) { -#else TEST_F(SubprocessMemoryTest, DefinitionFillsCompletely) { -#endif testCommon({{"test1", {APInt(8, 0xaa), 4096, 0}}, {"test2", {APInt(16, 0xbbbb), 4096, 1}}, {"test3", {APInt(24, 0xcccccc), 4096, 2}}}, @@ -118,7 +107,7 @@ TEST_F(SubprocessMemoryTest, DefinitionFillsCompletely) { } // The following test is only supported on little endian systems. -#if defined(__powerpc__) || defined(__s390x__) || __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ TEST_F(SubprocessMemoryTest, DISABLED_DefinitionEndTruncation) { #else TEST_F(SubprocessMemoryTest, DefinitionEndTruncation) { @@ -150,7 +139,7 @@ TEST_F(SubprocessMemoryTest, DefinitionEndTruncation) { checkSharedMemoryDefinition(getSharedMemoryName(3, 0), 4096, Test1Expected); } -#endif // defined(__linux__) && !defined(__ANDROID__) +#endif // __linux__ && !__ANDROID__ && !(__powerpc__ || __s390x__ || __sparc__) } // namespace exegesis } // namespace llvm diff --git a/llvm/utils/TableGen/ARMTargetDefEmitter.cpp b/llvm/utils/TableGen/ARMTargetDefEmitter.cpp index a4b25025b3c61..71ca331461c00 100644 --- a/llvm/utils/TableGen/ARMTargetDefEmitter.cpp +++ b/llvm/utils/TableGen/ARMTargetDefEmitter.cpp @@ -19,10 +19,38 @@ #include "llvm/TableGen/Record.h" #include "llvm/TableGen/TableGenBackend.h" #include +#include #include using namespace llvm; +/// Collect the full set of implied features for a SubtargetFeature. +static void CollectImpliedFeatures(std::set &SeenFeats, Record *Rec) { + assert(Rec->isSubClassOf("SubtargetFeature") && + "Rec is not a SubtargetFeature"); + + SeenFeats.insert(Rec); + for (Record *Implied : Rec->getValueAsListOfDefs("Implies")) + CollectImpliedFeatures(SeenFeats, Implied); +} + +static void CheckFeatureTree(Record *Root) { + std::set SeenFeats; + CollectImpliedFeatures(SeenFeats, Root); + + // Check that each of the mandatory (implied) features which is an + // ExtensionWithMArch is also enabled by default. + auto DefaultExtsVec = Root->getValueAsListOfDefs("DefaultExts"); + std::set DefaultExts{DefaultExtsVec.begin(), DefaultExtsVec.end()}; + for (auto *Feat : SeenFeats) { + if (Feat->isSubClassOf("ExtensionWithMArch") && !DefaultExts.count(Feat)) + PrintFatalError(Root->getLoc(), + "ExtensionWithMArch " + Feat->getName() + + " is implied (mandatory) as a SubtargetFeature, but " + "is not present in DefaultExts"); + } +} + static void EmitARMTargetDef(RecordKeeper &RK, raw_ostream &OS) { OS << "// Autogenerated by ARMTargetDefEmitter.cpp\n\n"; @@ -283,9 +311,7 @@ static void EmitARMTargetDef(RecordKeeper &RK, raw_ostream &OS) { auto Profile = Arch->getValueAsString("Profile"); auto ArchInfo = ArchInfoName(Major, Minor, Profile); - // The apple-latest alias is backend only, do not expose it to -mcpu. - if (Name == "apple-latest") - continue; + CheckFeatureTree(Arch); OS << " {\n" << " \"" << Name << "\",\n" diff --git a/llvm/utils/docker/debian10/Dockerfile b/llvm/utils/docker/debian10/Dockerfile deleted file mode 100644 index b898c935b9726..0000000000000 --- a/llvm/utils/docker/debian10/Dockerfile +++ /dev/null @@ -1,47 +0,0 @@ -#===- llvm/utils/docker/debian10/build/Dockerfile -------------------------===// -# -# 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 -# -#===----------------------------------------------------------------------===// -# Stage 1. Check out LLVM source code and run the build. -FROM launcher.gcr.io/google/debian10:latest as builder -LABEL maintainer "LLVM Developers" -# Install build dependencies of llvm. -# First, Update the apt's source list and include the sources of the packages. -RUN grep deb /etc/apt/sources.list | \ - sed 's/^deb/deb-src /g' >> /etc/apt/sources.list -# Install compiler, python and subversion. -RUN apt-get update && \ - apt-get install -y --no-install-recommends ca-certificates gnupg \ - build-essential cmake make python3 zlib1g wget subversion unzip git && \ - rm -rf /var/lib/apt/lists/* -# Install a newer ninja release. It seems the older version in the debian repos -# randomly crashes when compiling llvm. -RUN wget "https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip" && \ - echo "d2fea9ff33b3ef353161ed906f260d565ca55b8ca0568fa07b1d2cab90a84a07 ninja-linux.zip" \ - | sha256sum -c && \ - unzip ninja-linux.zip -d /usr/local/bin && \ - rm ninja-linux.zip - -ADD checksums /tmp/checksums -ADD scripts /tmp/scripts - -# Checkout the source code. -ARG checkout_args -RUN /tmp/scripts/checkout.sh ${checkout_args} -# Run the build. Results of the build will be available at /tmp/clang-install/. -ARG buildscript_args -RUN /tmp/scripts/build_install_llvm.sh --to /tmp/clang-install ${buildscript_args} - - -# Stage 2. Produce a minimal release image with build results. -FROM launcher.gcr.io/google/debian10:latest -LABEL maintainer "LLVM Developers" -# Install packages for minimal useful image. -RUN apt-get update && \ - apt-get install -y --no-install-recommends libstdc++-7-dev binutils && \ - rm -rf /var/lib/apt/lists/* -# Copy build results of stage 1 to /usr/local. -COPY --from=builder /tmp/clang-install/ /usr/local/ diff --git a/llvm/utils/docker/example/Dockerfile b/llvm/utils/docker/example/Dockerfile deleted file mode 100644 index ebfb0e49c82c8..0000000000000 --- a/llvm/utils/docker/example/Dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -#===- llvm/utils/docker/example/build/Dockerfile -------------------------===// -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===----------------------------------------------------------------------===// -# This is an example Dockerfile to build an image that compiles clang. -# Replace FIXMEs to prepare your own image. - -# Stage 1. Check out LLVM source code and run the build. -# FIXME: Replace 'ubuntu' with your base image -FROM ubuntu as builder -# FIXME: Change maintainer name -LABEL maintainer "Maintainer " -# FIXME: Install llvm/clang build dependencies here. Including compiler to -# build stage1, cmake, subversion, ninja, etc. - -ADD checksums /tmp/checksums -ADD scripts /tmp/scripts - -# Checkout the source code. -ARG checkout_args -RUN /tmp/scripts/checkout.sh ${checkout_args} -# Run the build. Results of the build will be available at /tmp/clang-install/. -ARG buildscript_args -RUN /tmp/scripts/build_install_llvm.sh --to /tmp/clang-install ${buildscript_args} - - -# Stage 2. Produce a minimal release image with build results. -# FIXME: Replace 'ubuntu' with your base image. -FROM ubuntu -# FIXME: Change maintainer name. -LABEL maintainer "Maintainer " -# FIXME: Install all packages you want to have in your release container. -# A minimal useful installation should include at least libstdc++ and binutils. - -# Copy build results of stage 1 to /usr/local. -COPY --from=builder /tmp/clang-install/ /usr/local/ diff --git a/llvm/utils/docker/nvidia-cuda/Dockerfile b/llvm/utils/docker/nvidia-cuda/Dockerfile deleted file mode 100644 index 91ad53c57b165..0000000000000 --- a/llvm/utils/docker/nvidia-cuda/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -#===- llvm/utils/docker/nvidia-cuda/build/Dockerfile ---------------------===// -# -# 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 -# -#===----------------------------------------------------------------------===// -# Stage 1. Check out LLVM source code and run the build. -FROM nvidia/cuda:8.0-devel as builder -LABEL maintainer "LLVM Developers" -# Install llvm build dependencies. -RUN apt-get update && \ - apt-get install -y --no-install-recommends ca-certificates cmake python \ - subversion ninja-build git && \ - rm -rf /var/lib/apt/lists/* - -ADD checksums /tmp/checksums -ADD scripts /tmp/scripts - -# Checkout the source code. -ARG checkout_args -RUN /tmp/scripts/checkout.sh ${checkout_args} -# Run the build. Results of the build will be available at /tmp/clang-install/. -ARG buildscript_args -RUN /tmp/scripts/build_install_llvm.sh --to /tmp/clang-install ${buildscript_args} - - -# Stage 2. Produce a minimal release image with build results. -FROM nvidia/cuda:8.0-devel -LABEL maintainer "LLVM Developers" -# Copy clang installation into this container. -COPY --from=builder /tmp/clang-install/ /usr/local/ -# C++ standard library and binutils are already included in the base package. diff --git a/llvm/utils/extract_symbols.py b/llvm/utils/extract_symbols.py index 10fdf14acd158..684e124c76259 100755 --- a/llvm/utils/extract_symbols.py +++ b/llvm/utils/extract_symbols.py @@ -140,7 +140,7 @@ def should_keep_itanium_symbol(symbol, calling_convention_decoration): if not symbol.startswith("_") and not symbol.startswith("."): return symbol # Discard manglings that aren't nested names - match = re.match("_Z(T[VTIS])?(N.+)", symbol) + match = re.match("\.?_Z(T[VTIS])?(N.+)", symbol) if not match: return None # Demangle the name. If the name is too complex then we don't need to keep @@ -323,7 +323,7 @@ def get_template_name(sym, mangling): if mangling == "microsoft": names = parse_microsoft_mangling(sym) else: - match = re.match("_Z(T[VTIS])?(N.+)", sym) + match = re.match("\.?_Z(T[VTIS])?(N.+)", sym) if match: names, _ = parse_itanium_nested_name(match.group(2)) else: @@ -483,6 +483,9 @@ def parse_tool_path(parser, tool, val): else: outfile = sys.stdout for k, v in list(symbol_defs.items()): + # On AIX, export function descriptors instead of function entries. + if platform.system() == "AIX" and k.startswith("."): + continue template = get_template_name(k, args.mangling) if v == 1 and (not template or template in template_instantiation_refs): print(k, file=outfile) diff --git a/llvm/utils/git/requirements.txt b/llvm/utils/git/requirements.txt deleted file mode 100644 index e354c91a4d5bd..0000000000000 --- a/llvm/utils/git/requirements.txt +++ /dev/null @@ -1,318 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile --generate-hashes --output-file=requirements.txt requirements.txt.in -# -certifi==2024.2.2 \ - --hash=sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f \ - --hash=sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1 - # via - # -r requirements.txt.in - # requests -cffi==1.16.0 \ - --hash=sha256:0c9ef6ff37e974b73c25eecc13952c55bceed9112be2d9d938ded8e856138bcc \ - --hash=sha256:131fd094d1065b19540c3d72594260f118b231090295d8c34e19a7bbcf2e860a \ - --hash=sha256:1b8ebc27c014c59692bb2664c7d13ce7a6e9a629be20e54e7271fa696ff2b417 \ - --hash=sha256:2c56b361916f390cd758a57f2e16233eb4f64bcbeee88a4881ea90fca14dc6ab \ - --hash=sha256:2d92b25dbf6cae33f65005baf472d2c245c050b1ce709cc4588cdcdd5495b520 \ - --hash=sha256:31d13b0f99e0836b7ff893d37af07366ebc90b678b6664c955b54561fc36ef36 \ - --hash=sha256:32c68ef735dbe5857c810328cb2481e24722a59a2003018885514d4c09af9743 \ - --hash=sha256:3686dffb02459559c74dd3d81748269ffb0eb027c39a6fc99502de37d501faa8 \ - --hash=sha256:582215a0e9adbe0e379761260553ba11c58943e4bbe9c36430c4ca6ac74b15ed \ - --hash=sha256:5b50bf3f55561dac5438f8e70bfcdfd74543fd60df5fa5f62d94e5867deca684 \ - --hash=sha256:5bf44d66cdf9e893637896c7faa22298baebcd18d1ddb6d2626a6e39793a1d56 \ - --hash=sha256:6602bc8dc6f3a9e02b6c22c4fc1e47aa50f8f8e6d3f78a5e16ac33ef5fefa324 \ - --hash=sha256:673739cb539f8cdaa07d92d02efa93c9ccf87e345b9a0b556e3ecc666718468d \ - --hash=sha256:68678abf380b42ce21a5f2abde8efee05c114c2fdb2e9eef2efdb0257fba1235 \ - --hash=sha256:68e7c44931cc171c54ccb702482e9fc723192e88d25a0e133edd7aff8fcd1f6e \ - --hash=sha256:6b3d6606d369fc1da4fd8c357d026317fbb9c9b75d36dc16e90e84c26854b088 \ - --hash=sha256:748dcd1e3d3d7cd5443ef03ce8685043294ad6bd7c02a38d1bd367cfd968e000 \ - --hash=sha256:7651c50c8c5ef7bdb41108b7b8c5a83013bfaa8a935590c5d74627c047a583c7 \ - --hash=sha256:7b78010e7b97fef4bee1e896df8a4bbb6712b7f05b7ef630f9d1da00f6444d2e \ - --hash=sha256:7e61e3e4fa664a8588aa25c883eab612a188c725755afff6289454d6362b9673 \ - --hash=sha256:80876338e19c951fdfed6198e70bc88f1c9758b94578d5a7c4c91a87af3cf31c \ - --hash=sha256:8895613bcc094d4a1b2dbe179d88d7fb4a15cee43c052e8885783fac397d91fe \ - --hash=sha256:88e2b3c14bdb32e440be531ade29d3c50a1a59cd4e51b1dd8b0865c54ea5d2e2 \ - --hash=sha256:8f8e709127c6c77446a8c0a8c8bf3c8ee706a06cd44b1e827c3e6a2ee6b8c098 \ - --hash=sha256:9cb4a35b3642fc5c005a6755a5d17c6c8b6bcb6981baf81cea8bfbc8903e8ba8 \ - --hash=sha256:9f90389693731ff1f659e55c7d1640e2ec43ff725cc61b04b2f9c6d8d017df6a \ - --hash=sha256:a09582f178759ee8128d9270cd1344154fd473bb77d94ce0aeb2a93ebf0feaf0 \ - --hash=sha256:a6a14b17d7e17fa0d207ac08642c8820f84f25ce17a442fd15e27ea18d67c59b \ - --hash=sha256:a72e8961a86d19bdb45851d8f1f08b041ea37d2bd8d4fd19903bc3083d80c896 \ - --hash=sha256:abd808f9c129ba2beda4cfc53bde801e5bcf9d6e0f22f095e45327c038bfe68e \ - --hash=sha256:ac0f5edd2360eea2f1daa9e26a41db02dd4b0451b48f7c318e217ee092a213e9 \ - --hash=sha256:b29ebffcf550f9da55bec9e02ad430c992a87e5f512cd63388abb76f1036d8d2 \ - --hash=sha256:b2ca4e77f9f47c55c194982e10f058db063937845bb2b7a86c84a6cfe0aefa8b \ - --hash=sha256:b7be2d771cdba2942e13215c4e340bfd76398e9227ad10402a8767ab1865d2e6 \ - --hash=sha256:b84834d0cf97e7d27dd5b7f3aca7b6e9263c56308ab9dc8aae9784abb774d404 \ - --hash=sha256:b86851a328eedc692acf81fb05444bdf1891747c25af7529e39ddafaf68a4f3f \ - --hash=sha256:bcb3ef43e58665bbda2fb198698fcae6776483e0c4a631aa5647806c25e02cc0 \ - --hash=sha256:c0f31130ebc2d37cdd8e44605fb5fa7ad59049298b3f745c74fa74c62fbfcfc4 \ - --hash=sha256:c6a164aa47843fb1b01e941d385aab7215563bb8816d80ff3a363a9f8448a8dc \ - --hash=sha256:d8a9d3ebe49f084ad71f9269834ceccbf398253c9fac910c4fd7053ff1386936 \ - --hash=sha256:db8e577c19c0fda0beb7e0d4e09e0ba74b1e4c092e0e40bfa12fe05b6f6d75ba \ - --hash=sha256:dc9b18bf40cc75f66f40a7379f6a9513244fe33c0e8aa72e2d56b0196a7ef872 \ - --hash=sha256:e09f3ff613345df5e8c3667da1d918f9149bd623cd9070c983c013792a9a62eb \ - --hash=sha256:e4108df7fe9b707191e55f33efbcb2d81928e10cea45527879a4749cbe472614 \ - --hash=sha256:e6024675e67af929088fda399b2094574609396b1decb609c55fa58b028a32a1 \ - --hash=sha256:e70f54f1796669ef691ca07d046cd81a29cb4deb1e5f942003f401c0c4a2695d \ - --hash=sha256:e715596e683d2ce000574bae5d07bd522c781a822866c20495e52520564f0969 \ - --hash=sha256:e760191dd42581e023a68b758769e2da259b5d52e3103c6060ddc02c9edb8d7b \ - --hash=sha256:ed86a35631f7bfbb28e108dd96773b9d5a6ce4811cf6ea468bb6a359b256b1e4 \ - --hash=sha256:ee07e47c12890ef248766a6e55bd38ebfb2bb8edd4142d56db91b21ea68b7627 \ - --hash=sha256:fa3a0128b152627161ce47201262d3140edb5a5c3da88d73a1b790a959126956 \ - --hash=sha256:fcc8eb6d5902bb1cf6dc4f187ee3ea80a1eba0a89aba40a5cb20a5087d961357 - # via - # cryptography - # pynacl -charset-normalizer==3.3.2 \ - --hash=sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027 \ - --hash=sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087 \ - --hash=sha256:0a55554a2fa0d408816b3b5cedf0045f4b8e1a6065aec45849de2d6f3f8e9786 \ - --hash=sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8 \ - --hash=sha256:10955842570876604d404661fbccbc9c7e684caf432c09c715ec38fbae45ae09 \ - --hash=sha256:122c7fa62b130ed55f8f285bfd56d5f4b4a5b503609d181f9ad85e55c89f4185 \ - --hash=sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574 \ - --hash=sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e \ - --hash=sha256:1f79682fbe303db92bc2b1136016a38a42e835d932bab5b3b1bfcfbf0640e519 \ - --hash=sha256:2127566c664442652f024c837091890cb1942c30937add288223dc895793f898 \ - --hash=sha256:22afcb9f253dac0696b5a4be4a1c0f8762f8239e21b99680099abd9b2b1b2269 \ - --hash=sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3 \ - --hash=sha256:2e81c7b9c8979ce92ed306c249d46894776a909505d8f5a4ba55b14206e3222f \ - --hash=sha256:3287761bc4ee9e33561a7e058c72ac0938c4f57fe49a09eae428fd88aafe7bb6 \ - --hash=sha256:34d1c8da1e78d2e001f363791c98a272bb734000fcef47a491c1e3b0505657a8 \ - --hash=sha256:37e55c8e51c236f95b033f6fb391d7d7970ba5fe7ff453dad675e88cf303377a \ - --hash=sha256:3d47fa203a7bd9c5b6cee4736ee84ca03b8ef23193c0d1ca99b5089f72645c73 \ - --hash=sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc \ - --hash=sha256:42cb296636fcc8b0644486d15c12376cb9fa75443e00fb25de0b8602e64c1714 \ - --hash=sha256:45485e01ff4d3630ec0d9617310448a8702f70e9c01906b0d0118bdf9d124cf2 \ - --hash=sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc \ - --hash=sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce \ - --hash=sha256:4d0d1650369165a14e14e1e47b372cfcb31d6ab44e6e33cb2d4e57265290044d \ - --hash=sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e \ - --hash=sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6 \ - --hash=sha256:572c3763a264ba47b3cf708a44ce965d98555f618ca42c926a9c1616d8f34269 \ - --hash=sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96 \ - --hash=sha256:5b4c145409bef602a690e7cfad0a15a55c13320ff7a3ad7ca59c13bb8ba4d45d \ - --hash=sha256:6463effa3186ea09411d50efc7d85360b38d5f09b870c48e4600f63af490e56a \ - --hash=sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4 \ - --hash=sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77 \ - --hash=sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d \ - --hash=sha256:68d1f8a9e9e37c1223b656399be5d6b448dea850bed7d0f87a8311f1ff3dabb0 \ - --hash=sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed \ - --hash=sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068 \ - --hash=sha256:6c4caeef8fa63d06bd437cd4bdcf3ffefe6738fb1b25951440d80dc7df8c03ac \ - --hash=sha256:6ef1d82a3af9d3eecdba2321dc1b3c238245d890843e040e41e470ffa64c3e25 \ - --hash=sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8 \ - --hash=sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab \ - --hash=sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26 \ - --hash=sha256:7f04c839ed0b6b98b1a7501a002144b76c18fb1c1850c8b98d458ac269e26ed2 \ - --hash=sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db \ - --hash=sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f \ - --hash=sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5 \ - --hash=sha256:86216b5cee4b06df986d214f664305142d9c76df9b6512be2738aa72a2048f99 \ - --hash=sha256:87d1351268731db79e0f8e745d92493ee2841c974128ef629dc518b937d9194c \ - --hash=sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d \ - --hash=sha256:8c622a5fe39a48f78944a87d4fb8a53ee07344641b0562c540d840748571b811 \ - --hash=sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa \ - --hash=sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a \ - --hash=sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03 \ - --hash=sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b \ - --hash=sha256:923c0c831b7cfcb071580d3f46c4baf50f174be571576556269530f4bbd79d04 \ - --hash=sha256:95f2a5796329323b8f0512e09dbb7a1860c46a39da62ecb2324f116fa8fdc85c \ - --hash=sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001 \ - --hash=sha256:9f96df6923e21816da7e0ad3fd47dd8f94b2a5ce594e00677c0013018b813458 \ - --hash=sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389 \ - --hash=sha256:a50aebfa173e157099939b17f18600f72f84eed3049e743b68ad15bd69b6bf99 \ - --hash=sha256:a981a536974bbc7a512cf44ed14938cf01030a99e9b3a06dd59578882f06f985 \ - --hash=sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537 \ - --hash=sha256:ae5f4161f18c61806f411a13b0310bea87f987c7d2ecdbdaad0e94eb2e404238 \ - --hash=sha256:aed38f6e4fb3f5d6bf81bfa990a07806be9d83cf7bacef998ab1a9bd660a581f \ - --hash=sha256:b01b88d45a6fcb69667cd6d2f7a9aeb4bf53760d7fc536bf679ec94fe9f3ff3d \ - --hash=sha256:b261ccdec7821281dade748d088bb6e9b69e6d15b30652b74cbbac25e280b796 \ - --hash=sha256:b2b0a0c0517616b6869869f8c581d4eb2dd83a4d79e0ebcb7d373ef9956aeb0a \ - --hash=sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143 \ - --hash=sha256:bd8f7df7d12c2db9fab40bdd87a7c09b1530128315d047a086fa3ae3435cb3a8 \ - --hash=sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c \ - --hash=sha256:c002b4ffc0be611f0d9da932eb0f704fe2602a9a949d1f738e4c34c75b0863d5 \ - --hash=sha256:c083af607d2515612056a31f0a8d9e0fcb5876b7bfc0abad3ecd275bc4ebc2d5 \ - --hash=sha256:c180f51afb394e165eafe4ac2936a14bee3eb10debc9d9e4db8958fe36afe711 \ - --hash=sha256:c235ebd9baae02f1b77bcea61bce332cb4331dc3617d254df3323aa01ab47bd4 \ - --hash=sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6 \ - --hash=sha256:d0eccceffcb53201b5bfebb52600a5fb483a20b61da9dbc885f8b103cbe7598c \ - --hash=sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7 \ - --hash=sha256:db364eca23f876da6f9e16c9da0df51aa4f104a972735574842618b8c6d999d4 \ - --hash=sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b \ - --hash=sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae \ - --hash=sha256:e06ed3eb3218bc64786f7db41917d4e686cc4856944f53d5bdf83a6884432e12 \ - --hash=sha256:e27ad930a842b4c5eb8ac0016b0a54f5aebbe679340c26101df33424142c143c \ - --hash=sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae \ - --hash=sha256:eb00ed941194665c332bf8e078baf037d6c35d7c4f3102ea2d4f16ca94a26dc8 \ - --hash=sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887 \ - --hash=sha256:eb8821e09e916165e160797a6c17edda0679379a4be5c716c260e836e122f54b \ - --hash=sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4 \ - --hash=sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f \ - --hash=sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5 \ - --hash=sha256:fb69256e180cb6c8a894fee62b3afebae785babc1ee98b81cdf68bbca1987f33 \ - --hash=sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519 \ - --hash=sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561 - # via requests -cryptography==42.0.5 \ - --hash=sha256:0270572b8bd2c833c3981724b8ee9747b3ec96f699a9665470018594301439ee \ - --hash=sha256:111a0d8553afcf8eb02a4fea6ca4f59d48ddb34497aa8706a6cf536f1a5ec576 \ - --hash=sha256:16a48c23a62a2f4a285699dba2e4ff2d1cff3115b9df052cdd976a18856d8e3d \ - --hash=sha256:1b95b98b0d2af784078fa69f637135e3c317091b615cd0905f8b8a087e86fa30 \ - --hash=sha256:1f71c10d1e88467126f0efd484bd44bca5e14c664ec2ede64c32f20875c0d413 \ - --hash=sha256:2424ff4c4ac7f6b8177b53c17ed5d8fa74ae5955656867f5a8affaca36a27abb \ - --hash=sha256:2bce03af1ce5a5567ab89bd90d11e7bbdff56b8af3acbbec1faded8f44cb06da \ - --hash=sha256:329906dcc7b20ff3cad13c069a78124ed8247adcac44b10bea1130e36caae0b4 \ - --hash=sha256:37dd623507659e08be98eec89323469e8c7b4c1407c85112634ae3dbdb926fdd \ - --hash=sha256:3eaafe47ec0d0ffcc9349e1708be2aaea4c6dd4978d76bf6eb0cb2c13636c6fc \ - --hash=sha256:5e6275c09d2badf57aea3afa80d975444f4be8d3bc58f7f80d2a484c6f9485c8 \ - --hash=sha256:6fe07eec95dfd477eb9530aef5bead34fec819b3aaf6c5bd6d20565da607bfe1 \ - --hash=sha256:7367d7b2eca6513681127ebad53b2582911d1736dc2ffc19f2c3ae49997496bc \ - --hash=sha256:7cde5f38e614f55e28d831754e8a3bacf9ace5d1566235e39d91b35502d6936e \ - --hash=sha256:9481ffe3cf013b71b2428b905c4f7a9a4f76ec03065b05ff499bb5682a8d9ad8 \ - --hash=sha256:98d8dc6d012b82287f2c3d26ce1d2dd130ec200c8679b6213b3c73c08b2b7940 \ - --hash=sha256:a011a644f6d7d03736214d38832e030d8268bcff4a41f728e6030325fea3e400 \ - --hash=sha256:a2913c5375154b6ef2e91c10b5720ea6e21007412f6437504ffea2109b5a33d7 \ - --hash=sha256:a30596bae9403a342c978fb47d9b0ee277699fa53bbafad14706af51fe543d16 \ - --hash=sha256:b03c2ae5d2f0fc05f9a2c0c997e1bc18c8229f392234e8a0194f202169ccd278 \ - --hash=sha256:b6cd2203306b63e41acdf39aa93b86fb566049aeb6dc489b70e34bcd07adca74 \ - --hash=sha256:b7ffe927ee6531c78f81aa17e684e2ff617daeba7f189f911065b2ea2d526dec \ - --hash=sha256:b8cac287fafc4ad485b8a9b67d0ee80c66bf3574f655d3b97ef2e1082360faf1 \ - --hash=sha256:ba334e6e4b1d92442b75ddacc615c5476d4ad55cc29b15d590cc6b86efa487e2 \ - --hash=sha256:ba3e4a42397c25b7ff88cdec6e2a16c2be18720f317506ee25210f6d31925f9c \ - --hash=sha256:c41fb5e6a5fe9ebcd58ca3abfeb51dffb5d83d6775405305bfa8715b76521922 \ - --hash=sha256:cd2030f6650c089aeb304cf093f3244d34745ce0cfcc39f20c6fbfe030102e2a \ - --hash=sha256:cd65d75953847815962c84a4654a84850b2bb4aed3f26fadcc1c13892e1e29f6 \ - --hash=sha256:e4985a790f921508f36f81831817cbc03b102d643b5fcb81cd33df3fa291a1a1 \ - --hash=sha256:e807b3188f9eb0eaa7bbb579b462c5ace579f1cedb28107ce8b48a9f7ad3679e \ - --hash=sha256:f12764b8fffc7a123f641d7d049d382b73f96a34117e0b637b80643169cec8ac \ - --hash=sha256:f8837fe1d6ac4a8052a9a8ddab256bc006242696f03368a4009be7ee3075cdb7 - # via pyjwt -deprecated==1.2.14 \ - --hash=sha256:6fac8b097794a90302bdbb17b9b815e732d3c4720583ff1b198499d78470466c \ - --hash=sha256:e5323eb936458dccc2582dc6f9c322c852a775a27065ff2b0c4970b9d53d01b3 - # via pygithub -gitdb==4.0.11 \ - --hash=sha256:81a3407ddd2ee8df444cbacea00e2d038e40150acfa3001696fe0dcf1d3adfa4 \ - --hash=sha256:bf5421126136d6d0af55bc1e7c1af1c397a34f5b7bd79e776cd3e89785c2b04b - # via gitpython -gitpython==3.1.43 \ - --hash=sha256:35f314a9f878467f5453cc1fee295c3e18e52f1b99f10f6cf5b1682e968a9e7c \ - --hash=sha256:eec7ec56b92aad751f9912a73404bc02ba212a23adb2c7098ee668417051a1ff - # via -r requirements.txt.in -idna==3.7 \ - --hash=sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc \ - --hash=sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0 - # via requests -pycparser==2.22 \ - --hash=sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6 \ - --hash=sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc - # via cffi -pygithub==1.59.1 \ - --hash=sha256:3d87a822e6c868142f0c2c4bf16cce4696b5a7a4d142a7bd160e1bdf75bc54a9 \ - --hash=sha256:c44e3a121c15bf9d3a5cc98d94c9a047a5132a9b01d22264627f58ade9ddc217 - # via -r requirements.txt.in -pyjwt[crypto]==2.8.0 \ - --hash=sha256:57e28d156e3d5c10088e0c68abb90bfac3df82b40a71bd0daa20c65ccd5c23de \ - --hash=sha256:59127c392cc44c2da5bb3192169a91f429924e17aff6534d70fdc02ab3e04320 - # via pygithub -pynacl==1.5.0 \ - --hash=sha256:06b8f6fa7f5de8d5d2f7573fe8c863c051225a27b61e6860fd047b1775807858 \ - --hash=sha256:0c84947a22519e013607c9be43706dd42513f9e6ae5d39d3613ca1e142fba44d \ - --hash=sha256:20f42270d27e1b6a29f54032090b972d97f0a1b0948cc52392041ef7831fee93 \ - --hash=sha256:401002a4aaa07c9414132aaed7f6836ff98f59277a234704ff66878c2ee4a0d1 \ - --hash=sha256:52cb72a79269189d4e0dc537556f4740f7f0a9ec41c1322598799b0bdad4ef92 \ - --hash=sha256:61f642bf2378713e2c2e1de73444a3778e5f0a38be6fee0fe532fe30060282ff \ - --hash=sha256:8ac7448f09ab85811607bdd21ec2464495ac8b7c66d146bf545b0f08fb9220ba \ - --hash=sha256:a36d4a9dda1f19ce6e03c9a784a2921a4b726b02e1c736600ca9c22029474394 \ - --hash=sha256:a422368fc821589c228f4c49438a368831cb5bbc0eab5ebe1d7fac9dded6567b \ - --hash=sha256:e46dae94e34b085175f8abb3b0aaa7da40767865ac82c928eeb9e57e1ea8a543 - # via pygithub -requests==2.31.0 \ - --hash=sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f \ - --hash=sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1 - # via pygithub -smmap==5.0.1 \ - --hash=sha256:dceeb6c0028fdb6734471eb07c0cd2aae706ccaecab45965ee83f11c8d3b1f62 \ - --hash=sha256:e6d8668fa5f93e706934a62d7b4db19c8d9eb8cf2adbb75ef1b675aa332b69da - # via gitdb -urllib3==2.2.1 \ - --hash=sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d \ - --hash=sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19 - # via requests -wrapt==1.16.0 \ - --hash=sha256:0d2691979e93d06a95a26257adb7bfd0c93818e89b1406f5a28f36e0d8c1e1fc \ - --hash=sha256:14d7dc606219cdd7405133c713f2c218d4252f2a469003f8c46bb92d5d095d81 \ - --hash=sha256:1a5db485fe2de4403f13fafdc231b0dbae5eca4359232d2efc79025527375b09 \ - --hash=sha256:1acd723ee2a8826f3d53910255643e33673e1d11db84ce5880675954183ec47e \ - --hash=sha256:1ca9b6085e4f866bd584fb135a041bfc32cab916e69f714a7d1d397f8c4891ca \ - --hash=sha256:1dd50a2696ff89f57bd8847647a1c363b687d3d796dc30d4dd4a9d1689a706f0 \ - --hash=sha256:2076fad65c6736184e77d7d4729b63a6d1ae0b70da4868adeec40989858eb3fb \ - --hash=sha256:2a88e6010048489cda82b1326889ec075a8c856c2e6a256072b28eaee3ccf487 \ - --hash=sha256:3ebf019be5c09d400cf7b024aa52b1f3aeebeff51550d007e92c3c1c4afc2a40 \ - --hash=sha256:418abb18146475c310d7a6dc71143d6f7adec5b004ac9ce08dc7a34e2babdc5c \ - --hash=sha256:43aa59eadec7890d9958748db829df269f0368521ba6dc68cc172d5d03ed8060 \ - --hash=sha256:44a2754372e32ab315734c6c73b24351d06e77ffff6ae27d2ecf14cf3d229202 \ - --hash=sha256:490b0ee15c1a55be9c1bd8609b8cecd60e325f0575fc98f50058eae366e01f41 \ - --hash=sha256:49aac49dc4782cb04f58986e81ea0b4768e4ff197b57324dcbd7699c5dfb40b9 \ - --hash=sha256:5eb404d89131ec9b4f748fa5cfb5346802e5ee8836f57d516576e61f304f3b7b \ - --hash=sha256:5f15814a33e42b04e3de432e573aa557f9f0f56458745c2074952f564c50e664 \ - --hash=sha256:5f370f952971e7d17c7d1ead40e49f32345a7f7a5373571ef44d800d06b1899d \ - --hash=sha256:66027d667efe95cc4fa945af59f92c5a02c6f5bb6012bff9e60542c74c75c362 \ - --hash=sha256:66dfbaa7cfa3eb707bbfcd46dab2bc6207b005cbc9caa2199bcbc81d95071a00 \ - --hash=sha256:685f568fa5e627e93f3b52fda002c7ed2fa1800b50ce51f6ed1d572d8ab3e7fc \ - --hash=sha256:6906c4100a8fcbf2fa735f6059214bb13b97f75b1a61777fcf6432121ef12ef1 \ - --hash=sha256:6a42cd0cfa8ffc1915aef79cb4284f6383d8a3e9dcca70c445dcfdd639d51267 \ - --hash=sha256:6dcfcffe73710be01d90cae08c3e548d90932d37b39ef83969ae135d36ef3956 \ - --hash=sha256:6f6eac2360f2d543cc875a0e5efd413b6cbd483cb3ad7ebf888884a6e0d2e966 \ - --hash=sha256:72554a23c78a8e7aa02abbd699d129eead8b147a23c56e08d08dfc29cfdddca1 \ - --hash=sha256:73870c364c11f03ed072dda68ff7aea6d2a3a5c3fe250d917a429c7432e15228 \ - --hash=sha256:73aa7d98215d39b8455f103de64391cb79dfcad601701a3aa0dddacf74911d72 \ - --hash=sha256:75ea7d0ee2a15733684badb16de6794894ed9c55aa5e9903260922f0482e687d \ - --hash=sha256:7bd2d7ff69a2cac767fbf7a2b206add2e9a210e57947dd7ce03e25d03d2de292 \ - --hash=sha256:807cc8543a477ab7422f1120a217054f958a66ef7314f76dd9e77d3f02cdccd0 \ - --hash=sha256:8e9723528b9f787dc59168369e42ae1c3b0d3fadb2f1a71de14531d321ee05b0 \ - --hash=sha256:9090c9e676d5236a6948330e83cb89969f433b1943a558968f659ead07cb3b36 \ - --hash=sha256:9153ed35fc5e4fa3b2fe97bddaa7cbec0ed22412b85bcdaf54aeba92ea37428c \ - --hash=sha256:9159485323798c8dc530a224bd3ffcf76659319ccc7bbd52e01e73bd0241a0c5 \ - --hash=sha256:941988b89b4fd6b41c3f0bfb20e92bd23746579736b7343283297c4c8cbae68f \ - --hash=sha256:94265b00870aa407bd0cbcfd536f17ecde43b94fb8d228560a1e9d3041462d73 \ - --hash=sha256:98b5e1f498a8ca1858a1cdbffb023bfd954da4e3fa2c0cb5853d40014557248b \ - --hash=sha256:9b201ae332c3637a42f02d1045e1d0cccfdc41f1f2f801dafbaa7e9b4797bfc2 \ - --hash=sha256:a0ea261ce52b5952bf669684a251a66df239ec6d441ccb59ec7afa882265d593 \ - --hash=sha256:a33a747400b94b6d6b8a165e4480264a64a78c8a4c734b62136062e9a248dd39 \ - --hash=sha256:a452f9ca3e3267cd4d0fcf2edd0d035b1934ac2bd7e0e57ac91ad6b95c0c6389 \ - --hash=sha256:a86373cf37cd7764f2201b76496aba58a52e76dedfaa698ef9e9688bfd9e41cf \ - --hash=sha256:ac83a914ebaf589b69f7d0a1277602ff494e21f4c2f743313414378f8f50a4cf \ - --hash=sha256:aefbc4cb0a54f91af643660a0a150ce2c090d3652cf4052a5397fb2de549cd89 \ - --hash=sha256:b3646eefa23daeba62643a58aac816945cadc0afaf21800a1421eeba5f6cfb9c \ - --hash=sha256:b47cfad9e9bbbed2339081f4e346c93ecd7ab504299403320bf85f7f85c7d46c \ - --hash=sha256:b935ae30c6e7400022b50f8d359c03ed233d45b725cfdd299462f41ee5ffba6f \ - --hash=sha256:bb2dee3874a500de01c93d5c71415fcaef1d858370d405824783e7a8ef5db440 \ - --hash=sha256:bc57efac2da352a51cc4658878a68d2b1b67dbe9d33c36cb826ca449d80a8465 \ - --hash=sha256:bf5703fdeb350e36885f2875d853ce13172ae281c56e509f4e6eca049bdfb136 \ - --hash=sha256:c31f72b1b6624c9d863fc095da460802f43a7c6868c5dda140f51da24fd47d7b \ - --hash=sha256:c5cd603b575ebceca7da5a3a251e69561bec509e0b46e4993e1cac402b7247b8 \ - --hash=sha256:d2efee35b4b0a347e0d99d28e884dfd82797852d62fcd7ebdeee26f3ceb72cf3 \ - --hash=sha256:d462f28826f4657968ae51d2181a074dfe03c200d6131690b7d65d55b0f360f8 \ - --hash=sha256:d5e49454f19ef621089e204f862388d29e6e8d8b162efce05208913dde5b9ad6 \ - --hash=sha256:da4813f751142436b075ed7aa012a8778aa43a99f7b36afe9b742d3ed8bdc95e \ - --hash=sha256:db2e408d983b0e61e238cf579c09ef7020560441906ca990fe8412153e3b291f \ - --hash=sha256:db98ad84a55eb09b3c32a96c576476777e87c520a34e2519d3e59c44710c002c \ - --hash=sha256:dbed418ba5c3dce92619656802cc5355cb679e58d0d89b50f116e4a9d5a9603e \ - --hash=sha256:dcdba5c86e368442528f7060039eda390cc4091bfd1dca41e8046af7c910dda8 \ - --hash=sha256:decbfa2f618fa8ed81c95ee18a387ff973143c656ef800c9f24fb7e9c16054e2 \ - --hash=sha256:e4fdb9275308292e880dcbeb12546df7f3e0f96c6b41197e0cf37d2826359020 \ - --hash=sha256:eb1b046be06b0fce7249f1d025cd359b4b80fc1c3e24ad9eca33e0dcdb2e4a35 \ - --hash=sha256:eb6e651000a19c96f452c85132811d25e9264d836951022d6e81df2fff38337d \ - --hash=sha256:ed867c42c268f876097248e05b6117a65bcd1e63b779e916fe2e33cd6fd0d3c3 \ - --hash=sha256:edfad1d29c73f9b863ebe7082ae9321374ccb10879eeabc84ba3b69f2579d537 \ - --hash=sha256:f2058f813d4f2b5e3a9eb2eb3faf8f1d99b81c3e51aeda4b168406443e8ba809 \ - --hash=sha256:f6b2d0c6703c988d334f297aa5df18c45e97b0af3679bb75059e0e0bd8b1069d \ - --hash=sha256:f8212564d49c50eb4565e502814f694e240c55551a5f1bc841d4fcaabb0a9b8a \ - --hash=sha256:ffa565331890b90056c01db69c0fe634a776f8019c143a5ae265f9c6bc4bd6d4 - # via deprecated diff --git a/llvm/utils/git/requirements_formatting.txt b/llvm/utils/git/requirements_formatting.txt deleted file mode 100644 index 4c9dbd8755ab5..0000000000000 --- a/llvm/utils/git/requirements_formatting.txt +++ /dev/null @@ -1,52 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile --output-file=llvm/utils/git/requirements_formatting.txt llvm/utils/git/requirements_formatting.txt.in -# -black==23.12.1 - # via - # -r llvm/utils/git/requirements_formatting.txt.in - # darker -certifi==2024.2.2 - # via requests -cffi==1.16.0 - # via - # cryptography - # pynacl -charset-normalizer==3.3.2 - # via requests -click==8.1.7 - # via black -cryptography==42.0.5 - # via pyjwt -darker==1.7.2 - # via -r llvm/utils/git/requirements_formatting.txt.in -deprecated==1.2.14 - # via pygithub -idna==3.7 - # via requests -mypy-extensions==1.0.0 - # via black -packaging==24.0 - # via black -pathspec==0.12.1 - # via black -platformdirs==4.2.1 - # via black -pycparser==2.22 - # via cffi -pygithub==1.59.1 - # via -r llvm/utils/git/requirements_formatting.txt.in -pyjwt[crypto]==2.8.0 - # via pygithub -pynacl==1.5.0 - # via pygithub -requests==2.31.0 - # via pygithub -toml==0.10.2 - # via darker -urllib3==2.2.1 - # via requests -wrapt==1.16.0 - # via deprecated diff --git a/llvm/utils/gn/secondary/llvm/version.gni b/llvm/utils/gn/secondary/llvm/version.gni index 7c02ed396db5f..3f44a4645acf6 100644 --- a/llvm/utils/gn/secondary/llvm/version.gni +++ b/llvm/utils/gn/secondary/llvm/version.gni @@ -1,4 +1,4 @@ llvm_version_major = 19 -llvm_version_minor = 0 +llvm_version_minor = 1 llvm_version_patch = 0 llvm_version = "$llvm_version_major.$llvm_version_minor.$llvm_version_patch" diff --git a/llvm/utils/lit/lit/__init__.py b/llvm/utils/lit/lit/__init__.py index a5a1ff66bf417..03edfc3360972 100644 --- a/llvm/utils/lit/lit/__init__.py +++ b/llvm/utils/lit/lit/__init__.py @@ -2,7 +2,7 @@ __author__ = "Daniel Dunbar" __email__ = "daniel@minormatter.com" -__versioninfo__ = (19, 0, 0) +__versioninfo__ = (19, 1, 0) __version__ = ".".join(str(v) for v in __versioninfo__) + "dev" __all__ = [] diff --git a/llvm/utils/mlgo-utils/mlgo/__init__.py b/llvm/utils/mlgo-utils/mlgo/__init__.py index c5b208cfba360..09e95f3d62058 100644 --- a/llvm/utils/mlgo-utils/mlgo/__init__.py +++ b/llvm/utils/mlgo-utils/mlgo/__init__.py @@ -4,7 +4,7 @@ from datetime import timezone, datetime -__versioninfo__ = (19, 0, 0) +__versioninfo__ = (19, 1, 0) __version__ = ( ".".join(str(v) for v in __versioninfo__) + "dev" diff --git a/llvm/utils/release/build_llvm_release.bat b/llvm/utils/release/build_llvm_release.bat index 55b20c7c28ac1..3508748c1d540 100755 --- a/llvm/utils/release/build_llvm_release.bat +++ b/llvm/utils/release/build_llvm_release.bat @@ -151,6 +151,7 @@ set common_cmake_flags=^ -DCMAKE_BUILD_TYPE=Release ^ -DLLVM_ENABLE_ASSERTIONS=OFF ^ -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON ^ + -DLLVM_TARGETS_TO_BUILD="AArch64;ARM;X86" ^ -DLLVM_BUILD_LLVM_C_DYLIB=ON ^ -DCMAKE_INSTALL_UCRT_LIBRARIES=ON ^ -DPython3_FIND_REGISTRY=NEVER ^ @@ -192,6 +193,7 @@ REM Stage0 binaries directory; used in stage1. set "stage0_bin_dir=%build_dir%/build32_stage0/bin" set cmake_flags=^ %common_cmake_flags% ^ + -DLLVM_ENABLE_RPMALLOC=OFF ^ -DLLDB_TEST_COMPILER=%stage0_bin_dir%/clang.exe ^ -DPYTHON_HOME=%PYTHONHOME% ^ -DPython3_ROOT_DIR=%PYTHONHOME% ^ diff --git a/llvm/utils/release/bump-version.py b/llvm/utils/release/bump-version.py index abff67ae926ac..5db62e88fec1d 100755 --- a/llvm/utils/release/bump-version.py +++ b/llvm/utils/release/bump-version.py @@ -12,6 +12,9 @@ class Processor: + def __init__(self, args): + self.args = args + def process_line(self, line: str) -> str: raise NotImplementedError() @@ -23,6 +26,13 @@ def process_file(self, fpath: Path, version: packaging.version.Version) -> None: version.micro, version.pre, ) + + if self.args.rc: + self.suffix = f"-rc{self.args.rc}" + + if self.args.git: + self.suffix = "git" + data = fpath.read_text() new_data = [] @@ -64,7 +74,7 @@ def process_line(self, line: str) -> str: if self.suffix: nline = re.sub( r"set\(LLVM_VERSION_SUFFIX(.*)\)", - f"set(LLVM_VERSION_SUFFIX -{self.suffix[0]}{self.suffix[1]})", + f"set(LLVM_VERSION_SUFFIX {self.suffix})", line, ) else: @@ -144,6 +154,7 @@ def process_line(self, line: str) -> str: ) parser.add_argument("version", help="Version to bump to, e.g. 15.0.1", default=None) parser.add_argument("--rc", default=None, type=int, help="RC version") + parser.add_argument("--git", action="store_true", help="Git version") parser.add_argument( "-s", "--source-root", @@ -153,9 +164,10 @@ def process_line(self, line: str) -> str: args = parser.parse_args() + if args.rc and args.git: + raise RuntimeError("Can't specify --git and --rc at the same time!") + verstr = args.version - if args.rc: - verstr += f"-rc{args.rc}" # parse the version string with distutils. # note that -rc will end up as version.pre here @@ -170,20 +182,25 @@ def process_line(self, line: str) -> str: files_to_update = ( # Main CMakeLists. - (source_root / "llvm" / "CMakeLists.txt", CMakeProcessor()), + (source_root / "cmake" / "Modules" / "LLVMVersion.cmake", CMakeProcessor(args)), # Lit configuration ( "llvm/utils/lit/lit/__init__.py", - LitProcessor(), + LitProcessor(args), + ), + # mlgo-utils configuration + ( + "llvm/utils/mlgo-utils/mlgo/__init__.py", + LitProcessor(args), ), # GN build system ( "llvm/utils/gn/secondary/llvm/version.gni", - GNIProcessor(), + GNIProcessor(args), ), ( "libcxx/include/__config", - LibCXXProcessor(), + LibCXXProcessor(args), ), ) diff --git a/llvm/utils/release/get-llvm-version.sh b/llvm/utils/release/get-llvm-version.sh new file mode 100755 index 0000000000000..2183e2e0edacd --- /dev/null +++ b/llvm/utils/release/get-llvm-version.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash +#===-- get-llvm-version.sh - Get LLVM Version from sources -----------------===# +# +# 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 +# +#===------------------------------------------------------------------------===# +# +# Extract the current LLVM version from the CMake files. +# +#===------------------------------------------------------------------------===# + +cmake_file=$(dirname $0)/../../../cmake/Modules/LLVMVersion.cmake +function usage() { + echo "usage: `basename $0`" + echo "" + echo "Calling this script with now options will output the full version: e.g. 19.1.0" + echo " --cmake-file Path to cmake file with the version (default: $cmake_file) + echo " You can use at most one of the following options: + echo " --major Print the major version." + echo " --minor Print the minor version." + echo " --patch Print the patch version." +} + +print="" + +while [ $# -gt 0 ]; do + case $1 in + --cmake-file ) + shift + cmake_file="$1" + ;; + --major) + if [ -n "$print" ]; then + echo "Only one of --major, --minor, --patch is allowed" + exit 1 + fi + print="major" + ;; + --minor) + if [ -n "$print" ]; then + echo "Only one of --major, --minor, --patch is allowed" + exit 1 + fi + print="minor" + ;; + --patch) + if [ -n "$print" ]; then + echo "Only one of --major, --minor, --patch is allowed" + exit 1 + fi + print="patch" + ;; + --help | -h | -\? ) + usage + exit 0 + ;; + * ) + echo "unknown option: $1" + usage + exit 1 + ;; + esac + shift +done + +major=`grep -o 'LLVM_VERSION_MAJOR[[:space:]]\+\([0-9]\+\)' $cmake_file | grep -o '[0-9]\+'` +minor=`grep -o 'LLVM_VERSION_MINOR[[:space:]]\+\([0-9]\+\)' $cmake_file | grep -o '[0-9]\+'` +patch=`grep -o 'LLVM_VERSION_PATCH[[:space:]]\+\([0-9]\+\)' $cmake_file | grep -o '[0-9]\+'` + +case $print in + major) + echo "$major" + ;; + minor) + echo "$minor" + ;; + patch) + echo "$patch" + ;; + *) + echo "$major.$minor.$patch" + ;; +esac + diff --git a/llvm/utils/vscode/llvm/.npmrc b/llvm/utils/vscode/llvm/.npmrc new file mode 100644 index 0000000000000..8701ec2998ee7 --- /dev/null +++ b/llvm/utils/vscode/llvm/.npmrc @@ -0,0 +1 @@ +registry=https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/ diff --git a/llvm/version.txt.in b/llvm/version.txt.in new file mode 100644 index 0000000000000..a24f9877ac158 --- /dev/null +++ b/llvm/version.txt.in @@ -0,0 +1 @@ +@PACKAGE_VERSION@ diff --git a/mlir/utils/tree-sitter-mlir/.npmrc b/mlir/utils/tree-sitter-mlir/.npmrc new file mode 100644 index 0000000000000..33312472ae5bf --- /dev/null +++ b/mlir/utils/tree-sitter-mlir/.npmrc @@ -0,0 +1 @@ +registry=https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/ \ No newline at end of file diff --git a/mlir/utils/vscode/.npmrc b/mlir/utils/vscode/.npmrc new file mode 100644 index 0000000000000..8701ec2998ee7 --- /dev/null +++ b/mlir/utils/vscode/.npmrc @@ -0,0 +1 @@ +registry=https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/ diff --git a/nuget/Directory.Build.props b/nuget/Directory.Build.props new file mode 100644 index 0000000000000..728d73a75c5a6 --- /dev/null +++ b/nuget/Directory.Build.props @@ -0,0 +1,206 @@ + + + + + + + + + + + AnyCPU + + + <_parseDistroRid>$(__DistroRid) + <_parseDistroRid Condition="'$(_parseDistroRid)' == '' and '$(__BuildOS)' == 'OSX'">osx-$(Platform) + <_distroRidIndex>$(_parseDistroRid.IndexOfAny("-")) + <_archRidIndex>$([MSBuild]::Add($(_distroRidIndex), 1)) + $(_parseDistroRid.SubString(0, $(_distroRidIndex))) + linux + win10 + + $(_parseDistroRid.SubString($(_archRidIndex))) + $(Platform) + $(BuildArch) + + $(OSRid) + + Windows_NT;OSX;Android;Linux;FreeBSD + ;$(SupportedPackageOSGroups); + + + <_runtimeOSVersionIndex>$(RuntimeOS.IndexOfAny(".-0123456789")) + <_runtimeOSFamily Condition="'$(_runtimeOSVersionIndex)' != '-1'">$(RuntimeOS.SubString(0, $(_runtimeOSVersionIndex))) + <_runtimeOSFamily Condition="'$(_runtimeOSVersionIndex)' == '-1'">$(RuntimeOS) + <_isSupportedOSGroup>true + + + + + <_derivedPackageTargetOSGroup Condition="'$(_derivedPackageTargetOSGroup)' == '' and '$(_runtimeOSFamily)' == 'osx'">OSX + <_derivedPackageTargetOSGroup Condition="'$(_derivedPackageTargetOSGroup)' == '' and '$(_runtimeOSFamily)' == 'android'">Android + <_derivedPackageTargetOSGroup Condition="'$(_derivedPackageTargetOSGroup)' == '' and '$(_runtimeOSFamily)' == 'win'">Windows_NT + <_derivedPackageTargetOSGroup Condition="'$(_derivedPackageTargetOSGroup)' == '' and '$(_runtimeOSFamily)' == 'freebsd'">FreeBSD + <_derivedPackageTargetOSGroup Condition="'$(_derivedPackageTargetOSGroup)' == '' and '$(__BuildOS)' != ''">$(__BuildOS) + <_derivedPackageTargetOSGroup Condition="'$(_derivedPackageTargetOSGroup)' == ''">Linux + + <_isSupportedOSGroup Condition="!$(SupportedPackageOSGroups.Contains(';$(_derivedPackageTargetOSGroup);'))">false + + + + + <_packageTargetOSGroup>$(_derivedPackageTargetOSGroup) + <_packageTargetOSGroup Condition="'$(_derivedPackageTargetOSGroup)' == 'Android'">Linux + + + true + $(PackageOutputPath) + + + + true + + + + + + + + $(OutputRID) + + + + + + win-$(ArchGroup) + + + + + osx-$(ArchGroup) + + osx-$(ArchGroup) + + + + + freebsd-$(ArchGroup) + + freebsd-$(ArchGroup) + + + + + android.21-$(ArchGroup) + + android-$(ArchGroup) + + + + + $(OSRid)-$(ArchGroup) + + linux-$(ArchGroup) + + + + + $(RuntimeOS)-$(ArchGroup) + + linux-$(ArchGroup) + + + + + + + + + + .dylib + .dwarf + + + + + .so + + .debug + + + + + .so + .dbg + + + + + + + + + + arm + + + arm64 + + + arm64 + + + armel + + + armel + + + + + + + + + + + x86 + + + + arm + + + arm64 + + + + + + + amd64 + $(ArchGroup) + + + + + <_project Include="@(BuildRID)"> + amd64 + %(Identity) + PackageTargetRuntime=%(Identity);Platform=%(Platform) + + + <_buildRidProjects Include="@(_project->'$(MSBuildProjectName).pkgproj')" /> + + + + + + + + + diff --git a/nuget/Directory.Build.targets b/nuget/Directory.Build.targets new file mode 100644 index 0000000000000..f5aaa3315faa1 --- /dev/null +++ b/nuget/Directory.Build.targets @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + runtimes/$(PackageTargetRuntime)/native + + + + runtimes/$(PackageTargetRuntime)/lib/netstandard1.0 + + + tools + + + + + + + + + + + + + + + + + + + + + + + true + + + + + true + + + + + runtimes/$(PackageTargetRuntime)/native + true + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.JIT.Tools/Directory.Build.props b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/Directory.Build.props new file mode 100644 index 0000000000000..f4a1490ea1da5 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/Directory.Build.props @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.JIT.Tools/Microsoft.NETCore.Runtime.JIT.Tools.builds b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/Microsoft.NETCore.Runtime.JIT.Tools.builds new file mode 100644 index 0000000000000..eaae7d884d1c9 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/Microsoft.NETCore.Runtime.JIT.Tools.builds @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.JIT.Tools/Microsoft.NETCore.Runtime.JIT.Tools.pkgproj b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/Microsoft.NETCore.Runtime.JIT.Tools.pkgproj new file mode 100644 index 0000000000000..a574caec29e4f --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/Microsoft.NETCore.Runtime.JIT.Tools.pkgproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.JIT.Tools/runtime.FreeBSD.Microsoft.NETCore.Runtime.JIT.Tools.props b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/runtime.FreeBSD.Microsoft.NETCore.Runtime.JIT.Tools.props new file mode 100644 index 0000000000000..2bd12bbd01e47 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/runtime.FreeBSD.Microsoft.NETCore.Runtime.JIT.Tools.props @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.JIT.Tools/runtime.Linux.Microsoft.NETCore.Runtime.JIT.Tools.props b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/runtime.Linux.Microsoft.NETCore.Runtime.JIT.Tools.props new file mode 100644 index 0000000000000..7819e88686aba --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/runtime.Linux.Microsoft.NETCore.Runtime.JIT.Tools.props @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.JIT.Tools/runtime.OSX.Microsoft.NETCore.Runtime.JIT.Tools.props b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/runtime.OSX.Microsoft.NETCore.Runtime.JIT.Tools.props new file mode 100644 index 0000000000000..c4fb271a83161 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/runtime.OSX.Microsoft.NETCore.Runtime.JIT.Tools.props @@ -0,0 +1,7 @@ + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.JIT.Tools/runtime.Windows_NT.Microsoft.NETCore.Runtime.JIT.Tools.props b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/runtime.Windows_NT.Microsoft.NETCore.Runtime.JIT.Tools.props new file mode 100644 index 0000000000000..0efb2beedbf52 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.JIT.Tools/runtime.Windows_NT.Microsoft.NETCore.Runtime.JIT.Tools.props @@ -0,0 +1,7 @@ + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/Directory.Build.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/Directory.Build.props new file mode 100644 index 0000000000000..f4a1490ea1da5 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/Directory.Build.props @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.builds b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.builds new file mode 100644 index 0000000000000..eaae7d884d1c9 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.builds @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.pkgproj b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.pkgproj new file mode 100644 index 0000000000000..eb8cf7351b8e1 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.pkgproj @@ -0,0 +1,13 @@ + + + + + false + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/runtime.FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/runtime.FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.props new file mode 100644 index 0000000000000..e8a5844ef6f7a --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/runtime.FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.props @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/runtime.Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/runtime.Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.props new file mode 100644 index 0000000000000..4e65bf4153277 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/runtime.Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.props @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/runtime.OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/runtime.OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.props new file mode 100644 index 0000000000000..43873c8cb16f9 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/runtime.OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.props @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/runtime.Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/runtime.Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.props new file mode 100644 index 0000000000000..46d627ba8b08e --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Libclang/runtime.Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Libclang.props @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Directory.Build.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Directory.Build.props new file mode 100644 index 0000000000000..f4a1490ea1da5 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Directory.Build.props @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.Debug.builds b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.Debug.builds new file mode 100644 index 0000000000000..eaae7d884d1c9 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.Debug.builds @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.Debug.pkgproj b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.Debug.pkgproj new file mode 100644 index 0000000000000..10df842e48c1e --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.Debug.pkgproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.builds b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.builds new file mode 100644 index 0000000000000..eaae7d884d1c9 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.builds @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.pkgproj b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.pkgproj new file mode 100644 index 0000000000000..a574caec29e4f --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.pkgproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/runtime.FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/runtime.FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.props new file mode 100644 index 0000000000000..f6ad932032869 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/runtime.FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.props @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/runtime.Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/runtime.Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.props new file mode 100644 index 0000000000000..fbf98adad6dbd --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/runtime.Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.props @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/runtime.OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/runtime.OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.props new file mode 100644 index 0000000000000..81f1ea3a62338 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/runtime.OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.props @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/runtime.Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/runtime.Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.props new file mode 100644 index 0000000000000..e58d01f1bac10 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Sdk/runtime.Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.props @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Directory.Build.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Directory.Build.props new file mode 100644 index 0000000000000..f4a1490ea1da5 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Directory.Build.props @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Microsoft.NETCore.Runtime.Mono.LLVM.Tools.Debug.builds b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Microsoft.NETCore.Runtime.Mono.LLVM.Tools.Debug.builds new file mode 100644 index 0000000000000..eaae7d884d1c9 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Microsoft.NETCore.Runtime.Mono.LLVM.Tools.Debug.builds @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Microsoft.NETCore.Runtime.Mono.LLVM.Tools.Debug.pkgproj b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Microsoft.NETCore.Runtime.Mono.LLVM.Tools.Debug.pkgproj new file mode 100644 index 0000000000000..10df842e48c1e --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Microsoft.NETCore.Runtime.Mono.LLVM.Tools.Debug.pkgproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Microsoft.NETCore.Runtime.Mono.LLVM.Tools.builds b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Microsoft.NETCore.Runtime.Mono.LLVM.Tools.builds new file mode 100644 index 0000000000000..eaae7d884d1c9 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Microsoft.NETCore.Runtime.Mono.LLVM.Tools.builds @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Microsoft.NETCore.Runtime.Mono.LLVM.Tools.pkgproj b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Microsoft.NETCore.Runtime.Mono.LLVM.Tools.pkgproj new file mode 100644 index 0000000000000..a574caec29e4f --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/Microsoft.NETCore.Runtime.Mono.LLVM.Tools.pkgproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/runtime.FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Tools.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/runtime.FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Tools.props new file mode 100644 index 0000000000000..380e3ad2abc7d --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/runtime.FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Tools.props @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/runtime.Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Tools.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/runtime.Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Tools.props new file mode 100644 index 0000000000000..618c55664f811 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/runtime.Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Tools.props @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/runtime.OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Tools.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/runtime.OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Tools.props new file mode 100644 index 0000000000000..c2c6b0392785e --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/runtime.OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Tools.props @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/runtime.Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Tools.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/runtime.Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Tools.props new file mode 100644 index 0000000000000..cf9091a3ed976 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Tools/runtime.Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Tools.props @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Directory.Build.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Directory.Build.props new file mode 100644 index 0000000000000..f4a1490ea1da5 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Directory.Build.props @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.props new file mode 100644 index 0000000000000..0244bbb94f278 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.props @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.props new file mode 100644 index 0000000000000..0244bbb94f278 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.props @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.builds b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.builds new file mode 100644 index 0000000000000..eaae7d884d1c9 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.builds @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.pkgproj b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.pkgproj new file mode 100644 index 0000000000000..be55eebf48af8 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.pkgproj @@ -0,0 +1,14 @@ + + + + + false + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.props new file mode 100644 index 0000000000000..22d21e98612d6 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.props @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.props new file mode 100644 index 0000000000000..20abfd1a589fe --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport/Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport.props @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Directory.Build.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Directory.Build.props new file mode 100644 index 0000000000000..f4a1490ea1da5 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Directory.Build.props @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.props new file mode 100644 index 0000000000000..9eee0be2cfc26 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/FreeBSD.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.props @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.props new file mode 100644 index 0000000000000..23a0e45defccf --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Linux.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.props @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.builds b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.builds new file mode 100644 index 0000000000000..eaae7d884d1c9 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.builds @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.pkgproj b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.pkgproj new file mode 100644 index 0000000000000..be55eebf48af8 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.pkgproj @@ -0,0 +1,14 @@ + + + + + false + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.props new file mode 100644 index 0000000000000..78806e9fab0d3 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/OSX.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.props @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.props b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.props new file mode 100644 index 0000000000000..c8a76cbba6972 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport/Windows_NT.Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport.props @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Directory.Build.props b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Directory.Build.props new file mode 100644 index 0000000000000..f4a1490ea1da5 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Directory.Build.props @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/FreeBSD.Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.props b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/FreeBSD.Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.props new file mode 100644 index 0000000000000..650cdf6082e2d --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/FreeBSD.Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.props @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Linux.Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.props b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Linux.Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.props new file mode 100644 index 0000000000000..43f84ec784700 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Linux.Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.props @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.builds b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.builds new file mode 100644 index 0000000000000..eaae7d884d1c9 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.builds @@ -0,0 +1,4 @@ + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.pkgproj b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.pkgproj new file mode 100644 index 0000000000000..be55eebf48af8 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.pkgproj @@ -0,0 +1,14 @@ + + + + + false + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/OSX.Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.props b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/OSX.Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.props new file mode 100644 index 0000000000000..4ca975e2f0a61 --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/OSX.Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.props @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Windows_NT.Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.props b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Windows_NT.Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.props new file mode 100644 index 0000000000000..33e1432913d2a --- /dev/null +++ b/nuget/Microsoft.NETCore.Runtime.Wasm.LLVM.Transport/Windows_NT.Microsoft.NETCore.Runtime.Wasm.LLVM.Transport.props @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/builds.targets b/nuget/builds.targets new file mode 100644 index 0000000000000..6ff282b2577d9 --- /dev/null +++ b/nuget/builds.targets @@ -0,0 +1,31 @@ + + + + true + + + true + + + false + + + + + + + + <_projectsToBuild Include="@(Project)" Condition="'%(Project.PackageTargetRuntime)' == '$(PackageRID)'" /> + + + + <_projectsToBuild Include="@(Project)" Condition="'%(Project.PackageTargetRuntime)' == ''" /> + + + + + + + \ No newline at end of file diff --git a/nuget/descriptions.json b/nuget/descriptions.json new file mode 100644 index 0000000000000..b5bb999541e41 --- /dev/null +++ b/nuget/descriptions.json @@ -0,0 +1,57 @@ +[ + { + "Name": "RuntimePackage", + "Description": "Internal implementation package not meant for direct consumption. Please do not reference directly.", + "CommonTypes": [ ] + }, + { + "Name": "NuGet3MinVersion", + "Description": "When using NuGet 3.x this package requires at least version {0}.", + "CommonTypes": [ ] + }, + { + "Name": "Microsoft.NETCore.Runtime.Mono.LLVM.Libclang", + "Description": "The libclang library and Python bindings.", + "CommonTypes": [ ] + }, + { + "Name": "Microsoft.NETCore.Runtime.Mono.LLVM.Sdk", + "Description": "The .NET Core fork of the LLVM project, used to compile the Mono .NET Core runtime in LLVM JIT mode. Internal implementation package not meant for direct consumption. Please do not reference directly.", + "CommonTypes": [ ] + }, + { + "Name": "Microsoft.NETCore.Runtime.Mono.LLVM.Sdk.Debug", + "Description": "The .NET Core fork of the LLVM project, used to compile the Mono .NET Core runtime in LLVM JIT mode (Debug runtime). Internal implementation package not meant for direct consumption. Please do not reference directly.", + "CommonTypes": [ ] + }, + { + "Name": "Microsoft.NETCore.Runtime.Mono.LLVM.Tools", + "Description": "The llvm-as, llc and opt tools, used by the Mono .NET Core runtime in LLVM AOT mode.", + "CommonTypes": [ ] + }, + { + "Name": "Microsoft.NETCore.Runtime.Mono.LLVM.Tools.Debug", + "Description": "The llvm-as, llc and opt tools, used by the Mono .NET Core runtime in LLVM AOT mode (Debug runtime).", + "CommonTypes": [ ] + }, + { + "Name": "Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.A.Transport", + "Description": "Clang compiler and tools, used by the Mono .NET Core runtime to target WASI (Part 1).", + "CommonTypes": [ ] + }, + { + "Name": "Microsoft.NETCore.Runtime.Mono.LLVM.Wasm.B.Transport", + "Description": "Clang compiler and tools, used by the Mono .NET Core runtime to target WASI (Part 2).", + "CommonTypes": [ ] + }, + { + "Name": "Microsoft.NETCore.Runtime.JIT.Tools", + "Description": "Tools such as FileCheck and llvm-mca used for testing the .NET JIT compiler. Internal implementation package not meant for direct consumption. Please do not reference directly.", + "CommonTypes": [ ] + }, + { + "Name": "Microsoft.NETCore.Runtime.Wasm.LLVM.Transport", + "Description": "Clang compiler and tools, used by the Mono .NET Core runtime to target WebAssembly.", + "CommonTypes": [ ] + }, +] diff --git a/nuget/packageIndex.json b/nuget/packageIndex.json new file mode 100644 index 0000000000000..7a73a41bfdf76 --- /dev/null +++ b/nuget/packageIndex.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/nuget/packages.builds b/nuget/packages.builds new file mode 100644 index 0000000000000..34e21859dc115 --- /dev/null +++ b/nuget/packages.builds @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nuget/packaging.props b/nuget/packaging.props new file mode 100644 index 0000000000000..3424836526167 --- /dev/null +++ b/nuget/packaging.props @@ -0,0 +1,39 @@ + + + + + $(MSBuildThisFileDirectory)/descriptions.json + $(RepoRoot)/llvm/LICENSE.TXT + $(RepoRoot)/THIRD-PARTY-NOTICES.TXT + + https://go.microsoft.com/fwlink/?LinkID=799421 + + https://dot.net + https://github.com/dotnet/llvm-project/blob/dotnet/main/llvm/LICENSE.TXT + + $(MSBuildThisFileDirectory)/packageIndex.json + + + true + + + + + + + true + + + true + + + + + + true + + + diff --git a/openmp/runtime/src/z_Linux_asm.S b/openmp/runtime/src/z_Linux_asm.S index 5b614e26a8337..223ad091030e7 100644 --- a/openmp/runtime/src/z_Linux_asm.S +++ b/openmp/runtime/src/z_Linux_asm.S @@ -176,6 +176,53 @@ KMP_PREFIX_UNDERSCORE(\proc): .endm # endif // KMP_OS_DARWIN +# if KMP_OS_LINUX +// BTI and PAC gnu property note +# define NT_GNU_PROPERTY_TYPE_0 5 +# define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000 +# define GNU_PROPERTY_AARCH64_FEATURE_1_BTI 1 +# define GNU_PROPERTY_AARCH64_FEATURE_1_PAC 2 + +# define GNU_PROPERTY(type, value) \ + .pushsection .note.gnu.property, "a"; \ + .p2align 3; \ + .word 4; \ + .word 16; \ + .word NT_GNU_PROPERTY_TYPE_0; \ + .asciz "GNU"; \ + .word type; \ + .word 4; \ + .word value; \ + .word 0; \ + .popsection +# endif + +# if defined(__ARM_FEATURE_BTI_DEFAULT) +# define BTI_FLAG GNU_PROPERTY_AARCH64_FEATURE_1_BTI +# else +# define BTI_FLAG 0 +# endif +# if __ARM_FEATURE_PAC_DEFAULT & 3 +# define PAC_FLAG GNU_PROPERTY_AARCH64_FEATURE_1_PAC +# else +# define PAC_FLAG 0 +# endif + +# if (BTI_FLAG | PAC_FLAG) != 0 +# if PAC_FLAG != 0 +# define PACBTI_C hint #25 +# define PACBTI_RET hint #29 +# else +# define PACBTI_C hint #34 +# define PACBTI_RET +# endif +# define GNU_PROPERTY_BTI_PAC \ + GNU_PROPERTY(GNU_PROPERTY_AARCH64_FEATURE_1_AND, BTI_FLAG | PAC_FLAG) +# else +# define PACBTI_C +# define PACBTI_RET +# define GNU_PROPERTY_BTI_PAC +# endif #endif // (KMP_OS_LINUX || KMP_OS_DARWIN || KMP_OS_WINDOWS) && (KMP_ARCH_AARCH64 || KMP_ARCH_AARCH64_32 || KMP_ARCH_ARM) .macro COMMON name, size, align_power @@ -1296,6 +1343,7 @@ __tid = 8 // mark_begin; .text PROC __kmp_invoke_microtask + PACBTI_C stp x29, x30, [sp, #-16]! # if OMPT_SUPPORT @@ -1359,6 +1407,7 @@ KMP_LABEL(kmp_1): ldp x19, x20, [sp], #16 # endif ldp x29, x30, [sp], #16 + PACBTI_RET ret DEBUG_INFO __kmp_invoke_microtask @@ -2472,3 +2521,7 @@ __kmp_unnamed_critical_addr: .4byte .gomp_critical_user_ .size __kmp_unnamed_critical_addr, 4 #endif + +#if KMP_OS_LINUX && (KMP_ARCH_AARCH64 || KMP_ARCH_AARCH64_32) +GNU_PROPERTY_BTI_PAC +#endif diff --git a/polly/lib/External/isl/imath/tests/linux/Dockerfile b/polly/lib/External/isl/imath/tests/linux/Dockerfile deleted file mode 100644 index 50e1a91e8f530..0000000000000 --- a/polly/lib/External/isl/imath/tests/linux/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -# Build IMath and run tests with GCC on Linux. -# -# Usage (from the imath root): -# -# docker run --rm -it "$(docker build -f tests/linux/Dockerfile -q .)" -# -FROM alpine:latest AS base - -RUN apk add --no-cache bash build-base gcc gmp-dev make python2 - -FROM base AS test -COPY . /imath -WORKDIR /imath -CMD make distclean examples check diff --git a/utils/bazel/.bazelignore b/utils/bazel/.bazelignore deleted file mode 100644 index 1463bcc9c490e..0000000000000 --- a/utils/bazel/.bazelignore +++ /dev/null @@ -1,2 +0,0 @@ -llvm-project-overlay -examples diff --git a/utils/bazel/.bazelrc b/utils/bazel/.bazelrc deleted file mode 100644 index 975667f8fa811..0000000000000 --- a/utils/bazel/.bazelrc +++ /dev/null @@ -1,211 +0,0 @@ -# This file is licensed 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 - -############################################################################### -# Common flags that apply to all configurations. -# Use sparingly for things common to all compilers and platforms. -############################################################################### -# Prevent invalid caching if input files are modified during a build. -build --experimental_guard_against_concurrent_changes - -# Automatically enable --config=(linux|macos|windows) based on the host -build --enable_platform_specific_config - -# In opt mode, bazel by default builds both PIC and non-PIC object files for -# tests vs binaries. We don't need this feature and it slows down opt builds -# considerably. -# TODO: Remove platform specifics we're on bazel 7.x https://github.com/bazelbuild/bazel/issues/12439 -# Apple platforms always enable pic so this flag is unnecessary anyways -build:linux --force_pic -build:windows --force_pic - -# Shared objects take up more space. With fast linkers and binaries that aren't -# super large, the benefits of shared objects are minimal. -build --dynamic_mode=off - -# Rely on compiler flags to compile with debug info/strip rather than stripping -# based on compilation_mode. -build --strip=never - -# Add layering check to all projects. -build --features=layering_check - -# Opt out of legacy lax behavior implicitly exporting files that are rule inputs -# with default visibility. -# See: https://bazel.build/reference/be/functions#exports_files -build --incompatible_no_implicit_file_export - -# Enable so downstream users can flip this flag globally, this should -# eventually become the default -common --incompatible_disallow_empty_glob - -# TODO: Remove once we move to bazel 7.x -build --experimental_cc_shared_library - -############################################################################### -# Options to select different strategies for linking potential dependent -# libraries. The default leaves it disabled. -############################################################################### - -build:zlib_external --repo_env=BAZEL_LLVM_ZLIB_STRATEGY=external -build:zlib_system --repo_env=BAZEL_LLVM_ZLIB_STRATEGY=system - -############################################################################### -# Options for "generic_clang" builds: these options should generally apply to -# builds using a Clang-based compiler, and default to the `clang` executable on -# the `PATH`. While these are provided for convenience and may serve as a -# reference, it would be preferable for users to configure an explicit C++ -# toolchain instead of relying on `.bazelrc` files. -############################################################################### - -# Set the default compiler to the `clang` binary on the `PATH`. -build:generic_clang --repo_env=CC=clang - -# C++17 standard version is required. -build:generic_clang --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 - -# Use `-Wall` for Clang. -build:generic_clang --copt=-Wall --host_copt=-Wall - -# The Clang available on MacOS has a warning that isn't clean on MLIR code. The -# warning doesn't show up with more recent Clangs, so just disable for now. -build:generic_clang --cxxopt=-Wno-range-loop-analysis --host_cxxopt=-Wno-range-loop-analysis - -# Build errors are not a helpful way to enforce deprecation in-repo and it is -# not the point of the Bazel build to catch usage of deprecated APIs. -build:generic_clang --copt=-Wno-deprecated --host_copt=-Wno-deprecated - -# lld links faster than other linkers. Assume that anybody using clang also has -# lld available. -build:generic_clang --linkopt=-fuse-ld=lld --host_linkopt=-fuse-ld=lld - -############################################################################### -# Options for "generic_gcc" builds: these options should generally apply to -# builds using a GCC-based compiler, and default to the `gcc` executable on -# the `PATH`. While these are provided for convenience and may serve as a -# reference, it would be preferable for users to configure an explicit C++ -# toolchain instead of relying on `.bazelrc` files. -############################################################################### - -# Set the default compiler to the `gcc` binary on the `PATH`. -build:generic_gcc --repo_env=CC=gcc - -# C++17 standard version is required. -build:generic_gcc --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 - -# Build errors are not a helpful way to enforce deprecation in-repo and it is -# not the point of the Bazel build to catch usage of deprecated APIs. -build:generic_gcc --copt=-Wno-deprecated --host_copt=-Wno-deprecated - -# Disable GCC warnings that are noisy and/or false positives on LLVM code. -# These need to be global as some code triggering these is in header files. -build:generic_gcc --copt=-Wno-unused-parameter --host_copt=-Wno-unused-parameter -build:generic_gcc --copt=-Wno-comment --host_copt=-Wno-comment -build:generic_gcc --cxxopt=-Wno-class-memaccess --host_cxxopt=-Wno-class-memaccess -build:generic_gcc --copt=-Wno-maybe-uninitialized --host_copt=-Wno-maybe-uninitialized -build:generic_gcc --copt=-Wno-misleading-indentation --host_copt=-Wno-misleading-indentation - -############################################################################### -# Generic Windows flags common to both MSVC and Clang. -############################################################################### - -# C++17 standard version is required. -build:windows --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 - -# Other generic dialect flags. -build:windows --copt=/Zc:strictStrings --host_copt=/Zc:strictStrings -build:windows --copt=/Oi --host_copt=/Oi -build:windows --cxxopt=/Zc:rvalueCast --host_cxxopt=/Zc:rvalueCast - -# Use the more flexible bigobj format for C++ files that have lots of symbols. -build:windows --cxxopt=/bigobj --host_cxxopt=/bigobj - -############################################################################### -# Windows specific flags for building with MSVC. -############################################################################### - -build:msvc --config=windows - -build:msvc --copt=/WX --host_copt=/WX # Treat warnings as errors... -# ...but disable the ones that are violated -build:msvc --copt=/wd4141 --host_copt=/wd4141 # inline used more than once -build:msvc --copt=/wd4244 --host_copt=/wd4244 # conversion type -> type -build:msvc --copt=/wd4267 --host_copt=/wd4267 # conversion size_t -> type -build:msvc --copt=/wd4273 --host_copt=/wd4273 # multiple definitions with different dllimport -build:msvc --copt=/wd4319 --host_copt=/wd4319 # zero-extending after complement -build:msvc --copt=/wd4624 --host_copt=/wd4624 # destructor was implicitly defined as deleted -build:msvc --copt=/wd4804 --host_copt=/wd4804 # comparisons between bool and int -build:msvc --copt=/wd4805 --host_copt=/wd4805 # comparisons between bool and int - -build:msvc --linkopt=/WX --host_linkopt=/WX # Treat warnings as errors... -# ...but disable the ones that are violated. -build:msvc --linkopt=/IGNORE:4001 --host_linkopt=/IGNORE:4001 # no object files - -############################################################################### -# Options for Windows `clang-cl` builds. -############################################################################### - -# We just start with the baseline Windows config as `clang-cl` doesn't accept -# some of the generic Clang flags. -build:clang-cl --config=windows - -# Switch from MSVC to the `clang-cl` compiler. -build:clang-cl --compiler=clang-cl - -# Use Clang's internal warning flags instead of the ones that sometimes map -# through to MSVC's flags. -build:clang-cl --copt=/clang:-Wall --host_copt=/clang:-Wall -build:clang-cl --copt=/clang:-Werror --host_copt=/clang:-Werror - -# This doesn't appear to be enforced by any upstream bot. -build:clang-cl --copt=/clang:-Wno-unused --host_copt=/clang:-Wno-unused - -# There appears to be an unused constant in GoogleTest on Windows. -build:clang-cl --copt=/clang:-Wno-unused-const-variable --host_copt=/clang:-Wno-unused-const-variable - -# Disable some warnings hit even with `clang-cl` in Clang's own code. -build:clang-cl --copt=/clang:-Wno-inconsistent-dllimport --host_copt=/clang:-Wno-inconsistent-dllimport -build:clang-cl --cxxopt=/clang:-Wno-c++11-narrowing --host_cxxopt=/clang:-Wno-c++11-narrowing - -############################################################################### -# Options for continuous integration. -############################################################################### - -# -O1 tries to provide a reasonable tradeoff between compile times and runtime -# performance. However, if we start running more tests (e.g. all of -# check-clang) we may want more optimizations. -# Note for anybody considering using --compilation_mode=opt in CI, it builds -# most files twice, one PIC version for shared libraries in tests, and one -# non-PIC version for binaries. -build:ci --copt=-O1 - -# Use clang. -build:ci --config=generic_clang - -# Speedup bazel using a ramdisk. -build:ci --sandbox_base=/dev/shm - -# Use system's mpfr and pfm instead of building it from source. -# This is non hermetic but helps with compile time. -build:ci --@llvm-project//libc:mpfr=system -build:ci --@llvm-project//llvm:pfm=system - -# Don't build/test targets tagged with "nobuildkite". -build:ci --build_tag_filters=-nobuildkite -build:ci --test_tag_filters=-nobuildkite - -# Show as many errors as possible. -build:ci --keep_going - -# Show test errors. -build:ci --test_output=errors - -# Only show failing tests to reduce output -build:ci --test_summary=terse - -############################################################################### - -# The user.bazelrc file is not checked in but available for local mods. -# Always keep this at the end of the file so that user flags override. -try-import %workspace%/user.bazelrc diff --git a/utils/bazel/.bazelversion b/utils/bazel/.bazelversion deleted file mode 100644 index 5e3254243a3b2..0000000000000 --- a/utils/bazel/.bazelversion +++ /dev/null @@ -1 +0,0 @@ -6.1.2 diff --git a/utils/bazel/.gitignore b/utils/bazel/.gitignore deleted file mode 100644 index 6bb9fd1ef0a2a..0000000000000 --- a/utils/bazel/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# Bazel artifacts -**/bazel-* - -# Per-user bazelrc files -user.bazelrc diff --git a/utils/bazel/BUILD.bazel b/utils/bazel/BUILD.bazel deleted file mode 100644 index dd837093c62ac..0000000000000 --- a/utils/bazel/BUILD.bazel +++ /dev/null @@ -1,5 +0,0 @@ -# This file is licensed 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 - -# Required to reference .bzl files in this package diff --git a/utils/bazel/README.md b/utils/bazel/README.md deleted file mode 100644 index d3e7f15f17683..0000000000000 --- a/utils/bazel/README.md +++ /dev/null @@ -1,116 +0,0 @@ -# Introduction - -*Warning* The Bazel build is experimental and best-effort, supported in line -with the policy for -[LLVM's peripheral support tier](https://llvm.org/docs/SupportPolicy.html). -LLVM's official build system is CMake. If in doubt use that. If you make changes -to LLVM, you're expected to update the CMake build but you don't need to update -Bazel build files. Reviewers should not ask authors to update Bazel build files -unless the author has opted in to support Bazel. Keeping the Bazel build files -up-to-date is on the people who use the Bazel build. - -[Bazel](https://bazel.build/) is a multi-language build system focused on -reproducible builds to enable dependency analysis and caching for fast -incremental builds. - -The main motivation behind the existence of an LLVM Bazel build is that a number -of projects that depend on LLVM use Bazel, and Bazel works best when it knows -about the whole source tree (as opposed to installing artifacts coming from -another build system). Community members are also welcome to use Bazel for their -own development as long as they continue to maintain the official CMake build -system. See also, the -[proposal](https://github.com/llvm/llvm-www/blob/main/proposals/LP0002-BazelBuildConfiguration.md) -for adding this configuration. - -# Quick Start - -1. `git clone https://github.com/llvm/llvm-project.git; cd llvm-project` if - you don't have a checkout yet. -2. Install Bazel at the version indicated by [.bazelversion](./.bazelversion), - following the official instructions, if you don't have it installed yet: - https://docs.bazel.build/versions/main/install.html. - * You can also install and use - [bazelisk](https://github.com/bazelbuild/bazelisk) which automates - downloading the proper bazel version -3. `cd utils/bazel` -4. The `bazel build` command depends on the local compiler you want to use. - * For **clang**, go to step 5. - * For **gcc** or **MSVC**, go to step 6 -5. If you are using **clang**, it is expected that lld is also available. - The `--config=generic_clang` flag by default sets the compiler to be `clang` - binary on the `PATH`. - ``` - bazel build --config=generic_clang @llvm-project//... - ``` - To provide a specific path to your `clang`, use the `--repo_env` Bazel flag. - For example: - ``` - bazel build --config=generic_clang --repo_env=CC=/usr/bin/clang --repo_env=CXX=/usr/bin/clang++ @llvm-project//... - ``` -6. If you are using **gcc** or **MSVC**, instead of `--config=generic_clang` - , pass `--config=generic_gcc` or `--config=generic_msvc`, which sets the - compiler to be `gcc` binary on the `PATH`. - ``` - bazel build --config=generic_gcc @llvm-project//... - ``` - To provide a specific path to your `gcc`, use the `--repo_env` Bazel flag. - For example: - ``` - bazel build --config=generic_gcc --repo_env=CC=/usr/bin/gcc --repo_env=CXX=/usr/bin/g++ @llvm-project//... - ``` - -# Configuration - -The repository `.bazelrc` will import user-specific settings from a -`user.bazelrc` file (in addition to the standard locations). Adding your typical -config setting is recommended. - -```.bazelrc -build --config=generic_clang -``` - -You can enable -[disk caching](https://docs.bazel.build/versions/main/remote-caching.html#disk-cache), -which will cache build results - -```.bazelrc -build --disk_cache=~/.cache/bazel-disk-cache -``` - -You can instruct Bazel to use a ramdisk for its sandboxing operations via -[--sandbox_base](https://docs.bazel.build/versions/main/command-line-reference.html#flag--sandbox_base), -which can help avoid IO bottlenecks for the symlink strategy used for -sandboxing. This is especially important with many inputs and many cores (see -https://github.com/bazelbuild/bazel/issues/11868): - -```.bazelrc -build --sandbox_base=/dev/shm -``` - -Bear in mind that this requires that your ramdisk is of sufficient size to hold -any temporary files. Anecdotally, 1GB should be sufficient. - -# Coverage - -The LLVM, MLIR, and Clang subprojects have configurations for Linux (Clang and -GCC), Mac (Clang and GCC), and Windows (MSVC). Configuration options that are -platform-specific are selected for in defines. Many are also hardcoded to the -values currently used by all supported configurations. If there is a -configuration you'd like to use that isn't supported, please send a patch. - -# Continuous Testing - -A [Buildkite pipeline](https://buildkite.com/llvm-project/upstream-bazel) -runs the full Bazel build on every commit to the main branch. Notifications of -failures are sent to the -[llvm-bazel-alerts google group](https://groups.google.com/g/llvm-bazel-alerts), -which anyone is free to join. Currently, the behavior is just to send an email -on each failure using Buildkite's built-in notification system, so if you -subscribe, it is highly recommended that you set up email filters or some other -mechanism to not flood your inbox. More sophisticated notifications, e.g. only -on status change or routed based on blamelist are TODO (contributions welcome). - -# Usage in Downstream Projects - -To use in dependent projects using Bazel, you can import LLVM and then use the -provided configuration rule. See example usage in the `examples/` directory. diff --git a/utils/bazel/WORKSPACE b/utils/bazel/WORKSPACE deleted file mode 100644 index 7baca11eed3d3..0000000000000 --- a/utils/bazel/WORKSPACE +++ /dev/null @@ -1,158 +0,0 @@ -# This file is licensed 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 - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") - -SKYLIB_VERSION = "1.3.0" - -http_archive( - name = "bazel_skylib", - sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), - "https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), - ], -) - -new_local_repository( - name = "llvm-raw", - build_file_content = "# empty", - path = "../../", -) - -load("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure") - -llvm_configure(name = "llvm-project") - -maybe( - http_archive, - name = "rules_python", - sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618", - strip_prefix = "rules_python-0.34.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz", -) - -maybe( - http_archive, - name = "llvm_zlib", - build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD", - sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731", - strip_prefix = "zlib-ng-2.0.7", - urls = [ - "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip", - ], -) - -maybe( - http_archive, - name = "vulkan_headers", - build_file = "@llvm-raw//utils/bazel/third_party_build:vulkan_headers.BUILD", - sha256 = "19f491784ef0bc73caff877d11c96a48b946b5a1c805079d9006e3fbaa5c1895", - strip_prefix = "Vulkan-Headers-9bd3f561bcee3f01d22912de10bb07ce4e23d378", - urls = [ - "https://github.com/KhronosGroup/Vulkan-Headers/archive/9bd3f561bcee3f01d22912de10bb07ce4e23d378.tar.gz", - ], -) - -load("@llvm-raw//utils/bazel:vulkan_sdk.bzl", "vulkan_sdk_setup") - -maybe( - vulkan_sdk_setup, - name = "vulkan_sdk", -) - -http_archive( - name = "build_bazel_apple_support", - sha256 = "c4bb2b7367c484382300aee75be598b92f847896fb31bbd22f3a2346adf66a80", - url = "https://github.com/bazelbuild/apple_support/releases/download/1.15.1/apple_support.1.15.1.tar.gz", -) - -load( - "@build_bazel_apple_support//lib:repositories.bzl", - "apple_support_dependencies", -) - -apple_support_dependencies() - -# llvm libc math tests reply on `mpfr`. -# The availability of `mpfr` is controlled by a flag and can be either `disable`, `system` or `external`. -# Continuous integration uses `system` to speed up the build process (see .bazelrc). -# Otherwise by default it is set to `external`: `mpfr` and `gmp` are built from source by using `rules_foreign_cc`. -# Note: that building from source requires `m4` to be installed on the host machine. -# This is a known issue: https://github.com/bazelbuild/rules_foreign_cc/issues/755. - -http_archive( - name = "rules_foreign_cc", - sha256 = "4b33d62cf109bcccf286b30ed7121129cc34cf4f4ed9d8a11f38d9108f40ba74", - strip_prefix = "rules_foreign_cc-0.11.1", - url = "https://github.com/bazelbuild/rules_foreign_cc/releases/download/0.11.1/rules_foreign_cc-0.11.1.tar.gz", -) - -load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies") - -rules_foreign_cc_dependencies() - -maybe( - http_archive, - name = "gmp", - build_file = "@llvm-raw//utils/bazel/third_party_build:gmp.BUILD", - sha256 = "fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2", - strip_prefix = "gmp-6.2.1", - urls = [ - "https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz", - "https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz", - ], -) - -# https://www.mpfr.org/mpfr-current/ -# -# When updating to a newer version, don't use URLs with "mpfr-current" in them. -# Instead, find a stable URL like the one used currently. -maybe( - http_archive, - name = "mpfr", - build_file = "@llvm-raw//utils/bazel/third_party_build:mpfr.BUILD", - sha256 = "9cbed5d0af0d9ed5e9f8dd013e17838eb15e1db9a6ae0d371d55d35f93a782a7", - strip_prefix = "mpfr-4.1.1", - urls = ["https://www.mpfr.org/mpfr-4.1.1/mpfr-4.1.1.tar.gz"], -) - -maybe( - http_archive, - name = "pfm", - build_file = "@llvm-raw//utils/bazel/third_party_build:pfm.BUILD", - sha256 = "d18b97764c755528c1051d376e33545d0eb60c6ebf85680436813fa5b04cc3d1", - strip_prefix = "libpfm-4.13.0", - urls = ["https://versaweb.dl.sourceforge.net/project/perfmon2/libpfm4/libpfm-4.13.0.tar.gz"], -) - -maybe( - http_archive, - name = "llvm_zstd", - build_file = "@llvm-raw//utils/bazel/third_party_build:zstd.BUILD", - sha256 = "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0", - strip_prefix = "zstd-1.5.2", - urls = [ - "https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz", - ], -) - -maybe( - http_archive, - name = "pybind11", - build_file = "@llvm-raw//utils/bazel/third_party_build:pybind.BUILD", - sha256 = "201966a61dc826f1b1879a24a3317a1ec9214a918c8eb035be2f30c3e9cfbdcb", - strip_prefix = "pybind11-2.10.3", - url = "https://github.com/pybind/pybind11/archive/v2.10.3.zip", -) - -load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") - -py_repositories() - -python_register_toolchains( - name = "python_3_12", - python_version = "3.12", -) diff --git a/utils/bazel/configure.bzl b/utils/bazel/configure.bzl deleted file mode 100644 index 717b86d7d6e8a..0000000000000 --- a/utils/bazel/configure.bzl +++ /dev/null @@ -1,188 +0,0 @@ -# This file is licensed 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 - -"""Helper macros to configure the LLVM overlay project.""" - -# Directory of overlay files relative to WORKSPACE -DEFAULT_OVERLAY_PATH = "llvm-project-overlay" - -DEFAULT_TARGETS = [ - "AArch64", - "AMDGPU", - "ARM", - "AVR", - "BPF", - "Hexagon", - "Lanai", - "LoongArch", - "Mips", - "MSP430", - "NVPTX", - "PowerPC", - "RISCV", - "Sparc", - "SystemZ", - "VE", - "WebAssembly", - "X86", - "XCore", -] - -def _overlay_directories(repository_ctx): - src_path = repository_ctx.path(Label("@llvm-raw//:WORKSPACE")).dirname - bazel_path = src_path.get_child("utils").get_child("bazel") - overlay_path = bazel_path.get_child("llvm-project-overlay") - script_path = bazel_path.get_child("overlay_directories.py") - - python_bin = repository_ctx.which("python3") - if not python_bin: - # Windows typically just defines "python" as python3. The script itself - # contains a check to ensure python3. - python_bin = repository_ctx.which("python") - - if not python_bin: - fail("Failed to find python3 binary") - - cmd = [ - python_bin, - script_path, - "--src", - src_path, - "--overlay", - overlay_path, - "--target", - ".", - ] - exec_result = repository_ctx.execute(cmd, timeout = 20) - - if exec_result.return_code != 0: - fail(("Failed to execute overlay script: '{cmd}'\n" + - "Exited with code {return_code}\n" + - "stdout:\n{stdout}\n" + - "stderr:\n{stderr}\n").format( - cmd = " ".join([str(arg) for arg in cmd]), - return_code = exec_result.return_code, - stdout = exec_result.stdout, - stderr = exec_result.stderr, - )) - -def _extract_cmake_settings(repository_ctx, llvm_cmake): - # The list to be written to vars.bzl - # `CMAKE_CXX_STANDARD` may be used from WORKSPACE for the toolchain. - c = { - "CMAKE_CXX_STANDARD": None, - "LLVM_VERSION_MAJOR": None, - "LLVM_VERSION_MINOR": None, - "LLVM_VERSION_PATCH": None, - "LLVM_VERSION_SUFFIX": None, - } - - # It would be easier to use external commands like sed(1) and python. - # For portability, the parser should run on Starlark. - llvm_cmake_path = repository_ctx.path(Label("//:" + llvm_cmake)) - for line in repository_ctx.read(llvm_cmake_path).splitlines(): - # Extract "set ( FOO bar ... " - setfoo = line.partition("(") - if setfoo[1] != "(": - continue - if setfoo[0].strip().lower() != "set": - continue - - # `kv` is assumed as \s*KEY\s+VAL\s*\).* - # Typical case is like - # LLVM_REQUIRED_CXX_STANDARD 17) - # Possible case -- It should be ignored. - # CMAKE_CXX_STANDARD ${...} CACHE STRING "...") - kv = setfoo[2].strip() - i = kv.find(" ") - if i < 0: - continue - k = kv[:i] - - # Prefer LLVM_REQUIRED_CXX_STANDARD instead of CMAKE_CXX_STANDARD - if k == "LLVM_REQUIRED_CXX_STANDARD": - k = "CMAKE_CXX_STANDARD" - c[k] = None - if k not in c: - continue - - # Skip if `CMAKE_CXX_STANDARD` is set with - # `LLVM_REQUIRED_CXX_STANDARD`. - # Then `v` will not be desired form, like "${...} CACHE" - if c[k] != None: - continue - - # Pick up 1st word as the value. - # Note: It assumes unquoted word. - v = kv[i:].strip().partition(")")[0].partition(" ")[0] - c[k] = v - - # Synthesize `LLVM_VERSION` for convenience. - c["LLVM_VERSION"] = "{}.{}.{}".format( - c["LLVM_VERSION_MAJOR"], - c["LLVM_VERSION_MINOR"], - c["LLVM_VERSION_PATCH"], - ) - - c["PACKAGE_VERSION"] = "{}.{}.{}{}".format( - c["LLVM_VERSION_MAJOR"], - c["LLVM_VERSION_MINOR"], - c["LLVM_VERSION_PATCH"], - c["LLVM_VERSION_SUFFIX"], - ) - - return c - -def _write_dict_to_file(repository_ctx, filepath, header, vars): - # (fci + individual vars) + (fcd + dict items) + (fct) - fci = header - fcd = "\nllvm_vars={\n" - fct = "}\n" - - for k, v in vars.items(): - fci += '{} = "{}"\n'.format(k, v) - fcd += ' "{}": "{}",\n'.format(k, v) - - repository_ctx.file(filepath, content = fci + fcd + fct) - -def _llvm_configure_impl(repository_ctx): - _overlay_directories(repository_ctx) - - llvm_cmake = "llvm/CMakeLists.txt" - vars = _extract_cmake_settings( - repository_ctx, - llvm_cmake, - ) - - # Grab version info and merge it with the other vars - version = _extract_cmake_settings( - repository_ctx, - "cmake/Modules/LLVMVersion.cmake", - ) - version = {k: v for k, v in version.items() if v != None} - vars.update(version) - - _write_dict_to_file( - repository_ctx, - filepath = "vars.bzl", - header = "# Generated from {}\n\n".format(llvm_cmake), - vars = vars, - ) - - # Create a starlark file with the requested LLVM targets. - targets = repository_ctx.attr.targets - repository_ctx.file( - "llvm/targets.bzl", - content = "llvm_targets = " + str(targets), - executable = False, - ) - -llvm_configure = repository_rule( - implementation = _llvm_configure_impl, - local = True, - configure = True, - attrs = { - "targets": attr.string_list(default = DEFAULT_TARGETS), - }, -) diff --git a/utils/bazel/examples/http_archive/WORKSPACE b/utils/bazel/examples/http_archive/WORKSPACE deleted file mode 100644 index 94dffa7fa63ae..0000000000000 --- a/utils/bazel/examples/http_archive/WORKSPACE +++ /dev/null @@ -1,64 +0,0 @@ -# This file is licensed 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 - -"""An example WORKSPACE for configuring LLVM using http_archive.""" - -workspace(name = "http_archive_example") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -SKYLIB_VERSION = "1.0.3" - -http_archive( - name = "bazel_skylib", - sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), - "https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), - ], -) - -# Replace with the LLVM commit you want to use. -LLVM_COMMIT = "926f85db98aae66ab8f57b9981f47ddddb868c51" - -# The easiest way to calculate this for a new commit is to set it to empty and -# then run a bazel build and it will report the digest necessary to cache the -# archive and make the build reproducible. -LLVM_SHA256 = "c78c94b2a03b2cf6ef1ba035c31a6f1b0bb7913da8af5aa8d5c2061f6499d589" - -http_archive( - name = "llvm-raw", - build_file_content = "# empty", - sha256 = LLVM_SHA256, - strip_prefix = "llvm-project-" + LLVM_COMMIT, - urls = ["https://github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT)], -) - -load("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure") - -llvm_configure(name = "llvm-project") - -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") - -maybe( - http_archive, - name = "llvm_zlib", - build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD", - sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731", - strip_prefix = "zlib-ng-2.0.7", - urls = [ - "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip", - ], -) - -maybe( - http_archive, - name = "llvm_zstd", - build_file = "@llvm-raw//utils/bazel/third_party_build:zstd.BUILD", - sha256 = "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0", - strip_prefix = "zstd-1.5.2", - urls = [ - "https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz", - ], -) diff --git a/utils/bazel/examples/submodule/WORKSPACE b/utils/bazel/examples/submodule/WORKSPACE deleted file mode 100644 index d6f0a5db91c99..0000000000000 --- a/utils/bazel/examples/submodule/WORKSPACE +++ /dev/null @@ -1,55 +0,0 @@ -# This file is licensed 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 - -"""An example WORKSPACE for configuring LLVM using a git submodule.""" - -workspace(name = "submodule_example") - -SKYLIB_VERSION = "1.0.3" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "bazel_skylib", - sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), - "https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), - ], -) - -new_local_repository( - name = "llvm-raw", - build_file_content = "# empty", - # Or wherever your submodule is located. - path = "third_party/llvm-project", -) - -load("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure") - -llvm_configure(name = "llvm-project") - -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") - -maybe( - http_archive, - name = "llvm_zlib", - build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD", - sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731", - strip_prefix = "zlib-ng-2.0.7", - urls = [ - "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip", - ], -) - -maybe( - http_archive, - name = "llvm_zstd", - build_file = "@llvm-raw//utils/bazel/third_party_build:zstd.BUILD", - sha256 = "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0", - strip_prefix = "zstd-1.5.2", - urls = [ - "https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz", - ], -) diff --git a/utils/bazel/llvm-project-overlay/.bazelignore b/utils/bazel/llvm-project-overlay/.bazelignore deleted file mode 100644 index f3d19a94233d6..0000000000000 --- a/utils/bazel/llvm-project-overlay/.bazelignore +++ /dev/null @@ -1,6 +0,0 @@ -# Ignore the utils/bazel directory when this is overlayed onto the repo root. -utils/bazel -# Ignore third-party projects. These should be configured separately and some -# include Bazel configs. -libcxx/utils/google-benchmark -third-party/benchmark diff --git a/utils/bazel/llvm-project-overlay/bolt/BUILD.bazel b/utils/bazel/llvm-project-overlay/bolt/BUILD.bazel deleted file mode 100644 index a1c089a89db87..0000000000000 --- a/utils/bazel/llvm-project-overlay/bolt/BUILD.bazel +++ /dev/null @@ -1,310 +0,0 @@ -# This file is licensed 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 - -load("@bazel_skylib//rules:expand_template.bzl", "expand_template") - -package( - default_visibility = ["//visibility:public"], -) - -licenses(["notice"]) - -cc_binary( - name = "llvm-bolt-heatmap", - srcs = glob([ - "tools/heatmap/*.cpp", - ]), - deps = [ - ":Profile", - ":Rewrite", - ":Utils", - "//llvm:AllTargetsAsmParsers", - "//llvm:AllTargetsDisassemblers", - "//llvm:MC", - "//llvm:Object", - "//llvm:Support", - ], -) - -cc_binary( - name = "merge-fdata", - srcs = glob([ - "tools/merge-fdata/*.cpp", - ]), - deps = [ - ":Profile", - "//llvm:Support", - ], -) - -cc_binary( - name = "llvm-bolt", - srcs = glob([ - "tools/driver/*.cpp", - ]), - includes = ["include"], - deps = [ - ":Profile", - ":Rewrite", - ":RuntimeLibs", - ":TargetAArch64", - ":TargetX86", - ":Utils", - "//llvm:AllTargetsAsmParsers", - "//llvm:AllTargetsCodeGens", - "//llvm:AllTargetsDisassemblers", - "//llvm:ExecutionEngine", - "//llvm:MC", - "//llvm:Object", - "//llvm:Support", - ], -) - -cc_library( - name = "Rewrite", - srcs = glob([ - "lib/Rewrite/*.cpp", - ]), - hdrs = glob([ - "include/bolt/Rewrite/*.h", - ]), - includes = ["include"], - deps = [ - ":Core", - ":Passes", - ":Profile", - ":RuntimeLibs", - ":TargetX86", - ":Utils", - "//llvm:Analysis", - "//llvm:BinaryFormat", - "//llvm:CodeGen", - "//llvm:DWARFLinker", - "//llvm:DWP", - "//llvm:DebugInfoDWARF", - "//llvm:Demangle", - "//llvm:JITLink", - "//llvm:MC", - "//llvm:MCDisassembler", - "//llvm:MCParser", - "//llvm:Object", - "//llvm:OrcShared", - "//llvm:Support", - "//llvm:ir_headers", - ], -) - -expand_template( - name = "RuntimeLibraryVariables_inc", - out = "include/bolt/RuntimeLibs/RuntimeLibraryVariables.inc", - substitutions = { - # FIXME this is a total guess - "@LLVM_LIBDIR_SUFFIX@": "lib", - }, - template = "include/bolt/RuntimeLibs/RuntimeLibraryVariables.inc.in", -) - -cc_library( - name = "RuntimeLibs", - srcs = glob([ - "lib/RuntimeLibs/*.cpp", - ]), - includes = ["include"], - textual_hdrs = glob([ - "include/bolt/RuntimeLibs/*.h", - ]) + ["include/bolt/RuntimeLibs/RuntimeLibraryVariables.inc"], - deps = [ - ":Core", - ":Passes", - ":Utils", - "//llvm:Analysis", - "//llvm:BinaryFormat", - "//llvm:CodeGen", - "//llvm:DWP", - "//llvm:DebugInfoDWARF", - "//llvm:Demangle", - "//llvm:MC", - "//llvm:MCDisassembler", - "//llvm:MCParser", - "//llvm:Object", - "//llvm:Support", - ], -) - -cc_library( - name = "ProfileHeaders", - hdrs = glob(["include/bolt/Profile/*.h"]), - includes = ["include"], - visibility = ["//visibility:private"], -) - -cc_library( - name = "Profile", - srcs = glob([ - "lib/Profile/*.cpp", - ]), - hdrs = glob([ - "include/bolt/Profile/*.h", - ]), - includes = ["include"], - deps = [ - ":Core", - ":Passes", - ":Utils", - "//llvm:Analysis", - "//llvm:BinaryFormat", - "//llvm:CodeGen", - "//llvm:DebugInfoDWARF", - "//llvm:Demangle", - "//llvm:ExecutionEngine", - "//llvm:MC", - "//llvm:MCDisassembler", - "//llvm:MCParser", - "//llvm:Object", - "//llvm:Support", - "//llvm:TransformUtils", - ], -) - -cc_library( - name = "Passes", - srcs = glob([ - "lib/Passes/*.cpp", - ]), - hdrs = glob([ - "include/bolt/Passes/*.h", - ]) + [ - # To avoid circular dependency on "Profile". - "include/bolt/Profile/BoltAddressTranslation.h", - ], - includes = ["include"], - deps = [ - ":Core", - ":Utils", - "//llvm:Analysis", - "//llvm:BinaryFormat", - "//llvm:CodeGen", - "//llvm:DebugInfoDWARF", - "//llvm:Demangle", - "//llvm:ExecutionEngine", - "//llvm:MC", - "//llvm:MCDisassembler", - "//llvm:MCParser", - "//llvm:Object", - "//llvm:Support", - "//llvm:Target", - "//llvm:TransformUtils", - ], -) - -cc_library( - name = "TargetX86", - srcs = glob([ - "lib/Target/X86/*.cpp", - ]), - hdrs = glob([ - "lib/Target/X86/*.h", - ]), - includes = ["include"], - deps = [ - ":Core", - "//llvm:Analysis", - "//llvm:BinaryFormat", - "//llvm:CodeGen", - "//llvm:DWP", - "//llvm:DebugInfoDWARF", - "//llvm:Demangle", - "//llvm:ExecutionEngine", - "//llvm:MC", - "//llvm:MCDisassembler", - "//llvm:MCParser", - "//llvm:Object", - "//llvm:Support", - "//llvm:X86CommonTableGen", - "//llvm:X86UtilsAndDesc", - ], -) - -cc_library( - name = "TargetAArch64", - srcs = glob([ - "lib/Target/AArch64/*.cpp", - ]), - includes = ["include"], - deps = [ - ":Core", - ":Utils", - "//llvm:AArch64CommonTableGen", - "//llvm:AArch64UtilsAndDesc", - "//llvm:Analysis", - "//llvm:BinaryFormat", - "//llvm:CodeGen", - "//llvm:DWP", - "//llvm:DebugInfoDWARF", - "//llvm:Demangle", - "//llvm:ExecutionEngine", - "//llvm:MC", - "//llvm:MCDisassembler", - "//llvm:MCParser", - "//llvm:Object", - "//llvm:Support", - ], -) - -cc_library( - name = "Core", - srcs = glob([ - "lib/Core/*.cpp", - ]), - hdrs = glob([ - "include/bolt/Core/*.h", - "include/bolt/RuntimeLibs/*.h", - "include/bolt/Passes/*.h", - "include/bolt/Rewrite/*.h", - ]), - includes = ["include"], - deps = [ - ":ProfileHeaders", - ":Utils", - "//llvm:Analysis", - "//llvm:BinaryFormat", - "//llvm:CodeGen", - "//llvm:DebugInfoDWARF", - "//llvm:Demangle", - "//llvm:ExecutionEngine", - "//llvm:MC", - "//llvm:MCDisassembler", - "//llvm:MCParser", - "//llvm:Object", - "//llvm:ObjectYAML", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:ir_headers", - ], -) - -cc_library( - name = "Utils", - srcs = glob([ - "lib/Utils/*.cpp", - ]), - hdrs = glob([ - "include/bolt/Utils/*.h", - ]), - includes = ["include"], - deps = [ - "//llvm:Analysis", - "//llvm:BinaryFormat", - "//llvm:CodeGen", - "//llvm:DWP", - "//llvm:DebugInfoDWARF", - "//llvm:Demangle", - "//llvm:ExecutionEngine", - "//llvm:MC", - "//llvm:MCDisassembler", - "//llvm:MCParser", - "//llvm:Object", - "//llvm:Support", - ], -) diff --git a/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/BUILD.bazel deleted file mode 100644 index 57c46c91402d9..0000000000000 --- a/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/BUILD.bazel +++ /dev/null @@ -1,385 +0,0 @@ -# This file is licensed 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 - -load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") -load("@bazel_skylib//rules:expand_template.bzl", "expand_template") -load("@bazel_skylib//rules:native_binary.bzl", "native_binary") -load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") -load("defs.bzl", "clang_tidy_library") - -package( - default_visibility = ["//visibility:public"], - features = ["layering_check"], -) - -licenses(["notice"]) - -# Include static analyzer checks in clang-tidy. Usage: -# $ bazel build --@llvm-project//clang-tools-extra/clang-tidy:enable_static_analyzer=true //... -# $ bazel build --@llvm-project//clang-tools-extra/clang-tidy:enable_static_analyzer=false //... -bool_flag( - name = "enable_static_analyzer", - build_setting_default = True, -) - -config_setting( - name = "static_analyzer_enabled", - flag_values = { - ":enable_static_analyzer": "true", - }, -) - -expand_template( - name = "config", - out = "clang-tidy-config.h", - substitutions = select({ - ":static_analyzer_enabled": { - "#cmakedefine01 CLANG_TIDY_ENABLE_STATIC_ANALYZER": "#define CLANG_TIDY_ENABLE_STATIC_ANALYZER 1", - }, - "//conditions:default": { - "#cmakedefine01 CLANG_TIDY_ENABLE_STATIC_ANALYZER": "#define CLANG_TIDY_ENABLE_STATIC_ANALYZER 0", - }, - }), - template = "clang-tidy-config.h.cmake", - visibility = ["//visibility:private"], -) - -cc_binary( - name = "confusable_table_builder", - srcs = ["misc/ConfusableTable/BuildConfusableTable.cpp"], - visibility = ["//visibility:private"], - deps = ["//llvm:Support"], -) - -genrule( - name = "confusables_inc", - srcs = ["misc/ConfusableTable/confusables.txt"], - outs = ["Confusables.inc"], - cmd = "$(location :confusable_table_builder) $(SRCS) $(OUTS)", - tools = [":confusable_table_builder"], - visibility = ["//visibility:private"], -) - -cc_library( - name = "confusables", - hdrs = [":confusables_inc"], - include_prefix = ".", -) - -clang_tidy_library( - name = "lib", - srcs = glob(["*.cpp"]) + [":config"], - hdrs = glob(["*.h"]), - includes = ["."], - deps = [ - "//clang:analysis", - "//clang:format", - "//clang:frontend_rewrite", - "//clang:rewrite", - "//clang:sema", - "//clang:serialization", - "//clang:tooling", - "//clang:tooling_core", - ] + select({ - ":static_analyzer_enabled": [ - "//clang:static_analyzer_core", - "//clang:static_analyzer_frontend", - ], - "//conditions:default": [], - }), -) - -clang_tidy_library( - name = "misc", - deps = [ - ":confusables", - ":lib", - ":utils", - "//clang:analysis", - "//clang:format", - "//clang:serialization", - "//clang:tooling", - "//clang:tooling_core", - "//clang:tooling_inclusions", - "//clang-tools-extra/include-cleaner:include_cleaner", - ], -) - -clang_tidy_library( - name = "portability", - deps = [ - ":lib", - "//llvm:TargetParser", - ], -) - -clang_tidy_library( - name = "utils", - deps = [ - ":lib", - "//clang:analysis", - "//clang:sema", - "//clang:tooling", - "//clang:transformer", - ], -) - -clang_tidy_library( - name = "readability", - deps = [ - ":lib", - ":utils", - "//clang:analysis", - "//clang:tooling", - ], -) - -clang_tidy_library( - name = "google", - deps = [ - ":lib", - ":readability", - ":utils", - ], -) - -clang_tidy_library( - name = "fuchsia", - deps = [ - ":google", - ":lib", - ], -) - -clang_tidy_library( - name = "llvm", - deps = [ - ":lib", - ":readability", - ":utils", - "//clang:tooling", - ], -) - -clang_tidy_library( - name = "llvmlibc", - deps = [ - ":lib", - ":portability", - ":utils", - ], -) - -clang_tidy_library( - name = "abseil", - deps = [ - ":lib", - ":utils", - "//clang:tooling", - "//clang:transformer", - ], -) - -clang_tidy_library( - name = "altera", - deps = [":lib"], -) - -clang_tidy_library( - name = "android", - deps = [ - ":lib", - ":utils", - ], -) - -clang_tidy_library( - name = "boost", - deps = [ - ":lib", - ":utils", - ], -) - -clang_tidy_library( - name = "concurrency", - deps = [":lib"], -) - -clang_tidy_library( - name = "darwin", - deps = [":lib"], -) - -clang_tidy_library( - name = "linuxkernel", - deps = [":lib"], -) - -clang_tidy_library( - name = "modernize", - deps = [ - ":lib", - ":utils", - "//clang:tooling", - ], -) - -clang_tidy_library( - name = "mpi", - deps = [ - ":lib", - "//clang:static_analyzer_checkers", - "//clang:static_analyzer_core", - "//clang:static_analyzer_frontend", - "//clang:tooling", - ], -) - -clang_tidy_library( - name = "objc", - deps = [ - ":lib", - ":utils", - ], -) - -clang_tidy_library( - name = "openmp", - deps = [ - ":lib", - ":utils", - ], -) - -clang_tidy_library( - name = "zircon", - deps = [ - ":lib", - ":utils", - ], -) - -clang_tidy_library( - name = "cppcoreguidelines", - deps = [ - ":lib", - ":misc", - ":modernize", - ":performance", - ":readability", - ":utils", - "//clang:analysis", - ], -) - -clang_tidy_library( - name = "bugprone", - deps = [ - ":cppcoreguidelines", - ":lib", - ":utils", - "//clang:analysis", - "//clang:tooling", - "//clang:transformer", - ], -) - -clang_tidy_library( - name = "performance", - deps = [ - ":lib", - ":utils", - "//clang:analysis", - "//clang:tooling", - ], -) - -clang_tidy_library( - name = "cert", - deps = [ - ":bugprone", - ":concurrency", - ":google", - ":lib", - ":misc", - ":performance", - ":readability", - ":utils", - ], -) - -clang_tidy_library( - name = "hicpp", - deps = [ - ":bugprone", - ":cppcoreguidelines", - ":google", - ":lib", - ":misc", - ":modernize", - ":performance", - ":readability", - ], -) - -clang_tidy_library( - name = "plugin", - deps = [":lib"], -) - -CHECKS = [ - ":abseil", - ":altera", - ":android", - ":boost", - ":bugprone", - ":cert", - ":concurrency", - ":cppcoreguidelines", - ":darwin", - ":fuchsia", - ":google", - ":hicpp", - ":linuxkernel", - ":llvm", - ":llvmlibc", - ":misc", - ":modernize", - ":objc", - ":openmp", - ":performance", - ":portability", - ":readability", - ":zircon", -] + select({ - ":static_analyzer_enabled": [":mpi"], - "//conditions:default": [], -}) - -cc_library( - name = "tool", - srcs = ["tool/ClangTidyMain.cpp"], - hdrs = ["tool/ClangTidyMain.h"], - deps = CHECKS + [ - ":lib", - ":utils", - "//clang:tooling", - "//llvm:Support", - ], -) - -cc_binary( - name = "clang-tidy", - srcs = ["tool/ClangTidyToolMain.cpp"], - stamp = 0, - deps = [":tool"], -) - -native_binary( - name = "run-clang-tidy", - src = "tool/run-clang-tidy.py", - out = "run-clang-tidy", - data = [":clang-tidy"], -) diff --git a/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/defs.bzl b/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/defs.bzl deleted file mode 100644 index 387d104a773ab..0000000000000 --- a/utils/bazel/llvm-project-overlay/clang-tools-extra/clang-tidy/defs.bzl +++ /dev/null @@ -1,25 +0,0 @@ -# This file is licensed 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 - -load("@bazel_skylib//lib:paths.bzl", "paths") -load("@rules_cc//cc:defs.bzl", "cc_library") - -_common_library_deps = [ - "//clang:ast", - "//clang:ast_matchers", - "//clang:basic", - "//clang:lex", - "//clang:frontend", - "//llvm:FrontendOpenMP", - "//llvm:Support", -] - -def clang_tidy_library(name, **kwargs): - kwargs["srcs"] = kwargs.get("srcs", native.glob([paths.join(name, "*.cpp")], allow_empty = True)) - kwargs["hdrs"] = kwargs.get("hdrs", native.glob([paths.join(name, "*.h")], allow_empty = True)) - kwargs["deps"] = kwargs.get("deps", []) + _common_library_deps - cc_library( - name = name, - **kwargs - ) diff --git a/utils/bazel/llvm-project-overlay/clang-tools-extra/include-cleaner/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang-tools-extra/include-cleaner/BUILD.bazel deleted file mode 100644 index 28f90efb3ba7f..0000000000000 --- a/utils/bazel/llvm-project-overlay/clang-tools-extra/include-cleaner/BUILD.bazel +++ /dev/null @@ -1,63 +0,0 @@ -# This file is licensed 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 - -load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") - -package( - default_visibility = ["//visibility:public"], - features = ["layering_check"], -) - -licenses(["notice"]) - -cc_library( - name = "include_cleaner", - srcs = glob([ - "lib/*.h", - "lib/*.cpp", - ]), - hdrs = glob(["include/clang-include-cleaner/*.h"]), - includes = ["include/"], - deps = [ - "//clang:ast", - "//clang:basic", - "//clang:format", - "//clang:frontend", - "//clang:lex", - "//clang:tooling_core", - "//clang:tooling_inclusions", - "//llvm:Support", - ], -) - -cc_library( - name = "include_cleaner_internal", - hdrs = glob(["lib/*.h"]), - includes = ["lib/"], - visibility = [":__subpackages__"], - deps = [ - ":include_cleaner", - "//clang:ast", - "//clang:basic", - "//clang:frontend", - "//clang:lex", - "//clang:tooling_inclusions", - "//llvm:Support", - ], -) - -cc_binary( - name = "clang-include-cleaner", - srcs = glob([ - "tool/*.cpp", - ]), - deps = [ - ":include_cleaner", - ":include_cleaner_internal", - "//clang:frontend", - "//clang:lex", - "//clang:tooling", - "//llvm:Support", - ], -) diff --git a/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel deleted file mode 100644 index 12e87cec4b76b..0000000000000 --- a/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel +++ /dev/null @@ -1,55 +0,0 @@ -# This file is licensed 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 - -load("@rules_cc//cc:defs.bzl", "cc_test") - -package( - default_visibility = ["//visibility:public"], - features = ["layering_check"], -) - -licenses(["notice"]) - -cc_test( - name = "clang_tidy_test", - size = "small", - srcs = glob( - [ - "clang-tidy/*.cpp", - "clang-tidy/*.h", - ], - allow_empty = False, - ), - includes = ["clang-tidy/include"], - deps = [ - "//clang:ast", - "//clang:ast_matchers", - "//clang:basic", - "//clang:frontend", - "//clang:lex", - "//clang:serialization", - "//clang:testing", - "//clang:tooling", - "//clang:tooling_core", - "//clang:transformer", - "//clang-tools-extra/clang-tidy:android", - "//clang-tools-extra/clang-tidy:google", - "//clang-tools-extra/clang-tidy:lib", - "//clang-tools-extra/clang-tidy:llvm", - "//clang-tools-extra/clang-tidy:misc", - "//clang-tools-extra/clang-tidy:modernize", - "//clang-tools-extra/clang-tidy:objc", - "//clang-tools-extra/clang-tidy:performance", - "//clang-tools-extra/clang-tidy:readability", - "//clang-tools-extra/clang-tidy:tool", - "//clang-tools-extra/clang-tidy:utils", - "//llvm:FrontendOpenMP", - "//llvm:Support", - "//llvm:TestingAnnotations", - "//llvm:TestingSupport", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) diff --git a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel deleted file mode 100644 index 2d7ce8702a5d9..0000000000000 --- a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel +++ /dev/null @@ -1,2656 +0,0 @@ -# This file is licensed 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 - -load( - "//:vars.bzl", - "LLVM_VERSION", - "LLVM_VERSION_MAJOR", - "LLVM_VERSION_MINOR", - "LLVM_VERSION_PATCH", -) -load("//:workspace_root.bzl", "workspace_root") -load("//llvm:binary_alias.bzl", "binary_alias") -load("//llvm:cc_plugin_library.bzl", "cc_plugin_library") -load("//llvm:driver.bzl", "llvm_driver_cc_binary") -load("//llvm:tblgen.bzl", "gentbl") - -package( - default_visibility = ["//visibility:public"], - features = ["layering_check"], -) - -licenses(["notice"]) - -exports_files([ - "tools/clang-format/clang-format.el", - "tools/clang-format/clang-format-test.el", - "tools/clang-format/clang-format.py", - "tools/clang-rename/clang-rename.el", - "tools/extra/clang-include-fixer/tool/clang-include-fixer.el", - "tools/extra/clang-include-fixer/tool/clang-include-fixer-test.el", -]) - -cc_binary( - name = "clang-tblgen", - srcs = glob([ - "utils/TableGen/*.cpp", - "utils/TableGen/*.h", - ]), - copts = [ - "$(STACK_FRAME_UNLIMITED)", - ], - stamp = 0, - deps = [ - ":support", - "//llvm:Support", - "//llvm:TableGen", - "//llvm:config", - ], -) - -gentbl( - name = "diagnostic_defs_gen", - tbl_outs = [( - "-gen-clang-diags-defs -clang-component=%s" % c, - "include/clang/Basic/Diagnostic%sKinds.inc" % c, - ) for c in [ - "AST", - "Analysis", - "Comment", - "Common", - "CrossTU", - "Driver", - "Frontend", - "InstallAPI", - "Lex", - "Parse", - "Refactoring", - "Sema", - "Serialization", - ]] + [ - ( - "-gen-clang-diag-groups", - "include/clang/Basic/DiagnosticGroups.inc", - ), - ( - "-gen-clang-diags-index-name", - "include/clang/Basic/DiagnosticIndexName.inc", - ), - ], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/Diagnostic.td", - td_srcs = glob(["include/clang/Basic/*.td"]), -) - -gentbl( - name = "basic_arm_neon_inc_gen", - tbl_outs = [( - "-gen-arm-neon-sema", - "include/clang/Basic/arm_neon.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_neon.td", - td_srcs = [ - "include/clang/Basic/arm_neon.td", - "include/clang/Basic/arm_neon_incl.td", - ], -) - -gentbl( - name = "basic_arm_fp16_inc_gen", - tbl_outs = [( - "-gen-arm-neon-sema", - "include/clang/Basic/arm_fp16.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_fp16.td", - td_srcs = [ - "include/clang/Basic/arm_fp16.td", - "include/clang/Basic/arm_neon_incl.td", - ], -) - -gentbl( - name = "basic_arm_mve_aliases_gen", - tbl_outs = [( - "-gen-arm-mve-builtin-aliases", - "include/clang/Basic/arm_mve_builtin_aliases.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_mve.td", - td_srcs = [ - "include/clang/Basic/arm_mve.td", - "include/clang/Basic/arm_mve_defs.td", - ], -) - -gentbl( - name = "basic_arm_sve_builtins_gen", - tbl_outs = [( - "-gen-arm-sve-builtins", - "include/clang/Basic/arm_sve_builtins.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_sve.td", - td_srcs = [ - "include/clang/Basic/arm_sve.td", - "include/clang/Basic/arm_sve_sme_incl.td", - ], -) - -gentbl( - name = "basic_arm_sve_builtin_cg_gen", - tbl_outs = [( - "-gen-arm-sve-builtin-codegen", - "include/clang/Basic/arm_sve_builtin_cg.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_sve.td", - td_srcs = [ - "include/clang/Basic/arm_sve.td", - "include/clang/Basic/arm_sve_sme_incl.td", - ], -) - -gentbl( - name = "basic_arm_sve_typeflags_gen", - tbl_outs = [( - "-gen-arm-sve-typeflags", - "include/clang/Basic/arm_sve_typeflags.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_sve.td", - td_srcs = [ - "include/clang/Basic/arm_sve.td", - "include/clang/Basic/arm_sve_sme_incl.td", - ], -) - -gentbl( - name = "basic_arm_sve_sema_rangechecks_gen", - tbl_outs = [( - "-gen-arm-sve-sema-rangechecks", - "include/clang/Basic/arm_sve_sema_rangechecks.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_sve.td", - td_srcs = [ - "include/clang/Basic/arm_sve.td", - "include/clang/Basic/arm_sve_sme_incl.td", - ], -) - -gentbl( - name = "basic_arm_sve_streaming_attrs_gen", - tbl_outs = [( - "-gen-arm-sve-streaming-attrs", - "include/clang/Basic/arm_sve_streaming_attrs.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_sve.td", - td_srcs = [ - "include/clang/Basic/arm_sve.td", - "include/clang/Basic/arm_sve_sme_incl.td", - ], -) - -gentbl( - name = "basic_arm_sme_builtins_gen", - tbl_outs = [( - "-gen-arm-sme-builtins", - "include/clang/Basic/arm_sme_builtins.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_sme.td", - td_srcs = [ - "include/clang/Basic/arm_sme.td", - "include/clang/Basic/arm_sve_sme_incl.td", - ], -) - -gentbl( - name = "basic_arm_sme_builtin_cg_gen", - tbl_outs = [( - "-gen-arm-sme-builtin-codegen", - "include/clang/Basic/arm_sme_builtin_cg.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_sme.td", - td_srcs = [ - "include/clang/Basic/arm_sme.td", - "include/clang/Basic/arm_sve_sme_incl.td", - ], -) - -gentbl( - name = "basic_arm_sme_builtins_za_state_gen", - tbl_outs = [( - "-gen-arm-sme-builtin-za-state", - "include/clang/Basic/arm_sme_builtins_za_state.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_sme.td", - td_srcs = [ - "include/clang/Basic/arm_sme.td", - "include/clang/Basic/arm_sve_sme_incl.td", - ], -) - -gentbl( - name = "basic_arm_sme_sema_rangechecks_gen", - tbl_outs = [( - "-gen-arm-sme-sema-rangechecks", - "include/clang/Basic/arm_sme_sema_rangechecks.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_sme.td", - td_srcs = [ - "include/clang/Basic/arm_sme.td", - "include/clang/Basic/arm_sve_sme_incl.td", - ], -) - -gentbl( - name = "basic_arm_sme_streaming_attrs_gen", - tbl_outs = [( - "-gen-arm-sme-streaming-attrs", - "include/clang/Basic/arm_sme_streaming_attrs.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_sme.td", - td_srcs = [ - "include/clang/Basic/arm_sme.td", - "include/clang/Basic/arm_sve_sme_incl.td", - ], -) - -gentbl( - name = "basic_arm_mve_cg_gen", - tbl_outs = [( - "-gen-arm-mve-builtin-codegen", - "include/clang/Basic/arm_mve_builtin_cg.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_mve.td", - td_srcs = [ - "include/clang/Basic/arm_mve.td", - "include/clang/Basic/arm_mve_defs.td", - ], -) - -gentbl( - name = "basic_arm_mve_inc_gen", - tbl_outs = [( - "-gen-arm-mve-builtin-def", - "include/clang/Basic/arm_mve_builtins.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_mve.td", - td_srcs = [ - "include/clang/Basic/arm_mve.td", - "include/clang/Basic/arm_mve_defs.td", - ], -) - -gentbl( - name = "basic_arm_mve_sema_gen", - tbl_outs = [( - "-gen-arm-mve-builtin-sema", - "include/clang/Basic/arm_mve_builtin_sema.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_mve.td", - td_srcs = [ - "include/clang/Basic/arm_mve.td", - "include/clang/Basic/arm_mve_defs.td", - ], -) - -gentbl( - name = "basic_builtins_bpf_gen", - tbl_outs = [( - "-gen-clang-builtins", - "include/clang/Basic/BuiltinsBPF.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/BuiltinsBPF.td", - td_srcs = [ - "include/clang/Basic/BuiltinsBPF.td", - "include/clang/Basic/BuiltinsBase.td", - ], -) - -gentbl( - name = "basic_builtins_riscv_gen", - tbl_outs = [( - "-gen-clang-builtins", - "include/clang/Basic/BuiltinsRISCV.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/BuiltinsRISCV.td", - td_srcs = [ - "include/clang/Basic/BuiltinsRISCV.td", - "include/clang/Basic/BuiltinsBase.td", - ], -) - -gentbl( - name = "basic_builtins_gen", - tbl_outs = [( - "-gen-clang-builtins", - "include/clang/Basic/Builtins.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/Builtins.td", - td_srcs = [ - "include/clang/Basic/Builtins.td", - "include/clang/Basic/BuiltinsBase.td", - ], -) - -gentbl( - name = "basic_riscv_vector_builtins_gen", - tbl_outs = [( - "-gen-riscv-vector-builtins", - "include/clang/Basic/riscv_vector_builtins.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/riscv_vector.td", - td_srcs = [ - "include/clang/Basic/riscv_vector.td", - "include/clang/Basic/riscv_vector_common.td", - ], -) - -gentbl( - name = "basic_riscv_vector_builtin_cg_gen", - tbl_outs = [( - "-gen-riscv-vector-builtin-codegen", - "include/clang/Basic/riscv_vector_builtin_cg.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/riscv_vector.td", - td_srcs = [ - "include/clang/Basic/riscv_vector.td", - "include/clang/Basic/riscv_vector_common.td", - ], -) - -gentbl( - name = "basic_riscv_vector_builtin_sema_gen", - tbl_outs = [( - "-gen-riscv-vector-builtin-sema", - "include/clang/Basic/riscv_vector_builtin_sema.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/riscv_vector.td", - td_srcs = [ - "include/clang/Basic/riscv_vector.td", - "include/clang/Basic/riscv_vector_common.td", - ], -) - -gentbl( - name = "basic_riscv_sifive_vector_builtins_gen", - tbl_outs = [( - "-gen-riscv-sifive-vector-builtins", - "include/clang/Basic/riscv_sifive_vector_builtins.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/riscv_sifive_vector.td", - td_srcs = [ - "include/clang/Basic/riscv_sifive_vector.td", - "include/clang/Basic/riscv_vector_common.td", - ], -) - -gentbl( - name = "basic_riscv_sifive_vector_builtin_cg_gen", - tbl_outs = [( - "-gen-riscv-sifive-vector-builtin-codegen", - "include/clang/Basic/riscv_sifive_vector_builtin_cg.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/riscv_sifive_vector.td", - td_srcs = [ - "include/clang/Basic/riscv_sifive_vector.td", - "include/clang/Basic/riscv_vector_common.td", - ], -) - -gentbl( - name = "basic_riscv_sifive_vector_builtin_sema_gen", - tbl_outs = [( - "-gen-riscv-sifive-vector-builtin-sema", - "include/clang/Basic/riscv_sifive_vector_builtin_sema.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/riscv_sifive_vector.td", - td_srcs = [ - "include/clang/Basic/riscv_sifive_vector.td", - "include/clang/Basic/riscv_vector_common.td", - ], -) - -gentbl( - name = "basic_arm_cde_gen", - tbl_outs = [( - "-gen-arm-cde-builtin-def", - "include/clang/Basic/arm_cde_builtins.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_cde.td", - td_srcs = [ - "include/clang/Basic/arm_cde.td", - "include/clang/Basic/arm_mve_defs.td", - ], -) - -gentbl( - name = "basic_arm_cde_aliases_gen", - tbl_outs = [( - "-gen-arm-cde-builtin-aliases", - "include/clang/Basic/arm_cde_builtin_aliases.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_cde.td", - td_srcs = [ - "include/clang/Basic/arm_cde.td", - "include/clang/Basic/arm_mve_defs.td", - ], -) - -gentbl( - name = "basic_arm_cde_cg_gen", - tbl_outs = [( - "-gen-arm-cde-builtin-codegen", - "include/clang/Basic/arm_cde_builtin_cg.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_cde.td", - td_srcs = [ - "include/clang/Basic/arm_cde.td", - "include/clang/Basic/arm_mve_defs.td", - ], -) - -gentbl( - name = "basic_arm_cde_sema_gen", - tbl_outs = [( - "-gen-arm-cde-builtin-sema", - "include/clang/Basic/arm_cde_builtin_sema.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_cde.td", - td_srcs = [ - "include/clang/Basic/arm_cde.td", - "include/clang/Basic/arm_mve_defs.td", - ], -) - -gentbl( - name = "basic_attr_gen", - tbl_outs = [ - ( - "-gen-clang-attr-has-attribute-impl", - "include/clang/Basic/AttrHasAttributeImpl.inc", - ), - ( - "-gen-clang-attr-list", - "include/clang/Basic/AttrList.inc", - ), - ( - "-gen-clang-attr-subject-match-rule-list", - "include/clang/Basic/AttrSubMatchRulesList.inc", - ), - ( - "-gen-clang-regular-keyword-attr-info", - "include/clang/Basic/RegularKeywordAttrInfo.inc", - ), - ], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/Attr.td", - td_srcs = [ - "include/clang/Basic/ASTNode.td", - "include/clang/Basic/Attr.td", - "include/clang/Basic/AttrDocs.td", - "include/clang/Basic/DeclNodes.td", - "include/clang/Basic/StmtNodes.td", - ], -) - -gentbl( - name = "libsema_openclbuiltins_inc_gen", - strip_include_prefix = "lib/Sema", - tbl_outs = [( - "-gen-clang-opencl-builtins", - "lib/Sema/OpenCLBuiltins.inc", - )], - tblgen = ":clang-tblgen", - td_file = "lib/Sema/OpenCLBuiltins.td", - td_srcs = [ - "lib/Sema/OpenCLBuiltins.td", - ], -) - -# Table definition files can be used for documentation: -filegroup( - name = "all_table_defs", - srcs = glob(["include/**/*.td"]), -) - -exports_files( - glob(["include/**/*.td"]), -) - -genrule( - name = "basic_version_gen", - outs = ["include/clang/Basic/Version.inc"], - cmd = ( - "echo '#define CLANG_VERSION {vers}' >> $@\n" + - "echo '#define CLANG_VERSION_MAJOR {major}' >> $@\n" + - "echo '#define CLANG_VERSION_MAJOR_STRING \"{major}\"' >> $@\n" + - "echo '#define CLANG_VERSION_MINOR {minor}' >> $@\n" + - "echo '#define CLANG_VERSION_PATCHLEVEL {patch}' >> $@\n" + - "echo '#define CLANG_VERSION_STRING \"{vers}git\"' >> $@\n" - ).format( - major = LLVM_VERSION_MAJOR, - minor = LLVM_VERSION_MINOR, - patch = LLVM_VERSION_PATCH, - vers = LLVM_VERSION, - ), -) - -cc_library( - name = "config", - hdrs = [ - "include/clang/Basic/Version.inc", - "include/clang/Config/config.h", - ], - includes = ["include"], - deps = [ - # We rely on the LLVM config library to provide configuration defines. - "//llvm:config", - ], -) - -# TODO: This should get replaced with something that actually generates the -# correct version number. -genrule( - name = "vcs_version_gen", - # This should be under lib/Basic, but because of how the include paths - # are passed through bazel, it's easier to drop generated files next to - # the other includes. - outs = ["include/VCSVersion.inc"], - cmd = "echo '#undef CLANG_REVISION' > $@", -) - -py_binary( - name = "bundle_resources", - srcs = [ - "utils/bundle_resources.py", - ], - main = "utils/bundle_resources.py", -) - -# A hacky library to expose some internal headers of the `basic` library to its -# own implementation source files using a stripped include prefix rather than -# file-relative-inclusion. This is inherently non-modular as these headers will -# be repeated in the sources below for file-relative-inclusion. -cc_library( - name = "basic_internal_headers", - hdrs = glob([ - "lib/Basic/*.h", - ]), - features = ["-header_modules"], - strip_include_prefix = "lib/Basic", -) - -cc_library( - name = "basic", - srcs = [ - "include/VCSVersion.inc", - "include/clang/Basic/Version.inc", - ] + glob([ - "lib/Basic/*.cpp", - "lib/Basic/*.h", - "lib/Basic/Targets/*.cpp", - "lib/Basic/Targets/*.h", - ]), - hdrs = glob([ - "include/clang/Basic/*.h", - ]), - copts = [ - "-DHAVE_VCS_VERSION_INC", - "$(STACK_FRAME_UNLIMITED)", - ], - includes = ["include"], - textual_hdrs = [ - "include/clang/Basic/arm_fp16.inc", - "include/clang/Basic/arm_mve_builtins.inc", - "include/clang/Basic/arm_mve_builtin_aliases.inc", - "include/clang/Basic/arm_mve_builtin_cg.inc", - "include/clang/Basic/arm_mve_builtin_sema.inc", - "include/clang/Basic/arm_sme_builtins.inc", - "include/clang/Basic/arm_sme_builtin_cg.inc", - "include/clang/Basic/arm_neon.inc", - "include/clang/Basic/AttrHasAttributeImpl.inc", - "include/clang/Basic/AttrList.inc", - "include/clang/Basic/AttrSubMatchRulesList.inc", - "include/clang/Basic/DiagnosticASTKinds.inc", - "include/clang/Basic/DiagnosticGroups.inc", - "include/clang/Basic/DiagnosticRefactoringKinds.inc", - "include/clang/Basic/DiagnosticAnalysisKinds.inc", - "include/clang/Basic/DiagnosticSemaKinds.inc", - "include/clang/Basic/DiagnosticCommentKinds.inc", - "include/clang/Basic/DiagnosticParseKinds.inc", - "include/clang/Basic/DiagnosticLexKinds.inc", - "include/clang/Basic/DiagnosticSerializationKinds.inc", - "include/clang/Basic/DiagnosticFrontendKinds.inc", - "include/clang/Basic/DiagnosticDriverKinds.inc", - "include/clang/Basic/DiagnosticCrossTUKinds.inc", - "include/clang/Basic/DiagnosticCommonKinds.inc", - "include/clang/Basic/DiagnosticIndexName.inc", - ] + glob([ - "include/clang/Basic/*.def", - ]), - deps = [ - ":basic_arm_cde_gen", - ":basic_arm_fp16_inc_gen", - ":basic_arm_mve_aliases_gen", - ":basic_arm_mve_cg_gen", - ":basic_arm_mve_inc_gen", - ":basic_arm_mve_sema_gen", - ":basic_arm_neon_inc_gen", - ":basic_arm_sme_builtin_cg_gen", - ":basic_arm_sme_builtins_gen", - ":basic_arm_sve_builtins_gen", - ":basic_arm_sve_typeflags_gen", - ":basic_attr_gen", - ":basic_builtins_bpf_gen", - ":basic_builtins_gen", - ":basic_builtins_riscv_gen", - ":basic_internal_headers", - ":basic_riscv_sifive_vector_builtins_gen", - ":basic_riscv_vector_builtin_cg_gen", - ":basic_riscv_vector_builtins_gen", - ":config", - ":diagnostic_defs_gen", - ":sema_attr_gen", - "//llvm:Core", - "//llvm:FrontendDebug", - "//llvm:FrontendDriver", - "//llvm:FrontendOpenMP", - "//llvm:Instrumentation", - "//llvm:MC", - "//llvm:Support", - "//llvm:Target", - "//llvm:TargetParser", - "//llvm:config", - ], -) - -cc_library( - name = "lex", - srcs = glob([ - "lib/Lex/*.cpp", - "lib/Lex/*.h", - ]), - hdrs = glob([ - "include/clang/Lex/*.h", - ]), - includes = ["include"], - deps = [ - ":basic", - ":config", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -gentbl( - name = "ast_attr_gen", - tbl_outs = [ - ( - "-gen-clang-attr-ast-visitor", - "include/clang/AST/AttrVisitor.inc", - ), - ( - "-gen-clang-attr-classes", - "include/clang/AST/Attrs.inc", - ), - ( - "-gen-clang-attr-doc-table", - "lib/AST/AttrDocTable.inc", - ), - ( - "-gen-clang-attr-text-node-dump", - "include/clang/AST/AttrTextNodeDump.inc", - ), - ( - "-gen-clang-attr-node-traverse", - "include/clang/AST/AttrNodeTraverse.inc", - ), - ( - "-gen-clang-attr-impl", - "include/clang/AST/AttrImpl.inc", - ), - ], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/Attr.td", - td_srcs = [ - "include/clang/Basic/Attr.td", - "include/clang/Basic/AttrDocs.td", - "include/clang/Basic/ASTNode.td", - "include/clang/Basic/DeclNodes.td", - "include/clang/Basic/StmtNodes.td", - ], -) - -gentbl( - name = "ast_decl_nodes_gen", - tbl_outs = [( - "-gen-clang-decl-nodes", - "include/clang/AST/DeclNodes.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/DeclNodes.td", - td_srcs = [ - "include/clang/Basic/ASTNode.td", - "include/clang/Basic/DeclNodes.td", - ], -) - -gentbl( - name = "ast_stmt_nodes_gen", - tbl_outs = [( - "-gen-clang-stmt-nodes", - "include/clang/AST/StmtNodes.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/StmtNodes.td", - td_srcs = [ - "include/clang/Basic/ASTNode.td", - "include/clang/Basic/StmtNodes.td", - ], -) - -gentbl( - name = "ast_comment_nodes_gen", - tbl_outs = [( - "-gen-clang-comment-nodes", - "include/clang/AST/CommentNodes.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/CommentNodes.td", - td_srcs = [ - "include/clang/Basic/ASTNode.td", - "include/clang/Basic/CommentNodes.td", - ], -) - -gentbl( - name = "ast_comment_command_info_gen", - tbl_outs = [ - ( - "-gen-clang-comment-command-info", - "include/clang/AST/CommentCommandInfo.inc", - ), - ( - "-gen-clang-comment-command-list", - "include/clang/AST/CommentCommandList.inc", - ), - ], - tblgen = ":clang-tblgen", - td_file = "include/clang/AST/CommentCommands.td", - td_srcs = ["include/clang/AST/CommentCommands.td"], -) - -gentbl( - name = "ast_comment_html_tags_gen", - tbl_outs = [( - "-gen-clang-comment-html-tags", - "include/clang/AST/CommentHTMLTags.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/AST/CommentHTMLTags.td", - td_srcs = ["include/clang/AST/CommentHTMLTags.td"], -) - -gentbl( - name = "ast_comment_html_tags_properties_gen", - tbl_outs = [( - "-gen-clang-comment-html-tags-properties", - "include/clang/AST/CommentHTMLTagsProperties.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/AST/CommentHTMLTags.td", - td_srcs = ["include/clang/AST/CommentHTMLTags.td"], -) - -gentbl( - name = "ast_comment_html_named_character_references_gen", - tbl_outs = [( - "-gen-clang-comment-html-named-character-references", - "include/clang/AST/CommentHTMLNamedCharacterReferences.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/AST/CommentHTMLNamedCharacterReferences.td", - td_srcs = ["include/clang/AST/CommentHTMLNamedCharacterReferences.td"], -) - -gentbl( - name = "ast_stmt_data_collectors_gen", - tbl_outs = [( - "-gen-clang-data-collectors", - "include/clang/AST/StmtDataCollectors.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/AST/StmtDataCollectors.td", - td_srcs = ["include/clang/AST/StmtDataCollectors.td"], -) - -gentbl( - name = "ast_interp_opcodes_gen", - tbl_outs = [( - "-gen-clang-opcodes", - "lib/AST/Interp/Opcodes.inc", - )], - tblgen = ":clang-tblgen", - td_file = "lib/AST/Interp/Opcodes.td", - td_srcs = ["lib/AST/Interp/Opcodes.td"], -) - -gentbl( - name = "ast_properties_base_gen", - tbl_outs = [ - ( - "-gen-clang-basic-reader", - "include/clang/AST/AbstractBasicReader.inc", - ), - ( - "-gen-clang-basic-writer", - "include/clang/AST/AbstractBasicWriter.inc", - ), - ], - tblgen = ":clang-tblgen", - td_file = "include/clang/AST/PropertiesBase.td", - td_srcs = ["include/clang/AST/PropertiesBase.td"], -) - -gentbl( - name = "ast_type_properties_gen", - tbl_outs = [ - ( - "-gen-clang-type-reader", - "include/clang/AST/AbstractTypeReader.inc", - ), - ( - "-gen-clang-type-writer", - "include/clang/AST/AbstractTypeWriter.inc", - ), - ], - tblgen = ":clang-tblgen", - td_file = "include/clang/AST/TypeProperties.td", - td_srcs = [ - "include/clang/AST/PropertiesBase.td", - "include/clang/AST/TypeProperties.td", - "include/clang/Basic/ASTNode.td", - "include/clang/Basic/TypeNodes.td", - ], -) - -gentbl( - name = "type_nodes_gen", - tbl_outs = [( - "-gen-clang-type-nodes", - "include/clang/AST/TypeNodes.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/TypeNodes.td", - td_srcs = [ - "include/clang/Basic/ASTNode.td", - "include/clang/Basic/TypeNodes.td", - ], -) - -workspace_root(name = "workspace_root") - -cc_library( - name = "ast", - srcs = glob([ - "lib/AST/*.cpp", - "lib/AST/*.h", - "lib/AST/Interp/*.cpp", - "lib/AST/Interp/*.h", - ]) + [ - "lib/AST/AttrDocTable.inc", - "lib/AST/Interp/Opcodes.inc", - ], - hdrs = glob([ - "include/clang/AST/*.h", - ]), - copts = [ - # FIXME: This is necessary to allow "file relative" include paths from - # non-generated `srcs` to find generated `srcs` above. Bazel should - # either make this work automatically by creating a unified tree of - # `srcs` or at least provide a `local_includes` that has the path - # translation logic of `includes` but is only used locally (similar to - # `local_defines` vs. `defines`). Until one of those lands, this is the - # least bad approach. Using `includes` is *specifically* problematic for - # this library because it contains files that collide easily with system - # headers such as `CXXABI.h`. - "-I$(GENDIR)/$(WORKSPACE_ROOT)/clang/lib/AST", - "-I$(GENDIR)/$(WORKSPACE_ROOT)/clang/lib/AST/Interp", - ], - textual_hdrs = [ - "include/clang/AST/AttrImpl.inc", - "include/clang/AST/AttrNodeTraverse.inc", - "include/clang/AST/Attrs.inc", - "include/clang/AST/AttrTextNodeDump.inc", - "include/clang/AST/AttrVisitor.inc", - "include/clang/AST/CommentCommandInfo.inc", - "include/clang/AST/CommentCommandList.inc", - "include/clang/AST/CommentHTMLNamedCharacterReferences.inc", - "include/clang/AST/CommentHTMLTags.inc", - "include/clang/AST/CommentHTMLTagsProperties.inc", - "include/clang/AST/CommentNodes.inc", - "include/clang/AST/DeclNodes.inc", - "include/clang/AST/StmtDataCollectors.inc", - "include/clang/AST/StmtNodes.inc", - ] + glob([ - "include/clang/AST/*.def", - ]), - toolchains = [ - ":workspace_root", - ], - deps = [ - ":ast_attr_gen", - ":ast_comment_command_info_gen", - ":ast_comment_html_named_character_references_gen", - ":ast_comment_html_tags_gen", - ":ast_comment_html_tags_properties_gen", - ":ast_comment_nodes_gen", - ":ast_decl_nodes_gen", - ":ast_interp_opcodes_gen", - ":ast_properties_base_gen", - ":ast_stmt_data_collectors_gen", - ":ast_stmt_nodes_gen", - ":ast_type_properties_gen", - ":basic", - ":basic_builtins_gen", - ":lex", - ":type_nodes_gen", - "//llvm:BinaryFormat", - "//llvm:Core", - "//llvm:FrontendHLSL", - "//llvm:FrontendOpenMP", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -cc_library( - name = "index", - srcs = glob([ - "lib/Index/*.cpp", - "lib/Index/*.h", - ]), - hdrs = glob([ - "include/clang/Index/*.h", - "include/clang-c/*.h", - ]), - includes = ["include"], - deps = [ - ":ast", - ":basic", - ":format", - ":frontend", - ":lex", - ":rewrite", - ":serialization", - "//llvm:Core", - "//llvm:Support", - ], -) - -genrule( - name = "analysis_htmllogger_gen", - srcs = [ - "lib/Analysis/FlowSensitive/HTMLLogger.html", - "lib/Analysis/FlowSensitive/HTMLLogger.css", - "lib/Analysis/FlowSensitive/HTMLLogger.js", - ], - outs = ["lib/Analysis/FlowSensitive/HTMLLogger.inc"], - cmd = "$(location :bundle_resources) $@ $(SRCS)", - tools = [":bundle_resources"], -) - -cc_library( - name = "analysis", - srcs = glob([ - "lib/Analysis/FlowSensitive/Models/*.cpp", - "lib/Analysis/FlowSensitive/*.cpp", - "lib/Analysis/*.cpp", - ]) + [ - ":analysis_htmllogger_gen", - ], - hdrs = glob([ - "include/clang/Analysis/**/*.h", - ]), - includes = [ - "include", - "lib/Analysis/FlowSensitive", - ], - textual_hdrs = glob([ - "include/clang/Analysis/**/*.def", - ]), - deps = [ - ":ast", - ":ast_matchers", - ":basic", - ":lex", - "//llvm:Support", - ], -) - -gentbl( - name = "sema_attr_gen", - tbl_outs = [ - ( - "-gen-clang-attr-parsed-attr-impl", - "include/clang/Sema/AttrParsedAttrImpl.inc", - ), - ( - "-gen-clang-attr-parsed-attr-kinds", - "include/clang/Sema/AttrParsedAttrKinds.inc", - ), - ( - "-gen-clang-attr-parsed-attr-list", - "include/clang/Sema/AttrParsedAttrList.inc", - ), - ( - "-gen-clang-attr-spelling-index", - "include/clang/Sema/AttrSpellingListIndex.inc", - ), - ( - "-gen-clang-attr-template-instantiate", - "include/clang/Sema/AttrTemplateInstantiate.inc", - ), - ], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/Attr.td", - td_srcs = [ - "include/clang/Basic/ASTNode.td", - "include/clang/Basic/Attr.td", - "include/clang/Basic/AttrDocs.td", - "include/clang/Basic/DeclNodes.td", - "include/clang/Basic/StmtNodes.td", - ], -) - -cc_library( - name = "sema", - srcs = glob([ - "lib/Sema/*.cpp", - "lib/Sema/*.h", - ]), - hdrs = glob([ - "include/clang/Sema/*.h", - "include/clang-c/*.h", - ]), - copts = ["$(STACK_FRAME_UNLIMITED)"], - includes = ["include"], - textual_hdrs = [ - "include/clang/Sema/AttrParsedAttrImpl.inc", - "include/clang/Sema/AttrParsedAttrKinds.inc", - "include/clang/Sema/AttrParsedAttrList.inc", - "include/clang/Sema/AttrSpellingListIndex.inc", - "include/clang/Sema/AttrTemplateInstantiate.inc", - "lib/Sema/OpenCLBuiltins.inc", - ], - deps = [ - ":analysis", - ":apinotes", - ":ast", - ":basic", - ":basic_arm_cde_aliases_gen", - ":basic_arm_cde_sema_gen", - ":basic_arm_sme_builtins_gen", - ":basic_arm_sme_builtins_za_state_gen", - ":basic_arm_sme_sema_rangechecks_gen", - ":basic_arm_sme_streaming_attrs_gen", - ":basic_arm_sve_builtins_gen", - ":basic_arm_sve_sema_rangechecks_gen", - ":basic_arm_sve_streaming_attrs_gen", - ":basic_builtins_gen", - ":basic_riscv_sifive_vector_builtin_sema_gen", - ":basic_riscv_vector_builtin_sema_gen", - ":edit", - ":lex", - ":libsema_openclbuiltins_inc_gen", - ":sema_attr_gen", - ":support", - ":type_nodes_gen", - "//llvm:AllTargetsAsmParsers", - "//llvm:AllTargetsCodeGens", - "//llvm:Core", - "//llvm:Demangle", - "//llvm:FrontendHLSL", - "//llvm:FrontendOpenMP", - "//llvm:MC", - "//llvm:MCParser", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -gentbl( - name = "parse_attr_gen", - tbl_outs = [ - ( - "-gen-clang-attr-parser-string-switches", - "include/clang/Parse/AttrParserStringSwitches.inc", - ), - ( - "-gen-clang-attr-subject-match-rules-parser-string-switches", - "include/clang/Parse/AttrSubMatchRulesParserStringSwitches.inc", - ), - ], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/Attr.td", - td_srcs = [ - "include/clang/Basic/ASTNode.td", - "include/clang/Basic/Attr.td", - "include/clang/Basic/AttrDocs.td", - "include/clang/Basic/DeclNodes.td", - "include/clang/Basic/StmtNodes.td", - ], -) - -cc_library( - name = "parse", - srcs = glob([ - "lib/Parse/*.cpp", - ]), - hdrs = [ - "include/clang/Parse/AttrParserStringSwitches.inc", - "include/clang/Parse/AttrSubMatchRulesParserStringSwitches.inc", - ] + glob(["include/clang/Parse/*.h"]), - includes = ["include"], - deps = [ - ":ast", - ":basic", - ":lex", - ":parse_attr_gen", - ":sema", - "//llvm:FrontendOpenMP", - "//llvm:MC", - "//llvm:MCParser", - "//llvm:Support", - ], -) - -cc_library( - name = "ast_matchers", - srcs = glob([ - "lib/ASTMatchers/*.cpp", - ]), - hdrs = glob(["include/clang/ASTMatchers/*.h"]), - includes = ["include"], - deps = [ - ":ast", - ":basic", - ":lex", - "//llvm:Support", - ], -) - -cc_library( - name = "ast_matchers_dynamic", - srcs = glob([ - "lib/ASTMatchers/Dynamic/*.cpp", - "lib/ASTMatchers/Dynamic/*.h", - ]), - hdrs = glob(["include/clang/ASTMatchers/Dynamic/*.h"]), - copts = ["$(STACK_FRAME_UNLIMITED)"], - includes = ["include"], - deps = [ - ":ast", - ":ast_matchers", - ":basic", - "//llvm:FrontendOpenMP", - "//llvm:Support", - ], -) - -cc_library( - name = "rewrite", - srcs = glob([ - "lib/Rewrite/*.cpp", - ]), - hdrs = glob(["include/clang/Rewrite/Core/*.h"]), - includes = ["include"], - deps = [ - ":ast", - ":basic", - ":edit", - ":lex", - "//llvm:Support", - ], -) - -cc_library( - name = "testing", - testonly = 1, - srcs = glob([ - "lib/Testing/*.cpp", - ]), - hdrs = glob(["include/clang/Testing/*.h"]), - includes = ["include"], - deps = [ - ":basic", - ":frontend", - "//llvm:MC", - "//llvm:Support", - "//third-party/unittest:gtest", - ], -) - -cc_library( - name = "tooling_core", - srcs = glob([ - "lib/Tooling/Core/*.cpp", - ]), - hdrs = glob(["include/clang/Tooling/Core/*.h"]), - includes = ["include"], - deps = [ - ":ast", - ":basic", - ":lex", - ":rewrite", - "//llvm:Support", - ], -) - -cc_library( - name = "tooling", - srcs = glob( - [ - "lib/Tooling/*.cpp", - ], - # Temporarily disable until we support the generated file. - exclude = ["lib/Tooling/NodeIntrospection.cpp"], - ), - hdrs = glob([ - "include/clang/Tooling/*.h", - ]), - includes = ["include"], - deps = [ - ":ast", - ":ast_matchers", - ":basic", - ":driver", - ":format", - ":frontend", - ":lex", - ":rewrite", - ":tooling_core", - "//llvm:Option", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -cc_library( - name = "tooling_inclusions", - srcs = glob([ - "lib/Tooling/Inclusions/**/*.cpp", - "lib/Tooling/Inclusions/**/*.inc", - ]), - hdrs = glob([ - "include/clang/Tooling/Inclusions/**/*.h", - ]), - deps = [ - ":ast", - ":basic", - ":lex", - ":rewrite", - ":tooling_core", - "//llvm:Support", - ], -) - -cc_library( - name = "tooling_refactoring", - srcs = glob([ - "lib/Tooling/Refactoring/**/*.cpp", - ]), - hdrs = glob([ - "include/clang/Tooling/Refactoring/**/*.h", - ]), - deps = [ - ":ast", - ":ast_matchers", - ":basic", - ":format", - ":frontend", - ":index", - ":lex", - ":rewrite", - ":tooling", - ":tooling_core", - "//llvm:Support", - ], -) - -gentbl( - name = "tooling_syntax_gen", - tbl_outs = [ - ("-gen-clang-syntax-node-list", "include/clang/Tooling/Syntax/Nodes.inc"), - ("-gen-clang-syntax-node-classes", "include/clang/Tooling/Syntax/NodeClasses.inc"), - ], - tblgen = ":clang-tblgen", - td_file = "include/clang/Tooling/Syntax/Nodes.td", - td_srcs = [ - "include/clang/Tooling/Syntax/Nodes.td", - "include/clang/Tooling/Syntax/Syntax.td", - ], -) - -cc_library( - name = "tooling_syntax", - srcs = glob(["lib/Tooling/Syntax/**/*.cpp"]), - hdrs = glob(["include/clang/Tooling/Syntax/**/*.h"]), - deps = [ - ":ast", - ":basic", - ":lex", - ":tooling_core", - ":tooling_syntax_gen", - "//llvm:Support", - ], -) - -cc_library( - name = "tooling_dependency_scanning", - srcs = glob(["lib/Tooling/DependencyScanning/**/*.cpp"]), - hdrs = glob(["include/clang/Tooling/DependencyScanning/**/*.h"]), - deps = [ - ":basic", - ":codegen", - ":driver", - ":frontend", - ":lex", - ":serialization", - ":tooling", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -cc_library( - name = "transformer", - srcs = glob(["lib/Tooling/Transformer/**/*.cpp"]), - hdrs = glob(["include/clang/Tooling/Transformer/**/*.h"]), - deps = [ - ":ast", - ":ast_matchers", - ":basic", - ":lex", - ":rewrite", - ":tooling_refactoring", - "//llvm:Support", - ], -) - -cc_library( - name = "ast-diff", - srcs = glob(["lib/Tooling/ASTDiff/*.cpp"]), - hdrs = glob(["include/clang/Tooling/ASTDiff/*.h"]), - deps = [ - ":ast", - ":basic", - ":lex", - "//llvm:Support", - ], -) - -cc_library( - name = "crosstu", - srcs = glob(["lib/CrossTU/*.cpp"]), - hdrs = glob(["include/clang/CrossTU/*.h"]), - deps = [ - ":analysis", - ":ast", - ":basic", - ":frontend", - ":index", - "//llvm:Option", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -cc_library( - name = "format", - srcs = glob( - [ - "lib/Format/*.cpp", - "lib/Format/*.h", - ], - ), - hdrs = [ - "lib/Format/FormatTokenLexer.h", - "lib/Format/FormatTokenSource.h", - "lib/Format/Macros.h", - "lib/Format/QualifierAlignmentFixer.h", - "lib/Format/UnwrappedLineParser.h", - ] + glob([ - "include/clang/Format/*.h", - ]), - includes = ["include"], - deps = [ - ":basic", - ":lex", - ":tooling_core", - ":tooling_inclusions", - "//llvm:Support", - ], -) - -cc_library( - name = "edit", - srcs = glob(["lib/Edit/*.cpp"]), - hdrs = glob(["include/clang/Edit/*.h"]), - includes = ["include"], - deps = [ - ":ast", - ":basic", - ":lex", - "//llvm:Support", - ], -) - -cc_library( - name = "static_analyzer_core_options", - hdrs = [ - "include/clang/StaticAnalyzer/Core/AnalyzerOptions.h", - ], - textual_hdrs = [ - "include/clang/StaticAnalyzer/Core/Analyses.def", - "include/clang/StaticAnalyzer/Core/AnalyzerOptions.def", - ], - deps = [ - ":basic", - ":static_analyzer_checkers_gen", - "//llvm:Support", - ], -) - -cc_library( - name = "static_analyzer_core", - srcs = glob([ - "lib/StaticAnalyzer/Core/**/*.cpp", - "lib/StaticAnalyzer/Core/**/*.h", - ]), - hdrs = glob([ - "include/clang/StaticAnalyzer/Core/**/*.h", - ]), - includes = ["include"], - textual_hdrs = glob([ - "include/clang/StaticAnalyzer/Core/**/*.def", - ]), - deps = [ - ":analysis", - ":ast", - ":ast_matchers", - ":basic", - ":crosstu", - ":driver", - ":frontend", - ":lex", - ":rewrite", - ":static_analyzer_checkers_gen", - ":tooling", - ":tooling_core", - "//llvm:Support", - ], -) - -gentbl( - name = "static_analyzer_checkers_gen", - tbl_outs = [( - "-gen-clang-sa-checkers", - "include/clang/StaticAnalyzer/Checkers/Checkers.inc", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/StaticAnalyzer/Checkers/Checkers.td", - td_srcs = [ - "include/clang/StaticAnalyzer/Checkers/CheckerBase.td", - "include/clang/StaticAnalyzer/Checkers/Checkers.td", - ], -) - -cc_library( - name = "static_analyzer_checkers", - srcs = glob([ - "lib/StaticAnalyzer/Checkers/**/*.cpp", - "lib/StaticAnalyzer/Checkers/**/*.h", - ]), - hdrs = [ - "include/clang/StaticAnalyzer/Checkers/Checkers.inc", - ] + glob([ - "include/clang/StaticAnalyzer/Checkers/**/*.h", - ]), - copts = ["$(STACK_FRAME_UNLIMITED)"], - includes = ["include"], - deps = [ - ":analysis", - ":ast", - ":ast_matchers", - ":basic", - ":driver", - ":lex", - ":static_analyzer_checkers_gen", - ":static_analyzer_core", - "//llvm:Support", - ], -) - -gentbl( - name = "driver_options_inc_gen", - tbl_outs = [( - "-gen-opt-parser-defs", - "include/clang/Driver/Options.inc", - )], - tblgen = "//llvm:llvm-tblgen", - td_file = "include/clang/Driver/Options.td", - td_srcs = [ - "//llvm:include/llvm/Option/OptParser.td", - ], -) - -cc_library( - name = "driver", - srcs = glob( - [ - "lib/Driver/*.cpp", - "lib/Driver/ToolChains/*.cpp", - "lib/Driver/ToolChains/*.h", - "lib/Driver/ToolChains/Arch/*.cpp", - "lib/Driver/ToolChains/Arch/*.h", - ], - exclude = [ - "lib/Driver/ToolChains/MSVCSetupApi.h", - ], - ), - hdrs = glob([ - "include/clang/Driver/*.h", - ]), - copts = ["$(STACK_FRAME_UNLIMITED)"], - includes = [ - "include", - # TODO: This is likely a layering issue, but files in Arch are currently - # directly #including "Tools.h". - "lib/Driver", - ], - linkopts = select({ - "@platforms//os:windows": ["version.lib"], - "//conditions:default": [], - }), - textual_hdrs = glob([ - "include/clang/Driver/*.def", - ]), - deps = [ - ":ast", - ":basic", - ":config", - ":driver_options_inc_gen", - ":parse", - ":static_analyzer_checkers_gen", - "//llvm:BinaryFormat", - "//llvm:FrontendDebug", - "//llvm:Instrumentation", - "//llvm:MC", - "//llvm:Object", - "//llvm:Option", - "//llvm:ProfileData", - "//llvm:Support", - "//llvm:Target", - "//llvm:TargetParser", - "//llvm:WindowsDriver", - "//llvm:config", - ], -) - -gentbl( - name = "headers_arm_neon_gen", - tbl_outs = [( - "-gen-arm-neon", - "lib/Headers/arm_neon.h", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_neon.td", - td_srcs = [ - "include/clang/Basic/arm_neon.td", - "include/clang/Basic/arm_neon_incl.td", - ], -) - -gentbl( - name = "headers_arm_fp16_gen", - tbl_outs = [( - "-gen-arm-fp16", - "lib/Headers/arm_fp16.h", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_fp16.td", - td_srcs = [ - "include/clang/Basic/arm_fp16.td", - "include/clang/Basic/arm_neon_incl.td", - ], -) - -gentbl( - name = "headers_arm_mve_gen", - tbl_outs = [( - "-gen-arm-mve-header", - "lib/Headers/arm_mve.h", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_mve.td", - td_srcs = [ - "include/clang/Basic/arm_mve.td", - "include/clang/Basic/arm_mve_defs.td", - ], -) - -gentbl( - name = "headers_arm_cde_gen", - tbl_outs = [( - "-gen-arm-cde-header", - "lib/Headers/arm_cde.h", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_cde.td", - td_srcs = [ - "include/clang/Basic/arm_cde.td", - "include/clang/Basic/arm_mve_defs.td", - ], -) - -gentbl( - name = "headers_arm_sve_gen", - tbl_outs = [( - "-gen-arm-sve-header", - "lib/Headers/arm_sve.h", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_sve.td", - td_srcs = [ - "include/clang/Basic/arm_sve.td", - "include/clang/Basic/arm_sve_sme_incl.td", - ], -) - -gentbl( - name = "headers_arm_bf16_gen", - tbl_outs = [( - "-gen-arm-bf16", - "lib/Headers/arm_bf16.h", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_bf16.td", - td_srcs = [ - "include/clang/Basic/arm_bf16.td", - "include/clang/Basic/arm_neon_incl.td", - ], -) - -gentbl( - name = "headers_arm_sme_gen", - copts = [ - "-Wno-implicit-fallthrough", - "-Wno-error=frame-larger-than=", - ], - tbl_outs = [( - "-gen-arm-sme-header", - "lib/Headers/arm_sme.h", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_sme.td", - td_srcs = [ - "include/clang/Basic/arm_sme.td", - "include/clang/Basic/arm_sve_sme_incl.td", - ], -) - -gentbl( - name = "headers_arm_vector_type_gen", - tbl_outs = [( - "-gen-arm-vector-type", - "lib/Headers/arm_vector_types.h", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/arm_neon.td", - td_srcs = [ - "include/clang/Basic/arm_neon.td", - "include/clang/Basic/arm_neon_incl.td", - ], -) - -gentbl( - name = "headers_riscv_vector", - tbl_outs = [( - "-gen-riscv-vector-header", - "lib/Headers/riscv_vector.h", - )], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/riscv_vector.td", - td_srcs = [ - "include/clang/Basic/riscv_vector.td", - "include/clang/Basic/riscv_vector_common.td", - ], -) - -# We generate the set of builtin headers under a special subdirectory in the -# 'bin' section of the bazel output so that they can be used as data -# dependencies. It requires listing explicitly all the generated inputs here. -builtin_headers = glob( - ["lib/Headers/**/*.h"], - exclude = [ - # FIXME: They are not handled in CMake side. - "lib/Headers/openmp_wrappers/stdlib.h", - "lib/Headers/openmp_wrappers/time.h", - "lib/Headers/ppc_wrappers/nmmintrin.h", - ], -) + [ - "lib/Headers/arm_cde.h", - "lib/Headers/arm_fp16.h", - "lib/Headers/arm_mve.h", - "lib/Headers/arm_neon.h", - "lib/Headers/arm_sve.h", - "lib/Headers/arm_sme.h", - "lib/Headers/arm_vector_types.h", - "lib/Headers/arm_bf16.h", - "lib/Headers/module.modulemap", - "lib/Headers/riscv_vector.h", - "lib/Headers/cuda_wrappers/algorithm", - "lib/Headers/cuda_wrappers/complex", - "lib/Headers/cuda_wrappers/new", - "lib/Headers/openmp_wrappers/cmath", - "lib/Headers/openmp_wrappers/complex", - "lib/Headers/openmp_wrappers/new", -] - -genrule( - name = "builtin_headers_gen", - srcs = builtin_headers, - outs = [hdr.replace("lib/Headers/", "staging/include/") for hdr in builtin_headers], - cmd = """ - for src in $(SRCS); do - relsrc=$${src#*"$(WORKSPACE_ROOT)"/clang/lib/Headers} - target=$(@D)/staging/include/$$relsrc - mkdir -p $$(dirname $$target) - cp $$src $$target - done""", - output_to_bindir = 1, - toolchains = [ - ":workspace_root", - ], -) - -cc_library( - name = "frontend", - srcs = glob([ - "lib/Frontend/*.cpp", - "lib/Frontend/*.h", - ]), - hdrs = glob([ - "include/clang/Frontend/*.h", - ]), - copts = ["$(STACK_FRAME_UNLIMITED)"], - data = [":builtin_headers_gen"], - includes = ["include"], - deps = [ - ":apinotes", - ":ast", - ":basic", - ":config", - ":driver", - ":driver_options_inc_gen", - ":edit", - ":lex", - ":parse", - ":sema", - ":serialization", - ":static_analyzer_core_options", - "//llvm:BinaryFormat", - "//llvm:BitReader", - "//llvm:BitstreamReader", - "//llvm:BitstreamWriter", - "//llvm:Core", - "//llvm:FrontendDebug", - "//llvm:Linker", - "//llvm:MC", - "//llvm:Option", - "//llvm:ProfileData", - "//llvm:Remarks", - "//llvm:Support", - "//llvm:Target", - "//llvm:TargetParser", - "//llvm:TextAPI", - "//llvm:config", - ], -) - -cc_library( - name = "frontend_rewrite", - srcs = glob([ - "lib/Frontend/Rewrite/*.cpp", - ]), - hdrs = glob(["include/clang/Rewrite/Frontend/*.h"]), - includes = ["include"], - deps = [ - ":ast", - ":basic", - ":config", - ":edit", - ":frontend", - ":lex", - ":parse", - ":rewrite", - ":serialization", - "//llvm:Support", - ], -) - -cc_library( - name = "interpreter", - srcs = glob( - [ - "lib/Interpreter/*.cpp", - "lib/Interpreter/*.h", - ], - exclude = ["lib/Interpreter/Wasm.cpp"], - ), - hdrs = glob( - [ - "include/clang/Interpreter/*.h", - ], - exclude = ["lib/Interpreter/Wasm.cpp"], - ), - includes = ["include"], - deps = [ - ":analysis", - ":ast", - ":basic", - ":codegen", - ":driver", - ":edit", - ":frontend", - ":frontend_tool", - ":lex", - ":parse", - ":sema", - ":serialization", - "//llvm:AllTargetsAsmParsers", - "//llvm:AllTargetsCodeGens", - "//llvm:Core", - "//llvm:ExecutionEngine", - "//llvm:MC", - "//llvm:Option", - "//llvm:OrcDebugging", - "//llvm:OrcJIT", - "//llvm:OrcShared", - "//llvm:OrcTargetProcess", - "//llvm:Support", - "//llvm:Target", - "//llvm:TargetParser", - ], -) - -cc_library( - name = "codegen", - srcs = glob([ - "lib/CodeGen/**/*.cpp", - "lib/CodeGen/**/*.h", - ]), - hdrs = glob(["include/clang/CodeGen/*.h"]), - copts = ["$(STACK_FRAME_UNLIMITED)"], - includes = [ - "include", - "lib/CodeGen", - ], - deps = [ - ":analysis", - ":ast", - ":basic", - ":basic_arm_cde_cg_gen", - ":basic_arm_sme_builtin_cg_gen", - ":basic_arm_sve_builtin_cg_gen", - ":basic_riscv_sifive_vector_builtin_cg_gen", - ":basic_riscv_vector_builtin_cg_gen", - ":driver", - ":frontend", - ":lex", - ":sema", - ":serialization", - ":type_nodes_gen", - "//llvm:AllTargetsAsmParsers", - "//llvm:Analysis", - "//llvm:BinaryFormat", - "//llvm:BitReader", - "//llvm:BitWriter", - "//llvm:BitstreamReader", - "//llvm:CodeGen", - "//llvm:CodeGenTypes", - "//llvm:Core", - "//llvm:Coroutines", - "//llvm:Coverage", - "//llvm:DebugInfoDWARF", - "//llvm:Demangle", - "//llvm:FrontendDriver", - "//llvm:FrontendHLSL", - "//llvm:FrontendOffloading", - "//llvm:FrontendOpenMP", - "//llvm:HipStdPar", - "//llvm:IPO", - "//llvm:IRPrinter", - "//llvm:IRReader", - "//llvm:InstCombine", - "//llvm:Instrumentation", - "//llvm:LTO", - "//llvm:Linker", - "//llvm:MC", - "//llvm:ObjCARC", - "//llvm:Object", - "//llvm:Passes", - "//llvm:ProfileData", - "//llvm:Scalar", - "//llvm:Support", - "//llvm:Target", - "//llvm:TargetParser", - "//llvm:TransformUtils", - ], -) - -cc_library( - name = "static_analyzer_frontend", - srcs = glob([ - "lib/StaticAnalyzer/Frontend/**/*.cpp", - "lib/StaticAnalyzer/Frontend/**/*.h", - ]), - hdrs = glob(["include/clang/StaticAnalyzer/Frontend/**/*.h"]), - includes = ["include"], - deps = [ - ":analysis", - ":ast", - ":basic", - ":crosstu", - ":driver", - ":frontend", - ":lex", - ":rewrite", - ":serialization", - ":static_analyzer_checkers", - ":static_analyzer_core", - ":tooling", - ":tooling_core", - "//llvm:Support", - ], -) - -gentbl( - name = "serialization_attr_gen", - tbl_outs = [ - ( - "-gen-clang-attr-pch-read", - "include/clang/Serialization/AttrPCHRead.inc", - ), - ( - "-gen-clang-attr-pch-write", - "include/clang/Serialization/AttrPCHWrite.inc", - ), - ], - tblgen = ":clang-tblgen", - td_file = "include/clang/Basic/Attr.td", - td_srcs = [ - "include/clang/Basic/ASTNode.td", - "include/clang/Basic/Attr.td", - "include/clang/Basic/AttrDocs.td", - "include/clang/Basic/DeclNodes.td", - "include/clang/Basic/StmtNodes.td", - ], -) - -cc_library( - name = "support", - srcs = glob([ - "lib/Support/*.cpp", - ]), - hdrs = glob([ - "include/clang/Support/*.h", - ]), - includes = ["include"], - deps = [ - "//llvm:Support", - ], -) - -cc_library( - name = "install_api", - srcs = glob([ - "lib/InstallAPI/*.cpp", - "lib/InstallAPI/*.h", - ]), - hdrs = glob([ - "include/clang/InstallAPI/*.h", - ]), - includes = ["include"], - deps = [ - ":ast", - ":basic", - ":frontend", - ":support", - "//llvm:Core", - "//llvm:Demangle", - "//llvm:Support", - "//llvm:TextAPI", - "//llvm:TextAPIBinaryReader", - ], -) - -cc_library( - name = "serialization", - srcs = [ - "include/clang/Serialization/AttrPCHRead.inc", - "include/clang/Serialization/AttrPCHWrite.inc", - ] + glob([ - "include/clang/Frontend/*.h", - "lib/Serialization/*.cpp", - "lib/Serialization/*.h", - ]), - hdrs = glob([ - "include/clang/Serialization/*.h", - ]), - includes = ["include"], - textual_hdrs = glob([ - "include/clang/Serialization/*.def", - ]), - deps = [ - ":apinotes", - ":ast", - ":basic", - ":driver", - ":lex", - ":sema", - ":serialization_attr_gen", - ":static_analyzer_core_options", - ":type_nodes_gen", - "//llvm:BitReader", - "//llvm:BitWriter", - "//llvm:BitstreamReader", - "//llvm:BitstreamWriter", - "//llvm:FrontendOpenMP", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -cc_library( - name = "frontend_tool", - srcs = glob([ - "lib/FrontendTool/*.cpp", - ]), - hdrs = glob(["include/clang/FrontendTool/*.h"]), - includes = ["include"], - deps = [ - ":arc_migrate", - ":codegen", - ":config", - ":driver", - ":extract_api", - ":frontend", - ":frontend_rewrite", - ":static_analyzer_frontend", - "//llvm:Option", - "//llvm:Support", - ], -) - -cc_library( - name = "arc_migrate", - srcs = glob([ - "lib/ARCMigrate/*.cpp", - "lib/ARCMigrate/*.h", - ]), - hdrs = glob(["include/clang/ARCMigrate/*.h"]), - includes = ["include"], - deps = [ - ":analysis", - ":ast", - ":basic", - ":edit", - ":frontend", - ":frontend_rewrite", - ":lex", - ":parse", - ":rewrite", - ":sema", - ":serialization", - ":static_analyzer_checkers", - ":static_analyzer_core", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -cc_library( - name = "libclang_static", - srcs = glob([ - "tools/libclang/*.cpp", - "tools/libclang/*.h", - ]), - hdrs = glob(["include/clang-c/*.h"]), - defines = ["CINDEX_NO_EXPORTS"], - deps = [ - ":arc_migrate", - ":ast", - ":basic", - ":codegen", - ":config", - ":driver", - ":extract_api", - ":frontend", - ":index", - ":lex", - ":rewrite", - ":sema", - ":tooling", - "//llvm:BitstreamReader", - "//llvm:FrontendOpenMP", - "//llvm:Support", - "//llvm:config", - ], -) - -cc_plugin_library( - name = "libclang", - srcs = glob([ - "tools/libclang/*.cpp", - "tools/libclang/*.h", - ]), - hdrs = glob(["include/clang-c/*.h"]), - copts = select({ - "@platforms//os:windows": ["-D_CINDEX_LIB_"], - "//conditions:default": [], - }), - strip_include_prefix = "include", - deps = [ - ":arc_migrate", - ":ast", - ":basic", - ":codegen", - ":config", - ":driver", - ":extract_api", - ":frontend", - ":index", - ":lex", - ":rewrite", - ":sema", - ":tooling", - "//llvm:BitstreamReader", - "//llvm:FrontendOpenMP", - "//llvm:Support", - "//llvm:config", - ], -) - -filegroup( - name = "python-sources", - srcs = [ - "bindings/python/clang/cindex.py", - ], -) - -filegroup( - name = "python-cindex-examples", - srcs = [ - "bindings/python/examples/cindex/cindex-dump.py", - "bindings/python/examples/cindex/cindex-includes.py", - ], -) - -cc_binary( - name = "c-index-test", - testonly = 1, - srcs = [ - "tools/c-index-test/c-index-test.c", - "tools/c-index-test/core_main.cpp", - ], - copts = [ - "-Wno-uninitialized", - ], - stamp = 0, - deps = [ - ":ast", - ":basic", - ":codegen", - ":config", - ":frontend", - ":index", - ":lex", - ":libclang", - ":serialization", - "//llvm:Core", - "//llvm:MC", - "//llvm:Support", - ], -) - -cc_library( - name = "apinotes", - srcs = glob([ - "lib/APINotes/*.cpp", - "lib/APINotes/*.h", - ]), - hdrs = glob(["include/clang/APINotes/*.h"]), - deps = [ - ":basic", - "//llvm:BitWriter", - "//llvm:BitstreamReader", - "//llvm:BitstreamWriter", - "//llvm:Support", - ], -) - -cc_binary( - name = "arcmt-test", - testonly = 1, - srcs = ["tools/arcmt-test/arcmt-test.cpp"], - stamp = 0, - deps = [ - ":arc_migrate", - ":ast", - ":basic", - ":frontend", - ":frontend_rewrite", - ":lex", - "//llvm:Support", - ], -) - -cc_binary( - name = "c-arcmt-test", - testonly = 1, - srcs = ["tools/c-arcmt-test/c-arcmt-test.c"], - copts = select({ - "@platforms//os:windows": [], - "//conditions:default": ["-std=gnu99"], - }), - stamp = 0, - deps = [ - ":codegen", - ":libclang", - "//llvm:MC", - "//llvm:Support", - ], -) - -cc_binary( - name = "clang-import-test", - testonly = 1, - srcs = glob([ - "tools/clang-import-test/*.cpp", - ]), - stamp = 0, - deps = [ - ":ast", - ":basic", - ":codegen", - ":driver", - ":frontend", - ":lex", - ":parse", - "//llvm:Core", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -cc_library( - name = "clang-driver", - srcs = glob(["tools/driver/*.cpp"]), - copts = [ - # Disable stack frame size checks in the driver because - # clang::ensureStackAddressSpace allocates a large array on the stack. - "$(STACK_FRAME_UNLIMITED)", - ], - deps = [ - ":analysis", - ":ast", - ":basic", - ":codegen", - ":config", - ":driver", - ":frontend", - ":frontend_rewrite", - ":frontend_tool", - ":lex", - ":parse", - ":sema", - ":serialization", - ":static_analyzer_frontend", - "//llvm:AllTargetsAsmParsers", - "//llvm:AllTargetsCodeGens", - "//llvm:BitReader", - "//llvm:BitWriter", - "//llvm:CodeGen", - "//llvm:Core", - "//llvm:IPO", - "//llvm:MC", - "//llvm:MCParser", - "//llvm:Option", - "//llvm:Support", - "//llvm:Target", - "//llvm:TargetParser", - "//llvm:config", - ], -) - -llvm_driver_cc_binary( - name = "clang", - stamp = 0, - deps = [":clang-driver"], -) - -cc_binary( - name = "diagtool", - srcs = glob([ - "tools/diagtool/*.cpp", - "tools/diagtool/*.h", - ]), - stamp = 0, - deps = [ - ":basic", - ":diagnostic_defs_gen", - ":frontend", - ":lex", - ":sema", - "//llvm:Support", - ], -) - -filegroup( - name = "exploded_graph_rewriter", - testonly = 1, - data = ["utils/analyzer/exploded-graph-rewriter.py"], -) - -filegroup( - name = "module-deps-to-rsp", - testonly = 1, - data = ["utils/module-deps-to-rsp.py"], -) - -filegroup( - name = "hmaptool", - testonly = 1, - data = ["utils/hmaptool/hmaptool"], -) - -binary_alias( - name = "clang++", - binary = ":clang", -) - -cc_binary( - name = "clang-check", - srcs = ["tools/clang-check/ClangCheck.cpp"], - stamp = 0, - deps = [ - ":ast", - ":codegen", - ":driver", - ":frontend", - ":frontend_rewrite", - ":serialization", - ":static_analyzer_frontend", - ":tooling", - ":tooling_syntax", - "//llvm:Option", - "//llvm:Support", - ], -) - -cc_binary( - name = "clang-format", - srcs = [ - "lib/Format/MatchFilePath.h", - "tools/clang-format/ClangFormat.cpp", - ], - stamp = 0, - deps = [ - ":basic", - ":format", - ":frontend", - ":rewrite", - "//llvm:Support", - ], -) - -cc_binary( - name = "clang-diff", - srcs = glob(["tools/clang-diff/*.cpp"]), - stamp = 0, - deps = [ - ":ast-diff", - ":tooling", - "//llvm:Support", - ], -) - -cc_binary( - name = "clang-offload-bundler", - srcs = glob(["tools/clang-offload-bundler/*.cpp"]), - stamp = 0, - deps = [ - ":basic", - ":driver", - ":tooling", - "//llvm:BitWriter", - "//llvm:Core", - "//llvm:Object", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -cc_binary( - name = "clang-offload-packager", - srcs = glob(["tools/clang-offload-packager/*.cpp"]), - stamp = 0, - deps = [ - ":basic", - "//llvm:BinaryFormat", - "//llvm:Object", - "//llvm:Support", - ], -) - -gentbl( - name = "linker_wrapper_opts_gen", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/clang-linker-wrapper/LinkerWrapperOpts.inc", - )], - tblgen = "//llvm:llvm-tblgen", - td_file = "tools/clang-linker-wrapper/LinkerWrapperOpts.td", - td_srcs = [ - "tools/clang-linker-wrapper/LinkerWrapperOpts.td", - "//llvm:include/llvm/Option/OptParser.td", - ], -) - -cc_binary( - name = "clang-linker-wrapper", - srcs = [ - "tools/clang-linker-wrapper/ClangLinkerWrapper.cpp", - ], - copts = [ - "-I$(GENDIR)/$(WORKSPACE_ROOT)/clang/tools/clang-linker-wrapper", - ], - stamp = 0, - toolchains = [ - ":workspace_root", - ], - deps = [ - ":basic", - ":linker_wrapper_opts_gen", - "//llvm:AllTargetsAsmParsers", - "//llvm:Analysis", - "//llvm:BinaryFormat", - "//llvm:BitWriter", - "//llvm:CodeGen", - "//llvm:Core", - "//llvm:FrontendOffloading", - "//llvm:IRReader", - "//llvm:LTO", - "//llvm:MC", - "//llvm:Object", - "//llvm:Option", - "//llvm:Passes", - "//llvm:Remarks", - "//llvm:Support", - "//llvm:Target", - "//llvm:TargetParser", - "//llvm:TransformUtils", - ], -) - -cc_binary( - name = "clang-refactor", - srcs = glob([ - "tools/clang-refactor/*.cpp", - "tools/clang-refactor/*.h", - ]), - stamp = 0, - deps = [ - ":ast", - ":basic", - ":format", - ":frontend", - ":lex", - ":rewrite", - ":tooling", - ":tooling_refactoring", - "//llvm:Support", - ], -) - -cc_binary( - name = "clang-rename", - srcs = glob(["tools/clang-rename/*.cpp"]), - stamp = 0, - deps = [ - ":basic", - ":frontend", - ":rewrite", - ":tooling", - ":tooling_refactoring", - "//llvm:Support", - ], -) - -cc_binary( - name = "clang-repl", - srcs = glob(["tools/clang-repl/*.cpp"]), - stamp = 0, - deps = [ - ":basic", - ":frontend", - ":interpreter", - ":lex", - ":sema", - ":tooling", - "//llvm:Core", - "//llvm:LineEditor", - "//llvm:Option", - "//llvm:OrcJIT", - "//llvm:Support", - ], -) - -cc_binary( - name = "clang-extdef-mapping", - srcs = glob(["tools/clang-extdef-mapping/*.cpp"]), - stamp = 0, - deps = [ - ":ast", - ":basic", - ":crosstu", - ":frontend", - ":tooling", - "//llvm:Support", - ], -) - -gentbl( - name = "ScanDepsTableGen", - strip_include_prefix = "tools/clang-scan-deps", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/clang-scan-deps/Opts.inc", - )], - tblgen = "//llvm:llvm-tblgen", - td_file = "tools/clang-scan-deps/Opts.td", - td_srcs = ["//llvm:include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "clang-scan-deps-lib", - srcs = glob(["tools/clang-scan-deps/*.cpp"]), - deps = [ - ":ScanDepsTableGen", - ":driver", - ":frontend", - ":tooling", - ":tooling_dependency_scanning", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -llvm_driver_cc_binary( - name = "clang-scan-deps", - stamp = 0, - deps = [":clang-scan-deps-lib"], -) - -cc_library( - name = "extract_api", - srcs = glob([ - "lib/ExtractAPI/**/*.cpp", - ]), - hdrs = glob([ - "include/clang/ExtractAPI/**/*.h", - ]) + [ - "include/clang/ExtractAPI/APIRecords.inc", - ], - includes = ["include"], - deps = [ - ":ast", - ":basic", - ":frontend", - ":index", - ":install_api", - ":lex", - "//llvm:Option", - "//llvm:Support", - "//llvm:TargetParser", - ], -) diff --git a/utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h b/utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h deleted file mode 100644 index ac0d9eb24931f..0000000000000 --- a/utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h +++ /dev/null @@ -1,116 +0,0 @@ -/*===------- clang/Config/config.h - llvm configuration -----------*- 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 */ -/* */ -/*===----------------------------------------------------------------------===*/ - -/* This is a manual port of config.h.cmake for the symbols that do not change - based on platform. Those that do change should not be defined here and - instead use Bazel cc_library defines. Some attempt has been made to extract - such symbols that do vary based on platform (for the platforms we care about) - into Bazel defines, but it is by no means complete, so if you see something - that looks wrong, it probably is. */ - -#ifdef CLANG_CONFIG_H -#error config.h can only be included once -#else -#define CLANG_CONFIG_H - -/* Bug report URL. */ -#define BUG_REPORT_URL "https://github.com/llvm/llvm-project/issues/" - -/* Default to -fPIE and -pie on Linux. */ -#define CLANG_DEFAULT_PIE_ON_LINUX 1 - -/* Default linker to use. */ -#define CLANG_DEFAULT_LINKER "" - -/* Default C++ stdlib to use. */ -#define CLANG_DEFAULT_CXX_STDLIB "" - -/* Default runtime library to use. */ -#define CLANG_DEFAULT_RTLIB "" - -/* Default unwind library to use. */ -#define CLANG_DEFAULT_UNWINDLIB "" - -/* Default objcopy to use */ -#define CLANG_DEFAULT_OBJCOPY "objcopy" - -/* Default OpenMP runtime used by -fopenmp. */ -#define CLANG_DEFAULT_OPENMP_RUNTIME "libomp" - -/* Default architecture for SystemZ. */ -#define CLANG_SYSTEMZ_DEFAULT_ARCH "z10" - -/* Multilib basename for libdir. */ -#define CLANG_INSTALL_LIBDIR_BASENAME "lib" - -/* Relative directory for resource files */ -#define CLANG_RESOURCE_DIR "" - -/* Directories clang will search for headers */ -#define C_INCLUDE_DIRS "" - -/* Directories clang will search for configuration files */ -/* #undef CLANG_CONFIG_FILE_SYSTEM_DIR */ -/* #undef CLANG_CONFIG_FILE_USER_DIR */ - -/* Default to all compiler invocations for --sysroot=. */ -#define DEFAULT_SYSROOT "" - -/* Directory where gcc is installed. */ -#define GCC_INSTALL_PREFIX "" - -/* Define if we have libxml2 */ -/* #undef CLANG_HAVE_LIBXML */ - -/* Define if we have sys/resource.h (rlimits) */ -/* CLANG_HAVE_RLIMITS defined conditionally below */ - -/* Define if we have dlfcn.h */ -#define CLANG_HAVE_DLFCN_H 1 - -/* Define if dladdr() is available on this platform. */ -#define CLANG_HAVE_DLADDR 1 - -/* Linker version detected at compile time. */ -/* #undef HOST_LINK_VERSION */ - -/* pass --build-id to ld */ -/* #undef ENABLE_LINKER_BUILD_ID */ - -/* enable x86 relax relocations by default */ -#define ENABLE_X86_RELAX_RELOCATIONS 1 - -/* enable IEEE binary128 as default long double format on PowerPC Linux. */ -#define PPC_LINUX_DEFAULT_IEEELONGDOUBLE 0 - -/* Enable the experimental new pass manager by default */ -#define ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER 0 - -/* Enable each functionality of modules */ -#define CLANG_ENABLE_ARCMT 1 -#define CLANG_ENABLE_OBJC_REWRITER 1 -#define CLANG_ENABLE_STATIC_ANALYZER 1 - -/* Spawn a new process clang.exe for the CC1 tool invocation, when necessary */ -#define CLANG_SPAWN_CC1 0 - -/* Whether to enable opaque pointers by default */ -#define CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL 1 - -/* Directly provide definitions here behind platform preprocessor definitions. - * The preprocessor conditions are sufficient to handle all of the configuration - * on platforms targeted by Bazel, and defining these here more faithfully - * matches how the users of this header expect things to work with CMake. - */ - -#ifndef _WIN32 -#define CLANG_HAVE_RLIMITS 1 -#endif - -#endif diff --git a/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel deleted file mode 100644 index 884a6055cf4e0..0000000000000 --- a/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel +++ /dev/null @@ -1,552 +0,0 @@ -# This file is licensed 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 - -package( - default_visibility = ["//visibility:public"], -) - -licenses(["notice"]) - -cc_test( - name = "ast_tests", - size = "medium", - srcs = glob( - [ - "AST/*.cpp", - "AST/*.h", - ], - allow_empty = False, - ), - shard_count = 20, - deps = [ - "//clang:ast", - "//clang:ast_matchers", - "//clang:basic", - "//clang:frontend", - "//clang:lex", - "//clang:testing", - "//clang:tooling", - "//llvm:Core", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TestingAnnotations", - "//llvm:TestingSupport", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_library( - name = "ast_matchers_tests_hdrs", - testonly = 1, - hdrs = glob( - ["ASTMatchers/*.h"], - allow_empty = False, - ), - deps = [ - "//clang:ast_matchers", - "//clang:frontend", - "//clang:testing", - "//clang:tooling", - "//third-party/unittest:gtest", - ], -) - -cc_test( - name = "ast_matchers_tests", - size = "medium", - srcs = glob( - ["ASTMatchers/*.cpp"], - allow_empty = False, - ), - shard_count = 20, - deps = [ - ":ast_matchers_tests_hdrs", - "//clang:ast", - "//clang:ast_matchers", - "//clang:frontend", - "//clang:tooling", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TestingSupport", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "ast_matchers_dynamic_tests", - size = "small", - srcs = glob( - ["ASTMatchers/Dynamic/*.cpp"], - allow_empty = False, - ), - deps = [ - ":ast_matchers_tests_hdrs", - "//clang:ast_matchers", - "//clang:ast_matchers_dynamic", - "//clang:frontend", - "//clang:tooling", - "//llvm:Support", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "analysis_tests", - size = "small", - srcs = glob( - [ - "Analysis/*.cpp", - "Analysis/*.h", - ], - allow_empty = False, - ), - deps = [ - "//clang:analysis", - "//clang:ast", - "//clang:ast_matchers", - "//clang:basic", - "//clang:frontend", - "//clang:lex", - "//clang:parse", - "//clang:tooling", - "//llvm:Support", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "analysis_flow_sensitive_tests", - srcs = glob( - [ - "Analysis/FlowSensitive/*.cpp", - "Analysis/FlowSensitive/*.h", - ], - allow_empty = False, - ), - deps = [ - "//clang:analysis", - "//clang:ast", - "//clang:ast_matchers", - "//clang:basic", - "//clang:frontend", - "//clang:lex", - "//clang:serialization", - "//clang:testing", - "//clang:tooling", - "//llvm:Support", - "//llvm:TestingADT", - "//llvm:TestingAnnotations", - "//llvm:TestingSupport", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "basic_tests", - size = "small", - srcs = glob( - ["Basic/*.cpp"], - allow_empty = False, - ), - deps = [ - "//clang:basic", - "//clang:frontend", - "//clang:lex", - "//llvm:Support", - "//llvm:TestingSupport", - "//llvm:config", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "codegen_tests", - size = "small", - srcs = glob( - [ - "CodeGen/*.cpp", - "CodeGen/*.h", - ], - allow_empty = False, - ), - deps = [ - "//clang:ast", - "//clang:basic", - "//clang:codegen", - "//clang:frontend", - "//clang:lex", - "//clang:parse", - "//clang:sema", - "//llvm:Core", - "//llvm:Support", - "//llvm:TargetParser", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "format_tests", - size = "medium", - srcs = glob( - [ - "Format/*.cpp", - "Format/*.h", - "Tooling/*.h", - ], - allow_empty = False, - ), - copts = ["$(STACK_FRAME_UNLIMITED)"], - features = ["-layering_check"], # #include "../../lib/Format/TokenAnalyzer.h" - shard_count = 20, - deps = [ - "//clang:basic", - "//clang:format", - "//clang:frontend", - "//clang:rewrite", - "//clang:tooling_core", - "//llvm:Support", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "frontend_tests", - size = "small", - srcs = glob( - ["Frontend/*.cpp"], - allow_empty = False, - ), - deps = [ - "//clang:ast", - "//clang:basic", - "//clang:codegen", - "//clang:driver_options_inc_gen", - "//clang:frontend", - "//clang:frontend_tool", - "//clang:lex", - "//clang:sema", - "//clang:serialization", - "//llvm:Support", - "//llvm:TargetParser", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "lex_tests", - size = "small", - srcs = glob( - [ - "Lex/*.cpp", - "Lex/*.h", - ], - allow_empty = False, - ), - copts = ["$(STACK_FRAME_UNLIMITED)"], - deps = [ - "//clang:ast", - "//clang:basic", - "//clang:frontend", - "//clang:lex", - "//clang:parse", - "//clang:sema", - "//clang:serialization", - "//llvm:Support", - "//llvm:TestingAnnotations", - "//llvm:TestingSupport", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -# A library to carefully expose the tooling headers using the include prefix -# expected by the `rename_tests`. -cc_library( - name = "rename_tests_tooling_hdrs", - testonly = 1, - hdrs = glob( - ["Tooling/*.h"], - allow_empty = False, - ), - include_prefix = "unittests", - deps = [ - "//clang:ast", - "//clang:basic", - "//clang:frontend", - "//clang:rewrite", - "//clang:tooling", - "//clang:tooling_core", - "//llvm:Support", - "//third-party/unittest:gtest", - ], -) - -cc_test( - name = "rename_tests", - size = "small", - timeout = "moderate", - srcs = glob( - [ - "Rename/*.cpp", - "Rename/*.h", - ], - allow_empty = False, - ), - shard_count = 20, - deps = [ - ":rename_tests_tooling_hdrs", - "//clang:ast_matchers", - "//clang:basic", - "//clang:format", - "//clang:frontend", - "//clang:tooling", - "//clang:tooling_refactoring", - "//llvm:Support", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "rewrite_tests", - size = "small", - srcs = glob( - ["Rewrite/*.cpp"], - allow_empty = False, - ), - deps = [ - "//clang:rewrite", - "//clang:tooling", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "sema_tests", - size = "small", - srcs = glob( - ["Sema/*.cpp"], - allow_empty = False, - ), - deps = [ - ":ast_matchers_tests_hdrs", - "//clang:ast", - "//clang:ast_matchers", - "//clang:frontend", - "//clang:lex", - "//clang:parse", - "//clang:sema", - "//clang:tooling", - "//llvm:TestingAnnotations", - "//llvm:TestingSupport", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_library( - name = "static_analyzer_test_headers", - testonly = 1, - hdrs = glob( - ["StaticAnalyzer/*.h"], - allow_empty = False, - ), - deps = [ - "//clang:ast_matchers", - "//clang:crosstu", - "//clang:frontend", - "//clang:static_analyzer_core", - "//clang:static_analyzer_frontend", - "//clang:testing", - "//clang:tooling", - "//third-party/unittest:gtest", - ], -) - -cc_test( - name = "static_analyzer_tests", - size = "small", - srcs = glob( - ["StaticAnalyzer/*.cpp"], - allow_empty = False, - exclude = [ - # New test has unused-variable warnings. - "StaticAnalyzer/ParamRegionTest.cpp", - ], - ), - deps = [ - ":static_analyzer_test_headers", - "//clang:analysis", - "//clang:ast", - "//clang:ast_matchers", - "//clang:basic", - "//clang:frontend", - "//clang:static_analyzer_core", - "//clang:static_analyzer_frontend", - "//clang:testing", - "//clang:tooling", - "//llvm:Support", - "//llvm:config", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "tooling_tests", - size = "medium", - srcs = glob( - [ - "Tooling/*.cpp", - "Tooling/*.h", - ], - allow_empty = False, - ), - shard_count = 20, - deps = [ - "//clang:ast", - "//clang:ast_matchers", - "//clang:basic", - "//clang:driver", - "//clang:format", - "//clang:frontend", - "//clang:lex", - "//clang:rewrite", - "//clang:testing", - "//clang:tooling", - "//clang:tooling_core", - "//clang:tooling_dependency_scanning", - "//clang:tooling_inclusions", - "//clang:tooling_refactoring", - "//clang:transformer", - "//llvm:MC", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TestingAnnotations", - "//llvm:TestingSupport", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -# A library to carefully expose the tooling headers using the include prefix -# expected by the `tooling_recursive_ast_visitor_tests`. -cc_library( - name = "tooling_recursive_ast_visitor_tests_tooling_hdrs", - testonly = 1, - hdrs = glob( - ["Tooling/*.h"], - allow_empty = False, - ), - strip_include_prefix = "Tooling", - deps = [ - "//clang:ast", - "//clang:basic", - "//clang:frontend", - "//clang:rewrite", - "//clang:tooling", - "//clang:tooling_core", - "//llvm:Support", - "//third-party/unittest:gtest", - ], -) - -cc_test( - name = "tooling_recursive_ast_visitor_tests", - size = "medium", - srcs = glob( - ["Tooling/RecursiveASTVisitorTests/*.cpp"], - allow_empty = False, - ) + [ - "Tooling/RecursiveASTVisitorTests/CallbacksCommon.h", - ], - deps = [ - ":tooling_recursive_ast_visitor_tests_tooling_hdrs", - "//clang:ast", - "//clang:basic", - "//clang:frontend", - "//clang:lex", - "//clang:tooling", - "//clang:tooling_syntax", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TestingSupport", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "tooling_syntax_tests", - size = "medium", - srcs = glob( - [ - "Tooling/Syntax/*.cpp", - "Tooling/Syntax/*.h", - ], - allow_empty = False, - ), - shard_count = 20, - deps = [ - "//clang:ast", - "//clang:basic", - "//clang:frontend", - "//clang:lex", - "//clang:testing", - "//clang:tooling", - "//clang:tooling_core", - "//clang:tooling_syntax", - "//llvm:Support", - "//llvm:TestingAnnotations", - "//llvm:TestingSupport", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "libclang_tests", - size = "small", - srcs = glob( - ["libclang/*.cpp"], - allow_empty = False, - ) + [ - "libclang/TestUtils.h", - ], - args = select({ - "@platforms//os:windows": [ - # Need to disable the VFS tests that don't use Windows friendly - # paths. These are also disabled on Windows in the CMake build. - "--gtest_filter=-*VirtualFileOverlay*", - ], - "//conditions:default": [], - }), - deps = [ - "//clang:libclang", - "//llvm:Support", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) diff --git a/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel b/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel deleted file mode 100644 index 9a4e103be01e2..0000000000000 --- a/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel +++ /dev/null @@ -1,110 +0,0 @@ -# This file is licensed 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 - -package( - default_visibility = ["//visibility:public"], - features = ["layering_check"], -) - -licenses(["notice"]) - -cc_library( - name = "config", - defines = select({ - "@platforms//os:linux": [ - "COMPILER_RT_HAS_ATOMICS=1", - "COMPILER_RT_HAS_FCNTL_LCK=1", - "COMPILER_RT_HAS_UNAME=1", - ], - # Will raise error unless supported platforms. - }), - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), -) - -WIN32_ONLY_FILES = [ - "lib/profile/WindowsMMap.c", -] - -cc_library( - name = "profile", - srcs = glob( - [ - "lib/profile/*.c", - "lib/profile/*.cpp", - "lib/profile/*.h", - ], - exclude = WIN32_ONLY_FILES, - ) + select({ - "@platforms//os:windows": WIN32_ONLY_FILES, - "//conditions:default": [], - }), - hdrs = glob([ - "include/profile/*.h", - "include/profile/*.inc", - ]), - includes = [ - "include", - ], - linkstatic = True, - deps = [ - ":config", - ], -) - -cc_library( - name = "orc_rt_common_headers", - hdrs = [ - "lib/orc/adt.h", - "lib/orc/bitmask_enum.h", - "lib/orc/common.h", - "lib/orc/compiler.h", - "lib/orc/debug.h", - "lib/orc/endianness.h", - "lib/orc/error.h", - "lib/orc/executor_address.h", - "lib/orc/executor_symbol_def.h", - "lib/orc/extensible_rtti.h", - "lib/orc/interval_map.h", - "lib/orc/interval_set.h", - "lib/orc/simple_packed_serialization.h", - "lib/orc/stl_extras.h", - "lib/orc/string_pool.h", - "lib/orc/wrapper_function_utils.h", - ], - strip_include_prefix = "lib/orc", -) - -cc_library( - name = "orc_rt", - srcs = [ - "lib/orc/debug.cpp", - "lib/orc/dlfcn_wrapper.cpp", - "lib/orc/extensible_rtti.cpp", - "lib/orc/log_error_to_stderr.cpp", - "lib/orc/run_program_wrapper.cpp", - ] + select({ - "@platforms//os:macos": [ - "lib/orc/macho_platform.cpp", - "lib/orc/macho_platform.h", - "lib/orc/macho_tlv.arm64.S", - "lib/orc/macho_tlv.x86-64.S", - ], - "@platforms//os:linux": [ - "lib/orc/elfnix_platform.cpp", - "lib/orc/elfnix_platform.h", - "lib/orc/elfnix_tls.aarch64.S", - "lib/orc/elfnix_tls.ppc64.S", - "lib/orc/elfnix_tls.x86-64.S", - ], - }), - hdrs = glob(["include/orc_rt/*.h"]), - includes = ["include"], - linkstatic = True, - deps = [ - ":orc_rt_common_headers", - ], -) diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel deleted file mode 100644 index eab5e28511c2c..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ /dev/null @@ -1,3716 +0,0 @@ -# This file is licensed 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 - -# LLVM libc project. -load("@bazel_skylib//lib:selects.bzl", "selects") -load("@bazel_skylib//rules:common_settings.bzl", "string_flag") -load( - ":libc_build_rules.bzl", - "libc_function", - "libc_math_function", - "libc_support_library", -) -load(":platforms.bzl", "PLATFORM_CPU_ARM64", "PLATFORM_CPU_X86_64") - -package( - default_visibility = ["//visibility:public"], - features = [ - "-use_header_modules", - "-layering_check", - ], -) - -licenses(["notice"]) - -# A flag to pick which `mpfr` to use for math tests. -# Usage: `--@llvm-project//libc:mpfr=`. -# Flag documentation: https://bazel.build/extending/config -string_flag( - name = "mpfr", - build_setting_default = "external", - values = [ - "disable", # Skip tests that need mpfr - "external", # Build mpfr from source - "system", # Use system mpfr (non hermetic) - ], -) - -config_setting( - name = "mpfr_disable", - flag_values = {":mpfr": "disable"}, -) - -config_setting( - name = "mpfr_external", - flag_values = {":mpfr": "external"}, -) - -config_setting( - name = "mpfr_system", - flag_values = {":mpfr": "system"}, -) - -################################## Base Config ################################# - -cc_library( - name = "__support_macros_config", - hdrs = ["src/__support/macros/config.h"], -) - -################################# Include Files ################################ - -libc_support_library( - name = "llvm_libc_macros_math_macros", - hdrs = ["include/llvm-libc-macros/math-macros.h"], - deps = [":llvm_libc_macros_limits_macros"], -) - -libc_support_library( - name = "llvm_libc_macros_limits_macros", - hdrs = ["include/llvm-libc-macros/limits-macros.h"], -) - -libc_support_library( - name = "llvm_libc_macros_float_macros", - hdrs = ["include/llvm-libc-macros/float-macros.h"], -) - -libc_support_library( - name = "llvm_libc_macros_float16_macros", - hdrs = ["include/llvm-libc-macros/float16-macros.h"], - deps = [":llvm_libc_types_float128"], -) - -libc_support_library( - name = "llvm_libc_macros_stdint_macros", - hdrs = ["include/llvm-libc-macros/stdint-macros.h"], -) - -libc_support_library( - name = "llvm_libc_macros_stdfix_macros", - hdrs = ["include/llvm-libc-macros/stdfix-macros.h"], - deps = [":llvm_libc_macros_float_macros"], -) - -libc_support_library( - name = "llvm_libc_types_float128", - hdrs = ["include/llvm-libc-types/float128.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [":llvm_libc_macros_float_macros"], -) - -libc_support_library( - name = "llvm_libc_macros_fcntl_macros", - hdrs = ["include/llvm-libc-macros/linux/fcntl-macros.h"], -) - -########################### Macro Proxy Header Files ########################### - -libc_support_library( - name = "hdr_math_macros", - hdrs = ["hdr/math_macros.h"], -) - -libc_support_library( - name = "hdr_fenv_macros", - hdrs = ["hdr/fenv_macros.h"], -) - -libc_support_library( - name = "hdr_signal_macros", - hdrs = ["hdr/signal_macros.h"], -) - -libc_support_library( - name = "hdr_sys_epoll_macros", - hdrs = ["hdr/sys_epoll_macros.h"], -) - -libc_support_library( - name = "hdr_errno_macros", - hdrs = ["hdr/errno_macros.h"], -) - -libc_support_library( - name = "hdr_time_macros", - hdrs = ["hdr/time_macros.h"], -) - -libc_support_library( - name = "hdr_float_macros", - hdrs = ["hdr/float_macros.h"], -) - -libc_support_library( - name = "hdr_stdio_macros", - hdrs = ["hdr/stdio_macros.h"], -) - -############################ Type Proxy Header Files ########################### - -libc_support_library( - name = "types_clockid_t", - hdrs = ["hdr/types/clockid_t.h"], -) - -libc_support_library( - name = "types_fenv_t", - hdrs = ["hdr/types/fenv_t.h"], -) - -libc_support_library( - name = "types_fexcept_t", - hdrs = ["hdr/types/fexcept_t.h"], -) - -libc_support_library( - name = "types_sigset_t", - hdrs = ["hdr/types/sigset_t.h"], -) - -libc_support_library( - name = "types_struct_epoll_event", - hdrs = ["hdr/types/struct_epoll_event.h"], -) - -libc_support_library( - name = "types_struct_timespec", - hdrs = ["hdr/types/struct_timespec.h"], -) - -libc_support_library( - name = "types_time_t", - hdrs = ["hdr/types/time_t.h"], -) - -libc_support_library( - name = "types_pid_t", - hdrs = ["hdr/types/pid_t.h"], -) - -libc_support_library( - name = "types_off_t", - hdrs = ["hdr/types/off_t.h"], -) - -libc_support_library( - name = "types_FILE", - hdrs = ["hdr/types/FILE.h"], -) - -############################### Support libraries ############################## - -libc_support_library( - name = "__support_macros_properties_architectures", - hdrs = ["src/__support/macros/properties/architectures.h"], -) - -libc_support_library( - name = "__support_macros_properties_compiler", - hdrs = ["src/__support/macros/properties/compiler.h"], -) - -libc_support_library( - name = "__support_macros_properties_os", - hdrs = ["src/__support/macros/properties/os.h"], -) - -libc_support_library( - name = "__support_macros_properties_types", - hdrs = ["src/__support/macros/properties/types.h"], - deps = [ - ":__support_macros_properties_architectures", - ":__support_macros_properties_compiler", - ":__support_macros_properties_cpu_features", - ":__support_macros_properties_os", - ":hdr_float_macros", - ":llvm_libc_macros_float16_macros", - ":llvm_libc_types_float128", - ], -) - -libc_support_library( - name = "__support_macros_properties_cpu_features", - hdrs = ["src/__support/macros/properties/cpu_features.h"], - deps = [ - "__support_macros_properties_architectures", - ], -) - -libc_support_library( - name = "__support_macros_attributes", - hdrs = ["src/__support/macros/attributes.h"], - deps = [ - ":__support_macros_properties_architectures", - ], -) - -libc_support_library( - name = "__support_macros_optimization", - hdrs = ["src/__support/macros/optimization.h"], - deps = [ - ":__support_macros_attributes", - ":__support_macros_config", - ":__support_macros_properties_compiler", - ], -) - -libc_support_library( - name = "__support_macros_sanitizer", - hdrs = ["src/__support/macros/sanitizer.h"], - deps = [ - ":__support_macros_config", - ], -) - -libc_support_library( - name = "__support_common", - hdrs = [ - "src/__support/common.h", - "src/__support/endian.h", - ], - deps = [ - ":__support_macros_attributes", - ":__support_macros_config", - ":__support_macros_properties_architectures", - ], -) - -libc_support_library( - name = "__support_cpp_algorithm", - hdrs = ["src/__support/CPP/algorithm.h"], - deps = [ - ":__support_macros_attributes", - ":__support_macros_config", - ], -) - -libc_support_library( - name = "__support_cpp_iterator", - hdrs = ["src/__support/CPP/iterator.h"], - deps = [ - ":__support_cpp_type_traits", - ":__support_macros_attributes", - ], -) - -libc_support_library( - name = "__support_cpp_array", - hdrs = ["src/__support/CPP/array.h"], - deps = [ - ":__support_cpp_iterator", - ":__support_macros_attributes", - ], -) - -libc_support_library( - name = "__support_cpp_bit", - hdrs = ["src/__support/CPP/bit.h"], - deps = [ - ":__support_cpp_limits", - ":__support_cpp_type_traits", - ":__support_macros_attributes", - ":__support_macros_sanitizer", - ], -) - -libc_support_library( - name = "__support_cpp_bitset", - hdrs = ["src/__support/CPP/bitset.h"], - deps = [ - ":__support_macros_attributes", - ":__support_macros_config", - ], -) - -libc_support_library( - name = "__support_cpp_cstddef", - hdrs = ["src/__support/CPP/cstddef.h"], - deps = [ - ":__support_cpp_type_traits", - ":__support_macros_attributes", - ], -) - -libc_support_library( - name = "__support_cpp_expected", - hdrs = ["src/__support/CPP/expected.h"], - deps = [ - ":__support_macros_attributes", - ":__support_macros_config", - ], -) - -libc_support_library( - name = "__support_cpp_functional", - hdrs = ["src/__support/CPP/functional.h"], - deps = [ - "__support_cpp_type_traits", - "__support_cpp_utility", - "__support_macros_attributes", - ], -) - -libc_support_library( - name = "__support_cpp_limits", - hdrs = ["src/__support/CPP/limits.h"], - deps = [ - "__support_cpp_type_traits", - "__support_macros_attributes", - ":__support_macros_properties_types", - ":llvm_libc_macros_limits_macros", - ], -) - -libc_support_library( - name = "__support_cpp_new", - srcs = ["src/__support/CPP/new.cpp"], - hdrs = ["src/__support/CPP/new.h"], - deps = [ - ":__support_common", - ], -) - -libc_support_library( - name = "__support_cpp_optional", - hdrs = ["src/__support/CPP/optional.h"], - deps = [ - ":__support_cpp_utility", - ], -) - -libc_support_library( - name = "__support_cpp_span", - hdrs = ["src/__support/CPP/span.h"], - deps = [ - ":__support_cpp_array", - ":__support_cpp_type_traits", - ], -) - -libc_support_library( - name = "__support_cpp_string_view", - hdrs = ["src/__support/CPP/string_view.h"], - deps = [ - ":__support_common", - ], -) - -libc_support_library( - name = "__support_cpp_stringstream", - hdrs = ["src/__support/CPP/stringstream.h"], - deps = [ - ":__support_cpp_span", - ":__support_cpp_string_view", - ":__support_cpp_type_traits", - ":__support_integer_to_string", - ], -) - -libc_support_library( - name = "__support_cpp_string", - hdrs = ["src/__support/CPP/string.h"], - deps = [ - ":__support_common", - ":__support_cpp_string_view", - ":__support_integer_to_string", - ":string_memory_utils", - ":string_utils", - ], -) - -libc_support_library( - name = "__support_cpp_type_traits", - hdrs = glob(["src/__support/CPP/type_traits/*.h"]) + [ - "src/__support/CPP/type_traits.h", - "src/__support/CPP/utility/declval.h", - "src/__support/CPP/utility/forward.h", - ], - deps = [ - ":__support_macros_attributes", - ":__support_macros_config", - ":__support_macros_properties_types", - ":llvm_libc_macros_stdfix_macros", - ], -) - -libc_support_library( - name = "__support_cpp_utility", - hdrs = glob(["src/__support/CPP/utility/*.h"]) + [ - "src/__support/CPP/utility.h", - ], - deps = [ - ":__support_cpp_type_traits", - ":__support_macros_attributes", - ], -) - -libc_support_library( - name = "__support_cpp_atomic", - hdrs = ["src/__support/CPP/atomic.h"], - deps = [ - ":__support_cpp_type_traits", - ":__support_macros_attributes", - ":__support_macros_properties_architectures", - ], -) - -libc_support_library( - name = "__support_blockstore", - hdrs = ["src/__support/blockstore.h"], - deps = [ - ":__support_cpp_new", - ":__support_libc_assert", - ], -) - -libc_support_library( - name = "__support_arg_list", - hdrs = ["src/__support/arg_list.h"], - deps = [ - ":__support_common", - ], -) - -libc_support_library( - name = "__support_c_string", - hdrs = ["src/__support/c_string.h"], - deps = [ - ":__support_cpp_string", - ], -) - -libc_support_library( - name = "__support_fixedvector", - hdrs = ["src/__support/fixedvector.h"], - deps = [ - ":__support_cpp_array", - ":__support_cpp_iterator", - ], -) - -libc_support_library( - name = "__support_char_vector", - hdrs = ["src/__support/char_vector.h"], - deps = [ - ":__support_common", - ], -) - -libc_support_library( - name = "__support_error_or", - hdrs = ["src/__support/error_or.h"], - deps = [ - ":__support_common", - ":__support_cpp_expected", - ], -) - -libc_support_library( - name = "__support_float_to_string", - hdrs = [ - "src/__support/float_to_string.h", - "src/__support/ryu_constants.h", - "src/__support/ryu_long_double_constants.h", - ], - deps = [ - ":__support_big_int", - ":__support_common", - ":__support_cpp_type_traits", - ":__support_fputil_dyadic_float", - ":__support_fputil_fp_bits", - ":__support_libc_assert", - ], -) - -libc_support_library( - name = "__support_number_pair", - hdrs = ["src/__support/number_pair.h"], - deps = [ - ":__support_cpp_type_traits", - ], -) - -libc_support_library( - name = "__support_big_int", - hdrs = ["src/__support/big_int.h"], - deps = [ - ":__support_cpp_array", - ":__support_cpp_bit", - ":__support_cpp_limits", - ":__support_cpp_optional", - ":__support_cpp_type_traits", - ":__support_macros_attributes", - ":__support_macros_optimization", - ":__support_macros_properties_types", - ":__support_math_extras", - ":__support_number_pair", - ], -) - -libc_support_library( - name = "__support_sign", - hdrs = ["src/__support/sign.h"], - deps = [ - ":__support_macros_attributes", - ], -) - -libc_support_library( - name = "__support_uint128", - hdrs = ["src/__support/uint128.h"], - deps = [ - ":__support_big_int", - ":__support_macros_attributes", - ":__support_macros_properties_types", - ], -) - -libc_support_library( - name = "__support_integer_literals", - hdrs = ["src/__support/integer_literals.h"], - deps = [ - ":__support_cpp_limits", - ":__support_uint128", - ], -) - -libc_support_library( - name = "__support_str_to_num_result", - hdrs = ["src/__support/str_to_num_result.h"], - deps = [ - ":__support_macros_attributes", - ":__support_macros_config", - ], -) - -libc_support_library( - name = "__support_integer_operations", - hdrs = ["src/__support/integer_operations.h"], - deps = [":__support_cpp_type_traits"], -) - -libc_support_library( - name = "__support_integer_to_string", - hdrs = ["src/__support/integer_to_string.h"], - deps = [ - ":__support_big_int", - ":__support_common", - ":__support_cpp_algorithm", - ":__support_cpp_bit", - ":__support_cpp_limits", - ":__support_cpp_optional", - ":__support_cpp_span", - ":__support_cpp_string_view", - ":__support_cpp_type_traits", - ], -) - -libc_support_library( - name = "__support_libc_assert", - hdrs = ["src/__support/libc_assert.h"], - deps = [ - ":__support_integer_to_string", - ":__support_macros_attributes", - ":__support_osutil_exit", - ":__support_osutil_io", - ], -) - -libc_support_library( - name = "__support_ctype_utils", - hdrs = ["src/__support/ctype_utils.h"], - deps = [ - ":__support_macros_attributes", - ":__support_macros_config", - ], -) - -libc_support_library( - name = "__support_str_to_integer", - hdrs = ["src/__support/str_to_integer.h"], - deps = [ - ":__support_common", - ":__support_cpp_limits", - ":__support_cpp_type_traits", - ":__support_ctype_utils", - ":__support_str_to_num_result", - ":__support_uint128", - ":errno", - ], -) - -libc_support_library( - name = "__support_str_to_float", - hdrs = [ - "src/__support/detailed_powers_of_ten.h", - "src/__support/high_precision_decimal.h", - "src/__support/str_to_float.h", - ], - deps = [ - ":__support_common", - ":__support_cpp_bit", - ":__support_cpp_limits", - ":__support_cpp_optional", - ":__support_cpp_string_view", - ":__support_ctype_utils", - ":__support_fputil_dyadic_float", - ":__support_fputil_fenv_impl", - ":__support_fputil_fp_bits", - ":__support_fputil_rounding_mode", - ":__support_str_to_integer", - ":__support_str_to_num_result", - ":__support_uint128", - ":errno", - ], -) - -libc_support_library( - name = "__support_fputil_basic_operations", - hdrs = ["src/__support/FPUtil/BasicOperations.h"], - deps = [ - ":__support_common", - ":__support_cpp_type_traits", - ":__support_fputil_fenv_impl", - ":__support_fputil_fp_bits", - ":__support_macros_optimization", - ":__support_uint128", - ], -) - -libc_support_library( - name = "__support_file_file", - srcs = [ - "include/llvm-libc-types/off_t.h", - "src/__support/File/file.cpp", - ], - hdrs = ["src/__support/File/file.h"], - deps = [ - ":__support_cpp_new", - ":__support_cpp_span", - ":__support_error_or", - ":__support_threads_mutex", - ":errno", - ":hdr_stdio_macros", - ":types_off_t", - ], -) - -libc_support_library( - name = "__support_file_linux_lseekimpl", - hdrs = ["src/__support/File/linux/lseekImpl.h"], - deps = [ - ":__support_common", - ":__support_error_or", - ":__support_osutil_syscall", - ":errno", - ":types_off_t", - ], -) - -libc_support_library( - name = "__support_math_extras", - hdrs = ["src/__support/math_extras.h"], - deps = [ - ":__support_cpp_bit", - ":__support_cpp_limits", - ":__support_cpp_type_traits", - ":__support_macros_attributes", - ], -) - -libc_support_library( - name = "__support_fixed_point", - hdrs = [ - "src/__support/fixed_point/fx_bits.h", - "src/__support/fixed_point/fx_rep.h", - ], - deps = [ - ":__support_cpp_bit", - ":__support_cpp_type_traits", - ":__support_macros_attributes", - ":__support_macros_optimization", - ":__support_math_extras", - ":llvm_libc_macros_stdfix_macros", - ], -) - -libc_support_library( - name = "__support_fputil_generic_fmod", - hdrs = ["src/__support/FPUtil/generic/FMod.h"], - deps = [ - ":__support_common", - ":__support_cpp_bit", - ":__support_cpp_limits", - ":__support_cpp_type_traits", - ":__support_fputil_fenv_impl", - ":__support_fputil_fp_bits", - ], -) - -libc_support_library( - name = "__support_fputil_division_and_remainder_operations", - hdrs = ["src/__support/FPUtil/DivisionAndRemainderOperations.h"], - deps = [ - ":__support_common", - ":__support_cpp_type_traits", - ":__support_fputil_fp_bits", - ":__support_fputil_manipulation_functions", - ":__support_fputil_normal_float", - ], -) - -libc_support_library( - name = "__support_fputil_except_value_utils", - hdrs = ["src/__support/FPUtil/except_value_utils.h"], - deps = [ - ":__support_cpp_optional", - ":__support_fputil_fenv_impl", - ":__support_fputil_fp_bits", - ":__support_fputil_rounding_mode", - ], -) - -libc_support_library( - name = "__support_fputil_fenv_impl", - hdrs = ["src/__support/FPUtil/FEnvImpl.h"], - textual_hdrs = [ - "src/__support/FPUtil/x86_64/FEnvImpl.h", - "src/__support/FPUtil/aarch64/FEnvImpl.h", - "src/__support/FPUtil/aarch64/fenv_darwin_impl.h", - ], - deps = [ - ":__support_fputil_fp_bits", - ":__support_macros_attributes", - ":__support_macros_properties_architectures", - ":__support_macros_sanitizer", - ":errno", - ":hdr_fenv_macros", - ":hdr_math_macros", - ":types_fenv_t", - ], -) - -libc_support_library( - name = "__support_fputil_rounding_mode", - hdrs = ["src/__support/FPUtil/rounding_mode.h"], - deps = [ - ":__support_macros_attributes", - ":__support_macros_config", - ":hdr_fenv_macros", - ], -) - -libc_support_library( - name = "__support_fputil_fp_bits", - hdrs = ["src/__support/FPUtil/FPBits.h"], - deps = [ - ":__support_common", - ":__support_cpp_bit", - ":__support_cpp_type_traits", - ":__support_libc_assert", - ":__support_macros_attributes", - ":__support_macros_properties_types", - ":__support_math_extras", - ":__support_sign", - ":__support_uint128", - ], -) - -libc_support_library( - name = "__support_fputil_fpbits_str", - hdrs = ["src/__support/FPUtil/fpbits_str.h"], - deps = [ - ":__support_common", - ":__support_cpp_string", - ":__support_cpp_type_traits", - ":__support_fputil_fp_bits", - ":__support_integer_to_string", - ":__support_uint128", - ], -) - -libc_support_library( - name = "__support_fputil_hypot", - hdrs = ["src/__support/FPUtil/Hypot.h"], - deps = [ - ":__support_common", - ":__support_cpp_bit", - ":__support_cpp_type_traits", - ":__support_fputil_basic_operations", - ":__support_fputil_fenv_impl", - ":__support_fputil_fp_bits", - ":__support_fputil_rounding_mode", - ":__support_uint128", - ], -) - -libc_support_library( - name = "__support_fputil_manipulation_functions", - hdrs = ["src/__support/FPUtil/ManipulationFunctions.h"], - textual_hdrs = [ - "src/__support/FPUtil/x86_64/NextAfterLongDouble.h", - "src/__support/FPUtil/x86_64/NextUpDownLongDouble.h", - ], - deps = [ - ":__support_common", - ":__support_cpp_bit", - ":__support_cpp_limits", - ":__support_cpp_type_traits", - ":__support_fputil_dyadic_float", - ":__support_fputil_fp_bits", - ":__support_fputil_nearest_integer_operations", - ":__support_fputil_normal_float", - ":__support_macros_optimization", - ":__support_uint128", - ":hdr_math_macros", - ], -) - -libc_support_library( - name = "__support_fputil_nearest_integer_operations", - hdrs = ["src/__support/FPUtil/NearestIntegerOperations.h"], - deps = [ - ":__support_common", - ":__support_cpp_type_traits", - ":__support_fputil_fenv_impl", - ":__support_fputil_fp_bits", - ":__support_fputil_rounding_mode", - ":__support_macros_attributes", - ":hdr_math_macros", - ], -) - -libc_support_library( - name = "__support_fputil_normal_float", - hdrs = ["src/__support/FPUtil/NormalFloat.h"], - deps = [ - ":__support_common", - ":__support_cpp_type_traits", - ":__support_fputil_fp_bits", - ], -) - -sqrt_common_hdrs = [ - "src/__support/FPUtil/sqrt.h", - "src/__support/FPUtil/generic/sqrt.h", - "src/__support/FPUtil/generic/sqrt_80_bit_long_double.h", -] - -sqrt_hdrs = selects.with_or({ - "//conditions:default": sqrt_common_hdrs, - PLATFORM_CPU_X86_64: sqrt_common_hdrs + [ - "src/__support/FPUtil/x86_64/sqrt.h", - ], - PLATFORM_CPU_ARM64: sqrt_common_hdrs + [ - "src/__support/FPUtil/aarch64/sqrt.h", - ], -}) - -libc_support_library( - name = "__support_fputil_sqrt", - hdrs = sqrt_hdrs, - deps = [ - ":__support_common", - ":__support_cpp_bit", - ":__support_cpp_type_traits", - ":__support_fputil_dyadic_float", - ":__support_fputil_fenv_impl", - ":__support_fputil_fp_bits", - ":__support_fputil_rounding_mode", - ":__support_uint128", - ], -) - -fma_common_hdrs = [ - "src/__support/FPUtil/FMA.h", - "src/__support/FPUtil/generic/FMA.h", -] - -libc_support_library( - name = "__support_fputil_fma", - hdrs = fma_common_hdrs, - deps = [ - ":__support_cpp_bit", - ":__support_cpp_type_traits", - ":__support_fputil_basic_operations", - ":__support_fputil_dyadic_float", - ":__support_fputil_fenv_impl", - ":__support_fputil_fp_bits", - ":__support_fputil_rounding_mode", - ":__support_macros_attributes", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":__support_uint128", - ], -) - -libc_support_library( - name = "__support_fputil_multiply_add", - hdrs = [ - "src/__support/FPUtil/multiply_add.h", - ], - deps = [ - ":__support_common", - ":__support_cpp_type_traits", - ], -) - -libc_support_library( - name = "__support_fputil_polyeval", - hdrs = [ - "src/__support/FPUtil/PolyEval.h", - ], - deps = [ - ":__support_common", - ":__support_fputil_multiply_add", - ], -) - -nearest_integer_common_hdrs = [ - "src/__support/FPUtil/nearest_integer.h", -] - -nearest_integer_platform_hdrs = [ - "src/__support/FPUtil/x86_64/nearest_integer.h", - "src/__support/FPUtil/aarch64/nearest_integer.h", -] - -libc_support_library( - name = "__support_fputil_nearest_integer", - hdrs = nearest_integer_common_hdrs, - # These are conditionally included and will #error out if the platform - # doesn't support rounding instructions, so they can't be compiled on their - # own. - textual_hdrs = nearest_integer_platform_hdrs, - deps = [ - ":__support_common", - ":__support_macros_optimization", - ":__support_macros_properties_architectures", - ":__support_macros_properties_cpu_features", - ], -) - -libc_support_library( - name = "__support_fputil_double_double", - hdrs = ["src/__support/FPUtil/double_double.h"], - deps = [ - ":__support_common", - ":__support_fputil_multiply_add", - ":__support_number_pair", - ], -) - -libc_support_library( - name = "__support_fputil_triple_double", - hdrs = ["src/__support/FPUtil/triple_double.h"], - deps = [ - ":__support_common", - ], -) - -libc_support_library( - name = "__support_fputil_dyadic_float", - hdrs = ["src/__support/FPUtil/dyadic_float.h"], - deps = [ - ":__support_big_int", - ":__support_common", - ":__support_cpp_type_traits", - ":__support_fputil_fenv_impl", - ":__support_fputil_fp_bits", - ":__support_fputil_multiply_add", - ":__support_macros_optimization", - ], -) - -libc_support_library( - name = "__support_osutil_syscall", - hdrs = ["src/__support/OSUtil/syscall.h"], - textual_hdrs = select({ - "@platforms//os:macos": [ - "src/__support/OSUtil/darwin/syscall.h", - "src/__support/OSUtil/darwin/arm/syscall.h", - ], - "@platforms//os:linux": [ - "src/__support/OSUtil/linux/syscall.h", - "src/__support/OSUtil/linux/aarch64/syscall.h", - "src/__support/OSUtil/linux/x86_64/syscall.h", - ], - }), - deps = [ - ":__support_common", - ":__support_cpp_bit", - ":__support_macros_sanitizer", - ], -) - -libc_support_library( - name = "__support_osutil_io", - hdrs = ["src/__support/OSUtil/io.h"], - textual_hdrs = select({ - "@platforms//os:macos": ["src/__support/OSUtil/darwin/io.h"], - "@platforms//os:linux": ["src/__support/OSUtil/linux/io.h"], - }), - deps = [ - ":__support_common", - ":__support_cpp_string_view", - ":__support_osutil_syscall", - ":string_utils", - ], -) - -libc_support_library( - name = "__support_osutil_exit", - srcs = ["src/__support/OSUtil/linux/exit.cpp"], - hdrs = ["src/__support/OSUtil/exit.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [ - ":__support_osutil_syscall", - ], -) - -libc_support_library( - name = "__support_osutil_pid", - srcs = ["src/__support/OSUtil/linux/pid.cpp"], - hdrs = ["src/__support/OSUtil/pid.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [ - ":__support_macros_attributes", - ":__support_macros_optimization", - ":__support_osutil_syscall", - ":types_pid_t", - ] -) - -libc_support_library( - name = "__support_stringutil", - srcs = glob(["src/__support/StringUtil/tables/**/*.h"]) + [ - "src/__support/StringUtil/error_to_string.cpp", - "src/__support/StringUtil/message_mapper.h", - "src/__support/StringUtil/platform_errors.h", - "src/__support/StringUtil/platform_signals.h", - "src/__support/StringUtil/signal_to_string.cpp", - ], - hdrs = [ - "src/__support/StringUtil/error_to_string.h", - "src/__support/StringUtil/signal_to_string.h", - ], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [ - ":__support_cpp_array", - ":__support_cpp_span", - ":__support_cpp_string_view", - ":__support_cpp_stringstream", - ":__support_integer_to_string", - ":__support_macros_attributes", - ":errno", - ], -) - -libc_support_library( - name = "__support_threads_linux_futex_word_type", - hdrs = [ - "src/__support/threads/linux/futex_word.h", - ], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [ - ":__support_osutil_syscall", - ], -) - -libc_support_library( - name = "__support_threads_linux_futex_utils", - hdrs = [ - "src/__support/threads/linux/futex_utils.h", - ], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [ - ":__support_cpp_atomic", - ":__support_cpp_optional", - ":__support_osutil_syscall", - ":__support_threads_linux_futex_word_type", - ":__support_time_linux", - ":types_struct_timespec", - ], -) - -libc_support_library( - name = "__support_threads_sleep", - hdrs = ["src/__support/threads/sleep.h"], - deps = [ - ":__support_macros_attributes", - ":__support_macros_config", - ], -) - -libc_support_library( - name = "__support_threads_raw_mutex", - hdrs = [ - "src/__support/threads/linux/raw_mutex.h", - ], - defines = [ - "LIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY", - "LIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT", - ], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [ - ":__support_cpp_optional", - ":__support_threads_linux_futex_utils", - ":__support_threads_sleep", - ":__support_time_linux", - ":types_pid_t", - ], -) - -libc_support_library( - name = "__support_threads_mutex", - hdrs = [ - "src/__support/threads/mutex.h", - "src/__support/threads/mutex_common.h", - ], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - textual_hdrs = [ - "src/__support/threads/linux/mutex.h", - ], - deps = [ - ":__support_cpp_atomic", - ":__support_osutil_syscall", - ":__support_threads_linux_futex_utils", - ":__support_threads_raw_mutex", - ":types_pid_t", - ], -) - -libc_support_library( - name = "__support_time", - hdrs = glob(["src/__support/time/*.h"]), - deps = [ - ":__support_common", - ":hdr_time_macros", - ":types_time_t", - ], -) - -libc_support_library( - name = "__support_time_linux", - hdrs = glob(["src/__support/time/linux/**/*.h"]), - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [ - ":__support_common", - ":__support_cpp_expected", - ":__support_error_or", - ":__support_libc_assert", - ":__support_time", - ":hdr_time_macros", - ":types_clockid_t", - ":types_struct_timespec", - ], -) - -############################### errno targets ################################ - -libc_function( - name = "errno", - srcs = ["src/errno/libc_errno.cpp"], - hdrs = ["src/errno/libc_errno.h"], - deps = [ - ":__support_common", - ":__support_cpp_atomic", - ":__support_macros_attributes", - ":__support_macros_properties_architectures", - ":hdr_errno_macros", - ], -) - -################################ fenv targets ################################ - -libc_function( - name = "fetestexcept", - srcs = ["src/fenv/fetestexcept.cpp"], - hdrs = ["src/fenv/fetestexcept.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ], -) - -libc_function( - name = "fetestexceptflag", - srcs = ["src/fenv/fetestexceptflag.cpp"], - hdrs = ["src/fenv/fetestexceptflag.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ":types_fexcept_t", - ], -) - -libc_function( - name = "feclearexcept", - srcs = ["src/fenv/feclearexcept.cpp"], - hdrs = ["src/fenv/feclearexcept.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ], -) - -libc_function( - name = "feraiseexcept", - srcs = ["src/fenv/feraiseexcept.cpp"], - hdrs = ["src/fenv/feraiseexcept.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ], -) - -libc_function( - name = "fegetround", - srcs = ["src/fenv/fegetround.cpp"], - hdrs = ["src/fenv/fegetround.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ], -) - -libc_function( - name = "fesetround", - srcs = ["src/fenv/fesetround.cpp"], - hdrs = ["src/fenv/fesetround.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ], -) - -libc_function( - name = "fedisableexcept", - srcs = ["src/fenv/fedisableexcept.cpp"], - hdrs = ["src/fenv/fedisableexcept.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ], -) - -libc_function( - name = "feenableexcept", - srcs = ["src/fenv/feenableexcept.cpp"], - hdrs = ["src/fenv/feenableexcept.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ], -) - -libc_function( - name = "fegetexcept", - srcs = ["src/fenv/fegetexcept.cpp"], - hdrs = ["src/fenv/fegetexcept.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ], -) - -libc_function( - name = "fegetenv", - srcs = ["src/fenv/fegetenv.cpp"], - hdrs = ["src/fenv/fegetenv.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ], -) - -libc_function( - name = "fesetenv", - srcs = ["src/fenv/fesetenv.cpp"], - hdrs = ["src/fenv/fesetenv.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ], -) - -libc_function( - name = "feupdateenv", - srcs = ["src/fenv/feupdateenv.cpp"], - hdrs = ["src/fenv/feupdateenv.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ], -) - -libc_function( - name = "fesetexcept", - srcs = ["src/fenv/fesetexcept.cpp"], - hdrs = ["src/fenv/fesetexcept.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ], -) - -libc_function( - name = "fegetexceptflag", - srcs = ["src/fenv/fegetexceptflag.cpp"], - hdrs = ["src/fenv/fegetexceptflag.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ":types_fexcept_t", - ], -) - -libc_function( - name = "fesetexceptflag", - srcs = ["src/fenv/fesetexceptflag.cpp"], - hdrs = ["src/fenv/fesetexceptflag.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ":types_fexcept_t", - ], -) - -libc_function( - name = "feholdexcept", - srcs = ["src/fenv/feholdexcept.cpp"], - hdrs = ["src/fenv/feholdexcept.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ], -) - -################################ math targets ################################ - -libc_support_library( - name = "common_constants", - srcs = ["src/math/generic/common_constants.cpp"], - hdrs = ["src/math/generic/common_constants.h"], - deps = [ - ":__support_fputil_triple_double", - ":__support_number_pair", - ], -) - -libc_support_library( - name = "range_reduction", - hdrs = [ - "src/math/generic/range_reduction.h", - "src/math/generic/range_reduction_fma.h", - ], - deps = [ - ":__support_common", - ":__support_fputil_fma", - ":__support_fputil_fp_bits", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ], -) - -libc_support_library( - name = "sincosf_utils", - hdrs = ["src/math/generic/sincosf_utils.h"], - deps = [ - ":__support_fputil_fp_bits", - ":__support_fputil_polyeval", - ":range_reduction", - ], -) - -libc_support_library( - name = "explogxf", - srcs = ["src/math/generic/explogxf.cpp"], - hdrs = ["src/math/generic/explogxf.h"], - deps = [ - ":__support_common", - ":__support_fputil_fenv_impl", - ":__support_fputil_fma", - ":__support_fputil_fp_bits", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":common_constants", - ], -) - -libc_support_library( - name = "inv_trigf_utils", - srcs = ["src/math/generic/inv_trigf_utils.cpp"], - hdrs = ["src/math/generic/inv_trigf_utils.h"], - deps = [ - ":__support_common", - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_polyeval", - ], -) - -libc_support_library( - name = "log_range_reduction", - hdrs = ["src/math/generic/log_range_reduction.h"], - deps = [ - ":__support_common", - ":__support_fputil_dyadic_float", - ":__support_uint128", - ":common_constants", - ], -) - -libc_support_library( - name = "exp10f_impl", - hdrs = ["src/math/generic/exp10f_impl.h"], - deps = [ - ":__support_fputil_basic_operations", - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_macros_optimization", - ":common_constants", - ":explogxf", - ], -) - -libc_support_library( - name = "exp2f_impl", - hdrs = ["src/math/generic/exp2f_impl.h"], - deps = [ - ":__support_fputil_except_value_utils", - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_macros_optimization", - ":common_constants", - ":explogxf", - ], -) - -libc_math_function( - name = "erff", - additional_deps = [ - ":__support_fputil_multiply_add", - ":__support_fputil_polyeval", - ":__support_macros_optimization", - ], -) - -libc_math_function( - name = "expm1", - additional_deps = [ - ":__support_fputil_double_double", - ":__support_fputil_dyadic_float", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_fputil_triple_double", - ":__support_integer_literals", - ":__support_macros_optimization", - ":common_constants", - ":explogxf", - ], -) - -libc_math_function( - name = "expm1f", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":common_constants", - ], -) - -libc_math_function( - name = "exp", - additional_deps = [ - ":__support_fputil_double_double", - ":__support_fputil_dyadic_float", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_fputil_triple_double", - ":__support_integer_literals", - ":__support_macros_optimization", - ":common_constants", - ":explogxf", - ], -) - -libc_math_function( - name = "expf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_macros_optimization", - ":common_constants", - ], -) - -libc_math_function( - name = "exp10", - additional_deps = [ - ":__support_fputil_double_double", - ":__support_fputil_dyadic_float", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_fputil_triple_double", - ":__support_integer_literals", - ":__support_macros_optimization", - ":common_constants", - ":explogxf", - ], -) - -libc_math_function( - name = "exp10f", - additional_deps = [ - ":exp10f_impl", - ], -) - -libc_math_function( - name = "exp2", - additional_deps = [ - ":__support_fputil_double_double", - ":__support_fputil_dyadic_float", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_fputil_triple_double", - ":__support_integer_literals", - ":__support_macros_optimization", - ":common_constants", - ":explogxf", - ], -) - -libc_math_function( - name = "exp2f", - additional_deps = [ - ":exp2f_impl", - ], -) - -libc_math_function( - name = "logf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_polyeval", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":common_constants", - ], -) - -libc_math_function( - name = "log2f", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_polyeval", - ":__support_macros_optimization", - ":common_constants", - ], -) - -libc_math_function( - name = "log10f", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_polyeval", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":common_constants", - ], -) - -libc_math_function( - name = "log1pf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_polyeval", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":common_constants", - ], -) - -libc_math_function( - name = "log", - additional_deps = [ - ":__support_fputil_double_double", - ":__support_fputil_dyadic_float", - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_polyeval", - ":__support_integer_literals", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":common_constants", - ":log_range_reduction", - ], -) - -libc_math_function( - name = "log2", - additional_deps = [ - ":__support_fputil_double_double", - ":__support_fputil_dyadic_float", - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_polyeval", - ":__support_integer_literals", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":common_constants", - ":log_range_reduction", - ], -) - -libc_math_function( - name = "log10", - additional_deps = [ - ":__support_fputil_double_double", - ":__support_fputil_dyadic_float", - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_polyeval", - ":__support_integer_literals", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":common_constants", - ":log_range_reduction", - ], -) - -libc_math_function( - name = "log1p", - additional_deps = [ - ":__support_fputil_double_double", - ":__support_fputil_dyadic_float", - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_polyeval", - ":__support_integer_literals", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":common_constants", - ], -) - -libc_math_function( - name = "sinhf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_macros_optimization", - ":common_constants", - ":explogxf", - ], -) - -libc_math_function( - name = "coshf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_macros_optimization", - ":common_constants", - ":explogxf", - ], -) - -libc_math_function( - name = "cospif", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_macros_optimization", - ":common_constants", - ":explogxf", - ":sincosf_utils", - ], -) - -libc_math_function( - name = "tanhf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":common_constants", - ":explogxf", - ], -) - -libc_math_function( - name = "asinhf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_sqrt", - ":__support_macros_optimization", - ":common_constants", - ":explogxf", - ], -) - -libc_math_function( - name = "acoshf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_sqrt", - ":__support_macros_optimization", - ":common_constants", - ":explogxf", - ], -) - -libc_math_function( - name = "atanhf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_macros_optimization", - ":common_constants", - ":explogxf", - ], -) - -libc_math_function( - name = "asinf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_sqrt", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":inv_trigf_utils", - ], -) - -libc_math_function( - name = "acosf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_sqrt", - ":__support_macros_optimization", - ":inv_trigf_utils", - ], -) - -libc_math_function( - name = "atanf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_macros_optimization", - ":inv_trigf_utils", - ], -) - -libc_math_function( - name = "powf", - additional_deps = [ - ":__support_fputil_double_double", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_fputil_sqrt", - ":__support_fputil_triple_double", - ":__support_macros_optimization", - ":common_constants", - ":explogxf", - ":exp2f_impl", - ":exp10f_impl", - ], -) - -libc_math_function(name = "fabs") - -libc_math_function(name = "fabsf") - -libc_math_function(name = "fabsl") - -libc_math_function(name = "fabsf128") - -libc_math_function(name = "fdim") - -libc_math_function(name = "fdimf") - -libc_math_function(name = "fdiml") - -libc_math_function(name = "fdimf128") - -libc_math_function( - name = "ceil", - specializations = [ - "generic", - ], -) - -libc_math_function( - name = "ceilf", - specializations = [ - "generic", - ], -) - -libc_math_function( - name = "ceill", - specializations = [ - "generic", - ], -) - -libc_math_function(name = "ceilf128") - -libc_math_function( - name = "floor", - specializations = [ - "generic", - ], -) - -libc_math_function( - name = "floorf", - specializations = [ - "generic", - ], -) - -libc_math_function(name = "floorl") - -libc_math_function(name = "floorf128") - -libc_math_function(name = "ldexp") - -libc_math_function(name = "ldexpf") - -libc_math_function(name = "ldexpl") - -libc_math_function(name = "ldexpf128") - -libc_math_function( - name = "trunc", - specializations = [ - "generic", - ], -) - -libc_math_function( - name = "truncf", - specializations = [ - "generic", - ], -) - -libc_math_function(name = "truncl") - -libc_math_function(name = "truncf128") - -libc_math_function( - name = "round", - specializations = [ - "generic", - ], -) - -libc_math_function( - name = "roundf", - specializations = [ - "generic", - ], -) - -libc_math_function(name = "roundl") - -libc_math_function(name = "roundf128") - -libc_math_function( - name = "fmod", - additional_deps = [ - ":__support_fputil_generic_fmod", - ], -) - -libc_math_function( - name = "fmodf", - additional_deps = [ - ":__support_fputil_generic_fmod", - ], -) - -libc_math_function(name = "frexp") - -libc_math_function(name = "frexpf") - -libc_math_function(name = "frexpl") - -libc_math_function(name = "frexpf128") - -libc_math_function(name = "hypot") - -libc_math_function( - name = "hypotf", - additional_deps = [ - ":__support_fputil_double_double", - ":__support_fputil_sqrt", - ], -) - -libc_math_function(name = "logb") - -libc_math_function(name = "logbf") - -libc_math_function(name = "logbl") - -libc_math_function(name = "logbf128") - -libc_math_function(name = "modf") - -libc_math_function(name = "modff") - -libc_math_function(name = "modfl") - -libc_math_function(name = "modff128") - -libc_math_function(name = "remquo") - -libc_math_function(name = "remquof") - -libc_math_function(name = "remquol") - -libc_math_function(name = "remainder") - -libc_math_function(name = "remainderf") - -libc_math_function(name = "remainderl") - -libc_math_function(name = "fmin") - -libc_math_function(name = "fminf") - -libc_math_function(name = "fminl") - -libc_math_function(name = "fminf128") - -libc_math_function(name = "fmax") - -libc_math_function(name = "fmaxf") - -libc_math_function(name = "fmaxl") - -libc_math_function(name = "fmaxf128") - -libc_math_function( - name = "cosf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":sincosf_utils", - ], -) - -libc_math_function( - name = "sincosf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_rounding_mode", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":sincosf_utils", - ], -) - -libc_math_function( - name = "sinf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_polyeval", - ":__support_fputil_rounding_mode", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":range_reduction", - ":sincosf_utils", - ], -) - -libc_math_function( - name = "tanf", - additional_deps = [ - ":__support_fputil_fma", - ":__support_fputil_multiply_add", - ":__support_fputil_nearest_integer", - ":__support_fputil_polyeval", - ":__support_macros_optimization", - ":__support_macros_properties_cpu_features", - ":range_reduction", - ":sincosf_utils", - ], -) - -libc_math_function( - name = "sqrt", - additional_deps = [ - ":__support_fputil_sqrt", - ], -) - -libc_math_function( - name = "sqrtf", - additional_deps = [ - ":__support_fputil_sqrt", - ], -) - -libc_math_function( - name = "sqrtl", - additional_deps = [ - ":__support_fputil_sqrt", - ], -) - -libc_math_function( - name = "sqrtf128", - additional_deps = [ - ":__support_fputil_sqrt", - ], -) - -libc_math_function(name = "copysign") - -libc_math_function(name = "copysignf") - -libc_math_function(name = "copysignl") - -libc_math_function( - name = "copysignf128", - additional_deps = [ - ":llvm_libc_types_float128", - ], -) - -libc_math_function(name = "ilogb") - -libc_math_function(name = "ilogbf") - -libc_math_function(name = "ilogbl") - -libc_math_function(name = "ilogbf128") - -libc_math_function(name = "rint") - -libc_math_function(name = "rintf") - -libc_math_function(name = "rintl") - -libc_math_function(name = "rintf128") - -libc_math_function(name = "lrint") - -libc_math_function(name = "lrintf") - -libc_math_function(name = "lrintl") - -libc_math_function(name = "lrintf128") - -libc_math_function(name = "llrint") - -libc_math_function(name = "llrintf") - -libc_math_function(name = "llrintl") - -libc_math_function(name = "llrintf128") - -libc_math_function(name = "lround") - -libc_math_function(name = "lroundf") - -libc_math_function(name = "lroundl") - -libc_math_function(name = "lroundf128") - -libc_math_function(name = "llround") - -libc_math_function(name = "llroundf") - -libc_math_function(name = "llroundl") - -libc_math_function(name = "llroundf128") - -libc_math_function( - name = "nan", - additional_deps = [ - ":__support_str_to_float", - ":errno", - ], -) - -libc_math_function( - name = "nanf", - additional_deps = [ - ":__support_str_to_float", - ":errno", - ], -) - -libc_math_function( - name = "nanl", - additional_deps = [ - ":__support_str_to_float", - ":errno", - ], -) - -libc_math_function( - name = "nanf128", - additional_deps = [ - ":__support_str_to_float", - ":errno", - ], -) - -libc_math_function(name = "nearbyint") - -libc_math_function(name = "nearbyintf") - -libc_math_function(name = "nearbyintl") - -libc_math_function(name = "nextafter") - -libc_math_function(name = "nextafterf") - -libc_math_function(name = "nextafterl") - -libc_math_function(name = "nextafterf128") - -libc_math_function(name = "nexttoward") - -libc_math_function(name = "nexttowardf") - -libc_math_function(name = "nexttowardl") - -libc_math_function(name = "scalbn") - -libc_math_function(name = "scalbnf") - -libc_math_function(name = "scalbnl") - -############################## inttypes targets ############################## - -libc_function( - name = "imaxabs", - srcs = ["src/inttypes/imaxabs.cpp"], - hdrs = ["src/inttypes/imaxabs.h"], - deps = [ - ":__support_common", - ":__support_integer_operations", - ], -) - -libc_function( - name = "imaxdiv", - srcs = ["src/inttypes/imaxdiv.cpp"], - hdrs = ["src/inttypes/imaxdiv.h"], - deps = [ - ":__support_common", - ":__support_integer_operations", - ], -) - -############################### stdlib targets ############################### - -libc_function( - name = "abs", - srcs = ["src/stdlib/abs.cpp"], - hdrs = ["src/stdlib/abs.h"], - deps = [ - ":__support_common", - ":__support_integer_operations", - ], -) - -libc_function( - name = "labs", - srcs = ["src/stdlib/labs.cpp"], - hdrs = ["src/stdlib/labs.h"], - deps = [ - ":__support_common", - ":__support_integer_operations", - ], -) - -libc_function( - name = "llabs", - srcs = ["src/stdlib/llabs.cpp"], - hdrs = ["src/stdlib/llabs.h"], - deps = [ - ":__support_common", - ":__support_integer_operations", - ], -) - -libc_function( - name = "div", - srcs = ["src/stdlib/div.cpp"], - hdrs = ["src/stdlib/div.h"], - deps = [ - ":__support_common", - ":__support_integer_operations", - ], -) - -libc_function( - name = "ldiv", - srcs = ["src/stdlib/ldiv.cpp"], - hdrs = ["src/stdlib/ldiv.h"], - deps = [ - ":__support_common", - ":__support_integer_operations", - ], -) - -libc_function( - name = "lldiv", - srcs = ["src/stdlib/lldiv.cpp"], - hdrs = ["src/stdlib/lldiv.h"], - deps = [ - ":__support_common", - ":__support_integer_operations", - ], -) - -libc_function( - name = "atoi", - srcs = ["src/stdlib/atoi.cpp"], - hdrs = ["src/stdlib/atoi.h"], - deps = [ - ":__support_common", - ":__support_str_to_integer", - ":errno", - ], -) - -libc_function( - name = "atol", - srcs = ["src/stdlib/atol.cpp"], - hdrs = ["src/stdlib/atol.h"], - deps = [ - ":__support_common", - ":__support_str_to_integer", - ":errno", - ], -) - -libc_function( - name = "atoll", - srcs = ["src/stdlib/atoll.cpp"], - hdrs = ["src/stdlib/atoll.h"], - deps = [ - ":__support_common", - ":__support_str_to_integer", - ":errno", - ], -) - -libc_function( - name = "atof", - srcs = ["src/stdlib/atof.cpp"], - hdrs = ["src/stdlib/atof.h"], - deps = [ - ":__support_common", - ":__support_str_to_float", - ":errno", - ], -) - -libc_function( - name = "bsearch", - srcs = ["src/stdlib/bsearch.cpp"], - hdrs = ["src/stdlib/bsearch.h"], - deps = [ - ":__support_common", - ], -) - -libc_support_library( - name = "qsort_util", - hdrs = [ - "src/stdlib/heap_sort.h", - "src/stdlib/qsort_data.h", - "src/stdlib/qsort_util.h", - "src/stdlib/quick_sort.h", - ], - deps = [ - ":__support_common", - ":__support_cpp_cstddef", - ":__support_macros_attributes", - ], -) - -libc_function( - name = "qsort", - srcs = ["src/stdlib/qsort.cpp"], - hdrs = ["src/stdlib/qsort.h"], - deps = [ - ":__support_common", - ":qsort_util", - ], -) - -libc_function( - name = "qsort_r", - srcs = ["src/stdlib/qsort_r.cpp"], - hdrs = ["src/stdlib/qsort_r.h"], - deps = [ - ":__support_common", - ":qsort_util", - ], -) - -libc_function( - name = "strtol", - srcs = ["src/stdlib/strtol.cpp"], - hdrs = ["src/stdlib/strtol.h"], - deps = [ - ":__support_common", - ":__support_str_to_integer", - ":errno", - ], -) - -libc_function( - name = "strtoll", - srcs = ["src/stdlib/strtoll.cpp"], - hdrs = ["src/stdlib/strtoll.h"], - deps = [ - ":__support_common", - ":__support_str_to_integer", - ":errno", - ], -) - -libc_function( - name = "strtoul", - srcs = ["src/stdlib/strtoul.cpp"], - hdrs = ["src/stdlib/strtoul.h"], - deps = [ - ":__support_common", - ":__support_str_to_integer", - ":errno", - ], -) - -libc_function( - name = "strtoull", - srcs = ["src/stdlib/strtoull.cpp"], - hdrs = ["src/stdlib/strtoull.h"], - deps = [ - ":__support_common", - ":__support_str_to_integer", - ":errno", - ], -) - -libc_function( - name = "strtof", - srcs = ["src/stdlib/strtof.cpp"], - hdrs = ["src/stdlib/strtof.h"], - deps = [ - ":__support_common", - ":__support_str_to_float", - ":errno", - ], -) - -libc_function( - name = "strtod", - srcs = ["src/stdlib/strtod.cpp"], - hdrs = ["src/stdlib/strtod.h"], - deps = [ - ":__support_common", - ":__support_str_to_float", - ":errno", - ], -) - -libc_function( - name = "strtold", - srcs = ["src/stdlib/strtold.cpp"], - hdrs = ["src/stdlib/strtold.h"], - deps = [ - ":__support_common", - ":__support_str_to_float", - ":errno", - ], -) - -############################### string targets ############################### - -no_sanitize_features = [ - "-asan", - "-msan", - "-tsan", - "-ubsan", -] - -libc_support_library( - name = "string_memory_utils", - hdrs = [ - "src/string/memory_utils/op_aarch64.h", - "src/string/memory_utils/op_builtin.h", - "src/string/memory_utils/op_generic.h", - "src/string/memory_utils/op_riscv.h", - "src/string/memory_utils/op_x86.h", - "src/string/memory_utils/utils.h", - ], - textual_hdrs = [ - "src/string/memory_utils/aarch64/inline_bcmp.h", - "src/string/memory_utils/aarch64/inline_memcmp.h", - "src/string/memory_utils/aarch64/inline_memcpy.h", - "src/string/memory_utils/aarch64/inline_memmove.h", - "src/string/memory_utils/aarch64/inline_memset.h", - "src/string/memory_utils/generic/aligned_access.h", - "src/string/memory_utils/generic/byte_per_byte.h", - "src/string/memory_utils/inline_bcmp.h", - "src/string/memory_utils/inline_bzero.h", - "src/string/memory_utils/inline_memcmp.h", - "src/string/memory_utils/inline_memcpy.h", - "src/string/memory_utils/inline_memmem.h", - "src/string/memory_utils/inline_memmove.h", - "src/string/memory_utils/inline_memset.h", - "src/string/memory_utils/inline_strcmp.h", - "src/string/memory_utils/inline_strstr.h", - "src/string/memory_utils/riscv/inline_bcmp.h", - "src/string/memory_utils/riscv/inline_memcmp.h", - "src/string/memory_utils/riscv/inline_memcpy.h", - "src/string/memory_utils/riscv/inline_memmove.h", - "src/string/memory_utils/riscv/inline_memset.h", - "src/string/memory_utils/x86_64/inline_bcmp.h", - "src/string/memory_utils/x86_64/inline_memcmp.h", - "src/string/memory_utils/x86_64/inline_memcpy.h", - "src/string/memory_utils/x86_64/inline_memmove.h", - "src/string/memory_utils/x86_64/inline_memset.h", - ], - deps = [ - ":__support_common", - ":__support_cpp_array", - ":__support_cpp_bit", - ":__support_cpp_cstddef", - ":__support_cpp_type_traits", - ":__support_macros_attributes", - ":__support_macros_optimization", - ":__support_macros_properties_architectures", - ":__support_macros_properties_cpu_features", - ], -) - -libc_support_library( - name = "string_utils", - hdrs = ["src/string/string_utils.h"], - deps = [ - ":__support_common", - ":__support_cpp_bitset", - ":__support_macros_optimization", - ":string_memory_utils", - ], -) - -libc_function( - name = "memchr", - srcs = ["src/string/memchr.cpp"], - hdrs = ["src/string/memchr.h"], - deps = [ - ":__support_common", - ":string_utils", - ], -) - -libc_function( - name = "memcpy", - srcs = ["src/string/memcpy.cpp"], - hdrs = ["src/string/memcpy.h"], - copts = ["-mllvm --tail-merge-threshold=0"], - features = no_sanitize_features, - weak = True, - deps = [ - ":__support_common", - ":string_memory_utils", - ], -) - -libc_function( - name = "memset", - srcs = ["src/string/memset.cpp"], - hdrs = ["src/string/memset.h"], - features = no_sanitize_features, - weak = True, - deps = [ - ":__support_common", - ":string_memory_utils", - ], -) - -libc_function( - name = "memmove", - srcs = ["src/string/memmove.cpp"], - hdrs = ["src/string/memmove.h"], - features = no_sanitize_features, - weak = True, - deps = [ - ":__support_common", - ":string_memory_utils", - ], -) - -libc_function( - name = "mempcpy", - srcs = ["src/string/mempcpy.cpp"], - hdrs = ["src/string/mempcpy.h"], - copts = ["-mllvm --tail-merge-threshold=0"], - features = no_sanitize_features, - weak = True, - deps = [ - ":__support_common", - ":string_memory_utils", - ], -) - -libc_function( - name = "bcopy", - srcs = ["src/string/bcopy.cpp"], - hdrs = ["src/string/bcopy.h"], - features = no_sanitize_features, - deps = [ - ":__support_common", - ":string_memory_utils", - ], -) - -libc_function( - name = "memcmp", - srcs = ["src/string/memcmp.cpp"], - hdrs = ["src/string/memcmp.h"], - features = no_sanitize_features, - weak = True, - deps = [ - ":__support_common", - ":__support_integer_operations", - ":string_memory_utils", - ], -) - -libc_function( - name = "bcmp", - srcs = ["src/string/bcmp.cpp"], - hdrs = ["src/string/bcmp.h"], - features = no_sanitize_features, - weak = True, - deps = [ - ":__support_common", - ":string_memory_utils", - ], -) - -libc_function( - name = "bzero", - srcs = ["src/string/bzero.cpp"], - hdrs = ["src/string/bzero.h"], - features = no_sanitize_features, - weak = True, - deps = [ - ":__support_common", - ":string_memory_utils", - ], -) - -libc_function( - name = "memrchr", - srcs = ["src/string/memrchr.cpp"], - hdrs = ["src/string/memrchr.h"], - deps = [ - ":__support_common", - ":string_utils", - ], -) - -libc_function( - name = "strlen", - srcs = ["src/string/strlen.cpp"], - hdrs = ["src/string/strlen.h"], - features = no_sanitize_features, - deps = [ - ":__support_common", - ":string_utils", - ], -) - -libc_function( - name = "strcpy", - srcs = ["src/string/strcpy.cpp"], - hdrs = ["src/string/strcpy.h"], - features = no_sanitize_features, - deps = [ - ":__support_common", - ":memcpy", - ":string_memory_utils", - ":string_utils", - ], -) - -# A sanitizer instrumented flavor of strcpy to be used with unittests. -libc_function( - name = "strcpy_sanitized", - testonly = 1, - srcs = ["src/string/strcpy.cpp"], - hdrs = ["src/string/strcpy.h"], - deps = [ - ":__support_common", - ":memcpy", - ":string_memory_utils", - ":string_utils", - ], -) - -libc_function( - name = "strncpy", - srcs = ["src/string/strncpy.cpp"], - hdrs = ["src/string/strncpy.h"], - deps = [ - ":__support_common", - ], -) - -libc_function( - name = "strcmp", - srcs = ["src/string/strcmp.cpp"], - hdrs = ["src/string/strcmp.h"], - deps = [ - ":__support_common", - ":string_memory_utils", - ":string_utils", - ], -) - -libc_function( - name = "strchr", - srcs = ["src/string/strchr.cpp"], - hdrs = ["src/string/strchr.h"], - deps = [ - ":__support_common", - ":string_utils", - ], -) - -libc_function( - name = "strrchr", - srcs = ["src/string/strrchr.cpp"], - hdrs = ["src/string/strrchr.h"], - deps = [ - ":__support_common", - ":string_utils", - ], -) - -libc_function( - name = "strstr", - srcs = ["src/string/strstr.cpp"], - hdrs = ["src/string/strstr.h"], - deps = [ - ":__support_common", - ":string_memory_utils", - ":string_utils", - ], -) - -libc_function( - name = "strnlen", - srcs = ["src/string/strnlen.cpp"], - hdrs = ["src/string/strnlen.h"], - deps = [ - ":__support_common", - ":string_utils", - ], -) - -libc_function( - name = "strcspn", - srcs = ["src/string/strcspn.cpp"], - hdrs = ["src/string/strcspn.h"], - deps = [ - ":__support_common", - ":string_utils", - ], -) - -libc_function( - name = "strspn", - srcs = ["src/string/strspn.cpp"], - hdrs = ["src/string/strspn.h"], - deps = [ - ":__support_common", - ":__support_cpp_bitset", - ":string_utils", - ], -) - -libc_function( - name = "strpbrk", - srcs = ["src/string/strpbrk.cpp"], - hdrs = ["src/string/strpbrk.h"], - deps = [ - ":__support_common", - ":string_utils", - ], -) - -libc_function( - name = "strtok", - srcs = ["src/string/strtok.cpp"], - hdrs = ["src/string/strtok.h"], - deps = [ - ":__support_common", - ":string_utils", - ], -) - -################################ fcntl targets ################################# - -libc_function( - name = "open", - srcs = ["src/fcntl/linux/open.cpp"], - hdrs = ["src/fcntl/open.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "openat", - srcs = ["src/fcntl/linux/openat.cpp"], - hdrs = ["src/fcntl/openat.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "creat", - srcs = ["src/fcntl/linux/creat.cpp"], - hdrs = ["src/fcntl/creat.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -################################ unistd targets ################################ - -libc_function( - name = "access", - srcs = ["src/unistd/linux/access.cpp"], - hdrs = ["src/unistd/access.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "chdir", - srcs = ["src/unistd/linux/chdir.cpp"], - hdrs = ["src/unistd/chdir.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "close", - srcs = ["src/unistd/linux/close.cpp"], - hdrs = ["src/unistd/close.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "dup", - srcs = ["src/unistd/linux/dup.cpp"], - hdrs = ["src/unistd/dup.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "dup2", - srcs = ["src/unistd/linux/dup2.cpp"], - hdrs = ["src/unistd/dup2.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "dup3", - srcs = ["src/unistd/linux/dup3.cpp"], - hdrs = ["src/unistd/dup3.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "environ", - srcs = ["src/unistd/environ.cpp"], - hdrs = ["src/unistd/environ.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "fchdir", - srcs = ["src/unistd/linux/fchdir.cpp"], - hdrs = ["src/unistd/fchdir.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "fsync", - srcs = ["src/unistd/linux/fsync.cpp"], - hdrs = ["src/unistd/fsync.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "ftruncate", - srcs = ["src/unistd/linux/ftruncate.cpp"], - hdrs = ["src/unistd/ftruncate.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -# libc_function( -# name = "getcwd", -# srcs = ["src/unistd/linux/getcwd.cpp"], -# hdrs = ["src/unistd/getcwd.h"], -# deps = [ -# ":__support_common", -# ":__support_osutil_syscall", -# ":errno", -# ], -# ) - -libc_function( - name = "geteuid", - srcs = ["src/unistd/linux/geteuid.cpp"], - hdrs = ["src/unistd/geteuid.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "getpid", - srcs = ["src/unistd/linux/getpid.cpp"], - hdrs = ["src/unistd/getpid.h"], - deps = [ - ":__support_common", - ":__support_macros_config", - ":__support_osutil_pid", - ":__support_osutil_syscall", - ":errno", - ":types_pid_t", - ], -) - -libc_function( - name = "getppid", - srcs = ["src/unistd/linux/getppid.cpp"], - hdrs = ["src/unistd/getppid.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "getuid", - srcs = ["src/unistd/linux/getuid.cpp"], - hdrs = ["src/unistd/getuid.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -# libc_function( -# name = "getopt", -# srcs = ["src/unistd/getopt.cpp"], -# hdrs = ["src/unistd/getopt.h"], -# deps = [ -# ":__support_common", -# ":__support_cpp_optional", -# ":__support_cpp_string_view", -# ":__support_file_file", -# ":__support_osutil_syscall", -# ":errno", -# ], -# ) - -libc_function( - name = "isatty", - srcs = ["src/unistd/linux/isatty.cpp"], - hdrs = ["src/unistd/isatty.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "link", - srcs = ["src/unistd/linux/link.cpp"], - hdrs = ["src/unistd/link.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "linkat", - srcs = ["src/unistd/linux/linkat.cpp"], - hdrs = ["src/unistd/linkat.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "pipe", - srcs = ["src/unistd/linux/pipe.cpp"], - hdrs = ["src/unistd/pipe.h"], - deps = [ - ":__support_common", - ":__support_macros_sanitizer", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "lseek", - srcs = ["src/unistd/linux/lseek.cpp"], - hdrs = ["src/unistd/lseek.h"], - deps = [ - ":__support_common", - ":__support_file_linux_lseekimpl", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "pread", - srcs = ["src/unistd/linux/pread.cpp"], - hdrs = ["src/unistd/pread.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [ - ":__support_common", - ":__support_macros_sanitizer", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "pwrite", - srcs = ["src/unistd/linux/pwrite.cpp"], - hdrs = ["src/unistd/pwrite.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "read", - srcs = ["src/unistd/linux/read.cpp"], - hdrs = ["src/unistd/read.h"], - weak = True, - deps = [ - ":__support_common", - ":__support_macros_sanitizer", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "readlink", - srcs = ["src/unistd/linux/readlink.cpp"], - hdrs = ["src/unistd/readlink.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "readlinkat", - srcs = ["src/unistd/linux/readlinkat.cpp"], - hdrs = ["src/unistd/readlinkat.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "rmdir", - srcs = ["src/unistd/linux/rmdir.cpp"], - hdrs = ["src/unistd/rmdir.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "symlink", - srcs = ["src/unistd/linux/symlink.cpp"], - hdrs = ["src/unistd/symlink.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "symlinkat", - srcs = ["src/unistd/linux/symlinkat.cpp"], - hdrs = ["src/unistd/symlinkat.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -#TODO: Enable once fullbuild is added to bazel, since this depends on a macro -# definition in the public header - -# libc_function( -# name = "syscall", -# srcs = ["src/unistd/linux/syscall.cpp"], -# hdrs = ["src/unistd/syscall.h"], -# deps = [ -# ":__support_common", -# ":__support_osutil_syscall", -# ":errno", -# ], -# ) - -libc_function( - name = "swab", - srcs = ["src/unistd/swab.cpp"], - hdrs = ["src/unistd/swab.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "truncate", - srcs = ["src/unistd/linux/truncate.cpp"], - hdrs = ["src/unistd/truncate.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "unlink", - srcs = ["src/unistd/linux/unlink.cpp"], - hdrs = ["src/unistd/unlink.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "unlinkat", - srcs = ["src/unistd/linux/unlinkat.cpp"], - hdrs = ["src/unistd/unlinkat.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "write", - srcs = ["src/unistd/linux/write.cpp"], - hdrs = ["src/unistd/write.h"], - weak = True, - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -################################ stdio targets ################################# - -libc_support_library( - name = "printf_config", - hdrs = ["src/stdio/printf_core/printf_config.h"], - deps = [ - ], -) - -libc_support_library( - name = "printf_core_structs", - hdrs = ["src/stdio/printf_core/core_structs.h"], - deps = [ - ":__support_cpp_string_view", - ":__support_fputil_fp_bits", - ":printf_config", - ], -) - -libc_support_library( - name = "printf_parser", - hdrs = ["src/stdio/printf_core/parser.h"], - deps = [ - ":__support_arg_list", - ":__support_common", - ":__support_cpp_algorithm", - ":__support_cpp_bit", - ":__support_cpp_optional", - ":__support_cpp_string_view", - ":__support_cpp_type_traits", - ":__support_ctype_utils", - ":__support_fputil_fp_bits", - ":__support_str_to_integer", - ":printf_config", - ":printf_core_structs", - ], -) - -# Only used for testing. -libc_support_library( - name = "printf_mock_parser", - hdrs = ["src/stdio/printf_core/parser.h"], - local_defines = ["LIBC_COPT_MOCK_ARG_LIST"], - deps = [ - ":__support_arg_list", - ":__support_common", - ":__support_cpp_bit", - ":__support_cpp_optional", - ":__support_cpp_string_view", - ":__support_cpp_type_traits", - ":__support_ctype_utils", - ":__support_fputil_fp_bits", - ":__support_str_to_integer", - ":printf_config", - ":printf_core_structs", - ], -) - -libc_support_library( - name = "printf_writer", - srcs = ["src/stdio/printf_core/writer.cpp"], - hdrs = ["src/stdio/printf_core/writer.h"], - deps = [ - ":__support_cpp_string_view", - ":__support_macros_optimization", - ":printf_core_structs", - ":string_memory_utils", - ], -) - -libc_support_library( - name = "printf_converter", - srcs = ["src/stdio/printf_core/converter.cpp"], - hdrs = [ - "src/stdio/printf_core/char_converter.h", - "src/stdio/printf_core/converter.h", - "src/stdio/printf_core/converter_atlas.h", - "src/stdio/printf_core/converter_utils.h", - "src/stdio/printf_core/float_dec_converter.h", - "src/stdio/printf_core/float_hex_converter.h", - "src/stdio/printf_core/float_inf_nan_converter.h", - "src/stdio/printf_core/int_converter.h", - "src/stdio/printf_core/ptr_converter.h", - "src/stdio/printf_core/string_converter.h", - "src/stdio/printf_core/write_int_converter.h", - ], - deps = [ - ":__support_big_int", - ":__support_common", - ":__support_cpp_limits", - ":__support_cpp_span", - ":__support_cpp_string_view", - ":__support_float_to_string", - ":__support_fputil_fenv_impl", - ":__support_fputil_fp_bits", - ":__support_fputil_rounding_mode", - ":__support_integer_to_string", - ":__support_libc_assert", - ":__support_uint128", - ":printf_config", - ":printf_core_structs", - ":printf_writer", - ], -) - -libc_support_library( - name = "printf_main", - srcs = ["src/stdio/printf_core/printf_main.cpp"], - hdrs = ["src/stdio/printf_core/printf_main.h"], - deps = [ - ":__support_arg_list", - ":printf_converter", - ":printf_core_structs", - ":printf_parser", - ":printf_writer", - ], -) - -libc_support_library( - name = "vfprintf_internal", - hdrs = ["src/stdio/printf_core/vfprintf_internal.h"], - deps = [ - ":__support_arg_list", - ":__support_file_file", - ":__support_macros_attributes", - ":printf_main", - ":printf_writer", - ":types_FILE", - ], -) - -libc_function( - name = "sprintf", - srcs = ["src/stdio/sprintf.cpp"], - hdrs = ["src/stdio/sprintf.h"], - deps = [ - ":__support_arg_list", - ":__support_cpp_limits", - ":errno", - ":printf_main", - ":printf_writer", - ], -) - -libc_function( - name = "snprintf", - srcs = ["src/stdio/snprintf.cpp"], - hdrs = ["src/stdio/snprintf.h"], - deps = [ - ":__support_arg_list", - ":errno", - ":printf_main", - ":printf_writer", - ], -) - -libc_function( - name = "printf", - srcs = ["src/stdio/generic/printf.cpp"], - hdrs = ["src/stdio/printf.h"], - deps = [ - ":__support_arg_list", - ":__support_file_file", - ":errno", - ":types_FILE", - ":vfprintf_internal", - ], -) - -libc_function( - name = "fprintf", - srcs = ["src/stdio/generic/fprintf.cpp"], - hdrs = ["src/stdio/fprintf.h"], - deps = [ - ":__support_arg_list", - ":__support_file_file", - ":errno", - ":types_FILE", - ":vfprintf_internal", - ], -) - -libc_function( - name = "vsprintf", - srcs = ["src/stdio/vsprintf.cpp"], - hdrs = ["src/stdio/vsprintf.h"], - deps = [ - ":__support_arg_list", - ":__support_cpp_limits", - ":errno", - ":printf_main", - ":printf_writer", - ], -) - -libc_function( - name = "vsnprintf", - srcs = ["src/stdio/vsnprintf.cpp"], - hdrs = ["src/stdio/vsnprintf.h"], - deps = [ - ":__support_arg_list", - ":errno", - ":printf_main", - ":printf_writer", - ], -) - -libc_function( - name = "vprintf", - srcs = ["src/stdio/generic/vprintf.cpp"], - hdrs = ["src/stdio/vprintf.h"], - deps = [ - ":__support_arg_list", - ":__support_file_file", - ":errno", - ":types_FILE", - ":vfprintf_internal", - ], -) - -libc_function( - name = "vfprintf", - srcs = ["src/stdio/generic/vfprintf.cpp"], - hdrs = ["src/stdio/vfprintf.h"], - deps = [ - ":__support_arg_list", - ":__support_file_file", - ":errno", - ":types_FILE", - ":vfprintf_internal", - ], -) - -libc_function( - name = "remove", - srcs = ["src/stdio/linux/remove.cpp"], - hdrs = ["src/stdio/remove.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ":types_FILE", - ], -) - -libc_function( - name = "rename", - srcs = ["src/stdio/linux/rename.cpp"], - hdrs = ["src/stdio/rename.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ":llvm_libc_macros_fcntl_macros", - ], -) - -############################### sys/stat targets ############################### - -libc_function( - name = "mkdir", - srcs = ["src/sys/stat/linux/mkdir.cpp"], - hdrs = ["src/sys/stat/mkdir.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "mkdirat", - srcs = ["src/sys/stat/linux/mkdirat.cpp"], - hdrs = ["src/sys/stat/mkdirat.h"], - deps = [ - ":__support_common", - ":__support_osutil_syscall", - ":errno", - ], -) - -############################## sys/epoll targets ############################### - -libc_function( - name = "epoll_create", - srcs = ["src/sys/epoll/linux/epoll_create.cpp"], - hdrs = ["src/sys/epoll/epoll_create.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - weak = True, - deps = [ - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "epoll_create1", - srcs = ["src/sys/epoll/linux/epoll_create1.cpp"], - hdrs = ["src/sys/epoll/epoll_create1.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - weak = True, - deps = [ - ":__support_osutil_syscall", - ":errno", - ], -) - -libc_function( - name = "epoll_ctl", - srcs = ["src/sys/epoll/linux/epoll_ctl.cpp"], - hdrs = ["src/sys/epoll/epoll_ctl.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - weak = True, - deps = [ - ":__support_osutil_syscall", - ":errno", - ":hdr_sys_epoll_macros", - ":types_struct_epoll_event", - ], -) - -libc_function( - name = "epoll_wait", - srcs = ["src/sys/epoll/linux/epoll_wait.cpp"], - hdrs = ["src/sys/epoll/epoll_wait.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - weak = True, - deps = [ - ":__support_macros_sanitizer", - ":__support_osutil_syscall", - ":errno", - ":hdr_signal_macros", - ":hdr_sys_epoll_macros", - ":types_sigset_t", - ":types_struct_epoll_event", - ], -) - -libc_function( - name = "epoll_pwait", - srcs = ["src/sys/epoll/linux/epoll_pwait.cpp"], - hdrs = ["src/sys/epoll/epoll_pwait.h"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - weak = True, - deps = [ - ":__support_macros_sanitizer", - ":__support_osutil_syscall", - ":errno", - ":hdr_signal_macros", - ":hdr_sys_epoll_macros", - ":types_sigset_t", - ":types_struct_epoll_event", - ], -) - -#TODO: Enable once epoll_pwait2 availablilty can be checked first. -# https://github.com/llvm/llvm-project/issues/80060 -# libc_function( -# name = "epoll_pwait2", -# srcs = ["src/sys/epoll/linux/epoll_pwait2.cpp"], -# hdrs = ["src/sys/epoll/epoll_pwait2.h"], -# target_compatible_with = select({ -# "@platforms//os:linux": [], -# "//conditions:default": ["@platforms//:incompatible"], -# }), -# weak = True, -# deps = [ -# ":__support_macros_sanitizer", -# ":__support_osutil_syscall", -# ":errno", -# ":hdr_signal_macros", -# ":hdr_sys_epoll_macros", -# ":types_sigset_t", -# ":types_struct_epoll_event", -# ":types_struct_timespec", -# ], -# ) diff --git a/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl b/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl deleted file mode 100644 index ec3714407cb91..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl +++ /dev/null @@ -1,172 +0,0 @@ -# This file is licensed 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 - -"""LLVM libc starlark rules for building individual functions.""" - -load("@bazel_skylib//lib:paths.bzl", "paths") -load("@bazel_skylib//lib:selects.bzl", "selects") -load(":libc_configure_options.bzl", "LIBC_CONFIGURE_OPTIONS") -load(":libc_namespace.bzl", "LIBC_NAMESPACE") -load(":platforms.bzl", "PLATFORM_CPU_ARM64", "PLATFORM_CPU_X86_64") - -def libc_internal_target(name): - return name + ".__internal__" - -def libc_common_copts(): - root_label = Label(":libc") - libc_include_path = paths.join(root_label.workspace_root, root_label.package) - return [ - "-I" + libc_include_path, - "-I" + paths.join(libc_include_path, "include"), - "-DLIBC_NAMESPACE=" + LIBC_NAMESPACE, - ] - -def _libc_library(name, hidden, copts = [], deps = [], local_defines = [], **kwargs): - """Internal macro to serve as a base for all other libc library rules. - - Args: - name: Target name. - copts: The special compiler options for the target. - deps: The list of target dependencies if any. - local_defines: The list of target local_defines if any. - hidden: Whether the symbols should be explicitly hidden or not. - **kwargs: All other attributes relevant for the cc_library rule. - """ - - # We want all libc sources to be compiled with "hidden" visibility. - # The public symbols will be given "default" visibility explicitly. - # See src/__support/common.h for more information. - if hidden: - copts = copts + ["-fvisibility=hidden"] - native.cc_library( - name = name, - copts = copts + libc_common_copts(), - local_defines = local_defines + LIBC_CONFIGURE_OPTIONS, - deps = deps, - linkstatic = 1, - **kwargs - ) - -# A convenience function which should be used to list all libc support libraries. -# Any library which does not define a public function should be listed with -# libc_support_library. -def libc_support_library(name, **kwargs): - _libc_library(name = name, hidden = False, **kwargs) - -def libc_function( - name, - srcs, - weak = False, - copts = None, - local_defines = None, - **kwargs): - """Add target for a libc function. - - The libc function is eventually available as a cc_library target by name - "name". LLVM libc implementations of libc functions are in C++. So, this - rule internally generates a C wrapper for the C++ implementation and adds - it to the source list of the cc_library. This way, the C++ implementation - and the C wrapper are both available in the cc_library. - - Args: - name: Target name. It is normally the name of the function this target is - for. - srcs: The .cpp files which contain the function implementation. - weak: Make the symbol corresponding to the libc function "weak". - deps: The list of target dependencies if any. - copts: The list of options to add to the C++ compilation command. - local_defines: The preprocessor defines which will be prepended with -D - and passed to the compile command of this target but not - its deps. - **kwargs: Other attributes relevant for a cc_library. For example, deps. - """ - - # We use the explicit equals pattern here because append and += mutate the - # original list, where this creates a new list and stores it in deps. - copts = copts or [] - copts = copts + [ - "-O3", - "-fno-builtin", - "-fno-lax-vector-conversions", - "-ftrivial-auto-var-init=pattern", - "-fno-omit-frame-pointer", - "-fstack-protector-strong", - ] - - # x86 targets have -mno-omit-leaf-frame-pointer. - platform_copts = selects.with_or({ - PLATFORM_CPU_X86_64: ["-mno-omit-leaf-frame-pointer"], - "//conditions:default": [], - }) - copts = copts + platform_copts - - # We compile the code twice, the first target is suffixed with ".__internal__" and contains the - # C++ functions in the "LIBC_NAMESPACE" namespace. This allows us to test the function in the - # presence of another libc. - libc_support_library( - name = libc_internal_target(name), - srcs = srcs, - copts = copts, - **kwargs - ) - - # This second target is the llvm libc C function with either a default or hidden visibility. - # All other functions are hidden. - func_attrs = ["__attribute__((visibility(\"default\")))"] - if weak: - func_attrs = func_attrs + ["__attribute__((weak))"] - local_defines = local_defines or ["LIBC_COPT_PUBLIC_PACKAGING"] - local_defines = local_defines + ["LLVM_LIBC_FUNCTION_ATTR='%s'" % " ".join(func_attrs)] - _libc_library( - name = name, - hidden = True, - srcs = srcs, - copts = copts, - local_defines = local_defines, - **kwargs - ) - -def libc_math_function( - name, - specializations = None, - additional_deps = None): - """Add a target for a math function. - - Args: - name: The name of the function. - specializations: List of machine specializations available for this - function. Possible specializations are "generic", - "aarch64" and "x86_64". - additional_deps: Other deps like helper cc_library targes used by the - math function. - """ - additional_deps = additional_deps or [] - specializations = specializations or ["generic"] - select_map = {} - if "generic" in specializations: - select_map["//conditions:default"] = ["src/math/generic/" + name + ".cpp"] - if "aarch64" in specializations: - select_map[PLATFORM_CPU_ARM64] = ["src/math/aarch64/" + name + ".cpp"] - if "x86_64" in specializations: - select_map[PLATFORM_CPU_X86_64] = ["src/math/x86_64/" + name + ".cpp"] - - #TODO(michaelrj): Fix the floating point dependencies - OLD_FPUTIL_DEPS = [ - ":__support_fputil_basic_operations", - ":__support_fputil_division_and_remainder_operations", - ":__support_fputil_fenv_impl", - ":__support_fputil_fp_bits", - ":__support_fputil_hypot", - ":__support_fputil_manipulation_functions", - ":__support_fputil_nearest_integer_operations", - ":__support_fputil_normal_float", - ":__support_math_extras", - ":__support_fputil_except_value_utils", - ] - libc_function( - name = name, - srcs = selects.with_or(select_map), - hdrs = ["src/math/" + name + ".h"], - deps = [":__support_common"] + OLD_FPUTIL_DEPS + additional_deps, - ) diff --git a/utils/bazel/llvm-project-overlay/libc/libc_namespace.bzl b/utils/bazel/llvm-project-overlay/libc/libc_namespace.bzl deleted file mode 100644 index a59aeea73713d..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/libc_namespace.bzl +++ /dev/null @@ -1,10 +0,0 @@ -# This file is licensed 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 - -"""LLVM libc namespace declaration.""" - -load("//:vars.bzl", "LLVM_VERSION_MAJOR", "LLVM_VERSION_MINOR", "LLVM_VERSION_PATCH") - -# The default libc namespace that encloses all functions. -LIBC_NAMESPACE = "__llvm_libc_{}_{}_{}_git".format(LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR, LLVM_VERSION_PATCH) diff --git a/utils/bazel/llvm-project-overlay/libc/platforms.bzl b/utils/bazel/llvm-project-overlay/libc/platforms.bzl deleted file mode 100644 index 7137984740e24..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/platforms.bzl +++ /dev/null @@ -1,9 +0,0 @@ -# This file is licensed 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 - -"""Defines global variables that lists target cpus""" - -PLATFORM_CPU_ARM64 = ("@platforms//cpu:arm64") - -PLATFORM_CPU_X86_64 = ("@platforms//cpu:x86_64") diff --git a/utils/bazel/llvm-project-overlay/libc/test/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/BUILD.bazel deleted file mode 100644 index 70b0196469eca..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/BUILD.bazel +++ /dev/null @@ -1,7 +0,0 @@ -# This file is licensed 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 - -package(default_visibility = ["//visibility:public"]) - -exports_files(["libc_test_rules.bzl"]) diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel deleted file mode 100644 index 3e130cd9dc6f0..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel +++ /dev/null @@ -1,148 +0,0 @@ -# This file is licensed 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 - -# LLVM libc unittest library. - -load("//libc:libc_build_rules.bzl", "libc_support_library") - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -libc_support_library( - name = "test_logger", - srcs = ["TestLogger.cpp"], - hdrs = ["TestLogger.h"], - deps = [ - "//libc:__support_big_int", - "//libc:__support_cpp_string", - "//libc:__support_cpp_string_view", - "//libc:__support_macros_config", - "//libc:__support_macros_properties_types", - "//libc:__support_osutil_io", - "//libc:__support_uint128", - ], -) - -libc_support_library( - name = "LibcUnitTest", - srcs = [ - "BazelFilePath.cpp", - "ExecuteFunctionUnix.cpp", - "LibcTest.cpp", - "LibcTestMain.cpp", - ], - hdrs = [ - "ErrnoSetterMatcher.h", - "ExecuteFunction.h", - "LibcTest.h", - "PlatformDefs.h", - "Test.h", - ], - deps = [ - ":test_logger", - "//libc:__support_c_string", - "//libc:__support_cpp_bit", - "//libc:__support_cpp_bitset", - "//libc:__support_cpp_span", - "//libc:__support_cpp_string", - "//libc:__support_cpp_string_view", - "//libc:__support_cpp_type_traits", - "//libc:__support_fixed_point", - "//libc:__support_fputil_fp_bits", - "//libc:__support_fputil_fpbits_str", - "//libc:__support_fputil_rounding_mode", - "//libc:__support_macros_config", - "//libc:__support_macros_properties_architectures", - "//libc:__support_macros_properties_types", - "//libc:__support_stringutil", - "//libc:__support_uint128", - "//libc:errno", - "//libc:llvm_libc_macros_stdfix_macros", - "//llvm:Support", - ], -) - -libc_support_library( - name = "fp_test_helpers", - srcs = [ - "FEnvSafeTest.cpp", - "FPExceptMatcher.cpp", - "RoundingModeUtils.cpp", - ], - hdrs = [ - "FEnvSafeTest.h", - "FPExceptMatcher.h", - "FPMatcher.h", - "RoundingModeUtils.h", - ], - deps = [ - ":LibcUnitTest", - ":string_utils", - ":test_logger", - "//libc:__support_cpp_array", - "//libc:__support_cpp_bit", - "//libc:__support_cpp_bitset", - "//libc:__support_cpp_span", - "//libc:__support_cpp_type_traits", - "//libc:__support_cpp_utility", - "//libc:__support_fputil_fenv_impl", - "//libc:__support_fputil_fp_bits", - "//libc:__support_fputil_fpbits_str", - "//libc:__support_fputil_rounding_mode", - "//libc:__support_macros_config", - "//libc:__support_macros_properties_architectures", - "//libc:hdr_fenv_macros", - "//libc:hdr_math_macros", - "//libc:types_fenv_t", - ], -) - -libc_support_library( - name = "memory_matcher", - srcs = [ - "MemoryMatcher.cpp", - ], - hdrs = [ - "MemoryMatcher.h", - ], - deps = [ - ":LibcUnitTest", - "//libc:__support_cpp_bit", - "//libc:__support_cpp_bitset", - "//libc:__support_cpp_span", - "//libc:__support_cpp_type_traits", - "//libc:__support_macros_config", - ], -) - -libc_support_library( - name = "printf_matcher", - srcs = [ - "PrintfMatcher.cpp", - ], - hdrs = [ - "PrintfMatcher.h", - ], - deps = [ - ":LibcUnitTest", - ":string_utils", - "//libc:__support_fputil_fp_bits", - "//libc:__support_macros_config", - "//libc:printf_core_structs", - ], -) - -libc_support_library( - name = "string_utils", - hdrs = [ - "StringUtils.h", - ], - deps = [ - "//libc:__support_big_int", - "//libc:__support_cpp_string", - "//libc:__support_cpp_type_traits", - "//libc:__support_macros_config", - ], -) diff --git a/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl b/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl deleted file mode 100644 index 1da0a24b7791a..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl +++ /dev/null @@ -1,43 +0,0 @@ -# This file is licensed 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 - -"""LLVM libc starlark rules for tests. - -libc functions are created though the libc_build_rules.bzl:libc_function. -They come in two flavors: - - the internal one that is scoped into the `LIBC_NAMESPACE` namespace. - - the libc one that is the regular C function. - -When performing tests we make sure to always use the internal version. -""" - -load("//libc:libc_build_rules.bzl", "libc_common_copts", "libc_internal_target") -load("//libc:libc_configure_options.bzl", "LIBC_CONFIGURE_OPTIONS") - -def libc_test(name, srcs, libc_function_deps = [], copts = [], deps = [], local_defines = [], **kwargs): - """Add target for a libc test. - - Args: - name: Test target name - srcs: List of sources for the test. - libc_function_deps: List of libc_function targets used by this test. - copts: The list of options to add to the C++ compilation command. - deps: The list of other libraries to be linked in to the test target. - local_defines: The list of target local_defines if any. - **kwargs: Attributes relevant for a libc_test. For example, name, srcs. - """ - all_function_deps = libc_function_deps + ["//libc:errno"] - native.cc_test( - name = name, - srcs = srcs, - local_defines = local_defines + LIBC_CONFIGURE_OPTIONS, - deps = [libc_internal_target(d) for d in all_function_deps] + [ - "//libc/test/UnitTest:LibcUnitTest", - "//libc:__support_macros_config", - ] + deps, - features = ["-link_llvmlibc"], # Do not link libllvmlibc.a - copts = copts + libc_common_copts(), - linkstatic = 1, - **kwargs - ) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel deleted file mode 100644 index c8001fe1e5812..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel +++ /dev/null @@ -1,122 +0,0 @@ -# This file is licensed 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 - -# Tests for LLVM libc __support functions. - -load("//libc/test:libc_test_rules.bzl", "libc_test") - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -libc_test( - name = "math_extras_test", - srcs = ["math_extras_test.cpp"], - deps = [ - "//libc:__support_integer_literals", - "//libc:__support_math_extras", - "//libc:__support_uint128", - ], -) - -# This test is currently disabled because of an issue in -# `libc/src/__support/CPP/new.h` which currently fails with -# "error: cannot apply asm label to function after its first use" -# libc_test( -# name = "blockstore_test", -# srcs = ["blockstore_test.cpp"], -# deps = ["//libc:__support_blockstore"], -# ) - -libc_test( - name = "endian_test", - srcs = ["endian_test.cpp"], - deps = ["//libc:__support_common"], -) - -libc_test( - name = "high_precision_decimal_test", - srcs = ["high_precision_decimal_test.cpp"], - deps = [ - "//libc:__support_str_to_float", - "//libc:__support_uint128", - ], -) - -libc_test( - name = "str_to_float_test", - srcs = [ - "str_to_double_test.cpp", - "str_to_float_test.cpp", - "str_to_fp_test.h", - "str_to_long_double_test.cpp", - ], - deps = [ - "//libc:__support_fputil_fp_bits", - "//libc:__support_integer_literals", - "//libc:__support_str_to_float", - "//libc:__support_uint128", - ], -) - -libc_test( - name = "integer_to_string_test", - srcs = ["integer_to_string_test.cpp"], - deps = [ - "//libc:__support_big_int", - "//libc:__support_cpp_limits", - "//libc:__support_cpp_span", - "//libc:__support_cpp_string_view", - "//libc:__support_integer_literals", - "//libc:__support_integer_to_string", - "//libc:__support_uint128", - ], -) - -libc_test( - name = "arg_list_test", - srcs = ["arg_list_test.cpp"], - deps = [ - "//libc:__support_arg_list", - ], -) - -libc_test( - name = "big_int_test", - srcs = ["big_int_test.cpp"], - deps = [ - "//libc:__support_big_int", - "//libc:__support_cpp_optional", - "//libc:__support_integer_literals", - "//libc:__support_macros_properties_types", - "//libc:hdr_math_macros", - "//libc:llvm_libc_macros_math_macros", - ], -) - -libc_test( - name = "fixedvector_test", - srcs = ["fixedvector_test.cpp"], - deps = [ - "//libc:__support_cpp_array", - "//libc:__support_fixedvector", - ], -) - -libc_test( - name = "char_vector_test", - srcs = ["char_vector_test.cpp"], - deps = [ - "//libc:__support_char_vector", - ], -) - -libc_test( - name = "integer_literals_test", - srcs = ["integer_literals_test.cpp"], - deps = [ - "//libc:__support_integer_literals", - "//libc:__support_macros_properties_types", - ], -) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/__support/CPP/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/__support/CPP/BUILD.bazel deleted file mode 100644 index 96dafbc6da485..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/src/__support/CPP/BUILD.bazel +++ /dev/null @@ -1,97 +0,0 @@ -# This file is licensed 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 - -# Tests for LLVM libc CPP functions. - -load("//libc/test:libc_test_rules.bzl", "libc_test") - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -libc_test( - name = "atomic_test", - srcs = ["atomic_test.cpp"], - deps = ["//libc:__support_cpp_atomic"], -) - -libc_test( - name = "bitset_test", - srcs = ["bitset_test.cpp"], - deps = ["//libc:__support_cpp_bitset"], -) - -libc_test( - name = "bit_test", - srcs = ["bit_test.cpp"], - deps = [ - "//libc:__support_big_int", - "//libc:__support_cpp_bit", - "//libc:__support_macros_properties_types", - ], -) - -libc_test( - name = "cstddef_test", - srcs = ["cstddef_test.cpp"], - deps = ["//libc:__support_cpp_cstddef"], -) - -libc_test( - name = "integer_sequence_test", - srcs = ["integer_sequence_test.cpp"], - deps = ["//libc:__support_cpp_utility"], -) - -libc_test( - name = "limits_test", - srcs = ["limits_test.cpp"], - deps = [ - "//libc:__support_big_int", - "//libc:__support_cpp_limits", - "//libc:__support_macros_properties_types", - ], -) - -libc_test( - name = "optional_test", - srcs = ["optional_test.cpp"], - deps = ["//libc:__support_cpp_optional"], -) - -libc_test( - name = "span_test", - srcs = ["span_test.cpp"], - deps = [ - "//libc:__support_cpp_array", - "//libc:__support_cpp_span", - ], -) - -libc_test( - name = "stringstream_test", - srcs = ["stringstream_test.cpp"], - deps = [ - "//libc:__support_cpp_span", - "//libc:__support_cpp_stringstream", - ], -) - -libc_test( - name = "string_test", - srcs = ["string_test.cpp"], - deps = ["//libc:__support_cpp_string"], -) - -libc_test( - name = "stringview_test", - srcs = ["stringview_test.cpp"], - deps = ["//libc:__support_cpp_string_view"], -) - -libc_test( - name = "type_traits_test", - srcs = ["type_traits_test.cpp"], - deps = ["//libc:__support_cpp_type_traits"], -) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/__support/FPUtil/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/__support/FPUtil/BUILD.bazel deleted file mode 100644 index 41b85d2a52368..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/src/__support/FPUtil/BUILD.bazel +++ /dev/null @@ -1,47 +0,0 @@ -# This file is licensed 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 - -# Tests for LLVM libc __support functions. - -load("//libc/test:libc_test_rules.bzl", "libc_test") - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -libc_test( - name = "fpbits_test", - srcs = ["fpbits_test.cpp"], - deps = [ - "//libc:__support_fputil_fp_bits", - "//libc:__support_fputil_fpbits_str", - "//libc:__support_integer_literals", - "//libc:__support_sign", - ], -) - -libc_test( - name = "dyadic_float_test", - srcs = ["dyadic_float_test.cpp"], - copts = ["-frounding-math"], - deps = [ - "//libc:__support_big_int", - "//libc:__support_fputil_dyadic_float", - "//libc:__support_macros_properties_types", - "//libc:__support_uint128", - "//libc/test/UnitTest:fp_test_helpers", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -libc_test( - name = "rounding_mode_test", - srcs = ["rounding_mode_test.cpp"], - deps = [ - "//libc:__support_fputil_rounding_mode", - "//libc:__support_uint128", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - "//libc:hdr_fenv_macros", - ], -) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/fenv/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/fenv/BUILD.bazel deleted file mode 100644 index 03c94d1db23aa..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/src/fenv/BUILD.bazel +++ /dev/null @@ -1,178 +0,0 @@ -# This file is licensed 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 - -# Tests for LLVM libc math.h functions. - -load("//libc/test:libc_test_rules.bzl", "libc_test") - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -libc_test( - name = "exception_status_test", - srcs = [ - "exception_status_test.cpp", - "excepts.h", - ], - libc_function_deps = [ - "//libc:feclearexcept", - "//libc:feraiseexcept", - "//libc:fesetexcept", - "//libc:fetestexcept", - ], - deps = [ - "//libc:__support_fputil_fenv_impl", - "//libc:hdr_fenv_macros", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -libc_test( - name = "rounding_mode_test", - srcs = [ - "excepts.h", - "rounding_mode_test.cpp", - ], - libc_function_deps = [ - "//libc:fegetround", - "//libc:fesetround", - ], - deps = [ - "//libc:hdr_fenv_macros", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -libc_test( - name = "enabled_exceptions_test", - srcs = [ - "enabled_exceptions_test.cpp", - "excepts.h", - ], - libc_function_deps = [ - "//libc:feclearexcept", - "//libc:feraiseexcept", - "//libc:fetestexcept", - ], - tags = ["nosan"], - deps = [ - "//libc:__support_common", - "//libc:__support_fputil_fenv_impl", - "//libc:__support_macros_properties_architectures", - "//libc:hdr_fenv_macros", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -libc_test( - name = "feholdexcept_test", - srcs = [ - "excepts.h", - "feholdexcept_test.cpp", - ], - libc_function_deps = [ - "//libc:feholdexcept", - ], - tags = ["nosan"], - deps = [ - "//libc:__support_common", - "//libc:__support_fputil_fenv_impl", - "//libc:__support_macros_properties_architectures", - "//libc:hdr_fenv_macros", - "//libc:types_fenv_t", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -libc_test( - name = "exception_flags_test", - srcs = [ - "exception_flags_test.cpp", - "excepts.h", - ], - libc_function_deps = [ - "//libc:fegetexceptflag", - "//libc:fesetexceptflag", - "//libc:fetestexceptflag", - ], - deps = [ - "//libc:__support_fputil_fenv_impl", - "//libc:hdr_fenv_macros", - "//libc:types_fexcept_t", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -libc_test( - name = "feclearexcept_test", - srcs = [ - "excepts.h", - "feclearexcept_test.cpp", - ], - libc_function_deps = [ - "//libc:feclearexcept", - ], - deps = [ - "//libc:__support_fputil_fenv_impl", - "//libc:hdr_fenv_macros", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -libc_test( - name = "feenableexcept_test", - srcs = [ - "excepts.h", - "feenableexcept_test.cpp", - ], - libc_function_deps = [ - "//libc:fedisableexcept", - "//libc:feenableexcept", - "//libc:fegetexcept", - ], - deps = [ - "//libc:__support_common", - "//libc:__support_macros_properties_architectures", - "//libc:hdr_fenv_macros", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -libc_test( - name = "feupdateenv_test", - srcs = [ - "excepts.h", - "feupdateenv_test.cpp", - ], - libc_function_deps = [ - "//libc:feupdateenv", - ], - deps = [ - "//libc:__support_fputil_fenv_impl", - "//libc:hdr_fenv_macros", - "//libc:types_fenv_t", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -libc_test( - name = "getenv_and_setenv_test", - srcs = [ - "excepts.h", - "getenv_and_setenv_test.cpp", - ], - libc_function_deps = [ - "//libc:fegetenv", - "//libc:fegetround", - "//libc:fesetenv", - "//libc:fesetround", - ], - deps = [ - "//libc:__support_fputil_fenv_impl", - "//libc:hdr_fenv_macros", - "//libc:types_fenv_t", - "//libc/test/UnitTest:fp_test_helpers", - ], -) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/inttypes/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/inttypes/BUILD.bazel deleted file mode 100644 index bda7245d1f677..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/src/inttypes/BUILD.bazel +++ /dev/null @@ -1,30 +0,0 @@ -# This file is licensed 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 - -# Tests for LLVM libc inttypes.h functions. - -load("//libc/test:libc_test_rules.bzl", "libc_test") - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -libc_test( - name = "imaxabs_test", - srcs = ["imaxabs_test.cpp"], - libc_function_deps = [ - "//libc:imaxabs", - ], -) - -libc_test( - name = "imaxdiv_test", - srcs = ["imaxdiv_test.cpp"], - libc_function_deps = [ - "//libc:imaxdiv", - ], - deps = [ - "//libc/test/src/stdlib:div_test_helper", - ], -) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel deleted file mode 100644 index 57e3f9f6e9458..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel +++ /dev/null @@ -1,833 +0,0 @@ -# This file is licensed 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 - -# Tests for LLVM libc math.h functions. - -load("//libc:libc_build_rules.bzl", "libc_support_library") -load("//libc/test/src/math:libc_math_test_rules.bzl", "math_test") - -package(default_visibility = ["//visibility:public"]) - -exports_files(["libc_math_test_rules.bzl"]) - -licenses(["notice"]) - -math_test( - name = "fabs", - hdrs = ["FAbsTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "fabsf", - hdrs = ["FAbsTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "fabsl", - hdrs = ["FAbsTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "ceil", - hdrs = ["CeilTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "ceilf", - hdrs = ["CeilTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "ceill", - hdrs = ["CeilTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "floor", - hdrs = ["FloorTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "floorf", - hdrs = ["FloorTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "floorl", - hdrs = ["FloorTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "trunc", - hdrs = ["TruncTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "truncf", - hdrs = ["TruncTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "truncl", - hdrs = ["TruncTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "round", - hdrs = ["RoundTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "roundf", - hdrs = ["RoundTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "roundl", - hdrs = ["RoundTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "frexp", - hdrs = ["FrexpTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "frexpf", - hdrs = ["FrexpTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "frexpl", - hdrs = ["FrexpTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "hypot", - hdrs = ["HypotTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "hypotf", - hdrs = [ - "HypotTest.h", - "hypotf_hard_to_round.h", - ], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "logb", - hdrs = ["LogbTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "logbf", - hdrs = ["LogbTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "logbl", - hdrs = ["LogbTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "modf", - hdrs = ["ModfTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "modff", - hdrs = ["ModfTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "modfl", - hdrs = ["ModfTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -libc_support_library( - name = "remquo_test_template", - hdrs = ["RemQuoTest.h"], - deps = [ - "//libc:__support_fputil_basic_operations", - "//libc:__support_fputil_fp_bits", - "//libc:hdr_math_macros", - "//libc/test/UnitTest:LibcUnitTest", - "//libc/test/UnitTest:fp_test_helpers", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "remquo", - deps = [ - ":remquo_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "remquof", - deps = [ - ":remquo_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "remquol", - deps = [ - ":remquo_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "fmin", - hdrs = ["FMinTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "fminf", - hdrs = ["FMinTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "fminl", - hdrs = ["FMinTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "fmax", - hdrs = ["FMaxTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "fmaxf", - hdrs = ["FMaxTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "fmaxl", - hdrs = ["FMaxTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "sqrt", - hdrs = ["SqrtTest.h"], - deps = [ - "//libc:__support_cpp_bit", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "sqrtf", - hdrs = ["SqrtTest.h"], - deps = [ - "//libc:__support_cpp_bit", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "sqrtl", - hdrs = ["SqrtTest.h"], - deps = [ - "//libc:__support_cpp_bit", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "copysign", - hdrs = ["CopySignTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "copysignf", - hdrs = ["CopySignTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -math_test( - name = "copysignl", - hdrs = ["CopySignTest.h"], - deps = ["//libc/utils/MPFRWrapper:mpfr_wrapper"], -) - -libc_support_library( - name = "ilogb_test_template", - hdrs = ["ILogbTest.h"], - deps = [ - "//libc:__support_cpp_limits", - "//libc:__support_fputil_fp_bits", - "//libc:__support_fputil_manipulation_functions", - "//libc:hdr_math_macros", - "//libc/test/UnitTest:LibcUnitTest", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -math_test( - name = "ilogb", - deps = [":ilogb_test_template"], -) - -math_test( - name = "ilogbf", - deps = [":ilogb_test_template"], -) - -math_test( - name = "ilogbl", - deps = [":ilogb_test_template"], -) - -libc_support_library( - name = "fdim_test_template", - hdrs = ["FDimTest.h"], - deps = [ - "//libc:__support_fputil_basic_operations", - "//libc:__support_fputil_fenv_impl", - "//libc:__support_fputil_fp_bits", - "//libc:hdr_math_macros", - "//libc/test/UnitTest:LibcUnitTest", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -math_test( - name = "fdim", - deps = [":fdim_test_template"], -) - -math_test( - name = "fdimf", - deps = [":fdim_test_template"], -) - -math_test( - name = "fdiml", - deps = [":fdim_test_template"], -) - -libc_support_library( - name = "ldexp_test_template", - hdrs = ["LdExpTest.h"], - deps = [ - "//libc:__support_cpp_limits", - "//libc:__support_fputil_fp_bits", - "//libc:__support_fputil_normal_float", - "//libc:hdr_math_macros", - "//libc/test/UnitTest:LibcUnitTest", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -math_test( - name = "ldexp", - deps = [":ldexp_test_template"], -) - -math_test( - name = "ldexpf", - deps = [":ldexp_test_template"], -) - -math_test( - name = "ldexpl", - deps = [":ldexp_test_template"], -) - -libc_support_library( - name = "rint_test_template", - hdrs = ["RIntTest.h"], - deps = [ - "//libc:__support_cpp_algorithm", - "//libc:__support_fputil_fenv_impl", - "//libc:__support_fputil_fp_bits", - "//libc:hdr_fenv_macros", - "//libc:hdr_math_macros", - "//libc/test/UnitTest:LibcUnitTest", - "//libc/test/UnitTest:fp_test_helpers", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "rint", - deps = [ - ":rint_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "rintf", - deps = [ - ":rint_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "rintl", - deps = [ - ":rint_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -libc_support_library( - name = "round_to_integer_test_template", - hdrs = ["RoundToIntegerTest.h"], - deps = [ - "//libc:__support_cpp_algorithm", - "//libc:__support_fputil_fenv_impl", - "//libc:__support_fputil_fp_bits", - "//libc:__support_macros_properties_architectures", - "//libc:hdr_math_macros", - "//libc/test/UnitTest:LibcUnitTest", - "//libc/test/UnitTest:fp_test_helpers", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "lrint", - deps = [ - ":round_to_integer_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "lrintf", - deps = [ - ":round_to_integer_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "lrintl", - deps = [ - ":round_to_integer_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "llrint", - deps = [ - ":round_to_integer_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "llrintf", - deps = [ - ":round_to_integer_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "llrintl", - deps = [ - ":round_to_integer_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "lround", - deps = [ - ":round_to_integer_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "lroundf", - deps = [ - ":round_to_integer_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "lroundl", - deps = [ - ":round_to_integer_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "llround", - deps = [ - ":round_to_integer_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "llroundf", - deps = [ - ":round_to_integer_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "llroundl", - deps = [ - ":round_to_integer_test_template", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -libc_support_library( - name = "nextafter_test_template", - hdrs = ["NextAfterTest.h"], - deps = [ - "//libc:__support_cpp_array", - "//libc:__support_cpp_bit", - "//libc:__support_cpp_type_traits", - "//libc:__support_fputil_basic_operations", - "//libc:__support_fputil_fenv_impl", - "//libc:__support_fputil_fp_bits", - "//libc:hdr_fenv_macros", - "//libc:hdr_math_macros", - "//libc/test/UnitTest:LibcUnitTest", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -math_test( - name = "nextafter", - deps = [":nextafter_test_template"], -) - -math_test( - name = "nextafterf", - deps = [":nextafter_test_template"], -) - -math_test( - name = "nextafterl", - deps = [":nextafter_test_template"], -) - -libc_support_library( - name = "sdcomp26094", - hdrs = ["sdcomp26094.h"], - deps = [ - "//libc:__support_cpp_array", - "//libc:__support_macros_config", - ], -) - -math_test( - name = "cosf", - deps = [ - ":sdcomp26094", - "//libc:__support_cpp_array", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "sincosf", - deps = [ - ":sdcomp26094", - "//libc:__support_cpp_array", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "sinf", - deps = [ - ":sdcomp26094", - "//libc:__support_cpp_array", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "tanf", - deps = [ - ":sdcomp26094", - "//libc:__support_cpp_array", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "expf", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "exp2f", - deps = [ - "//libc:__support_macros_properties_cpu_features", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "exp10f", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "expm1f", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "logf", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "log2f", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "log10f", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "log1pf", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "log", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "log2", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "log10", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "log1p", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "sinhf", - deps = [ - "//libc:__support_cpp_array", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "coshf", - deps = [ - "//libc:__support_cpp_array", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "cospif", - deps = [ - ":sdcomp26094", - "//libc:__support_cpp_array", - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "tanhf", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "asinhf", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "acoshf", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "atanhf", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "asinf", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "acosf", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "atanf", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "erff", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "exp", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "exp2", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "exp10", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "powf", - deps = [ - "//libc/utils/MPFRWrapper:mpfr_wrapper", - ], -) - -math_test( - name = "fmod", - hdrs = ["FModTest.h"], -) - -math_test( - name = "fmodf", - hdrs = ["FModTest.h"], -) - -math_test( - name = "scalbn", - hdrs = [ - "LdExpTest.h", - "ScalbnTest.h", - ], - deps = ["//libc:__support_cpp_limits"], -) - -math_test( - name = "scalbnf", - hdrs = [ - "LdExpTest.h", - "ScalbnTest.h", - ], - deps = ["//libc:__support_cpp_limits"], -) - -math_test( - name = "scalbnl", - hdrs = [ - "LdExpTest.h", - "ScalbnTest.h", - ], - deps = ["//libc:__support_cpp_limits"], -) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/math/libc_math_test_rules.bzl b/utils/bazel/llvm-project-overlay/libc/test/src/math/libc_math_test_rules.bzl deleted file mode 100644 index 9ec3a5e5ad57a..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/src/math/libc_math_test_rules.bzl +++ /dev/null @@ -1,42 +0,0 @@ -# This file is licensed 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 - -"""LLVM libc starlark rules for math tests. - -This rule delegates testing to libc_test_rules.bzl:libc_test. -It adds common math dependencies. -""" - -load("//libc/test:libc_test_rules.bzl", "libc_test") - -def math_test(name, hdrs = [], deps = [], **kwargs): - """Add a target for the unittest of a math function. - - Args: - name: The name of the function being tested. - hdrs: List of headers to add. - deps: The list of other libraries to be linked in to the test target. - **kwargs: Attributes relevant for a cc_test. For example, name, srcs. - """ - test_name = name + "_test" - libc_test( - name = test_name, - srcs = [test_name + ".cpp"] + hdrs, - libc_function_deps = ["//libc:func_name".replace("func_name", name)], - deps = [ - "//libc/test/UnitTest:fp_test_helpers", - "//libc:__support_cpp_algorithm", - "//libc:__support_fputil_basic_operations", - "//libc:__support_fputil_fenv_impl", - "//libc:__support_fputil_fp_bits", - "//libc:__support_fputil_manipulation_functions", - "//libc:__support_fputil_nearest_integer_operations", - "//libc:__support_fputil_normal_float", - "//libc:__support_macros_properties_architectures", - "//libc:__support_math_extras", - "//libc:__support_uint128", - "//libc:hdr_math_macros", - ] + deps, - **kwargs - ) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel deleted file mode 100644 index 145ef86380b62..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel +++ /dev/null @@ -1,134 +0,0 @@ -# This file is licensed 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 - -# Tests for LLVM libc stdio.h functions. - -load("//libc/test:libc_test_rules.bzl", "libc_test") - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -libc_test( - name = "printf_parser_test", - srcs = ["printf_core/parser_test.cpp"], - libc_function_deps = [ - ], - deps = [ - "//libc:__support_arg_list", - "//libc:__support_cpp_bit", - "//libc:__support_cpp_string_view", - "//libc:printf_core_structs", - "//libc:printf_parser", - "//libc/test/UnitTest:printf_matcher", - ], -) - -libc_test( - name = "printf_writer_test", - srcs = ["printf_core/writer_test.cpp"], - libc_function_deps = [ - ], - deps = [ - "//libc:__support_arg_list", - "//libc:__support_cpp_string_view", - "//libc:printf_core_structs", - "//libc:printf_writer", - "//libc:string_memory_utils", - ], -) - -libc_test( - name = "printf_converter_test", - srcs = ["printf_core/converter_test.cpp"], - libc_function_deps = [ - ], - deps = [ - "//libc:__support_arg_list", - "//libc:__support_cpp_string_view", - "//libc:printf_converter", - "//libc:printf_core_structs", - "//libc:printf_writer", - ], -) - -libc_test( - name = "sprintf_test", - srcs = ["sprintf_test.cpp"], - libc_function_deps = [ - "//libc:sprintf", - ], - deps = [ - "//libc:__support_fputil_fp_bits", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -libc_test( - name = "snprintf_test", - srcs = ["snprintf_test.cpp"], - libc_function_deps = [ - "//libc:snprintf", - ], -) - -libc_test( - name = "printf_test", - srcs = ["printf_test.cpp"], - libc_function_deps = [ - "//libc:printf", - ], -) - -libc_test( - name = "fprintf_test", - srcs = ["fprintf_test.cpp"], - libc_function_deps = [ - "//libc:fprintf", - ], -) - -libc_test( - name = "vsprintf_test", - srcs = ["vsprintf_test.cpp"], - libc_function_deps = [ - "//libc:vsprintf", - ], -) - -libc_test( - name = "vsnprintf_test", - srcs = ["vsnprintf_test.cpp"], - libc_function_deps = [ - "//libc:vsnprintf", - ], -) - -libc_test( - name = "vprintf_test", - srcs = ["vprintf_test.cpp"], - libc_function_deps = [ - "//libc:vprintf", - ], -) - -libc_test( - name = "vfprintf_test", - srcs = ["vfprintf_test.cpp"], - libc_function_deps = [ - "//libc:vfprintf", - ], -) - -libc_test( - name = "remove_test", - srcs = ["remove_test.cpp"], - libc_function_deps = [ - "//libc:remove", - "//libc:open", - "//libc:mkdirat", - "//libc:access", - "//libc:close", - ], -) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel deleted file mode 100644 index 4575c40bc76c5..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel +++ /dev/null @@ -1,212 +0,0 @@ -# This file is licensed 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 - -# Tests for LLVM libc stdlib.h functions. - -load("//libc:libc_build_rules.bzl", "libc_support_library") -load("//libc/test:libc_test_rules.bzl", "libc_test") - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -libc_test( - name = "abs_test", - srcs = ["abs_test.cpp"], - libc_function_deps = ["//libc:abs"], -) - -libc_test( - name = "labs_test", - srcs = ["labs_test.cpp"], - libc_function_deps = ["//libc:labs"], -) - -libc_test( - name = "llabs_test", - srcs = ["llabs_test.cpp"], - libc_function_deps = ["//libc:llabs"], -) - -libc_support_library( - name = "div_test_helper", - hdrs = ["DivTest.h"], - deps = ["//libc/test/UnitTest:LibcUnitTest"], -) - -libc_test( - name = "div_test", - srcs = ["div_test.cpp"], - libc_function_deps = ["//libc:div"], - deps = [":div_test_helper"], -) - -libc_test( - name = "ldiv_test", - srcs = ["ldiv_test.cpp"], - libc_function_deps = ["//libc:ldiv"], - deps = [":div_test_helper"], -) - -libc_test( - name = "lldiv_test", - srcs = ["lldiv_test.cpp"], - libc_function_deps = ["//libc:lldiv"], - deps = [":div_test_helper"], -) - -libc_support_library( - name = "atoi_test_helper", - hdrs = ["AtoiTest.h"], - deps = [ - "//libc:__support_cpp_limits", - "//libc:__support_cpp_type_traits", - "//libc/test/UnitTest:LibcUnitTest", - ], -) - -libc_test( - name = "atoi_test", - srcs = ["atoi_test.cpp"], - libc_function_deps = ["//libc:atoi"], - deps = [":atoi_test_helper"], -) - -libc_test( - name = "atol_test", - srcs = ["atol_test.cpp"], - libc_function_deps = ["//libc:atol"], - deps = [":atoi_test_helper"], -) - -libc_test( - name = "atoll_test", - srcs = ["atoll_test.cpp"], - libc_function_deps = ["//libc:atoll"], - deps = [":atoi_test_helper"], -) - -libc_test( - name = "atof_test", - srcs = ["atof_test.cpp"], - libc_function_deps = ["//libc:atof"], - deps = ["//libc:__support_fputil_fp_bits"], -) - -libc_test( - name = "bsearch_test", - srcs = ["bsearch_test.cpp"], - libc_function_deps = ["//libc:bsearch"], -) - -libc_support_library( - name = "qsort_test_helper", - hdrs = ["SortingTest.h"], - deps = [ - "//libc:__support_macros_config", - "//libc:qsort_util", - "//libc/test/UnitTest:LibcUnitTest", - ], -) - -libc_test( - name = "qsort_test", - srcs = ["qsort_test.cpp"], - libc_function_deps = ["//libc:qsort"], - deps = [":qsort_test_helper"], -) - -libc_test( - name = "quick_sort_test", - srcs = ["quick_sort_test.cpp"], - deps = [ - ":qsort_test_helper", - "//libc:qsort_util", - ], -) - -libc_test( - name = "heap_sort_test", - srcs = ["heap_sort_test.cpp"], - deps = [ - ":qsort_test_helper", - "//libc:qsort_util", - ], -) - -libc_test( - name = "qsort_r_test", - srcs = ["qsort_r_test.cpp"], - libc_function_deps = ["//libc:qsort_r"], -) - -libc_support_library( - name = "strtol_test_helper", - hdrs = ["StrtolTest.h"], - deps = [ - "//libc:__support_cpp_limits", - "//libc:__support_cpp_type_traits", - "//libc:__support_macros_properties_architectures", - "//libc:errno.__internal__", - "//libc/test/UnitTest:LibcUnitTest", - ], -) - -libc_test( - name = "strtol_test", - srcs = ["strtol_test.cpp"], - libc_function_deps = ["//libc:strtol"], - deps = [":strtol_test_helper"], -) - -libc_test( - name = "strtoll_test", - srcs = ["strtoll_test.cpp"], - libc_function_deps = ["//libc:strtoll"], - deps = [":strtol_test_helper"], -) - -libc_test( - name = "strtoul_test", - srcs = ["strtoul_test.cpp"], - libc_function_deps = ["//libc:strtoul"], - deps = [":strtol_test_helper"], -) - -libc_test( - name = "strtoull_test", - srcs = ["strtoull_test.cpp"], - libc_function_deps = ["//libc:strtoull"], - deps = [":strtol_test_helper"], -) - -libc_test( - name = "strtof_test", - srcs = ["strtof_test.cpp"], - libc_function_deps = ["//libc:strtof"], - deps = [ - "//libc:__support_fputil_fp_bits", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -libc_test( - name = "strtod_test", - srcs = ["strtod_test.cpp"], - libc_function_deps = ["//libc:strtod"], - deps = [ - "//libc:__support_fputil_fp_bits", - "//libc/test/UnitTest:fp_test_helpers", - ], -) - -libc_test( - name = "strtold_test", - srcs = ["strtold_test.cpp"], - libc_function_deps = ["//libc:strtold"], - deps = [ - "//libc:__support_fputil_fp_bits", - "//libc:__support_uint128", - ], -) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel deleted file mode 100644 index b11bf163473be..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel +++ /dev/null @@ -1,231 +0,0 @@ -# This file is licensed 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 - -# Tests for LLVM libc string.h functions. - -load("//libc:libc_build_rules.bzl", "libc_support_library") -load("//libc/test:libc_test_rules.bzl", "libc_test") - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -libc_test( - name = "strlen_test", - srcs = ["strlen_test.cpp"], - libc_function_deps = [ - "//libc:strlen", - ], -) - -libc_test( - name = "strcpy_test", - srcs = ["strcpy_test.cpp"], - libc_function_deps = [ - "//libc:strcpy_sanitized", - ], -) - -libc_test( - name = "strcmp_test", - srcs = ["strcmp_test.cpp"], - libc_function_deps = [ - "//libc:strcmp", - ], -) - -libc_test( - name = "memchr_test", - srcs = ["memchr_test.cpp"], - libc_function_deps = [ - "//libc:memchr", - ], -) - -libc_support_library( - name = "strchr_test_helper", - hdrs = ["StrchrTest.h"], - deps = ["//libc/test/UnitTest:LibcUnitTest"], -) - -libc_test( - name = "strchr_test", - srcs = ["strchr_test.cpp"], - libc_function_deps = [ - "//libc:strchr", - ], - deps = [":strchr_test_helper"], -) - -libc_test( - name = "strstr_test", - srcs = ["strstr_test.cpp"], - libc_function_deps = [ - "//libc:strstr", - ], -) - -libc_test( - name = "strnlen_test", - srcs = ["strnlen_test.cpp"], - libc_function_deps = [ - "//libc:strnlen", - ], -) - -libc_test( - name = "memrchr_test", - srcs = ["memrchr_test.cpp"], - libc_function_deps = [ - "//libc:memrchr", - ], -) - -libc_test( - name = "strrchr_test", - srcs = ["strrchr_test.cpp"], - libc_function_deps = [ - "//libc:strrchr", - ], - deps = [":strchr_test_helper"], -) - -libc_test( - name = "strcspn_test", - srcs = ["strcspn_test.cpp"], - libc_function_deps = [ - "//libc:strcspn", - ], -) - -libc_test( - name = "strspn_test", - srcs = ["strspn_test.cpp"], - libc_function_deps = [ - "//libc:strspn", - ], -) - -libc_test( - name = "strtok_test", - srcs = ["strtok_test.cpp"], - libc_function_deps = [ - "//libc:strtok", - ], -) - -libc_support_library( - name = "memory_check_utils", - hdrs = ["memory_utils/memory_check_utils.h"], - deps = [ - "//libc:__support_cpp_span", - "//libc:__support_libc_assert", - "//libc:__support_macros_config", - "//libc:__support_macros_sanitizer", - "//libc:string_memory_utils", - ], -) - -libc_support_library( - name = "protected_pages", - hdrs = ["memory_utils/protected_pages.h"], - deps = [ - "//libc:__support_macros_attributes", - "//libc:__support_macros_properties_os", - ], -) - -libc_test( - name = "memcpy_test", - srcs = ["memcpy_test.cpp"], - libc_function_deps = [ - "//libc:memcpy", - ], - deps = [ - ":memory_check_utils", - ":protected_pages", - "//libc:__support_macros_properties_os", - ], -) - -libc_test( - name = "mempcpy_test", - srcs = ["mempcpy_test.cpp"], - libc_function_deps = [ - "//libc:mempcpy", - ], -) - -libc_test( - name = "memset_test", - srcs = ["memset_test.cpp"], - libc_function_deps = [ - "//libc:memset", - ], - deps = [ - ":memory_check_utils", - ":protected_pages", - "//libc:__support_macros_properties_os", - ], -) - -libc_test( - name = "memmove_test", - srcs = ["memmove_test.cpp"], - libc_function_deps = [ - "//libc:memcmp", - "//libc:memmove", - ], - deps = [ - ":memory_check_utils", - "//libc:__support_cpp_span", - "//libc/test/UnitTest:memory_matcher", - ], -) - -libc_test( - name = "bcopy_test", - srcs = ["bcopy_test.cpp"], - libc_function_deps = [ - "//libc:bcopy", - ], - deps = [ - ":memory_check_utils", - "//libc:__support_cpp_span", - "//libc/test/UnitTest:memory_matcher", - ], -) - -libc_test( - name = "memcmp_test", - srcs = ["memcmp_test.cpp"], - libc_function_deps = [ - "//libc:memcmp", - ], - deps = [ - ":memory_check_utils", - "//libc/test/UnitTest:test_logger", - ], -) - -libc_test( - name = "bcmp_test", - srcs = ["bcmp_test.cpp"], - libc_function_deps = [ - "//libc:bcmp", - ], - deps = [ - ":memory_check_utils", - "//libc/test/UnitTest:test_logger", - ], -) - -libc_test( - name = "bzero_test", - srcs = ["bzero_test.cpp"], - libc_function_deps = [ - "//libc:bzero", - ], - deps = [":memory_check_utils"], -) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/sys/epoll/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/sys/epoll/BUILD.bazel deleted file mode 100644 index b090bde35b88d..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/src/sys/epoll/BUILD.bazel +++ /dev/null @@ -1,98 +0,0 @@ -# This file is licensed 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 - -# Tests for LLVM libc string.h functions. - -load("//libc/test:libc_test_rules.bzl", "libc_test") - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -libc_test( - name = "epoll_create_test", - srcs = ["linux/epoll_create_test.cpp"], - libc_function_deps = [ - "//libc:epoll_create", - "//libc:close", - ], -) - -libc_test( - name = "epoll_create1_test", - srcs = ["linux/epoll_create1_test.cpp"], - libc_function_deps = [ - "//libc:epoll_create1", - "//libc:close", - ], - deps = [ - "//libc:hdr_sys_epoll_macros", - ], -) - -libc_test( - name = "epoll_ctl_test", - srcs = ["linux/epoll_ctl_test.cpp"], - libc_function_deps = [ - "//libc:epoll_create1", - "//libc:epoll_ctl", - "//libc:pipe", - "//libc:close", - ], - deps = [ - "//libc:hdr_sys_epoll_macros", - "//libc:types_struct_epoll_event", - ], -) - -libc_test( - name = "epoll_wait_test", - srcs = ["linux/epoll_wait_test.cpp"], - libc_function_deps = [ - "//libc:epoll_wait", - "//libc:epoll_create1", - "//libc:epoll_ctl", - "//libc:pipe", - "//libc:close", - ], - deps = [ - "//libc:hdr_sys_epoll_macros", - "//libc:types_struct_epoll_event", - ], -) - -libc_test( - name = "epoll_pwait_test", - srcs = ["linux/epoll_pwait_test.cpp"], - libc_function_deps = [ - "//libc:epoll_pwait", - "//libc:epoll_create1", - "//libc:epoll_ctl", - "//libc:pipe", - "//libc:close", - ], - deps = [ - "//libc:hdr_sys_epoll_macros", - "//libc:types_struct_epoll_event", - ], -) - -#TODO: Enable once epoll_pwait2 availablilty can be checked first. -# https://github.com/llvm/llvm-project/issues/80060 -# libc_test( -# name = "epoll_pwait2_test", -# srcs = ["linux/epoll_pwait2_test.cpp"], -# libc_function_deps = [ -# "//libc:epoll_pwait2", -# "//libc:epoll_create1", -# "//libc:epoll_ctl", -# "//libc:pipe", -# "//libc:close", -# ], -# deps = [ -# "//libc:hdr_sys_epoll_macros", -# "//libc:types_struct_epoll_event", -# "//libc:types_struct_timespec", -# ], -# ) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel deleted file mode 100644 index 4549fa2a193fc..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/test/src/unistd/BUILD.bazel +++ /dev/null @@ -1,340 +0,0 @@ -# This file is licensed 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 - -# Tests for LLVM libc unistd.h functions. - -load("//libc/test:libc_test_rules.bzl", "libc_test") - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -libc_test( - name = "access_test", - srcs = ["access_test.cpp"], - libc_function_deps = [ - "//libc:open", - "//libc:access", - "//libc:close", - "//libc:unlink", - ], -) - -# libc_test( -# name = "chdir_test", -# srcs = ["chdir_test.cpp"], -# libc_function_deps = [ -# "//libc:open", -# "//libc:chdir", -# "//libc:close", -# ], -# ) - -libc_test( - name = "dup_test", - srcs = ["dup_test.cpp"], - libc_function_deps = [ - "//libc:open", - "//libc:close", - "//libc:dup", - "//libc:read", - "//libc:unlink", - "//libc:write", - ], -) - -libc_test( - name = "dup2_test", - srcs = ["dup2_test.cpp"], - libc_function_deps = [ - "//libc:open", - "//libc:close", - "//libc:dup2", - "//libc:read", - "//libc:unlink", - "//libc:write", - ], -) - -libc_test( - name = "dup3_test", - srcs = ["dup3_test.cpp"], - libc_function_deps = [ - "//libc:open", - "//libc:close", - "//libc:dup3", - "//libc:read", - "//libc:unlink", - "//libc:write", - ], -) - -# libc_test( -# name = "fchdir_test", -# srcs = ["fchdir_test.cpp"], -# libc_function_deps = [ -# "//libc:open", -# "//libc:fchdir", -# "//libc:close", -# ], -# ) - -libc_test( - name = "ftruncate_test", - srcs = ["ftruncate_test.cpp"], - libc_function_deps = [ - "//libc:open", - "//libc:close", - "//libc:read", - "//libc:ftruncate", - "//libc:unlink", - "//libc:write", - ], - deps = [ - "//libc:__support_cpp_string_view", - ], -) - -libc_test( - name = "pread_pwrite_test", - srcs = ["pread_pwrite_test.cpp"], - libc_function_deps = [ - "//libc:open", - "//libc:close", - "//libc:fsync", - "//libc:pread", - "//libc:pwrite", - "//libc:unlink", - "//libc:write", - ], -) - -libc_test( - name = "read_write_test", - srcs = ["read_write_test.cpp"], - libc_function_deps = [ - "//libc:open", - "//libc:close", - "//libc:fsync", - "//libc:read", - "//libc:write", - "//libc:remove", - ], -) - -libc_test( - name = "link_test", - srcs = ["link_test.cpp"], - libc_function_deps = [ - "//libc:open", - "//libc:close", - "//libc:link", - "//libc:unlink", - ], -) - -# libc_test( -# name = "linkat_test", -# srcs = ["linkat_test.cpp"], -# libc_function_deps = [ -# "//libc:open", -# "//libc:close", -# "//libc:linkat", -# "//libc:unlink", -# ], -# ) - -# libc_test( -# name = "lseek_test", -# srcs = ["lseek_test.cpp"], -# libc_function_deps = [ -# "//libc:open", -# "//libc:close", -# "//libc:lseek", -# "//libc:read", -# ], -# ) - -# libc_test( -# name = "rmdir_test", -# srcs = ["rmdir_test.cpp"], -# libc_function_deps = [ -# "//libc:mkdir", -# "//libc:rmdir", -# ], -# ) - -libc_test( - name = "swab_test", - srcs = ["swab_test.cpp"], - libc_function_deps = [ - "//libc:swab", - ], - deps = [ - "//libc:string_utils", - ], -) - -# libc_test( -# name = "readlink_test", -# srcs = ["readlink_test.cpp"], -# libc_function_deps = [ -# "//libc:readlink", -# "//libc:symlink", -# "//libc:unlink", -# ], -# deps = [ -# "//libc:__support_cpp_string_view", -# ], -# ) - -# libc_test( -# name = "readlinkat_test", -# srcs = ["readlinkat_test.cpp"], -# libc_function_deps = [ -# "//libc:readlinkat", -# "//libc:symlink", -# "//libc:unlink", -# ], -# deps = [ -# "//libc:__support_cpp_string_view", -# ], -# ) - -libc_test( - name = "symlink_test", - srcs = ["symlink_test.cpp"], - libc_function_deps = [ - "//libc:open", - "//libc:close", - "//libc:symlink", - "//libc:unlink", - ], -) - -# libc_test( -# name = "symlinkat_test", -# srcs = ["symlinkat_test.cpp"], -# libc_function_deps = [ -# "//libc:open", -# "//libc:close", -# "//libc:symlinkat", -# "//libc:unlink", -# ], -# ) - -libc_test( - name = "truncate_test", - srcs = ["truncate_test.cpp"], - libc_function_deps = [ - "//libc:open", - "//libc:close", - "//libc:read", - "//libc:truncate", - "//libc:unlink", - "//libc:write", - ], - deps = [ - "//libc:__support_cpp_string_view", - ], -) - -libc_test( - name = "unlink_test", - srcs = ["unlink_test.cpp"], - libc_function_deps = [ - "//libc:open", - "//libc:close", - "//libc:unlink", - ], -) - -# libc_test( -# name = "unlinkat_test", -# srcs = ["unlinkat_test.cpp"], -# libc_function_deps = [ -# "//libc:open", -# "//libc:openat", -# "//libc:close", -# "//libc:unlinkat", -# ], -# ) - -libc_test( - name = "getpid_test", - srcs = ["getpid_test.cpp"], - libc_function_deps = [ - "//libc:getpid", - ], -) - -libc_test( - name = "getppid_test", - srcs = ["getppid_test.cpp"], - libc_function_deps = [ - "//libc:getppid", - ], -) - -libc_test( - name = "getuid_test", - srcs = ["getuid_test.cpp"], - libc_function_deps = [ - "//libc:getuid", - ], -) - -libc_test( - name = "isatty_test", - srcs = ["isatty_test.cpp"], - libc_function_deps = [ - "//libc:isatty", - "//libc:open", - "//libc:close", - ], -) - -libc_test( - name = "geteuid_test", - srcs = ["geteuid_test.cpp"], - libc_function_deps = [ - "//libc:geteuid", - ], -) - -#TODO: Enable once fullbuild is added to bazel, since this depends on a macro -# definition in the public header - -# libc_test( -# name = "syscall_test", -# srcs = ["syscall_test.cpp"], -# libc_function_deps = [ -# "//libc:syscall", -# ], -# ) - -# TODO: add once sysconf is complete - -# libc_test( -# name = "sysconf_test", -# srcs = ["sysconf_test.cpp"], -# libc_function_deps = [ -# "//libc:sysconf", -# ], -# ) - -# TODO: add fopencookie and fflush - -# libc_test( -# name = "getopt_test", -# srcs = ["getopt_test.cpp"], -# libc_function_deps = [ -# "//libc:getopt", -# "//libc:fopencookie", -# "//libc:fflush", -# ], -# deps = [ -# "//libc:__support_cpp_array", -# ], -# ) diff --git a/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel deleted file mode 100644 index adf4b235b1b5e..0000000000000 --- a/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel +++ /dev/null @@ -1,59 +0,0 @@ -# This file is licensed under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -# A wrapper library over MPFR for use with LLVM libc math unittests. - -load("//libc:libc_build_rules.bzl", "libc_support_library") - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -cc_library( - name = "mpfr_impl", - hdrs = ["mpfr_inc.h"], - target_compatible_with = select({ - "//conditions:default": [], - "//libc:mpfr_disable": ["@platforms//:incompatible"], - }), - deps = select( - { - "//conditions:default": [], - "//libc:mpfr_external": ["@mpfr//:mpfr_external"], - "//libc:mpfr_system": ["@mpfr//:mpfr_system"], - }, - ), -) - -libc_support_library( - name = "mpfr_wrapper", - srcs = ["MPFRUtils.cpp"], - hdrs = ["MPFRUtils.h"], - # Disable layering check when using mpfr_system. - features = select( - { - "//conditions:default": [], - "//libc:mpfr_system": ["-layering_check"], - }, - ), - deps = [ - "//libc:__support_common", - "//libc:__support_cpp_array", - "//libc:__support_cpp_bit", - "//libc:__support_cpp_bitset", - "//libc:__support_cpp_string", - "//libc:__support_cpp_string_view", - "//libc:__support_cpp_stringstream", - "//libc:__support_cpp_type_traits", - "//libc:__support_fputil_fp_bits", - "//libc:__support_fputil_fpbits_str", - "//libc:__support_macros_config", - "//libc:__support_macros_properties_types", - "//libc:hdr_math_macros", - "//libc/test/UnitTest:LibcUnitTest", - "//libc/test/UnitTest:fp_test_helpers", - "//libc/utils/MPFRWrapper:mpfr_impl", - "@gmp//:gmp_", - ], -) diff --git a/utils/bazel/llvm-project-overlay/libunwind/BUILD.bazel b/utils/bazel/llvm-project-overlay/libunwind/BUILD.bazel deleted file mode 100644 index f8448fb0e7268..0000000000000 --- a/utils/bazel/llvm-project-overlay/libunwind/BUILD.bazel +++ /dev/null @@ -1,21 +0,0 @@ -# This file is licensed 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 - -package( - default_visibility = ["//visibility:public"], -) - -licenses(["notice"]) - -# The ld64 linker and lld-macho use the libunwind headers only for the constant -# definitions, in order to parse and convert DWARF to the compact encoding. -cc_library( - name = "unwind_headers_only", - hdrs = [ - "include/__libunwind_config.h", - "include/libunwind.h", - "include/mach-o/compact_unwind_encoding.h", - ], - strip_include_prefix = "include", -) diff --git a/utils/bazel/llvm-project-overlay/lld/BUILD.bazel b/utils/bazel/llvm-project-overlay/lld/BUILD.bazel deleted file mode 100644 index 2ccd6fcae635d..0000000000000 --- a/utils/bazel/llvm-project-overlay/lld/BUILD.bazel +++ /dev/null @@ -1,322 +0,0 @@ -# This file is licensed 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 - -load( - "//:vars.bzl", - "LLVM_VERSION", -) -load("//llvm:binary_alias.bzl", "binary_alias") -load("//llvm:driver.bzl", "llvm_driver_cc_binary") -load("//llvm:tblgen.bzl", "gentbl") - -package( - default_visibility = ["//visibility:public"], - features = ["layering_check"], -) - -licenses(["notice"]) - -# TODO: Actually compute version info -genrule( - name = "config_version_gen", - outs = ["include/lld/Common/Version.inc"], - cmd = "echo '#define LLD_VERSION_STRING \"{}\"' > $@".format(LLVM_VERSION), -) - -genrule( - name = "vcs_version_gen", - outs = ["Common/VCSVersion.inc"], - cmd = "echo '#undef LLD_REVISION' >> $@\n" + - "echo '#undef LLD_REPOSITORY' >> $@\n", -) - -# See https://github.com/bazelbuild/bazel/issues/13803 -cc_library( - name = "vcs_version", - hdrs = ["Common/VCSVersion.inc"], - strip_include_prefix = "Common", -) - -cc_library( - name = "Common", - srcs = [":config_version_gen"] + glob(["Common/*.cpp"]), - hdrs = glob(["include/lld/Common/*.h"]), - includes = ["include"], - deps = [ - ":vcs_version", - "//llvm:CodeGen", - "//llvm:Core", - "//llvm:DebugInfoDWARF", - "//llvm:IRPrinter", - "//llvm:Option", - "//llvm:Support", - "//llvm:Target", - "//llvm:TargetParser", - "//llvm:config", - ], -) - -gentbl( - name = "elf_options_inc_gen", - # See https://github.com/bazelbuild/bazel/issues/13803 - strip_include_prefix = "ELF", - tbl_outs = [( - "-gen-opt-parser-defs", - "ELF/Options.inc", - )], - tblgen = "//llvm:llvm-tblgen", - td_file = "ELF/Options.td", - td_srcs = [ - "//llvm:include/llvm/Option/OptParser.td", - ], -) - -cc_library( - name = "ELF", - srcs = glob([ - "ELF/*.cpp", - "ELF/*.h", - "ELF/Arch/*.cpp", - ]), - includes = ["ELF"], - textual_hdrs = [ - "ELF/Arch/PPCInsns.def", - ], - deps = [ - ":Common", - ":elf_options_inc_gen", - "//llvm:AllTargetsAsmParsers", - "//llvm:AllTargetsCodeGens", - "//llvm:AllTargetsDisassemblers", - "//llvm:Analysis", - "//llvm:BinaryFormat", - "//llvm:BitReader", - "//llvm:BitWriter", - "//llvm:CodeGen", - "//llvm:Core", - "//llvm:DebugInfoDWARF", - "//llvm:Demangle", - "//llvm:IPO", - "//llvm:LTO", - "//llvm:Linker", - "//llvm:MC", - "//llvm:Object", - "//llvm:Option", - "//llvm:Passes", - "//llvm:Remarks", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TransformUtils", - "//llvm:config", - "@llvm_zlib//:zlib", - "@llvm_zstd//:zstd", - ], -) - -gentbl( - name = "coff_options_inc_gen", - # See https://github.com/bazelbuild/bazel/issues/13803 - strip_include_prefix = "COFF", - tbl_outs = [( - "-gen-opt-parser-defs", - "COFF/Options.inc", - )], - tblgen = "//llvm:llvm-tblgen", - td_file = "COFF/Options.td", - td_srcs = [ - "//llvm:include/llvm/Option/OptParser.td", - ], -) - -cc_library( - name = "COFF", - srcs = glob([ - "COFF/*.cpp", - "COFF/*.h", - ]), - includes = ["COFF"], - deps = [ - ":Common", - ":coff_options_inc_gen", - "//llvm:AllTargetsAsmParsers", - "//llvm:AllTargetsCodeGens", - "//llvm:AllTargetsDisassemblers", - "//llvm:Analysis", - "//llvm:BinaryFormat", - "//llvm:BitReader", - "//llvm:BitWriter", - "//llvm:Core", - "//llvm:DebugInfo", - "//llvm:DebugInfoCodeView", - "//llvm:DebugInfoMSF", - "//llvm:DebugInfoPDB", - "//llvm:Demangle", - "//llvm:IPO", - "//llvm:LTO", - "//llvm:LibDriver", - "//llvm:Linker", - "//llvm:MC", - "//llvm:Object", - "//llvm:Option", - "//llvm:Support", - "//llvm:Symbolize", - "//llvm:Target", - "//llvm:TargetParser", - "//llvm:TransformUtils", - "//llvm:WindowsDriver", - "//llvm:WindowsManifest", - "//llvm:config", - ], -) - -gentbl( - name = "mingw_options_inc_gen", - tbl_outs = [( - "-gen-opt-parser-defs", - "MinGW/Options.inc", - )], - tblgen = "//llvm:llvm-tblgen", - td_file = "MinGW/Options.td", - td_srcs = [ - "//llvm:include/llvm/Option/OptParser.td", - ], -) - -cc_library( - name = "MinGW", - srcs = glob([ - "MinGW/*.cpp", - ]), - includes = ["MinGW"], - deps = [ - ":Common", - ":mingw_options_inc_gen", - "//llvm:Option", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -gentbl( - name = "macho_options_inc_gen", - # See https://github.com/bazelbuild/bazel/issues/13803 - strip_include_prefix = "MachO", - tbl_outs = [( - "-gen-opt-parser-defs", - "MachO/Options.inc", - )], - tblgen = "//llvm:llvm-tblgen", - td_file = "MachO/Options.td", - td_srcs = [ - "//llvm:include/llvm/Option/OptParser.td", - ], -) - -cc_library( - name = "MachO", - srcs = glob([ - "MachO/**/*.cpp", - "MachO/**/*.h", - ]), - includes = ["MachO"], - deps = [ - ":Common", - ":macho_options_inc_gen", - "//libunwind:unwind_headers_only", - "//llvm:BinaryFormat", - "//llvm:BitReader", - "//llvm:BitWriter", - "//llvm:Core", - "//llvm:DebugInfoDWARF", - "//llvm:Demangle", - "//llvm:LTO", - "//llvm:MC", - "//llvm:ObjCARC", - "//llvm:Object", - "//llvm:Option", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TextAPI", - "//llvm:config", - ], -) - -gentbl( - name = "wasm_options_inc_gen", - # See https://github.com/bazelbuild/bazel/issues/13803 - strip_include_prefix = "wasm", - tbl_outs = [( - "-gen-opt-parser-defs", - "wasm/Options.inc", - )], - tblgen = "//llvm:llvm-tblgen", - td_file = "wasm/Options.td", - td_srcs = [ - "//llvm:include/llvm/Option/OptParser.td", - ], -) - -cc_library( - name = "Wasm", - srcs = glob([ - "wasm/*.cpp", - "wasm/*.h", - ]), - includes = ["wasm"], - deps = [ - ":Common", - ":wasm_options_inc_gen", - "//llvm:AllTargetsAsmParsers", - "//llvm:AllTargetsCodeGens", - "//llvm:BinaryFormat", - "//llvm:Core", - "//llvm:Demangle", - "//llvm:LTO", - "//llvm:MC", - "//llvm:Object", - "//llvm:Option", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:config", - ], -) - -cc_library( - name = "lld-lib", - srcs = glob(["tools/lld/*.cpp"]), - deps = [ - ":COFF", - ":Common", - ":ELF", - ":MachO", - ":MinGW", - ":Wasm", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -llvm_driver_cc_binary( - name = "lld", - deps = [":lld-lib"], -) - -# These are the required names for lld running under different environs. -# -# Unix/Linux require that the binary be named "ld.lld". -# macOS require that the binary be named "ld64.lld". -# Windows require that the binary be named "lld-link". -# WebAssembly builds require that the binary be named "wasm-ld". -[ - binary_alias( - name = name, - binary = ":lld", - ) - for name in [ - "ld.lld", - "ld64.lld", - "lld-link", - "wasm-ld", - ] -] diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel deleted file mode 100644 index 64d36c7b7f664..0000000000000 --- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel +++ /dev/null @@ -1,5353 +0,0 @@ -# This file is licensed 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 - -load("@bazel_skylib//rules:common_settings.bzl", "string_flag") -load("@bazel_skylib//rules:expand_template.bzl", "expand_template") -load("//mlir:tblgen.bzl", "td_library") -load(":binary_alias.bzl", "binary_alias") -load(":config.bzl", "llvm_config_defines") -load(":driver.bzl", "generate_driver_selects", "generate_driver_tools_def", "llvm_driver_cc_binary", "select_driver_tools") -load(":enum_targets_gen.bzl", "enum_targets_gen") -load(":targets.bzl", "llvm_targets") -load(":tblgen.bzl", "gentbl") - -package( - default_visibility = ["//visibility:public"], - features = ["layering_check"], -) - -licenses(["notice"]) - -exports_files([ - "LICENSE.TXT", - "cmake/modules/llvm-driver-template.cpp.in", - "include/llvm/BinaryFormat/Dwarf.def", - "include/llvm/CodeGen/SDNodeProperties.td", - "include/llvm/CodeGen/ValueTypes.td", - "include/llvm/Frontend/Directive/DirectiveBase.td", - "include/llvm/Frontend/OpenACC/ACC.td", - "include/llvm/Frontend/OpenMP/OMP.td", - "include/llvm/IR/Intrinsics.td", - "include/llvm/Option/OptParser.td", - "utils/lit/lit.py", - "utils/lldbDataFormatters.py", -]) - -# It may be tempting to add compiler flags here, but that should be avoided. -# The necessary warnings and other compile flags should be provided by the -# toolchain or the `.bazelrc` file. This is just a workaround until we have a -# widely available feature to enable unlimited stack frame instead of using -# this `Make` variable. -llvm_copts = [ - "$(STACK_FRAME_UNLIMITED)", -] - -enum_targets_gen( - name = "targets_def_gen", - src = "include/llvm/Config/Targets.def.in", - out = "include/llvm/Config/Targets.def", - macro_name = "TARGET", - targets = llvm_targets, -) - -# Enabled targets with ASM printers. -llvm_target_asm_printers = [ - t - for t in llvm_targets - if glob(["lib/Target/{}/*AsmPrinter.cpp".format(t)]) -] - -enum_targets_gen( - name = "asm_printers_def_gen", - src = "include/llvm/Config/AsmPrinters.def.in", - out = "include/llvm/Config/AsmPrinters.def", - macro_name = "ASM_PRINTER", - targets = llvm_target_asm_printers, -) - -# Enabled targets with ASM parsers. -llvm_target_asm_parsers = [ - t - for t in llvm_targets - if glob( - ["lib/Target/{}/AsmParser/CMakeLists.txt".format(t)], - allow_empty = True, - ) -] - -enum_targets_gen( - name = "asm_parsers_def_gen", - src = "include/llvm/Config/AsmParsers.def.in", - out = "include/llvm/Config/AsmParsers.def", - macro_name = "ASM_PARSER", - targets = llvm_target_asm_parsers, -) - -# Enabled targets with disassemblers. -llvm_target_disassemblers = [ - t - for t in llvm_targets - if glob( - ["lib/Target/{}/Disassembler/CMakeLists.txt".format(t)], - allow_empty = True, - ) -] - -enum_targets_gen( - name = "disassemblers_def_gen", - src = "include/llvm/Config/Disassemblers.def.in", - out = "include/llvm/Config/Disassemblers.def", - macro_name = "DISASSEMBLER", - targets = llvm_target_disassemblers, -) - -# Enabled targets with MCA. -llvm_target_mcas = [ - t - for t in llvm_targets - if glob( - ["lib/Target/{}/MCA/CMakeLists.txt".format(t)], - allow_empty = True, - ) -] - -enum_targets_gen( - name = "target_mca_def_gen", - src = "include/llvm/Config/TargetMCAs.def.in", - out = "include/llvm/Config/TargetMCAs.def", - macro_name = "TARGETMCA", - targets = llvm_target_mcas, -) - -# Enabled targets with exegesis. -llvm_target_exegesis = [ - t - for t in llvm_targets - if glob( - ["tools/llvm-exegesis/lib/{}/CMakeLists.txt".format(t)], - allow_empty = True, - ) -] - -enum_targets_gen( - name = "target_exegesis_def_gen", - src = "include/llvm/Config/TargetExegesis.def.in", - out = "include/llvm/Config/TargetExegesis.def", - macro_name = "EXEGESIS", - placeholder_name = "@LLVM_ENUM_EXEGESIS@", - targets = llvm_target_exegesis, -) - -expand_template( - name = "abi_breaking_h_gen", - out = "include/llvm/Config/abi-breaking.h", - substitutions = { - # Define to enable checks that alter the LLVM C++ ABI - "#cmakedefine01 LLVM_ENABLE_ABI_BREAKING_CHECKS": "#define LLVM_ENABLE_ABI_BREAKING_CHECKS 0", - - # Define to enable reverse iteration of unordered llvm containers - "#cmakedefine01 LLVM_ENABLE_REVERSE_ITERATION": "#define LLVM_ENABLE_REVERSE_ITERATION 0", - }, - template = "include/llvm/Config/abi-breaking.h.cmake", -) - -# To enable diff testing out of tree -exports_files([ - "include/llvm/Config/config.h.cmake", - "include/llvm/Config/llvm-config.h.cmake", - "include/llvm/Config/abi-breaking.h.cmake", -]) - -td_library( - name = "OptParserTdFiles", - srcs = ["include/llvm/Option/OptParser.td"], - includes = ["include"], -) - -llvm_config_target_defines = [ - "LLVM_HAS_{}_TARGET=1".format(t) - for t in llvm_targets -] - -cc_library( - name = "config", - hdrs = [ - "include/llvm/Config/abi-breaking.h", - "include/llvm/Config/llvm-config.h", - ], - copts = llvm_copts, - defines = llvm_config_defines + llvm_config_target_defines, - includes = ["include"], - textual_hdrs = [ - "include/llvm/Config/AsmParsers.def", - "include/llvm/Config/AsmPrinters.def", - "include/llvm/Config/Disassemblers.def", - "include/llvm/Config/Targets.def", - "include/llvm/Config/TargetExegesis.def", - "include/llvm/Config/TargetMCAs.def", - # Needed for include scanner to find execinfo.h - "include/llvm/Config/config.h", - ], -) - -cc_library( - name = "Demangle", - srcs = glob([ - "lib/Demangle/*.cpp", - ]), - hdrs = glob([ - "include/llvm/Demangle/*.h", - "include/llvm/Demangle/*.def", - ]), - copts = llvm_copts, - deps = [":config"], -) - -genrule( - name = "generate_vcs_revision", - outs = ["include/llvm/Support/VCSRevision.h"], - cmd = "echo '#undef LLVM_REVISION' >> $@\n" + - "echo '#undef LLVM_REPOSITORY' >> $@\n", -) - -genrule( - name = "generate_static_extension_registry", - outs = ["include/llvm/Support/Extension.def"], - cmd = "echo -e '// extension handlers' >> $@\n" + - "echo -e '#undef HANDLE_EXTENSION' >> $@\n", -) - -cc_library( - name = "Support", - srcs = glob([ - "lib/Support/*.c", - "lib/Support/*.cpp", - "lib/Support/*.h", - "lib/Support/*.inc", - # To avoid a dependency cycle. - "include/llvm/Option/*.h", - ]) + select({ - "@platforms//os:windows": glob([ - "lib/Support/Windows/*.inc", - ]), - "//conditions:default": glob([ - "lib/Support/Unix/*.h", - "lib/Support/Unix/*.inc", - ]), - }) + [ - "lib/Support/BLAKE3/blake3.c", - "lib/Support/BLAKE3/blake3_dispatch.c", - "lib/Support/BLAKE3/blake3_impl.h", - "lib/Support/BLAKE3/blake3_portable.c", - "lib/Support/BLAKE3/llvm_blake3_prefix.h", - ] + select({ - "@platforms//cpu:aarch64": [ - "lib/Support/BLAKE3/blake3_neon.c", - ], - "@platforms//cpu:x86_64": [ - "lib/Support/BLAKE3/blake3_avx2_x86-64_unix.S", - "lib/Support/BLAKE3/blake3_avx512_x86-64_unix.S", - "lib/Support/BLAKE3/blake3_sse2_x86-64_unix.S", - "lib/Support/BLAKE3/blake3_sse41_x86-64_unix.S", - ], - "//conditions:default": [ - ], - }), - hdrs = glob([ - "include/llvm/Support/**/*.h", - "include/llvm/ADT/*.h", - ]) + [ - "include/llvm-c/Core.h", - "include/llvm-c/DataTypes.h", - "include/llvm-c/Deprecated.h", - "include/llvm-c/DisassemblerTypes.h", - "include/llvm-c/Error.h", - "include/llvm-c/ErrorHandling.h", - "include/llvm-c/ExternC.h", - "include/llvm-c/Support.h", - "include/llvm-c/Types.h", - "include/llvm-c/blake3.h", - "include/llvm/ExecutionEngine/JITSymbol.h", - "include/llvm/Support/Extension.def", - "include/llvm/Support/VCSRevision.h", - ], - copts = llvm_copts, - defines = select({ - "@platforms//cpu:aarch64": [ - ], - "//conditions:default": [ - "BLAKE3_USE_NEON=0", - ], - }) + select({ - "@platforms//cpu:x86_64": [ - ], - "//conditions:default": [ - "BLAKE3_NO_AVX2", - "BLAKE3_NO_AVX512", - "BLAKE3_NO_SSE2", - "BLAKE3_NO_SSE41", - ], - }), - includes = ["include"], - linkopts = select({ - "@platforms//os:windows": [ - "ws2_32.lib", - "ntdll.lib", - ], - "@platforms//os:freebsd": [ - "-pthread", - "-lexecinfo", - "-ldl", - "-lm", - ], - "@platforms//os:macos": [ - "-pthread", - "-ldl", - ], - "//conditions:default": [ - "-pthread", - "-ldl", - "-lm", - ], - }), - textual_hdrs = glob([ - "include/llvm/Support/*.def", - ]), - deps = [ - ":config", - ":Demangle", - # We unconditionally depend on the custom LLVM zlib wrapper. This will - # be an empty library unless zlib is enabled, in which case it will - # both provide the necessary dependencies and configuration defines. - "@llvm_zlib//:zlib", - # We unconditionally depend on the custom LLVM zstd wrapper. This will - # be an empty library unless zstd is enabled, in which case it will - # both provide the necessary dependencies and configuration defines. - "@llvm_zstd//:zstd", - ], -) - -# Note: although FileCheck (the binary) is a test utility, some non-test -# targets depend on the FileCheck library target. -cc_library( - name = "FileCheckLib", - srcs = glob([ - "lib/FileCheck/*.cpp", - "lib/FileCheck/*.h", - ]), - hdrs = glob(["include/llvm/FileCheck/*.h"]), - copts = llvm_copts, - deps = [":Support"], -) - -cc_library( - name = "LineEditor", - srcs = glob([ - "lib/LineEditor/*.cpp", - ]), - hdrs = glob(["include/llvm/LineEditor/*.h"]), - copts = llvm_copts, - deps = [ - ":Support", - ":config", - ], -) - -cc_library( - name = "Option", - srcs = glob([ - "lib/Option/*.cpp", - ]), - hdrs = glob(["include/llvm/Option/*.h"]), - copts = llvm_copts, - deps = [ - ":Support", - ":config", - ], -) - -cc_library( - name = "TableGen", - srcs = glob([ - "lib/TableGen/*.cpp", - "lib/TableGen/*.h", - ]), - hdrs = glob(["include/llvm/TableGen/*.h"]), - copts = llvm_copts, - deps = [ - ":Support", - ":config", - ], -) - -# This exists to avoid circular dependencies. -cc_library( - name = "ir_headers", - hdrs = glob( - [ - "include/llvm/*.h", - "include/llvm/IR/*.h", - ], - exclude = [ - "include/llvm/LinkAllPasses.h", - ], - ) + [ - "include/llvm-c/Comdat.h", - "include/llvm-c/DebugInfo.h", - "include/llvm/IR/Value.def", - ], - copts = llvm_copts, -) - -cc_library( - name = "BinaryFormat", - srcs = glob([ - "lib/BinaryFormat/*.cpp", - ]), - hdrs = glob([ - "include/llvm/BinaryFormat/*.h", - ]), - copts = llvm_copts, - includes = ["include"], - textual_hdrs = glob([ - "include/llvm/BinaryFormat/*.def", - "include/llvm/BinaryFormat/ELFRelocs/*.def", - ]), - deps = [ - ":Support", - ":TargetParser", - ], -) - -cc_library( - name = "DebugInfo", - hdrs = glob(["include/llvm/DebugInfo/**/*.h"]), - copts = llvm_copts, - textual_hdrs = glob(["include/llvm/DebugInfo/**/*.def"]), - deps = [ - ":Object", - ":Support", - ], -) - -cc_library( - name = "DebugInfoMSF", - srcs = glob([ - "lib/DebugInfo/MSF/*.cpp", - ]), - hdrs = glob(["include/llvm/DebugInfo/MSF/*.h"]), - copts = llvm_copts, - deps = [":Support"], -) - -cc_library( - name = "DebugInfoBTF", - srcs = glob([ - "lib/DebugInfo/BTF/*.cpp", - ]), - hdrs = glob(["include/llvm/DebugInfo/BTF/*.h"]) + [ - "include/llvm/DebugInfo/BTF/BTF.def", - ], - copts = llvm_copts, - deps = [ - ":DebugInfo", - ":Object", - ":Support", - ], -) - -cc_library( - name = "DebugInfoCodeView", - srcs = glob([ - "lib/DebugInfo/CodeView/*.cpp", - ]), - hdrs = glob([ - "include/llvm/DebugInfo/CodeView/*.h", - ]), - copts = llvm_copts, - textual_hdrs = glob([ - "include/llvm/DebugInfo/CodeView/*.def", - ]), - deps = [ - ":BinaryFormat", - ":DebugInfoMSF", - ":Support", - ], -) - -cc_library( - name = "DebugInfoLogicalView", - srcs = glob([ - "lib/DebugInfo/LogicalView/**/*.cpp", - ]), - hdrs = glob([ - "include/llvm/DebugInfo/LogicalView/**/*.h", - ]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":DebugInfo", - ":DebugInfoCodeView", - ":DebugInfoDWARF", - ":DebugInfoPDB", - ":Demangle", - ":MC", - ":MCDisassembler", - ":Object", - ":Support", - ], -) - -cc_library( - name = "DebugInfoPDB", - srcs = glob([ - "lib/DebugInfo/PDB/*.cpp", - "lib/DebugInfo/PDB/Native/*.cpp", - ]), - hdrs = glob([ - "include/llvm/DebugInfo/PDB/*.h", - "include/llvm/DebugInfo/PDB/Native/*.h", - ]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":DebugInfo", - ":DebugInfoBTF", - ":DebugInfoCodeView", - ":DebugInfoMSF", - ":Object", - ":Support", - ":config", - ], -) - -cc_library( - name = "Debuginfod", - srcs = glob([ - "lib/Debuginfod/*.cpp", - ]), - hdrs = glob([ - "include/llvm/Debuginfod/*.h", - ]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":DebugInfoDWARF", - ":Object", - ":Support", - ":Symbolize", - ], -) - -cc_library( - name = "MC", - srcs = glob([ - "lib/MC/*.cpp", - ]), - hdrs = glob([ - "include/llvm/MC/*.h", - ]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":DebugInfoCodeView", - ":Support", - ":TargetParser", - ":config", - ":ir_headers", - ], -) - -cc_library( - name = "DebugInfoDWARF", - srcs = glob([ - "lib/DebugInfo/DWARF/*.cpp", - ]), - hdrs = glob(["include/llvm/DebugInfo/DWARF/*.h"]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":DebugInfo", - ":MC", - ":Object", - ":Support", - ":TargetParser", - ], -) - -cc_library( - name = "DebugInfoGSYM", - srcs = glob([ - "lib/DebugInfo/GSYM/*.cpp", - ]), - hdrs = glob(["include/llvm/DebugInfo/GSYM/*.h"]), - copts = llvm_copts, - deps = [ - ":DebugInfo", - ":DebugInfoDWARF", - ":MC", - ":Object", - ":Support", - ], -) - -cc_library( - name = "Symbolize", - srcs = glob([ - "lib/DebugInfo/Symbolize/*.cpp", - ]), - hdrs = glob([ - "include/llvm/DebugInfo/Symbolize/*.h", - "include/llvm/Debuginfod/*.h", - ]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":DebugInfo", - ":DebugInfoDWARF", - ":DebugInfoPDB", - ":Demangle", - ":Object", - ":Support", - ":TargetParser", - ], -) - -# Command line flag to control which tools get included in the llvm driver binary. -# The macro also generates config_setting targets used by select_driver_tools(). -generate_driver_selects(name = "driver-tools") - -generate_driver_tools_def( - name = "gen_llvm_driver_tools_def", - out = "LLVMDriverTools.def", - driver_tools = select_driver_tools(":driver-tools"), -) - -# Workaround inability to put `.def` files into `srcs` with a library -cc_library( - name = "llvm_driver_tools_def_lib", - includes = ["."], - textual_hdrs = ["LLVMDriverTools.def"], -) - -cc_binary( - name = "llvm", - srcs = glob(["tools/llvm-driver/*.cpp"]), - deps = [ - ":Support", - ":llvm_driver_tools_def_lib", - ] + select_driver_tools(":driver-tools"), -) - -cc_binary( - name = "llvm-min-tblgen", - srcs = [ - "utils/TableGen/ARMTargetDefEmitter.cpp", - "utils/TableGen/Attributes.cpp", - "utils/TableGen/Basic/CodeGenIntrinsics.cpp", - "utils/TableGen/Basic/CodeGenIntrinsics.h", - "utils/TableGen/Basic/SDNodeProperties.cpp", - "utils/TableGen/Basic/SDNodeProperties.h", - "utils/TableGen/Basic/SequenceToOffsetTable.h", - "utils/TableGen/DirectiveEmitter.cpp", - "utils/TableGen/IntrinsicEmitter.cpp", - "utils/TableGen/RISCVTargetDefEmitter.cpp", - "utils/TableGen/TableGen.cpp", - "utils/TableGen/VTEmitter.cpp", - ], - copts = llvm_copts, - stamp = 0, - deps = [ - ":Support", - ":TableGen", - ":config", - ], -) - -cc_library( - name = "TableGenGlobalISel", - srcs = [ - "utils/TableGen/Common/GlobalISel/CodeExpander.cpp", - ], - hdrs = [ - # We have to include these headers here as well as in the `hdrs` below - # to allow the `.cpp` files to use file-relative-inclusion to find - # them, even though consumers of this library use inclusion relative to - # `utils/TableGen` with the `strip_includes_prefix` of this library. - # This mixture appears to be incompatible with header modules. - "utils/TableGen/Common/GlobalISel/CodeExpander.h", - "utils/TableGen/Common/GlobalISel/CodeExpansions.h", - ], - copts = llvm_copts, - features = ["-header_modules"], - strip_include_prefix = "utils/TableGen", - deps = [ - ":CodeGenTypes", - ":Support", - ":TableGen", - ":config", - ], -) - -cc_library( - name = "llvm-tblgen-headers", - textual_hdrs = glob(["utils/TableGen/*.def"]), -) - -cc_binary( - name = "llvm-tblgen", - srcs = glob( - [ - "utils/TableGen/*.cpp", - "utils/TableGen/*.h", - "utils/TableGen/Basic/*.cpp", - "utils/TableGen/Basic/*.h", - "utils/TableGen/Common/*.cpp", - "utils/TableGen/Common/*.h", - "utils/TableGen/Common/GlobalISel/*.cpp", - "utils/TableGen/Common/GlobalISel/*.h", - - # Some tablegen sources include headers from MC, so these have to be - # listed here. MC uses headers produced by tablegen, so it cannot be a - # regular dependency. - "include/llvm/MC/*.h", - ], - exclude = ["utils/TableGen/Common/GlobalISel/CodeExpander.cpp"], - ) + [ - "include/llvm/TargetParser/SubtargetFeature.h", - ], - copts = llvm_copts, - includes = ["utils/TableGen"], - stamp = 0, - deps = [ - ":CodeGenTypes", - ":Support", - ":TableGen", - ":TableGenGlobalISel", - ":TargetParser", - ":config", - ":llvm-tblgen-headers", - ":vt_gen", - ], -) - -gentbl( - name = "intrinsic_enums_gen", - tbl_outs = [("-gen-intrinsic-enums", "include/llvm/IR/IntrinsicEnums.inc")], - tblgen = ":llvm-min-tblgen", - td_file = "include/llvm/IR/Intrinsics.td", - td_srcs = glob([ - "include/llvm/CodeGen/*.td", - "include/llvm/IR/Intrinsics*.td", - ]), -) - -gentbl( - name = "intrinsics_impl_gen", - tbl_outs = [("-gen-intrinsic-impl", "include/llvm/IR/IntrinsicImpl.inc")], - tblgen = ":llvm-min-tblgen", - td_file = "include/llvm/IR/Intrinsics.td", - td_srcs = glob([ - "include/llvm/CodeGen/*.td", - "include/llvm/IR/Intrinsics*.td", - ]), -) - -gentbl( - name = "vt_gen", - tbl_outs = [("-gen-vt", "include/llvm/CodeGen/GenVT.inc")], - tblgen = ":llvm-min-tblgen", - td_file = "include/llvm/CodeGen/ValueTypes.td", - td_srcs = [ - "include/llvm/CodeGen/ValueTypes.td", - ], -) - -# Note that the intrinsics are not currently set up so they can be pruned for -# disabled targets. -llvm_target_intrinsics_list = [ - { - "name": "AArch64", - "intrinsic_prefix": "aarch64", - }, - { - "name": "AMDGPU", - "intrinsic_prefix": "amdgcn", - }, - { - "name": "ARM", - "intrinsic_prefix": "arm", - }, - { - "name": "BPF", - "intrinsic_prefix": "bpf", - }, - { - "name": "DirectX", - "intrinsic_prefix": "dx", - }, - { - "name": "Hexagon", - "intrinsic_prefix": "hexagon", - }, - { - "name": "LoongArch", - "intrinsic_prefix": "loongarch", - }, - { - "name": "Mips", - "intrinsic_prefix": "mips", - }, - { - "name": "NVPTX", - "intrinsic_prefix": "nvvm", - }, - { - "name": "PowerPC", - "intrinsic_prefix": "ppc", - }, - { - "name": "R600", - "intrinsic_prefix": "r600", - }, - { - "name": "RISCV", - "intrinsic_prefix": "riscv", - }, - { - "name": "S390", - "intrinsic_prefix": "s390", - }, - { - "name": "SPIRV", - "intrinsic_prefix": "spv", - }, - { - "name": "VE", - "intrinsic_prefix": "ve", - }, - { - "name": "WebAssembly", - "intrinsic_prefix": "wasm", - }, - { - "name": "X86", - "intrinsic_prefix": "x86", - }, - { - "name": "XCore", - "intrinsic_prefix": "xcore", - }, -] - -[[ - gentbl( - name = "intrinsic_" + target["name"] + "_gen", - tbl_outs = [( - "-gen-intrinsic-enums -intrinsic-prefix=" + target["intrinsic_prefix"], - "include/llvm/IR/Intrinsics" + target["name"] + ".h", - )], - tblgen = ":llvm-min-tblgen", - td_file = "include/llvm/IR/Intrinsics.td", - td_srcs = glob([ - "include/llvm/CodeGen/*.td", - "include/llvm/IR/*.td", - ]), - ), -] for target in llvm_target_intrinsics_list] - -gentbl( - name = "attributes_gen", - tbl_outs = [("-gen-attrs", "include/llvm/IR/Attributes.inc")], - tblgen = ":llvm-min-tblgen", - td_file = "include/llvm/IR/Attributes.td", - td_srcs = ["include/llvm/IR/Attributes.td"], -) - -cc_library( - name = "BitstreamReader", - srcs = glob([ - "lib/Bitstream/Reader/*.cpp", - ]), - hdrs = [ - "include/llvm/Bitstream/BitCodeEnums.h", - "include/llvm/Bitstream/BitCodes.h", - "include/llvm/Bitstream/BitstreamReader.h", - ], - copts = llvm_copts, - deps = [ - ":Support", - ], -) - -cc_library( - name = "BitstreamWriter", - hdrs = [ - "include/llvm/Bitstream/BitCodeEnums.h", - "include/llvm/Bitstream/BitCodes.h", - "include/llvm/Bitstream/BitstreamWriter.h", - ], - copts = llvm_copts, - deps = [ - ":Support", - ], -) - -cc_library( - name = "Remarks", - srcs = glob( - [ - "lib/Remarks/*.cpp", - "lib/Remarks/*.h", - ], - exclude = ["lib/Remarks/RemarkLinker.cpp"], - ), - hdrs = glob( - [ - "include/llvm/Remarks/*.h", - ], - exclude = ["include/llvm/Remarks/RemarkLinker.h"], - ) + [ - "include/llvm-c/Remarks.h", - ], - copts = llvm_copts, - deps = [ - ":BitstreamReader", - ":BitstreamWriter", - ":Support", - ], -) - -cc_library( - name = "remark_linker", - srcs = ["lib/Remarks/RemarkLinker.cpp"], - hdrs = ["include/llvm/Remarks/RemarkLinker.h"], - copts = llvm_copts, - deps = [ - ":Object", - ":Remarks", - ":Support", - ], -) - -filegroup( - name = "llvm_intrinsics_headers", - srcs = [ - "include/llvm/IR/Intrinsics" + target["name"] + ".h" - for target in llvm_target_intrinsics_list - ], -) - -cc_library( - name = "Core", - srcs = glob([ - "lib/IR/*.cpp", - "lib/IR/*.h", - ]) + [ - # To avoid a dependency cycle. - "include/llvm/Analysis/IVDescriptors.h", - ], - hdrs = glob( - [ - "include/llvm/*.h", - "include/llvm/IR/*.h", - ], - exclude = [ - "include/llvm/LinkAllPasses.h", - ], - ) + [ - "include/llvm-c/Comdat.h", - "include/llvm-c/DebugInfo.h", - ] + [":llvm_intrinsics_headers"], - copts = llvm_copts, - textual_hdrs = glob(["include/llvm/IR/*.def"]), - deps = [ - ":BinaryFormat", - ":Demangle", - ":Remarks", - ":Support", - ":TargetParser", - ":attributes_gen", - ":config", - ":intrinsic_enums_gen", - ":intrinsics_impl_gen", - ], -) - -cc_library( - name = "BitReader", - srcs = glob([ - "lib/Bitcode/Reader/*.cpp", - "lib/Bitcode/Reader/*.h", - ]), - hdrs = [ - "include/llvm-c/BitReader.h", - "include/llvm/Bitcode/BitcodeAnalyzer.h", - "include/llvm/Bitcode/BitcodeCommon.h", - "include/llvm/Bitcode/BitcodeReader.h", - "include/llvm/Bitcode/LLVMBitCodes.h", - ], - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":BitstreamReader", - ":Core", - ":Support", - ":TargetParser", - ":config", - ], -) - -cc_library( - name = "MCParser", - srcs = glob([ - "lib/MC/MCParser/*.cpp", - ]), - hdrs = glob(["include/llvm/MC/MCParser/*.h"]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":DebugInfoCodeView", - ":MC", - ":Support", - ":TargetParser", - ":config", - ], -) - -cc_library( - name = "TextAPI", - srcs = glob( - [ - "lib/TextAPI/**/*.cpp", - ], - exclude = ["lib/TextAPI/BinaryReader/**"], - ), - hdrs = glob( - [ - "include/llvm/TextAPI/**/*.h", - "include/llvm/TextAPI/**/*.def", - "lib/TextAPI/**/*.h", - ], - exclude = [ - "lib/TextAPI/BinaryReader/**", - "include/llvm/TextAPI/DylibReader.h", - ], - ), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":Support", - ":TargetParser", - ], -) - -cc_library( - name = "TextAPIBinaryReader", - srcs = glob([ - "lib/TextAPI/BinaryReader/**/*.cpp", - ]), - hdrs = ["include/llvm/TextAPI/DylibReader.h"], - copts = llvm_copts, - deps = [ - ":DebugInfoDWARF", - ":Object", - ":Support", - ":TargetParser", - ":TextAPI", - ], -) - -cc_library( - name = "ObjCopy", - srcs = glob([ - "lib/ObjCopy/**/*.cpp", - "lib/ObjCopy/**/*.h", - ]), - hdrs = glob([ - "include/llvm/ObjCopy/**/*.h", - ]), - copts = llvm_copts, - includes = ["lib/ObjCopy"], - deps = [ - ":BinaryFormat", - ":MC", - ":Object", - ":ObjectYAML", - ":Option", - ":Support", - ":Target", - ":intrinsics_impl_gen", - ], -) - -cc_library( - name = "Object", - srcs = glob([ - "lib/Object/*.cpp", - "lib/Object/*.h", - ]), - hdrs = glob([ - "include/llvm/Object/*.h", - ]) + [ - "include/llvm-c/Object.h", - ], - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":BitReader", - ":Core", - ":IRReader", - ":MC", - ":MCParser", - ":Support", - ":TargetParser", - ":TextAPI", - ":config", - ], -) - -cc_library( - name = "ObjectYAML", - srcs = glob([ - "lib/ObjectYAML/*.cpp", - ]), - hdrs = glob(["include/llvm/ObjectYAML/*.h"]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":DebugInfoCodeView", - ":MC", - ":Object", - ":Support", - ":TargetParser", - ], -) - -cc_library( - name = "ProfileData", - srcs = glob([ - "lib/ProfileData/*.cpp", - ]), - hdrs = glob([ - "include/llvm/ProfileData/*.h", - "include/llvm/ProfileData/*.inc", - ]), - copts = llvm_copts, - deps = [ - ":BitstreamReader", - ":BitstreamWriter", - ":Core", - ":DebugInfo", - ":DebugInfoDWARF", - ":Demangle", - ":Object", - ":Support", - ":Symbolize", - ":TargetParser", - ":config", - ], -) - -cc_library( - name = "Coverage", - srcs = glob([ - "lib/ProfileData/Coverage/*.cpp", - ]), - hdrs = glob(["include/llvm/ProfileData/Coverage/*.h"]), - copts = llvm_copts, - deps = [ - ":Object", - ":ProfileData", - ":Support", - ":TargetParser", - ], -) - -cc_library( - name = "Analysis", - srcs = glob( - [ - "lib/Analysis/*.cpp", - ], - ), - hdrs = glob( - [ - "include/llvm/Analysis/*.h", - "include/llvm/Analysis/Utils/*.h", - ], - ) + [ - "include/llvm-c/Analysis.h", - ], - copts = llvm_copts, - textual_hdrs = glob([ - "include/llvm/Analysis/*.def", - ]), - deps = [ - ":BinaryFormat", - ":Core", - ":Object", - ":ProfileData", - ":Support", - ":TargetParser", - ":config", - ], -) - -cc_library( - name = "BitWriter", - srcs = glob([ - "lib/Bitcode/Writer/*.cpp", - "lib/Bitcode/Writer/*.h", - ]), - hdrs = [ - "include/llvm-c/BitWriter.h", - "include/llvm/Bitcode/BitcodeCommon.h", - "include/llvm/Bitcode/BitcodeConvenience.h", - "include/llvm/Bitcode/BitcodeWriter.h", - "include/llvm/Bitcode/BitcodeWriterPass.h", - "include/llvm/Bitcode/LLVMBitCodes.h", - ], - copts = llvm_copts, - deps = [ - ":Analysis", - ":BitReader", - ":BitstreamWriter", - ":Core", - ":MC", - ":Object", - ":Support", - ":TargetParser", - ":config", - ], -) - -cc_library( - name = "Target", - srcs = glob([ - "lib/Target/*.cpp", - ]), - hdrs = glob([ - "include/llvm/Target/*.h", - ]) + [ - "include/llvm-c/Target.h", - "include/llvm-c/TargetMachine.h", - ], - copts = llvm_copts, - deps = [ - ":Analysis", - ":BinaryFormat", - ":Core", - ":MC", - ":Support", - ":TargetParser", - ":config", - ], -) - -gentbl( - name = "ARMTargetParserDefGen", - tbl_outs = [("-gen-arm-target-def", "include/llvm/TargetParser/ARMTargetParserDef.inc")], - tblgen = ":llvm-min-tblgen", - td_file = "lib/Target/ARM/ARM.td", - td_srcs = [ - ":common_target_td_sources", - ] + glob([ - "lib/Target/ARM/**/*.td", - ]), -) - -gentbl( - name = "AArch64TargetParserDefGen", - tbl_outs = [("-gen-arm-target-def", "include/llvm/TargetParser/AArch64TargetParserDef.inc")], - tblgen = ":llvm-min-tblgen", - td_file = "lib/Target/AArch64/AArch64.td", - td_srcs = [ - ":common_target_td_sources", - ] + glob([ - "lib/Target/AArch64/**/*.td", - ]), -) - -gentbl( - name = "RISCVTargetParserDefGen", - tbl_outs = [("-gen-riscv-target-def", "include/llvm/TargetParser/RISCVTargetParserDef.inc")], - tblgen = ":llvm-min-tblgen", - td_file = "lib/Target/RISCV/RISCV.td", - td_srcs = [ - ":common_target_td_sources", - ] + glob([ - "lib/Target/RISCV/**/*.td", - ]), -) - -cc_library( - name = "TargetParser", - srcs = glob([ - "lib/TargetParser/*.cpp", - ]) + select({ - "@platforms//os:windows": glob([ - "lib/TargetParser/Windows/*.inc", - ]), - "//conditions:default": glob([ - "lib/TargetParser/Unix/*.inc", - ]), - }), - hdrs = glob([ - "include/llvm/TargetParser/*.h", - ]), - copts = llvm_copts, - includes = ["include"], - textual_hdrs = [ - "include/llvm/TargetParser/AArch64CPUFeatures.inc", - "include/llvm/TargetParser/AArch64TargetParserDef.inc", - "include/llvm/TargetParser/ARMTargetParserDef.inc", - "include/llvm/TargetParser/RISCVTargetParserDef.inc", - ] + glob([ - "include/llvm/TargetParser/*.def", - ]), - deps = [ - ":Support", - ":config", - ], -) - -cc_library( - name = "DWP", - srcs = glob([ - "lib/DWP/*.cpp", - ]), - hdrs = glob(["include/llvm/DWP/*.h"]), - copts = llvm_copts, - deps = [ - ":DebugInfoDWARF", - ":MC", - ":Object", - ":Support", - ":Target", - ], -) - -cc_library( - name = "TransformUtils", - srcs = glob([ - "lib/Transforms/Utils/*.cpp", - ]), - hdrs = glob(["include/llvm/Transforms/Utils/*.h"]) + [ - "include/llvm/Transforms/Utils.h", - ], - copts = llvm_copts, - deps = [ - ":Analysis", - ":BinaryFormat", - ":BitWriter", - ":Core", - ":ProfileData", - ":Support", - ":Target", - ":TargetParser", - ":config", - ], -) - -gentbl( - name = "InstCombineTableGen", - strip_include_prefix = "lib/Target/AMDGPU", - tbl_outs = [( - "-gen-searchable-tables", - "lib/Target/AMDGPU/InstCombineTables.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "lib/Target/AMDGPU/InstCombineTables.td", - td_srcs = glob([ - "include/llvm/CodeGen/*.td", - "include/llvm/IR/Intrinsics*.td", - ]) + [ - "lib/Target/AMDGPU/InstCombineTables.td", - "include/llvm/TableGen/SearchableTable.td", - ], -) - -cc_library( - name = "InstCombine", - srcs = glob([ - "lib/Transforms/InstCombine/*.cpp", - "lib/Transforms/InstCombine/*.h", - ]), - hdrs = glob(["include/llvm/Transforms/InstCombine/*.h"]), - copts = llvm_copts, - deps = [ - ":Analysis", - ":Core", - ":Support", - ":Target", - ":TransformUtils", - ":config", - ], -) - -cc_library( - name = "AggressiveInstCombine", - srcs = glob([ - "lib/Transforms/AggressiveInstCombine/*.cpp", - "lib/Transforms/AggressiveInstCombine/*.h", - ]), - hdrs = [ - "include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h", - ], - copts = llvm_copts, - deps = [ - ":Analysis", - ":Core", - ":Support", - ":TransformUtils", - ], -) - -cc_library( - name = "Instrumentation", - srcs = glob([ - "lib/Transforms/Instrumentation/*.cpp", - "lib/Transforms/Instrumentation/*.h", - "lib/Transforms/Instrumentation/*.inc", - ]), - hdrs = glob(["include/llvm/Transforms/Instrumentation/*.h"]) + [ - "include/llvm/Transforms/Instrumentation.h", - ], - copts = llvm_copts, - deps = [ - ":Analysis", - ":BinaryFormat", - ":Core", - ":Demangle", - ":MC", - ":ProfileData", - ":Support", - ":Target", - ":TargetParser", - ":TransformUtils", - ":config", - ], -) - -cc_library( - name = "ObjCARC", - srcs = glob([ - "lib/Transforms/ObjCARC/*.cpp", - "lib/Transforms/ObjCARC/*.h", - ]), - hdrs = ["include/llvm/Transforms/ObjCARC.h"], - copts = llvm_copts, - deps = [ - ":Analysis", - ":Core", - ":Support", - ":Target", - ":TransformUtils", - ":config", - ], -) - -cc_library( - name = "Scalar", - srcs = glob([ - "lib/Transforms/Scalar/*.cpp", - ]), - hdrs = glob(["include/llvm/Transforms/Scalar/*.h"]) + [ - "include/llvm/Transforms/Scalar.h", - ], - copts = llvm_copts, - deps = [ - ":AggressiveInstCombine", - ":Analysis", - ":BinaryFormat", - ":Core", - ":InstCombine", - ":ProfileData", - ":Support", - ":Target", - ":TransformUtils", - ":config", - ], -) - -cc_library( - name = "Vectorize", - srcs = glob([ - "lib/Transforms/Vectorize/*.cpp", - "lib/Transforms/Vectorize/*.h", - ]), - hdrs = glob([ - "include/llvm/Transforms/Vectorize/*.h", - ]), - copts = llvm_copts, - deps = [ - ":Analysis", - ":Core", - ":Scalar", - ":Support", - ":Target", - ":TransformUtils", - ":config", - ], -) - -cc_library( - name = "FrontendDebug", - hdrs = glob([ - "include/llvm/Frontend/Debug/*.h", - ]), - copts = llvm_copts, - deps = [ - ":Support", - ], -) - -cc_library( - name = "FrontendDriver", - srcs = glob([ - "lib/Frontend/Driver/*.cpp", - ]), - hdrs = glob([ - "include/llvm/Frontend/Driver/*.h", - ]), - copts = llvm_copts, - deps = [ - ":Analysis", - ":TargetParser", - ], -) - -cc_library( - name = "FrontendHLSL", - srcs = glob([ - "lib/Frontend/HLSL/*.cpp", - ]), - hdrs = glob([ - "include/llvm/Frontend/HLSL/*.h", - ]), - copts = llvm_copts, - deps = [ - ":Core", - ":Support", - ], -) - -cc_library( - name = "FrontendOffloading", - srcs = glob([ - "lib/Frontend/Offloading/*.cpp", - ]), - hdrs = glob([ - "include/llvm/Frontend/Offloading/*.h", - ]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":Core", - ":Object", - ":Support", - ":TargetParser", - ":TransformUtils", - ], -) - -filegroup( - name = "omp_td_files", - srcs = glob([ - "include/llvm/Frontend/OpenMP/*.td", - "include/llvm/Frontend/Directive/*.td", - ]), -) - -gentbl( - name = "omp_gen", - library = False, - tbl_outs = [ - ("--gen-directive-decl", "include/llvm/Frontend/OpenMP/OMP.h.inc"), - ], - tblgen = ":llvm-min-tblgen", - td_file = "include/llvm/Frontend/OpenMP/OMP.td", - td_srcs = [":omp_td_files"], -) - -gentbl( - name = "omp_gen_impl", - library = False, - tbl_outs = [ - ("--gen-directive-impl", "include/llvm/Frontend/OpenMP/OMP.inc"), - ], - tblgen = ":llvm-min-tblgen", - td_file = "include/llvm/Frontend/OpenMP/OMP.td", - td_srcs = [":omp_td_files"], -) - -cc_library( - name = "FrontendOpenMP", - srcs = glob([ - "lib/Frontend/OpenMP/*.cpp", - ]), - hdrs = glob([ - "include/llvm/Frontend/OpenMP/*.h", - ]) + [ - "include/llvm/Frontend/OpenMP/OMP.h.inc", - "include/llvm/Frontend/OpenMP/OMP.inc", - ], - copts = llvm_copts, - textual_hdrs = glob([ - "include/llvm/Frontend/OpenMP/*.def", - ]), - deps = [ - ":Analysis", - ":BitReader", - ":Core", - ":FrontendOffloading", - ":MC", - ":Scalar", - ":Support", - ":Target", - ":TargetParser", - ":TransformUtils", - ], -) - -filegroup( - name = "acc_td_files", - srcs = glob([ - "include/llvm/Frontend/OpenACC/*.td", - "include/llvm/Frontend/Directive/*.td", - ]), -) - -gentbl( - name = "acc_gen", - library = False, - tbl_outs = [ - ("--gen-directive-decl", "include/llvm/Frontend/OpenACC/ACC.h.inc"), - ], - tblgen = ":llvm-min-tblgen", - td_file = "include/llvm/Frontend/OpenACC/ACC.td", - td_srcs = [":acc_td_files"], -) - -gentbl( - name = "acc_gen_impl", - library = False, - tbl_outs = [ - ("--gen-directive-impl", "include/llvm/Frontend/OpenACC/ACC.inc"), - ], - tblgen = ":llvm-min-tblgen", - td_file = "include/llvm/Frontend/OpenACC/ACC.td", - td_srcs = [":acc_td_files"], -) - -cc_library( - name = "FrontendOpenACC", - srcs = glob([ - "lib/Frontend/OpenACC/*.cpp", - ]) + [ - "include/llvm/Frontend/OpenACC/ACC.inc", - ], - hdrs = ["include/llvm/Frontend/OpenACC/ACC.h.inc"], - copts = llvm_copts, - deps = [ - ":Analysis", - ":Core", - ":Support", - ":TransformUtils", - ], -) - -cc_library( - name = "AsmParser", - srcs = glob([ - "lib/AsmParser/*.cpp", - ]), - hdrs = glob(["include/llvm/AsmParser/*.h"]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":Core", - ":Support", - ":attributes_gen", - ], -) - -cc_library( - name = "IRPrinter", - srcs = glob([ - "lib/IRPrinter/*.cpp", - ]), - hdrs = glob([ - "include/llvm/IRPrinter/*.h", - ]), - copts = llvm_copts, - deps = [ - ":Analysis", - ":Core", - ":Support", - ], -) - -cc_library( - name = "IRReader", - srcs = glob([ - "lib/IRReader/*.cpp", - ]), - hdrs = glob([ - "include/llvm/IRReader/*.h", - ]) + [ - "include/llvm-c/IRReader.h", - ], - copts = llvm_copts, - deps = [ - ":AsmParser", - ":BitReader", - ":Core", - ":Support", - ":config", - ], -) - -cc_library( - name = "Linker", - srcs = glob([ - "lib/Linker/*.cpp", - "lib/Linker/*.h", - ]), - hdrs = glob([ - "include/llvm/Linker/*.h", - ]) + [ - "include/llvm-c/Linker.h", - ], - copts = llvm_copts, - deps = [ - ":Core", - ":Object", - ":Support", - ":TargetParser", - ":TransformUtils", - ":config", - ], -) - -cc_library( - name = "IPO", - srcs = glob([ - "lib/Transforms/IPO/*.cpp", - ]), - hdrs = glob([ - "include/llvm/Transforms/IPO/*.h", - ]) + [ - "include/llvm/Transforms/IPO.h", - ], - copts = llvm_copts, - deps = [ - ":AggressiveInstCombine", - ":Analysis", - ":BinaryFormat", - ":BitReader", - ":BitWriter", - ":Core", - ":FrontendOpenMP", - ":IRPrinter", - ":IRReader", - ":InstCombine", - ":Instrumentation", - ":Linker", - ":ObjCARC", - ":Object", - ":ProfileData", - ":Scalar", - ":Support", - ":Target", - ":TargetParser", - ":TransformUtils", - ":Vectorize", - ":config", - ":ir_headers", - ], -) - -cc_library( - name = "CFGuard", - srcs = glob([ - "lib/Transforms/CFGuard/*.cpp", - ]), - hdrs = ["include/llvm/Transforms/CFGuard.h"], - copts = llvm_copts, - deps = [ - ":Core", - ":Support", - ":TargetParser", - ], -) - -cc_library( - name = "HipStdPar", - srcs = glob([ - "lib/Transforms/HipStdPar/*.cpp", - ]), - hdrs = ["include/llvm/Transforms/HipStdPar/HipStdPar.h"], - copts = llvm_copts, - deps = [ - ":Analysis", - ":Core", - ":Support", - ":TargetParser", - ":TransformUtils", - ], -) - -cc_library( - name = "Coroutines", - srcs = glob([ - "lib/Transforms/Coroutines/*.cpp", - "lib/Transforms/Coroutines/*.h", - ]), - hdrs = glob(["include/llvm/Transforms/Coroutines/*.h"]), - copts = llvm_copts, - deps = [ - ":Analysis", - ":BinaryFormat", - ":Core", - ":IPO", - ":Scalar", - ":Support", - ":TransformUtils", - ":config", - ], -) - -# Meta-target for clients which depend on all of the transforms libraries. -cc_library( - name = "common_transforms", - deps = [ - ":AggressiveInstCombine", - ":CFGuard", - ":Coroutines", - ":IPO", - ":InstCombine", - ":Instrumentation", - ":ObjCARC", - ":Scalar", - ":Vectorize", - ], -) - -cc_library( - name = "asm_printer_defs", - copts = llvm_copts, - textual_hdrs = glob(["lib/CodeGen/AsmPrinter/*.def"]), -) - -cc_library( - name = "CodeGenTypes", - srcs = glob([ - "lib/CodeGenTypes/**/*.cpp", - ]), - hdrs = glob([ - "include/llvm/CodeGenTypes/**/*.h", - ]), - copts = llvm_copts, - deps = [ - ":Support", - ":vt_gen", - ], -) - -cc_library( - name = "CodeGen", - srcs = glob( - [ - "lib/CodeGen/**/*.cpp", - "lib/CodeGen/**/*.h", - "lib/CodeGen/SelectionDAG/*.cpp", - "lib/CodeGen/SelectionDAG/*.h", - ], - ), - hdrs = [ - "include/llvm/LinkAllPasses.h", - ] + glob( - [ - "include/llvm/CodeGen/**/*.h", - ], - ), - copts = llvm_copts, - textual_hdrs = glob([ - "include/llvm/CodeGen/**/*.def", - ]), - deps = [ - ":AggressiveInstCombine", - ":Analysis", - ":AsmParser", - ":BinaryFormat", - ":BitReader", - ":BitWriter", - ":CFGuard", - ":CodeGenTypes", - ":Core", - ":DebugInfoCodeView", - ":DebugInfoDWARF", - ":IPO", - ":IRPrinter", - ":Instrumentation", - ":MC", - ":MCParser", - ":ObjCARC", - ":Object", - ":ProfileData", - ":Remarks", - ":Scalar", - ":Support", - ":Target", - ":TargetParser", - ":TransformUtils", - ":asm_printer_defs", - ":config", - ":vt_gen", - ], -) - -cc_library( - name = "MCDisassembler", - srcs = glob([ - "lib/MC/MCDisassembler/*.cpp", - "lib/MC/MCDisassembler/*.h", - ]), - hdrs = glob([ - "include/llvm/MC/MCDisassembler/*.h", - ]) + [ - "include/llvm-c/Disassembler.h", - ], - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":MC", - ":Support", - ":TargetParser", - ":config", - ], -) - -llvm_target_lib_list = [lib for lib in [ - { - "name": "AArch64", - "short_name": "AArch64", - "tbl_outs": [ - ("-gen-register-bank", "lib/Target/AArch64/AArch64GenRegisterBank.inc"), - ("-gen-register-info", "lib/Target/AArch64/AArch64GenRegisterInfo.inc"), - ("-gen-instr-info", "lib/Target/AArch64/AArch64GenInstrInfo.inc"), - ("-gen-emitter", "lib/Target/AArch64/AArch64GenMCCodeEmitter.inc"), - ("-gen-pseudo-lowering", "lib/Target/AArch64/AArch64GenMCPseudoLowering.inc"), - ("-gen-asm-writer", "lib/Target/AArch64/AArch64GenAsmWriter.inc"), - ("-gen-asm-writer -asmwriternum=1", "lib/Target/AArch64/AArch64GenAsmWriter1.inc"), - ("-gen-asm-matcher", "lib/Target/AArch64/AArch64GenAsmMatcher.inc"), - ("-gen-dag-isel", "lib/Target/AArch64/AArch64GenDAGISel.inc"), - ("-gen-fast-isel", "lib/Target/AArch64/AArch64GenFastISel.inc"), - ("-gen-global-isel", "lib/Target/AArch64/AArch64GenGlobalISel.inc"), - ("-gen-global-isel-combiner -combiners=AArch64O0PreLegalizerCombiner", "lib/Target/AArch64/AArch64GenO0PreLegalizeGICombiner.inc"), - ("-gen-global-isel-combiner -combiners=AArch64PreLegalizerCombiner", "lib/Target/AArch64/AArch64GenPreLegalizeGICombiner.inc"), - ("-gen-global-isel-combiner -combiners=AArch64PostLegalizerCombiner", "lib/Target/AArch64/AArch64GenPostLegalizeGICombiner.inc"), - ("-gen-global-isel-combiner -combiners=AArch64PostLegalizerLowering", "lib/Target/AArch64/AArch64GenPostLegalizeGILowering.inc"), - ("-gen-callingconv", "lib/Target/AArch64/AArch64GenCallingConv.inc"), - ("-gen-subtarget", "lib/Target/AArch64/AArch64GenSubtargetInfo.inc"), - ("-gen-disassembler", "lib/Target/AArch64/AArch64GenDisassemblerTables.inc"), - ("-gen-searchable-tables", "lib/Target/AArch64/AArch64GenSystemOperands.inc"), - ("-gen-exegesis", "lib/Target/AArch64/AArch64GenExegesis.inc"), - ], - }, - { - "name": "ARM", - "short_name": "ARM", - "tbl_outs": [ - ("-gen-register-bank", "lib/Target/ARM/ARMGenRegisterBank.inc"), - ("-gen-register-info", "lib/Target/ARM/ARMGenRegisterInfo.inc"), - ("-gen-searchable-tables", "lib/Target/ARM/ARMGenSystemRegister.inc"), - ("-gen-instr-info", "lib/Target/ARM/ARMGenInstrInfo.inc"), - ("-gen-emitter", "lib/Target/ARM/ARMGenMCCodeEmitter.inc"), - ("-gen-pseudo-lowering", "lib/Target/ARM/ARMGenMCPseudoLowering.inc"), - ("-gen-asm-writer", "lib/Target/ARM/ARMGenAsmWriter.inc"), - ("-gen-asm-matcher", "lib/Target/ARM/ARMGenAsmMatcher.inc"), - ("-gen-dag-isel", "lib/Target/ARM/ARMGenDAGISel.inc"), - ("-gen-fast-isel", "lib/Target/ARM/ARMGenFastISel.inc"), - ("-gen-global-isel", "lib/Target/ARM/ARMGenGlobalISel.inc"), - ("-gen-callingconv", "lib/Target/ARM/ARMGenCallingConv.inc"), - ("-gen-subtarget", "lib/Target/ARM/ARMGenSubtargetInfo.inc"), - ("-gen-disassembler", "lib/Target/ARM/ARMGenDisassemblerTables.inc"), - ], - }, - { - "name": "AMDGPU", - "short_name": "AMDGPU", - "tbl_outs": [ - ("-gen-register-bank", "lib/Target/AMDGPU/AMDGPUGenRegisterBank.inc"), - ("-gen-register-info", "lib/Target/AMDGPU/AMDGPUGenRegisterInfo.inc"), - ("-gen-instr-info", "lib/Target/AMDGPU/AMDGPUGenInstrInfo.inc"), - ("-gen-emitter", "lib/Target/AMDGPU/AMDGPUGenMCCodeEmitter.inc"), - ("-gen-pseudo-lowering", "lib/Target/AMDGPU/AMDGPUGenMCPseudoLowering.inc"), - ("-gen-asm-writer", "lib/Target/AMDGPU/AMDGPUGenAsmWriter.inc"), - ("-gen-asm-matcher", "lib/Target/AMDGPU/AMDGPUGenAsmMatcher.inc"), - ("-gen-dag-isel", "lib/Target/AMDGPU/AMDGPUGenDAGISel.inc"), - ("-gen-callingconv", "lib/Target/AMDGPU/AMDGPUGenCallingConv.inc"), - ("-gen-subtarget", "lib/Target/AMDGPU/AMDGPUGenSubtargetInfo.inc"), - ("-gen-disassembler", "lib/Target/AMDGPU/AMDGPUGenDisassemblerTables.inc"), - ("-gen-searchable-tables", "lib/Target/AMDGPU/AMDGPUGenSearchableTables.inc"), - ], - "tbl_deps": [ - ":InstCombineTableGen", - ":amdgpu_isel_target_gen", - ":r600_target_gen", - ], - }, - { - "name": "AVR", - "short_name": "AVR", - "tbl_outs": [ - ("-gen-asm-matcher", "lib/Target/AVR/AVRGenAsmMatcher.inc"), - ("-gen-asm-writer", "lib/Target/AVR/AVRGenAsmWriter.inc"), - ("-gen-callingconv", "lib/Target/AVR/AVRGenCallingConv.inc"), - ("-gen-dag-isel", "lib/Target/AVR/AVRGenDAGISel.inc"), - ("-gen-disassembler", "lib/Target/AVR/AVRGenDisassemblerTables.inc"), - ("-gen-emitter", "lib/Target/AVR/AVRGenMCCodeEmitter.inc"), - ("-gen-instr-info", "lib/Target/AVR/AVRGenInstrInfo.inc"), - ("-gen-register-info", "lib/Target/AVR/AVRGenRegisterInfo.inc"), - ("-gen-subtarget", "lib/Target/AVR/AVRGenSubtargetInfo.inc"), - ], - }, - { - "name": "BPF", - "short_name": "BPF", - "tbl_outs": [ - ("-gen-register-bank", "lib/Target/BPF/BPFGenRegisterBank.inc"), - ("-gen-asm-writer", "lib/Target/BPF/BPFGenAsmWriter.inc"), - ("-gen-asm-matcher", "lib/Target/BPF/BPFGenAsmMatcher.inc"), - ("-gen-callingconv", "lib/Target/BPF/BPFGenCallingConv.inc"), - ("-gen-dag-isel", "lib/Target/BPF/BPFGenDAGISel.inc"), - ("-gen-global-isel", "lib/Target/BPF/BPFGenGlobalISel.inc"), - ("-gen-disassembler", "lib/Target/BPF/BPFGenDisassemblerTables.inc"), - ("-gen-emitter", "lib/Target/BPF/BPFGenMCCodeEmitter.inc"), - ("-gen-instr-info", "lib/Target/BPF/BPFGenInstrInfo.inc"), - ("-gen-register-info", "lib/Target/BPF/BPFGenRegisterInfo.inc"), - ("-gen-subtarget", "lib/Target/BPF/BPFGenSubtargetInfo.inc"), - ], - }, - { - "name": "Hexagon", - "short_name": "Hexagon", - "tbl_outs": [ - ("-gen-asm-matcher", "lib/Target/Hexagon/HexagonGenAsmMatcher.inc"), - ("-gen-asm-writer", "lib/Target/Hexagon/HexagonGenAsmWriter.inc"), - ("-gen-callingconv", "lib/Target/Hexagon/HexagonGenCallingConv.inc"), - ("-gen-dag-isel", "lib/Target/Hexagon/HexagonGenDAGISel.inc"), - ("-gen-dfa-packetizer", "lib/Target/Hexagon/HexagonGenDFAPacketizer.inc"), - ("-gen-disassembler", "lib/Target/Hexagon/HexagonGenDisassemblerTables.inc"), - ("-gen-instr-info", "lib/Target/Hexagon/HexagonGenInstrInfo.inc"), - ("-gen-emitter", "lib/Target/Hexagon/HexagonGenMCCodeEmitter.inc"), - ("-gen-register-info", "lib/Target/Hexagon/HexagonGenRegisterInfo.inc"), - ("-gen-subtarget", "lib/Target/Hexagon/HexagonGenSubtargetInfo.inc"), - ], - }, - { - "name": "Lanai", - "short_name": "Lanai", - "tbl_outs": [ - ("-gen-asm-matcher", "lib/Target/Lanai/LanaiGenAsmMatcher.inc"), - ("-gen-asm-writer", "lib/Target/Lanai/LanaiGenAsmWriter.inc"), - ("-gen-callingconv", "lib/Target/Lanai/LanaiGenCallingConv.inc"), - ("-gen-dag-isel", "lib/Target/Lanai/LanaiGenDAGISel.inc"), - ("-gen-disassembler", "lib/Target/Lanai/LanaiGenDisassemblerTables.inc"), - ("-gen-emitter", "lib/Target/Lanai/LanaiGenMCCodeEmitter.inc"), - ("-gen-instr-info", "lib/Target/Lanai/LanaiGenInstrInfo.inc"), - ("-gen-register-info", "lib/Target/Lanai/LanaiGenRegisterInfo.inc"), - ("-gen-subtarget", "lib/Target/Lanai/LanaiGenSubtargetInfo.inc"), - ], - }, - { - "name": "LoongArch", - "short_name": "LoongArch", - "tbl_outs": [ - ("-gen-asm-matcher", "lib/Target/LoongArch/LoongArchGenAsmMatcher.inc"), - ("-gen-asm-writer", "lib/Target/LoongArch/LoongArchGenAsmWriter.inc"), - ("-gen-dag-isel", "lib/Target/LoongArch/LoongArchGenDAGISel.inc"), - ("-gen-disassembler", "lib/Target/LoongArch/LoongArchGenDisassemblerTables.inc"), - ("-gen-emitter", "lib/Target/LoongArch/LoongArchGenMCCodeEmitter.inc"), - ("-gen-instr-info", "lib/Target/LoongArch/LoongArchGenInstrInfo.inc"), - ("-gen-pseudo-lowering", "lib/Target/LoongArch/LoongArchGenMCPseudoLowering.inc"), - ("-gen-register-info", "lib/Target/LoongArch/LoongArchGenRegisterInfo.inc"), - ("-gen-subtarget", "lib/Target/LoongArch/LoongArchGenSubtargetInfo.inc"), - ], - }, - { - "name": "Mips", - "short_name": "Mips", - "tbl_outs": [ - ("-gen-asm-matcher", "lib/Target/Mips/MipsGenAsmMatcher.inc"), - ("-gen-asm-writer", "lib/Target/Mips/MipsGenAsmWriter.inc"), - ("-gen-callingconv", "lib/Target/Mips/MipsGenCallingConv.inc"), - ("-gen-dag-isel", "lib/Target/Mips/MipsGenDAGISel.inc"), - ("-gen-disassembler", "lib/Target/Mips/MipsGenDisassemblerTables.inc"), - ("-gen-emitter", "lib/Target/Mips/MipsGenMCCodeEmitter.inc"), - ("-gen-exegesis", "lib/Target/Mips/MipsGenExegesis.inc"), - ("-gen-fast-isel", "lib/Target/Mips/MipsGenFastISel.inc"), - ("-gen-global-isel", "lib/Target/Mips/MipsGenGlobalISel.inc"), - ("-gen-global-isel-combiner -combiners=MipsPostLegalizerCombiner", "lib/Target/Mips/MipsGenPostLegalizeGICombiner.inc"), - ("-gen-instr-info", "lib/Target/Mips/MipsGenInstrInfo.inc"), - ("-gen-pseudo-lowering", "lib/Target/Mips/MipsGenMCPseudoLowering.inc"), - ("-gen-register-bank", "lib/Target/Mips/MipsGenRegisterBank.inc"), - ("-gen-register-info", "lib/Target/Mips/MipsGenRegisterInfo.inc"), - ("-gen-subtarget", "lib/Target/Mips/MipsGenSubtargetInfo.inc"), - ], - }, - { - "name": "MSP430", - "short_name": "MSP430", - "tbl_outs": [ - ("-gen-asm-matcher", "lib/Target/MSP430/MSP430GenAsmMatcher.inc"), - ("-gen-asm-writer", "lib/Target/MSP430/MSP430GenAsmWriter.inc"), - ("-gen-callingconv", "lib/Target/MSP430/MSP430GenCallingConv.inc"), - ("-gen-dag-isel", "lib/Target/MSP430/MSP430GenDAGISel.inc"), - ("-gen-disassembler", "lib/Target/MSP430/MSP430GenDisassemblerTables.inc"), - ("-gen-emitter", "lib/Target/MSP430/MSP430GenMCCodeEmitter.inc"), - ("-gen-instr-info", "lib/Target/MSP430/MSP430GenInstrInfo.inc"), - ("-gen-register-info", "lib/Target/MSP430/MSP430GenRegisterInfo.inc"), - ("-gen-subtarget", "lib/Target/MSP430/MSP430GenSubtargetInfo.inc"), - ], - }, - { - "name": "NVPTX", - "short_name": "NVPTX", - "tbl_outs": [ - ("-gen-register-info", "lib/Target/NVPTX/NVPTXGenRegisterInfo.inc"), - ("-gen-instr-info", "lib/Target/NVPTX/NVPTXGenInstrInfo.inc"), - ("-gen-asm-writer", "lib/Target/NVPTX/NVPTXGenAsmWriter.inc"), - ("-gen-dag-isel", "lib/Target/NVPTX/NVPTXGenDAGISel.inc"), - ("-gen-subtarget", "lib/Target/NVPTX/NVPTXGenSubtargetInfo.inc"), - ], - }, - { - "name": "PowerPC", - "short_name": "PPC", - "tbl_outs": [ - ("-gen-asm-writer", "lib/Target/PowerPC/PPCGenAsmWriter.inc"), - ("-gen-asm-matcher", "lib/Target/PowerPC/PPCGenAsmMatcher.inc"), - ("-gen-emitter", "lib/Target/PowerPC/PPCGenMCCodeEmitter.inc"), - ("-gen-register-info", "lib/Target/PowerPC/PPCGenRegisterInfo.inc"), - ("-gen-instr-info", "lib/Target/PowerPC/PPCGenInstrInfo.inc"), - ("-gen-dag-isel", "lib/Target/PowerPC/PPCGenDAGISel.inc"), - ("-gen-fast-isel", "lib/Target/PowerPC/PPCGenFastISel.inc"), - ("-gen-callingconv", "lib/Target/PowerPC/PPCGenCallingConv.inc"), - ("-gen-subtarget", "lib/Target/PowerPC/PPCGenSubtargetInfo.inc"), - ("-gen-disassembler", "lib/Target/PowerPC/PPCGenDisassemblerTables.inc"), - ("-gen-register-bank", "lib/Target/PowerPC/PPCGenRegisterBank.inc"), - ("-gen-global-isel", "lib/Target/PowerPC/PPCGenGlobalISel.inc"), - ("-gen-exegesis", "lib/Target/PowerPC/PPCGenExegesis.inc"), - ], - }, - { - "name": "Sparc", - "short_name": "Sparc", - "tbl_outs": [ - ("-gen-asm-writer", "lib/Target/Sparc/SparcGenAsmWriter.inc"), - ("-gen-asm-matcher", "lib/Target/Sparc/SparcGenAsmMatcher.inc"), - ("-gen-emitter", "lib/Target/Sparc/SparcGenMCCodeEmitter.inc"), - ("-gen-register-info", "lib/Target/Sparc/SparcGenRegisterInfo.inc"), - ("-gen-instr-info", "lib/Target/Sparc/SparcGenInstrInfo.inc"), - ("-gen-dag-isel", "lib/Target/Sparc/SparcGenDAGISel.inc"), - ("-gen-callingconv", "lib/Target/Sparc/SparcGenCallingConv.inc"), - ("-gen-subtarget", "lib/Target/Sparc/SparcGenSubtargetInfo.inc"), - ("-gen-disassembler", "lib/Target/Sparc/SparcGenDisassemblerTables.inc"), - ("-gen-searchable-tables", "lib/Target/Sparc/SparcGenSearchableTables.inc"), - ], - }, - { - "name": "SystemZ", - "short_name": "SystemZ", - "tbl_outs": [ - ("-gen-asm-matcher", "lib/Target/SystemZ/SystemZGenAsmMatcher.inc"), - ("-gen-asm-writer", "lib/Target/SystemZ/SystemZGenAsmWriter.inc"), - ("-gen-callingconv", "lib/Target/SystemZ/SystemZGenCallingConv.inc"), - ("-gen-dag-isel", "lib/Target/SystemZ/SystemZGenDAGISel.inc"), - ("-gen-disassembler", "lib/Target/SystemZ/SystemZGenDisassemblerTables.inc"), - ("-gen-emitter", "lib/Target/SystemZ/SystemZGenMCCodeEmitter.inc"), - ("-gen-instr-info", "lib/Target/SystemZ/SystemZGenInstrInfo.inc"), - ("-gen-register-info", "lib/Target/SystemZ/SystemZGenRegisterInfo.inc"), - ("-gen-subtarget", "lib/Target/SystemZ/SystemZGenSubtargetInfo.inc"), - ], - }, - { - "name": "RISCV", - "short_name": "RISCV", - "tbl_outs": [ - ("-gen-asm-matcher", "lib/Target/RISCV/RISCVGenAsmMatcher.inc"), - ("-gen-asm-writer", "lib/Target/RISCV/RISCVGenAsmWriter.inc"), - ("-gen-compress-inst-emitter", "lib/Target/RISCV/RISCVGenCompressInstEmitter.inc"), - ("-gen-dag-isel", "lib/Target/RISCV/RISCVGenDAGISel.inc"), - ("-gen-disassembler", "lib/Target/RISCV/RISCVGenDisassemblerTables.inc"), - ("-gen-instr-info", "lib/Target/RISCV/RISCVGenInstrInfo.inc"), - ("-gen-macro-fusion-pred", "lib/Target/RISCV/RISCVGenMacroFusion.inc"), - ("-gen-emitter", "lib/Target/RISCV/RISCVGenMCCodeEmitter.inc"), - ("-gen-pseudo-lowering", "lib/Target/RISCV/RISCVGenMCPseudoLowering.inc"), - ("-gen-register-bank", "lib/Target/RISCV/RISCVGenRegisterBank.inc"), - ("-gen-register-info", "lib/Target/RISCV/RISCVGenRegisterInfo.inc"), - ("-gen-subtarget", "lib/Target/RISCV/RISCVGenSubtargetInfo.inc"), - ("-gen-searchable-tables", "lib/Target/RISCV/RISCVGenSearchableTables.inc"), - ], - "tbl_deps": [ - ":riscv_isel_target_gen", - ], - }, - { - "name": "VE", - "short_name": "VE", - "tbl_outs": [ - ("-gen-asm-matcher", "lib/Target/VE/VEGenAsmMatcher.inc"), - ("-gen-asm-writer", "lib/Target/VE/VEGenAsmWriter.inc"), - ("-gen-callingconv", "lib/Target/VE/VEGenCallingConv.inc"), - ("-gen-dag-isel", "lib/Target/VE/VEGenDAGISel.inc"), - ("-gen-disassembler", "lib/Target/VE/VEGenDisassemblerTables.inc"), - ("-gen-emitter", "lib/Target/VE/VEGenMCCodeEmitter.inc"), - ("-gen-instr-info", "lib/Target/VE/VEGenInstrInfo.inc"), - ("-gen-register-info", "lib/Target/VE/VEGenRegisterInfo.inc"), - ("-gen-subtarget", "lib/Target/VE/VEGenSubtargetInfo.inc"), - ], - }, - { - "name": "WebAssembly", - "short_name": "WebAssembly", - "tbl_outs": [ - ("-gen-disassembler", "lib/Target/WebAssembly/WebAssemblyGenDisassemblerTables.inc"), - ("-gen-asm-writer", "lib/Target/WebAssembly/WebAssemblyGenAsmWriter.inc"), - ("-gen-instr-info", "lib/Target/WebAssembly/WebAssemblyGenInstrInfo.inc"), - ("-gen-dag-isel", "lib/Target/WebAssembly/WebAssemblyGenDAGISel.inc"), - ("-gen-fast-isel", "lib/Target/WebAssembly/WebAssemblyGenFastISel.inc"), - ("-gen-emitter", "lib/Target/WebAssembly/WebAssemblyGenMCCodeEmitter.inc"), - ("-gen-register-info", "lib/Target/WebAssembly/WebAssemblyGenRegisterInfo.inc"), - ("-gen-subtarget", "lib/Target/WebAssembly/WebAssemblyGenSubtargetInfo.inc"), - ("-gen-asm-matcher", "lib/Target/WebAssembly/WebAssemblyGenAsmMatcher.inc"), - ], - }, - { - "name": "X86", - "short_name": "X86", - "tbl_outs": [ - ("-gen-register-bank", "lib/Target/X86/X86GenRegisterBank.inc"), - ("-gen-register-info", "lib/Target/X86/X86GenRegisterInfo.inc"), - ("-gen-disassembler", "lib/Target/X86/X86GenDisassemblerTables.inc"), - ("-gen-instr-info", "lib/Target/X86/X86GenInstrInfo.inc"), - ("-gen-asm-writer", "lib/Target/X86/X86GenAsmWriter.inc"), - ("-gen-asm-writer -asmwriternum=1", "lib/Target/X86/X86GenAsmWriter1.inc"), - ("-gen-asm-matcher", "lib/Target/X86/X86GenAsmMatcher.inc"), - ("-gen-dag-isel", "lib/Target/X86/X86GenDAGISel.inc"), - ("-gen-fast-isel", "lib/Target/X86/X86GenFastISel.inc"), - ("-gen-global-isel", "lib/Target/X86/X86GenGlobalISel.inc"), - ("-gen-callingconv", "lib/Target/X86/X86GenCallingConv.inc"), - ("-gen-subtarget", "lib/Target/X86/X86GenSubtargetInfo.inc"), - ("-gen-x86-fold-tables -asmwriternum=1", "lib/Target/X86/X86GenFoldTables.inc"), - ("-gen-x86-instr-mapping", "lib/Target/X86/X86GenInstrMapping.inc"), - ("-gen-exegesis", "lib/Target/X86/X86GenExegesis.inc"), - ("-gen-x86-mnemonic-tables -asmwriternum=1", "lib/Target/X86/X86GenMnemonicTables.inc"), - ], - }, - { - "name": "XCore", - "short_name": "XCore", - "tbl_outs": [ - ("-gen-asm-writer", "lib/Target/XCore/XCoreGenAsmWriter.inc"), - ("-gen-callingconv", "lib/Target/XCore/XCoreGenCallingConv.inc"), - ("-gen-dag-isel", "lib/Target/XCore/XCoreGenDAGISel.inc"), - ("-gen-disassembler", "lib/Target/XCore/XCoreGenDisassemblerTables.inc"), - ("-gen-instr-info", "lib/Target/XCore/XCoreGenInstrInfo.inc"), - ("-gen-register-info", "lib/Target/XCore/XCoreGenRegisterInfo.inc"), - ("-gen-subtarget", "lib/Target/XCore/XCoreGenSubtargetInfo.inc"), - ], - }, -] if lib["name"] in llvm_targets] - -cc_library( - name = "x86_target_layering_problem_hdrs", - textual_hdrs = ["lib/Target/X86/X86InstrInfo.h"], -) - -filegroup( - name = "common_target_td_sources", - srcs = glob([ - "include/llvm/CodeGen/*.td", - "include/llvm/Frontend/Directive/*.td", - "include/llvm/IR/Intrinsics*.td", - "include/llvm/TableGen/*.td", - "include/llvm/Target/*.td", - "include/llvm/Target/GlobalISel/*.td", - ]), -) - -gentbl( - name = "amdgpu_isel_target_gen", - strip_include_prefix = "lib/Target/AMDGPU", - tbl_outs = [ - ("-gen-global-isel", "lib/Target/AMDGPU/AMDGPUGenGlobalISel.inc"), - ("-gen-global-isel-combiner -combiners=AMDGPUPreLegalizerCombiner", "lib/Target/AMDGPU/AMDGPUGenPreLegalizeGICombiner.inc"), - ("-gen-global-isel-combiner -combiners=AMDGPUPostLegalizerCombiner", "lib/Target/AMDGPU/AMDGPUGenPostLegalizeGICombiner.inc"), - ("-gen-global-isel-combiner -combiners=AMDGPURegBankCombiner", "lib/Target/AMDGPU/AMDGPUGenRegBankGICombiner.inc"), - ], - tblgen = ":llvm-tblgen", - td_file = "lib/Target/AMDGPU/AMDGPUGISel.td", - td_srcs = [ - ":common_target_td_sources", - ] + glob([ - "lib/Target/AMDGPU/*.td", - ]), -) - -gentbl( - name = "r600_target_gen", - strip_include_prefix = "lib/Target/AMDGPU", - tbl_outs = [ - ("-gen-asm-writer", "lib/Target/AMDGPU/R600GenAsmWriter.inc"), - ("-gen-callingconv", "lib/Target/AMDGPU/R600GenCallingConv.inc"), - ("-gen-dag-isel", "lib/Target/AMDGPU/R600GenDAGISel.inc"), - ("-gen-dfa-packetizer", "lib/Target/AMDGPU/R600GenDFAPacketizer.inc"), - ("-gen-instr-info", "lib/Target/AMDGPU/R600GenInstrInfo.inc"), - ("-gen-emitter", "lib/Target/AMDGPU/R600GenMCCodeEmitter.inc"), - ("-gen-register-info", "lib/Target/AMDGPU/R600GenRegisterInfo.inc"), - ("-gen-subtarget", "lib/Target/AMDGPU/R600GenSubtargetInfo.inc"), - ], - tblgen = ":llvm-tblgen", - td_file = "lib/Target/AMDGPU/R600.td", - td_srcs = [ - ":common_target_td_sources", - ] + glob([ - "lib/Target/AMDGPU/*.td", - ]), -) - -gentbl( - name = "riscv_isel_target_gen", - strip_include_prefix = "lib/Target/RISCV", - tbl_outs = [ - ("-gen-global-isel", "lib/Target/RISCV/RISCVGenGlobalISel.inc"), - ("-gen-global-isel-combiner -combiners=RISCVO0PreLegalizerCombiner", "lib/Target/RISCV/RISCVGenO0PreLegalizeGICombiner.inc"), - ("-gen-global-isel-combiner -combiners=RISCVPostLegalizerCombiner", "lib/Target/RISCV/RISCVGenPostLegalizeGICombiner.inc"), - ("-gen-global-isel-combiner -combiners=RISCVPreLegalizerCombiner", "lib/Target/RISCV/RISCVGenPreLegalizeGICombiner.inc"), - ], - tblgen = ":llvm-tblgen", - td_file = "lib/Target/RISCV/RISCVGISel.td", - td_srcs = [ - ":common_target_td_sources", - ] + glob([ - "lib/Target/RISCV/**/*.td", - ]), -) - -[[ - [gentbl( - name = target["name"] + "CommonTableGen", - strip_include_prefix = "lib/Target/" + target["name"], - tbl_outs = target["tbl_outs"], - tblgen = ":llvm-tblgen", - # MSVC isn't happy with long string literals, while other compilers - # which support them get significant compile time improvements with - # them enabled. Ideally this flag would only be enabled on Windows via - # a select() on `@platforms//os:windows,`, but that would - # require refactoring gentbl from a macro into a rule. - # TODO(#92): Refactor gentbl to support this use - tblgen_args = "--long-string-literals=0", - td_file = "lib/Target/" + target["name"] + "/" + target["short_name"] + ".td", - td_srcs = [ - ":common_target_td_sources", - ] + glob( - [ - "lib/Target/" + target["name"] + "/*.td", - "lib/Target/" + target["name"] + "/GISel/*.td", - ], - allow_empty = True, - ), - deps = target.get("tbl_deps", []), - )], - [cc_library( - name = target["name"] + "Info", - srcs = ["lib/Target/" + target["name"] + "/TargetInfo/" + target["name"] + "TargetInfo.cpp"], - hdrs = glob(["lib/Target/" + target["name"] + "/TargetInfo/*.h"]), - copts = llvm_copts, - # Workaround for https://github.com/bazelbuild/bazel/issues/3828 - # TODO(gcmn): Remove this when upgrading to a Bazel version containing - # https://github.com/bazelbuild/bazel/commit/e3b7e17b05f1 - includes = ["lib/Target/" + target["name"]], - strip_include_prefix = "lib/Target/" + target["name"], - deps = [ - ":" + target["name"] + "CommonTableGen", - ":MC", - ":Support", - ":Target", - ], - )], - # We cannot separate the `Utils` and `MCTargetDesc` sublibraries of - # a number of targets due to crisscrossing inclusion of headers. - [cc_library( - name = target["name"] + "UtilsAndDesc", - srcs = glob( - [ - "lib/Target/" + target["name"] + "/MCTargetDesc/*.cpp", - "lib/Target/" + target["name"] + "/Utils/*.cpp", - - # We have to include these headers here as well as in the `hdrs` - # below to allow the `.cpp` files to use file-relative-inclusion to - # find them, even though consumers of this library use inclusion - # relative to the target with the `strip_includes_prefix` of this - # library. This mixture is likely incompatible with header modules. - "lib/Target/" + target["name"] + "/MCTargetDesc/*.h", - "lib/Target/" + target["name"] + "/Utils/*.h", - ], - allow_empty = True, - ), - hdrs = glob( - [ - "lib/Target/" + target["name"] + "/MCTargetDesc/*.h", - "lib/Target/" + target["name"] + "/Utils/*.h", - - # This a bit of a hack to allow us to expose common, internal - # target header files to other libraries within the target via - # target-relative includes. This usage of headers is inherently - # non-modular as there is a mixture of target-relative inclusion - # using this rule and file-relative inclusion using the repeated - # listing of these headers in the `srcs` of subsequent rules. - "lib/Target/" + target["name"] + "/*.h", - - # FIXME: The entries below should be `textual_hdrs` instead of - # `hdrs`, but unfortunately that doesn't work with - # `strip_include_prefix`: - # https://github.com/bazelbuild/bazel/issues/12424 - # - # Once that issue is fixed and released, we can switch this to - # `textual_hdrs` and remove the feature disabling the various Bazel - # features (both current and under-development) that motivated the - # distinction between these two. - "lib/Target/" + target["name"] + "/*.def", - "lib/Target/" + target["name"] + "/*.inc", - "lib/Target/" + target["name"] + "/MCTargetDesc/*.def", - ], - allow_empty = True, - ), - copts = llvm_copts, - features = [ - "-parse_headers", - "-header_modules", - "-layering_check", - ], - strip_include_prefix = "lib/Target/" + target["name"], - deps = [ - ":BinaryFormat", - ":CodeGen", - ":CodeGenTypes", - ":Core", - ":DebugInfoCodeView", - ":MC", - ":MCDisassembler", - ":Support", - ":Target", - ":config", - ":" + target["name"] + "CommonTableGen", - ":" + target["name"] + "Info", - ], - )], - [cc_library( - name = target["name"] + "CodeGen", - srcs = glob( - [ - "lib/Target/" + target["name"] + "/GISel/*.cpp", - "lib/Target/" + target["name"] + "/GISel/*.h", - "lib/Target/" + target["name"] + "/*.cpp", - "lib/Target/" + target["name"] + "/*.h", - ], - allow_empty = True, - ), - hdrs = ["lib/Target/" + target["name"] + "/" + target["short_name"] + ".h"], - copts = llvm_copts, - features = ["-layering_check"], - strip_include_prefix = "lib/Target/" + target["name"], - textual_hdrs = glob( - [ - "lib/Target/" + target["name"] + "/*.def", - "lib/Target/" + target["name"] + "/*.inc", - ], - allow_empty = True, - ), - deps = [ - ":Analysis", - ":BinaryFormat", - ":CFGuard", - ":CodeGen", - ":CodeGenTypes", - ":Core", - ":IPO", - ":MC", - ":Passes", # TODO(chandlerc): Likely a layering violation. - ":ProfileData", - ":Scalar", - ":Support", - ":Target", - ":TransformUtils", - ":Vectorize", - ":config", - ":" + target["name"] + "CommonTableGen", - ":" + target["name"] + "Info", - ":" + target["name"] + "UtilsAndDesc", - ], - )], - [cc_library( - name = target["name"] + "AsmParser", - srcs = glob( - [ - "lib/Target/" + target["name"] + "/AsmParser/*.cpp", - "lib/Target/" + target["name"] + "/AsmParser/*.h", - ], - allow_empty = True, - ), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":CodeGenTypes", - ":MC", - ":MCParser", - ":Support", - ":Target", - ":TargetParser", - ":" + target["name"] + "CodeGen", - ":" + target["name"] + "CommonTableGen", - ":" + target["name"] + "Info", - ":" + target["name"] + "UtilsAndDesc", - ], - )], - # This target is a bit of a hack to allow us to expose internal - # disassembler header files via internal target-relative include paths. - # This usage of headers is inherently non-modular as there is a mixture of - # target-relative inclusion using this rule and same-directory inclusion - # using the repeated listing of these headers in the `srcs` below. - [cc_library( - name = target["name"] + "DisassemblerInternalHeaders", - # FIXME: This should be `textual_hdrs` instead of `hdrs`, but - # unfortunately that doesn't work with `strip_include_prefix`: - # https://github.com/bazelbuild/bazel/issues/12424 - # - # Once that issue is fixed and released, we can switch this to - # `textual_hdrs` and remove the feature disabling the various Bazel - # features (both current and under-development) that motivated the - # distinction between these two. - hdrs = glob( - [ - "lib/Target/" + target["name"] + "/Disassembler/*.h", - ], - allow_empty = True, - ), - features = [ - "-parse_headers", - "-header_modules", - ], - strip_include_prefix = "lib/Target/" + target["name"], - )], - [cc_library( - name = target["name"] + "Disassembler", - srcs = glob( - [ - "lib/Target/" + target["name"] + "/Disassembler/*.cpp", - "lib/Target/" + target["name"] + "/Disassembler/*.c", - "lib/Target/" + target["name"] + "/Disassembler/*.h", - ], - allow_empty = True, - ), - copts = llvm_copts, - features = ["-layering_check"], - deps = [ - ":CodeGenTypes", - ":Core", - ":MC", - ":MCDisassembler", - ":Support", - ":Target", - ":" + target["name"] + "CodeGen", - ":" + target["name"] + "DisassemblerInternalHeaders", - ":" + target["name"] + "CommonTableGen", - ":" + target["name"] + "UtilsAndDesc", - ], - )], - [cc_library( - name = target["name"] + "TargetMCA", - srcs = glob( - [ - "lib/Target/" + target["name"] + "/MCA/*.cpp", - "lib/Target/" + target["name"] + "/MCA/*.c", - "lib/Target/" + target["name"] + "/MCA/*.h", - ], - allow_empty = True, - ), - copts = llvm_copts, - features = ["-layering_check"], - deps = [ - ":CodeGenTypes", - ":MC", - ":MCA", - ":MCParser", - ":Support", - ":" + target["name"] + "DisassemblerInternalHeaders", - ":" + target["name"] + "Info", - ":" + target["name"] + "UtilsAndDesc", - ], - )], -] for target in llvm_target_lib_list] - -cc_library( - name = "AllTargetsCodeGens", - copts = llvm_copts, - deps = [ - target["name"] + "CodeGen" - for target in llvm_target_lib_list - ], -) - -cc_library( - name = "AllTargetsAsmParsers", - copts = llvm_copts, - deps = [ - target["name"] + "AsmParser" - for target in llvm_target_lib_list - ], -) - -cc_library( - name = "AllTargetsDisassemblers", - copts = llvm_copts, - deps = [ - target["name"] + "Disassembler" - for target in llvm_target_lib_list - ], -) - -cc_library( - name = "AllTargetsMCAs", - copts = llvm_copts, - deps = [ - target["name"] + "TargetMCA" - for target in llvm_target_lib_list - ], -) - -cc_library( - name = "pass_registry_def", - copts = llvm_copts, - textual_hdrs = ["lib/Passes/PassRegistry.def"], -) - -cc_library( - name = "Passes", - srcs = glob([ - "lib/Passes/*.cpp", - ]), - hdrs = glob([ - "include/llvm/Passes/*.h", - "include/llvm/Passes/*.def", - "include/llvm/Passes/*.inc", - ]) + ["include/llvm-c/Transforms/PassBuilder.h"], - copts = llvm_copts, - deps = [ - ":AggressiveInstCombine", - ":Analysis", - ":CFGuard", - ":CodeGen", - ":Core", - ":Coroutines", - ":Demangle", - ":HipStdPar", - ":IPO", - ":IRPrinter", - ":InstCombine", - ":Instrumentation", - ":MC", - ":ObjCARC", - ":Scalar", - ":Support", - ":Target", - ":TransformUtils", - ":Vectorize", - ":common_transforms", - ":config", - ":pass_registry_def", - ], -) - -cc_library( - name = "LTO", - srcs = glob([ - "lib/LTO/*.cpp", - ]), - hdrs = glob([ - "include/llvm/LTO/*.h", - "include/llvm/LTO/legacy/*.h", - ]) + [ - "include/llvm-c/lto.h", - ], - copts = llvm_copts, - deps = [ - ":Analysis", - ":BitReader", - ":BitWriter", - ":CodeGen", - ":CodeGenTypes", - ":Core", - ":IPO", - ":IRPrinter", - ":IRReader", - ":Linker", - ":MC", - ":MCParser", - ":ObjCARC", - ":Object", - ":Passes", - ":Remarks", - ":Scalar", - ":Support", - ":Target", - ":TargetParser", - ":TransformUtils", - ":common_transforms", - ":config", - ], -) - -cc_library( - name = "ExecutionEngine", - srcs = glob([ - "lib/ExecutionEngine/*.cpp", - "lib/ExecutionEngine/RuntimeDyld/*.cpp", - "lib/ExecutionEngine/RuntimeDyld/*.h", - "lib/ExecutionEngine/RuntimeDyld/Targets/*.cpp", - "lib/ExecutionEngine/RuntimeDyld/Targets/*.h", - ]), - hdrs = glob( - [ - "include/llvm/ExecutionEngine/*.h", - ], - exclude = [ - "include/llvm/ExecutionEngine/MCJIT*.h", - "include/llvm/ExecutionEngine/OProfileWrapper.h", - ], - ) + [ - "include/llvm-c/ExecutionEngine.h", - ], - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":CodeGen", - ":Core", - ":DebugInfo", - ":MC", - ":MCDisassembler", - ":Object", - ":OrcTargetProcess", - ":Passes", - ":Support", - ":Target", - ":TargetParser", - ":config", - ], -) - -cc_library( - name = "Interpreter", - srcs = glob([ - "lib/ExecutionEngine/Interpreter/*.cpp", - "lib/ExecutionEngine/Interpreter/*.h", - ]), - hdrs = ["include/llvm/ExecutionEngine/Interpreter.h"], - copts = llvm_copts, - deps = [ - ":CodeGen", - ":Core", - ":ExecutionEngine", - ":Support", - ":Target", - ":config", - ], -) - -gentbl( - name = "JITLinkTableGen", - strip_include_prefix = "lib/ExecutionEngine/JITLink", - tbl_outs = [( - "-gen-opt-parser-defs", - "lib/ExecutionEngine/JITLink/COFFOptions.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "lib/ExecutionEngine/JITLink/COFFOptions.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "JITLink", - srcs = glob([ - "lib/ExecutionEngine/JITLink/*.cpp", - "lib/ExecutionEngine/JITLink/*.h", - ]), - hdrs = glob([ - "include/llvm/ExecutionEngine/JITLink/*.h", - "include/llvm/ExecutionEngine/Orc/*.h", - ]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":ExecutionEngine", - ":JITLinkTableGen", - ":Object", - ":Option", - ":OrcShared", - ":OrcTargetProcess", - ":Support", - ":TargetParser", - ":config", - ], -) - -cc_library( - name = "MCJIT", - srcs = glob([ - "lib/ExecutionEngine/MCJIT/*.cpp", - "lib/ExecutionEngine/MCJIT/*.h", - ]), - hdrs = glob(["include/llvm/ExecutionEngine/MCJIT*.h"]), - copts = llvm_copts, - deps = [ - ":CodeGen", - ":Core", - ":ExecutionEngine", - ":MC", - ":Object", - ":Support", - ":Target", - ":config", - ], -) - -cc_library( - name = "OrcJIT", - srcs = glob([ - "lib/ExecutionEngine/Orc/*.cpp", - ]), - hdrs = glob([ - "include/llvm/ExecutionEngine/Orc/*.h", - ]) + [ - "include/llvm-c/LLJIT.h", - "include/llvm-c/Orc.h", - "include/llvm-c/OrcEE.h", - ], - copts = llvm_copts, - linkopts = select({ - "@platforms//os:android": [], - "@platforms//os:windows": [], - "@platforms//os:freebsd": [], - "@platforms//os:macos": [], - "//conditions:default": [ - "-lrt", - ], - }), - deps = [ - ":Analysis", - ":BinaryFormat", - ":BitReader", - ":BitWriter", - ":Core", - ":DebugInfoDWARF", - ":ExecutionEngine", - ":JITLink", - ":MC", - ":MCDisassembler", - ":Object", - ":OrcShared", - ":OrcTargetProcess", - ":Passes", - ":Support", - ":Target", - ":TargetParser", - ":TransformUtils", - ":WindowsDriver", - ":config", - ], -) - -cc_library( - name = "OrcShared", - srcs = glob([ - "lib/ExecutionEngine/Orc/Shared/*.cpp", - ]), - hdrs = glob([ - "include/llvm/ExecutionEngine/Orc/Shared/*.h", - ]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":CodeGen", - ":Core", - ":DebugInfo", - ":MC", - ":MCDisassembler", - ":Object", - ":Passes", - ":Support", - ":Target", - ":config", - ], -) - -cc_library( - name = "OrcDebugging", - srcs = glob([ - "lib/ExecutionEngine/Orc/Debugging/*.cpp", - ]), - hdrs = glob([ - "include/llvm/ExecutionEngine/Orc/Debugging/*.h", - ]) + ["include/llvm-c/LLJITUtils.h"], - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":DebugInfo", - ":JITLink", - ":OrcJIT", - ":OrcShared", - ":Support", - ":TargetParser", - ], -) - -cc_library( - name = "OrcTargetProcess", - srcs = glob([ - "lib/ExecutionEngine/Orc/TargetProcess/*.cpp", - "lib/ExecutionEngine/Orc/TargetProcess/*.h", - ]), - hdrs = glob([ - "include/llvm/ExecutionEngine/Orc/TargetProcess/*.h", - ]), - copts = llvm_copts, - linkopts = select({ - "@platforms//os:android": [], - "@platforms//os:windows": [], - "@platforms//os:freebsd": [], - "@platforms//os:macos": [], - "//conditions:default": [ - "-lrt", - ], - }), - deps = [ - ":BinaryFormat", - ":CodeGen", - ":Core", - ":DebugInfo", - ":MC", - ":MCDisassembler", - ":Object", - ":OrcShared", - ":Passes", - ":Support", - ":Target", - ":TargetParser", - ":config", - ], -) - -cc_library( - name = "DWARFLinker", - srcs = glob([ - "lib/DWARFLinker/Classic/*.cpp", - ]), - hdrs = glob(["include/llvm/DWARFLinker/Classic/*.h"]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":CodeGen", - ":CodeGenTypes", - ":DWARFLinkerBase", - ":DebugInfoDWARF", - ":MC", - ":Support", - ":Target", - ":TargetParser", - ], -) - -cc_library( - name = "DWARFLinkerBase", - srcs = glob([ - "lib/DWARFLinker/*.cpp", - ]), - hdrs = glob(["include/llvm/DWARFLinker/*.h"]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":CodeGen", - ":DebugInfoDWARF", - ":Support", - ":Target", - ], -) - -cc_library( - name = "DWARFLinkerParallel", - srcs = glob([ - "lib/DWARFLinker/Parallel/*.cpp", - "lib/DWARFLinker/Parallel/*.h", - ]), - hdrs = glob(["include/llvm/DWARFLinker/Parallel/*.h"]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":CodeGen", - ":DWARFLinkerBase", - ":DebugInfoDWARF", - ":MC", - ":Object", - ":Support", - ":Target", - ":TargetParser", - ], -) - -gentbl( - name = "DllOptionsTableGen", - strip_include_prefix = "lib/ToolDrivers/llvm-dlltool", - tbl_outs = [( - "-gen-opt-parser-defs", - "lib/ToolDrivers/llvm-dlltool/Options.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "lib/ToolDrivers/llvm-dlltool/Options.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "DlltoolDriver", - srcs = glob(["lib/ToolDrivers/llvm-dlltool/*.cpp"]), - hdrs = glob(["include/llvm/ToolDrivers/llvm-dlltool/*.h"]), - copts = llvm_copts, - deps = [ - ":DllOptionsTableGen", - ":Object", - ":Option", - ":Support", - ":TargetParser", - ], -) - -gentbl( - name = "LibOptionsTableGen", - strip_include_prefix = "lib/ToolDrivers/llvm-lib", - tbl_outs = [( - "-gen-opt-parser-defs", - "lib/ToolDrivers/llvm-lib/Options.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "lib/ToolDrivers/llvm-lib/Options.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "LibDriver", - srcs = glob(["lib/ToolDrivers/llvm-lib/*.cpp"]), - hdrs = glob(["include/llvm/ToolDrivers/llvm-lib/*.h"]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":BitReader", - ":LibOptionsTableGen", - ":Object", - ":Option", - ":Support", - ], -) - -cc_library( - name = "InterfaceStub", - srcs = glob([ - "lib/InterfaceStub/*.cpp", - ]), - hdrs = glob([ - "include/llvm/InterfaceStub/*.h", - ]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":MC", - ":Object", - ":Support", - ":TargetParser", - ":config", - ], -) - -cc_library( - name = "WindowsDriver", - srcs = glob([ - "lib/WindowsDriver/*.cpp", - ]), - hdrs = glob([ - "include/llvm/WindowsDriver/*.h", - ]), - copts = llvm_copts, - deps = [ - ":Option", - ":Support", - ":TargetParser", - ], -) - -cc_library( - name = "WindowsManifest", - srcs = glob([ - "lib/WindowsManifest/*.cpp", - ]), - hdrs = glob([ - "include/llvm/WindowsManifest/*.h", - ]), - copts = llvm_copts, - deps = [ - ":Support", - ":config", - ], -) - -cc_library( - name = "MCA", - srcs = glob([ - "lib/MCA/**/*.cpp", - ]), - hdrs = glob([ - "include/llvm/MCA/**/*.h", - ]), - copts = llvm_copts, - deps = [ - ":MC", - ":MCDisassembler", - ":Object", - ":Support", - ], -) - -cc_library( - name = "MCAApplication", - srcs = glob([ - "tools/llvm-mca/Views/*.cpp", - ]) + [ - mca_source - for mca_source in glob(["tools/llvm-mca/*.cpp"]) - if mca_source != "tools/llvm-mca/llvm-mca.cpp" - ], - hdrs = glob([ - "tools/llvm-mca/*.h", - "tools/llvm-mca/Views/*.h", - ]), - strip_include_prefix = "tools/llvm-mca", - deps = [ - ":MC", - ":MCA", - ":MCParser", - ":Support", - ":TargetParser", - ], -) - -cc_library( - name = "XRay", - srcs = glob([ - "lib/XRay/*.cpp", - ]), - hdrs = glob(["include/llvm/XRay/*.h"]), - copts = llvm_copts, - deps = [ - ":Object", - ":Support", - ":TargetParser", - ], -) - -# A flag to pick which `pfm` to use for Exegesis. -# Usage: `--@llvm-project//llvm:pfm=`. -# Flag documentation: https://bazel.build/extending/config -string_flag( - name = "pfm", - build_setting_default = "external", - values = [ - "disable", # Don't include pfm at all - "external", # Build pfm from source - "system", # Use system pfm (non hermetic) - ], -) - -config_setting( - name = "pfm_disable", - flag_values = {":pfm": "disable"}, -) - -config_setting( - name = "pfm_external", - flag_values = {":pfm": "external"}, -) - -config_setting( - name = "pfm_system", - flag_values = {":pfm": "system"}, -) - -cc_library( - name = "maybe_pfm", - # We want dependencies of this library to have -DHAVE_LIBPFM conditionally - # defined, so we set `defines` instead of `copts`. - defines = select({ - ":pfm_external": ["HAVE_LIBPFM=1"], - ":pfm_system": ["HAVE_LIBPFM=1"], - "//conditions:default": [], - }), - deps = select({ - ":pfm_external": ["@pfm//:pfm_external"], - ":pfm_system": ["@pfm//:pfm_system"], - "//conditions:default": [], - }), -) - -cc_library( - name = "Exegesis", - srcs = glob( - [ - "tools/llvm-exegesis/lib/*.cpp", - # We have to include these headers here as well as in the `hdrs` below - # to allow the `.cpp` files to use file-relative-inclusion to find - # them, even though consumers of this library use inclusion relative to - # `tools/llvm-exegesis/lib` with the `strip_includes_prefix` of this - # library. This mixture appears to be incompatible with header modules. - "tools/llvm-exegesis/lib/*.h", - ] + [ - "tools/llvm-exegesis/lib/{}/*.cpp".format(t) - for t in llvm_target_exegesis - ] + [ - "tools/llvm-exegesis/lib/{}/*.h".format(t) - for t in llvm_target_exegesis - ], - allow_empty = True, - ), - hdrs = glob(["tools/llvm-exegesis/lib/*.h"]), - copts = llvm_copts, - features = [ - "-header_modules", - "-layering_check", - ], - strip_include_prefix = "tools/llvm-exegesis/lib", - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":CodeGen", - ":CodeGenTypes", - ":Core", - ":ExecutionEngine", - ":MC", - ":MCA", - ":MCDisassembler", - ":Object", - ":ObjectYAML", - ":OrcJIT", - ":Support", - ":Target", - ":config", - ] + select({ - "@platforms//os:linux": [":maybe_pfm"], - "//conditions:default": [], - }), -) - -################################################################################ -# LLVM toolchain and development binaries - -gentbl( - name = "DsymutilTableGen", - strip_include_prefix = "tools/dsymutil", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/dsymutil/Options.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/dsymutil/Options.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "dsymutil-lib", - srcs = glob([ - "tools/dsymutil/*.cpp", - "tools/dsymutil/*.h", - ]), - copts = llvm_copts, - deps = [ - ":AllTargetsCodeGens", - ":BinaryFormat", - ":CodeGen", - ":CodeGenTypes", - ":DWARFLinker", - ":DWARFLinkerParallel", - ":DebugInfo", - ":DebugInfoDWARF", - ":DsymutilTableGen", - ":MC", - ":Object", - ":Option", - ":Remarks", - ":Support", - ":Target", - ":TargetParser", - ":config", - ":remark_linker", - ], -) - -llvm_driver_cc_binary( - name = "dsymutil", - stamp = 0, - deps = [":dsymutil-lib"], -) - -cc_binary( - name = "llc", - srcs = glob([ - "tools/llc/*.cpp", - "tools/llc/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":Analysis", - ":AsmParser", - ":BitReader", - ":CodeGen", - ":CodeGenTypes", - ":Core", - ":IRPrinter", - ":IRReader", - ":MC", - ":Passes", - ":Remarks", - ":Scalar", - ":Support", - ":Target", - ":TargetParser", - ":TransformUtils", - ], -) - -cc_binary( - name = "lli", - srcs = glob([ - "tools/lli/*.cpp", - "tools/lli/*.h", - ]), - copts = llvm_copts, - # ll scripts rely on symbols from dependent - # libraries being resolvable. - linkopts = select({ - "@platforms//os:windows": [], - "@platforms//os:macos": [], - "//conditions:default": [ - "-Wl,--undefined=_ZTIi", - "-Wl,--export-dynamic-symbol=_ZTIi", - "-Wl,--export-dynamic-symbol=__cxa_begin_catch", - "-Wl,--export-dynamic-symbol=__cxa_end_catch", - "-Wl,--export-dynamic-symbol=__gxx_personality_v0", - "-Wl,--export-dynamic-symbol=__cxa_allocate_exception", - "-Wl,--export-dynamic-symbol=__cxa_throw", - "-Wl,--export-dynamic-symbol=llvm_orc_registerJITLoaderGDBWrapper", - "-Wl,--export-dynamic-symbol=llvm_orc_registerEHFrameSectionWrapper", - "-Wl,--export-dynamic-symbol=llvm_orc_deregisterEHFrameSectionWrapper", - ], - }), - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":AsmParser", - ":BitReader", - ":CodeGen", - ":Core", - ":ExecutionEngine", - ":IRPrinter", - ":IRReader", - ":Instrumentation", - ":Interpreter", - ":MCJIT", - ":Object", - ":OrcDebugging", - ":OrcJIT", - ":OrcTargetProcess", - ":Support", - ":TargetParser", - ":config", - ], -) - -cc_library( - name = "llvm-ar-lib", - srcs = glob(["tools/llvm-ar/*.cpp"]), - copts = llvm_copts, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":BinaryFormat", - ":Core", - ":DlltoolDriver", - ":LibDriver", - ":Object", - ":Support", - ":TargetParser", - ], -) - -llvm_driver_cc_binary( - name = "llvm-ar", - stamp = 0, - deps = [":llvm-ar-lib"], -) - -# We need to run llvm-ar with different basenames to make it run with -# different behavior. -binary_alias( - name = "llvm-dlltool", - binary = ":llvm-ar", -) - -binary_alias( - name = "llvm-lib", - binary = ":llvm-ar", -) - -binary_alias( - name = "llvm-ranlib", - binary = ":llvm-ar", -) - -cc_binary( - name = "llvm-as", - srcs = glob([ - "tools/llvm-as/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":Analysis", - ":AsmParser", - ":BitWriter", - ":Core", - ":Support", - ], -) - -cc_binary( - name = "llvm-bcanalyzer", - srcs = glob([ - "tools/llvm-bcanalyzer/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":BitReader", - ":Support", - ], -) - -cc_binary( - name = "llvm-cat", - srcs = glob([ - "tools/llvm-cat/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":BitReader", - ":BitWriter", - ":Core", - ":IRPrinter", - ":IRReader", - ":Support", - ], -) - -cc_binary( - name = "llvm-cfi-verify", - srcs = glob([ - "tools/llvm-cfi-verify/*.cpp", - "tools/llvm-cfi-verify/lib/*.cpp", - "tools/llvm-cfi-verify/lib/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":AllTargetsDisassemblers", - ":BinaryFormat", - ":DebugInfoDWARF", - ":MC", - ":MCDisassembler", - ":MCParser", - ":Object", - ":Support", - ":Symbolize", - ], -) - -cc_binary( - name = "llvm-cov", - srcs = glob([ - "tools/llvm-cov/*.cpp", - "tools/llvm-cov/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":Coverage", - ":Debuginfod", - ":Instrumentation", - ":Object", - ":ProfileData", - ":Support", - ":TargetParser", - ":config", - ], -) - -gentbl( - name = "CvtResTableGen", - strip_include_prefix = "tools/llvm-cvtres", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-cvtres/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-cvtres/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_binary( - name = "llvm-cvtres", - srcs = glob([ - "tools/llvm-cvtres/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":BinaryFormat", - ":CvtResTableGen", - ":Object", - ":Option", - ":Support", - ], -) - -cc_binary( - name = "llvm-cxxdump", - srcs = glob([ - "tools/llvm-cxxdump/*.cpp", - "tools/llvm-cxxdump/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsCodeGens", - ":BitReader", - ":MC", - ":Object", - ":Support", - ], -) - -cc_binary( - name = "llvm-cxxmap", - srcs = glob([ - "tools/llvm-cxxmap/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":ProfileData", - ":Support", - ], -) - -gentbl( - name = "CxxfiltOptsTableGen", - strip_include_prefix = "tools/llvm-cxxfilt", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-cxxfilt/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-cxxfilt/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "llvm-cxxfilt-lib", - srcs = glob(["tools/llvm-cxxfilt/*.cpp"]), - copts = llvm_copts, - deps = [ - ":CxxfiltOptsTableGen", - ":Demangle", - ":Option", - ":Support", - ":TargetParser", - ], -) - -llvm_driver_cc_binary( - name = "llvm-cxxfilt", - stamp = 0, - deps = [":llvm-cxxfilt-lib"], -) - -cc_binary( - name = "llvm-debuginfo-analyzer", - srcs = glob([ - "tools/llvm-debuginfo-analyzer/*.cpp", - "tools/llvm-debuginfo-analyzer/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsCodeGens", - ":AllTargetsDisassemblers", - ":DebugInfoLogicalView", - ":Support", - ], -) - -cc_binary( - name = "llvm-debuginfod-find", - srcs = glob([ - "tools/llvm-debuginfod-find/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":BitReader", - ":Core", - ":Debuginfod", - ":Support", - ":Symbolize", - ], -) - -cc_binary( - name = "llvm-dis", - srcs = glob([ - "tools/llvm-dis/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":Analysis", - ":BitReader", - ":Core", - ":Support", - ], -) - -cc_binary( - name = "llvm-dwarfdump", - srcs = glob([ - "tools/llvm-dwarfdump/*.cpp", - "tools/llvm-dwarfdump/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsCodeGens", - ":BinaryFormat", - ":DebugInfo", - ":DebugInfoDWARF", - ":MC", - ":Object", - ":Support", - ":TargetParser", - ], -) - -gentbl( - name = "DwarfutilOptionsTableGen", - strip_include_prefix = "tools/llvm-dwarfutil", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-dwarfutil/Options.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-dwarfutil/Options.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_binary( - name = "llvm-dwarfutil", - srcs = glob([ - "tools/llvm-dwarfutil/*.cpp", - "tools/llvm-dwarfutil/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":CodeGenTypes", - ":DWARFLinker", - ":DWARFLinkerParallel", - ":DebugInfoDWARF", - ":DwarfutilOptionsTableGen", - ":MC", - ":ObjCopy", - ":Object", - ":Option", - ":Support", - ":Target", - ":TargetParser", - ], -) - -gentbl( - name = "DwpOptionsTableGen", - strip_include_prefix = "tools/llvm-dwp", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-dwp/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-dwp/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "llvm-dwp-lib", - srcs = glob(["tools/llvm-dwp/*.cpp"]), - copts = llvm_copts, - deps = [ - ":AllTargetsCodeGens", - ":DWP", - ":DwpOptionsTableGen", - ":MC", - ":Option", - ":Support", - ], -) - -llvm_driver_cc_binary( - name = "llvm-dwp", - stamp = 0, - deps = [":llvm-dwp-lib"], -) - -cc_binary( - name = "llvm-exegesis", - srcs = [ - "tools/llvm-exegesis/llvm-exegesis.cpp", - ], - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":AllTargetsDisassemblers", - ":CodeGenTypes", - ":Exegesis", - ":MC", - ":MCParser", - ":Object", - ":Support", - ":TargetParser", - ":config", - ], -) - -cc_binary( - name = "llvm-extract", - srcs = glob([ - "tools/llvm-extract/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AsmParser", - ":BitReader", - ":BitWriter", - ":Core", - ":IPO", - ":IRPrinter", - ":IRReader", - ":Passes", - ":Support", - ], -) - -gentbl( - name = "GSYMUtilOptionsTableGen", - strip_include_prefix = "tools/llvm-gsymutil", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-gsymutil/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-gsymutil/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "llvm-gsymutil-lib", - srcs = glob(["tools/llvm-gsymutil/*.cpp"]), - copts = llvm_copts, - deps = [ - ":AllTargetsCodeGens", - ":DebugInfo", - ":DebugInfoDWARF", - ":DebugInfoGSYM", - ":GSYMUtilOptionsTableGen", - ":MC", - ":Object", - ":Option", - ":Support", - ":Target", - ":TargetParser", - ], -) - -llvm_driver_cc_binary( - name = "llvm-gsymutil", - stamp = 0, - deps = [":llvm-gsymutil-lib"], -) - -gentbl( - name = "IfsOptionsTableGen", - strip_include_prefix = "tools/llvm-ifs", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-ifs/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-ifs/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "llvm-ifs-lib", - srcs = glob([ - "tools/llvm-ifs/*.cpp", - "tools/llvm-ifs/*.h", - ]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":IfsOptionsTableGen", - ":InterfaceStub", - ":ObjectYAML", - ":Option", - ":Support", - ":TargetParser", - ":TextAPI", - ], -) - -llvm_driver_cc_binary( - name = "llvm-ifs", - stamp = 0, - deps = [":llvm-ifs-lib"], -) - -cc_binary( - name = "llvm-jitlink", - srcs = glob([ - "tools/llvm-jitlink/*.cpp", - "tools/llvm-jitlink/*.h", - ]), - copts = llvm_copts, - # Make symbols from the standard library dynamically resolvable. - linkopts = select({ - "@platforms//os:windows": [], - "@platforms//os:macos": [], - "//conditions:default": [ - "-Wl,--undefined=_ZTIi", - "-Wl,--export-dynamic-symbol=_ZTIi", - "-Wl,--export-dynamic-symbol=__cxa_begin_catch", - "-Wl,--export-dynamic-symbol=__cxa_end_catch", - "-Wl,--export-dynamic-symbol=__gxx_personality_v0", - "-Wl,--export-dynamic-symbol=__cxa_allocate_exception", - "-Wl,--export-dynamic-symbol=__cxa_throw", - "-Wl,--export-dynamic-symbol=llvm_orc_registerJITLoaderGDBWrapper", - ], - }), - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":AllTargetsDisassemblers", - ":AsmParser", - ":BinaryFormat", - ":BitReader", - ":CodeGen", - ":ExecutionEngine", - ":MC", - ":MCDisassembler", - ":MCJIT", - ":Object", - ":OrcDebugging", - ":OrcJIT", - ":OrcShared", - ":OrcTargetProcess", - ":Support", - ":TargetParser", - ":config", - ], -) - -gentbl( - name = "LibtoolDarwinOptionsTableGen", - strip_include_prefix = "tools/llvm-libtool-darwin", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-libtool-darwin/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-libtool-darwin/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "llvm-libtool-darwin-lib", - srcs = glob([ - "tools/llvm-libtool-darwin/*.cpp", - "tools/llvm-libtool-darwin/*.h", - ]), - copts = llvm_copts, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":BinaryFormat", - ":Core", - ":LibtoolDarwinOptionsTableGen", - ":Object", - ":Option", - ":Support", - ":TextAPI", - ], -) - -llvm_driver_cc_binary( - name = "llvm-libtool-darwin", - stamp = 0, - deps = [":llvm-libtool-darwin-lib"], -) - -cc_binary( - name = "llvm-link", - srcs = glob([ - "tools/llvm-link/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AsmParser", - ":BinaryFormat", - ":BitReader", - ":BitWriter", - ":Core", - ":IPO", - ":IRPrinter", - ":IRReader", - ":Linker", - ":Object", - ":Support", - ":TransformUtils", - ], -) - -gentbl( - name = "LipoOptsTableGen", - strip_include_prefix = "tools/llvm-lipo", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-lipo/LipoOpts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-lipo/LipoOpts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "llvm-lipo-lib", - srcs = ["tools/llvm-lipo/llvm-lipo.cpp"], - copts = llvm_copts, - deps = [ - ":AllTargetsAsmParsers", - ":BinaryFormat", - ":Core", - ":LipoOptsTableGen", - ":Object", - ":Option", - ":Support", - ":TargetParser", - ":TextAPI", - ], -) - -llvm_driver_cc_binary( - name = "llvm-lipo", - stamp = 0, - deps = [":llvm-lipo-lib"], -) - -cc_binary( - name = "llvm-lto", - srcs = glob([ - "tools/llvm-lto/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":BitReader", - ":BitWriter", - ":CodeGen", - ":Core", - ":IRPrinter", - ":IRReader", - ":LTO", - ":Support", - ":Target", - ], -) - -cc_binary( - name = "llvm-lto2", - srcs = glob([ - "tools/llvm-lto2/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":BitReader", - ":CodeGen", - ":Core", - ":LTO", - ":Passes", - ":Remarks", - ":Support", - ], -) - -cc_binary( - name = "llvm-mc", - srcs = glob([ - "tools/llvm-mc/*.cpp", - "tools/llvm-mc/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":AllTargetsDisassemblers", - ":MC", - ":MCDisassembler", - ":MCParser", - ":Object", - ":Support", - ":TargetParser", - ], -) - -cc_binary( - name = "llvm-mca", - srcs = [ - "tools/llvm-mca/llvm-mca.cpp", - ], - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":AllTargetsDisassemblers", - ":AllTargetsMCAs", - ":MC", - ":MCA", - ":MCAApplication", - ":MCParser", - ":Support", - ":TargetParser", - ], -) - -gentbl( - name = "MlTableGen", - strip_include_prefix = "tools/llvm-ml", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-ml/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-ml/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "llvm-ml-lib", - srcs = glob([ - "tools/llvm-ml/*.cpp", - "tools/llvm-ml/*.h", - ]), - copts = llvm_copts, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":AllTargetsDisassemblers", - ":MC", - ":MCDisassembler", - ":MCParser", - ":MlTableGen", - ":Option", - ":Support", - ":TargetParser", - ], -) - -llvm_driver_cc_binary( - name = "llvm-ml", - stamp = 0, - deps = [":llvm-ml-lib"], -) - -cc_binary( - name = "llvm-modextract", - srcs = glob([ - "tools/llvm-modextract/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":BitReader", - ":BitWriter", - ":IRPrinter", - ":IRReader", - ":Support", - ], -) - -gentbl( - name = "MtTableGen", - strip_include_prefix = "tools/llvm-mt", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-mt/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-mt/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "llvm-mt-lib", - srcs = glob(["tools/llvm-mt/*.cpp"]), - copts = llvm_copts, - deps = [ - ":MtTableGen", - ":Option", - ":Support", - ":WindowsManifest", - ], -) - -llvm_driver_cc_binary( - name = "llvm-mt", - stamp = 0, - deps = [":llvm-mt-lib"], -) - -gentbl( - name = "NmOptsTableGen", - strip_include_prefix = "tools/llvm-nm", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-nm/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-nm/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "llvm-nm-lib", - srcs = glob(["tools/llvm-nm/*.cpp"]), - copts = llvm_copts, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":BinaryFormat", - ":BitReader", - ":Core", - ":Demangle", - ":NmOptsTableGen", - ":Object", - ":Option", - ":Support", - ":Symbolize", - ":TargetParser", - ], -) - -llvm_driver_cc_binary( - name = "llvm-nm", - stamp = 0, - deps = [":llvm-nm-lib"], -) - -gentbl( - name = "llvm-objcopy-opts", - strip_include_prefix = "tools/llvm-objcopy", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-objcopy/ObjcopyOpts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-objcopy/ObjcopyOpts.td", - td_srcs = [ - "include/llvm/Option/OptParser.td", - "tools/llvm-objcopy/CommonOpts.td", - ], -) - -gentbl( - name = "llvm-installnametool-opts", - strip_include_prefix = "tools/llvm-objcopy", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-objcopy/InstallNameToolOpts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-objcopy/InstallNameToolOpts.td", - td_srcs = [ - "include/llvm/Option/OptParser.td", - "tools/llvm-objcopy/CommonOpts.td", - ], -) - -gentbl( - name = "llvm-strip-opts", - strip_include_prefix = "tools/llvm-objcopy", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-objcopy/StripOpts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-objcopy/StripOpts.td", - td_srcs = [ - "include/llvm/Option/OptParser.td", - "tools/llvm-objcopy/CommonOpts.td", - ], -) - -gentbl( - name = "llvm-bitcode-strip-opts", - strip_include_prefix = "tools/llvm-objcopy", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-objcopy/BitcodeStripOpts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-objcopy/BitcodeStripOpts.td", - td_srcs = [ - "include/llvm/Option/OptParser.td", - "tools/llvm-objcopy/CommonOpts.td", - ], -) - -cc_binary( - name = "llvm-stress", - srcs = glob([ - "tools/llvm-stress/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":Core", - ":Support", - ], -) - -cc_library( - name = "llvm-objcopy-lib", - srcs = glob([ - "tools/llvm-objcopy/*.cpp", - "tools/llvm-objcopy/*.h", - ]), - copts = llvm_copts, - deps = [ - ":BinaryFormat", - ":MC", - ":ObjCopy", - ":Object", - ":ObjectYAML", - ":Option", - ":Support", - ":Target", - ":TargetParser", - ":llvm-bitcode-strip-opts", - ":llvm-installnametool-opts", - ":llvm-objcopy-opts", - ":llvm-strip-opts", - ], -) - -llvm_driver_cc_binary( - name = "llvm-objcopy", - stamp = 0, - deps = [":llvm-objcopy-lib"], -) - -binary_alias( - name = "llvm-strip", - binary = ":llvm-objcopy", -) - -binary_alias( - name = "llvm-bitcode-strip", - binary = ":llvm-objcopy", -) - -binary_alias( - name = "llvm-install-name-tool", - binary = ":llvm-objcopy", -) - -cc_library( - name = "llvm-objdump-lib", - srcs = glob([ - "tools/llvm-objdump/*.cpp", - "tools/llvm-objdump/*.h", - ]), - copts = llvm_copts, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":AllTargetsDisassemblers", - ":BinaryFormat", - ":CodeGen", - ":DebugInfo", - ":DebugInfoDWARF", - ":Debuginfod", - ":Demangle", - ":MC", - ":MCDisassembler", - ":ObjdumpOptsTableGen", - ":Object", - ":Option", - ":OtoolOptsTableGen", - ":Support", - ":Symbolize", - ":TargetParser", - ":config", - ], -) - -llvm_driver_cc_binary( - name = "llvm-objdump", - stamp = 0, - deps = [":llvm-objdump-lib"], -) - -gentbl( - name = "ObjdumpOptsTableGen", - strip_include_prefix = "tools/llvm-objdump", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-objdump/ObjdumpOpts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-objdump/ObjdumpOpts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -binary_alias( - name = "llvm-otool", - binary = ":llvm-objdump", -) - -gentbl( - name = "OtoolOptsTableGen", - strip_include_prefix = "tools/llvm-objdump", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-objdump/OtoolOpts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-objdump/OtoolOpts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_binary( - name = "llvm-opt-report", - srcs = glob([ - "tools/llvm-opt-report/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsCodeGens", - ":Demangle", - ":Remarks", - ":Support", - ], -) - -cc_binary( - name = "llvm-pdbutil", - srcs = glob([ - "tools/llvm-pdbutil/*.cpp", - "tools/llvm-pdbutil/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":BinaryFormat", - ":DebugInfoBTF", - ":DebugInfoCodeView", - ":DebugInfoMSF", - ":DebugInfoPDB", - ":Object", - ":ObjectYAML", - ":Support", - ":config", - ], -) - -cc_library( - name = "llvm-profdata-lib", - srcs = glob(["tools/llvm-profdata/*.cpp"]), - copts = llvm_copts, - deps = [ - ":Core", - ":Object", - ":ProfileData", - ":Support", - ], -) - -llvm_driver_cc_binary( - name = "llvm-profdata", - stamp = 0, - deps = [":llvm-profdata-lib"], -) - -cc_binary( - name = "llvm-profgen", - srcs = glob([ - "tools/llvm-profgen/*.cpp", - "tools/llvm-profgen/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsCodeGens", - ":AllTargetsDisassemblers", - ":Core", - ":DebugInfoDWARF", - ":Demangle", - ":IPO", - ":MC", - ":MCDisassembler", - ":Object", - ":ProfileData", - ":Support", - ":Symbolize", - ":TargetParser", - ], -) - -gentbl( - name = "RcTableGen", - strip_include_prefix = "tools/llvm-rc", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-rc/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-rc/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -gentbl( - name = "WindresTableGen", - strip_include_prefix = "tools/llvm-rc", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-rc/WindresOpts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-rc/WindresOpts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -# Workaround inability to put `.def` files into `srcs` with a library. -cc_library( - name = "llvm-rc-defs-lib", - textual_hdrs = glob(["tools/llvm-rc/*.def"]), -) - -cc_library( - name = "llvm-rc-lib", - srcs = glob([ - "tools/llvm-rc/*.cpp", - "tools/llvm-rc/*.h", - ]), - copts = llvm_copts, - deps = [ - ":Object", - ":Option", - ":RcTableGen", - ":Support", - ":TargetParser", - ":WindresTableGen", - ":config", - ":llvm-rc-defs-lib", - ], -) - -llvm_driver_cc_binary( - name = "llvm-rc", - stamp = 0, - deps = [":llvm-rc-lib"], -) - -binary_alias( - name = "llvm-windres", - binary = ":llvm-rc", -) - -gentbl( - name = "ReadobjOptsTableGen", - strip_include_prefix = "tools/llvm-readobj", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-readobj/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-readobj/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "llvm-readobj-lib", - srcs = glob([ - "tools/llvm-readobj/*.cpp", - "tools/llvm-readobj/*.h", - ]), - copts = llvm_copts, - deps = [ - ":AllTargetsCodeGens", - ":BinaryFormat", - ":BitReader", - ":DebugInfoCodeView", - ":DebugInfoDWARF", - ":Demangle", - ":MC", - ":Object", - ":Option", - ":ReadobjOptsTableGen", - ":Support", - ], -) - -llvm_driver_cc_binary( - name = "llvm-readobj", - stamp = 0, - deps = [":llvm-readobj-lib"], -) - -# Create an 'llvm-readelf' named binary from the 'llvm-readobj' tool. -binary_alias( - name = "llvm-readelf", - binary = ":llvm-readobj", -) - -cc_binary( - name = "llvm-reduce", - srcs = glob([ - "tools/llvm-reduce/**/*.cpp", - "tools/llvm-reduce/**/*.h", - ]), - copts = llvm_copts, - includes = ["tools/llvm-reduce"], - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":Analysis", - ":BitReader", - ":BitWriter", - ":CodeGen", - ":CodeGenTypes", - ":Core", - ":IPO", - ":IRReader", - ":MC", - ":Passes", - ":Support", - ":Target", - ":TargetParser", - ":TransformUtils", - ], -) - -cc_binary( - name = "llvm-rtdyld", - srcs = glob([ - "tools/llvm-rtdyld/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsCodeGens", - ":AllTargetsDisassemblers", - ":DebugInfo", - ":DebugInfoDWARF", - ":ExecutionEngine", - ":MC", - ":MCDisassembler", - ":Object", - ":Support", - ], -) - -gentbl( - name = "SizeOptsTableGen", - strip_include_prefix = "tools/llvm-size", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-size/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-size/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "llvm-size-lib", - srcs = glob(["tools/llvm-size/*.cpp"]), - copts = llvm_copts, - deps = [ - ":Object", - ":Option", - ":SizeOptsTableGen", - ":Support", - ], -) - -llvm_driver_cc_binary( - name = "llvm-size", - stamp = 0, - deps = [":llvm-size-lib"], -) - -cc_binary( - name = "llvm-split", - srcs = glob([ - "tools/llvm-split/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":BitWriter", - ":Core", - ":IRPrinter", - ":IRReader", - ":MC", - ":Support", - ":Target", - ":TargetParser", - ":TransformUtils", - ], -) - -gentbl( - name = "StringsOptsTableGen", - strip_include_prefix = "tools/llvm-strings", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-strings/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-strings/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_binary( - name = "llvm-strings", - srcs = glob([ - "tools/llvm-strings/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":Object", - ":Option", - ":StringsOptsTableGen", - ":Support", - ], -) - -gentbl( - name = "SymbolizerOptsTableGen", - strip_include_prefix = "tools/llvm-symbolizer", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-symbolizer/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-symbolizer/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "llvm-symbolizer-lib", - srcs = glob(["tools/llvm-symbolizer/*.cpp"]), - copts = llvm_copts, - deps = [ - ":DebugInfoDWARF", - ":DebugInfoPDB", - ":Debuginfod", - ":Object", - ":Option", - ":Support", - ":Symbolize", - ":SymbolizerOptsTableGen", - ":config", - ], -) - -llvm_driver_cc_binary( - name = "llvm-symbolizer", - stamp = 0, - deps = [":llvm-symbolizer-lib"], -) - -binary_alias( - name = "llvm-addr2line", - binary = ":llvm-symbolizer", -) - -cc_binary( - name = "llvm-undname", - srcs = glob([ - "tools/llvm-undname/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":Demangle", - ":Support", - ], -) - -cc_binary( - name = "llvm-xray", - srcs = glob([ - "tools/llvm-xray/*.cpp", - "tools/llvm-xray/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":DebugInfoDWARF", - ":Object", - ":Support", - ":Symbolize", - ":XRay", - ], -) - -cc_library( - name = "opt-driver", - srcs = glob([ - "tools/opt/*.cpp", - "tools/opt/*.h", - ]), - copts = llvm_copts, - linkopts = select({ - "@platforms//os:windows": [], - "@platforms//os:macos": [], - "//conditions:default": ["-Wl,--export-dynamic"], - }), - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":Analysis", - ":AsmParser", - ":BitReader", - ":BitWriter", - ":CodeGen", - ":Core", - ":IPO", - ":IRPrinter", - ":IRReader", - ":Instrumentation", - ":MC", - ":Passes", - ":Remarks", - ":Scalar", - ":Support", - ":Target", - ":TargetParser", - ":TransformUtils", - ":common_transforms", - ":config", - ], -) - -cc_binary( - name = "opt", - stamp = 0, - deps = [":opt-driver"], -) - -gentbl( - name = "SancovOptsTableGen", - strip_include_prefix = "tools/sancov", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/sancov/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/sancov/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_library( - name = "sancov-lib", - srcs = glob(["tools/sancov/*.cpp"]), - copts = llvm_copts, - deps = [ - ":AllTargetsCodeGens", - ":AllTargetsDisassemblers", - ":DebugInfoDWARF", - ":DebugInfoPDB", - ":MC", - ":MCDisassembler", - ":Object", - ":Option", - ":SancovOptsTableGen", - ":Support", - ":Symbolize", - ], -) - -llvm_driver_cc_binary( - name = "sancov", - stamp = 0, - deps = [":sancov-lib"], -) - -cc_binary( - name = "sanstats", - srcs = glob([ - "tools/sanstats/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":Support", - ":Symbolize", - ":TransformUtils", - ], -) - -cc_binary( - name = "split-file", - srcs = glob([ - "utils/split-file/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":Support", - ], -) - -################################################################################ -# Begin testonly libraries - -cc_library( - name = "FuzzMutate", - testonly = True, - srcs = glob(["lib/FuzzMutate/*.cpp"]), - hdrs = glob(["include/llvm/FuzzMutate/*.h"]), - copts = llvm_copts, - includes = ["include"], - deps = [ - ":Analysis", - ":BitReader", - ":BitWriter", - ":Core", - ":Scalar", - ":Support", - ":TargetParser", - ":TransformUtils", - ], -) - -cc_library( - name = "Diff", - testonly = True, - srcs = glob(["tools/llvm-diff/lib/*.cpp"]), - hdrs = glob(["tools/llvm-diff/lib/*.h"]), - deps = [ - ":Core", - ":Support", - ], -) - -py_binary( - name = "lit", - testonly = True, - srcs = ["utils/lit/lit.py"] + glob(["utils/lit/lit/**/*.py"]), - imports = ["utils/lit"], -) - -py_binary( - name = "extract_ir", - srcs = [ - "utils/mlgo-utils/mlgo/__init__.py", - "utils/mlgo-utils/mlgo/corpus/extract_ir.py", - "utils/mlgo-utils/mlgo/corpus/extract_ir_lib.py", - ], - imports = ["utils/mlgo-utils"], -) - -py_binary( - name = "combine_training_corpus", - srcs = [ - "utils/mlgo-utils/mlgo/__init__.py", - "utils/mlgo-utils/mlgo/corpus/combine_training_corpus.py", - "utils/mlgo-utils/mlgo/corpus/combine_training_corpus_lib.py", - ], - imports = ["utils/mlgo-utils"], -) - -py_binary( - name = "make_corpus", - srcs = [ - "utils/mlgo-utils/mlgo/__init__.py", - "utils/mlgo-utils/mlgo/corpus/make_corpus.py", - "utils/mlgo-utils/mlgo/corpus/make_corpus_lib.py", - ], - imports = ["utils/mlgo-utils"], -) - -cc_library( - name = "TestingADT", - testonly = True, - hdrs = glob([ - "include/llvm/Testing/ADT/*.h", - ]), - copts = llvm_copts, - deps = [ - ":Support", - "//third-party/unittest:gmock", - ], -) - -cc_library( - name = "TestingSupport", - testonly = True, - srcs = glob([ - "lib/Testing/Support/*.cpp", - ]), - hdrs = glob(["include/llvm/Testing/Support/*.h"]), - copts = llvm_copts, - deps = [ - ":Support", - ":config", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - ], -) - -cc_library( - name = "TestingAnnotations", - testonly = True, - srcs = ["lib/Testing/Annotations/Annotations.cpp"], - hdrs = ["include/llvm/Testing/Annotations/Annotations.h"], - copts = llvm_copts, - deps = [":Support"], -) - -################################################################################ -# Begin testonly binary utilities - -cc_binary( - name = "FileCheck", - testonly = True, - srcs = glob([ - "utils/FileCheck/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":FileCheckLib", - ":Support", - ], -) - -cc_binary( - name = "bugpoint", - srcs = glob([ - "tools/bugpoint/*.cpp", - "tools/bugpoint/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":Analysis", - ":AsmParser", - ":BitReader", - ":BitWriter", - ":CodeGen", - ":Core", - ":IPO", - ":IRPrinter", - ":IRReader", - ":Linker", - ":Passes", - ":Scalar", - ":Support", - ":TargetParser", - ":TransformUtils", - ":common_transforms", - ":config", - ], -) - -cc_binary( - name = "count", - testonly = True, - srcs = glob([ - "utils/count/*.c", - ]), - stamp = 0, - deps = [":Support"], -) - -cc_binary( - name = "lli-child-target", - testonly = True, - srcs = glob([ - "tools/lli/ChildTarget/*.cpp", - ]), - copts = llvm_copts, - # The tests load code into this binary that expect to see symbols - # from libstdc++ such as __cxa_begin_catch and _ZTIi. The latter - # isn't even used in the main binary, so we also need to force it - # to be included. - linkopts = select({ - "@platforms//os:windows": [], - "@platforms//os:macos": [], - "//conditions:default": [ - "-rdynamic", - "-u_ZTIi", - ], - }), - stamp = 0, - deps = [ - ":OrcJIT", - ":OrcTargetProcess", - ":Support", - ":attributes_gen", - ":config", - ":intrinsic_enums_gen", - ], -) - -cc_binary( - name = "llvm-c-test", - testonly = True, - srcs = glob([ - "tools/llvm-c-test/*.c", - "tools/llvm-c-test/*.cpp", - "tools/llvm-c-test/*.h", - ]), - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":AllTargetsDisassemblers", - ":Analysis", - ":BitReader", - ":BitWriter", - ":Core", - ":ExecutionEngine", - ":IPO", - ":IRReader", - ":InstCombine", - ":LTO", - ":Linker", - ":MCDisassembler", - ":Object", - ":OrcJIT", - ":Passes", - ":Remarks", - ":Scalar", - ":Support", - ":Target", - ":TransformUtils", - ":Vectorize", - ], -) - -cc_binary( - name = "llvm-diff", - testonly = True, - srcs = glob([ - "tools/llvm-diff/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":Core", - ":Diff", - ":IRPrinter", - ":IRReader", - ":Support", - ], -) - -cc_binary( - name = "llvm-isel-fuzzer", - testonly = True, - srcs = glob([ - "tools/llvm-isel-fuzzer/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsAsmParsers", - ":AllTargetsCodeGens", - ":Analysis", - ":BitReader", - ":BitWriter", - ":CodeGen", - ":Core", - ":FuzzMutate", - ":IRPrinter", - ":IRReader", - ":MC", - ":Support", - ":Target", - ], -) - -# This is really a Python script, but call it sh_binary to ignore the hyphen in -# the path, which py_binary does not allow. -# Also, note: llvm-locstats expects llvm-dwarfdump to be in the same directory -# when executed. -sh_binary( - name = "llvm-locstats", - testonly = True, - srcs = glob([ - "utils/llvm-locstats/*.py", - ]), - # llvm-locstats is a thin wrapper around llvm-dwarfdump. - data = [":llvm-dwarfdump"], -) - -sh_binary( - name = "llvm-original-di-preservation", - testonly = True, - srcs = ["utils/llvm-original-di-preservation.py"], -) - -cc_binary( - name = "not", - testonly = True, - srcs = glob([ - "utils/not/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [":Support"], -) - -cc_binary( - name = "llvm-opt-fuzzer", - testonly = True, - srcs = glob([ - "tools/llvm-opt-fuzzer/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AllTargetsCodeGens", - ":Analysis", - ":BitReader", - ":BitWriter", - ":CodeGen", - ":Core", - ":Coroutines", - ":FuzzMutate", - ":MC", - ":Passes", - ":Support", - ":Target", - ], -) - -gentbl( - name = "ReadTAPIOptsTableGen", - strip_include_prefix = "tools/llvm-readtapi", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-readtapi/TapiOpts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-readtapi/TapiOpts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_binary( - name = "llvm-readtapi", - testonly = True, - srcs = glob([ - "tools/llvm-readtapi/*.cpp", - "tools/llvm-readtapi/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":BinaryFormat", - ":Object", - ":Option", - ":ReadTAPIOptsTableGen", - ":Support", - ":TextAPI", - ":TextAPIBinaryReader", - ], -) - -gentbl( - name = "TLICheckerOptsTableGen", - strip_include_prefix = "tools/llvm-tli-checker", - tbl_outs = [( - "-gen-opt-parser-defs", - "tools/llvm-tli-checker/Opts.inc", - )], - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-tli-checker/Opts.td", - td_srcs = ["include/llvm/Option/OptParser.td"], -) - -cc_binary( - name = "llvm-tli-checker", - testonly = True, - srcs = glob([ - "tools/llvm-tli-checker/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":Analysis", - ":BinaryFormat", - ":BitReader", - ":BitstreamReader", - ":Core", - ":Demangle", - ":MC", - ":MCParser", - ":Object", - ":Option", - ":Remarks", - ":Support", - ":TLICheckerOptsTableGen", - ":TargetParser", - ":TextAPI", - ":config", - ], -) - -cc_binary( - name = "obj2yaml", - testonly = True, - srcs = glob([ - "tools/obj2yaml/*.cpp", - "tools/obj2yaml/*.h", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":BinaryFormat", - ":DebugInfoCodeView", - ":DebugInfoDWARF", - ":Object", - ":ObjectYAML", - ":Support", - ], -) - -cc_binary( - name = "verify-uselistorder", - srcs = glob([ - "tools/verify-uselistorder/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":AsmParser", - ":BitReader", - ":BitWriter", - ":Core", - ":IRPrinter", - ":IRReader", - ":Support", - ], -) - -cc_binary( - name = "yaml2obj", - testonly = True, - srcs = glob([ - "tools/yaml2obj/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":BinaryFormat", - ":DebugInfoCodeView", - ":MC", - ":Object", - ":ObjectYAML", - ":Support", - ], -) - -cc_binary( - name = "yaml-bench", - testonly = True, - srcs = glob([ - "utils/yaml-bench/*.cpp", - ]), - copts = llvm_copts, - stamp = 0, - deps = [ - ":Support", - ], -) diff --git a/utils/bazel/llvm-project-overlay/llvm/binary_alias.bzl b/utils/bazel/llvm-project-overlay/llvm/binary_alias.bzl deleted file mode 100644 index 0108742f345ed..0000000000000 --- a/utils/bazel/llvm-project-overlay/llvm/binary_alias.bzl +++ /dev/null @@ -1,35 +0,0 @@ -# This file is licensed 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 - -"""Creates a copy of a binary, giving it a different basename. - -binary_alias( - name = "my_binary_other_name", - binary = ":some_cc_binary", -) -""" - -def _binary_alias_impl(ctx): - ctx.actions.symlink( - target_file = ctx.executable.binary, - output = ctx.outputs.executable, - is_executable = True, - ) - - return [DefaultInfo( - executable = ctx.outputs.executable, - runfiles = ctx.attr.binary[DefaultInfo].default_runfiles, - )] - -binary_alias = rule( - _binary_alias_impl, - attrs = { - "binary": attr.label( - mandatory = True, - executable = True, - cfg = "target", - ), - }, - executable = True, -) diff --git a/utils/bazel/llvm-project-overlay/llvm/cc_plugin_library.bzl b/utils/bazel/llvm-project-overlay/llvm/cc_plugin_library.bzl deleted file mode 100644 index b28425efa3977..0000000000000 --- a/utils/bazel/llvm-project-overlay/llvm/cc_plugin_library.bzl +++ /dev/null @@ -1,75 +0,0 @@ -# This file is licensed under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -"""A macro to produce a loadable plugin library for the target OS. - -This macro produces a set of platform-specific `cc_binary` rules, by appending -the platform suffix (`.dll`, `.dylib`, or `.so`) to the provided `name`. It then -connects these to a `cc_import` rule with `name` exactly and `hdrs` that can be -used by other Bazel rules to depend on the plugin library. - -The `srcs` attribute for the `cc_binary` rules is `srcs + hdrs`. Other explicit -arguments are passed to all of the rules where they apply, and can be used to -configure generic aspects of all generated rules such as `testonly`. Lastly, -`kwargs` is expanded into all the `cc_binary` rules. -""" - -load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_import", "cc_library") - -def cc_plugin_library(name, srcs, hdrs, include_prefix = None, strip_include_prefix = None, alwayslink = False, features = [], tags = [], testonly = False, **kwargs): - # Neither the name of the plugin binary nor tags on whether it is built are - # configurable. Instead, we build a `cc_binary` with each name and - # selectively depend on them based on platform. - # - # All-in-all, this is a pretty poor workaround. I think this is part of the - # Bazel issue: https://github.com/bazelbuild/bazel/issues/7538 - so_name = name + ".so" - dll_name = name + ".dll" - dylib_name = name + ".dylib" - interface_output_name = name + "_interface_output" - import_name = name + "_import" - for impl_name in [dll_name, dylib_name, so_name]: - cc_binary( - name = impl_name, - srcs = srcs + hdrs, - linkshared = True, - linkstatic = True, - features = features, - tags = ["manual"] + tags, - testonly = testonly, - **kwargs - ) - native.filegroup( - name = interface_output_name, - srcs = select({ - "@platforms//os:windows": [":" + dll_name], - "@platforms//os:macos": [":" + dylib_name], - "//conditions:default": [":" + so_name], - }), - output_group = "interface_library", - ) - cc_import( - name = import_name, - interface_library = ":" + interface_output_name, - shared_library = select({ - "@platforms//os:windows": ":" + dll_name, - "@platforms//os:macos": ":" + dylib_name, - "//conditions:default": ":" + so_name, - }), - alwayslink = alwayslink, - features = features, - tags = tags, - testonly = testonly, - ) - cc_library( - name = name, - hdrs = hdrs, - include_prefix = include_prefix, - strip_include_prefix = strip_include_prefix, - deps = [":" + import_name], - alwayslink = alwayslink, - features = features, - tags = tags, - testonly = testonly, - ) diff --git a/utils/bazel/llvm-project-overlay/llvm/config.bzl b/utils/bazel/llvm-project-overlay/llvm/config.bzl deleted file mode 100644 index 2e3bff53ead9d..0000000000000 --- a/utils/bazel/llvm-project-overlay/llvm/config.bzl +++ /dev/null @@ -1,120 +0,0 @@ -# This file is licensed 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 - -"""Defines variables that use selects to configure LLVM based on platform.""" - -load( - "//:vars.bzl", - "LLVM_VERSION", - "LLVM_VERSION_MAJOR", - "LLVM_VERSION_MINOR", - "LLVM_VERSION_PATCH", -) - -def native_arch_defines(arch, triple): - return [ - r'LLVM_NATIVE_ARCH=\"{}\"'.format(arch), - "LLVM_NATIVE_ASMPARSER=LLVMInitialize{}AsmParser".format(arch), - "LLVM_NATIVE_ASMPRINTER=LLVMInitialize{}AsmPrinter".format(arch), - "LLVM_NATIVE_DISASSEMBLER=LLVMInitialize{}Disassembler".format(arch), - "LLVM_NATIVE_TARGET=LLVMInitialize{}Target".format(arch), - "LLVM_NATIVE_TARGETINFO=LLVMInitialize{}TargetInfo".format(arch), - "LLVM_NATIVE_TARGETMC=LLVMInitialize{}TargetMC".format(arch), - "LLVM_NATIVE_TARGETMCA=LLVMInitialize{}TargetMCA".format(arch), - r'LLVM_HOST_TRIPLE=\"{}\"'.format(triple), - r'LLVM_DEFAULT_TARGET_TRIPLE=\"{}\"'.format(triple), - ] - -posix_defines = [ - "LLVM_ON_UNIX=1", - "HAVE_BACKTRACE=1", - "BACKTRACE_HEADER=", - r'LTDL_SHLIB_EXT=\".so\"', - r'LLVM_PLUGIN_EXT=\".so\"', - "LLVM_ENABLE_THREADS=1", - "HAVE_DEREGISTER_FRAME=1", - "HAVE_LIBPTHREAD=1", - "HAVE_PTHREAD_GETNAME_NP=1", - "HAVE_PTHREAD_H=1", - "HAVE_PTHREAD_SETNAME_NP=1", - "HAVE_REGISTER_FRAME=1", - "HAVE_SETENV_R=1", - "HAVE_STRERROR_R=1", - "HAVE_SYSEXITS_H=1", - "HAVE_UNISTD_H=1", -] - -linux_defines = posix_defines + [ - "_GNU_SOURCE", - "HAVE_LINK_H=1", - "HAVE_MALLINFO=1", - "HAVE_SBRK=1", - "HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1", -] - -macos_defines = posix_defines + [ - "HAVE_MACH_MACH_H=1", - "HAVE_MALLOC_MALLOC_H=1", - "HAVE_MALLOC_ZONE_STATISTICS=1", - "HAVE_PROC_PID_RUSAGE=1", - "HAVE_UNW_ADD_DYNAMIC_FDE=1", -] - -win32_defines = [ - # Windows system library specific defines. - "_CRT_SECURE_NO_DEPRECATE", - "_CRT_SECURE_NO_WARNINGS", - "_CRT_NONSTDC_NO_DEPRECATE", - "_CRT_NONSTDC_NO_WARNINGS", - "_SCL_SECURE_NO_DEPRECATE", - "_SCL_SECURE_NO_WARNINGS", - "UNICODE", - "_UNICODE", - - # LLVM features - r'LTDL_SHLIB_EXT=\".dll\"', - r'LLVM_PLUGIN_EXT=\".dll\"', -] - -# TODO: We should switch to platforms-based config settings to make this easier -# to express. -os_defines = select({ - "@bazel_tools//src/conditions:windows": win32_defines, - "@bazel_tools//src/conditions:darwin": macos_defines, - "@bazel_tools//src/conditions:freebsd": posix_defines, - "//conditions:default": linux_defines, -}) - -# HAVE_BUILTIN_THREAD_POINTER is true for on Linux (outside of ppc64) for -# all recent toolchains. Add it here by default on Linux as we can't perform a -# configure time check. -builtin_thread_pointer = select({ - "@bazel_tools//src/conditions:linux_ppc64le": [], - "@bazel_tools//src/conditions:linux": ["HAVE_BUILTIN_THREAD_POINTER"], - "//conditions:default": [], -}) - -# TODO: We should split out host vs. target here. -llvm_config_defines = os_defines + builtin_thread_pointer + select({ - "@bazel_tools//src/conditions:windows": native_arch_defines("X86", "x86_64-pc-win32"), - "@bazel_tools//src/conditions:darwin_arm64": native_arch_defines("AArch64", "arm64-apple-darwin"), - "@bazel_tools//src/conditions:darwin_x86_64": native_arch_defines("X86", "x86_64-unknown-darwin"), - "@bazel_tools//src/conditions:linux_aarch64": native_arch_defines("AArch64", "aarch64-unknown-linux-gnu"), - "@bazel_tools//src/conditions:linux_ppc64le": native_arch_defines("PowerPC", "powerpc64le-unknown-linux-gnu"), - "@bazel_tools//src/conditions:linux_s390x": native_arch_defines("SystemZ", "systemz-unknown-linux_gnu"), - "//conditions:default": native_arch_defines("X86", "x86_64-unknown-linux-gnu"), -}) + [ - "LLVM_VERSION_MAJOR={}".format(LLVM_VERSION_MAJOR), - "LLVM_VERSION_MINOR={}".format(LLVM_VERSION_MINOR), - "LLVM_VERSION_PATCH={}".format(LLVM_VERSION_PATCH), - r'LLVM_VERSION_STRING=\"{}git\"'.format(LLVM_VERSION), - # These shouldn't be needed by the C++11 standard, but are for some - # platforms (e.g. glibc < 2.18. See - # https://sourceware.org/bugzilla/show_bug.cgi?id=15366). These are also - # included unconditionally in the CMake build: - # https://github.com/llvm/llvm-project/blob/cd0dd8ece8e/llvm/cmake/modules/HandleLLVMOptions.cmake#L907-L909 - "__STDC_LIMIT_MACROS", - "__STDC_CONSTANT_MACROS", - "__STDC_FORMAT_MACROS", -] diff --git a/utils/bazel/llvm-project-overlay/llvm/enum_targets_gen.bzl b/utils/bazel/llvm-project-overlay/llvm/enum_targets_gen.bzl deleted file mode 100644 index 79617490bf7a4..0000000000000 --- a/utils/bazel/llvm-project-overlay/llvm/enum_targets_gen.bzl +++ /dev/null @@ -1,68 +0,0 @@ -# This file is licensed under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -"""A rule to expand LLVM target enumerations. - -Replaces in a text file a single variable of the style `@LLVM_ENUM_FOOS@` with a -list of macro invocations, one for each target on its own line: - -``` -LLVM_FOO(TARGET1) -LLVM_FOO(TARGET2) -// ... -``` - -Example: -load(":enum_targets_gen.bzl", "enum_targets_gen") - -enum_targets_gen( - name = "disassemblers_def_gen", - src = "include/llvm/Config/Disassemblers.def.in", - out = "include/llvm/Config/Disassemblers.def", - macro_name = "DISASSEMBLER", - targets = llvm_target_disassemblers, -) - -This rule provides a slightly more semantic API than template_rule, but the main -reason it exists is to permit a list with selects to be passed for `targets` as -a select is not allowed to be passed to a rule within another data structure. -""" - -def enum_targets_gen_impl(ctx): - to_replace = ctx.attr.placeholder_name - if not to_replace: - to_replace = "@LLVM_ENUM_{}S@".format(ctx.attr.macro_name) - replacement = "\n".join([ - "LLVM_{}({})\n".format(ctx.attr.macro_name, t) - for t in ctx.attr.targets - ]) - - ctx.actions.expand_template( - template = ctx.file.src, - output = ctx.outputs.out, - substitutions = {to_replace: replacement}, - ) - -enum_targets_gen = rule( - attrs = { - "src": attr.label( - mandatory = True, - allow_single_file = True, - ), - "out": attr.output(mandatory = True), - "targets": attr.string_list(mandatory = True), - "macro_name": attr.string( - mandatory = True, - doc = "The name of the enumeration. This is the suffix of the" + - " placeholder being replaced `@LLVM_ENUM_{}S@` and of the" + - " macro invocations generated `LLVM_{}(TARGET)`. Should be" + - " all caps and singular, e.g. 'DISASSEMBLER'", - ), - "placeholder_name": attr.string( - doc = "The name of the placeholder. If unset, this defaults to" + - " `@LLVM_ENUM_{macro_name}S@`", - ), - }, - implementation = enum_targets_gen_impl, -) diff --git a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h deleted file mode 100644 index a4fb47d677ab1..0000000000000 --- a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h +++ /dev/null @@ -1,360 +0,0 @@ -/*===------- llvm/Config/config.h - llvm configuration ------------*- 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 */ -/* */ -/*===----------------------------------------------------------------------===*/ - -/* This is a manual port of config.h.cmake for the symbols that do not change - based on platform. Those that do change should not be defined here and - instead use Bazel cc_library defines. Some attempt has been made to extract - such symbols that do vary based on platform (for the platforms we care about) - into Bazel defines, but it is by no means complete, so if you see something - that looks wrong, it probably is. */ - -#ifndef CONFIG_H -#define CONFIG_H - -// Include this header only under the llvm source tree. -// This is a private header. - -/* Exported configuration */ -#include "llvm/Config/llvm-config.h" - -/* Bug report URL. */ -#define BUG_REPORT_URL "https://github.com/llvm/llvm-project/issues/" - -/* Define to 1 to enable backtraces, and to 0 otherwise. */ -#define ENABLE_BACKTRACES 1 - -/* Define to 1 to enable crash overrides, and to 0 otherwise. */ -#define ENABLE_CRASH_OVERRIDES 1 - -/* Define to 1 to enable crash memory dumps, and to 0 otherwise. */ -#define LLVM_ENABLE_CRASH_DUMPS 0 - -/* Define to 1 to prefer forward slashes on Windows, and to 0 prefer - backslashes. */ -#define LLVM_WINDOWS_PREFER_FORWARD_SLASH 0 - -/* Define to 1 if you have the `backtrace' function. */ -/* HAVE_BACKTRACE defined in Bazel */ - -/* BACKTRACE_HEADER defined in Bazel */ - -/* Define to 1 if you have the header file. */ -/* HAVE_CRASHREPORTERCLIENT_H defined in Bazel */ - -/* can use __crashreporter_info__ */ -/* HAVE_CRASHREPORTER_INFO defined in Bazel */ - -/* Define to 1 if you have the declaration of `arc4random', and to 0 if you - don't. */ -#define HAVE_DECL_ARC4RANDOM 0 - -/* Define to 1 if you have the declaration of `FE_ALL_EXCEPT', and to 0 if you - don't. */ -#define HAVE_DECL_FE_ALL_EXCEPT 1 - -/* Define to 1 if you have the declaration of `FE_INEXACT', and to 0 if you - don't. */ -#define HAVE_DECL_FE_INEXACT 1 - -/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you - don't. */ -#define HAVE_DECL_STRERROR_S 0 - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define if dlopen() is available on this platform. */ -#define HAVE_DLOPEN 1 - -/* Define if dladdr() is available on this platform. */ -#define HAVE_DLADDR 1 - -/* Define to 1 if we can register EH frames on this platform. */ -/* HAVE_REGISTER_FRAME defined in Bazel*/ - -/* Define to 1 if we can deregister EH frames on this platform. */ -/* HAVE_DEREGISTER_FRAME defined in Bazel*/ - -/* Define if __unw_add_dynamic_fde() is available on this platform. */ -/* HAVE_UNW_ADD_DYNAMIC_FDE defined in Bazel */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FENV_H 1 - -/* Define if libffi is available on this platform. */ -/* #undef HAVE_FFI_CALL */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_FFI_FFI_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_FFI_H */ - -/* Define to 1 if you have the `futimens' function. */ -#define HAVE_FUTIMENS 1 - -/* Define to 1 if you have the `futimes' function. */ -#define HAVE_FUTIMES 1 - -/* Define to 1 if you have the `getpagesize' function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define to 1 if you have the `getrlimit' function. */ -#define HAVE_GETRLIMIT 1 - -/* Define to 1 if you have the `getrusage' function. */ -#define HAVE_GETRUSAGE 1 - -/* Define to 1 if you have the `isatty' function. */ -#define HAVE_ISATTY 1 - -/* Define to 1 if you have the `edit' library (-ledit). */ -/* #undef HAVE_LIBEDIT */ - -/* Define to 1 if you have the `pfm' library (-lpfm). */ -/* #undef HAVE_LIBPFM */ - -/* Define to 1 if the `perf_branch_entry' struct has field cycles. */ -/* #undef LIBPFM_HAS_FIELD_CYCLES */ - -/* Define to 1 if you have the `psapi' library (-lpsapi). */ -/* #undef HAVE_LIBPSAPI */ - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -#define HAVE_LIBPTHREAD 1 - -/* Define to 1 if you have the `pthread_getname_np' function. */ -#define HAVE_PTHREAD_GETNAME_NP 1 - -/* Define to 1 if you have the `pthread_setname_np' function. */ -#define HAVE_PTHREAD_SETNAME_NP 1 - -/* Define to 1 if you have the header file. */ -/* HAVE_LINK_H defined in Bazel */ - -/* Define to 1 if you have the header file. */ -/* HAVE_MACH_MACH_H defined in Bazel */ - -/* Define to 1 if you have the `mallctl' function. */ -/* #undef HAVE_MALLCTL */ - -/* Define to 1 if you have the `mallinfo' function. */ -/* HAVE_MALLINFO defined in Bazel */ - -/* Define to 1 if you have the header file. */ -/* HAVE_MALLOC_MALLOC_H defined in Bazel */ - -/* Define to 1 if you have the `malloc_zone_statistics' function. */ -/* HAVE_MALLOC_ZONE_STATISTICS defined in Bazel */ - -/* Define to 1 if you have the `posix_spawn' function. */ -#define HAVE_POSIX_SPAWN 1 - -/* Define to 1 if you have the `pread' function. */ -#define HAVE_PREAD 1 - -/* Define to 1 if you have the header file. */ -/* HAVE_PTHREAD_H defined in Bazel */ - -/* Have pthread_mutex_lock */ -#define HAVE_PTHREAD_MUTEX_LOCK 1 - -/* Have pthread_rwlock_init */ -#define HAVE_PTHREAD_RWLOCK_INIT 1 - -/* Define to 1 if you have the `sbrk' function. */ -/* HAVE_SBRK defined in Bazel */ - -/* Define to 1 if you have the `setenv' function. */ -/* HAVE_SETENV defined in Bazel */ - -/* Define to 1 if you have the `setrlimit' function. */ -#define HAVE_SETRLIMIT 1 - -/* Define to 1 if you have the `sigaltstack' function. */ -#define HAVE_SIGALTSTACK 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SIGNAL_H 1 - -/* Define to 1 if you have the `strerror_r' function. */ -/* HAVE_STRERROR_R defined in Bazel */ - -/* Define to 1 if you have the `sysconf' function. */ -#define HAVE_SYSCONF 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_MMAN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_RESOURCE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if stat struct has st_mtimespec member .*/ -/* #undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC */ - -/* Define to 1 if stat struct has st_mtim member. */ -/* HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC defined in Bazel */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_TERMIOS_H 1 - -/* Define to 1 if you have the header file. */ -/* HAVE_UNISTD_H defined in Bazel */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_VALGRIND_VALGRIND_H */ - -/* Have host's _alloca */ -/* #undef HAVE__ALLOCA */ - -/* Define to 1 if you have the `_chsize_s' function. */ -/* #undef HAVE__CHSIZE_S */ - -/* Define to 1 if you have the `_Unwind_Backtrace' function. */ -#define HAVE__UNWIND_BACKTRACE 1 - -/* Have host's __alloca */ -/* #undef HAVE___ALLOCA */ - -/* Have host's __ashldi3 */ -/* #undef HAVE___ASHLDI3 */ - -/* Have host's __ashrdi3 */ -/* #undef HAVE___ASHRDI3 */ - -/* Have host's __chkstk */ -/* #undef HAVE___CHKSTK */ - -/* Have host's __chkstk_ms */ -/* #undef HAVE___CHKSTK_MS */ - -/* Have host's __cmpdi2 */ -/* #undef HAVE___CMPDI2 */ - -/* Have host's __divdi3 */ -/* #undef HAVE___DIVDI3 */ - -/* Have host's __fixdfdi */ -/* #undef HAVE___FIXDFDI */ - -/* Have host's __fixsfdi */ -/* #undef HAVE___FIXSFDI */ - -/* Have host's __floatdidf */ -/* #undef HAVE___FLOATDIDF */ - -/* Have host's __lshrdi3 */ -/* #undef HAVE___LSHRDI3 */ - -/* Have host's __main */ -/* #undef HAVE___MAIN */ - -/* Have host's __moddi3 */ -/* #undef HAVE___MODDI3 */ - -/* Have host's __udivdi3 */ -/* #undef HAVE___UDIVDI3 */ - -/* Have host's __umoddi3 */ -/* #undef HAVE___UMODDI3 */ - -/* Have host's ___chkstk */ -/* #undef HAVE____CHKSTK */ - -/* Have host's ___chkstk_ms */ -/* #undef HAVE____CHKSTK_MS */ - -/* Linker version detected at compile time. */ -/* #undef HOST_LINK_VERSION */ - -/* Define if zlib compression is available */ -/* LLVM_ENABLE_ZLIB defined in Bazel */ - -/* Define if overriding target triple is enabled */ -/* #undef LLVM_TARGET_TRIPLE_ENV */ - -/* Whether tools show host and target info when invoked with --version */ -#define LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO 1 - -/* Whether tools show optional build config flags when invoked with --version */ -#define LLVM_VERSION_PRINTER_SHOW_BUILD_CONFIG 1 - -/* Define if libxml2 is supported on this platform. */ -/* #undef LLVM_ENABLE_LIBXML2 */ - -/* Define to the extension used for shared libraries, say, ".so". */ -/* LTDL_SHLIB_EXT defined in Bazel */ - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "https://github.com/llvm/llvm-project/issues/" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "LLVM" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING PACKAGE_NAME " " LLVM_VERSION_STRING - -/* Define to the version of this package. */ -#define PACKAGE_VERSION LLVM_VERSION_STRING - -/* Define to the vendor of this package. */ -/* #undef PACKAGE_VENDOR */ - -/* Define to a function implementing stricmp */ -/* stricmp defined conditionally below. */ - -/* Define to a function implementing strdup */ -/* strdup defined conditionally below. */ - -/* Whether GlobalISel rule coverage is being collected */ -#define LLVM_GISEL_COV_ENABLED 0 - -/* Define to the default GlobalISel coverage file prefix */ -/* #undef LLVM_GISEL_COV_PREFIX */ - -/* Whether Timers signpost passes in Xcode Instruments */ -#define LLVM_SUPPORT_XCODE_SIGNPOSTS 0 - -/* HAVE_PROC_PID_RUSAGE defined in Bazel */ - -/* Directly provide definitions here behind platform preprocessor definitions. - * The preprocessor conditions are sufficient to handle all of the configuration - * on platforms targeted by Bazel, and defining these here more faithfully - * matches how the users of this header expect things to work with CMake. - * FIXME: We should consider moving other platform defines to use this technique - * as well. - */ - -#ifdef _WIN32 -#define stricmp _stricmp -#define strdup _strdup -#endif - -#endif diff --git a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h deleted file mode 100644 index 5240b8299c109..0000000000000 --- a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h +++ /dev/null @@ -1,127 +0,0 @@ -/*===------- llvm/Config/llvm-config.h - llvm configuration -------*- 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 */ -/* */ -/*===----------------------------------------------------------------------===*/ - -/* This is a manual port of config.h.cmake for the symbols that do not change - based on platform. Those that do change should not be defined here and - instead use Bazel cc_library defines. Some attempt has been made to extract - such symbols that do vary based on platform (for the platforms we care about) - into Bazel defines, but it is by no means complete, so if you see something - that looks wrong, it probably is. */ - - -/* This file enumerates variables from the LLVM configuration so that they - can be in exported headers and won't override package specific directives. - This is a C header that can be included in the llvm-c headers. */ - -#ifndef LLVM_CONFIG_H -#define LLVM_CONFIG_H - -/* Define if LLVM_ENABLE_DUMP is enabled */ -/* #undef LLVM_ENABLE_DUMP */ - -/* Target triple LLVM will generate code for by default */ -/* LLVM_DEFAULT_TARGET_TRIPLE defined in Bazel */ - -/* Define if threads enabled */ -#define LLVM_ENABLE_THREADS 1 - -/* Has gcc/MSVC atomic intrinsics */ -#define LLVM_HAS_ATOMICS 1 - -/* Host triple LLVM will be executed on */ -/* LLVM_HOST_TRIPLE defined in Bazel */ - -/* LLVM architecture name for the native architecture, if available */ -/* LLVM_NATIVE_ARCH defined in Bazel */ - -/* LLVM name for the native AsmParser init function, if available */ -/* LLVM_NATIVE_ASMPARSER defined in Bazel */ - -/* LLVM name for the native AsmPrinter init function, if available */ -/* LLVM_NATIVE_ASMPRINTER defined in Bazel */ - -/* LLVM name for the native Disassembler init function, if available */ -/* LLVM_NATIVE_DISASSEMBLER defined in Bazel */ - -/* LLVM name for the native Target init function, if available */ -/* LLVM_NATIVE_TARGET defined in Bazel */ - -/* LLVM name for the native TargetInfo init function, if available */ -/* LLVM_NATIVE_TARGETINFO defined in Bazel */ - -/* LLVM name for the native target MC init function, if available */ -/* LLVM_NATIVE_TARGETMC defined in Bazel */ - -/* LLVM name for the native target MCA init function, if available */ -/* LLVM_NATIVE_TARGETMCA defined in Bazel */ - -/* Define if this is Unixish platform */ -/* LLVM_ON_UNIX defined in Bazel */ - -/* Define if we have the Intel JIT API runtime support library */ -#define LLVM_USE_INTEL_JITEVENTS 0 - -/* Define if we have the oprofile JIT-support library */ -#define LLVM_USE_OPROFILE 0 - -/* Define if we have the perf JIT-support library */ -#define LLVM_USE_PERF 0 - -/* Major version of the LLVM API */ -/* #undef LLVM_VERSION_MAJOR */ - -/* Minor version of the LLVM API */ -/* #undef LLVM_VERSION_MINOR */ - -/* Patch version of the LLVM API */ -/* #undef LLVM_VERSION_PATCH */ - -/* LLVM version string */ -/* #undef LLVM_VERSION_STRING */ - -/* Whether LLVM records statistics for use with GetStatistics(), - * PrintStatistics() or PrintStatisticsJSON() - */ -#define LLVM_FORCE_ENABLE_STATS 0 - -/* Define if we have z3 and want to build it */ -/* #undef LLVM_WITH_Z3 */ - -/* Define if we have curl and want to use it */ -/* #undef LLVM_ENABLE_CURL */ - -/* Define if we have cpp-httplib and want to use it */ -/* #undef LLVM_ENABLE_HTTPLIB */ - -/* Define if LLVM was built with a dependency to the tensorflow compiler */ -/* #undef LLVM_HAVE_TF_AOT */ - -/* Define to 1 if you have the header file. */ -/* HAVE_SYSEXITS_H defined in Bazel */ - -/* Define if the xar_open() function is supported this platform. */ -/* #undef HAVE_LIBXAR */ - -/* Define if building libLLVM shared library */ -/* #undef LLVM_BUILD_LLVM_DYLIB */ - -/* Define if building LLVM with BUILD_SHARED_LIBS */ -/* #undef LLVM_BUILD_SHARED_LIBS */ - -/* Define if building LLVM with LLVM_FORCE_USE_OLD_TOOLCHAIN_LIBS */ -/* #undef LLVM_FORCE_USE_OLD_TOOLCHAIN ${LLVM_FORCE_USE_OLD_TOOLCHAIN} */ - -/* Define if llvm_unreachable should be optimized with undefined behavior - * in non assert builds */ -#define LLVM_UNREACHABLE_OPTIMIZE 1 - -/* Define to 1 if you have the DIA SDK installed, and to 0 if you don't. */ -#define LLVM_ENABLE_DIA_SDK 0 - -#endif diff --git a/utils/bazel/llvm-project-overlay/llvm/lit_test.bzl b/utils/bazel/llvm-project-overlay/llvm/lit_test.bzl deleted file mode 100644 index af7ae560768d6..0000000000000 --- a/utils/bazel/llvm-project-overlay/llvm/lit_test.bzl +++ /dev/null @@ -1,52 +0,0 @@ -# This file is licensed 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 -"""Rules for running lit tests.""" - -load("@bazel_skylib//lib:paths.bzl", "paths") - -def lit_test( - name, - srcs, - args = None, - data = None, - deps = None, - **kwargs): - """Runs a single test file with LLVM's lit tool. - - Args: - name: string. the name of the generated test target. - srcs: label list. The files on which to run lit. - args: string list. Additional arguments to pass to lit. - Note that `-v` and the 'srcs' paths are added automatically. - data: label list. Additional data dependencies of the test. - Note that 'srcs' targets are added automatically. - **kwargs: additional keyword arguments. - - See https://llvm.org/docs/CommandGuide/lit.html for details on lit. - """ - - args = args or [] - data = data or [] - deps = deps or [] - - native.py_test( - name = name, - srcs = [Label("//llvm:lit")], - main = Label("//llvm:utils/lit/lit.py"), - args = args + ["-v"] + ["$(execpath %s)" % src for src in srcs], - data = data + srcs, - legacy_create_init = False, - deps = deps + [Label("//llvm:lit")], - **kwargs - ) - -def package_path(label): - """Returns the path to the package of 'label'. - - Args: - label: label. The label to return the package path of. - - For example, package_path("@foo//bar:BUILD") returns 'external/foo/bar'. - """ - return paths.join(Label(label).workspace_root, Label(label).package) diff --git a/utils/bazel/llvm-project-overlay/llvm/tblgen.bzl b/utils/bazel/llvm-project-overlay/llvm/tblgen.bzl deleted file mode 100644 index d43390918e390..0000000000000 --- a/utils/bazel/llvm-project-overlay/llvm/tblgen.bzl +++ /dev/null @@ -1,81 +0,0 @@ -# This file is licensed under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -"""This file contains BUILD extensions for generating source code from LLVM's -table definition files using the TableGen tool. - -See http://llvm.org/cmds/tblgen.html for more information on the TableGen -tool. -TODO(chandlerc): Currently this expresses include-based dependencies as -"sources", and has no transitive understanding due to these files not being -correctly understood by the build system. -""" - -def gentbl( - name, - tblgen, - td_file, - td_srcs, - tbl_outs, - library = True, - tblgen_args = "", - **kwargs): - """gentbl() generates tabular code from a table definition file. - - Args: - name: The name of the build rule for use in dependencies. - tblgen: The binary used to produce the output. - td_file: The primary table definitions file. - td_srcs: A list of table definition files included transitively. - tbl_outs: A list of tuples (opts, out), where each opts is a string of - options passed to tblgen, and the out is the corresponding output file - produced. - library: Whether to bundle the generated files into a library. - tblgen_args: Extra arguments string to pass to the tblgen binary. - **kwargs: Keyword arguments to pass to subsidiary cc_library() rule. - """ - llvm_project_execroot_path = Label("//llvm:tblgen.bzl").workspace_root - - if td_file not in td_srcs: - td_srcs += [td_file] - for (opts, out) in tbl_outs: - rule_suffix = "_".join(opts.replace("-", "_").replace("=", "_").split(" ")) - native.genrule( - name = "%s_%s_genrule" % (name, rule_suffix), - srcs = td_srcs, - outs = [out], - tools = [tblgen], - message = "Generating code from table: %s" % td_file, - cmd = (("$(location %s) -I %s/llvm/include " + - "-I %s/clang/include " + - "-I $$(dirname $(location %s)) " + - "%s $(location %s) %s -o $@") % ( - tblgen, - llvm_project_execroot_path, - llvm_project_execroot_path, - td_file, - opts, - td_file, - tblgen_args, - )), - ) - - # For now, all generated files can be assumed to comprise public interfaces. - # If this is not true, you should specify library = False - # and list the generated '.inc' files in "srcs". - if library: - native.cc_library( - name = name, - # FIXME: This should be `textual_hdrs` instead of `hdrs`, but - # unfortunately that doesn't work with `strip_include_prefix`: - # https://github.com/bazelbuild/bazel/issues/12424 - # - # Once that issue is fixed and released, we can switch this to - # `textual_hdrs` and remove the feature disabling the various Bazel - # features (both current and under-development) that motivated the - # distinction between these two. - hdrs = [f for (_, f) in tbl_outs], - features = ["-parse_headers", "-header_modules"], - **kwargs - ) diff --git a/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel deleted file mode 100644 index dfc0f870177bb..0000000000000 --- a/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel +++ /dev/null @@ -1,844 +0,0 @@ -# This file is licensed 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 - -load("//llvm:tblgen.bzl", "gentbl") - -package( - default_visibility = ["//visibility:public"], - features = ["layering_check"], -) - -licenses(["notice"]) - -cc_test( - name = "adt_tests", - size = "medium", - srcs = glob( - [ - "ADT/*.cpp", - "ADT/*.h", - ], - allow_empty = False, - ), - shard_count = 20, - deps = [ - "//llvm:Core", - "//llvm:Support", - "//llvm:TestingSupport", - "//llvm:config", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "analysis_tests", - size = "small", - srcs = glob( - ["Analysis/*.cpp"], - allow_empty = False, - exclude = [ - # TODO: Add this file to the build. - "Analysis/ConstraintSystemTest.cpp", - "Analysis/TFUtilsTest.cpp", - "Analysis/TrainingLoggerTest.cpp", - "Analysis/MLModelRunnerTest.cpp", - ], - ), - deps = [ - "//llvm:Analysis", - "//llvm:AsmParser", - "//llvm:CodeGen", - "//llvm:Core", - "//llvm:Passes", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TestingSupport", - "//llvm:TransformUtils", - "//llvm:attributes_gen", - "//llvm:config", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "asm_parser_tests", - size = "small", - srcs = glob( - ["AsmParser/*.cpp"], - allow_empty = False, - ), - deps = [ - "//llvm:AsmParser", - "//llvm:Core", - "//llvm:Support", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "bitcode_tests", - size = "small", - srcs = glob( - [ - "Bitcode/*.cpp", - "Bitcode/*.h", - ], - allow_empty = False, - ), - deps = [ - "//llvm:AsmParser", - "//llvm:BitReader", - "//llvm:BitWriter", - "//llvm:Core", - "//llvm:Support", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "bitstream_tests", - size = "small", - srcs = glob( - ["Bitstream/*.cpp"], - allow_empty = False, - ), - deps = [ - "//llvm:BitstreamReader", - "//llvm:BitstreamWriter", - "//llvm:Support", - "//llvm:TestingSupport", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_library( - name = "codegen_tests_includes", - textual_hdrs = glob( - ["CodeGen/*.inc"], - allow_empty = False, - ), -) - -cc_test( - name = "codegen_tests", - size = "medium", - srcs = glob( - [ - "CodeGen/*.cpp", - "CodeGen/*.h", - ], - allow_empty = False, - ), - features = ["-layering_check"], # #include "../lib/CodeGen/AllocationOrder.h" - deps = [ - ":codegen_tests_includes", - "//llvm:AllTargetsAsmParsers", - "//llvm:AllTargetsCodeGens", - "//llvm:Analysis", - "//llvm:AsmParser", - "//llvm:BinaryFormat", - "//llvm:CodeGen", - "//llvm:CodeGenTypes", - "//llvm:Core", - "//llvm:MC", - "//llvm:Passes", - "//llvm:Support", - "//llvm:Target", - "//llvm:TestingSupport", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "codegen_globalisel_tests", - size = "small", - srcs = glob( - [ - "CodeGen/GlobalISel/*.cpp", - "CodeGen/GlobalISel/*.h", - ], - allow_empty = False, - ), - copts = [ - "$(STACK_FRAME_UNLIMITED)", - ], - deps = [ - "//llvm:AllTargetsAsmParsers", - "//llvm:AllTargetsCodeGens", - "//llvm:AsmParser", - "//llvm:CodeGen", - "//llvm:CodeGenTypes", - "//llvm:Core", - "//llvm:FileCheckLib", - "//llvm:MC", - "//llvm:Support", - "//llvm:Target", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "debuginfo_tests", - size = "medium", - srcs = glob( - [ - "DebugInfo/DWARF/*.cpp", - "DebugInfo/DWARF/*.h", - # TODO: Re-enable these when they stop crashing. - #"DebugInfo/PDB/*.cpp", - #"DebugInfo/PDB/*.h", - ], - allow_empty = False, - ), - args = [ - # Skip a test that relies on reading files in a way that doesn't easily - # work with Bazel. - "--gtest_filter=-NativeSymbolReuseTest.*", - ], - features = ["-layering_check"], # #include "../lib/CodeGen/AsmPrinter/DwarfStringPool.h" - deps = [ - "//llvm:AllTargetsAsmParsers", - "//llvm:AllTargetsCodeGens", - "//llvm:BinaryFormat", - "//llvm:CodeGenTypes", - "//llvm:Core", - "//llvm:DebugInfo", - "//llvm:DebugInfoDWARF", - "//llvm:DebugInfoPDB", - "//llvm:MC", - "//llvm:Object", - "//llvm:ObjectYAML", - "//llvm:Support", - "//llvm:Target", - "//llvm:TestingSupport", - "//llvm:config", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "debuginfod_tests", - srcs = glob(["Debuginfod/*.cpp"]), - deps = [ - "//llvm:Debuginfod", - "//llvm:Support", - "//llvm:TestingSupport", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "execution_engine_tests", - size = "small", - srcs = glob( - ["ExecutionEngine/*.cpp"], - allow_empty = False, - ), - deps = [ - "//llvm:AllTargetsCodeGens", - "//llvm:AsmParser", - "//llvm:Core", - "//llvm:ExecutionEngine", - "//llvm:Interpreter", - "//llvm:Support", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "execution_engine_mcjit_tests", - size = "medium", - srcs = glob( - [ - "ExecutionEngine/MCJIT/*.cpp", - "ExecutionEngine/MCJIT/*.h", - ], - allow_empty = False, - ), - copts = [ - "$(STACK_FRAME_UNLIMITED)", - ], - deps = [ - "//llvm:AllTargetsCodeGens", - "//llvm:Analysis", - "//llvm:AsmParser", - "//llvm:Core", - "//llvm:ExecutionEngine", - "//llvm:MC", - "//llvm:MCJIT", - "//llvm:Passes", - "//llvm:Support", - "//llvm:Target", - "//llvm:TargetParser", - "//llvm:config", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "execution_engine_orc_tests", - size = "medium", - srcs = glob( - [ - "ExecutionEngine/Orc/*.cpp", - "ExecutionEngine/Orc/*.h", - ], - allow_empty = False, - ), - args = [ - # keep one-per-line - "--gtest_filter=-ObjectLinkingLayerTest.TestSetProcessAllSections", - ], - linkopts = select({ - "@platforms//os:macos": [], - "@platforms//os:windows": [], - "//conditions:default": [ - "-Wl,--export-dynamic-symbol=llvm_orc_registerJITLoaderGDBWrapper", - ], - }), - deps = [ - "//llvm:AllTargetsAsmParsers", - "//llvm:AllTargetsCodeGens", - "//llvm:AsmParser", - "//llvm:BinaryFormat", - "//llvm:Core", - "//llvm:ExecutionEngine", - "//llvm:IRReader", - "//llvm:JITLink", - "//llvm:MC", - "//llvm:Object", - "//llvm:OrcDebugging", - "//llvm:OrcJIT", - "//llvm:OrcShared", - "//llvm:OrcTargetProcess", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TestingSupport", - "//llvm:config", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "filecheck_tests", - size = "small", - srcs = glob( - ["FileCheck/*.cpp"], - allow_empty = False, - ), - features = ["-layering_check"], # #include "../lib/FileCheck/FileCheckImpl.h" - deps = [ - "//llvm:FileCheckLib", - "//llvm:Support", - "//llvm:TestingSupport", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "ir_tests", - size = "medium", - timeout = "long", # ConstantRangeTest cases may take several seconds each. - srcs = glob( - [ - "IR/*.cpp", - "IR/*.h", - ], - allow_empty = False, - ) + [ - "Support/KnownBitsTest.h", - ], - features = ["-layering_check"], - shard_count = 20, - deps = [ - "//llvm:Analysis", - "//llvm:AsmParser", - "//llvm:BinaryFormat", - "//llvm:CodeGen", - "//llvm:Core", - "//llvm:Passes", - "//llvm:Scalar", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TestingSupport", - "//llvm:TransformUtils", - "//llvm:config", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "line_editor_tests", - size = "small", - srcs = glob( - ["LineEditor/*.cpp"], - allow_empty = False, - ), - deps = [ - "//llvm:LineEditor", - "//llvm:Support", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "frontend_tests", - size = "small", - srcs = glob( - ["Frontend/*.cpp"], - allow_empty = False, - ), - deps = [ - "//llvm:Analysis", - "//llvm:Core", - "//llvm:FrontendOpenACC", - "//llvm:FrontendOpenMP", - "//llvm:Passes", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TransformUtils", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "linker_tests", - size = "small", - srcs = glob( - ["Linker/*.cpp"], - allow_empty = False, - ), - deps = [ - "//llvm:AsmParser", - "//llvm:Core", - "//llvm:Linker", - "//llvm:Support", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "mc_tests", - size = "small", - srcs = glob( - ["MC/*.cpp"], - allow_empty = False, - ), - deps = [ - "//llvm:AllTargetsCodeGens", - "//llvm:AllTargetsDisassemblers", - "//llvm:BinaryFormat", - "//llvm:MC", - "//llvm:MCDisassembler", - "//llvm:Object", - "//llvm:Support", - "//llvm:Target", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "mi_tests", - size = "medium", - srcs = glob( - ["MI/*.cpp"], - allow_empty = False, - ), - features = ["-layering_check"], # #include "../lib/CodeGen/RegisterCoalescer.h" - deps = [ - "//llvm:AllTargetsAsmParsers", - "//llvm:AllTargetsCodeGens", - "//llvm:CodeGen", - "//llvm:CodeGenTypes", - "//llvm:Core", - "//llvm:MC", - "//llvm:Support", - "//llvm:Target", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "objcopy_tests", - srcs = glob( - ["ObjCopy/*.cpp"], - allow_empty = False, - ), - deps = [ - "//llvm:ObjCopy", - "//llvm:Object", - "//llvm:ObjectYAML", - "//llvm:Support", - "//llvm:TestingSupport", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "object_tests", - size = "small", - srcs = glob( - ["Object/*.cpp"], - allow_empty = False, - ), - deps = [ - "//llvm:BinaryFormat", - "//llvm:Object", - "//llvm:ObjectYAML", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TestingSupport", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "object_yaml_tests", - size = "small", - srcs = glob( - ["ObjectYAML/*.cpp"], - allow_empty = False, - ), - deps = [ - "//llvm:DebugInfoCodeView", - "//llvm:Object", - "//llvm:ObjectYAML", - "//llvm:Support", - "//llvm:TestingSupport", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -gentbl( - name = "option_tests_gen", - strip_include_prefix = "Option", - tbl_outs = [( - "-gen-opt-parser-defs", - "Option/Opts.inc", - )], - tblgen = "//llvm:llvm-tblgen", - td_file = "Option/Opts.td", - td_srcs = [ - "//llvm:include/llvm/Option/OptParser.td", - ], -) - -gentbl( - name = "automata_automata_gen", - strip_include_prefix = "TableGen", - tbl_outs = [( - "-gen-automata", - "TableGen/AutomataAutomata.inc", - )], - tblgen = "//llvm:llvm-tblgen", - td_file = "TableGen/Automata.td", - td_srcs = ["//llvm:common_target_td_sources"] + [ - "TableGen/Automata.td", - ], -) - -gentbl( - name = "automata_tables_gen", - strip_include_prefix = "TableGen", - tbl_outs = [( - "-gen-searchable-tables", - "TableGen/AutomataTables.inc", - )], - tblgen = "//llvm:llvm-tblgen", - td_file = "TableGen/Automata.td", - td_srcs = ["//llvm:common_target_td_sources"] + [ - "TableGen/Automata.td", - ], -) - -cc_test( - name = "option_tests", - size = "small", - srcs = glob( - ["Option/*.cpp"], - allow_empty = False, - ), - deps = [ - ":option_tests_gen", - "//llvm:Option", - "//llvm:Support", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "remarks_tests", - size = "small", - srcs = glob( - ["Remarks/*.cpp"], - allow_empty = False, - ), - deps = [ - "//llvm:BitReader", - "//llvm:Remarks", - "//llvm:Support", - "//llvm:remark_linker", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "profile_data_tests", - size = "small", - srcs = glob( - ["ProfileData/*.cpp"], - allow_empty = False, - ), - deps = [ - "//llvm:BitstreamReader", - "//llvm:Core", - "//llvm:Coverage", - "//llvm:DebugInfo", - "//llvm:Object", - "//llvm:ProfileData", - "//llvm:Support", - "//llvm:Symbolize", - "//llvm:TestingSupport", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -# Note that the name of this test is important as it is used in the test itself. -cc_test( - name = "SupportTests", - size = "medium", - srcs = glob( - [ - "Support/*.cpp", - "Support/*.h", - ], - allow_empty = False, - exclude = [ - "Support/ParallelTest.cpp", - ], - ), - args = [ - # keep one-per-line - "--gtest_filter=-ProgramTest.CreateProcessTrailingSlash", - ], - copts = [ - "$(STACK_FRAME_UNLIMITED)", - ], - linkstatic = 1, - tags = [ - "local", # Not compatible with the sandbox on MacOS - ], - deps = [ - "//llvm:AllTargetsCodeGens", - "//llvm:BinaryFormat", - "//llvm:Core", - "//llvm:ProfileData", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TestingSupport", - "//llvm:config", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "support_parallel_tests", - size = "small", - srcs = ["Support/ParallelTest.cpp"], - copts = [ - "$(STACK_FRAME_UNLIMITED)", - ], - linkstatic = 1, - deps = [ - "//llvm:AllTargetsCodeGens", - "//llvm:Support", - "//llvm:config", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "tablegen_tests", - size = "small", - srcs = glob( - [ - "TableGen/*.cpp", - ], - allow_empty = False, - ), - deps = [ - ":automata_automata_gen", - ":automata_tables_gen", - "//llvm:Support", - "//llvm:TableGen", - "//llvm:TableGenGlobalISel", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "target_aarch64_tests", - size = "small", - srcs = glob( - ["Target/AArch64/*.cpp"], - allow_empty = False, - ), - copts = [ - "$(STACK_FRAME_UNLIMITED)", - ], - features = ["-layering_check"], # #include "AArch64GenInstrInfo.inc" - deps = [ - "//llvm:AArch64CodeGen", - "//llvm:AArch64UtilsAndDesc", - "//llvm:AsmParser", - "//llvm:CodeGen", - "//llvm:CodeGenTypes", - "//llvm:Core", - "//llvm:MC", - "//llvm:Support", - "//llvm:Target", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "testing_adt_tests", - size = "small", - srcs = glob( - [ - "Testing/ADT/*.cpp", - ], - allow_empty = False, - ), - deps = [ - "//llvm:Support", - "//llvm:TestingADT", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "transforms_tests", - size = "small", - srcs = glob( - [ - "Transforms/IPO/*.cpp", - "Transforms/IPO/*.h", - "Transforms/Utils/*.cpp", - ], - allow_empty = False, - ), - deps = [ - "//llvm:Analysis", - "//llvm:AsmParser", - "//llvm:Core", - "//llvm:IPO", - "//llvm:IRReader", - "//llvm:Passes", - "//llvm:Support", - "//llvm:TestingSupport", - "//llvm:TransformUtils", - "//llvm:Vectorize", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "llvm_exegesis_tests", - size = "small", - srcs = glob( - [ - "tools/llvm-exegesis/*.cpp", - "tools/llvm-exegesis/X86/*.cpp", - "tools/llvm-exegesis/X86/*.h", - ], - allow_empty = False, - ) + [ - "tools/llvm-exegesis/Common/AssemblerUtils.h", - ], - includes = ["tools/llvm-exegesis"], - deps = [ - "//llvm:AllTargetsCodeGens", - "//llvm:AllTargetsDisassemblers", - "//llvm:CodeGen", - "//llvm:CodeGenTypes", - "//llvm:Exegesis", - "//llvm:MC", - "//llvm:MCDisassembler", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TestingSupport", - "//llvm:X86CodeGen", - "//llvm:X86UtilsAndDesc", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "llvm_mca_tests", - size = "small", - srcs = glob( - [ - "tools/llvm-mca/*.cpp", - "tools/llvm-mca/*.h", - "tools/llvm-mca/X86/*.cpp", - "tools/llvm-mca/X86/*.h", - ], - allow_empty = False, - ), - includes = ["tools/llvm-mca"], - deps = [ - "//llvm:MC", - "//llvm:MCA", - "//llvm:MCAApplication", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:X86CodeGen", - "//llvm:X86UtilsAndDesc", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) diff --git a/utils/bazel/llvm-project-overlay/llvm/utils/lit/tests/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/utils/lit/tests/BUILD.bazel deleted file mode 100644 index b9e0a2e153ac1..0000000000000 --- a/utils/bazel/llvm-project-overlay/llvm/utils/lit/tests/BUILD.bazel +++ /dev/null @@ -1,37 +0,0 @@ -# This file is licensed 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 - -load("@bazel_skylib//rules:expand_template.bzl", "expand_template") -load("//llvm:lit_test.bzl", "lit_test", "package_path") - -expand_template( - name = "lit_site_cfg", - testonly = True, - out = "lit.site.cfg", - substitutions = { - "@LIT_SITE_CFG_IN_HEADER@": "# Autogenerated, do not edit.", - "@LLVM_LIT_TOOLS_DIR@": package_path("//llvm/utils/lit:BUILD"), - "@LLVM_SOURCE_DIR@": package_path("//llvm:BUILD"), - "@LLVM_BINARY_DIR@": package_path("//llvm:BUILD"), - "@LLVM_TOOLS_DIR@": package_path("//llvm:BUILD"), - }, - template = "lit.site.cfg.in", -) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - args = ["--path %s" % package_path("//llvm:BUILD")], - data = [ - "check-tested-lit-timeout-ability", - "lit.cfg", - "lit.site.cfg", - "//llvm:FileCheck", - "//llvm:count", - "//llvm:not", - ] + glob(["Inputs/**"]), - ) - for src in glob(["*/*.py"]) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel deleted file mode 100644 index 0d0224e6d6802..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel +++ /dev/null @@ -1,14343 +0,0 @@ -# This file is licensed 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 - -# Description: -# The MLIR "Multi-Level Intermediate Representation" Compiler Infrastructure - -load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") -load("@bazel_skylib//rules:expand_template.bzl", "expand_template") -load( - ":build_defs.bzl", - "cc_headers_only", - "if_cuda_available", - "mlir_c_api_cc_library", -) -load(":linalggen.bzl", "genlinalg") -load(":tblgen.bzl", "gentbl_cc_library", "td_library") - -package( - default_visibility = ["//visibility:public"], - features = ["layering_check"], -) - -licenses(["notice"]) - -exports_files([ - "LICENSE.TXT", - "run_lit.sh", - "utils/lldb-scripts/mlirDataFormatters.py", - "utils/textmate/mlir.json", -]) - -bool_flag( - name = "enable_cuda", - build_setting_default = False, -) - -config_setting( - name = "enable_cuda_config", - flag_values = { - ":enable_cuda": "True", - }, -) - -expand_template( - name = "mlir_config_h_gen", - out = "include/mlir/Config/mlir-config.h", - substitutions = { - "#cmakedefine01 MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE": "#define MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE 0", - "#cmakedefine01 MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS": "#define MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS 0", - "#cmakedefine MLIR_GREEDY_REWRITE_RANDOMIZER_SEED ${MLIR_GREEDY_REWRITE_RANDOMIZER_SEED}": "/* #undef MLIR_GREEDY_REWRITE_RANDOMIZER_SEED */", - "#cmakedefine01 MLIR_ENABLE_NVPTXCOMPILER": "#define MLIR_ENABLE_NVPTXCOMPILER 0", - "#cmakedefine01 MLIR_ENABLE_PDL_IN_PATTERNMATCH": "#define MLIR_ENABLE_PDL_IN_PATTERNMATCH 1", - "#cmakedefine01 MLIR_ENABLE_ROCM_CONVERSIONS": "#define MLIR_ENABLE_ROCM_CONVERSIONS 0", - }, - template = "include/mlir/Config/mlir-config.h.cmake", -) - -cc_library( - name = "config", - hdrs = [ - "include/mlir/Config/mlir-config.h", - ], -) - -filegroup( - name = "c_headers", - srcs = glob(["include/mlir-c/**/*"]), # <== i.e. match the entire tree -) - -exports_files(glob(["include/**/*.td"])) - -[ - gentbl_cc_library( - name = name + "IncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/IR/" + name + ".h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/IR/" + name + ".cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/IR/" + name + ".td", - deps = [":OpBaseTdFiles"], - ) - for name in [ - "OpAsmInterface", - "RegionKindInterface", - "SymbolInterfaces", - ] -] - -gentbl_cc_library( - name = "TensorEncodingIncGen", - tbl_outs = [ - ( - ["-gen-attr-interface-decls"], - "include/mlir/IR/TensorEncInterfaces.h.inc", - ), - ( - ["-gen-attr-interface-defs"], - "include/mlir/IR/TensorEncInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/IR/TensorEncoding.td", - deps = [":TensorOpsTdFiles"], -) - -td_library( - name = "BuiltinDialectTdFiles", - srcs = [ - "include/mlir/IR/BuiltinAttributeInterfaces.td", - "include/mlir/IR/BuiltinAttributes.td", - "include/mlir/IR/BuiltinDialect.td", - "include/mlir/IR/BuiltinLocationAttributes.td", - "include/mlir/IR/BuiltinOps.td", - "include/mlir/IR/BuiltinTypeInterfaces.td", - "include/mlir/IR/BuiltinTypes.td", - ], - includes = ["include"], - deps = [ - ":BytecodeTdFiles", - ":CallInterfacesTdFiles", - ":CastInterfacesTdFiles", - ":DataLayoutInterfacesTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -td_library( - name = "BuiltinDialectBytecodeTdFiles", - srcs = ["include/mlir/IR/BuiltinDialectBytecode.td"], - includes = ["include"], - deps = [ - ":BytecodeTdFiles", - ], -) - -gentbl_cc_library( - name = "BuiltinDialectIncGen", - tbl_outs = [ - ( - ["-gen-dialect-decls"], - "include/mlir/IR/BuiltinDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/IR/BuiltinDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/IR/BuiltinDialect.td", - deps = [":BuiltinDialectTdFiles"], -) - -gentbl_cc_library( - name = "BuiltinDialectBytecodeGen", - tbl_outs = [ - ( - [ - "-gen-bytecode", - "-bytecode-dialect=Builtin", - ], - "include/mlir/IR/BuiltinDialectBytecode.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/IR/BuiltinDialectBytecode.td", - deps = [":BuiltinDialectTdFiles"], -) - -gentbl_cc_library( - name = "BuiltinAttributesIncGen", - tbl_outs = [ - ( - ["--gen-attrdef-decls"], - "include/mlir/IR/BuiltinAttributes.h.inc", - ), - ( - ["--gen-attrdef-defs"], - "include/mlir/IR/BuiltinAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/IR/BuiltinAttributes.td", - deps = [":BuiltinDialectTdFiles"], -) - -gentbl_cc_library( - name = "BuiltinAttributeInterfacesIncGen", - tbl_outs = [ - ( - ["--gen-attr-interface-decls"], - "include/mlir/IR/BuiltinAttributeInterfaces.h.inc", - ), - ( - ["--gen-attr-interface-defs"], - "include/mlir/IR/BuiltinAttributeInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/IR/BuiltinAttributeInterfaces.td", - deps = [":BuiltinDialectTdFiles"], -) - -gentbl_cc_library( - name = "BuiltinLocationAttributesIncGen", - tbl_outs = [ - ( - ["--gen-attrdef-decls"], - "include/mlir/IR/BuiltinLocationAttributes.h.inc", - ), - ( - ["--gen-attrdef-defs"], - "include/mlir/IR/BuiltinLocationAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/IR/BuiltinLocationAttributes.td", - deps = [":BuiltinDialectTdFiles"], -) - -gentbl_cc_library( - name = "BuiltinOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/IR/BuiltinOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/IR/BuiltinOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/IR/BuiltinOps.td", - deps = [ - ":BuiltinDialectTdFiles", - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "BuiltinTypesIncGen", - tbl_outs = [ - ( - ["--gen-typedef-decls"], - "include/mlir/IR/BuiltinTypes.h.inc", - ), - ( - ["--gen-typedef-defs"], - "include/mlir/IR/BuiltinTypes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/IR/BuiltinTypes.td", - deps = [":BuiltinDialectTdFiles"], -) - -gentbl_cc_library( - name = "BuiltinTypeInterfacesIncGen", - tbl_outs = [ - ( - ["--gen-type-interface-decls"], - "include/mlir/IR/BuiltinTypeInterfaces.h.inc", - ), - ( - ["--gen-type-interface-defs"], - "include/mlir/IR/BuiltinTypeInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/IR/BuiltinTypeInterfaces.td", - deps = [ - ":BuiltinDialectTdFiles", - ], -) - -td_library( - name = "FunctionInterfacesTdFiles", - srcs = ["include/mlir/Interfaces/FunctionInterfaces.td"], - includes = ["include"], - deps = [ - ":CallInterfacesTdFiles", - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "FunctionInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/FunctionInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/FunctionInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/FunctionInterfaces.td", - deps = [ - ":FunctionInterfacesTdFiles", - ], -) - -cc_library( - name = "FunctionInterfaces", - srcs = [ - "lib/Interfaces/FunctionImplementation.cpp", - "lib/Interfaces/FunctionInterfaces.cpp", - ], - hdrs = [ - "include/mlir/Interfaces/FunctionImplementation.h", - "include/mlir/Interfaces/FunctionInterfaces.h", - ], - includes = ["include"], - deps = [ - ":CallOpInterfaces", - ":FunctionInterfacesIncGen", - ":IR", - "//llvm:Support", - ], -) - -cc_library( - name = "IR", - srcs = glob([ - "lib/IR/*.cpp", - "lib/IR/*.h", - "lib/IR/PDL/*.cpp", - "lib/Bytecode/Writer/*.h", - "include/mlir/Bytecode/*.h", - ]) + [ - "include/mlir/IR/PDLPatternMatch.h.inc", - "include/mlir/Interfaces/CallInterfaces.h", - "include/mlir/Interfaces/DataLayoutInterfaces.h", - "include/mlir/Interfaces/SideEffectInterfaces.h", - ], - hdrs = glob([ - "include/mlir/IR/*.h", - ]) + [ - "include/mlir/Interfaces/FoldInterfaces.h", - ], - includes = ["include"], - deps = [ - ":BuiltinAttributeInterfacesIncGen", - ":BuiltinAttributesIncGen", - ":BuiltinDialectBytecodeGen", - ":BuiltinDialectIncGen", - ":BuiltinLocationAttributesIncGen", - ":BuiltinOpsIncGen", - ":BuiltinTypeInterfacesIncGen", - ":BuiltinTypesIncGen", - ":BytecodeOpInterfaceIncGen", - ":CallOpInterfacesIncGen", - ":DataLayoutInterfacesIncGen", - ":OpAsmInterfaceIncGen", - ":RegionKindInterfaceIncGen", - ":SideEffectInterfacesIncGen", - ":Support", - ":SymbolInterfacesIncGen", - ":TensorEncodingIncGen", - ":config", - "//llvm:Support", - ], -) - -cc_library( - name = "Pass", - srcs = glob([ - "lib/Pass/*.cpp", - "lib/Pass/*.h", - ]), - hdrs = glob([ - "include/mlir/Pass/*.h", - ]), - includes = ["include"], - deps = [ - ":IR", - ":Parser", - ":Support", - "//llvm:Support", - ], -) - -mlir_c_api_cc_library( - name = "CAPIIR", - srcs = [ - "lib/CAPI/Dialect/Func.cpp", - "lib/CAPI/Dialect/IRDL.cpp", - "lib/CAPI/IR/AffineExpr.cpp", - "lib/CAPI/IR/AffineMap.cpp", - "lib/CAPI/IR/BuiltinAttributes.cpp", - "lib/CAPI/IR/BuiltinTypes.cpp", - "lib/CAPI/IR/Diagnostics.cpp", - "lib/CAPI/IR/DialectHandle.cpp", - "lib/CAPI/IR/IR.cpp", - "lib/CAPI/IR/IntegerSet.cpp", - "lib/CAPI/IR/Pass.cpp", - "lib/CAPI/IR/Support.cpp", - ], - hdrs = [ - "include/mlir-c/AffineExpr.h", - "include/mlir-c/AffineMap.h", - "include/mlir-c/BuiltinAttributes.h", - "include/mlir-c/BuiltinTypes.h", - "include/mlir-c/Diagnostics.h", - "include/mlir-c/Dialect/Func.h", - "include/mlir-c/Dialect/IRDL.h", - "include/mlir-c/ExecutionEngine.h", - "include/mlir-c/IR.h", - "include/mlir-c/IntegerSet.h", - "include/mlir-c/Interfaces.h", - "include/mlir-c/Pass.h", - "include/mlir-c/RegisterEverything.h", - "include/mlir-c/Rewrite.h", - "include/mlir-c/Support.h", - "include/mlir/CAPI/AffineExpr.h", - "include/mlir/CAPI/AffineMap.h", - "include/mlir/CAPI/Diagnostics.h", - "include/mlir/CAPI/IR.h", - "include/mlir/CAPI/IntegerSet.h", - "include/mlir/CAPI/Interfaces.h", - "include/mlir/CAPI/Pass.h", - "include/mlir/CAPI/Registration.h", - "include/mlir/CAPI/Rewrite.h", - "include/mlir/CAPI/Support.h", - "include/mlir/CAPI/Utils.h", - "include/mlir/CAPI/Wrap.h", - ], - header_deps = [ - ":BytecodeWriter", - ":IR", - ":Pass", - ":Support", - ":config", - "//llvm:Support", - ], - includes = ["include"], - deps = [ - ":AsmParser", - ":ConversionPassIncGen", - ":FuncDialect", - ":IRDLDialect", - ":InferTypeOpInterface", - ":Parser", - ], -) - -mlir_c_api_cc_library( - name = "CAPIInterfaces", - srcs = [ - "lib/CAPI/Interfaces/Interfaces.cpp", - ], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":IR", - ":InferTypeOpInterface", - "//llvm:Support", - ], -) - -mlir_c_api_cc_library( - name = "CAPIAMDGPU", - srcs = ["lib/CAPI/Dialect/AMDGPU.cpp"], - hdrs = ["include/mlir-c/Dialect/AMDGPU.h"], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":AMDGPUDialect", - ], -) - -mlir_c_api_cc_library( - name = "CAPIArith", - srcs = ["lib/CAPI/Dialect/Arith.cpp"], - hdrs = ["include/mlir-c/Dialect/Arith.h"], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":ArithDialect", - ], -) - -mlir_c_api_cc_library( - name = "CAPIAsync", - srcs = [ - "lib/CAPI/Dialect/Async.cpp", - "lib/CAPI/Dialect/AsyncPasses.cpp", - ], - hdrs = ["include/mlir-c/Dialect/Async.h"], - capi_deps = [ - ":CAPIIR", - ], - header_deps = [ - ":AsyncPassIncGen", - ], - includes = ["include"], - deps = [ - ":AsyncDialect", - ":AsyncTransforms", - ":Pass", - ], -) - -mlir_c_api_cc_library( - name = "CAPILinalg", - srcs = [ - "lib/CAPI/Dialect/Linalg.cpp", - "lib/CAPI/Dialect/LinalgPasses.cpp", - ], - hdrs = [ - "include/mlir-c/Dialect/Linalg.h", - ], - capi_deps = [ - ":CAPIIR", - ], - header_deps = [ - ":LinalgPassIncGen", - ], - includes = ["include"], - deps = [ - ":LinalgDialect", - ":LinalgTransforms", - ":Pass", - ], -) - -mlir_c_api_cc_library( - name = "CAPILLVM", - srcs = [ - "lib/CAPI/Dialect/LLVM.cpp", - ], - hdrs = [ - "include/mlir-c/Dialect/LLVM.h", - ], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":LLVMDialect", - "//llvm:Support", - ], -) - -mlir_c_api_cc_library( - name = "CAPIMath", - srcs = ["lib/CAPI/Dialect/Math.cpp"], - hdrs = ["include/mlir-c/Dialect/Math.h"], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":MathDialect", - ], -) - -mlir_c_api_cc_library( - name = "CAPIMemRef", - srcs = ["lib/CAPI/Dialect/MemRef.cpp"], - hdrs = ["include/mlir-c/Dialect/MemRef.h"], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":MemRefDialect", - ], -) - -mlir_c_api_cc_library( - name = "CAPINVGPU", - srcs = ["lib/CAPI/Dialect/NVGPU.cpp"], - hdrs = ["include/mlir-c/Dialect/NVGPU.h"], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":IR", - ":NVGPUDialect", - ], -) - -mlir_c_api_cc_library( - name = "CAPINVVM", - srcs = ["lib/CAPI/Dialect/NVVM.cpp"], - hdrs = ["include/mlir-c/Dialect/NVVM.h"], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":NVVMDialect", - ], -) - -mlir_c_api_cc_library( - name = "CAPITarget", - srcs = ["lib/CAPI/Target/LLVMIR.cpp"], - hdrs = ["include/mlir-c/Target/LLVMIR.h"], - capi_deps = [ - ":CAPIIR", - ], - header_deps = [ - "//llvm:Support", - ], - includes = ["include"], - deps = [ - ":LLVMToLLVMIRTranslation", - ":Support", - ":ToLLVMIRTranslation", - ":ToLLVMIRTranslationRegistration", - "//llvm:Core", - ], -) - -mlir_c_api_cc_library( - name = "CAPIGPU", - srcs = [ - "lib/CAPI/Dialect/GPU.cpp", - "lib/CAPI/Dialect/GPUPasses.cpp", - ], - hdrs = [ - "include/mlir-c/Dialect/GPU.h", - ], - capi_deps = [ - ":CAPIIR", - ], - header_deps = [ - ":GPUPassIncGen", - ], - includes = ["include"], - deps = [ - ":GPUDialect", - ":GPUTransforms", - ":Pass", - "//llvm:Support", - ], -) - -mlir_c_api_cc_library( - name = "CAPIROCDL", - srcs = ["lib/CAPI/Dialect/ROCDL.cpp"], - hdrs = ["include/mlir-c/Dialect/ROCDL.h"], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":ROCDLDialect", - ], -) - -mlir_c_api_cc_library( - name = "CAPISCF", - srcs = ["lib/CAPI/Dialect/SCF.cpp"], - hdrs = ["include/mlir-c/Dialect/SCF.h"], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":SCFDialect", - ], -) - -mlir_c_api_cc_library( - name = "CAPISparseTensor", - srcs = [ - "lib/CAPI/Dialect/SparseTensor.cpp", - "lib/CAPI/Dialect/SparseTensorPasses.cpp", - ], - hdrs = [ - "include/mlir-c/Dialect/SparseTensor.h", - ], - capi_deps = [ - ":CAPIIR", - ], - header_deps = [ - ":SparseTensorPassIncGen", - ], - includes = ["include"], - deps = [ - ":Pass", - ":SparseTensorDialect", - ":SparseTensorTransforms", - ":Support", - ], -) - -mlir_c_api_cc_library( - name = "CAPIQuant", - srcs = [ - "lib/CAPI/Dialect/Quant.cpp", - ], - hdrs = [ - "include/mlir-c/Dialect/Quant.h", - ], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":QuantOps", - ], -) - -mlir_c_api_cc_library( - name = "CAPIPDL", - srcs = [ - "lib/CAPI/Dialect/PDL.cpp", - ], - hdrs = [ - "include/mlir-c/Dialect/PDL.h", - ], - header_deps = [ - ":CAPIIRHeaders", - ], - includes = ["include"], - deps = [ - ":CAPIIR", - ":PDLDialect", - ":PDLOpsIncGen", - ":PDLTypesIncGen", - ], -) - -mlir_c_api_cc_library( - name = "CAPITransformDialect", - srcs = [ - "lib/CAPI/Dialect/Transform.cpp", - ], - hdrs = [ - "include/mlir-c/Dialect/Transform.h", - ], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":TransformDialect", - ], -) - -mlir_c_api_cc_library( - name = "CAPITransformDialectTransforms", - srcs = [ - "lib/CAPI/Dialect/TransformInterpreter.cpp", - ], - hdrs = [ - "include/mlir-c/Dialect/Transform/Interpreter.h", - ], - capi_deps = [ - ":CAPIIR", - ":CAPITransformDialect", - ], - includes = ["include"], - deps = [ - ":TransformDialect", - ":TransformDialectInterfaces", - ":TransformDialectTransforms", - ], -) - -mlir_c_api_cc_library( - name = "CAPIMLProgram", - srcs = [ - "lib/CAPI/Dialect/MLProgram.cpp", - ], - hdrs = [ - "include/mlir-c/Dialect/MLProgram.h", - ], - header_deps = [ - ":CAPIIRHeaders", - ], - includes = ["include"], - deps = [ - ":CAPIIR", - ":MLProgramDialect", - ":MLProgramOpsIncGen", - ":MLProgramTypesIncGen", - ], -) - -mlir_c_api_cc_library( - name = "CAPIVector", - srcs = ["lib/CAPI/Dialect/Vector.cpp"], - hdrs = ["include/mlir-c/Dialect/Vector.h"], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":VectorDialect", - ], -) - -mlir_c_api_cc_library( - name = "CAPIConversion", - srcs = ["lib/CAPI/Conversion/Passes.cpp"], - hdrs = ["include/mlir-c/Conversion.h"], - capi_deps = [ - ":CAPIIR", - ], - header_deps = [ - ":ConversionPassIncGen", - ], - includes = ["include"], - deps = [ - ":ConversionPasses", - ":ConvertToSPIRV", - ":Pass", - ], -) - -mlir_c_api_cc_library( - name = "CAPIDebug", - srcs = ["lib/CAPI/Debug/Debug.cpp"], - hdrs = ["include/mlir-c/Debug.h"], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":Support", - "//llvm:Support", - ], -) - -mlir_c_api_cc_library( - name = "CAPIExecutionEngine", - srcs = ["lib/CAPI/ExecutionEngine/ExecutionEngine.cpp"], - hdrs = [ - "include/mlir-c/ExecutionEngine.h", - "include/mlir/CAPI/ExecutionEngine.h", - ], - capi_deps = [ - ":CAPIIR", - ], - header_deps = [ - ":ExecutionEngine", - ], - includes = ["include"], - deps = [ - ":BuiltinToLLVMIRTranslation", - ":ExecutionEngineUtils", - ":LLVMToLLVMIRTranslation", - ":OpenMPToLLVMIRTranslation", - "//llvm:OrcJIT", - "//llvm:Support", - ], -) - -mlir_c_api_cc_library( - name = "CAPITransforms", - srcs = [ - "lib/CAPI/Transforms/Passes.cpp", - "lib/CAPI/Transforms/Rewrite.cpp", - ], - hdrs = ["include/mlir-c/Transforms.h"], - capi_deps = [ - ":CAPIIR", - ], - header_deps = [ - ":TransformsPassIncGen", - ], - includes = ["include"], - deps = [ - ":IR", - ":Pass", - ":Rewrite", - ":TransformUtils", - ":Transforms", - ], -) - -mlir_c_api_cc_library( - name = "CAPIRegisterEverything", - srcs = ["lib/CAPI/RegisterEverything/RegisterEverything.cpp"], - hdrs = ["include/mlir-c/RegisterEverything.h"], - capi_deps = [ - ":CAPIIR", - ], - includes = ["include"], - deps = [ - ":AllExtensions", - ":AllPassesAndDialects", - ":AllToLLVMIRTranslations", - ":BuiltinToLLVMIRTranslation", - ":IR", - ":LLVMToLLVMIRTranslation", - ], -) - -##---------------------------------------------------------------------------## -# Sources of Python bindings. -#----------------------------------------------------------------------------## - -exports_files( - glob(["lib/Bindings/Python/**/*.cpp"]), -) - -filegroup( - name = "MLIRBindingsPythonHeaderFiles", - srcs = glob([ - "lib/Bindings/Python/*.h", - "include/mlir-c/Bindings/Python/*.h", - "include/mlir/Bindings/Python/*.h", - ]), -) - -cc_library( - name = "MLIRBindingsPythonHeaders", - includes = [ - "include", - "lib/Bindings/Python", - ], - textual_hdrs = [":MLIRBindingsPythonHeaderFiles"], - deps = [ - ":CAPIIRHeaders", - ":CAPITransformsHeaders", - "@pybind11", - "@rules_python//python/cc:current_py_cc_headers", - ], -) - -cc_library( - name = "MLIRBindingsPythonHeadersAndDeps", - includes = [ - "include", - "lib/Bindings/Python", - ], - textual_hdrs = [":MLIRBindingsPythonHeaderFiles"], - deps = [ - ":CAPIIR", - ":CAPITransforms", - "@pybind11", - "@rules_python//python/cc:current_py_cc_headers", - ], -) - -# These flags are needed for pybind11 to work. -PYBIND11_COPTS = [ - "-fexceptions", - "-frtti", -] - -PYBIND11_FEATURES = [ - # Cannot use header_modules (parse_headers feature fails). - "-use_header_modules", -] - -filegroup( - name = "MLIRBindingsPythonSourceFiles", - srcs = [ - "lib/Bindings/Python/IRAffine.cpp", - "lib/Bindings/Python/IRAttributes.cpp", - "lib/Bindings/Python/IRCore.cpp", - "lib/Bindings/Python/IRInterfaces.cpp", - "lib/Bindings/Python/IRModule.cpp", - "lib/Bindings/Python/IRTypes.cpp", - "lib/Bindings/Python/Pass.cpp", - "lib/Bindings/Python/Rewrite.cpp", - ], -) - -cc_library( - name = "MLIRBindingsPythonCore", - srcs = [":MLIRBindingsPythonSourceFiles"], - copts = PYBIND11_COPTS, - features = PYBIND11_FEATURES, - deps = [ - ":CAPIAsync", - ":CAPIDebug", - ":CAPIIR", - ":CAPIInterfaces", - ":MLIRBindingsPythonHeadersAndDeps", - ":Support", - ":config", - "//llvm:Support", - "@pybind11", - "@rules_python//python/cc:current_py_cc_headers", - ], -) - -cc_library( - name = "MLIRBindingsPythonCoreNoCAPI", - srcs = [":MLIRBindingsPythonSourceFiles"], - copts = PYBIND11_COPTS, - features = PYBIND11_FEATURES, - deps = [ - ":CAPIAsyncHeaders", - ":CAPIDebugHeaders", - ":CAPIIRHeaders", - ":MLIRBindingsPythonHeaders", - ":Support", - ":config", - "//llvm:Support", - "@pybind11", - "@rules_python//python/cc:current_py_cc_headers", - ], -) - -# Target that bundles together the CAPI objects needed for -# MLIRBindingsPythonCoreNoCAPI. -cc_library( - name = "MLIRBindingsPythonCAPIObjects", - deps = [ - ":CAPIAsyncObjects", - ":CAPIDebugObjects", - ":CAPIIRObjects", - ":CAPIInterfacesObjects", - ":CAPITransformsObjects", - ], -) - -# Dynamic library with the MLIR Python extension. -cc_binary( - name = "_mlir.so", - srcs = ["lib/Bindings/Python/MainModule.cpp"], - # These flags are needed for pybind11 to work. - copts = PYBIND11_COPTS, - features = PYBIND11_FEATURES, - linkshared = 1, - linkstatic = 0, - deps = [ - ":MLIRBindingsPythonCore", - ":MLIRBindingsPythonHeadersAndDeps", - ], -) - -cc_binary( - name = "_mlirDialectsLinalg.so", - srcs = ["lib/Bindings/Python/DialectLinalg.cpp"], - copts = PYBIND11_COPTS, - features = PYBIND11_FEATURES, - linkshared = 1, - linkstatic = 0, - deps = [ - ":CAPIIR", - ":CAPILinalg", - ":MLIRBindingsPythonHeadersAndDeps", - ], -) - -cc_binary( - name = "_mlirDialectsLLVM.so", - srcs = ["lib/Bindings/Python/DialectLLVM.cpp"], - copts = PYBIND11_COPTS, - features = PYBIND11_FEATURES, - linkshared = 1, - linkstatic = 0, - deps = [ - ":CAPIIR", - ":CAPILLVM", - ":MLIRBindingsPythonHeadersAndDeps", - "@pybind11", - ], -) - -cc_binary( - name = "_mlirDialectsQuant.so", - srcs = ["lib/Bindings/Python/DialectQuant.cpp"], - copts = PYBIND11_COPTS, - features = PYBIND11_FEATURES, - linkshared = 1, - linkstatic = 0, - deps = [ - ":CAPIIR", - ":CAPIQuant", - ":MLIRBindingsPythonHeadersAndDeps", - "@pybind11", - ], -) - -cc_binary( - name = "_mlirDialectsSparseTensor.so", - srcs = ["lib/Bindings/Python/DialectSparseTensor.cpp"], - copts = PYBIND11_COPTS, - features = PYBIND11_FEATURES, - linkshared = 1, - linkstatic = 0, - deps = [ - ":CAPIIR", - ":CAPISparseTensor", - ":MLIRBindingsPythonHeadersAndDeps", - "@pybind11", - ], -) - -# Dynamic library with the MLIR Conversions Python extension. -cc_binary( - name = "_mlirExecutionEngine.so", - srcs = ["lib/Bindings/Python/ExecutionEngineModule.cpp"], - copts = PYBIND11_COPTS, - features = PYBIND11_FEATURES, - linkshared = 1, - linkstatic = 0, - deps = [ - ":CAPIExecutionEngine", - ":MLIRBindingsPythonHeadersAndDeps", - "@pybind11", - "@rules_python//python/cc:current_py_cc_headers", - ], -) - -# Dynamic library with the MLIR Linalg dialect+passes Python extension. -cc_binary( - name = "_mlirLinalgPasses.so", - srcs = ["lib/Bindings/Python/LinalgPasses.cpp"], - copts = PYBIND11_COPTS, - features = PYBIND11_FEATURES, - linkshared = 1, - linkstatic = 0, - deps = [ - ":CAPILinalg", - ":MLIRBindingsPythonHeadersAndDeps", - "@pybind11", - "@rules_python//python/cc:current_py_cc_headers", - ], -) - -##---------------------------------------------------------------------------## - -td_library( - name = "AttrTdFiles", - srcs = [ - "include/mlir/IR/AttrTypeBase.td", - "include/mlir/IR/EnumAttr.td", - ], - includes = ["include"], -) - -td_library( - name = "OpBaseTdFiles", - srcs = [ - "include/mlir/IR/CommonAttrConstraints.td", - "include/mlir/IR/CommonTypeConstraints.td", - "include/mlir/IR/Constraints.td", - "include/mlir/IR/DialectBase.td", - "include/mlir/IR/Interfaces.td", - "include/mlir/IR/OpAsmInterface.td", - "include/mlir/IR/OpBase.td", - "include/mlir/IR/PatternBase.td", - "include/mlir/IR/Properties.td", - "include/mlir/IR/RegionKindInterface.td", - "include/mlir/IR/SymbolInterfaces.td", - "include/mlir/IR/TensorEncoding.td", - "include/mlir/IR/Traits.td", - "include/mlir/IR/Utils.td", - ], - includes = ["include"], - deps = [ - ":AttrTdFiles", - ], -) - -td_library( - name = "BytecodeTdFiles", - srcs = ["include/mlir/IR/BytecodeBase.td"], - includes = ["include"], -) - -td_library( - name = "CallInterfacesTdFiles", - srcs = ["include/mlir/Interfaces/CallInterfaces.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "CastInterfacesTdFiles", - srcs = ["include/mlir/Interfaces/CastInterfaces.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "ControlFlowInterfacesTdFiles", - srcs = ["include/mlir/Interfaces/ControlFlowInterfaces.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "BytecodeOpInterfaceTdFiles", - srcs = ["include/mlir/Bytecode/BytecodeOpInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "CopyOpInterfaceTdFiles", - srcs = ["include/mlir/Interfaces/CopyOpInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "DerivedAttributeOpInterfaceTdFiles", - srcs = ["include/mlir/Interfaces/DerivedAttributeOpInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "DestinationStyleOpInterfaceTdFiles", - srcs = ["include/mlir/Interfaces/DestinationStyleOpInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "InferIntRangeInterfaceTdFiles", - srcs = ["include/mlir/Interfaces/InferIntRangeInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "InferTypeOpInterfaceTdFiles", - srcs = ["include/mlir/Interfaces/InferTypeOpInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "LoopLikeInterfaceTdFiles", - srcs = ["include/mlir/Interfaces/LoopLikeInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "MemorySlotInterfacesTdFiles", - srcs = ["include/mlir/Interfaces/MemorySlotInterfaces.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "ShapedOpInterfacesTdFiles", - srcs = ["include/mlir/Interfaces/ShapedOpInterfaces.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "ParallelCombiningOpInterfaceTdFiles", - srcs = ["include/mlir/Interfaces/ParallelCombiningOpInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "RuntimeVerifiableOpInterfaceTdFiles", - srcs = ["include/mlir/Interfaces/RuntimeVerifiableOpInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "SideEffectInterfacesTdFiles", - srcs = [ - "include/mlir/Interfaces/SideEffectInterfaceBase.td", - "include/mlir/Interfaces/SideEffectInterfaces.td", - ], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "TilingInterfaceTdFiles", - srcs = ["include/mlir/Interfaces/TilingInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "VectorInterfacesTdFiles", - srcs = ["include/mlir/Interfaces/VectorInterfaces.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "ViewLikeInterfaceTdFiles", - srcs = ["include/mlir/Interfaces/ViewLikeInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "ReducerTdFiles", - srcs = ["include/mlir/Reducer/Passes.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -##---------------------------------------------------------------------------## -# Affine dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "PassBaseTdFiles", - srcs = ["include/mlir/Pass/PassBase.td"], - includes = ["include"], -) - -td_library( - name = "RewritePassBaseTdFiles", - srcs = ["include/mlir/Rewrite/PassUtil.td"], - includes = ["include"], -) - -td_library( - name = "AffineOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td", - "include/mlir/Dialect/Affine/IR/AffineOps.td", - ], - includes = ["include"], - deps = [ - ":ArithOpsTdFiles", - ":FuncTdFiles", - ":LoopLikeInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "AffineOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Affine/IR/AffineOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Affine/IR/AffineOps.cpp.inc", - ), - ( - [ - "-gen-dialect-decls", - "-dialect=affine", - ], - "include/mlir/Dialect/Affine/IR/AffineOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=affine", - ], - "include/mlir/Dialect/Affine/IR/AffineOpsDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Affine/IR/AffineOps.td", - deps = [":AffineOpsTdFiles"], -) - -gentbl_cc_library( - name = "AffineMemoryOpInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td", - deps = [":AffineOpsTdFiles"], -) - -td_library( - name = "AffineTransformOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Affine/TransformOps/AffineTransformOps.td", - ], - includes = ["include"], - deps = [ - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "AffineTransformOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Affine/TransformOps/AffineTransformOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Affine/TransformOps/AffineTransformOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Affine/TransformOps/AffineTransformOps.td", - deps = [ - ":AffineTransformOpsTdFiles", - ], -) - -cc_library( - name = "AffineTransformOps", - srcs = glob(["lib/Dialect/Affine/TransformOps/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/Affine/TransformOps/*.h"]), - includes = ["include"], - deps = [ - ":AffineAnalysis", - ":AffineDialect", - ":AffineTransformOpsIncGen", - ":AffineUtils", - ":BytecodeOpInterface", - ":IR", - ":TransformDialect", - ":TransformDialectInterfaces", - ":TransformUtils", - ], -) - -##---------------------------------------------------------------------------## -# AMDGPU dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "AMDGPUTdFiles", - srcs = ["include/mlir/Dialect/AMDGPU/IR/AMDGPU.td"], - includes = ["include"], - deps = [ - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "AMDGPUIncGen", - tbl_outs = [ - ( - [ - "-gen-attrdef-decls", - "-dialect=amdgpu", - ], - "include/mlir/Dialect/AMDGPU/IR/AMDGPUAttributes.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "-dialect=amdgpu", - ], - "include/mlir/Dialect/AMDGPU/IR/AMDGPUAttributes.cpp.inc", - ), - ( - [ - "-gen-dialect-decls", - "-dialect=amdgpu", - ], - "include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=amdgpu", - ], - "include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.cpp.inc", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/AMDGPU/IR/AMDGPUEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/AMDGPU/IR/AMDGPUEnums.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/AMDGPU/IR/AMDGPU.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/AMDGPU/IR/AMDGPU.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/AMDGPU/IR/AMDGPU.md", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/AMDGPU/IR/AMDGPU.td", - deps = [":AMDGPUTdFiles"], -) - -cc_library( - name = "AMDGPUDialect", - srcs = ["lib/Dialect/AMDGPU/IR/AMDGPUDialect.cpp"], - hdrs = ["include/mlir/Dialect/AMDGPU/IR/AMDGPUDialect.h"], - includes = ["include"], - deps = [ - ":AMDGPUIncGen", - ":ArithDialect", - ":BytecodeOpInterface", - ":GPUDialect", - ":IR", - ":SideEffectInterfaces", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "AMDGPUPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=AMDGPU", - ], - "include/mlir/Dialect/AMDGPU/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/AMDGPU/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "AMDGPUTransforms", - srcs = glob( - [ - "lib/Dialect/AMDGPU/Transforms/*.cpp", - ], - ), - hdrs = glob(["include/mlir/Dialect/AMDGPU/Transforms/*.h"]), - includes = ["include"], - deps = [ - ":AMDGPUDialect", - ":AMDGPUPassIncGen", - ":AMDGPUUtils", - ":ArithDialect", - ":ControlFlowDialect", - ":FuncDialect", - ":GPUDialect", - ":IR", - ":MemRefDialect", - ":Pass", - ":SideEffectInterfaces", - ":Support", - ":TransformUtils", - ":VectorDialect", - ], -) - -cc_library( - name = "AMDGPUUtils", - srcs = glob(["lib/Dialect/AMDGPU/Utils/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/AMDGPU/Utils/*.h"]), - includes = ["include"], - deps = [ - ":Support", - "//llvm:Support", - ], -) - -##---------------------------------------------------------------------------## -# EmitC dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "EmitCTdFiles", - srcs = [ - "include/mlir/Dialect/EmitC/IR/EmitC.td", - "include/mlir/Dialect/EmitC/IR/EmitCAttributes.td", - "include/mlir/Dialect/EmitC/IR/EmitCBase.td", - "include/mlir/Dialect/EmitC/IR/EmitCTypes.td", - ], - includes = ["include"], - deps = [ - ":BuiltinDialectTdFiles", - ":CallInterfacesTdFiles", - ":CastInterfacesTdFiles", - ":ControlFlowInterfacesTdFiles", - ":FunctionInterfacesTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "EmitCAttributesIncGen", - tbl_outs = [ - ( - ["--gen-attrdef-decls"], - "include/mlir/Dialect/EmitC/IR/EmitCAttributes.h.inc", - ), - ( - ["--gen-attrdef-defs"], - "include/mlir/Dialect/EmitC/IR/EmitCAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/EmitC/IR/EmitCAttributes.td", - deps = [":EmitCTdFiles"], -) - -gentbl_cc_library( - name = "EmitCOpsIncGen", - tbl_outs = [ - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/EmitC/IR/EmitCDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/EmitC/IR/EmitCDialect.cpp.inc", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/EmitC/IR/EmitCEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/EmitC/IR/EmitCEnums.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/EmitC/IR/EmitC.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/EmitC/IR/EmitC.cpp.inc", - ), - ( - ["-gen-typedef-decls"], - "include/mlir/Dialect/EmitC/IR/EmitCTypes.h.inc", - ), - ( - ["-gen-typedef-defs"], - "include/mlir/Dialect/EmitC/IR/EmitCTypes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/EmitC/IR/EmitC.td", - deps = [":EmitCTdFiles"], -) - -gentbl_cc_library( - name = "EmitCPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=EmitC", - ], - "include/mlir/Dialect/EmitC/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/EmitC/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "TargetCpp", - srcs = glob([ - "lib/Target/Cpp/*.cpp", - ]), - hdrs = glob(["include/mlir/Target/Cpp/*.h"]), - deps = [ - ":ControlFlowDialect", - ":EmitCDialect", - ":FuncDialect", - ":IR", - ":Support", - ":TranslateLib", - "//llvm:Support", - ], -) - -##---------------------------------------------------------------------------## -# Async dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "AsyncOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Async/IR/AsyncDialect.td", - "include/mlir/Dialect/Async/IR/AsyncOps.td", - "include/mlir/Dialect/Async/IR/AsyncTypes.td", - ], - includes = ["include"], - deps = [ - ":CallInterfacesTdFiles", - ":ControlFlowInterfacesTdFiles", - ":FunctionInterfacesTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "AsyncOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Async/IR/AsyncOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Async/IR/AsyncOps.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/Async/IR/AsyncOpsDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/Async/IR/AsyncOpsDialect.cpp.inc", - ), - ( - ["-gen-typedef-decls"], - "include/mlir/Dialect/Async/IR/AsyncOpsTypes.h.inc", - ), - ( - ["-gen-typedef-defs"], - "include/mlir/Dialect/Async/IR/AsyncOpsTypes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Async/IR/AsyncOps.td", - deps = [":AsyncOpsTdFiles"], -) - -gentbl_cc_library( - name = "AsyncPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Async", - ], - "include/mlir/Dialect/Async/Passes.h.inc", - ), - ( - [ - "-gen-pass-capi-header", - "--prefix=Async", - ], - "include/mlir/Dialect/Async/Passes.capi.h.inc", - ), - ( - [ - "-gen-pass-capi-impl", - "--prefix=Async", - ], - "include/mlir/Dialect/Async/Passes.capi.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Async/Passes.td", - deps = [":PassBaseTdFiles"], -) - -##---------------------------------------------------------------------------## -# ArmNeon dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "ArmNeonTdFiles", - srcs = ["include/mlir/Dialect/ArmNeon/ArmNeon.td"], - includes = ["include"], - deps = [ - ":LLVMOpsTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ArmNeonIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=arm_neon", - ], - "include/mlir/Dialect/ArmNeon/ArmNeonDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=arm_neon", - ], - "include/mlir/Dialect/ArmNeon/ArmNeonDialect.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/ArmNeon/ArmNeon.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/ArmNeon/ArmNeon.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/ArmNeon/ArmNeon.md", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/ArmNeon/ArmNeon.td", - deps = [":ArmNeonTdFiles"], -) - -cc_library( - name = "ArmNeonDialect", - srcs = ["lib/Dialect/ArmNeon/IR/ArmNeonDialect.cpp"], - hdrs = ["include/mlir/Dialect/ArmNeon/ArmNeonDialect.h"], - includes = ["include"], - deps = [ - ":ArmNeonIncGen", - ":BytecodeOpInterface", - ":IR", - ":SideEffectInterfaces", - ":VectorDialect", - ], -) - -cc_library( - name = "ArmNeonTransforms", - srcs = glob(["lib/Dialect/ArmNeon/Transforms/*.cpp"]), - hdrs = ["include/mlir/Dialect/ArmNeon/Transforms.h"], - includes = ["include"], - deps = [ - ":ArithDialect", - ":ArmNeonDialect", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":LLVMDialect", - ":Support", - ":TransformUtils", - ":VectorDialect", - ], -) - -gentbl_cc_library( - name = "ArmNeonConversionIncGen", - tbl_outs = [ - ( - ["-gen-llvmir-conversions"], - "include/mlir/Dialect/ArmNeon/ArmNeonConversions.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/ArmNeon/ArmNeon.td", - deps = [":ArmNeonTdFiles"], -) - -cc_library( - name = "ArmNeon2dToIntr", - srcs = glob([ - "lib/Conversion/ArmNeon2dToIntr/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/ArmNeon2dToIntr/*.h", - ]), - includes = ["include"], - deps = [ - ":ArmNeonDialect", - ":ConversionPassIncGen", - ":IR", - ":Pass", - ":TransformUtils", - ":VectorDialect", - ], -) - -##---------------------------------------------------------------------------## -# ArmSME dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "ArmSMETdFiles", - srcs = [ - "include/mlir/Dialect/ArmSME/IR/ArmSME.td", - ], - includes = ["include"], - deps = [ - ":ArithOpsTdFiles", - ":FuncTdFiles", - ":LLVMOpsTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ArmSMETransformsPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=ArmSME", - ], - "include/mlir/Dialect/ArmSME/Transforms/Passes.h.inc", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/ArmSME/Transforms/PassesEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/ArmSME/Transforms/PassesEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/ArmSME/Transforms/Passes.td", - deps = [ - ":OpBaseTdFiles", - ":PassBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "ArmSMEIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/ArmSME/IR/ArmSME.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/ArmSME/IR/ArmSME.cpp.inc", - ), - ( - ["-gen-typedef-decls"], - "include/mlir/Dialect/ArmSME/IR/ArmSMETypes.h.inc", - ), - ( - ["-gen-typedef-defs"], - "include/mlir/Dialect/ArmSME/IR/ArmSMETypes.cpp.inc", - ), - ( - [ - "-gen-dialect-decls", - "-dialect=arm_sme", - ], - "include/mlir/Dialect/ArmSME/IR/ArmSMEDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=arm_sme", - ], - "include/mlir/Dialect/ArmSME/IR/ArmSMEDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/ArmSME/IR/ArmSME.td", - deps = [":ArmSMETdFiles"], -) - -gentbl_cc_library( - name = "ArmSMEOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/ArmSME/IR/ArmSMEOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/ArmSME/IR/ArmSMEOps.cpp.inc", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/ArmSME/IR/ArmSMEEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/ArmSME/IR/ArmSMEEnums.cpp.inc", - ), - ( - [ - "-gen-attrdef-decls", - "-attrdefs-dialect=arm_sme", - ], - "include/mlir/Dialect/ArmSME/IR/ArmSMEAttrDefs.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "-attrdefs-dialect=arm_sme", - ], - "include/mlir/Dialect/ArmSME/IR/ArmSMEAttrDefs.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/ArmSME/IR/ArmSMEOps.td", - deps = [":ArmSMETdFiles"], -) - -gentbl_cc_library( - name = "ArmSMEConversionIncGen", - tbl_outs = [ - ( - ["-gen-llvmir-conversions"], - "include/mlir/Dialect/ArmSME/IR/ArmSMEOpsConversions.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/ArmSME/IR/ArmSMEOps.td", - deps = [":ArmSMETdFiles"], -) - -gentbl_cc_library( - name = "ArmSMEOpInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/ArmSME/IR/ArmSMEOps.td", - deps = [":ArmSMETdFiles"], -) - -cc_library( - name = "ArmSMEOpInterfaces", - hdrs = [ - "include/mlir/Dialect/ArmSME/IR/ArmSMEOpInterfaces.h", - ], - includes = ["include"], - deps = [ - ":ArmSMEOpInterfacesIncGen", - ":IR", - ":Support", - ":VectorDialect", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "ArmSMEIntrinsicOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicOps.cpp.inc", - ), - ( - ["-gen-llvmir-conversions"], - "include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicConversions.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/ArmSME/IR/ArmSMEIntrinsicOps.td", - deps = [":ArmSMETdFiles"], -) - -cc_library( - name = "ArmSMEEnums", - hdrs = [ - "include/mlir/Dialect/ArmSME/IR/ArmSMEEnums.h", - ], - deps = [ - ":ArmSMEIncGen", - ":ArmSMEOpsIncGen", - ":IR", - ], -) - -cc_library( - name = "ArmSMEDialect", - srcs = glob(["lib/Dialect/ArmSME/IR/*.cpp"]), - hdrs = [ - "include/mlir/Dialect/ArmSME/IR/ArmSME.h", - "include/mlir/Dialect/ArmSME/Utils/Utils.h", - ], - includes = ["include"], - deps = [ - ":ArmSMEEnums", - ":ArmSMEIncGen", - ":ArmSMEIntrinsicOpsIncGen", - ":ArmSMEOpInterfaces", - ":ArmSMEOpInterfacesIncGen", - ":ArmSMEOpsIncGen", - ":BytecodeOpInterface", - ":FunctionInterfaces", - ":IR", - ":LLVMDialect", - ":MemRefDialect", - ":SCFDialect", - ":SideEffectInterfaces", - ":VectorDialect", - "//llvm:Support", - ], -) - -cc_library( - name = "ArmSMETransforms", - srcs = glob(["lib/Dialect/ArmSME/Transforms/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/ArmSME/Transforms/*.h"]), - includes = ["include"], - deps = [ - ":Analysis", - ":ArithUtils", - ":ArmSMEDialect", - ":ArmSMETransformsPassIncGen", - ":ControlFlowDialect", - ":DialectUtils", - ":FuncDialect", - ":FuncTransforms", - ":FunctionInterfaces", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MemRefDialect", - ":Pass", - ":SCFDialect", - ":SCFTransforms", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "ArmSMEToSCF", - srcs = glob(["lib/Conversion/ArmSMEToSCF/*.cpp"]), - hdrs = glob(["include/mlir/Conversion/ArmSMEToSCF/*.h"]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":ArmSMEDialect", - ":ConversionPassIncGen", - ":Pass", - ":SCFDialect", - ":TransformUtils", - ], -) - -cc_library( - name = "ArmSMEToLLVM", - srcs = glob(["lib/Conversion/ArmSMEToLLVM/*.cpp"]), - hdrs = glob(["include/mlir/Conversion/ArmSMEToLLVM/*.h"]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":ArmSMEDialect", - ":ArmSMETransforms", - ":ControlFlowDialect", - ":ConversionPassIncGen", - ":FuncDialect", - ":FunctionInterfaces", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MemRefDialect", - ":Pass", - ":TransformUtils", - ":VectorDialect", - ], -) - -##---------------------------------------------------------------------------## -# ArmSVE dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "ArmSVETdFiles", - srcs = [ - "include/mlir/Dialect/ArmSVE/IR/ArmSVE.td", - ], - includes = ["include"], - deps = [ - ":ArithOpsTdFiles", - ":FuncTdFiles", - ":LLVMOpsTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ArmSVEIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/ArmSVE/IR/ArmSVE.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/ArmSVE/IR/ArmSVE.cpp.inc", - ), - ( - ["-gen-typedef-decls"], - "include/mlir/Dialect/ArmSVE/IR/ArmSVETypes.h.inc", - ), - ( - ["-gen-typedef-defs"], - "include/mlir/Dialect/ArmSVE/IR/ArmSVETypes.cpp.inc", - ), - ( - [ - "-gen-dialect-decls", - "-dialect=arm_sve", - ], - "include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=arm_sve", - ], - "include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/ArmSVE/IR/ArmSVE.td", - deps = [":ArmSVETdFiles"], -) - -cc_library( - name = "ArmSVEDialect", - srcs = ["lib/Dialect/ArmSVE/IR/ArmSVEDialect.cpp"], - hdrs = ["include/mlir/Dialect/ArmSVE/IR/ArmSVEDialect.h"], - includes = ["include"], - deps = [ - ":ArmSVEIncGen", - ":BytecodeOpInterface", - ":IR", - ":LLVMDialect", - ":SideEffectInterfaces", - ":VectorDialect", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "ArmSVEPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=ArmSVE", - ], - "include/mlir/Dialect/ArmSVE/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/ArmSVE/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "ArmSVETransforms", - srcs = glob(["lib/Dialect/ArmSVE/Transforms/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/ArmSVE/Transforms/*.h"]), - includes = ["include"], - deps = [ - ":ArmSVEDialect", - ":ArmSVEPassIncGen", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MemRefDialect", - ":Pass", - ":TransformUtils", - ":VectorDialect", - ], -) - -gentbl_cc_library( - name = "ArmSVEConversionIncGen", - tbl_outs = [ - ( - ["-gen-llvmir-conversions"], - "include/mlir/Dialect/ArmSVE/IR/ArmSVEConversions.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/ArmSVE/IR/ArmSVE.td", - deps = [":ArmSVETdFiles"], -) - -##---------------------------------------------------------------------------## -# AMX dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "AMXTdFiles", - srcs = ["include/mlir/Dialect/AMX/AMX.td"], - includes = ["include"], - deps = [ - ":LLVMOpsTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "AMXIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=amx", - ], - "include/mlir/Dialect/AMX/AMXDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=amx", - ], - "include/mlir/Dialect/AMX/AMXDialect.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/AMX/AMX.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/AMX/AMX.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/AMX/AMX.md", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/AMX/AMX.td", - deps = [":AMXTdFiles"], -) - -cc_library( - name = "AMXDialect", - srcs = ["lib/Dialect/AMX/IR/AMXDialect.cpp"], - hdrs = ["include/mlir/Dialect/AMX/AMXDialect.h"], - includes = ["include"], - deps = [ - ":AMXIncGen", - ":BytecodeOpInterface", - ":IR", - ":LLVMDialect", - ":SideEffectInterfaces", - ], -) - -cc_library( - name = "AMXTransforms", - srcs = glob(["lib/Dialect/AMX/Transforms/*.cpp"]), - hdrs = ["include/mlir/Dialect/AMX/Transforms.h"], - includes = ["include"], - deps = [ - ":AMXDialect", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ], -) - -gentbl_cc_library( - name = "AMXConversionIncGen", - tbl_outs = [ - ( - ["-gen-llvmir-conversions"], - "include/mlir/Dialect/AMX/AMXConversions.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/AMX/AMX.td", - deps = [":AMXTdFiles"], -) - -##---------------------------------------------------------------------------## -# X86Vector dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "X86VectorTdFiles", - srcs = ["include/mlir/Dialect/X86Vector/X86Vector.td"], - includes = ["include"], - deps = [ - ":InferTypeOpInterfaceTdFiles", - ":LLVMOpsTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "X86VectorIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=x86vector", - ], - "include/mlir/Dialect/X86Vector/X86VectorDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=x86vector", - ], - "include/mlir/Dialect/X86Vector/X86VectorDialect.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/X86Vector/X86Vector.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/X86Vector/X86Vector.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/X86Vector/X86Vector.md", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/X86Vector/X86Vector.td", - deps = [":X86VectorTdFiles"], -) - -cc_library( - name = "X86VectorDialect", - srcs = ["lib/Dialect/X86Vector/IR/X86VectorDialect.cpp"], - hdrs = ["include/mlir/Dialect/X86Vector/X86VectorDialect.h"], - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":IR", - ":InferTypeOpInterface", - ":LLVMDialect", - ":SideEffectInterfaces", - ":X86VectorIncGen", - ], -) - -cc_library( - name = "X86VectorTransforms", - srcs = glob(["lib/Dialect/X86Vector/Transforms/*.cpp"]), - hdrs = ["include/mlir/Dialect/X86Vector/Transforms.h"], - includes = ["include"], - deps = [ - ":ArithDialect", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":VectorDialect", - ":VectorUtils", - ":X86VectorDialect", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "X86VectorConversionIncGen", - tbl_outs = [ - ( - ["-gen-llvmir-conversions"], - "include/mlir/Dialect/X86Vector/X86VectorConversions.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/X86Vector/X86Vector.td", - deps = [":X86VectorTdFiles"], -) - -##---------------------------------------------------------------------------## -# IRDL dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "IRDLTdFiles", - srcs = [ - "include/mlir/Dialect/IRDL/IR/IRDL.td", - "include/mlir/Dialect/IRDL/IR/IRDLAttributes.td", - "include/mlir/Dialect/IRDL/IR/IRDLInterfaces.td", - "include/mlir/Dialect/IRDL/IR/IRDLOps.td", - "include/mlir/Dialect/IRDL/IR/IRDLTypes.td", - ], - includes = ["include"], - deps = [ - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "IRDLIncGen", - tbl_outs = [ - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/IRDL/IR/IRDLDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/IRDL/IR/IRDLDialect.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/IRDL/IR/IRDL.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/IRDL/IR/IRDL.cpp.inc", - ), - ( - ["-gen-typedef-decls"], - "include/mlir/Dialect/IRDL/IR/IRDLTypes.h.inc", - ), - ( - ["-gen-typedef-defs"], - "include/mlir/Dialect/IRDL/IR/IRDLTypes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/IRDL/IR/IRDLOps.td", - deps = [":IRDLTdFiles"], -) - -gentbl_cc_library( - name = "IRDLInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/IRDL/IR/IRDLInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/IRDL/IR/IRDLInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/IRDL/IR/IRDLInterfaces.td", - deps = [":IRDLTdFiles"], -) - -gentbl_cc_library( - name = "IRDLAttributesIncGen", - tbl_outs = [ - ( - ["-gen-attrdef-decls"], - "include/mlir/Dialect/IRDL/IR/IRDLAttributes.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "include/mlir/Dialect/IRDL/IR/IRDLAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/IRDL/IR/IRDLAttributes.td", - deps = [":IRDLTdFiles"], -) - -gentbl_cc_library( - name = "IRDLEnumsIncGen", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/IRDL/IR/IRDLEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/IRDL/IR/IRDLEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/IRDL/IR/IRDLAttributes.td", - deps = [":IRDLTdFiles"], -) - -gentbl_cc_library( - name = "IRDLOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/IRDL/IR/IRDLOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/IRDL/IR/IRDLOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/IRDL/IR/IRDLOps.td", - deps = [":IRDLTdFiles"], -) - -gentbl_cc_library( - name = "IRDLTypesIncGen", - tbl_outs = [ - ( - ["-gen-typedef-decls"], - "include/mlir/Dialect/IRDL/IR/IRDLTypesGen.h.inc", - ), - ( - ["-gen-typedef-defs"], - "include/mlir/Dialect/IRDL/IR/IRDLTypesGen.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/IRDL/IR/IRDLTypes.td", - deps = [":IRDLTdFiles"], -) - -cc_library( - name = "IRDLDialect", - srcs = [ - "lib/Dialect/IRDL/IR/IRDL.cpp", - "lib/Dialect/IRDL/IR/IRDLOps.cpp", - "lib/Dialect/IRDL/IRDLLoading.cpp", - "lib/Dialect/IRDL/IRDLSymbols.cpp", - "lib/Dialect/IRDL/IRDLVerifiers.cpp", - ], - hdrs = [ - "include/mlir/Dialect/IRDL/IR/IRDL.h", - "include/mlir/Dialect/IRDL/IR/IRDLInterfaces.h", - "include/mlir/Dialect/IRDL/IR/IRDLTraits.h", - "include/mlir/Dialect/IRDL/IRDLLoading.h", - "include/mlir/Dialect/IRDL/IRDLSymbols.h", - "include/mlir/Dialect/IRDL/IRDLVerifiers.h", - ], - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":Dialect", - ":IR", - ":IRDLAttributesIncGen", - ":IRDLEnumsIncGen", - ":IRDLIncGen", - ":IRDLInterfacesIncGen", - ":IRDLOpsIncGen", - ":IRDLTypesIncGen", - ":InferTypeOpInterface", - ":SideEffectInterfaces", - ":Support", - "//llvm:Core", - "//llvm:Support", - ], -) - -##---------------------------------------------------------------------------## -# SCF dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "SCFTdFiles", - srcs = [ - "include/mlir/Dialect/SCF/IR/DeviceMappingInterface.td", - "include/mlir/Dialect/SCF/IR/SCFOps.td", - ], - includes = ["include"], - deps = [ - ":ControlFlowInterfacesTdFiles", - ":DestinationStyleOpInterfaceTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":LoopLikeInterfaceTdFiles", - ":ParallelCombiningOpInterfaceTdFiles", - ":SideEffectInterfacesTdFiles", - ":ViewLikeInterfaceTdFiles", - ], -) - -gentbl_cc_library( - name = "SCFIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/SCF/IR/SCFOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/SCF/IR/SCFOps.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/SCF/IR/SCFOpsDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/SCF/IR/SCFOpsDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SCF/IR/SCFOps.td", - deps = [":SCFTdFiles"], -) - -gentbl_cc_library( - name = "SCFDeviceMappingInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-attr-interface-decls"], - "include/mlir/Dialect/SCF/IR/DeviceMappingAttrInterface.h.inc", - ), - ( - ["-gen-attr-interface-defs"], - "include/mlir/Dialect/SCF/IR/DeviceMappingAttrInterface.cpp.inc", - ), - ( - ["-gen-attrdef-decls"], - "include/mlir/Dialect/SCF/IR/DeviceMappingAttributes.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "include/mlir/Dialect/SCF/IR/DeviceMappingAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SCF/IR/DeviceMappingInterface.td", - deps = [":SCFTdFiles"], -) - -gentbl_cc_library( - name = "SCFPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=SCF", - ], - "include/mlir/Dialect/SCF/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SCF/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "SCFTransforms", - srcs = glob([ - "lib/Dialect/SCF/Transforms/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/SCF/Transforms/*.h", - ]), - includes = ["include"], - deps = [ - ":AffineAnalysis", - ":AffineDialect", - ":Analysis", - ":ArithDialect", - ":ArithUtils", - ":BufferizationDialect", - ":BufferizationInterfaces", - ":BufferizationTransforms", - ":DestinationStyleOpInterface", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":LoopLikeInterface", - ":MemRefDialect", - ":Pass", - ":SCFDialect", - ":SCFPassIncGen", - ":SCFUtils", - ":SideEffectInterfaces", - ":Support", - ":TensorDialect", - ":TensorTransforms", - ":TilingInterface", - ":TransformUtils", - ":ViewLikeInterface", - "//llvm:Support", - ], -) - -td_library( - name = "SCFTransformOpsTdFiles", - srcs = [ - "include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td", - ], - includes = ["include"], - deps = [ - ":PDLDialect", - ":TransformLoopExtensionTdFiles", - ], -) - -gentbl_cc_library( - name = "SCFTransformOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td", - deps = [ - ":SCFTransformOpsTdFiles", - ], -) - -cc_library( - name = "SCFTransformOps", - srcs = glob(["lib/Dialect/SCF/TransformOps/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/SCF/TransformOps/*.h"]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":AffineUtils", - ":ArithDialect", - ":ArithUtils", - ":BytecodeOpInterface", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":LoopLikeInterface", - ":SCFDialect", - ":SCFToControlFlow", - ":SCFTransformOpsIncGen", - ":SCFTransforms", - ":SCFUtils", - ":TransformDialect", - ":TransformDialectInterfaces", - ":VectorDialect", - ], -) - -##---------------------------------------------------------------------------## -# SparseTensor dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "SparseTensorTdFiles", - srcs = glob([ - "include/mlir/Dialect/SparseTensor/IR/*.td", - ]), - includes = ["include"], - deps = [ - ":ControlFlowInterfacesTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":LoopLikeInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "SparseTensorAttrDefsIncGen", - tbl_outs = [ - ( - ["--gen-attrdef-decls"], - "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.h.inc", - ), - ( - ["--gen-attrdef-defs"], - "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.cpp.inc", - ), - ( - ["--gen-enum-decls"], - "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrEnums.h.inc", - ), - ( - ["--gen-enum-defs"], - "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td", - deps = [":SparseTensorTdFiles"], -) - -gentbl_cc_library( - name = "SparseTensorOpsIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=sparse_tensor", - ], - "include/mlir/Dialect/SparseTensor/IR/SparseTensorOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=sparse_tensor", - ], - "include/mlir/Dialect/SparseTensor/IR/SparseTensorOpsDialect.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/SparseTensor/SparseTensor.md", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td", - deps = [":SparseTensorTdFiles"], -) - -gentbl_cc_library( - name = "SparseTensorTypesIncGen", - tbl_outs = [ - ( - ["--gen-typedef-decls"], - "include/mlir/Dialect/SparseTensor/IR/SparseTensorTypes.h.inc", - ), - ( - ["--gen-typedef-defs"], - "include/mlir/Dialect/SparseTensor/IR/SparseTensorTypes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SparseTensor/IR/SparseTensorTypes.td", - deps = [":SparseTensorTdFiles"], -) - -gentbl_cc_library( - name = "SparseTensorPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=SparseTensor", - ], - "include/mlir/Dialect/SparseTensor/Transforms/Passes.h.inc", - ), - ( - [ - "-gen-pass-capi-header", - "--prefix=SparseTensor", - ], - "include/mlir/Dialect/SparseTensor/Transforms/Passes.capi.h.inc", - ), - ( - [ - "-gen-pass-capi-impl", - "--prefix=SparseTensor", - ], - "include/mlir/Dialect/SparseTensor/Transforms/Passes.capi.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SparseTensor/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -gentbl_cc_library( - name = "SparseTensorInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/SparseTensor/IR/SparseTensorInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/SparseTensor/IR/SparseTensorInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SparseTensor/IR/SparseTensorInterfaces.td", - deps = [":SparseTensorTdFiles"], -) - -td_library( - name = "SparseTensorTransformOpsTdFiles", - srcs = glob([ - "include/mlir/Dialect/SparseTensor/TransformOps/*.td", - ]), - includes = ["include"], - deps = [ - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "SparseTensorTransformOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/SparseTensor/TransformOps/SparseTensorTransformOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/SparseTensor/TransformOps/SparseTensorTransformOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SparseTensor/TransformOps/SparseTensorTransformOps.td", - deps = [ - ":SparseTensorTransformOpsTdFiles", - ], -) - -# This library is shared by both SparseTensorDialect and -# SparseTensorRuntime, so it must not depend on any of the MLIR/LLVM -# internals or else mlir_c_runner_utils will inherit that dependency. -cc_library( - name = "SparseTensorEnums", - hdrs = ["include/mlir/Dialect/SparseTensor/IR/Enums.h"], - includes = ["include"], -) - -cc_library( - name = "SparseTensorDialect", - srcs = glob([ - "lib/Dialect/SparseTensor/IR/*.cpp", - "lib/Dialect/SparseTensor/IR/Detail/*.cpp", - "lib/Dialect/SparseTensor/IR/Detail/*.h", - ]), - hdrs = [ - "include/mlir/Dialect/SparseTensor/IR/SparseTensor.h", - "include/mlir/Dialect/SparseTensor/IR/SparseTensorInterfaces.h", - "include/mlir/Dialect/SparseTensor/IR/SparseTensorStorageLayout.h", - "include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h", - ], - includes = ["include"], - deps = [ - ":ArithDialect", - ":BufferizationInterfaces", - ":BytecodeOpInterface", - ":ComplexDialect", - ":ControlFlowInterfaces", - ":DialectUtils", - ":IR", - ":InferTypeOpInterface", - ":LoopLikeInterface", - ":SideEffectInterfaces", - ":SparseTensorAttrDefsIncGen", - ":SparseTensorEnums", - ":SparseTensorInterfacesIncGen", - ":SparseTensorOpsIncGen", - ":SparseTensorTypesIncGen", - "//llvm:Support", - ], -) - -cc_library( - name = "SparseTensorTransformOps", - srcs = glob([ - "lib/Dialect/SparseTensor/TransformOps/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/SparseTensor/TransformOps/*.h", - ]), - includes = ["include"], - deps = [ - ":IR", - ":LinalgTransformOps", - ":SparseTensorDialect", - ":SparseTensorTransformOpsIncGen", - ":TransformDialect", - ":TransformDialectInterfaces", - ], -) - -cc_library( - name = "SparseTensorUtils", - srcs = glob([ - "lib/Dialect/SparseTensor/Utils/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/SparseTensor/Utils/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":ComplexDialect", - ":IR", - ":LinalgDialect", - ":MathDialect", - ":SparseTensorDialect", - ":SparseTensorEnums", - "//llvm:Support", - ], -) - -cc_library( - name = "SparseTensorTransforms", - srcs = glob([ - "lib/Dialect/SparseTensor/Transforms/*.cpp", - "lib/Dialect/SparseTensor/Transforms/Utils/*.cpp", - "lib/Dialect/SparseTensor/Transforms/Utils/*.h", - ]), - hdrs = [ - "include/mlir/Dialect/SparseTensor/Transforms/BufferizableOpInterfaceImpl.h", - "include/mlir/Dialect/SparseTensor/Transforms/Passes.h", - ], - includes = ["include"], - deps = [ - ":AffineDialect", - ":ArithDialect", - ":ArithUtils", - ":BufferizationDialect", - ":BufferizationInterfaces", - ":BufferizationTransforms", - ":ComplexDialect", - ":DialectUtils", - ":FuncDialect", - ":FuncTransforms", - ":GPUDialect", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":LinalgDialect", - ":LinalgTransforms", - ":LinalgUtils", - ":MathDialect", - ":MemRefDialect", - ":Pass", - ":SCFDialect", - ":SCFTransforms", - ":SparseTensorDialect", - ":SparseTensorEnums", - ":SparseTensorPassIncGen", - ":SparseTensorUtils", - ":Support", - ":TensorDialect", - ":TransformUtils", - ":Transforms", - ":VectorDialect", - "//llvm:Support", - ], -) - -cc_library( - name = "SparseTensorPipelines", - srcs = glob([ - "lib/Dialect/SparseTensor/Pipelines/*.cpp", - ]), - hdrs = [ - "include/mlir/Dialect/SparseTensor/Pipelines/Passes.h", - ], - includes = ["include"], - local_defines = if_cuda_available(["MLIR_GPU_TO_CUBIN_PASS_ENABLE"]), - deps = [ - ":ArithTransforms", - ":BufferizationTransforms", - ":ConversionPasses", - ":FuncDialect", - ":GPUDialect", - ":GPUToNVVMTransforms", - ":GPUTransforms", - ":LinalgTransforms", - ":MemRefTransforms", - ":NVVMDialect", - ":Pass", - ":SparseTensorDialect", - ":SparseTensorTransforms", - ":Transforms", - ":VectorToLLVM", - ], -) - -##---------------------------------------------------------------------------## -# Mesh Dialect -##---------------------------------------------------------------------------## - -td_library( - name = "MeshTdFiles", - srcs = [ - "include/mlir/Dialect/Mesh/IR/MeshBase.td", - "include/mlir/Dialect/Mesh/IR/MeshOps.td", - ], - includes = ["include"], - deps = [ - ":BuiltinDialectTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "MeshIncGen", - tbl_outs = [ - ( - [ - "-gen-op-decls", - "-dialect=mesh", - ], - "include/mlir/Dialect/Mesh/IR/MeshOps.h.inc", - ), - ( - [ - "-gen-op-defs", - "-dialect=mesh", - ], - "include/mlir/Dialect/Mesh/IR/MeshOps.cpp.inc", - ), - ( - [ - "-gen-dialect-decls", - "-dialect=mesh", - ], - "include/mlir/Dialect/Mesh/IR/MeshDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=mesh", - ], - "include/mlir/Dialect/Mesh/IR/MeshDialect.cpp.inc", - ), - ( - [ - "-gen-enum-decls", - "-dialect=mesh", - ], - "include/mlir/Dialect/Mesh/IR/MeshEnums.h.inc", - ), - ( - [ - "-gen-enum-defs", - "-dialect=mesh", - ], - "include/mlir/Dialect/Mesh/IR/MeshEnums.cpp.inc", - ), - ( - [ - "-gen-attrdef-decls", - "-dialect=mesh", - ], - "include/mlir/Dialect/Mesh/IR/MeshAttributes.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "-dialect=mesh", - ], - "include/mlir/Dialect/Mesh/IR/MeshAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Mesh/IR/MeshOps.td", - deps = [ - ":MeshTdFiles", - ":ShapeOpsTdFiles", - ], -) - -gentbl_cc_library( - name = "MeshShardingInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/Mesh/Interfaces/ShardingInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/Mesh/Interfaces/ShardingInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Mesh/Interfaces/ShardingInterface.td", - deps = [":OpBaseTdFiles"], -) - -cc_library( - name = "MeshShardingInterface", - srcs = ["lib/Dialect/Mesh/Interfaces/ShardingInterface.cpp"], - hdrs = [ - "include/mlir/Dialect/Mesh/Interfaces/ShardingInterface.h", - "include/mlir/Dialect/Mesh/Interfaces/ShardingInterfaceImpl.h", - ], - includes = ["include"], - deps = [ - ":DialectUtils", - ":IR", - ":MeshDialect", - ":MeshShardingInterfaceIncGen", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "MeshDialect", - srcs = ["lib/Dialect/Mesh/IR/MeshOps.cpp"], - hdrs = [ - "include/mlir/Dialect/Mesh/IR/MeshDialect.h", - "include/mlir/Dialect/Mesh/IR/MeshOps.h", - ], - includes = ["include"], - deps = [ - ":ArithDialect", - ":BytecodeOpInterface", - ":DialectUtils", - ":IR", - ":InferTypeOpInterface", - ":MeshIncGen", - ":SideEffectInterfaces", - ":Support", - ":ViewLikeInterface", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "MeshTransformsPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Mesh", - ], - "include/mlir/Dialect/Mesh/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Mesh/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "MeshTransforms", - srcs = glob([ - "lib/Dialect/Mesh/Transforms/*.cpp", - "lib/Dialect/Mesh/Transforms/*.h", - ]), - hdrs = glob(["include/mlir/Dialect/Mesh/Transforms/*.h"]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":AffineUtils", - ":ArithDialect", - ":ArithUtils", - ":ControlFlowDialect", - ":ControlFlowInterfaces", - ":DialectUtils", - ":FuncDialect", - ":FunctionInterfaces", - ":IR", - ":MeshDialect", - ":MeshShardingInterface", - ":MeshTransformsPassIncGen", - ":Pass", - ":Support", - ":TensorDialect", - ":Transforms", - "//llvm:Support", - ], -) - -##---------------------------------------------------------------------------## -# NVGPU dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "NVGPUTdFiles", - srcs = ["include/mlir/Dialect/NVGPU/IR/NVGPU.td"], - includes = ["include"], - deps = [ - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "NVGPUIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=nvgpu", - ], - "include/mlir/Dialect/NVGPU/IR/NVGPUDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=nvgpu", - ], - "include/mlir/Dialect/NVGPU/IR/NVGPUDialect.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/NVGPU/IR/NVGPU.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/NVGPU/IR/NVGPU.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/NVGPU/NVGPU.md", - ), - ( - ["-gen-typedef-decls"], - "include/mlir/Dialect/NVGPU/IR/NVGPUTypes.h.inc", - ), - ( - ["-gen-typedef-defs"], - "include/mlir/Dialect/NVGPU/IR/NVGPUTypes.cpp.inc", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/NVGPU/IR/NVGPUEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/NVGPU/IR/NVGPUEnums.cpp.inc", - ), - ( - ["-gen-attrdef-decls"], - "include/mlir/Dialect/NVGPU/IR/NVGPUAttrDefs.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "include/mlir/Dialect/NVGPU/IR/NVGPUAttrDefs.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/NVGPU/IR/NVGPU.td", - deps = [":NVGPUTdFiles"], -) - -gentbl_cc_library( - name = "NVGPUPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=NVGPU", - ], - "include/mlir/Dialect/NVGPU/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/NVGPU/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "NVGPUDialect", - srcs = ["lib/Dialect/NVGPU/IR/NVGPUDialect.cpp"], - hdrs = ["include/mlir/Dialect/NVGPU/IR/NVGPUDialect.h"], - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":GPUDialect", - ":IR", - ":LLVMDialect", - ":NVGPUIncGen", - ":SideEffectInterfaces", - "//llvm:Support", - ], -) - -cc_library( - name = "NVGPUTransformOps", - srcs = glob([ - "lib/Dialect/NVGPU/TransformOps/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/NVGPU/TransformOps/*.h", - ]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":Analysis", - ":ArithDialect", - ":ArithUtils", - ":DialectUtils", - ":GPUDialect", - ":GPUToGPURuntimeTransforms", - ":IR", - ":LLVMCommonConversion", - ":LinalgDialect", - ":MemRefDialect", - ":NVGPUDialect", - ":NVGPUToNVVM", - ":NVGPUTransformOpsIncGen", - ":NVGPUTransforms", - ":NVVMDialect", - ":SCFDialect", - ":SCFTransforms", - ":TransformDialect", - ":TransformDialectInterfaces", - ":VectorDialect", - "//llvm:Support", - ], -) - -td_library( - name = "NVGPUTransformOpsTdFiles", - srcs = glob([ - "include/mlir/Dialect/NVGPU/TransformOps/*.td", - ]), - includes = ["include"], - deps = [ - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "NVGPUTransformOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/NVGPU/TransformOps/NVGPUTransformOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/NVGPU/TransformOps/NVGPUTransformOps.td", - deps = [ - ":NVGPUTransformOpsTdFiles", - ], -) - -cc_library( - name = "NVGPUUtils", - srcs = ["lib/Dialect/NVGPU/Utils/MMAUtils.cpp"], - hdrs = ["include/mlir/Dialect/NVGPU/Utils/MMAUtils.h"], - includes = ["include"], - deps = [ - ":AffineDialect", - ":ArithDialect", - ":IR", - ":NVGPUDialect", - ":NVVMDialect", - ":VectorDialect", - ], -) - -cc_library( - name = "NVGPUTransforms", - srcs = glob([ - "lib/Dialect/NVGPU/Transforms/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/NVGPU/Transforms/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":GPUDialect", - ":IR", - ":MemRefDialect", - ":NVGPUDialect", - ":NVGPUPassIncGen", - ":Pass", - ":SideEffectInterfaces", - ":Support", - ":VectorDialect", - "//llvm:Support", - ], -) - -##---------------------------------------------------------------------------## -# XeGPU dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "XeGPUTdFiles", - srcs = glob(["include/mlir/Dialect/XeGPU/IR/*.td"]), - includes = ["include"], - deps = [ - ":BuiltinDialectTdFiles", - ":OpBaseTdFiles", - ":ShapedOpInterfacesTdFiles", - ":ViewLikeInterfaceTdFiles", - ], -) - -gentbl_cc_library( - name = "XeGPUIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=xegpu", - ], - "include/mlir/Dialect/XeGPU/IR/XeGPUDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=xegpu", - ], - "include/mlir/Dialect/XeGPU/IR/XeGPUDialect.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/XeGPU/IR/XeGPU.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/XeGPU/IR/XeGPU.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/XeGPU/XeGPU.md", - ), - ( - [ - "-gen-typedef-decls", - "-typedefs-dialect=xegpu", - ], - "include/mlir/Dialect/XeGPU/IR/XeGPUTypes.h.inc", - ), - ( - [ - "-gen-typedef-defs", - "-typedefs-dialect=xegpu", - ], - "include/mlir/Dialect/XeGPU/IR/XeGPUTypes.cpp.inc", - ), - ( - [ - "-gen-attrdef-decls", - "-attrdefs-dialect=xegpu", - ], - "include/mlir/Dialect/XeGPU/IR/XeGPUAttrs.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "-attrdefs-dialect=xegpu", - ], - "include/mlir/Dialect/XeGPU/IR/XeGPUAttrs.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/XeGPU/IR/XeGPU.td", - deps = [ - ":ArithOpsTdFiles", - ":XeGPUTdFiles", - ], -) - -td_library( - name = "XeGPUAttrTdFiles", - srcs = [ - "include/mlir/Dialect/XeGPU/IR/XeGPUAttrs.td", - "include/mlir/Dialect/XeGPU/IR/XeGPUDialect.td", - ], - includes = ["include"], - deps = [ - ":BuiltinDialectTdFiles", - ":OpBaseTdFiles", - ":ShapedOpInterfacesTdFiles", - ":ViewLikeInterfaceTdFiles", - ], -) - -# Separated from the XeGPUIncGen target because the enum declaration causes -# duplicate declarations with the Arith enums. -gentbl_cc_library( - name = "XeGPUEnumsIncGen", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/XeGPU/IR/XeGPUEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/XeGPU/IR/XeGPUEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/XeGPU/IR/XeGPUAttrs.td", - deps = [":XeGPUAttrTdFiles"], -) - -cc_library( - name = "XeGPUDialect", - srcs = [ - "lib/Dialect/XeGPU/IR/XeGPUDialect.cpp", - "lib/Dialect/XeGPU/IR/XeGPUOps.cpp", - ], - hdrs = ["include/mlir/Dialect/XeGPU/IR/XeGPU.h"], - includes = ["include"], - deps = [ - ":ArithDialect", - ":BytecodeOpInterface", - ":DialectUtils", - ":IR", - ":ShapedOpInterfaces", - ":SideEffectInterfaces", - ":ViewLikeInterface", - ":XeGPUEnumsIncGen", - ":XeGPUIncGen", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "XeGPUPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=XeGPU", - ], - "include/mlir/Dialect/XeGPU/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/XeGPU/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "XeGPUTransforms", - srcs = glob([ - "lib/Dialect/XeGPU/Transforms/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/XeGPU/Transforms/*.h", - ]), - includes = ["include"], - deps = [ - ":AffineUtils", - ":IR", - ":MemRefDialect", - ":Pass", - ":SideEffectInterfaces", - ":Support", - ":TransformUtils", - ":XeGPUDialect", - ":XeGPUPassIncGen", - "//llvm:Support", - ], -) - -td_library( - name = "FuncTdFiles", - srcs = [ - "include/mlir/Dialect/Func/IR/FuncOps.td", - ], - includes = ["include"], - deps = [ - ":AttrTdFiles", - ":CallInterfacesTdFiles", - ":CastInterfacesTdFiles", - ":ControlFlowInterfacesTdFiles", - ":FunctionInterfacesTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ":VectorInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "FuncIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Func/IR/FuncOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Func/IR/FuncOps.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/Func/IR/FuncOpsDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/Func/IR/FuncOpsDialect.cpp.inc", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/Func/IR/FuncOpsEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/Func/IR/FuncOpsEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Func/IR/FuncOps.td", - deps = [":FuncTdFiles"], -) - -cc_library( - name = "Dialect", - srcs = glob([ - "lib/Dialect/*.cpp", - ]), - hdrs = glob( - include = ["include/mlir/Dialect/*.h"], - exclude = ["include/mlir/Dialect/CommonFolders.h"], - ), - includes = ["include"], - deps = [ - ":IR", - "//llvm:Support", - ], -) - -td_library( - name = "DialectUtilsTdFiles", - srcs = [ - "include/mlir/Dialect/Utils/StructuredOpsUtils.td", - ], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -gentbl_cc_library( - name = "DialectUtilsIncGen", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/Utils/DialectUtilsEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/Utils/DialectUtilsEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Utils/StructuredOpsUtils.td", - deps = [":DialectUtilsTdFiles"], -) - -cc_library( - name = "DialectUtils", - srcs = glob([ - "lib/Dialect/Utils/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/Utils/*.h", - ]), - includes = ["include"], - deps = [ - ":DialectUtilsIncGen", - ":IR", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "AffineDialect", - srcs = glob([ - "lib/Dialect/Affine/IR/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/Affine/IR/*.h", - ]), - includes = ["include"], - deps = [ - ":AffineMemoryOpInterfacesIncGen", - ":AffineOpsIncGen", - ":ArithDialect", - ":ControlFlowInterfaces", - ":IR", - ":InliningUtils", - ":LoopLikeInterface", - ":MemRefDialect", - ":ShapedOpInterfaces", - ":Support", - ":UBDialect", - ":ValueBoundsOpInterface", - "//llvm:Support", - ], -) - -cc_library( - name = "EmitCDialect", - srcs = glob([ - "lib/Dialect/EmitC/IR/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/EmitC/IR/*.h", - ]), - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":CastInterfaces", - ":ControlFlowInterfaces", - ":EmitCAttributesIncGen", - ":EmitCOpsIncGen", - ":FunctionInterfaces", - ":IR", - ":SideEffectInterfaces", - "//llvm:Support", - ], -) - -cc_library( - name = "EmitCTransforms", - srcs = glob([ - "lib/Dialect/EmitC/Transforms/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/EmitC/Transforms/*.h", - ]), - includes = ["include"], - deps = [ - ":EmitCDialect", - ":EmitCPassIncGen", - ":IR", - ":Pass", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "AsyncDialect", - srcs = glob([ - "lib/Dialect/Async/IR/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/Async/IR/*.h", - ]), - includes = ["include"], - deps = [ - ":AsyncOpsIncGen", - ":BytecodeOpInterface", - ":CallOpInterfaces", - ":ControlFlowInterfaces", - ":FunctionInterfaces", - ":IR", - ":InferTypeOpInterface", - ":SideEffectInterfaces", - "//llvm:Support", - ], -) - -cc_library( - name = "AsyncTransforms", - srcs = glob([ - "lib/Dialect/Async/Transforms/*.cpp", - "lib/Dialect/Async/Transforms/*.h", - ]), - hdrs = [ - "include/mlir/Dialect/Async/Passes.h", - "include/mlir/Dialect/Async/Transforms.h", - ], - includes = ["include"], - deps = [ - ":Analysis", - ":ArithDialect", - ":AsyncDialect", - ":AsyncPassIncGen", - ":ControlFlowDialect", - ":FuncDialect", - ":IR", - ":Pass", - ":SCFDialect", - ":SCFToControlFlow", - ":Support", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "AffineAnalysis", - srcs = glob([ - "lib/Dialect/Affine/Analysis/*.cpp", - ]), - hdrs = glob(["include/mlir/Dialect/Affine/Analysis/*.h"]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":Analysis", - ":ArithDialect", - ":CallOpInterfaces", - ":DialectUtils", - ":IR", - ":SideEffectInterfaces", - ":Support", - ":ViewLikeInterface", - "//llvm:Support", - ], -) - -cc_library( - name = "AffineUtils", - srcs = glob( - [ - "lib/Dialect/Affine/Utils/*.cpp", - ], - ), - hdrs = [ - "include/mlir/Dialect/Affine/LoopFusionUtils.h", - "include/mlir/Dialect/Affine/LoopUtils.h", - "include/mlir/Dialect/Affine/Utils.h", - "include/mlir/Dialect/Affine/ViewLikeInterfaceUtils.h", - ], - includes = ["include"], - deps = [ - ":AffineAnalysis", - ":AffineDialect", - ":Analysis", - ":ArithUtils", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":MemRefDialect", - ":SCFDialect", - ":Support", - ":TransformUtils", - ":ViewLikeInterface", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "AffinePassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Affine", - ], - "include/mlir/Dialect/Affine/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Affine/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "AffineTransforms", - srcs = glob([ - "lib/Dialect/Affine/Transforms/*.cpp", - ]), - hdrs = [ - "include/mlir/Dialect/Affine/Passes.h", - "include/mlir/Dialect/Affine/Transforms/Transforms.h", - ], - includes = ["include"], - deps = [ - ":AffineAnalysis", - ":AffineDialect", - ":AffinePassIncGen", - ":AffineUtils", - ":Analysis", - ":ArithDialect", - ":ArithUtils", - ":FuncDialect", - ":IR", - ":MemRefDialect", - ":Pass", - ":SCFDialect", - ":SCFUtils", - ":SideEffectInterfaces", - ":Support", - ":TensorDialect", - ":TransformUtils", - ":Transforms", - ":ValueBoundsOpInterface", - ":VectorDialect", - ":VectorUtils", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "ConversionPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Conversion", - ], - "include/mlir/Conversion/Passes.h.inc", - ), - ( - [ - "-gen-pass-capi-header", - "--prefix=Conversion", - ], - "include/mlir/Conversion/Passes.capi.h.inc", - ), - ( - [ - "-gen-pass-capi-impl", - "--prefix=Conversion", - ], - "include/mlir/Conversion/Passes.capi.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Conversion/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "ConversionPasses", - hdrs = ["include/mlir/Conversion/Passes.h"], - includes = ["include"], - deps = [ - ":AMDGPUToROCDL", - ":AffineToStandard", - ":ArithToAMDGPU", - ":ArithToArmSME", - ":ArithToEmitC", - ":ArithToLLVM", - ":ArithToSPIRV", - ":ArmNeon2dToIntr", - ":ArmSMEToLLVM", - ":ArmSMEToSCF", - ":AsyncToLLVM", - ":BufferizationToMemRef", - ":ComplexToLLVM", - ":ComplexToLibm", - ":ComplexToSPIRV", - ":ComplexToStandard", - ":ControlFlowToLLVM", - ":ControlFlowToSCF", - ":ControlFlowToSPIRV", - ":ConversionPassIncGen", - ":ConvertToLLVM", - ":ConvertToSPIRV", - ":FuncToEmitC", - ":FuncToLLVM", - ":FuncToSPIRV", - ":GPUToGPURuntimeTransforms", - ":GPUToLLVMSPVTransforms", - ":GPUToNVVMTransforms", - ":GPUToROCDLTransforms", - ":GPUToSPIRV", - ":GPUToVulkanTransforms", - ":IndexToLLVM", - ":IndexToSPIRV", - ":LinalgToStandard", - ":MathToFuncs", - ":MathToLLVM", - ":MathToLibm", - ":MathToROCDL", - ":MathToSPIRV", - ":MemRefToEmitC", - ":MemRefToLLVM", - ":MemRefToSPIRV", - ":NVGPUToNVVM", - ":NVVMToLLVM", - ":OpenACCToSCF", - ":OpenMPToLLVM", - ":PDLToPDLInterp", - ":ReconcileUnrealizedCasts", - ":SCFToControlFlow", - ":SCFToEmitC", - ":SCFToGPU", - ":SCFToOpenMP", - ":SCFToSPIRV", - ":SPIRVToLLVM", - ":ShapeToStandard", - ":TensorToLinalg", - ":TensorToSPIRV", - ":TosaToArith", - ":TosaToLinalg", - ":TosaToMLProgram", - ":TosaToSCF", - ":TosaToTensor", - ":UBToLLVM", - ":UBToSPIRV", - ":VectorToArmSME", - ":VectorToGPU", - ":VectorToLLVM", - ":VectorToSCF", - ":VectorToSPIRV", - ], -) - -cc_library( - name = "AsyncToLLVM", - srcs = glob([ - "lib/Conversion/AsyncToLLVM/*.cpp", - ]), - hdrs = glob(["include/mlir/Conversion/AsyncToLLVM/*.h"]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":AsyncDialect", - ":ConversionPassIncGen", - ":ConvertToLLVMInterface", - ":FuncDialect", - ":FuncToLLVM", - ":FuncTransforms", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":Pass", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "AffineToStandard", - srcs = glob([ - "lib/Conversion/AffineToStandard/*.cpp", - ]), - hdrs = glob(["include/mlir/Conversion/AffineToStandard/*.h"]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":AffineTransforms", - ":AffineUtils", - ":ConversionPassIncGen", - ":IR", - ":MemRefDialect", - ":SCFDialect", - ":Support", - ":TransformUtils", - ":Transforms", - ":VectorDialect", - ], -) - -cc_library( - name = "SCFDialect", - srcs = glob( - [ - "lib/Dialect/SCF/IR/*.cpp", - ], - ), - hdrs = glob( - [ - "include/mlir/Dialect/SCF/IR/*.h", - ], - ), - includes = ["include"], - deps = [ - ":ArithDialect", - ":ArithUtils", - ":BufferizationInterfaces", - ":ControlFlowDialect", - ":ControlFlowInterfaces", - ":DestinationStyleOpInterface", - ":FunctionInterfaces", - ":IR", - ":InferTypeOpInterface", - ":InliningUtils", - ":LoopLikeInterface", - ":MemRefDialect", - ":ParallelCombiningOpInterface", - ":SCFDeviceMappingInterfacesIncGen", - ":SCFIncGen", - ":SideEffectInterfaces", - ":Support", - ":TensorDialect", - ":ValueBoundsOpInterface", - ":ViewLikeInterface", - "//llvm:Support", - ], -) - -cc_library( - name = "SCFUtils", - srcs = glob( - [ - "lib/Dialect/SCF/Utils/*.cpp", - ], - ), - hdrs = glob( - [ - "include/mlir/Dialect/SCF/Utils/*.h", - ], - ), - includes = ["include"], - deps = [ - ":AffineAnalysis", - ":AffineDialect", - ":Analysis", - ":ArithDialect", - ":ArithUtils", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":SCFDialect", - ":SideEffectInterfaces", - ":Support", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "InferIntRangeCommon", - srcs = [ - "lib/Interfaces/Utils/InferIntRangeCommon.cpp", - ], - hdrs = ["include/mlir/Interfaces/Utils/InferIntRangeCommon.h"], - includes = ["include"], - deps = [ - ":InferIntRangeInterface", - "//llvm:Support", - ], -) - -cc_library( - name = "DataLayoutInterfaces", - srcs = ["lib/Interfaces/DataLayoutInterfaces.cpp"], - hdrs = ["include/mlir/Interfaces/DataLayoutInterfaces.h"], - includes = ["include"], - deps = [ - ":DataLayoutInterfacesIncGen", - ":IR", - "//llvm:Support", - ], -) - -cc_library( - name = "InliningUtils", - srcs = ["lib/Transforms/Utils/InliningUtils.cpp"], - hdrs = ["include/mlir/Transforms/InliningUtils.h"], - includes = ["include"], - deps = [ - ":CallOpInterfaces", - ":IR", - "//llvm:Support", - ], -) - -cc_library( - name = "LoopLikeInterface", - srcs = ["lib/Interfaces/LoopLikeInterface.cpp"], - hdrs = ["include/mlir/Interfaces/LoopLikeInterface.h"], - includes = ["include"], - deps = [ - ":FunctionInterfaces", - ":IR", - ":LoopLikeInterfaceIncGen", - "//llvm:Support", - ], -) - -cc_library( - name = "MemorySlotInterfaces", - srcs = ["lib/Interfaces/MemorySlotInterfaces.cpp"], - hdrs = ["include/mlir/Interfaces/MemorySlotInterfaces.h"], - includes = ["include"], - deps = [ - ":IR", - ":MemorySlotInterfacesIncGen", - ], -) - -cc_library( - name = "ShapedOpInterfaces", - srcs = ["lib/Interfaces/ShapedOpInterfaces.cpp"], - hdrs = ["include/mlir/Interfaces/ShapedOpInterfaces.h"], - includes = ["include"], - deps = [ - ":IR", - ":ShapedOpInterfacesIncGen", - ], -) - -cc_library( - name = "ParallelCombiningOpInterface", - srcs = ["lib/Interfaces/ParallelCombiningOpInterface.cpp"], - hdrs = ["include/mlir/Interfaces/ParallelCombiningOpInterface.h"], - includes = ["include"], - deps = [ - ":IR", - ":ParallelCombiningOpInterfaceIncGen", - ], -) - -cc_library( - name = "RuntimeVerifiableOpInterface", - srcs = ["lib/Interfaces/RuntimeVerifiableOpInterface.cpp"], - hdrs = ["include/mlir/Interfaces/RuntimeVerifiableOpInterface.h"], - includes = ["include"], - deps = [ - ":IR", - ":RuntimeVerifiableOpInterfaceIncGen", - ], -) - -cc_library( - name = "VectorInterfaces", - srcs = ["lib/Interfaces/VectorInterfaces.cpp"], - hdrs = ["include/mlir/Interfaces/VectorInterfaces.h"], - includes = ["include"], - deps = [ - ":IR", - ":VectorInterfacesIncGen", - ], -) - -cc_library( - name = "ViewLikeInterface", - srcs = ["lib/Interfaces/ViewLikeInterface.cpp"], - hdrs = ["include/mlir/Interfaces/ViewLikeInterface.h"], - includes = ["include"], - deps = [ - ":DialectUtils", - ":IR", - ":ViewLikeInterfaceIncGen", - ], -) - -cc_library( - name = "CopyOpInterface", - srcs = ["lib/Interfaces/CopyOpInterface.cpp"], - hdrs = ["include/mlir/Interfaces/CopyOpInterface.h"], - includes = ["include"], - deps = [ - ":CopyOpInterfaceIncGen", - ":IR", - ], -) - -td_library( - name = "ShapeOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Shape/IR/ShapeBase.td", - "include/mlir/Dialect/Shape/IR/ShapeOps.td", - ], - includes = ["include"], - deps = [ - ":CallInterfacesTdFiles", - ":CastInterfacesTdFiles", - ":ControlFlowInterfacesTdFiles", - ":FunctionInterfacesTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ShapeOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Shape/IR/ShapeOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Shape/IR/ShapeOps.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/Shape/IR/ShapeOpsDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/Shape/IR/ShapeOpsDialect.cpp.inc", - ), - ( - ["-gen-typedef-decls"], - "include/mlir/Dialect/Shape/IR/ShapeOpsTypes.h.inc", - ), - ( - ["-gen-typedef-defs"], - "include/mlir/Dialect/Shape/IR/ShapeOpsTypes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Shape/IR/ShapeOps.td", - deps = [":ShapeOpsTdFiles"], -) - -gentbl_cc_library( - name = "MLIRShapeCanonicalizationIncGen", - strip_include_prefix = "include/mlir/Dialect/Shape/IR", - tbl_outs = [ - ( - ["-gen-rewriters"], - "include/mlir/Dialect/Shape/IR/ShapeCanonicalization.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "lib/Dialect/Shape/IR/ShapeCanonicalization.td", - deps = [ - ":FuncTdFiles", - ":ShapeOpsTdFiles", - ":TensorOpsTdFiles", - ], -) - -cc_library( - name = "ShapeDialect", - srcs = glob(["lib/Dialect/Shape/IR/*.cpp"]), - hdrs = ["include/mlir/Dialect/Shape/IR/Shape.h"], - includes = ["include"], - deps = [ - ":ArithDialect", - ":BufferizationInterfaces", - ":BytecodeOpInterface", - ":CallOpInterfaces", - ":CastInterfaces", - ":CommonFolders", - ":ControlFlowInterfaces", - ":Dialect", - ":FunctionInterfaces", - ":IR", - ":InferTypeOpInterface", - ":InliningUtils", - ":MLIRShapeCanonicalizationIncGen", - ":ShapeOpsIncGen", - ":SideEffectInterfaces", - ":TensorDialect", - ":UBDialect", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "ShapeToStandardGen", - strip_include_prefix = "lib/Conversion/ShapeToStandard", - tbl_outs = [ - ( - ["-gen-rewriters"], - "lib/Conversion/ShapeToStandard/ShapeToStandard.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "lib/Conversion/ShapeToStandard/ShapeToStandard.td", - deps = [":ShapeOpsTdFiles"], -) - -cc_library( - name = "ShapeToStandard", - srcs = glob([ - "lib/Conversion/ShapeToStandard/*.cpp", - ]), - hdrs = ["include/mlir/Conversion/ShapeToStandard/ShapeToStandard.h"], - includes = ["include"], - deps = [ - ":ArithDialect", - ":ControlFlowDialect", - ":ConversionPassIncGen", - ":FuncDialect", - ":IR", - ":Pass", - ":SCFDialect", - ":ShapeDialect", - ":ShapeToStandardGen", - ":TensorDialect", - ":TransformUtils", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "ShapeTransformsPassIncGen", - tbl_outs = [( - [ - "-gen-pass-decls", - "-name=Shape", - ], - "include/mlir/Dialect/Shape/Transforms/Passes.h.inc", - )], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Shape/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "ShapeTransforms", - srcs = glob([ - "lib/Dialect/Shape/Transforms/*.cpp", - ]), - hdrs = [ - "include/mlir/Dialect/Shape/Analysis/ShapeMappingAnalysis.h", - "include/mlir/Dialect/Shape/Transforms/BufferizableOpInterfaceImpl.h", - "include/mlir/Dialect/Shape/Transforms/Passes.h", - ], - includes = ["include"], - deps = [ - ":ArithDialect", - ":BufferizationDialect", - ":BufferizationInterfaces", - ":BufferizationTransforms", - ":FuncDialect", - ":IR", - ":MemRefDialect", - ":Pass", - ":ShapeDialect", - ":ShapeTransformsPassIncGen", - ":TensorDialect", - ":TransformUtils", - "//llvm:Support", - ], -) - -td_library( - name = "ControlFlowOpsTdFiles", - srcs = [ - "include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.td", - ], - includes = ["include"], - deps = [ - ":AttrTdFiles", - ":CallInterfacesTdFiles", - ":CastInterfacesTdFiles", - ":ControlFlowInterfacesTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ControlFlowOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsDialect.cpp.inc", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/ControlFlow/IR/ControlFlowOpsEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/ControlFlow/IR/ControlFlowOps.td", - deps = [ - ":AttrTdFiles", - ":ControlFlowOpsTdFiles", - ], -) - -cc_library( - name = "ControlFlowDialect", - srcs = glob( - [ - "lib/Dialect/ControlFlow/IR/*.cpp", - ], - ), - hdrs = glob([ - "include/mlir/Dialect/ControlFlow/IR/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":BufferizationInterfaces", - ":BytecodeOpInterface", - ":ControlFlowInterfaces", - ":ControlFlowOpsIncGen", - ":ConvertToLLVMInterface", - ":IR", - ":InliningUtils", - ":SideEffectInterfaces", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "ControlFlowTransforms", - srcs = glob([ - "lib/Dialect/ControlFlow/Transforms/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/ControlFlow/Transforms/*.h", - ]), - includes = ["include"], - deps = [ - ":BufferizationDialect", - ":BufferizationInterfaces", - ":BufferizationTransforms", - ":ControlFlowDialect", - ":IR", - ":MemRefDialect", - ], -) - -cc_library( - name = "FuncDialect", - srcs = glob( - [ - "lib/Dialect/Func/IR/*.cpp", - ], - ), - hdrs = glob([ - "include/mlir/Dialect/Func/IR/*.h", - ]), - includes = ["include"], - deps = [ - ":BufferizationInterfaces", - ":BytecodeOpInterface", - ":CallOpInterfaces", - ":ControlFlowInterfaces", - ":ConvertToLLVMInterface", - ":FuncIncGen", - ":FunctionInterfaces", - ":IR", - ":InferTypeOpInterface", - ":InliningUtils", - ":SideEffectInterfaces", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "FuncExtensions", - srcs = glob(["lib/Dialect/Func/Extensions/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/Func/Extensions/*.h"]), - includes = ["include"], - deps = [ - ":ControlFlowDialect", - ":FuncDialect", - ":IR", - ":InliningUtils", - ":MeshShardingInterface", - ], -) - -td_library( - name = "FuncTransformOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Func/TransformOps/FuncTransformOps.td", - ], - includes = ["include"], - deps = [ - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "FuncTransformOpsIncGen", - strip_include_prefix = "include", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Func/TransformOps/FuncTransformOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Func/TransformOps/FuncTransformOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Func/TransformOps/FuncTransformOps.td", - deps = [ - ":FuncTransformOpsTdFiles", - ], -) - -cc_library( - name = "FuncTransformOps", - srcs = [ - "lib/Dialect/Func/TransformOps/FuncTransformOps.cpp", - ], - hdrs = [ - "include/mlir/Dialect/Func/TransformOps/FuncTransformOps.h", - ], - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":FuncDialect", - ":FuncToLLVM", - ":FuncTransformOpsIncGen", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":TransformDialect", - ":TransformDialectInterfaces", - ":TransformUtils", - ], -) - -cc_library( - name = "AllExtensions", - hdrs = ["include/mlir/InitAllExtensions.h"], - deps = [ - ":AffineTransformOps", - ":ArithToLLVM", - ":BufferizationTransformOps", - ":BuiltinToLLVMIRTranslation", - ":ComplexToLLVM", - ":ControlFlowToLLVM", - ":FuncExtensions", - ":FuncToLLVM", - ":FuncTransformOps", - ":GPUToLLVMIRTranslation", - ":GPUTransformOps", - ":IndexToLLVM", - ":LLVMToLLVMIRTranslation", - ":LinalgTransformOps", - ":MathToLLVM", - ":MemRefToLLVM", - ":MemRefTransformOps", - ":MeshDialect", - ":NVGPUTransformOps", - ":NVVMTarget", - ":NVVMToLLVM", - ":ROCDLTarget", - ":ROCDLToLLVMIRTranslation", - ":SCFTransformOps", - ":SparseTensorTransformOps", - ":TensorTransformOps", - ":TransformDebugExtension", - ":TransformIRDLExtension", - ":TransformLoopExtension", - ":TransformPDLExtension", - ":UBToLLVM", - ":VCIXToLLVMIRTranslation", - ":VectorTransformOps", - ], -) - -# TODO(zinenko): remove this after updating users. - -gentbl_cc_library( - name = "FuncTransformsPassIncGen", - tbl_outs = [( - [ - "-gen-pass-decls", - "-name=Func", - ], - "include/mlir/Dialect/Func/Transforms/Passes.h.inc", - )], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Func/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "FuncTransforms", - srcs = glob([ - "lib/Dialect/Func/Transforms/*.cpp", - ]), - hdrs = glob(["include/mlir/Dialect/Func/Transforms/*.h"]), - includes = ["include"], - deps = [ - ":BufferizationDialect", - ":BufferizationTransforms", - ":FuncDialect", - ":FuncTransformsPassIncGen", - ":IR", - ":MemRefDialect", - ":Pass", - ":Support", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "VectorDialect", - srcs = glob( - [ - "lib/Dialect/Vector/IR/*.cpp", - ], - ), - hdrs = glob([ - "include/mlir/Dialect/Vector/IR/*.h", - ]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":Analysis", - ":ArithDialect", - ":ArithUtils", - ":BufferizationInterfaces", - ":BytecodeOpInterface", - ":ControlFlowInterfaces", - ":DestinationStyleOpInterface", - ":DialectUtils", - ":IR", - ":InferTypeOpInterface", - ":InliningUtils", - ":MaskableOpInterface", - ":MaskingOpInterface", - ":MemRefDialect", - ":SideEffectInterfaces", - ":SubsetOpInterface", - ":Support", - ":TensorDialect", - ":ValueBoundsOpInterface", - ":VectorAttributesIncGen", - ":VectorDialectIncGen", - ":VectorInterfaces", - ":VectorOpsIncGen", - ":ViewLikeInterface", - "//llvm:Support", - ], -) - -cc_library( - name = "VectorTransformOps", - srcs = [ - "lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp", - ], - hdrs = [ - "include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.h", - ], - includes = ["include"], - deps = [ - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":TransformDialect", - ":TransformDialectInterfaces", - ":TransformUtils", - ":VectorDialect", - ":VectorToLLVM", - ":VectorToSCF", - ":VectorTransformOpsIncGen", - ":VectorTransforms", - ":X86VectorTransforms", - ], -) - -td_library( - name = "VectorTransformsTdFiles", - srcs = ["include/mlir/Dialect/Vector/Transforms/VectorTransformsBase.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -gentbl_cc_library( - name = "VectorEnumsIncGen", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/Vector/Transforms/VectorTransformsEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/Vector/Transforms/VectorTransformsEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Vector/Transforms/VectorTransformsBase.td", - deps = [ - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "VectorPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Vector", - ], - "include/mlir/Dialect/Vector/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Vector/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "VectorTransforms", - srcs = glob( - [ - "lib/Dialect/Vector/Transforms/*.cpp", - ], - ), - hdrs = glob([ - "include/mlir/Dialect/Vector/Transforms/*.h", - ]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":ArithDialect", - ":ArithTransforms", - ":ArithUtils", - ":BufferizationDialect", - ":BufferizationInterfaces", - ":BufferizationTransforms", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":LinalgDialect", - ":MemRefDialect", - ":MemRefUtils", - ":Pass", - ":SCFDialect", - ":SideEffectInterfaces", - ":SubsetOpInterface", - ":Support", - ":TensorDialect", - ":TransformUtils", - ":VectorDialect", - ":VectorEnumsIncGen", - ":VectorInterfaces", - ":VectorPassIncGen", - ":VectorUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "VectorUtils", - srcs = glob( - [ - "lib/Dialect/Vector/Utils/*.cpp", - ], - ), - hdrs = glob([ - "include/mlir/Dialect/Vector/Utils/*.h", - ]), - includes = ["include"], - deps = [ - ":AffineAnalysis", - ":AffineDialect", - ":ArithDialect", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":MemRefDialect", - ":Support", - ":TensorDialect", - ":VectorDialect", - "//llvm:Support", - ], -) - -cc_library( - name = "Support", - srcs = glob([ - "lib/Support/*.cpp", - ]), - hdrs = glob(["include/mlir/Support/*.h"]), - includes = ["include"], - deps = ["//llvm:Support"], -) - -cc_library( - name = "Debug", - srcs = glob([ - "lib/Debug/*.cpp", - "lib/Debug/BreakpointManagers/*.cpp", - "lib/Debug/Observers/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Debug/*.h", - "include/mlir/Debug/BreakpointManagers/*.h", - "include/mlir/Debug/Observers/*.h", - ]), - includes = ["include"], - deps = [ - ":CAPIIR", - ":IR", - ":Rewrite", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "MlirLspServerSupportLib", - srcs = glob( - [ - "lib/Tools/lsp-server-support/*.cpp", - ], - ), - hdrs = glob( - [ - "include/mlir/Tools/lsp-server-support/*.h", - ], - ), - deps = [ - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "MlirLspServerLib", - srcs = glob( - [ - "lib/Tools/mlir-lsp-server/*.cpp", - "lib/Tools/mlir-lsp-server/*.h", - ], - ), - hdrs = glob( - ["include/mlir/Tools/mlir-lsp-server/*.h"], - ), - includes = ["include"], - deps = [ - ":AsmParser", - ":BytecodeWriter", - ":FunctionInterfaces", - ":IR", - ":MlirLspServerSupportLib", - ":Parser", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "MlirPdllLspServerLib", - srcs = glob( - [ - "lib/Tools/mlir-pdll-lsp-server/*.cpp", - "lib/Tools/mlir-pdll-lsp-server/*.h", - ], - ), - hdrs = glob( - ["include/mlir/Tools/mlir-pdll-lsp-server/*.h"], - ), - includes = ["include"], - deps = [ - ":IR", - ":MlirLspServerSupportLib", - ":PDLLAST", - ":PDLLCodeGen", - ":PDLLODS", - ":PDLLParser", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "AsmParserTokenKinds", - # strip_include_prefix does not apply to textual_hdrs. - hdrs = ["lib/AsmParser/TokenKinds.def"], - strip_include_prefix = "lib/AsmParser", - textual_hdrs = ["lib/AsmParser/TokenKinds.def"], -) - -cc_library( - name = "AsmParser", - srcs = glob([ - "lib/AsmParser/*.cpp", - "lib/AsmParser/*.h", - ]), - hdrs = glob([ - "include/mlir/AsmParser/*.h", - ]), - includes = ["include"], - deps = [ - ":AsmParserTokenKinds", - ":IR", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "BytecodeReader", - srcs = glob([ - "lib/Bytecode/Reader/*.cpp", - ]), - hdrs = ["include/mlir/Bytecode/BytecodeReader.h"], - includes = ["include"], - deps = [ - ":AsmParser", - ":BytecodeOpInterface", - ":IR", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "BytecodeWriter", - srcs = glob([ - "lib/Bytecode/Writer/*.cpp", - "lib/Bytecode/Writer/*.h", - ]), - hdrs = ["include/mlir/Bytecode/BytecodeWriter.h"], - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":IR", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "Parser", - srcs = glob([ - "lib/Parser/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Parser/*.h", - ]), - includes = ["include"], - deps = [ - ":AsmParser", - ":BytecodeReader", - ":IR", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "LLVMDialectInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/LLVMIR/LLVMInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/LLVMIR/LLVMInterfaces.cpp.inc", - ), - ( - ["-gen-attr-interface-decls"], - "include/mlir/Dialect/LLVMIR/LLVMAttrInterfaces.h.inc", - ), - ( - ["-gen-attr-interface-defs"], - "include/mlir/Dialect/LLVMIR/LLVMAttrInterfaces.cpp.inc", - ), - ( - ["-gen-type-interface-decls"], - "include/mlir/Dialect/LLVMIR/LLVMTypeInterfaces.h.inc", - ), - ( - ["-gen-type-interface-defs"], - "include/mlir/Dialect/LLVMIR/LLVMTypeInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/LLVMInterfaces.td", - deps = [":LLVMOpsTdFiles"], -) - -cc_library( - name = "LLVMDialect", - srcs = glob( - [ - "lib/Dialect/LLVMIR/IR/*.cpp", - "lib/Dialect/LLVMIR/IR/*.h", - ], - exclude = [ - "lib/Dialect/LLVMIR/IR/*AMX*.cpp", - "lib/Dialect/LLVMIR/IR/*AMX*.h", - "lib/Dialect/LLVMIR/IR/*ArmSVE*.cpp", - "lib/Dialect/LLVMIR/IR/*ArmSVE*.h", - "lib/Dialect/LLVMIR/IR/NVVM*.cpp", - "lib/Dialect/LLVMIR/IR/NVVM*.h", - "lib/Dialect/LLVMIR/IR/ROCDL*.cpp", - "lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp", - "lib/Dialect/LLVMIR/IR/ROCDL*.h", - "lib/Dialect/LLVMIR/IR/VCIX*.cpp", - "lib/Dialect/LLVMIR/IR/VCIX*.h", - "lib/Dialect/LLVMIR/IR/*X86Vector*.cpp", - "lib/Dialect/LLVMIR/IR/*X86Vector*.h", - ], - ), - hdrs = glob( - ["include/mlir/Dialect/LLVMIR/*.h"], - exclude = [ - "include/mlir/Dialect/LLVMIR/*AMX*.h", - "include/mlir/Dialect/LLVMIR/*ArmSVE*.h", - "include/mlir/Dialect/LLVMIR/NVVM*.h", - "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h", - "include/mlir/Dialect/LLVMIR/ROCDL*.h", - "include/mlir/Dialect/LLVMIR/VCIX*.h", - "include/mlir/Dialect/LLVMIR/*X86Vector*.h", - ], - ), - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":CallOpInterfaces", - ":ControlFlowInterfaces", - ":DataLayoutInterfaces", - ":FunctionInterfaces", - ":IR", - ":InferTypeOpInterface", - ":InliningUtils", - ":LLVMDialectInterfaceIncGen", - ":LLVMIntrinsicOpsIncGen", - ":LLVMOpsIncGen", - ":LLVMTypesIncGen", - ":MemorySlotInterfaces", - ":MemorySlotInterfacesIncGen", - ":SideEffectInterfaces", - ":Support", - "//llvm:AsmParser", - "//llvm:BinaryFormat", - "//llvm:BitReader", - "//llvm:BitWriter", - "//llvm:Core", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "LLVMPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=LLVM", - ], - "include/mlir/Dialect/LLVMIR/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "LLVMIRTransforms", - srcs = glob([ - "lib/Dialect/LLVMIR/Transforms/*.cpp", - ]), - hdrs = glob(["include/mlir/Dialect/LLVMIR/Transforms/*.h"]), - includes = ["include"], - deps = [ - ":FuncDialect", - ":IR", - ":LLVMDialect", - ":LLVMPassIncGen", - ":NVVMDialect", - ":Pass", - ":TransformUtils", - "//llvm:BinaryFormat", - "//llvm:Support", - ], -) - -td_library( - name = "GPUOpsTdFiles", - srcs = [ - "include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.td", - "include/mlir/Dialect/GPU/IR/CompilationAttrs.td", - "include/mlir/Dialect/GPU/IR/GPUBase.td", - "include/mlir/Dialect/GPU/IR/GPUDeviceMappingAttr.td", - "include/mlir/Dialect/GPU/IR/GPUOps.td", - "include/mlir/Dialect/GPU/IR/ParallelLoopMapperAttr.td", - ], - includes = ["include"], - deps = [ - ":DLTIDialectTdFiles", - ":DataLayoutInterfacesTdFiles", - ":FunctionInterfacesTdFiles", - ":InferIntRangeInterfaceTdFiles", - ":LLVMOpsTdFiles", - ":OpBaseTdFiles", - ":SCFTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "GPUDeviceMapperEnumsGen", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/GPU/TransformOps/GPUDeviceMapperEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/GPU/TransformOps/GPUDeviceMapperEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/GPU/IR/GPUDeviceMappingAttr.td", - deps = [ - ":GPUOpsTdFiles", - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "GPUCompilationAttrInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-attr-interface-decls"], - "include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.h.inc", - ), - ( - ["-gen-attr-interface-defs"], - "include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.td", - deps = [ - ":AttrTdFiles", - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "GPUBaseIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/GPU/IR/GPUOpInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/GPU/IR/GPUOpInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/GPU/IR/GPUBase.td", - deps = [":OpBaseTdFiles"], -) - -gentbl_cc_library( - name = "GPUOpsIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=gpu", - ], - "include/mlir/Dialect/GPU/IR/GPUOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=gpu", - ], - "include/mlir/Dialect/GPU/IR/GPUOpsDialect.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/GPU/IR/GPUOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/GPU/IR/GPUOps.cpp.inc", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/GPU/IR/GPUOpsEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/GPU/IR/GPUOpsEnums.cpp.inc", - ), - ( - ["-gen-attrdef-decls"], - "include/mlir/Dialect/GPU/IR/GPUOpsAttributes.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "include/mlir/Dialect/GPU/IR/GPUOpsAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/GPU/IR/GPUOps.td", - deps = [ - ":DLTIDialectTdFiles", - ":GPUOpsTdFiles", - ], -) - -cc_library( - name = "GPUDialect", - srcs = glob( - [ - "lib/Dialect/GPU/IR/*.cpp", - ], - ), - hdrs = glob(["include/mlir/Dialect/GPU/IR/*.h"]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":BufferizationInterfaces", - ":BytecodeOpInterface", - ":ControlFlowInterfaces", - ":DLTIDialect", - ":FunctionInterfaces", - ":GPUBaseIncGen", - ":GPUCompilationAttrInterfacesIncGen", - ":GPUOpsIncGen", - ":IR", - ":InferIntRangeInterface", - ":InferTypeOpInterface", - ":InliningUtils", - ":MemRefDialect", - ":SCFDialect", - ":SideEffectInterfaces", - ":Support", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "GPUPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=GPU", - ], - "include/mlir/Dialect/GPU/Transforms/Passes.h.inc", - ), - ( - [ - "-gen-pass-capi-header", - "--prefix=GPU", - ], - "include/mlir/Dialect/GPU/Transforms/Passes.capi.h.inc", - ), - ( - [ - "-gen-pass-capi-impl", - "--prefix=GPU", - ], - "include/mlir/Dialect/GPU/Transforms/Passes.capi.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/GPU/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "GPUPipelines", - srcs = ["lib/Dialect/GPU/Pipelines/GPUToNVVMPipeline.cpp"], - hdrs = ["include/mlir/Dialect/GPU/Pipelines/Passes.h"], - includes = ["include"], - deps = [ - ":AffineToStandard", - ":ArithToLLVM", - ":FuncDialect", - ":FuncToLLVM", - ":GPUDialect", - ":GPUToGPURuntimeTransforms", - ":GPUToNVVMTransforms", - ":GPUTransforms", - ":IndexToLLVM", - ":LLVMDialect", - ":LinalgTransforms", - ":MathToLLVM", - ":MemRefToLLVM", - ":MemRefTransforms", - ":NVGPUToNVVM", - ":NVVMToLLVM", - ":Pass", - ":ReconcileUnrealizedCasts", - ":SCFToControlFlow", - ":Transforms", - ":VectorToLLVM", - ":VectorToSCF", - ], -) - -cc_library( - name = "GPUTransforms", - srcs = glob( - [ - "lib/Dialect/GPU/Transforms/*.cpp", - ], - ), - hdrs = glob(["include/mlir/Dialect/GPU/Transforms/*.h"]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":AffineUtils", - ":ArithDialect", - ":AsmParser", - ":AsyncDialect", - ":BufferizationDialect", - ":BufferizationInterfaces", - ":ControlFlowDialect", - ":DLTIDialect", - ":DialectUtils", - ":ExecutionEngineUtils", - ":FuncDialect", - ":GPUDialect", - ":GPUPassIncGen", - ":GPUToLLVMIRTranslation", - ":IR", - ":IndexDialect", - ":LLVMDialect", - ":LLVMToLLVMIRTranslation", - ":MemRefDialect", - ":NVVMDialect", - ":NVVMTarget", - ":Pass", - ":ROCDLDialect", - ":ROCDLTarget", - ":ROCDLToLLVMIRTranslation", - ":SCFDialect", - ":SPIRVDialect", - ":SPIRVTarget", - ":SideEffectInterfaces", - ":Support", - ":ToLLVMIRTranslation", - ":TransformUtils", - ":Transforms", - ":VCIXToLLVMIRTranslation", - ":VectorDialect", - ":config", - "//llvm:Core", - "//llvm:MC", - "//llvm:Support", - "//llvm:Target", - ] + if_cuda_available([ - ":NVVMToLLVMIRTranslation", - "//llvm:NVPTXCodeGen", - ]), -) - -td_library( - name = "GPUTransformOpsTdFiles", - srcs = [ - "include/mlir/Dialect/GPU/TransformOps/GPUTransformOps.td", - ], - includes = ["include"], - deps = [ - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "GPUTransformOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/GPU/TransformOps/GPUTransformOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/GPU/TransformOps/GPUTransformOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/GPU/TransformOps/GPUTransformOps.td", - deps = [ - ":GPUTransformOpsTdFiles", - ], -) - -cc_library( - name = "GPUTransformOps", - srcs = glob([ - "lib/Dialect/GPU/TransformOps/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/GPU/TransformOps/*.h", - ]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":ArithDialect", - ":DialectUtils", - ":FuncDialect", - ":GPUDialect", - ":GPUToGPURuntimeTransforms", - ":GPUToNVVMTransforms", - ":GPUTransformOpsIncGen", - ":GPUTransforms", - ":IR", - ":LLVMCommonConversion", - ":MemRefDialect", - ":NVVMDialect", - ":SCFDialect", - ":Support", - ":TransformDialect", - ":TransformDialectInterfaces", - ":TransformUtils", - ":VectorDialect", - ":VectorTransforms", - "//llvm:Support", - ], -) - -td_library( - name = "LLVMOpsTdFiles", - srcs = [ - "include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td", - "include/mlir/Dialect/LLVMIR/LLVMDialect.td", - "include/mlir/Dialect/LLVMIR/LLVMEnums.td", - "include/mlir/Dialect/LLVMIR/LLVMInterfaces.td", - "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td", - "include/mlir/Dialect/LLVMIR/LLVMOpBase.td", - "include/mlir/Dialect/LLVMIR/LLVMOps.td", - "include/mlir/Dialect/LLVMIR/LLVMTypes.td", - ], - includes = ["include"], - deps = [ - ":CallInterfacesTdFiles", - ":ControlFlowInterfacesTdFiles", - ":DataLayoutInterfacesTdFiles", - ":FunctionInterfacesTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":MemorySlotInterfacesTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -cc_library( - name = "GPUCommonTransforms", - hdrs = [ - "lib/Conversion/GPUCommon/GPUOpsLowering.h", - "lib/Conversion/GPUCommon/IndexIntrinsicsOpLowering.h", - "lib/Conversion/GPUCommon/OpToFuncCallLowering.h", - ], - deps = [ - ":GPUDialect", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ], -) - -gentbl_cc_library( - name = "GPUToNVVMGen", - strip_include_prefix = "lib/Conversion/GPUToNVVM", - tbl_outs = [ - ( - ["-gen-rewriters"], - "lib/Conversion/GPUToNVVM/GPUToNVVM.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "lib/Conversion/GPUToNVVM/GPUToNVVM.td", - deps = [ - ":GPUOpsTdFiles", - ":NVVMOpsTdFiles", - ], -) - -cc_library( - name = "GPUToLLVMSPVTransforms", - srcs = glob([ - "lib/Conversion/GPUToLLVMSPV/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/GPUToLLVMSPV/*.h", - ]), - includes = ["include"], - deps = [ - ":ConversionPassIncGen", - ":GPUDialect", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":Pass", - ":SPIRVDialect", - ":Support", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "GPUToNVVMTransforms", - srcs = glob([ - "lib/Conversion/GPUToNVVM/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/GPUToNVVM/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithToLLVM", - ":ControlFlowDialect", - ":ControlFlowToLLVM", - ":ConversionPassIncGen", - ":FuncDialect", - ":FuncToLLVM", - ":GPUCommonTransforms", - ":GPUDialect", - ":GPUToGPURuntimeTransforms", - ":GPUToNVVMGen", - ":GPUTransforms", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MathDialect", - ":MemRefDialect", - ":MemRefToLLVM", - ":NVVMDialect", - ":TransformUtils", - ":VectorToLLVM", - ], -) - -cc_library( - name = "AMDGPUToROCDL", - srcs = glob([ - "lib/Conversion/AMDGPUToROCDL/*.cpp", - ]) + ["include/mlir/Conversion/GPUToROCDL/Runtimes.h"], - hdrs = glob([ - "include/mlir/Conversion/AMDGPUToROCDL/*.h", - ]), - includes = ["include"], - deps = [ - ":AMDGPUDialect", - ":AMDGPUUtils", - ":ConversionPassIncGen", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":Pass", - ":ROCDLDialect", - "//llvm:Support", - ], -) - -cc_library( - name = "NVGPUToNVVM", - srcs = glob([ - "lib/Conversion/NVGPUToNVVM/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/NVGPUToNVVM/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":ConversionPassIncGen", - ":GPUDialect", - ":GPUToGPURuntimeTransforms", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MemRefDialect", - ":NVGPUDialect", - ":NVVMDialect", - ":Pass", - ":SCFTransforms", - "//llvm:Support", - ], -) - -cc_library( - name = "VectorToSPIRV", - srcs = glob([ - "lib/Conversion/VectorToSPIRV/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/VectorToSPIRV/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":ConversionPassIncGen", - ":IR", - ":Pass", - ":SPIRVConversion", - ":SPIRVDialect", - ":Support", - ":TransformUtils", - ":VectorDialect", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "GPUToROCDLTGen", - strip_include_prefix = "lib/Conversion/GPUToROCDL", - tbl_outs = [ - ( - ["-gen-rewriters"], - "lib/Conversion/GPUToROCDL/GPUToROCDL.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "lib/Conversion/GPUToROCDL/GPUToROCDL.td", - deps = [ - ":GPUOpsTdFiles", - ":ROCDLOpsTdFiles", - ], -) - -cc_library( - name = "GPUToROCDLTransforms", - srcs = [ - "include/mlir/Conversion/GPUToROCDL/Runtimes.h", - "lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp", - ], - hdrs = ["include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h"], - includes = ["include"], - deps = [ - ":AMDGPUToROCDL", - ":ArithToLLVM", - ":ArithTransforms", - ":ControlFlowDialect", - ":ControlFlowToLLVM", - ":ConversionPassIncGen", - ":FuncDialect", - ":FuncToLLVM", - ":GPUCommonTransforms", - ":GPUDialect", - ":GPUToGPURuntimeTransforms", - ":GPUToROCDLTGen", - ":GPUTransforms", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MathDialect", - ":MathToROCDL", - ":MemRefDialect", - ":MemRefToLLVM", - ":Pass", - ":ROCDLDialect", - ":TransformUtils", - ":Transforms", - ":VectorDialect", - ":VectorToLLVM", - "//llvm:Support", - ], -) - -cc_library( - name = "GPUToVulkanTransforms", - srcs = [ - "lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp", - "lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp", - ], - hdrs = ["include/mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"], - includes = ["include"], - deps = [ - ":ConversionPassIncGen", - ":FuncDialect", - ":GPUDialect", - ":IR", - ":LLVMDialect", - ":Pass", - ":SPIRVDialect", - ":SPIRVSerialization", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "GPUToGPURuntimeTransforms", - srcs = [ - "lib/Conversion/GPUCommon/GPUOpsLowering.cpp", - "lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp", - ], - hdrs = ["include/mlir/Conversion/GPUCommon/GPUCommonPass.h"], - includes = ["include"], - deps = [ - ":ArithToLLVM", - ":AsyncDialect", - ":AsyncToLLVM", - ":ControlFlowToLLVM", - ":ConversionPassIncGen", - ":ConvertToLLVM", - ":ConvertToLLVMInterface", - ":FuncToLLVM", - ":GPUCommonTransforms", - ":GPUDialect", - ":GPUTransforms", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MemRefDialect", - ":MemRefToLLVM", - ":Support", - ":VectorToLLVM", - "//llvm:Support", - ], -) - -cc_library( - name = "GPUToSPIRV", - srcs = glob([ - "lib/Conversion/GPUToSPIRV/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/GPUToSPIRV/*.h", - ]), - includes = [ - "include", - "lib/Conversions/GPUToSPIRV", - ], - deps = [ - ":ArithToSPIRV", - ":ConversionPassIncGen", - ":FuncDialect", - ":FuncToSPIRV", - ":GPUDialect", - ":IR", - ":MemRefToSPIRV", - ":SCFToSPIRV", - ":SPIRVConversion", - ":SPIRVDialect", - ":Support", - ":TransformUtils", - ":VectorToSPIRV", - "//llvm:Support", - ], -) - -cc_library( - name = "PDLToPDLInterp", - srcs = glob([ - "lib/Conversion/PDLToPDLInterp/*.cpp", - "lib/Conversion/PDLToPDLInterp/*.h", - ]), - hdrs = [ - "include/mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h", - "lib/Conversion/PDLToPDLInterp/RootOrdering.h", - ], - includes = ["include"], - deps = [ - ":ConversionPassIncGen", - ":IR", - ":InferTypeOpInterface", - ":PDLDialect", - ":PDLInterpDialect", - ":Pass", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "SPIRVToLLVM", - srcs = glob([ - "lib/Conversion/SPIRVToLLVM/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/SPIRVToLLVM/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithToLLVM", - ":ConversionPassIncGen", - ":FuncDialect", - ":FuncToLLVM", - ":GPUDialect", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MemRefToLLVM", - ":Pass", - ":SPIRVDialect", - ":SPIRVUtils", - ":Support", - ":TransformUtils", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "LLVMOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/LLVMIR/LLVMOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/LLVMIR/LLVMOpsDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/LLVMIR/LLVMOpsDialect.cpp.inc", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/LLVMIR/LLVMOpsEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/LLVMIR/LLVMOpsEnums.cpp.inc", - ), - ( - [ - "--gen-attrdef-decls", - "-attrdefs-dialect=llvm", - ], - "include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.h.inc", - ), - ( - [ - "--gen-attrdef-defs", - "-attrdefs-dialect=llvm", - ], - "include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/LLVMOps.td", - deps = [":LLVMOpsTdFiles"], -) - -gentbl_cc_library( - name = "LLVMTypesIncGen", - tbl_outs = [ - ( - [ - "-gen-typedef-decls", - "-typedefs-dialect=llvm", - ], - "include/mlir/Dialect/LLVMIR/LLVMTypes.h.inc", - ), - ( - [ - "-gen-typedef-defs", - "-typedefs-dialect=llvm", - ], - "include/mlir/Dialect/LLVMIR/LLVMTypes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/LLVMTypes.td", - deps = [":LLVMOpsTdFiles"], -) - -gentbl_cc_library( - name = "LLVMIntrinsicOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td", - deps = [":LLVMOpsTdFiles"], -) - -gentbl_cc_library( - name = "LLVMConversionIncGen", - tbl_outs = [ - ( - ["-gen-llvmir-conversions"], - "include/mlir/Dialect/LLVMIR/LLVMConversions.inc", - ), - ( - ["-gen-enum-to-llvmir-conversions"], - "include/mlir/Dialect/LLVMIR/LLVMConversionEnumsToLLVM.inc", - ), - ( - ["-gen-enum-from-llvmir-conversions"], - "include/mlir/Dialect/LLVMIR/LLVMConversionEnumsFromLLVM.inc", - ), - ( - ["-gen-op-from-llvmir-conversions"], - "include/mlir/Dialect/LLVMIR/LLVMOpFromLLVMIRConversions.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/LLVMOps.td", - deps = [":LLVMOpsTdFiles"], -) - -gentbl_cc_library( - name = "LLVMIntrinsicConversionIncGen", - tbl_outs = [ - ( - ["-gen-llvmir-conversions"], - "include/mlir/Dialect/LLVMIR/LLVMIntrinsicConversions.inc", - ), - ( - ["-gen-intr-from-llvmir-conversions"], - "include/mlir/Dialect/LLVMIR/LLVMIntrinsicFromLLVMIRConversions.inc", - ), - ( - ["-gen-convertible-llvmir-intrinsics"], - "include/mlir/Dialect/LLVMIR/LLVMConvertibleLLVMIRIntrinsics.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td", - deps = [":LLVMOpsTdFiles"], -) - -cc_library( - name = "NVVMDialect", - srcs = ["lib/Dialect/LLVMIR/IR/NVVMDialect.cpp"], - hdrs = ["include/mlir/Dialect/LLVMIR/NVVMDialect.h"], - includes = ["include"], - deps = [ - ":BasicPtxBuilderInterface", - ":BytecodeOpInterface", - ":ConvertToLLVMInterface", - ":DialectUtils", - ":GPUDialect", - ":IR", - ":LLVMDialect", - ":NVVMOpsIncGen", - ":SideEffectInterfaces", - ":Support", - "//llvm:AsmParser", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "TargetLLVM", - srcs = ["lib/Target/LLVM/ModuleToObject.cpp"], - hdrs = glob(["include/mlir/Target/LLVM/*.h"]), - includes = ["include"], - deps = [ - ":ExecutionEngineUtils", - ":IR", - ":LLVMToLLVMIRTranslation", - ":ToLLVMIRTranslation", - "//llvm:BitWriter", - "//llvm:Core", - "//llvm:IPO", - "//llvm:IRReader", - "//llvm:Linker", - "//llvm:MC", - "//llvm:Passes", - "//llvm:Support", - "//llvm:Target", - "//llvm:TargetParser", - ], -) - -cc_library( - name = "NVVMTarget", - srcs = ["lib/Target/LLVM/NVVM/Target.cpp"], - hdrs = glob(["include/mlir/Target/LLVM/NVVM/*.h"]), - includes = ["include"], - deps = [ - ":GPUDialect", - ":GPUToLLVMIRTranslation", - ":LLVMToLLVMIRTranslation", - ":NVVMDialect", - ":NVVMToLLVMIRTranslation", - ":TargetLLVM", - ":ToLLVMIRTranslation", - "//llvm:NVPTXCodeGen", - "//llvm:Support", - "//llvm:config", - ], -) - -td_library( - name = "BasicPtxBuilderIntTdFiles", - srcs = [ - "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.td", - ], - includes = ["include"], - deps = [ - ":GPUOpsTdFiles", - ":LLVMOpsTdFiles", - ":OpBaseTdFiles", - ], -) - -td_library( - name = "NVVMOpsTdFiles", - srcs = ["include/mlir/Dialect/LLVMIR/NVVMOps.td"], - includes = ["include"], - deps = [ - ":BasicPtxBuilderIntTdFiles", - ":GPUOpsTdFiles", - ":LLVMOpsTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "BasicPtxBuilderIntGen", - tbl_outs = [ - ( - [ - "-gen-op-interface-decls", - ], - "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h.inc", - ), - ( - [ - "-gen-op-interface-defs", - ], - "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.td", - deps = [ - ":BasicPtxBuilderIntTdFiles", - ":GPUOpsTdFiles", - ":LLVMOpsTdFiles", - ], -) - -gentbl_cc_library( - name = "NVVMOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/LLVMIR/NVVMOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/LLVMIR/NVVMOps.cpp.inc", - ), - ( - [ - "-gen-dialect-decls", - "-dialect=nvvm", - ], - "include/mlir/Dialect/LLVMIR/NVVMOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=nvvm", - ], - "include/mlir/Dialect/LLVMIR/NVVMOpsDialect.cpp.inc", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/LLVMIR/NVVMOpsEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/LLVMIR/NVVMOpsEnums.cpp.inc", - ), - ( - [ - "-gen-attrdef-decls", - "-attrdefs-dialect=nvvm", - ], - "include/mlir/Dialect/LLVMIR/NVVMOpsAttributes.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "-attrdefs-dialect=nvvm", - ], - "include/mlir/Dialect/LLVMIR/NVVMOpsAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/NVVMOps.td", - deps = [":NVVMOpsTdFiles"], -) - -gentbl_cc_library( - name = "NVVMConversionIncGen", - tbl_outs = [ - ( - ["-gen-llvmir-conversions"], - "include/mlir/Dialect/LLVMIR/NVVMConversions.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/NVVMOps.td", - deps = [":NVVMOpsTdFiles"], -) - -gentbl_cc_library( - name = "NVVMFromLLVMIRConversionsIncGen", - tbl_outs = [ - ( - ["-gen-intr-from-llvmir-conversions"], - "include/mlir/Dialect/LLVMIR/NVVMFromLLVMIRConversions.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/NVVMOps.td", - deps = [":NVVMOpsTdFiles"], -) - -gentbl_cc_library( - name = "NVVMConvertibleLLVMIRIntrinsicsIncGen", - tbl_outs = [ - ( - ["-gen-convertible-llvmir-intrinsics"], - "include/mlir/Dialect/LLVMIR/NVVMConvertibleLLVMIRIntrinsics.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/NVVMOps.td", - deps = [":NVVMOpsTdFiles"], -) - -cc_library( - name = "BasicPtxBuilderInterface", - srcs = ["lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp"], - hdrs = [ - "include/mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h", - ], - includes = ["include"], - deps = [ - ":BasicPtxBuilderIntGen", - ":IR", - ":LLVMDialect", - ":Support", - ], -) - -cc_library( - name = "NVVMToLLVM", - srcs = ["lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp"], - hdrs = glob(["include/mlir/Conversion/NVVMToLLVM/*.h"]), - includes = ["include"], - deps = [ - ":ConversionPassIncGen", - ":ConvertToLLVMInterface", - ":FuncDialect", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":NVVMDialect", - ":Pass", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "ROCDLDialect", - srcs = ["lib/Dialect/LLVMIR/IR/ROCDLDialect.cpp"], - hdrs = ["include/mlir/Dialect/LLVMIR/ROCDLDialect.h"], - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":GPUDialect", - ":IR", - ":LLVMDialect", - ":ROCDLOpsIncGen", - ":SideEffectInterfaces", - "//llvm:AsmParser", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "ROCDLTarget", - srcs = ["lib/Target/LLVM/ROCDL/Target.cpp"], - hdrs = glob(["include/mlir/Target/LLVM/ROCDL/*.h"]), - includes = ["include"], - deps = [ - ":GPUDialect", - ":GPUToLLVMIRTranslation", - ":LLVMToLLVMIRTranslation", - ":ROCDLDialect", - ":ROCDLToLLVMIRTranslation", - ":Support", - ":TargetLLVM", - ":ToLLVMIRTranslation", - "//llvm:Core", - "//llvm:MC", - "//llvm:MCParser", - "//llvm:Support", - "//llvm:TargetParser", - ], -) - -td_library( - name = "ROCDLOpsTdFiles", - srcs = ["include/mlir/Dialect/LLVMIR/ROCDLOps.td"], - includes = ["include"], - deps = [ - ":GPUOpsTdFiles", - ":LLVMOpsTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ROCDLOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/LLVMIR/ROCDLOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc", - ), - ( - [ - "-gen-dialect-decls", - "-dialect=rocdl", - ], - "include/mlir/Dialect/LLVMIR/ROCDLOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=rocdl", - ], - "include/mlir/Dialect/LLVMIR/ROCDLOpsDialect.cpp.inc", - ), - ( - [ - "-gen-attrdef-decls", - "-attrdefs-dialect=rocdl", - ], - "include/mlir/Dialect/LLVMIR/ROCDLOpsAttributes.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "-attrdefs-dialect=rocdl", - ], - "include/mlir/Dialect/LLVMIR/ROCDLOpsAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/ROCDLOps.td", - deps = [":ROCDLOpsTdFiles"], -) - -gentbl_cc_library( - name = "ROCDLConversionIncGen", - tbl_outs = [ - ( - ["-gen-llvmir-conversions"], - "include/mlir/Dialect/LLVMIR/ROCDLConversions.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/ROCDLOps.td", - deps = [":ROCDLOpsTdFiles"], -) - -cc_library( - name = "PDLDialect", - srcs = glob([ - "lib/Dialect/PDL/IR/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/PDL/IR/*.h", - ]), - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":IR", - ":InferTypeOpInterface", - ":PDLOpsIncGen", - ":PDLTypesIncGen", - ":SideEffectInterfaces", - "//llvm:Support", - ], -) - -td_library( - name = "PDLDialectTdFiles", - srcs = [ - "include/mlir/Dialect/PDL/IR/PDLDialect.td", - "include/mlir/Dialect/PDL/IR/PDLOps.td", - "include/mlir/Dialect/PDL/IR/PDLTypes.td", - ], - deps = [ - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "PDLOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/PDL/IR/PDLOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/PDL/IR/PDLOps.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/PDL/IR/PDLOpsDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/PDL/IR/PDLOpsDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/PDL/IR/PDLOps.td", - deps = [":PDLDialectTdFiles"], -) - -gentbl_cc_library( - name = "PDLTypesIncGen", - tbl_outs = [ - ( - ["-gen-typedef-decls"], - "include/mlir/Dialect/PDL/IR/PDLOpsTypes.h.inc", - ), - ( - ["-gen-typedef-defs"], - "include/mlir/Dialect/PDL/IR/PDLOpsTypes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/PDL/IR/PDLTypes.td", - deps = [":PDLDialectTdFiles"], -) - -cc_library( - name = "PDLInterpDialect", - srcs = glob([ - "lib/Dialect/PDLInterp/IR/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/PDLInterp/IR/*.h", - ]), - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":FunctionInterfaces", - ":IR", - ":InferTypeOpInterface", - ":PDLDialect", - ":PDLInterpOpsIncGen", - ":SideEffectInterfaces", - ], -) - -td_library( - name = "PDLInterpOpsTdFiles", - srcs = ["include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td"], - includes = ["include"], - deps = [ - ":FunctionInterfacesTdFiles", - ":OpBaseTdFiles", - ":PDLDialectTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "PDLInterpOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.cpp.inc", - ), - ( - [ - "-gen-dialect-decls", - "-dialect=pdl_interp", - ], - "include/mlir/Dialect/PDLInterp/IR/PDLInterpOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=pdl_interp", - ], - "include/mlir/Dialect/PDLInterp/IR/PDLInterpOpsDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td", - deps = [":PDLInterpOpsTdFiles"], -) - -cc_library( - name = "PolynomialDialect", - srcs = glob([ - "lib/Dialect/Polynomial/IR/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/Polynomial/IR/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":IR", - ":InferTypeOpInterface", - ":PolynomialAttributesIncGen", - ":PolynomialCanonicalizationIncGen", - ":PolynomialIncGen", - ":Support", - "//llvm:Support", - ], -) - -td_library( - name = "PolynomialTdFiles", - srcs = glob(["include/mlir/Dialect/Polynomial/IR/*.td"]), - includes = ["include"], - deps = [ - ":BuiltinDialectTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "PolynomialIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Polynomial/IR/Polynomial.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Polynomial/IR/Polynomial.cpp.inc", - ), - ( - [ - "-gen-dialect-decls", - "-dialect=polynomial", - ], - "include/mlir/Dialect/Polynomial/IR/PolynomialDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=polynomial", - ], - "include/mlir/Dialect/Polynomial/IR/PolynomialDialect.cpp.inc", - ), - ( - [ - "--gen-typedef-decls", - "-typedefs-dialect=polynomial", - ], - "include/mlir/Dialect/Polynomial/IR/PolynomialTypes.h.inc", - ), - ( - [ - "--gen-typedef-defs", - "-typedefs-dialect=polynomial", - ], - "include/mlir/Dialect/Polynomial/IR/PolynomialTypes.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/Polynomial/Polynomial.md", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Polynomial/IR/Polynomial.td", - deps = [":PolynomialTdFiles"], -) - -gentbl_cc_library( - name = "PolynomialAttributesIncGen", - tbl_outs = [ - ( - [ - "-gen-attrdef-decls", - "-attrdefs-dialect=polynomial", - ], - "include/mlir/Dialect/Polynomial/IR/PolynomialAttributes.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "-attrdefs-dialect=polynomial", - ], - "include/mlir/Dialect/Polynomial/IR/PolynomialAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Polynomial/IR/Polynomial.td", - deps = [":PolynomialTdFiles"], -) - -gentbl_cc_library( - name = "PolynomialCanonicalizationIncGen", - strip_include_prefix = "include/mlir/Dialect/Polynomial/IR", - tbl_outs = [ - ( - ["-gen-rewriters"], - "include/mlir/Dialect/Polynomial/IR/PolynomialCanonicalization.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "lib/Dialect/Polynomial/IR/PolynomialCanonicalization.td", - deps = [ - ":ArithOpsTdFiles", - ":PolynomialTdFiles", - ], -) - -td_library( - name = "PtrTdFiles", - srcs = [ - "include/mlir/Dialect/Ptr/IR/PtrAttrDefs.td", - "include/mlir/Dialect/Ptr/IR/PtrDialect.td", - "include/mlir/Dialect/Ptr/IR/PtrOps.td", - ], - includes = ["include"], - deps = [ - ":AttrTdFiles", - ":BuiltinDialectTdFiles", - ":DataLayoutInterfacesTdFiles", - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "PtrDialectIncGen", - tbl_outs = [ - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/Ptr/IR/PtrOpsDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/Ptr/IR/PtrOpsDialect.cpp.inc", - ), - ( - ["-gen-typedef-decls"], - "include/mlir/Dialect/Ptr/IR/PtrOpsTypes.h.inc", - ), - ( - ["-gen-typedef-defs"], - "include/mlir/Dialect/Ptr/IR/PtrOpsTypes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Ptr/IR/PtrDialect.td", - deps = [ - ":PtrTdFiles", - ], -) - -gentbl_cc_library( - name = "PtrOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Ptr/IR/PtrOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Ptr/IR/PtrOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Ptr/IR/PtrOps.td", - deps = [ - ":PtrTdFiles", - ], -) - -gentbl_cc_library( - name = "PtrAttrsIncGen", - tbl_outs = [ - ( - ["-gen-attrdef-decls"], - "include/mlir/Dialect/Ptr/IR/PtrOpsAttrs.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "include/mlir/Dialect/Ptr/IR/PtrOpsAttrs.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Ptr/IR/PtrAttrDefs.td", - deps = [ - ":PtrTdFiles", - ], -) - -cc_library( - name = "PtrDialect", - srcs = glob( - [ - "lib/Dialect/Ptr/IR/*.cpp", - ], - ), - hdrs = glob([ - "include/mlir/Dialect/Ptr/IR/*.h", - ]), - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":DataLayoutInterfaces", - ":IR", - ":InliningUtils", - ":PtrAttrsIncGen", - ":PtrDialectIncGen", - ":PtrOpsIncGen", - "//llvm:Support", - ], -) - -td_library( - name = "SPIRVOpsTdFiles", - srcs = glob(["include/mlir/Dialect/SPIRV/IR/*.td"]), - includes = ["include"], - deps = [ - ":BuiltinDialectTdFiles", - ":CallInterfacesTdFiles", - ":ControlFlowInterfacesTdFiles", - ":FunctionInterfacesTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "SPIRVOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/SPIRV/IR/SPIRVOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/SPIRV/IR/SPIRVOps.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/SPIRV/IR/SPIRVOpsDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/SPIRV/IR/SPIRVOpsDialect.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/SPIRV/SPIRVOps.md", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/SPIRV/IR/SPIRVEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/SPIRV/IR/SPIRVEnums.cpp.inc", - ), - ( - ["-gen-spirv-enum-avail-decls"], - "include/mlir/Dialect/SPIRV/IR/SPIRVEnumAvailability.h.inc", - ), - ( - ["-gen-spirv-enum-avail-defs"], - "include/mlir/Dialect/SPIRV/IR/SPIRVEnumAvailability.cpp.inc", - ), - ( - ["-gen-spirv-capability-implication"], - "include/mlir/Dialect/SPIRV/IR/SPIRVCapabilityImplication.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVOps.td", - deps = [":SPIRVOpsTdFiles"], -) - -gentbl_cc_library( - name = "SPIRVAttributesIncGen", - tbl_outs = [ - ( - ["-gen-attrdef-decls"], - "include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.td", - deps = [":SPIRVOpsTdFiles"], -) - -gentbl_cc_library( - name = "SPIRVCanonicalizationIncGen", - strip_include_prefix = "lib/Dialect/SPIRV/IR", - tbl_outs = [ - ( - ["-gen-rewriters"], - "lib/Dialect/SPIRV/IR/SPIRVCanonicalization.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "lib/Dialect/SPIRV/IR/SPIRVCanonicalization.td", - deps = [":SPIRVOpsTdFiles"], -) - -gentbl_cc_library( - name = "SPIRVAvailabilityIncGen", - tbl_outs = [ - ( - ["-gen-avail-interface-decls"], - "include/mlir/Dialect/SPIRV/IR/SPIRVAvailability.h.inc", - ), - ( - ["-gen-avail-interface-defs"], - "include/mlir/Dialect/SPIRV/IR/SPIRVAvailability.cpp.inc", - ), - ( - ["-gen-spirv-avail-impls"], - "include/mlir/Dialect/SPIRV/IR/SPIRVOpAvailabilityImpl.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVOps.td", - deps = [":SPIRVOpsTdFiles"], -) - -gentbl_cc_library( - name = "SPIRVAttrUtilsGen", - tbl_outs = [ - ( - ["-gen-spirv-attr-utils"], - "include/mlir/Dialect/SPIRV/IR/SPIRVAttrUtils.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVBase.td", - deps = [":SPIRVOpsTdFiles"], -) - -gentbl_cc_library( - name = "SPIRVSerializationGen", - tbl_outs = [ - ( - ["-gen-spirv-serialization"], - "include/mlir/Dialect/SPIRV/IR/SPIRVSerialization.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SPIRV/IR/SPIRVOps.td", - deps = [":SPIRVOpsTdFiles"], -) - -cc_library( - name = "SPIRVDialect", - srcs = glob([ - "lib/Dialect/SPIRV/IR/*.cpp", - "lib/Dialect/SPIRV/IR/*.h", - ]), - hdrs = glob([ - "include/mlir/Dialect/SPIRV/IR/*.h", - ]), - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":CallOpInterfaces", - ":CommonFolders", - ":ControlFlowInterfaces", - ":FunctionInterfaces", - ":GPUDialect", - ":IR", - ":InferTypeOpInterface", - ":InliningUtils", - ":Parser", - ":SPIRVAttrUtilsGen", - ":SPIRVAttributesIncGen", - ":SPIRVAvailabilityIncGen", - ":SPIRVCanonicalizationIncGen", - ":SPIRVOpsIncGen", - ":SideEffectInterfaces", - ":Support", - ":UBDialect", - "//llvm:Support", - ], -) - -cc_library( - name = "SPIRVTarget", - srcs = ["lib/Target/SPIRV/Target.cpp"], - hdrs = ["include/mlir/Target/SPIRV/Target.h"], - includes = ["include"], - deps = [ - ":GPUDialect", - ":SPIRVDialect", - ":SPIRVSerialization", - ], -) - -gentbl_cc_library( - name = "SPIRVPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=SPIRV", - ], - "include/mlir/Dialect/SPIRV/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/SPIRV/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "SPIRVUtils", - srcs = glob([ - "lib/Dialect/SPIRV/Utils/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/SPIRV/Utils/*.h", - ]), - includes = ["include"], - deps = [":SPIRVDialect"], -) - -cc_library( - name = "SPIRVConversion", - srcs = ["lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp"], - hdrs = ["include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"], - includes = ["include"], - deps = [ - ":ArithDialect", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":SPIRVDialect", - ":Support", - ":TransformUtils", - ":VectorDialect", - ":VectorTransforms", - "//llvm:Support", - ], -) - -cc_library( - name = "SPIRVTransforms", - srcs = glob( - [ - "lib/Dialect/SPIRV/Transforms/*.cpp", - ], - exclude = ["lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp"], - ), - hdrs = glob( - ["include/mlir/Dialect/SPIRV/Transforms/*.h"], - exclude = ["include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"], - ), - includes = ["include"], - deps = [ - ":FuncDialect", - ":IR", - ":Pass", - ":SPIRVConversion", - ":SPIRVDialect", - ":SPIRVPassIncGen", - ":SPIRVUtils", - ":Support", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "SPIRVCommonConversion", - hdrs = ["lib/Conversion/SPIRVCommon/Pattern.h"], - includes = ["include"], - deps = [ - ":IR", - ":SPIRVDialect", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "MathToSPIRV", - srcs = glob([ - "lib/Conversion/MathToSPIRV/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/MathToSPIRV/*.h", - ]), - includes = [ - "include", - "lib/Conversion/MathToSPIRV", - ], - deps = [ - ":ConversionPassIncGen", - ":IR", - ":MathDialect", - ":Pass", - ":SPIRVCommonConversion", - ":SPIRVConversion", - ":SPIRVDialect", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "MathToROCDL", - srcs = glob([ - "lib/Conversion/MathToROCDL/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/MathToROCDL/*.h", - ]), - includes = ["include"], - deps = [ - ":ConversionPassIncGen", - ":DialectUtils", - ":FuncDialect", - ":GPUCommonTransforms", - ":GPUToGPURuntimeTransforms", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MathDialect", - ":Pass", - ":ROCDLDialect", - ":TransformUtils", - ":VectorDialect", - ], -) - -cc_library( - name = "FuncToEmitC", - srcs = glob([ - "lib/Conversion/FuncToEmitC/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/FuncToEmitC/*.h", - ]), - includes = [ - "include", - "lib/Conversion/FuncToEmitC", - ], - deps = [ - ":ConversionPassIncGen", - ":EmitCDialect", - ":FuncDialect", - ":Pass", - ":TransformUtils", - ], -) - -cc_library( - name = "FuncToSPIRV", - srcs = glob([ - "lib/Conversion/FuncToSPIRV/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/FuncToSPIRV/*.h", - ]), - includes = [ - "include", - "lib/Conversion/FuncToSPIRV", - ], - deps = [ - ":ConversionPassIncGen", - ":FuncDialect", - ":IR", - ":Pass", - ":SPIRVCommonConversion", - ":SPIRVConversion", - ":SPIRVDialect", - ":SPIRVUtils", - ":Support", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "TensorToLinalg", - srcs = glob([ - "lib/Conversion/TensorToLinalg/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/TensorToLinalg/*.h", - ]), - includes = [ - "include", - "lib/Conversion/TensorToLinalg", - ], - deps = [ - ":ArithDialect", - ":ConversionPassIncGen", - ":IR", - ":LinalgDialect", - ":LinalgTransforms", - ":Pass", - ":Support", - ":TensorDialect", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "TensorToSPIRV", - srcs = glob([ - "lib/Conversion/TensorToSPIRV/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/TensorToSPIRV/*.h", - ]), - includes = [ - "include", - "lib/Conversion/TensorToSPIRV", - ], - deps = [ - ":ArithToSPIRV", - ":ConversionPassIncGen", - ":FuncToSPIRV", - ":IR", - ":Pass", - ":SPIRVCommonConversion", - ":SPIRVConversion", - ":SPIRVDialect", - ":SPIRVUtils", - ":Support", - ":TensorDialect", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "SPIRVBinaryUtils", - srcs = ["lib/Target/SPIRV/SPIRVBinaryUtils.cpp"], - hdrs = ["include/mlir/Target/SPIRV/SPIRVBinaryUtils.h"], - includes = ["include"], - deps = [ - ":SPIRVDialect", - ":Support", - ], -) - -cc_library( - name = "SPIRVSerialization", - srcs = [ - "lib/Target/SPIRV/Serialization/Serialization.cpp", - "lib/Target/SPIRV/Serialization/SerializeOps.cpp", - "lib/Target/SPIRV/Serialization/Serializer.cpp", - "lib/Target/SPIRV/Serialization/Serializer.h", - ], - hdrs = ["include/mlir/Target/SPIRV/Serialization.h"], - includes = ["include"], - deps = [ - ":IR", - ":SPIRVBinaryUtils", - ":SPIRVDialect", - ":SPIRVSerializationGen", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "SPIRVDeserialization", - srcs = glob([ - "lib/Target/SPIRV/Deserialization/*.cpp", - "lib/Target/SPIRV/Deserialization/*.h", - ]), - hdrs = ["include/mlir/Target/SPIRV/Deserialization.h"], - includes = ["include"], - deps = [ - ":IR", - ":SPIRVBinaryUtils", - ":SPIRVDialect", - ":SPIRVSerializationGen", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "SPIRVModuleCombiner", - srcs = glob( - ["lib/Dialect/SPIRV/Linking/ModuleCombiner/*.cpp"], - ), - hdrs = ["include/mlir/Dialect/SPIRV/Linking/ModuleCombiner.h"], - includes = ["include"], - deps = [ - ":IR", - ":SPIRVDialect", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "SPIRVTranslateRegistration", - srcs = ["lib/Target/SPIRV/TranslateRegistration.cpp"], - includes = ["include"], - deps = [ - ":IR", - ":Parser", - ":SPIRVDeserialization", - ":SPIRVDialect", - ":SPIRVSerialization", - ":Support", - ":TranslateLib", - "//llvm:Support", - ], -) - -td_library( - name = "TensorOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Tensor/IR/TensorBase.td", - "include/mlir/Dialect/Tensor/IR/TensorOps.td", - ], - includes = ["include"], - deps = [ - ":CastInterfacesTdFiles", - ":ControlFlowInterfacesTdFiles", - ":DestinationStyleOpInterfaceTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":ParallelCombiningOpInterfaceTdFiles", - ":ShapedOpInterfacesTdFiles", - ":SideEffectInterfacesTdFiles", - ":TilingInterfaceTdFiles", - ":ViewLikeInterfaceTdFiles", - ], -) - -gentbl_cc_library( - name = "TensorOpsIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=tensor", - ], - "include/mlir/Dialect/Tensor/IR/TensorOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=tensor", - ], - "include/mlir/Dialect/Tensor/IR/TensorOpsDialect.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Tensor/IR/TensorOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Tensor/IR/TensorOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Tensor/IR/TensorOps.td", - deps = [":TensorOpsTdFiles"], -) - -cc_library( - name = "TensorDialect", - srcs = [ - "lib/Dialect/Tensor/IR/TensorDialect.cpp", - "lib/Dialect/Tensor/IR/TensorOps.cpp", - "lib/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.cpp", - ], - hdrs = [ - "include/mlir/Dialect/Tensor/IR/Tensor.h", - "include/mlir/Dialect/Tensor/IR/ValueBoundsOpInterfaceImpl.h", - ], - includes = ["include"], - deps = [ - ":AffineDialect", - ":ArithDialect", - ":ArithUtils", - ":BufferizationInterfaces", - ":BytecodeOpInterface", - ":CastInterfaces", - ":ComplexDialect", - ":ControlFlowInterfaces", - ":DestinationStyleOpInterface", - ":DialectUtils", - ":IR", - ":InferTypeOpInterface", - ":InliningUtils", - ":LoopLikeInterface", - ":ParallelCombiningOpInterface", - ":ShapedOpInterfaces", - ":SideEffectInterfaces", - ":SubsetOpInterface", - ":Support", - ":TensorOpsIncGen", - ":TilingInterface", - ":TransformDialectInterfaces", - ":ValueBoundsOpInterface", - ":ViewLikeInterface", - "//llvm:Support", - ], -) - -cc_library( - name = "TensorInferTypeOpInterfaceImpl", - srcs = ["lib/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.cpp"], - hdrs = ["include/mlir/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.h"], - includes = ["include"], - deps = [ - ":AffineDialect", - ":ArithUtils", - ":DialectUtils", - ":IR", - ":InferTypeOpInterface", - ":TensorDialect", - ], -) - -cc_library( - name = "TensorTilingInterfaceImpl", - srcs = ["lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp"], - hdrs = ["include/mlir/Dialect/Tensor/IR/TensorTilingInterfaceImpl.h"], - includes = ["include"], - deps = [ - ":AffineDialect", - ":AffineUtils", - ":ArithUtils", - ":DialectUtils", - ":IR", - ":LinalgDialect", - ":LinalgUtils", - ":SCFDialect", - ":TensorDialect", - ":TensorUtils", - ":TilingInterface", - ":ValueBoundsOpInterface", - ], -) - -cc_library( - name = "TensorUtils", - srcs = ["lib/Dialect/Tensor/Utils/Utils.cpp"], - hdrs = ["include/mlir/Dialect/Tensor/Utils/Utils.h"], - includes = ["include"], - deps = [ - ":AffineDialect", - ":ArithDialect", - ":ArithUtils", - ":DialectUtils", - ":TensorDialect", - ":ValueBoundsOpInterface", - ], -) - -gentbl_cc_library( - name = "TensorPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Tensor", - ], - "include/mlir/Dialect/Tensor/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Tensor/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "TensorTransforms", - srcs = glob( - [ - "lib/Dialect/Tensor/Transforms/*.cpp", - ], - ), - hdrs = glob(["include/mlir/Dialect/Tensor/Transforms/*.h"]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":AffineTransforms", - ":AffineUtils", - ":ArithDialect", - ":ArithUtils", - ":BufferizationDialect", - ":BufferizationInterfaces", - ":BufferizationTransforms", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":LinalgDialect", - ":MemRefDialect", - ":Pass", - ":SCFDialect", - ":SubsetOpInterface", - ":TensorDialect", - ":TensorPassIncGen", - ":TensorUtils", - ":TilingInterface", - ":TransformUtils", - ":ValueBoundsOpInterface", - ":VectorDialect", - ":VectorUtils", - ":ViewLikeInterface", - "//llvm:Support", - ], -) - -td_library( - name = "TensorTransformOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Tensor/TransformOps/TensorTransformOps.td", - ], - includes = ["include"], - deps = [ - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "TensorTransformOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Tensor/TransformOps/TensorTransformOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Tensor/TransformOps/TensorTransformOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Tensor/TransformOps/TensorTransformOps.td", - deps = [ - ":TensorTransformOpsTdFiles", - ], -) - -cc_library( - name = "TensorTransformOps", - srcs = glob(["lib/Dialect/Tensor/TransformOps/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/Tensor/TransformOps/*.h"]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":IR", - ":SCFDialect", - ":TensorDialect", - ":TensorTransformOpsIncGen", - ":TensorTransforms", - ":TensorUtils", - ":TransformDialect", - ":TransformDialectInterfaces", - ":TransformUtils", - ], -) - -cc_library( - name = "Rewrite", - srcs = glob([ - "lib/Rewrite/*.cpp", - "lib/Rewrite/*.h", - ]), - hdrs = glob(["include/mlir/Rewrite/*.h"]), - includes = ["include"], - deps = [ - ":Analysis", - ":IR", - ":PDLDialect", - ":PDLInterpDialect", - ":PDLToPDLInterp", - ":Pass", - ":SideEffectInterfaces", - "//llvm:Support", - ], -) - -cc_library( - name = "TransformUtils", - srcs = glob( - include = ["lib/Transforms/Utils/*.cpp"], - exclude = ["lib/Transforms/Utils/InliningUtils.cpp"], - ) + [ - ], - hdrs = [ - "include/mlir/Transforms/CFGToSCF.h", - "include/mlir/Transforms/CommutativityUtils.h", - "include/mlir/Transforms/ControlFlowSinkUtils.h", - "include/mlir/Transforms/DialectConversion.h", - "include/mlir/Transforms/FoldUtils.h", - "include/mlir/Transforms/GreedyPatternRewriteDriver.h", - "include/mlir/Transforms/Inliner.h", - "include/mlir/Transforms/LoopInvariantCodeMotionUtils.h", - "include/mlir/Transforms/OneToNTypeConversion.h", - "include/mlir/Transforms/RegionUtils.h", - ], - includes = ["include"], - deps = [ - ":Analysis", - ":CallOpInterfaces", - ":ControlFlowInterfaces", - ":FunctionInterfaces", - ":IR", - ":InliningUtils", - ":LoopLikeInterface", - ":Pass", - ":Rewrite", - ":SideEffectInterfaces", - ":SubsetOpInterface", - ":Support", - ":config", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "DerivedAttributeOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/DerivedAttributeOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/DerivedAttributeOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/DerivedAttributeOpInterface.td", - deps = [":DerivedAttributeOpInterfaceTdFiles"], -) - -cc_library( - name = "DerivedAttributeOpInterface", - srcs = ["lib/Interfaces/DerivedAttributeOpInterface.cpp"], - hdrs = ["include/mlir/Interfaces/DerivedAttributeOpInterface.h"], - includes = ["include"], - deps = [ - ":DerivedAttributeOpInterfaceIncGen", - ":IR", - ], -) - -gentbl_cc_library( - name = "DestinationStyleOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/DestinationStyleOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/DestinationStyleOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/DestinationStyleOpInterface.td", - deps = [":DestinationStyleOpInterfaceTdFiles"], -) - -cc_library( - name = "DestinationStyleOpInterface", - srcs = ["lib/Interfaces/DestinationStyleOpInterface.cpp"], - hdrs = ["include/mlir/Interfaces/DestinationStyleOpInterface.h"], - includes = ["include"], - deps = [ - ":DestinationStyleOpInterfaceIncGen", - ":IR", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "InferIntRangeInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/InferIntRangeInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/InferIntRangeInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/InferIntRangeInterface.td", - deps = [":InferIntRangeInterfaceTdFiles"], -) - -cc_library( - name = "InferIntRangeInterface", - srcs = ["lib/Interfaces/InferIntRangeInterface.cpp"], - hdrs = ["include/mlir/Interfaces/InferIntRangeInterface.h"], - includes = ["include"], - deps = [ - ":IR", - ":InferIntRangeInterfaceIncGen", - ], -) - -td_library( - name = "DataLayoutInterfacesTdFiles", - srcs = ["include/mlir/Interfaces/DataLayoutInterfaces.td"], - includes = ["include"], -) - -gentbl_cc_library( - name = "DataLayoutInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-attr-interface-decls"], - "include/mlir/Interfaces/DataLayoutAttrInterface.h.inc", - ), - ( - ["-gen-attr-interface-defs"], - "include/mlir/Interfaces/DataLayoutAttrInterface.cpp.inc", - ), - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/DataLayoutOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/DataLayoutOpInterface.cpp.inc", - ), - ( - ["-gen-type-interface-decls"], - "include/mlir/Interfaces/DataLayoutTypeInterface.h.inc", - ), - ( - ["-gen-type-interface-defs"], - "include/mlir/Interfaces/DataLayoutTypeInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/DataLayoutInterfaces.td", - deps = [":OpBaseTdFiles"], -) - -gentbl_cc_library( - name = "LoopLikeInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/LoopLikeInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/LoopLikeInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/LoopLikeInterface.td", - deps = [":LoopLikeInterfaceTdFiles"], -) - -gentbl_cc_library( - name = "MemorySlotInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/MemorySlotOpInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/MemorySlotOpInterfaces.cpp.inc", - ), - ( - ["-gen-type-interface-decls"], - "include/mlir/Interfaces/MemorySlotTypeInterfaces.h.inc", - ), - ( - ["-gen-type-interface-defs"], - "include/mlir/Interfaces/MemorySlotTypeInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/MemorySlotInterfaces.td", - deps = [":MemorySlotInterfacesTdFiles"], -) - -gentbl_cc_library( - name = "ShapedOpInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/ShapedOpInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/ShapedOpInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/ShapedOpInterfaces.td", - deps = [":ShapedOpInterfacesTdFiles"], -) - -gentbl_cc_library( - name = "ParallelCombiningOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/ParallelCombiningOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/ParallelCombiningOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/ParallelCombiningOpInterface.td", - deps = [":ParallelCombiningOpInterfaceTdFiles"], -) - -gentbl_cc_library( - name = "RuntimeVerifiableOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/RuntimeVerifiableOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/RuntimeVerifiableOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/RuntimeVerifiableOpInterface.td", - deps = [":RuntimeVerifiableOpInterfaceTdFiles"], -) - -gentbl_cc_library( - name = "VectorInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/VectorInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/VectorInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/VectorInterfaces.td", - deps = [":VectorInterfacesTdFiles"], -) - -gentbl_cc_library( - name = "ViewLikeInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/ViewLikeInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/ViewLikeInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/ViewLikeInterface.td", - deps = [":ViewLikeInterfaceTdFiles"], -) - -gentbl_cc_library( - name = "CopyOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/CopyOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/CopyOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/CopyOpInterface.td", - deps = [":CopyOpInterfaceTdFiles"], -) - -gentbl_cc_library( - name = "TransformsPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Transforms", - ], - "include/mlir/Transforms/Passes.h.inc", - ), - ( - [ - "-gen-pass-capi-header", - "--prefix=Transforms", - ], - "include/mlir/Transforms/Transforms.capi.h.inc", - ), - ( - [ - "-gen-pass-capi-impl", - "--prefix=Transforms", - ], - "include/mlir/Transforms/Transforms.capi.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Transforms/Passes.td", - deps = [ - ":PassBaseTdFiles", - ":RewritePassBaseTdFiles", - ], -) - -cc_library( - name = "Transforms", - srcs = glob([ - "lib/Transforms/*.cpp", - ]), - hdrs = [ - "include/mlir/Transforms/CSE.h", - "include/mlir/Transforms/EndomorphismSimplification.h", - "include/mlir/Transforms/HomomorphismSimplification.h", - "include/mlir/Transforms/LocationSnapshot.h", - "include/mlir/Transforms/Mem2Reg.h", - "include/mlir/Transforms/Passes.h", - "include/mlir/Transforms/SROA.h", - "include/mlir/Transforms/ViewOpGraph.h", - ], - includes = ["include"], - deps = [ - ":Analysis", - ":CallOpInterfaces", - ":ControlFlowInterfaces", - ":FunctionInterfaces", - ":IR", - ":LoopLikeInterface", - ":MemorySlotInterfaces", - ":Pass", - ":RuntimeVerifiableOpInterface", - ":SideEffectInterfaces", - ":Support", - ":TransformUtils", - ":TransformsPassIncGen", - "//llvm:Support", - ], -) - -cc_library( - name = "CommonFolders", - srcs = [ - ], - hdrs = ["include/mlir/Dialect/CommonFolders.h"], - includes = ["include"], - deps = [ - ":IR", - "//llvm:Support", - ], -) - -cc_library( - name = "SCFToGPU", - srcs = glob(["lib/Conversion/SCFToGPU/*.cpp"]), - hdrs = glob(["include/mlir/Conversion/SCFToGPU/*.h"]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":AffineToStandard", - ":ArithDialect", - ":ComplexDialect", - ":ConversionPassIncGen", - ":FunctionInterfaces", - ":GPUDialect", - ":GPUTransforms", - ":IR", - ":MemRefDialect", - ":Pass", - ":SCFDialect", - ":SideEffectInterfaces", - ":Support", - ":TransformUtils", - ":Transforms", - "//llvm:Support", - ], -) - -cc_library( - name = "SCFToEmitC", - srcs = glob(["lib/Conversion/SCFToEmitC/*.cpp"]), - hdrs = glob(["include/mlir/Conversion/SCFToEmitC/*.h"]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":ConversionPassIncGen", - ":EmitCDialect", - ":IR", - ":SCFDialect", - ":TransformUtils", - ":Transforms", - ], -) - -cc_library( - name = "SCFToSPIRV", - srcs = glob([ - "lib/Conversion/SCFToSPIRV/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/SCFToSPIRV/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithToSPIRV", - ":ConversionPassIncGen", - ":FuncToSPIRV", - ":IR", - ":IndexToSPIRV", - ":MemRefToSPIRV", - ":Pass", - ":SCFDialect", - ":SPIRVConversion", - ":SPIRVDialect", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "SCFToOpenMP", - srcs = [ - "lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp", - ], - hdrs = ["include/mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h"], - includes = ["include"], - deps = [ - ":AffineAnalysis", - ":Analysis", - ":ArithDialect", - ":ConversionPassIncGen", - ":IR", - ":LLVMDialect", - ":MemRefDialect", - ":OpenMPDialect", - ":Pass", - ":SCFDialect", - ":TransformUtils", - ], -) - -cc_library( - name = "SCFToControlFlow", - srcs = [ - "lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp", - ], - hdrs = ["include/mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"], - includes = ["include"], - deps = [ - ":ArithDialect", - ":ControlFlowDialect", - ":ConversionPassIncGen", - ":IR", - ":SCFDialect", - ":SCFTransforms", - ":TransformUtils", - ":Transforms", - ], -) - -cc_library( - name = "LLVMCommonConversion", - srcs = glob([ - "lib/Conversion/LLVMCommon/*.cpp", - ]) + ["lib/Conversion/LLVMCommon/MemRefDescriptor.h"], - hdrs = glob(["include/mlir/Conversion/LLVMCommon/*.h"]), - includes = ["include"], - deps = [ - ":DataLayoutInterfaces", - ":IR", - ":LLVMDialect", - ":Support", - ":TransformUtils", - ":Transforms", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "ReconcileUnrealizedCasts", - srcs = glob(["lib/Conversion/ReconcileUnrealizedCasts/*.cpp"]), - hdrs = glob(["include/mlir/Conversion/ReconcileUnrealizedCasts/*.h"]), - includes = ["include"], - deps = [ - ":ConversionPassIncGen", - ":IR", - ":Pass", - ":TransformUtils", - ], -) - -cc_library( - name = "ConvertToLLVMInterface", - srcs = ["lib/Conversion/ConvertToLLVM/ToLLVMInterface.cpp"], - hdrs = ["include/mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"], - includes = ["include"], - deps = [ - ":IR", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "ConvertToLLVM", - srcs = ["lib/Conversion/ConvertToLLVM/ConvertToLLVMPass.cpp"], - hdrs = ["include/mlir/Conversion/ConvertToLLVM/ToLLVMPass.h"], - includes = ["include"], - deps = [ - ":ConversionPassIncGen", - ":ConvertToLLVMInterface", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":Pass", - ":Rewrite", - ":TransformUtils", - ], -) - -cc_library( - name = "FuncToLLVM", - srcs = [ - "lib/Conversion/FuncToLLVM/FuncToLLVM.cpp", - ], - hdrs = [ - "include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h", - "include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h", - ], - includes = ["include"], - deps = [ - ":Analysis", - ":ArithToLLVM", - ":ControlFlowToLLVM", - ":ConversionPassIncGen", - ":ConvertToLLVMInterface", - ":DataLayoutInterfaces", - ":DialectUtils", - ":FuncDialect", - ":FuncTransforms", - ":FunctionInterfaces", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MathDialect", - ":MemRefDialect", - ":Parser", - ":Pass", - ":Support", - ":TransformUtils", - ":Transforms", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "ConvertToSPIRV", - srcs = ["lib/Conversion/ConvertToSPIRV/ConvertToSPIRVPass.cpp"], - hdrs = ["include/mlir/Conversion/ConvertToSPIRV/ConvertToSPIRVPass.h"], - includes = ["include"], - deps = [ - ":ArithToSPIRV", - ":ArithTransforms", - ":ConversionPassIncGen", - ":FuncToSPIRV", - ":IR", - ":IndexToSPIRV", - ":Pass", - ":Rewrite", - ":SCFToSPIRV", - ":SPIRVConversion", - ":SPIRVDialect", - ":SPIRVTransforms", - ":TransformUtils", - ":Transforms", - ":UBToSPIRV", - ":VectorToSPIRV", - ":VectorTransforms", - ], -) - -cc_library( - name = "ControlFlowToSCF", - srcs = [ - "lib/Conversion/ControlFlowToSCF/ControlFlowToSCF.cpp", - ], - hdrs = [ - "include/mlir/Conversion/ControlFlowToSCF/ControlFlowToSCF.h", - ], - includes = ["include"], - deps = [ - ":ArithDialect", - ":ControlFlowDialect", - ":ConversionPassIncGen", - ":FuncDialect", - ":LLVMDialect", - ":Pass", - ":SCFDialect", - ":TransformUtils", - ":UBDialect", - ], -) - -cc_library( - name = "ControlFlowToLLVM", - srcs = [ - "lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp", - ], - hdrs = [ - "include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h", - ], - includes = ["include"], - deps = [ - ":ControlFlowDialect", - ":ConversionPassIncGen", - ":ConvertToLLVMInterface", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":Pass", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "ControlFlowToSPIRV", - srcs = glob(["lib/Conversion/ControlFlowToSPIRV/*.cpp"]), - hdrs = glob(["include/mlir/Conversion/ControlFlowToSPIRV/*.h"]), - includes = ["include"], - deps = [ - ":ControlFlowDialect", - ":ConversionPassIncGen", - ":IR", - ":Pass", - ":SPIRVCommonConversion", - ":SPIRVConversion", - ":SPIRVDialect", - ":SPIRVUtils", - ":Support", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "MemRefToEmitC", - srcs = glob([ - "lib/Conversion/MemRefToEmitC/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/MemRefToEmitC/*.h", - ]), - includes = [ - "include", - "lib/Conversion/MemRefToEmitC", - ], - deps = [ - ":ConversionPassIncGen", - ":EmitCDialect", - ":IR", - ":MemRefDialect", - ":Pass", - ":TransformUtils", - ], -) - -cc_library( - name = "MemRefToLLVM", - srcs = glob(["lib/Conversion/MemRefToLLVM/*.cpp"]), - hdrs = glob(["include/mlir/Conversion/MemRefToLLVM/*.h"]), - includes = ["include"], - deps = [ - ":Analysis", - ":ArithDialect", - ":ConversionPassIncGen", - ":ConvertToLLVMInterface", - ":FuncDialect", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MemRefDialect", - ":MemRefUtils", - ":Pass", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "MemRefToSPIRV", - srcs = glob([ - "lib/Conversion/MemRefToSPIRV/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/MemRefToSPIRV/*.h", - ]), - includes = [ - "include", - "lib/Conversion/MemRefToSPIRV", - ], - deps = [ - ":ArithDialect", - ":ConversionPassIncGen", - ":FunctionInterfaces", - ":IR", - ":MemRefDialect", - ":Pass", - ":SPIRVConversion", - ":SPIRVDialect", - ":Support", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "ArithAttrToLLVMConversion", - srcs = glob(["lib/Conversion/ArithCommon/*.cpp"]), - hdrs = glob(["include/mlir/Conversion/ArithCommon/*.h"]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":LLVMDialect", - ], -) - -cc_library( - name = "ArithToAMDGPU", - srcs = glob(["lib/Conversion/ArithToAMDGPU/*.cpp"]), - hdrs = glob(["include/mlir/Conversion/ArithToAMDGPU/*.h"]), - includes = ["include"], - deps = [ - ":AMDGPUDialect", - ":ArithDialect", - ":ArithUtils", - ":ConversionPassIncGen", - ":IR", - ":Pass", - ":Support", - ":TransformUtils", - ":VectorDialect", - ], -) - -cc_library( - name = "ArithToArmSME", - srcs = glob([ - "lib/Conversion/ArithToArmSME/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/ArithToArmSME/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":ArmSMEDialect", - ":ConversionPassIncGen", - ":Pass", - ":TransformUtils", - ], -) - -cc_library( - name = "ArithToEmitC", - srcs = glob([ - "lib/Conversion/ArithToEmitC/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/ArithToEmitC/*.h", - ]), - includes = [ - "include", - "lib/Conversion/ArithToEmitC", - ], - deps = [ - ":ArithDialect", - ":ConversionPassIncGen", - ":EmitCDialect", - ":EmitCTransforms", - ":IR", - ":Pass", - ":Support", - ":TransformUtils", - ], -) - -cc_library( - name = "ArithToLLVM", - srcs = glob(["lib/Conversion/ArithToLLVM/*.cpp"]), - hdrs = glob(["include/mlir/Conversion/ArithToLLVM/*.h"]), - includes = ["include"], - deps = [ - ":ArithAttrToLLVMConversion", - ":ArithDialect", - ":ConversionPassIncGen", - ":ConvertToLLVMInterface", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":Pass", - ], -) - -cc_library( - name = "ArithToSPIRV", - srcs = glob(["lib/Conversion/ArithToSPIRV/*.cpp"]), - hdrs = glob(["include/mlir/Conversion/ArithToSPIRV/*.h"]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":ConversionPassIncGen", - ":IR", - ":Pass", - ":SPIRVCommonConversion", - ":SPIRVConversion", - ":SPIRVDialect", - "//llvm:Support", - ], -) - -cc_library( - name = "MathToLLVM", - srcs = glob(["lib/Conversion/MathToLLVM/*.cpp"]), - hdrs = glob(["include/mlir/Conversion/MathToLLVM/*.h"]), - includes = ["include"], - deps = [ - ":ArithAttrToLLVMConversion", - ":ConversionPassIncGen", - ":ConvertToLLVMInterface", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MathDialect", - ":Pass", - ], -) - -cc_library( - name = "MathToFuncs", - srcs = glob(["lib/Conversion/MathToFuncs/*.cpp"]), - hdrs = glob(["include/mlir/Conversion/MathToFuncs/*.h"]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":ControlFlowDialect", - ":ConversionPassIncGen", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":LLVMDialect", - ":MathDialect", - ":Pass", - ":SCFDialect", - ":TransformUtils", - ":VectorDialect", - ":VectorUtils", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "BytecodeOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Bytecode/BytecodeOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Bytecode/BytecodeOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Bytecode/BytecodeOpInterface.td", - deps = [":BytecodeOpInterfaceTdFiles"], -) - -cc_library( - name = "BytecodeOpInterface", - srcs = ["lib/Bytecode/BytecodeOpInterface.cpp"], - hdrs = [ - "include/mlir/Bytecode/BytecodeImplementation.h", - "include/mlir/Bytecode/BytecodeOpInterface.h", - "include/mlir/Bytecode/Encoding.h", - ], - includes = ["include"], - deps = [ - ":BytecodeOpInterfaceIncGen", - ":IR", - ":Support", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "CallOpInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/CallInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/CallInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/CallInterfaces.td", - deps = [":CallInterfacesTdFiles"], -) - -cc_library( - name = "CallOpInterfaces", - srcs = ["lib/Interfaces/CallInterfaces.cpp"], - hdrs = ["include/mlir/Interfaces/CallInterfaces.h"], - includes = ["include"], - deps = [ - ":CallOpInterfacesIncGen", - ":IR", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "CastInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/CastInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/CastInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/CastInterfaces.td", - deps = [":CastInterfacesTdFiles"], -) - -cc_library( - name = "CastInterfaces", - srcs = ["lib/Interfaces/CastInterfaces.cpp"], - hdrs = ["include/mlir/Interfaces/CastInterfaces.h"], - includes = ["include"], - deps = [ - ":CastInterfacesIncGen", - ":IR", - ], -) - -gentbl_cc_library( - name = "ControlFlowInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/ControlFlowInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/ControlFlowInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/ControlFlowInterfaces.td", - deps = [":ControlFlowInterfacesTdFiles"], -) - -cc_library( - name = "ControlFlowInterfaces", - srcs = ["lib/Interfaces/ControlFlowInterfaces.cpp"], - hdrs = ["include/mlir/Interfaces/ControlFlowInterfaces.h"], - includes = ["include"], - deps = [ - ":ControlFlowInterfacesIncGen", - ":IR", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "InferTypeOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/InferTypeOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/InferTypeOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/InferTypeOpInterface.td", - deps = [":InferTypeOpInterfaceTdFiles"], -) - -cc_library( - name = "InferTypeOpInterface", - srcs = ["lib/Interfaces/InferTypeOpInterface.cpp"], - hdrs = ["include/mlir/Interfaces/InferTypeOpInterface.h"], - includes = ["include"], - deps = [ - ":IR", - ":InferTypeOpInterfaceIncGen", - ":Support", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "SideEffectInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/SideEffectInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/SideEffectInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/SideEffectInterfaces.td", - deps = [":SideEffectInterfacesTdFiles"], -) - -cc_library( - name = "SideEffectInterfaces", - srcs = ["lib/Interfaces/SideEffectInterfaces.cpp"], - hdrs = ["include/mlir/Interfaces/SideEffectInterfaces.h"], - includes = ["include"], - deps = [ - ":IR", - ":SideEffectInterfacesIncGen", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "TilingInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/TilingInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/TilingInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/TilingInterface.td", - deps = [":TilingInterfaceTdFiles"], -) - -cc_library( - name = "Analysis", - srcs = glob( - [ - "lib/Analysis/*.cpp", - "lib/Analysis/*/*.cpp", - ], - ), - hdrs = glob( - [ - "include/mlir/Analysis/*.h", - "include/mlir/Analysis/*/*.h", - ], - ), - copts = [ - "$(STACK_FRAME_UNLIMITED)", - ], - includes = ["include"], - deps = [ - ":ArithDialect", - ":CallOpInterfaces", - ":ControlFlowInterfaces", - ":DataLayoutInterfaces", - ":FunctionInterfaces", - ":IR", - ":InferIntRangeInterface", - ":LoopLikeInterface", - ":Pass", - ":SideEffectInterfaces", - ":Support", - ":ViewLikeInterface", - "//llvm:Support", - "//llvm:config", - ], -) - -cc_library( - name = "ParseUtilities", - hdrs = ["include/mlir/Tools/ParseUtilities.h"], - includes = ["include"], - deps = [ - ":IR", - ":Parser", - ], -) - -cc_library( - name = "TranslateLib", - srcs = glob([ - "lib/Tools/mlir-translate/*.cpp", - ]), - hdrs = glob(["include/mlir/Tools/mlir-translate/*.h"]), - includes = ["include"], - deps = [ - ":IR", - ":ParseUtilities", - ":Parser", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "ToLLVMIRTranslation", - srcs = [ - "lib/Target/LLVMIR/AttrKindDetail.h", - "lib/Target/LLVMIR/DebugTranslation.cpp", - "lib/Target/LLVMIR/DebugTranslation.h", - "lib/Target/LLVMIR/LoopAnnotationTranslation.cpp", - "lib/Target/LLVMIR/LoopAnnotationTranslation.h", - "lib/Target/LLVMIR/ModuleTranslation.cpp", - "lib/Target/LLVMIR/TypeToLLVM.cpp", - ], - hdrs = [ - "include/mlir/Target/LLVMIR/Export.h", - "include/mlir/Target/LLVMIR/LLVMTranslationInterface.h", - "include/mlir/Target/LLVMIR/ModuleTranslation.h", - "include/mlir/Target/LLVMIR/TypeToLLVM.h", - ], - includes = ["include"], - deps = [ - ":Analysis", - ":DLTIDialect", - ":IR", - ":LLVMConversionIncGen", - ":LLVMDialect", - ":LLVMIRTransforms", - ":LLVMIntrinsicConversionIncGen", - ":OpenMPDialect", - ":Support", - ":TransformUtils", - "//llvm:Core", - "//llvm:FrontendOpenMP", - "//llvm:Support", - "//llvm:TransformUtils", - ], -) - -cc_library( - name = "AMXToLLVMIRTranslation", - srcs = glob(["lib/Target/LLVMIR/Dialect/AMX/*.cpp"]), - hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/AMX/*.h"]), - includes = ["include"], - deps = [ - ":AMXConversionIncGen", - ":AMXDialect", - ":IR", - ":ToLLVMIRTranslation", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "X86VectorToLLVMIRTranslation", - srcs = glob(["lib/Target/LLVMIR/Dialect/X86Vector/*.cpp"]), - hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/X86Vector/*.h"]), - includes = ["include"], - deps = [ - ":IR", - ":ToLLVMIRTranslation", - ":X86VectorConversionIncGen", - ":X86VectorDialect", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "ArmNeonToLLVMIRTranslation", - srcs = glob(["lib/Target/LLVMIR/Dialect/ArmNeon/*.cpp"]), - hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/ArmNeon/*.h"]), - includes = ["include"], - deps = [ - ":ArmNeonConversionIncGen", - ":ArmNeonDialect", - ":ArmNeonIncGen", - ":IR", - ":ToLLVMIRTranslation", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "ArmSMEToLLVMIRTranslation", - srcs = glob(["lib/Target/LLVMIR/Dialect/ArmSME/*.cpp"]), - hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/ArmSME/*.h"]), - includes = ["include"], - deps = [ - ":ArmSMEConversionIncGen", - ":ArmSMEDialect", - ":ArmSMEIntrinsicOpsIncGen", - ":IR", - ":ToLLVMIRTranslation", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "ArmSVEToLLVMIRTranslation", - srcs = glob(["lib/Target/LLVMIR/Dialect/ArmSVE/*.cpp"]), - hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/ArmSVE/*.h"]), - includes = ["include"], - deps = [ - ":ArmSVEConversionIncGen", - ":ArmSVEDialect", - ":IR", - ":ToLLVMIRTranslation", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "NVVMToLLVMIRTranslation", - srcs = ["lib/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.cpp"], - hdrs = ["include/mlir/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.h"], - includes = ["include"], - deps = [ - ":DialectUtils", - ":IR", - ":NVVMConversionIncGen", - ":NVVMDialect", - ":Support", - ":ToLLVMIRTranslation", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "ROCDLToLLVMIRTranslation", - srcs = glob(["lib/Target/LLVMIR/Dialect/ROCDL/*.cpp"]), - hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/ROCDL/*.h"]), - includes = ["include"], - deps = [ - ":IR", - ":ROCDLConversionIncGen", - ":ROCDLDialect", - ":ToLLVMIRTranslation", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "SPIRVToLLVMIRTranslation", - srcs = glob(["lib/Target/LLVMIR/Dialect/SPIRV/*.cpp"]), - hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/SPIRV/*.h"]), - includes = ["include"], - deps = [ - ":IR", - ":SPIRVDialect", - ":ToLLVMIRTranslation", - ], -) - -cc_library( - name = "GPUToLLVMIRTranslation", - srcs = [ - "lib/Target/LLVMIR/Dialect/GPU/GPUToLLVMIRTranslation.cpp", - "lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp", - ], - hdrs = ["include/mlir/Target/LLVMIR/Dialect/GPU/GPUToLLVMIRTranslation.h"], - includes = ["include"], - deps = [ - ":GPUDialect", - ":IR", - ":ToLLVMIRTranslation", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "BuiltinToLLVMIRTranslation", - srcs = ["lib/Target/LLVMIR/Dialect/Builtin/BuiltinToLLVMIRTranslation.cpp"], - hdrs = ["include/mlir/Target/LLVMIR/Dialect/Builtin/BuiltinToLLVMIRTranslation.h"], - includes = ["include"], - deps = [ - ":IR", - ":ToLLVMIRTranslation", - ], -) - -cc_library( - name = "LLVMToLLVMIRTranslation", - srcs = ["lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp"], - hdrs = ["include/mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h"], - includes = ["include"], - deps = [ - ":IR", - ":LLVMConversionIncGen", - ":LLVMDialect", - ":LLVMIntrinsicConversionIncGen", - ":Support", - ":ToLLVMIRTranslation", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "OpenMPCommon", - srcs = ["lib/Target/LLVMIR/Dialect/OpenMPCommon.cpp"], - hdrs = ["include/mlir/Target/LLVMIR/Dialect/OpenMPCommon.h"], - includes = ["include"], - deps = [ - ":IR", - ":Support", - "//llvm:Core", - "//llvm:FrontendOpenMP", - ], -) - -cc_library( - name = "LLVMIRToLLVMTranslation", - srcs = ["lib/Target/LLVMIR/Dialect/LLVMIR/LLVMIRToLLVMTranslation.cpp"], - hdrs = ["include/mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMIRToLLVMTranslation.h"], - includes = ["include"], - deps = [ - ":FromLLVMIRTranslation", - ":LLVMConversionIncGen", - ":LLVMDialect", - ":LLVMIntrinsicConversionIncGen", - ":Support", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "LLVMIRToNVVMTranslation", - srcs = ["lib/Target/LLVMIR/Dialect/NVVM/LLVMIRToNVVMTranslation.cpp"], - hdrs = ["include/mlir/Target/LLVMIR/Dialect/NVVM/LLVMIRToNVVMTranslation.h"], - includes = ["include"], - deps = [ - ":FromLLVMIRTranslation", - ":IR", - ":NVVMConvertibleLLVMIRIntrinsicsIncGen", - ":NVVMDialect", - ":NVVMFromLLVMIRConversionsIncGen", - ":Support", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "OpenACCToLLVMIRTranslation", - srcs = glob(["lib/Target/LLVMIR/Dialect/OpenACC/*.cpp"]), - hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/OpenACC/*.h"]), - includes = ["include"], - deps = [ - ":Analysis", - ":IR", - ":LLVMDialect", - ":OpenACCDialect", - ":OpenMPCommon", - ":Support", - ":ToLLVMIRTranslation", - ":TransformUtils", - "//llvm:Core", - "//llvm:FrontendOpenMP", - "//llvm:Support", - ], -) - -cc_library( - name = "OpenMPToLLVMIRTranslation", - srcs = glob(["lib/Target/LLVMIR/Dialect/OpenMP/*.cpp"]), - hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/OpenMP/*.h"]), - includes = ["include"], - deps = [ - ":Analysis", - ":IR", - ":LLVMDialect", - ":OpenMPCommon", - ":OpenMPDialect", - ":Support", - ":ToLLVMIRTranslation", - ":TransformUtils", - ":Transforms", - "//llvm:Core", - "//llvm:FrontendOpenMP", - "//llvm:Support", - "//llvm:TargetParser", - "//llvm:TransformUtils", - ], -) - -cc_library( - name = "AllToLLVMIRTranslations", - hdrs = ["include/mlir/Target/LLVMIR/Dialect/All.h"], - includes = ["include"], - deps = [ - ":AMXToLLVMIRTranslation", - ":ArmNeonToLLVMIRTranslation", - ":ArmSMEToLLVMIRTranslation", - ":ArmSVEToLLVMIRTranslation", - ":BuiltinToLLVMIRTranslation", - ":GPUToLLVMIRTranslation", - ":LLVMIRToLLVMTranslation", - ":LLVMIRToNVVMTranslation", - ":LLVMToLLVMIRTranslation", - ":NVVMTarget", - ":NVVMToLLVMIRTranslation", - ":OpenACCToLLVMIRTranslation", - ":OpenMPToLLVMIRTranslation", - ":ROCDLTarget", - ":ROCDLToLLVMIRTranslation", - ":SPIRVToLLVMIRTranslation", - ":VCIXToLLVMIRTranslation", - ":X86VectorToLLVMIRTranslation", - ], -) - -cc_library( - name = "ToLLVMIRTranslationRegistration", - srcs = ["lib/Target/LLVMIR/ConvertToLLVMIR.cpp"], - includes = ["include"], - deps = [ - ":AllToLLVMIRTranslations", - ":DLTIDialect", - ":FuncDialect", - ":IR", - ":NVVMTarget", - ":ROCDLTarget", - ":ToLLVMIRTranslation", - ":TranslateLib", - "//llvm:Core", - "//llvm:Support", - ], -) - -cc_library( - name = "FromLLVMIRTranslation", - srcs = [ - "lib/Target/LLVMIR/AttrKindDetail.h", - "lib/Target/LLVMIR/DataLayoutImporter.cpp", - "lib/Target/LLVMIR/DataLayoutImporter.h", - "lib/Target/LLVMIR/DebugImporter.cpp", - "lib/Target/LLVMIR/DebugImporter.h", - "lib/Target/LLVMIR/LoopAnnotationImporter.cpp", - "lib/Target/LLVMIR/LoopAnnotationImporter.h", - "lib/Target/LLVMIR/ModuleImport.cpp", - "lib/Target/LLVMIR/TypeFromLLVM.cpp", - ], - hdrs = [ - "include/mlir/Target/LLVMIR/Import.h", - "include/mlir/Target/LLVMIR/LLVMImportInterface.h", - "include/mlir/Target/LLVMIR/ModuleImport.h", - "include/mlir/Target/LLVMIR/TypeFromLLVM.h", - ], - includes = ["include"], - deps = [ - ":DLTIDialect", - ":DataLayoutInterfaces", - ":IR", - ":LLVMConversionIncGen", - ":LLVMDialect", - ":LLVMIntrinsicConversionIncGen", - ":Support", - ":TranslateLib", - "//llvm:BinaryFormat", - "//llvm:Core", - "//llvm:IRPrinter", - "//llvm:IRReader", - "//llvm:Support", - ], -) - -cc_library( - name = "FromLLVMIRTranslationRegistration", - srcs = [ - "lib/Target/LLVMIR/ConvertFromLLVMIR.cpp", - ], - deps = [ - ":AllToLLVMIRTranslations", - ":DLTIDialect", - ":FromLLVMIRTranslation", - ":IR", - ":TranslateLib", - "//llvm:Core", - "//llvm:IRReader", - "//llvm:Support", - ], -) - -cc_library( - name = "ExecutionEngine", - srcs = [ - "include/mlir/ExecutionEngine/CRunnerUtils.h", - "lib/ExecutionEngine/ExecutionEngine.cpp", - ], - hdrs = [ - "include/mlir/ExecutionEngine/ExecutionEngine.h", - "include/mlir/ExecutionEngine/MemRefUtils.h", - ], - includes = ["include"], - deps = [ - ":AllToLLVMIRTranslations", - ":IR", - ":LLVMDialect", - ":Support", - ":ToLLVMIRTranslation", - "//llvm:AllTargetsAsmParsers", - "//llvm:BitWriter", - "//llvm:Core", - "//llvm:ExecutionEngine", - "//llvm:MC", - "//llvm:OrcJIT", - "//llvm:Support", - "//llvm:Target", # fixdeps: keep - "//llvm:TargetParser", - "//llvm:TransformUtils", - "//llvm:X86CodeGen", # fixdeps: keep - "//llvm:X86Disassembler", # fixdeps: keep - ], -) - -cc_library( - name = "ExecutionEngineUtils", - srcs = ["lib/ExecutionEngine/OptUtils.cpp"], - hdrs = ["include/mlir/ExecutionEngine/OptUtils.h"], - includes = ["include"], - deps = [ - "//llvm:Analysis", - "//llvm:Core", - "//llvm:Coroutines", - "//llvm:IPO", - "//llvm:Passes", - "//llvm:Support", - "//llvm:Target", - "//llvm:common_transforms", - ], -) - -cc_library( - name = "PluginsLib", - srcs = [ - "lib/Tools/Plugins/DialectPlugin.cpp", - "lib/Tools/Plugins/PassPlugin.cpp", - ], - hdrs = [ - "include/mlir/Tools/Plugins/DialectPlugin.h", - "include/mlir/Tools/Plugins/PassPlugin.h", - ], - includes = ["include"], - deps = [ - ":IR", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "MlirOptLib", - srcs = ["lib/Tools/mlir-opt/MlirOptMain.cpp"], - hdrs = ["include/mlir/Tools/mlir-opt/MlirOptMain.h"], - includes = ["include"], - deps = [ - ":BytecodeWriter", - ":Debug", - ":IR", - ":IRDLDialect", - ":ParseUtilities", - ":Parser", - ":Pass", - ":PluginsLib", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "AllTranslations", - hdrs = ["include/mlir/InitAllTranslations.h"], - deps = [ - ":FromLLVMIRTranslationRegistration", - ":SPIRVTranslateRegistration", - ":TargetCpp", - ":ToLLVMIRTranslationRegistration", - ], -) - -cc_library( - name = "MlirTranslateMain", - srcs = ["tools/mlir-translate/mlir-translate.cpp"], - local_defines = ["MLIR_INCLUDE_TESTS"], - deps = [ - ":AllPassesAndDialects", - ":AllTranslations", - ":Support", - ":TranslateLib", - "//llvm:Support", - "//mlir/test:TestToLLVMIRTranslation", - ], -) - -cc_binary( - name = "mlir-translate", - deps = [":MlirTranslateMain"], -) - -cc_library( - name = "AllPassesAndDialects", - hdrs = [ - "include/mlir/InitAllDialects.h", - "include/mlir/InitAllPasses.h", - ], - deps = [ - ":AMDGPUDialect", - ":AMDGPUToROCDL", - ":AMDGPUTransforms", - ":AMXDialect", - ":AMXTransforms", - ":AffineDialect", - ":AffinePassIncGen", - ":AffineToStandard", - ":AffineTransformOps", - ":AffineTransforms", - ":ArithDialect", - ":ArithToAMDGPU", - ":ArithToLLVM", - ":ArithToSPIRV", - ":ArithTransforms", - ":ArithValueBoundsOpInterfaceImpl", - ":ArmNeonDialect", - ":ArmSMEDialect", - ":ArmSMETransforms", - ":ArmSVEDialect", - ":ArmSVETransforms", - ":AsyncDialect", - ":AsyncPassIncGen", - ":AsyncToLLVM", - ":AsyncTransforms", - ":BufferizationDialect", - ":BufferizationPipelines", - ":BufferizationTransformOps", - ":BufferizationTransforms", - ":CastInterfaces", - ":ComplexDialect", - ":ComplexToLLVM", - ":ComplexToLibm", - ":ComplexToSPIRV", - ":ControlFlowDialect", - ":ControlFlowTransforms", - ":ConversionPasses", - ":ConvertToLLVM", - ":DLTIDialect", - ":EmitCDialect", - ":EmitCTransforms", - ":FuncDialect", - ":FuncToLLVM", - ":FuncToSPIRV", - ":FuncTransformOps", - ":FuncTransforms", - ":FuncTransformsPassIncGen", - ":GPUDialect", - ":GPUPassIncGen", - ":GPUPipelines", - ":GPUToGPURuntimeTransforms", - ":GPUToNVVMTransforms", - ":GPUToROCDLTransforms", - ":GPUToSPIRV", - ":GPUToVulkanTransforms", - ":GPUTransformOps", - ":GPUTransforms", - ":IR", - ":IRDLDialect", - ":IndexDialect", - ":LLVMDialect", - ":LLVMIRTransforms", - ":LLVMPassIncGen", - ":LinalgDialect", - ":LinalgPassIncGen", - ":LinalgToStandard", - ":LinalgTransformOps", - ":LinalgTransforms", - ":MLProgramDialect", - ":MLProgramTransforms", - ":MPIDialect", - ":MathDialect", - ":MathToFuncs", - ":MathToLLVM", - ":MathToLibm", - ":MathToSPIRV", - ":MathTransforms", - ":MemRefDialect", - ":MemRefToLLVM", - ":MemRefToSPIRV", - ":MemRefTransformOps", - ":MemRefTransforms", - ":MeshDialect", - ":MeshTransforms", - ":NVGPUDialect", - ":NVGPUPassIncGen", - ":NVGPUToNVVM", - ":NVGPUTransformOps", - ":NVGPUTransforms", - ":NVVMDialect", - ":NVVMTarget", - ":OpenACCDialect", - ":OpenACCTransforms", - ":OpenMPDialect", - ":OpenMPToLLVM", - ":PDLDialect", - ":PDLInterpDialect", - ":PDLToPDLInterp", - ":PolynomialDialect", - ":PtrDialect", - ":QuantOps", - ":ROCDLDialect", - ":ROCDLTarget", - ":ReconcileUnrealizedCasts", - ":SCFDialect", - ":SCFPassIncGen", - ":SCFToControlFlow", - ":SCFToGPU", - ":SCFTransformOps", - ":SCFTransforms", - ":SPIRVDialect", - ":SPIRVPassIncGen", - ":SPIRVTarget", - ":SPIRVToLLVM", - ":SPIRVTransforms", - ":ShapeDialect", - ":ShapeToStandard", - ":ShapeTransforms", - ":ShapeTransformsPassIncGen", - ":SparseTensorDialect", - ":SparseTensorPipelines", - ":SparseTensorTransformOps", - ":SparseTensorTransforms", - ":TensorDialect", - ":TensorInferTypeOpInterfaceImpl", - ":TensorTilingInterfaceImpl", - ":TensorTransformOps", - ":TensorTransforms", - ":TosaDialect", - ":TosaToLinalg", - ":TransformDebugExtension", - ":TransformDialect", - ":TransformDialectTransforms", - ":TransformLoopExtension", - ":TransformPDLExtension", - ":Transforms", - ":TransformsPassIncGen", - ":UBDialect", - ":VectorDialect", - ":VectorToLLVM", - ":VectorToSCF", - ":VectorToSPIRV", - ":VectorTransformOps", - ":VectorTransforms", - ":X86VectorDialect", - ":X86VectorTransforms", - ":XeGPUDialect", - ":XeGPUTransforms", - ], -) - -cc_binary( - name = "mlir-lsp-server", - srcs = ["tools/mlir-lsp-server/mlir-lsp-server.cpp"], - includes = ["include"], - deps = [ - ":AllExtensions", - ":AllPassesAndDialects", - ":BytecodeWriter", - ":IR", - ":MlirLspServerLib", - ":Parser", - ], -) - -cc_binary( - name = "mlir-opt", - srcs = ["tools/mlir-opt/mlir-opt.cpp"], - local_defines = ["MLIR_INCLUDE_TESTS"], - deps = [ - ":AllExtensions", - ":AllPassesAndDialects", - ":AllToLLVMIRTranslations", - ":Analysis", - ":IR", - ":MlirOptLib", - ":OpenMPDialect", - ":Pass", - ":QuantOps", - ":SCFToGPU", - ":Support", - ":Transforms", - ":config", - "//llvm:AllTargetsCodeGens", - "//llvm:Support", - "//mlir/test:TestAffine", - "//mlir/test:TestAnalysis", - "//mlir/test:TestArith", - "//mlir/test:TestArmNeon", - "//mlir/test:TestArmSME", - "//mlir/test:TestBufferization", - "//mlir/test:TestControlFlow", - "//mlir/test:TestConvertToSPIRV", - "//mlir/test:TestDLTI", - "//mlir/test:TestDialect", - "//mlir/test:TestFunc", - "//mlir/test:TestFuncToLLVM", - "//mlir/test:TestGPU", - "//mlir/test:TestIR", - "//mlir/test:TestLLVM", - "//mlir/test:TestLinalg", - "//mlir/test:TestLoopLikeInterface", - "//mlir/test:TestMath", - "//mlir/test:TestMathToVCIX", - "//mlir/test:TestMemRef", - "//mlir/test:TestMesh", - "//mlir/test:TestNVGPU", - "//mlir/test:TestOneToNTypeConversion", - "//mlir/test:TestPDLL", - "//mlir/test:TestPass", - "//mlir/test:TestReducer", - "//mlir/test:TestRewrite", - "//mlir/test:TestSCF", - "//mlir/test:TestSPIRV", - "//mlir/test:TestShapeDialect", - "//mlir/test:TestTensor", - "//mlir/test:TestTestDynDialect", - "//mlir/test:TestTilingInterface", - "//mlir/test:TestTosaDialect", - "//mlir/test:TestTransformDialect", - "//mlir/test:TestTransforms", - "//mlir/test:TestVector", - "//mlir/test:TestVectorToSPIRV", - ], -) - -cc_library( - name = "MlirJitRunner", - srcs = ["lib/ExecutionEngine/JitRunner.cpp"], - hdrs = ["include/mlir/ExecutionEngine/JitRunner.h"], - includes = ["include"], - deps = [ - ":AllPassesAndDialects", - ":ExecutionEngine", - ":ExecutionEngineUtils", - ":IR", - ":LLVMDialect", - ":LLVMToLLVMIRTranslation", - ":OpenACCToLLVMIRTranslation", - ":OpenMPToLLVMIRTranslation", - ":ParseUtilities", - ":Parser", - ":SCFToControlFlow", - ":Support", - "//llvm:Core", - "//llvm:OrcJIT", - "//llvm:Support", - ], -) - -cc_library( - name = "mlir_async_runtime_api", - hdrs = ["include/mlir/ExecutionEngine/AsyncRuntime.h"], - includes = ["include"], -) - -cc_library( - name = "_mlir_async_runtime", - srcs = ["lib/ExecutionEngine/AsyncRuntime.cpp"], - copts = ["-Dmlir_async_runtime_EXPORTS"], - deps = [ - ":mlir_async_runtime_api", - "//llvm:Support", - ], -) - -# Indirection to avoid 'libmlir_async_runtime.so' filename clash. -alias( - name = "mlir_async_runtime", - actual = "_mlir_async_runtime", -) - -cc_binary( - name = "libmlir_async_runtime.so", - linkshared = True, - linkstatic = False, - deps = [":mlir_async_runtime"], -) - -cc_library( - name = "_mlir_float16_utils", - srcs = ["lib/ExecutionEngine/Float16bits.cpp"], - hdrs = ["include/mlir/ExecutionEngine/Float16bits.h"], - copts = ["-Dmlir_float16_utils_EXPORTS"], - includes = ["include"], -) - -# Indirection to avoid 'libmlir_float16_utils.so' filename clash. -alias( - name = "mlir_float16_utils", - actual = "_mlir_float16_utils", -) - -cc_binary( - name = "libmlir_float16_utils.so", - linkshared = True, - linkstatic = False, - deps = [":mlir_float16_utils"], -) - -# Unlike mlir_float16_utils, mlir_c_runner_utils, etc, we do *not* make -# this a shared library: because on the CMake side, doing so causes issues -# when building on Windows. In particular, various functions take/return -# `std::vector` but that class is not designed with dllimport/dllexport -# pragma, therefore it cannot be safely/correctly used across DLL boundaries. -# Consequently, we avoid using the "mlir_xxx_utils" naming scheme, -# since that is reserved/intended for shared libraries only. -cc_library( - name = "SparseTensorRuntime", - srcs = [ - "lib/ExecutionEngine/SparseTensor/File.cpp", - "lib/ExecutionEngine/SparseTensor/MapRef.cpp", - "lib/ExecutionEngine/SparseTensor/Storage.cpp", - ], - hdrs = [ - "include/mlir/ExecutionEngine/SparseTensor/ArithmeticUtils.h", - "include/mlir/ExecutionEngine/SparseTensor/COO.h", - "include/mlir/ExecutionEngine/SparseTensor/File.h", - "include/mlir/ExecutionEngine/SparseTensor/MapRef.h", - "include/mlir/ExecutionEngine/SparseTensor/Storage.h", - ], - includes = ["include"], - deps = [ - ":SparseTensorEnums", - ":mlir_float16_utils", - ], -) - -cc_library( - name = "_mlir_c_runner_utils", - srcs = [ - "lib/ExecutionEngine/CRunnerUtils.cpp", - "lib/ExecutionEngine/SparseTensorRuntime.cpp", - ], - hdrs = [ - "include/mlir/ExecutionEngine/CRunnerUtils.h", - "include/mlir/ExecutionEngine/Msan.h", - "include/mlir/ExecutionEngine/SparseTensorRuntime.h", - ], - includes = ["include"], - deps = [ - ":SparseTensorEnums", - ":SparseTensorRuntime", - ":mlir_float16_utils", - "//llvm:Support", - ], -) - -# Indirection to avoid 'libmlir_c_runner_utils.so' filename clash. -alias( - name = "mlir_c_runner_utils", - actual = "_mlir_c_runner_utils", -) - -cc_headers_only( - name = "mlir_c_runner_utils_hdrs", - src = ":mlir_c_runner_utils", -) - -cc_binary( - name = "libmlir_c_runner_utils.so", - linkshared = True, - linkstatic = False, - deps = [":mlir_c_runner_utils"], -) - -cc_library( - name = "_mlir_runner_utils", - srcs = ["lib/ExecutionEngine/RunnerUtils.cpp"], - hdrs = ["include/mlir/ExecutionEngine/RunnerUtils.h"], - includes = ["include"], - deps = [ - ":mlir_c_runner_utils", - ":mlir_float16_utils", - ], -) - -# Indirection to avoid 'libmlir_runner_utils.so' filename clash. -alias( - name = "mlir_runner_utils", - actual = "_mlir_runner_utils", -) - -cc_headers_only( - name = "mlir_runner_utils_hdrs", - src = ":mlir_runner_utils", -) - -cc_binary( - name = "libmlir_runner_utils.so", - linkshared = True, - linkstatic = False, - deps = [":mlir_runner_utils"], -) - -cc_binary( - name = "mlir-cpu-runner", - srcs = ["tools/mlir-cpu-runner/mlir-cpu-runner.cpp"], - deps = [ - ":AllToLLVMIRTranslations", - ":BuiltinToLLVMIRTranslation", - ":ExecutionEngineUtils", - ":IR", - ":LLVMDialect", - ":LLVMToLLVMIRTranslation", - ":MlirJitRunner", - ":OpenACCToLLVMIRTranslation", - ":OpenMPToLLVMIRTranslation", - ":ToLLVMIRTranslation", - "//llvm:AsmParser", - "//llvm:Support", - "//llvm:X86AsmParser", - ], -) - -# This target provides the headers from LLVM's Support target without any of -# the symbols. In particular, it does not contain the static registration code -# which may be executed by at most one shared library loaded by ORCJit. Direct -# dependencies need to avoid requiring symbols from LLVMSupport by adding -# copts = ["-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1"]. -# -# Bazel links the dependencies' object files instead of the archives, which -# means that symbols are linked in even if none are used. The LLVM cmake build -# on the other hand links archives (or shared libraries, depending on -# BUILD_SHARED_LIBS), skipping them if none of the symbols are used. -# See also https://reviews.llvm.org/D95613. -cc_headers_only( - name = "LLVMSupportHeaders", - src = "//llvm:Support", -) - -cc_library( - name = "_mlir_cuda_runtime", - srcs = ["lib/ExecutionEngine/CudaRuntimeWrappers.cpp"], - # Prevent needing EnableABIBreakingChecks symbol from LLVMSupport. - copts = ["-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1"], - # Here: - # MLIR_ENABLE_CUDA_CUSPARSE : enables cuSPARSE - # MLIR_ENABLE_CUDA_CUSPARSELT : enables cuSPARSElt - local_defines = ["MLIR_ENABLE_CUDA_CUSPARSE"], - tags = [ - "manual", # External dependency - "nobuildkite", # TODO(gcmn): Add support for this target - ], - deps = [ - ":LLVMSupportHeaders", - ":mlir_c_runner_utils_hdrs", - "@cuda//:cuda_headers", - "@cuda//:cusparse_static", - "@cuda//:libcuda", - ], -) - -# Indirection to avoid 'libmlir_cuda_runtime.so' filename clash. -alias( - name = "mlir_cuda_runtime", - actual = "_mlir_cuda_runtime", - tags = [ - "manual", # External dependency - "nobuildkite", # TODO(gcmn): Add support for this target - ], -) - -cc_binary( - name = "libmlir_cuda_runtime.so", - linkshared = True, - linkstatic = False, - tags = [ - "manual", # External dependency - "nobuildkite", # TODO(gcmn): Add support for this target - ], - deps = [":mlir_cuda_runtime"], -) - -cc_library( - name = "VulkanRuntime", - srcs = ["tools/mlir-vulkan-runner/VulkanRuntime.cpp"], - hdrs = ["tools/mlir-vulkan-runner/VulkanRuntime.h"], - tags = [ - "manual", # External dependency - ], - deps = [ - ":Support", - "@vulkan_headers", - "@vulkan_sdk//:sdk", - ], -) - -cc_binary( - name = "libvulkan-runtime-wrappers.so", - srcs = ["tools/mlir-vulkan-runner/vulkan-runtime-wrappers.cpp"], - linkshared = True, - linkstatic = False, - tags = [ - "manual", # External dependency - ], - deps = [":VulkanRuntime"], -) - -cc_binary( - name = "mlir-vulkan-runner", - srcs = ["tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp"], - deps = [ - ":ArithDialect", - ":BuiltinToLLVMIRTranslation", - ":ExecutionEngineUtils", - ":FuncDialect", - ":FuncToLLVM", - ":FuncToSPIRV", - ":GPUDialect", - ":GPUToSPIRV", - ":GPUToVulkanTransforms", - ":GPUTransforms", - ":LLVMCommonConversion", - ":LLVMDialect", - ":LLVMIRTransforms", - ":LLVMToLLVMIRTranslation", - ":MemRefDialect", - ":MemRefToLLVM", - ":MemRefTransforms", - ":MlirJitRunner", - ":Pass", - ":ReconcileUnrealizedCasts", - ":SCFDialect", - ":SPIRVDialect", - ":SPIRVTransforms", - ":ToLLVMIRTranslation", - ":VectorDialect", - ":VectorToLLVM", - "//llvm:Support", - ], -) - -cc_binary( - name = "mlir-spirv-cpu-runner", - srcs = ["tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp"], - deps = [ - ":ArithDialect", - ":BuiltinToLLVMIRTranslation", - ":ExecutionEngineUtils", - ":FuncDialect", - ":FuncToLLVM", - ":GPUDialect", - ":GPUToSPIRV", - ":GPUTransforms", - ":LLVMDialect", - ":LLVMToLLVMIRTranslation", - ":MemRefDialect", - ":MlirJitRunner", - ":Pass", - ":SPIRVConversion", - ":SPIRVDialect", - ":SPIRVToLLVM", - ":SPIRVTransforms", - ":ToLLVMIRTranslation", - "//llvm:Core", - "//llvm:Linker", - "//llvm:Support", - ], -) - -cc_library( - name = "TableGen", - srcs = glob(["lib/TableGen/*.cpp"]), - hdrs = glob(["include/mlir/TableGen/*.h"]), - includes = ["include"], - deps = [ - ":Support", - "//llvm:Support", - "//llvm:TableGen", - "//llvm:TargetParser", - ], -) - -cc_library( - name = "MlirTableGenMain", - srcs = glob(["lib/Tools/mlir-tblgen/*.cpp"]), - hdrs = glob(["include/mlir/Tools/mlir-tblgen/*.h"]), - includes = ["include"], - deps = [ - ":TableGen", - "//llvm:Support", - "//llvm:TableGen", - "//llvm:TargetParser", - "//llvm:config", - ], -) - -cc_binary( - name = "mlir-tblgen", - srcs = glob([ - "tools/mlir-tblgen/*.h", - "tools/mlir-tblgen/*.cpp", - ]), - deps = [ - ":MlirTableGenMain", - ":Support", - ":TableGen", - "//llvm:CodeGenTypes", - "//llvm:Support", - "//llvm:TableGen", - "//llvm:TargetParser", - "//llvm:config", - ], -) - -cc_binary( - name = "mlir-src-sharder", - srcs = ["tools/mlir-src-sharder/mlir-src-sharder.cpp"], - deps = [ - ":Support", - "//llvm:Support", - ], -) - -cc_binary( - name = "mlir-linalg-ods-yaml-gen", - srcs = [ - "tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp", - ], - deps = [ - ":AsmParser", - ":IR", - ":Support", - "//llvm:Support", - "//llvm:TableGen", - "//llvm:config", - ], -) - -## OpenMP / OpenACC common - -td_library( - name = "AtomicInterfacesTdFiles", - srcs = ["include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td"], - includes = ["include"], - deps = [ - ":ControlFlowInterfacesTdFiles", - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "AtomicInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td", - deps = [ - ":AtomicInterfacesTdFiles", - ":ControlFlowInterfacesTdFiles", - ], -) - -cc_library( - name = "AtomicInterfaces", - srcs = ["lib/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.cpp"], - hdrs = ["include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h"], - includes = ["include"], - deps = [ - ":AtomicInterfacesIncGen", - ":ControlFlowInterfaces", - ":IR", - ], -) - -## OpenACC dialect - -# TODO(gcmn): This is sticking td files in a cc_library -gentbl_cc_library( - name = "AccCommonGen", - includes = ["/llvm/include"], - tbl_outs = [ - ( - [ - "-gen-directive-decl", - "-directives-dialect=OpenACC", - ], - "include/mlir/Dialect/OpenACC/AccCommon.td", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "//llvm:include/llvm/Frontend/OpenACC/ACC.td", - deps = ["//llvm:acc_td_files"], -) - -td_library( - name = "OpenAccOpsTdFiles", - srcs = [ - "include/mlir/Dialect/OpenACC/AccCommon.td", - "include/mlir/Dialect/OpenACC/OpenACCBase.td", - "include/mlir/Dialect/OpenACC/OpenACCOps.td", - "include/mlir/Dialect/OpenACC/OpenACCOpsTypes.td", - "include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.td", - "include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td", - "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.td", - ], - includes = ["include"], - deps = [ - ":AtomicInterfacesTdFiles", - ":LoopLikeInterfaceTdFiles", - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "OpenACCMPOpsInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.td", - deps = [":OpenAccOpsTdFiles"], -) - -gentbl_cc_library( - name = "OpenACCOpsIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=acc", - ], - "include/mlir/Dialect/OpenACC/OpenACCOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=acc", - ], - "include/mlir/Dialect/OpenACC/OpenACCOpsDialect.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/OpenACC/OpenACCOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/OpenACC/OpenACCOps.cpp.inc", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/OpenACC/OpenACCOpsEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/OpenACC/OpenACCOpsEnums.cpp.inc", - ), - ( - [ - "-gen-attrdef-decls", - "-attrdefs-dialect=acc", - ], - "include/mlir/Dialect/OpenACC/OpenACCOpsAttributes.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "-attrdefs-dialect=acc", - ], - "include/mlir/Dialect/OpenACC/OpenACCOpsAttributes.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/OpenACC/OpenACCOps.md", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/OpenACC/OpenACCOps.td", - deps = [ - ":BuiltinDialectTdFiles", - ":ControlFlowInterfacesTdFiles", - ":OpenAccOpsTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "OpenACCTypesIncGen", - tbl_outs = [ - ( - [ - "--gen-typedef-decls", - "-typedefs-dialect=acc", - ], - "include/mlir/Dialect/OpenACC/OpenACCOpsTypes.h.inc", - ), - ( - [ - "--gen-typedef-defs", - "-typedefs-dialect=acc", - ], - "include/mlir/Dialect/OpenACC/OpenACCOpsTypes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/OpenACC/OpenACCOpsTypes.td", - deps = [":OpenAccOpsTdFiles"], -) - -gentbl_cc_library( - name = "OpenACCTypeInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-type-interface-decls"], - "include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.h.inc", - ), - ( - ["-gen-type-interface-defs"], - "include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.td", - deps = [":OpenAccOpsTdFiles"], -) - -cc_library( - name = "OpenACCDialect", - srcs = glob(["lib/Dialect/OpenACC/IR/*.cpp"]), - hdrs = glob( - include = ["include/mlir/Dialect/OpenACC/*.h"], - exclude = ["include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h"], - ) + [ - "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.h", - ], - includes = ["include"], - textual_hdrs = [ - "include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h", - ], - deps = [ - ":AtomicInterfaces", - ":AtomicInterfacesIncGen", - ":BytecodeOpInterface", - ":ControlFlowInterfaces", - ":IR", - ":LLVMDialect", - ":LoopLikeInterface", - ":MemRefDialect", - ":OpenACCMPOpsInterfacesIncGen", - ":OpenACCOpsIncGen", - ":OpenACCTypeInterfacesIncGen", - ":OpenACCTypesIncGen", - ":SideEffectInterfaces", - ":TransformUtils", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "OpenACCPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=OpenACC", - ], - "include/mlir/Dialect/OpenACC/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/OpenACC/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "OpenACCTransforms", - srcs = glob( - [ - "lib/Dialect/OpenACC/Transforms/*.cpp", - ], - ), - hdrs = glob(["include/mlir/Dialect/OpenACC/Transforms/*.h"]), - includes = ["include"], - deps = [ - ":FuncDialect", - ":OpenACCDialect", - ":OpenACCPassIncGen", - ":Pass", - ":TransformUtils", - ], -) - -## OpenMP dialect - -# TODO(gcmn): This is sticking td files in a cc_library -gentbl_cc_library( - name = "OmpCommonTdGen", - includes = ["/llvm/include"], - tbl_outs = [ - ( - [ - "-gen-directive-decl", - "-directives-dialect=OpenMP", - ], - "include/mlir/Dialect/OpenMP/OmpCommon.td", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "//llvm:include/llvm/Frontend/OpenMP/OMP.td", - deps = [ - ":OpBaseTdFiles", - "//llvm:omp_td_files", - ], -) - -td_library( - name = "OpenMPOpsTdFiles", - srcs = [ - "include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td", - "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.td", - "include/mlir/Dialect/OpenMP/OmpCommon.td", - "include/mlir/Dialect/OpenMP/OpenMPAttrDefs.td", - "include/mlir/Dialect/OpenMP/OpenMPClauses.td", - "include/mlir/Dialect/OpenMP/OpenMPDialect.td", - "include/mlir/Dialect/OpenMP/OpenMPEnums.td", - "include/mlir/Dialect/OpenMP/OpenMPOpBase.td", - "include/mlir/Dialect/OpenMP/OpenMPOps.td", - "include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td", - "include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.td", - ], - deps = [ - ":AtomicInterfacesTdFiles", - ":LLVMOpsTdFiles", - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "OpenMPOpsIncGen", - tbl_outs = [ - ( - [ - "-gen-typedef-decls", - "-typedefs-dialect=omp", - ], - "include/mlir/Dialect/OpenMP/OpenMPOpsTypes.h.inc", - ), - ( - [ - "-gen-typedef-defs", - "-typedefs-dialect=omp", - ], - "include/mlir/Dialect/OpenMP/OpenMPOpsTypes.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/OpenMP/OpenMPOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/OpenMP/OpenMPOps.cpp.inc", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/OpenMP/OpenMPOpsEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/OpenMP/OpenMPOpsEnums.cpp.inc", - ), - ( - [ - "-gen-dialect-decls", - "-dialect=omp", - ], - "include/mlir/Dialect/OpenMP/OpenMPOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=omp", - ], - "include/mlir/Dialect/OpenMP/OpenMPOpsDialect.cpp.inc", - ), - ( - [ - "-gen-attrdef-decls", - "-attrdefs-dialect=omp", - ], - "include/mlir/Dialect/OpenMP/OpenMPOpsAttributes.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "-attrdefs-dialect=omp", - ], - "include/mlir/Dialect/OpenMP/OpenMPOpsAttributes.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/OpenMP/OpenMPOps.md", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/OpenMP/OpenMPOps.td", - deps = [":OpenMPOpsTdFiles"], -) - -gentbl_cc_library( - name = "OpenMPTypeInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-type-interface-decls"], - "include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.h.inc", - ), - ( - ["-gen-type-interface-defs"], - "include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.td", - deps = [":OpenMPOpsTdFiles"], -) - -gentbl_cc_library( - name = "OpenMPInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td", - deps = [":OpenMPOpsTdFiles"], -) - -cc_library( - name = "OpenMPDialect", - srcs = glob(["lib/Dialect/OpenMP/IR/*.cpp"]), - hdrs = glob( - include = ["include/mlir/Dialect/OpenMP/*.h"], - exclude = ["include/mlir/Dialect/OpenMP/OpenMPInterfaces.h"], - ) + [ - "include/mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.h", - ], - includes = ["include"], - textual_hdrs = [ - "include/mlir/Dialect/OpenMP/OpenMPInterfaces.h", - ], - deps = [ - ":AtomicInterfaces", - ":AtomicInterfacesIncGen", - ":ControlFlowInterfaces", - ":FuncDialect", - ":IR", - ":LLVMDialect", - ":OpenACCMPOpsInterfacesIncGen", - ":OpenMPInterfacesIncGen", - ":OpenMPOpsIncGen", - ":OpenMPTypeInterfacesIncGen", - ":SideEffectInterfaces", - ":Support", - "//llvm:FrontendOpenMP", - "//llvm:Support", - ], -) - -cc_library( - name = "OpenACCToSCF", - srcs = glob([ - "lib/Conversion/OpenACCToSCF/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/OpenACCToSCF/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":ConversionPassIncGen", - ":IR", - ":OpenACCDialect", - ":Pass", - ":SCFDialect", - ":TransformUtils", - ], -) - -cc_library( - name = "OpenMPToLLVM", - srcs = glob([ - "lib/Conversion/OpenMPToLLVM/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/OpenMPToLLVM/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithToLLVM", - ":ControlFlowToLLVM", - ":ConversionPassIncGen", - ":FuncToLLVM", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MemRefToLLVM", - ":OpenMPDialect", - ":Pass", - ], -) - -td_library( - name = "QuantizationOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Quant/QuantOps.td", - "include/mlir/Dialect/Quant/QuantOpsBase.td", - ], - includes = ["include"], - deps = [ - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "QuantOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Quant/QuantOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Quant/QuantOps.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/Quant/QuantOpsDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/Quant/QuantOpsDialect.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/QuantOps/QuantOps.md", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Quant/QuantOps.td", - deps = [":QuantizationOpsTdFiles"], -) - -gentbl_cc_library( - name = "QuantDialectBytecodeGen", - tbl_outs = [ - ( - [ - "-gen-bytecode", - "-bytecode-dialect=Quant", - ], - "include/mlir/Dialect/Quant/QuantDialectBytecode.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Quant/QuantDialectBytecode.td", - deps = [ - ":BytecodeTdFiles", - ], -) - -cc_library( - name = "QuantOps", - srcs = [ - "lib/Dialect/Quant/IR/QuantDialectBytecode.cpp", - "lib/Dialect/Quant/IR/QuantDialectBytecode.h", - "lib/Dialect/Quant/IR/QuantOps.cpp", - "lib/Dialect/Quant/IR/QuantTypes.cpp", - "lib/Dialect/Quant/IR/TypeDetail.h", - "lib/Dialect/Quant/IR/TypeParser.cpp", - "lib/Dialect/Quant/Utils/FakeQuantSupport.cpp", - "lib/Dialect/Quant/Utils/UniformSupport.cpp", - ], - hdrs = [ - "include/mlir/Dialect/Quant/FakeQuantSupport.h", - "include/mlir/Dialect/Quant/QuantOps.h", - "include/mlir/Dialect/Quant/QuantTypes.h", - "include/mlir/Dialect/Quant/UniformSupport.h", - ], - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":IR", - ":InferTypeOpInterface", - ":QuantDialectBytecodeGen", - ":QuantOpsIncGen", - ":SideEffectInterfaces", - ":Support", - "//llvm:Support", - ], -) - -td_library( - name = "IndexOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Index/IR/IndexDialect.td", - "include/mlir/Dialect/Index/IR/IndexEnums.td", - "include/mlir/Dialect/Index/IR/IndexOps.td", - ], - includes = ["include"], - deps = [ - ":CastInterfacesTdFiles", - ":InferIntRangeInterfaceTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "IndexOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Index/IR/IndexOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Index/IR/IndexOps.cpp.inc", - ), - ( - [ - "-gen-dialect-decls", - "-dialect=index", - ], - "include/mlir/Dialect/Index/IR/IndexOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=index", - ], - "include/mlir/Dialect/Index/IR/IndexOpsDialect.cpp.inc", - ), - ( - ["-gen-attrdef-decls"], - "include/mlir/Dialect/Index/IR/IndexOpsAttrDefs.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "include/mlir/Dialect/Index/IR/IndexOpsAttrDefs.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Index/IR/IndexOps.td", - deps = [":IndexOpsTdFiles"], -) - -gentbl_cc_library( - name = "IndexEnumsIncGen", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/Index/IR/IndexEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/Index/IR/IndexEnums.cpp.inc", - ), - ( - [ - "-gen-attrdef-decls", - "-attrdefs-dialect=index", - ], - "include/mlir/Dialect/Index/IR/IndexAttrs.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "-attrdefs-dialect=index", - ], - "include/mlir/Dialect/Index/IR/IndexAttrs.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Index/IR/IndexEnums.td", - deps = [":IndexOpsTdFiles"], -) - -cc_library( - name = "IndexToLLVM", - srcs = glob([ - "lib/Conversion/IndexToLLVM/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/IndexToLLVM/*.h", - ]), - includes = ["include"], - deps = [ - ":ConversionPassIncGen", - ":ConvertToLLVMInterface", - ":IndexDialect", - ":LLVMCommonConversion", - ":LLVMDialect", - ":Pass", - ], -) - -cc_library( - name = "IndexToSPIRV", - srcs = glob([ - "lib/Conversion/IndexToSPIRV/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/IndexToSPIRV/*.h", - ]), - includes = ["include"], - deps = [ - ":ConversionPassIncGen", - ":IndexDialect", - ":Pass", - ":SPIRVCommonConversion", - ":SPIRVConversion", - ":SPIRVDialect", - ], -) - -cc_library( - name = "IndexDialect", - srcs = glob(["lib/Dialect/Index/IR/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/Index/IR/*.h"]), - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":CastInterfaces", - ":ConvertToLLVMInterface", - ":IR", - ":IndexEnumsIncGen", - ":IndexOpsIncGen", - ":InferIntRangeCommon", - ":InferIntRangeInterface", - ":InferTypeOpInterface", - ":SideEffectInterfaces", - "//llvm:Support", - ], -) - -td_library( - name = "LinalgOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Linalg/IR/LinalgBase.td", - "include/mlir/Dialect/Linalg/IR/LinalgEnums.td", - "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td", - "include/mlir/Dialect/Linalg/IR/LinalgOps.td", - ], - includes = ["include"], - deps = [ - ":ControlFlowInterfacesTdFiles", - ":DestinationStyleOpInterfaceTdFiles", - ":DialectUtilsTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":LoopLikeInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ":TilingInterfaceTdFiles", - ":ViewLikeInterfaceTdFiles", - ], -) - -td_library( - name = "LinalgTransformOpsTdFiles", - srcs = glob([ - "include/mlir/Dialect/Linalg/TransformOps/*.td", - ]), - includes = ["include"], - deps = [ - ":SCFTdFiles", - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "LinalgOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Linalg/IR/LinalgOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Linalg/IR/LinalgOps.cpp.inc", - ), - ( - [ - "-gen-dialect-decls", - "-dialect=linalg", - ], - "include/mlir/Dialect/Linalg/IR/LinalgOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=linalg", - ], - "include/mlir/Dialect/Linalg/IR/LinalgOpsDialect.cpp.inc", - ), - ( - ["-gen-attrdef-decls"], - "include/mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "include/mlir/Dialect/Linalg/IR/LinalgOpsAttrDefs.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Linalg/IR/LinalgOps.td", - deps = [":LinalgOpsTdFiles"], -) - -gentbl_cc_library( - name = "LinalgEnumsIncGen", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/Linalg/IR/LinalgOpsEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/Linalg/IR/LinalgOpsEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Linalg/IR/LinalgEnums.td", - deps = [":LinalgOpsTdFiles"], -) - -gentbl_cc_library( - name = "LinalgMatchOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.td", - deps = [ - ":LinalgTransformEnumsIncGen", - ":LinalgTransformOpsIncGen", - ":LinalgTransformOpsTdFiles", - ":SCFDeviceMappingInterfacesIncGen", - ], -) - -gentbl_cc_library( - name = "LinalgTransformEnumsIncGen", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOpsEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOpsEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformEnums.td", - deps = [ - ":LinalgTransformOpsTdFiles", - ":SCFDeviceMappingInterfacesIncGen", - ], -) - -gentbl_cc_library( - name = "LinalgTransformOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td", - deps = [ - ":LinalgTransformEnumsIncGen", - ":LinalgTransformOpsTdFiles", - ":SCFDeviceMappingInterfacesIncGen", - ], -) - -genlinalg( - name = "LinalgNamedStructuredOpsYamlIncGen", - src = "include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml", - linalg_outs = [ - ( - "-o-impl=$@", - "include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.cpp.inc", - ), - ( - "-o-ods-decl=$@", - "include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.td", - ), - ], - linalggen = ":mlir-linalg-ods-yaml-gen", -) - -td_library( - name = "LinalgStructuredOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td", - "include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.td", - "include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td", - ], - includes = ["include"], - deps = [ - ":CopyOpInterfaceTdFiles", - ":DestinationStyleOpInterface", - ":LinalgOpsTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "LinalgStructuredOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td", - deps = [":LinalgStructuredOpsTdFiles"], -) - -gentbl_cc_library( - name = "LinalgInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td", - deps = [":LinalgStructuredOpsTdFiles"], -) - -td_library( - name = "BufferizableOpInterfaceTdFiles", - srcs = [ - "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td", - ], - includes = ["include"], - deps = [ - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "BufferizableOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td", - deps = [ - ":BufferizableOpInterfaceTdFiles", - ], -) - -td_library( - name = "BufferDeallocationOpInterfaceTdFiles", - srcs = [ - "include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.td", - ], - includes = ["include"], - deps = [ - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "BufferDeallocationOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.td", - deps = [ - ":BufferDeallocationOpInterfaceTdFiles", - ], -) - -td_library( - name = "BufferViewFlowOpInterfaceTdFiles", - srcs = [ - "include/mlir/Dialect/Bufferization/IR/BufferViewFlowOpInterface.td", - ], - includes = ["include"], - deps = [ - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "BufferViewFlowOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/Bufferization/IR/BufferViewFlowOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/Bufferization/IR/BufferViewFlowOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Bufferization/IR/BufferViewFlowOpInterface.td", - deps = [ - ":BufferViewFlowOpInterfaceTdFiles", - ], -) - -td_library( - name = "SubsetOpInterfaceTdFiles", - srcs = [ - "include/mlir/Interfaces/SubsetOpInterface.td", - ], - includes = ["include"], - deps = [ - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "SubsetOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/SubsetOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/SubsetOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/SubsetOpInterface.td", - deps = [ - ":SubsetOpInterfaceTdFiles", - ], -) - -cc_library( - name = "SubsetOpInterface", - srcs = ["lib/Interfaces/SubsetOpInterface.cpp"], - hdrs = ["include/mlir/Interfaces/SubsetOpInterface.h"], - includes = ["include"], - deps = [ - ":DestinationStyleOpInterface", - ":IR", - ":SubsetOpInterfaceIncGen", - ":ValueBoundsOpInterface", - ], -) - -td_library( - name = "LinalgDocTdFiles", - srcs = ["include/mlir/Dialect/Linalg/IR/LinalgDoc.td"], - includes = ["include"], - deps = [ - ":LinalgOpsTdFiles", - ":LinalgStructuredOpsTdFiles", - ], -) - -gentbl_cc_library( - name = "LinalgDocIncGen", - tbl_outs = [ - ( - ["-gen-op-doc"], - "g3doc/Dialects/Linalg/LinalgOps.md", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Linalg/IR/LinalgDoc.td", - deps = [":LinalgDocTdFiles"], -) - -cc_library( - name = "LinalgToStandard", - srcs = glob([ - "lib/Conversion/LinalgToStandard/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/LinalgToStandard/*.h", - ]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":ConversionPassIncGen", - ":FuncDialect", - ":LLVMDialect", - ":LinalgDialect", - ":LinalgTransforms", - ":MemRefDialect", - ":Pass", - ":SCFDialect", - ":TransformUtils", - ], -) - -cc_library( - name = "LinalgDialect", - srcs = glob(["lib/Dialect/Linalg/IR/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/Linalg/IR/*.h"]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":ArithDialect", - ":ArithUtils", - ":AsmParser", - ":BufferizationInterfaces", - ":BytecodeOpInterface", - ":ComplexDialect", - ":ControlFlowInterfaces", - ":CopyOpInterface", - ":DestinationStyleOpInterface", - ":DialectUtils", - ":FunctionInterfaces", - ":IR", - ":InferTypeOpInterface", - ":InliningUtils", - ":LinalgEnumsIncGen", - ":LinalgInterfacesIncGen", - ":LinalgNamedStructuredOpsYamlIncGen", - ":LinalgOpsIncGen", - ":LinalgStructuredOpsIncGen", - ":MathDialect", - ":MemRefDialect", - ":MeshShardingInterface", - ":Parser", - ":SCFDialect", - ":SideEffectInterfaces", - ":SparseTensorDialect", - ":SubsetOpInterface", - ":Support", - ":TensorDialect", - ":TilingInterface", - ":ValueBoundsOpInterface", - ":ViewLikeInterface", - "//llvm:Support", - ], -) - -cc_library( - name = "LinalgTransformOps", - srcs = glob([ - "lib/Dialect/Linalg/TransformOps/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/Linalg/TransformOps/*.h", - ]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":Analysis", - ":ArithDialect", - ":AsmParser", - ":BufferizationDialect", - ":BufferizationTransforms", - ":DialectUtils", - ":FuncDialect", - ":FunctionInterfaces", - ":GPUDialect", - ":IR", - ":IndexDialect", - ":LinalgDialect", - ":LinalgMatchOpsIncGen", - ":LinalgTransformEnumsIncGen", - ":LinalgTransformOpsIncGen", - ":LinalgTransforms", - ":LinalgUtils", - ":SCFDialect", - ":SCFTransforms", - ":Support", - ":TensorDialect", - ":TensorUtils", - ":TilingInterface", - ":TransformDialect", - ":TransformDialectInterfaces", - ":TransformDialectUtils", - ":TransformUtils", - ":VectorDialect", - ":VectorTransforms", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "LinalgPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Linalg", - ], - "include/mlir/Dialect/Linalg/Passes.h.inc", - ), - ( - [ - "-gen-pass-capi-header", - "--prefix=Linalg", - ], - "include/mlir/Dialect/Linalg/Passes.capi.h.inc", - ), - ( - [ - "-gen-pass-capi-impl", - "--prefix=Linalg", - ], - "include/mlir/Dialect/Linalg/Passes.capi.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Linalg/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "LinalgUtils", - srcs = glob([ - "lib/Dialect/Linalg/Utils/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/Linalg/Utils/*.h", - ]), - deps = [ - ":AffineAnalysis", - ":AffineDialect", - ":AffineUtils", - ":Analysis", - ":ArithDialect", - ":ArithUtils", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":LinalgDialect", - ":MemRefDialect", - ":Pass", - ":SCFDialect", - ":TensorDialect", - ":TensorUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "LinalgTransforms", - srcs = glob([ - "lib/Dialect/Linalg/Transforms/*.cpp", - ]), - hdrs = [ - "include/mlir/Dialect/Linalg/Passes.h", - ] + glob([ - "include/mlir/Dialect/Linalg/Transforms/*.h", - ]), - includes = ["include"], - deps = [ - ":AffineAnalysis", - ":AffineDialect", - ":AffineTransforms", - ":AffineUtils", - ":Analysis", - ":ArithDialect", - ":ArithUtils", - ":BufferizationDialect", - ":BufferizationInterfaces", - ":BufferizationTransforms", - ":ComplexDialect", - ":ControlFlowDialect", - ":DestinationStyleOpInterface", - ":DialectUtils", - ":FuncDialect", - ":FuncTransforms", - ":GPUDialect", - ":IR", - ":IndexDialect", - ":LinalgDialect", - ":LinalgPassIncGen", - ":LinalgStructuredOpsIncGen", - ":LinalgUtils", - ":MaskableOpInterface", - ":MathDialect", - ":MemRefDialect", - ":MemRefTransforms", - ":MeshDialect", - ":MeshShardingInterface", - ":MeshTransforms", - ":Pass", - ":RuntimeVerifiableOpInterface", - ":SCFDialect", - ":SCFTransforms", - ":SCFUtils", - ":SparseTensorDialect", - ":SubsetOpInterface", - ":Support", - ":TensorDialect", - ":TensorTilingInterfaceImpl", - ":TensorTransforms", - ":TensorUtils", - ":TilingInterface", - ":TransformUtils", - ":ValueBoundsOpInterface", - ":VectorDialect", - ":VectorToSCF", - ":VectorTransforms", - ":VectorUtils", - ":X86VectorTransforms", - "//llvm:Support", - ], -) - -td_library( - name = "ValueBoundsOpInterfaceTdFiles", - srcs = [ - "include/mlir/Interfaces/ValueBoundsOpInterface.td", - ], - includes = ["include"], - deps = [ - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "ValueBoundsOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Interfaces/ValueBoundsOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Interfaces/ValueBoundsOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Interfaces/ValueBoundsOpInterface.td", - deps = [ - ":ValueBoundsOpInterfaceTdFiles", - ], -) - -cc_library( - name = "ValueBoundsOpInterface", - srcs = ["lib/Interfaces/ValueBoundsOpInterface.cpp"], - hdrs = ["include/mlir/Interfaces/ValueBoundsOpInterface.h"], - includes = ["include"], - deps = [ - ":Analysis", - ":DestinationStyleOpInterface", - ":IR", - ":ValueBoundsOpInterfaceIncGen", - ":ViewLikeInterface", - "//llvm:Support", - ], -) - -cc_library( - name = "ArithValueBoundsOpInterfaceImpl", - srcs = ["lib/Dialect/Arith/IR/ValueBoundsOpInterfaceImpl.cpp"], - hdrs = ["include/mlir/Dialect/Arith/IR/ValueBoundsOpInterfaceImpl.h"], - includes = ["include"], - deps = [ - ":ArithDialect", - ":ValueBoundsOpInterface", - ], -) - -cc_library( - name = "TilingInterface", - srcs = ["lib/Interfaces/TilingInterface.cpp"], - hdrs = ["include/mlir/Interfaces/TilingInterface.h"], - includes = ["include"], - deps = [ - ":DialectUtils", - ":IR", - ":Support", - ":TilingInterfaceIncGen", - ":ViewLikeInterface", - ], -) - -##---------------------------------------------------------------------------## -# Vector dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "MaskingOpInterfaceTdFiles", - srcs = ["include/mlir/Dialect/Vector/Interfaces/MaskingOpInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "MaskableOpInterfaceTdFiles", - srcs = ["include/mlir/Dialect/Vector/Interfaces/MaskableOpInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -td_library( - name = "VectorOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Vector/IR/Vector.td", - "include/mlir/Dialect/Vector/IR/VectorAttributes.td", - "include/mlir/Dialect/Vector/IR/VectorOps.td", - ], - includes = ["include"], - deps = [ - ":ControlFlowInterfacesTdFiles", - ":DestinationStyleOpInterfaceTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":MaskableOpInterfaceTdFiles", - ":MaskingOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ":VectorInterfacesTdFiles", - ":ViewLikeInterfaceTdFiles", - ], -) - -td_library( - name = "VectorTransformOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td", - ], - includes = ["include"], - deps = [ - ":PDLDialectTdFiles", - ":SCFTdFiles", - ":TransformDialectTdFiles", - ":VectorTransformsTdFiles", - ], -) - -gentbl_cc_library( - name = "MaskableOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/Vector/Interfaces/MaskableOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/Vector/Interfaces/MaskableOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Vector/Interfaces/MaskableOpInterface.td", - deps = [":MaskableOpInterfaceTdFiles"], -) - -gentbl_cc_library( - name = "MaskingOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/Vector/Interfaces/MaskingOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/Vector/Interfaces/MaskingOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Vector/Interfaces/MaskingOpInterface.td", - deps = [":MaskingOpInterfaceTdFiles"], -) - -gentbl_cc_library( - name = "VectorDialectIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=vector", - ], - "include/mlir/Dialect/Vector/IR/VectorDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=vector", - ], - "include/mlir/Dialect/Vector/IR/VectorDialect.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/Vector/Vector.md", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Vector/IR/Vector.td", - deps = [ - ":ArithOpsTdFiles", - ":VectorOpsTdFiles", - ], -) - -gentbl_cc_library( - name = "VectorOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Vector/IR/VectorOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Vector/IR/VectorOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Vector/IR/VectorOps.td", - deps = [ - ":ArithOpsTdFiles", - ":VectorOpsTdFiles", - ], -) - -gentbl_cc_library( - name = "VectorAttributesIncGen", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/Vector/IR/VectorEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/Vector/IR/VectorEnums.cpp.inc", - ), - ( - ["-gen-attrdef-decls"], - "include/mlir/Dialect/Vector/IR/VectorAttributes.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "include/mlir/Dialect/Vector/IR/VectorAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Vector/IR/VectorAttributes.td", - deps = [ - ":ArithOpsTdFiles", - ":VectorOpsTdFiles", - ], -) - -gentbl_cc_library( - name = "VectorTransformOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td", - deps = [ - ":VectorTransformOpsTdFiles", - ], -) - -cc_library( - name = "MaskableOpInterface", - srcs = ["lib/Dialect/Vector/Interfaces/MaskableOpInterface.cpp"], - hdrs = ["include/mlir/Dialect/Vector/Interfaces/MaskableOpInterface.h"], - includes = ["include"], - deps = [ - ":IR", - ":MaskableOpInterfaceIncGen", - ":MaskingOpInterface", - ], -) - -cc_library( - name = "MaskingOpInterface", - srcs = ["lib/Dialect/Vector/Interfaces/MaskingOpInterface.cpp"], - hdrs = ["include/mlir/Dialect/Vector/Interfaces/MaskingOpInterface.h"], - includes = ["include"], - deps = [ - ":IR", - ":MaskingOpInterfaceIncGen", - ], -) - -cc_library( - name = "VectorToLLVM", - srcs = glob([ - "lib/Conversion/VectorToLLVM/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/VectorToLLVM/*.h", - ]), - includes = ["include"], - deps = [ - ":AMXDialect", - ":AMXTransforms", - ":ArithAttrToLLVMConversion", - ":ArithDialect", - ":ArithUtils", - ":ArmNeonDialect", - ":ArmSVEDialect", - ":ArmSVETransforms", - ":ConversionPassIncGen", - ":FuncDialect", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":MaskableOpInterface", - ":MemRefDialect", - ":Pass", - ":ToLLVMIRTranslation", - ":TransformUtils", - ":VectorDialect", - ":VectorTransforms", - ":X86VectorDialect", - ":X86VectorTransforms", - "//llvm:Support", - ], -) - -cc_library( - name = "VectorToArmSME", - srcs = glob([ - "lib/Conversion/VectorToArmSME/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/VectorToArmSME/*.h", - ]), - includes = ["include"], - deps = [ - ":ArmSMEDialect", - ":ArmSVEDialect", - ":ConversionPassIncGen", - ":IR", - ":MemRefDialect", - ":Pass", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "VectorToGPU", - srcs = glob([ - "lib/Conversion/VectorToGPU/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/VectorToGPU/*.h", - ]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":Analysis", - ":ArithDialect", - ":ConversionPassIncGen", - ":DialectUtils", - ":GPUDialect", - ":IR", - ":MemRefDialect", - ":NVGPUDialect", - ":NVGPUUtils", - ":Pass", - ":SCFDialect", - ":Support", - ":TransformUtils", - ":Transforms", - ":VectorDialect", - ":VectorTransforms", - ":VectorUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "VectorToSCF", - srcs = glob([ - "lib/Conversion/VectorToSCF/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/VectorToSCF/*.h", - ]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":ArithDialect", - ":ConversionPassIncGen", - ":IR", - ":MemRefDialect", - ":Pass", - ":SCFDialect", - ":TensorDialect", - ":TransformUtils", - ":Transforms", - ":VectorDialect", - ":VectorTransforms", - ], -) - -td_library( - name = "TosaDialectTdFiles", - srcs = glob(["include/mlir/Dialect/Tosa/IR/*.td"]), - deps = [ - ":InferTypeOpInterfaceTdFiles", - ":LoopLikeInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ":VectorInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "TosaDialectIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Tosa/IR/TosaOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Tosa/IR/TosaOps.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/Tosa/IR/TosaOpsDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/Tosa/IR/TosaOpsDialect.cpp.inc", - ), - ( - ["-gen-attrdef-decls"], - "include/mlir/Dialect/Tosa/IR/TosaAttributes.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "include/mlir/Dialect/Tosa/IR/TosaAttributes.cpp.inc", - ), - ( - ["-gen-op-doc"], - "g3doc/Dialects/Tosa/TosaOps.md", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Tosa/IR/TosaOps.td", - deps = [":TosaDialectTdFiles"], -) - -gentbl_cc_library( - name = "TosaDialectBytecodeGen", - strip_include_prefix = "include", - tbl_outs = [ - ( - [ - "-gen-bytecode", - "-bytecode-dialect=Tosa", - ], - "include/mlir/Dialect/Tosa/IR/TosaDialectBytecode.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Tosa/IR/TosaDialectBytecode.td", - deps = [ - ":BytecodeTdFiles", - ], -) - -gentbl_cc_library( - name = "TosaInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/Tosa/IR/TosaInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/Tosa/IR/TosaInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Tosa/IR/TosaInterfaces.td", - deps = [":TosaDialectTdFiles"], -) - -gentbl_cc_library( - name = "TosaPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=TosaOpt", - ], - "include/mlir/Dialect/Tosa/Transforms/Passes.h.inc", - ), - ( - [ - "-gen-enum-decls", - "-name=TosaOpt", - ], - "include/mlir/Dialect/Tosa/Transforms/PassesEnums.h.inc", - ), - ( - [ - "-gen-enum-defs", - "-name=TosaOpt", - ], - "include/mlir/Dialect/Tosa/Transforms/PassesEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Tosa/Transforms/Passes.td", - deps = [ - ":OpBaseTdFiles", - ":PassBaseTdFiles", - ], -) - -cc_library( - name = "TosaDialect", - srcs = glob([ - "lib/Dialect/Tosa/IR/*.cpp", - "lib/Dialect/Tosa/Utils/*.cpp", - "lib/Dialect/Tosa/Transforms/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/Tosa/IR/*.h", - "include/mlir/Dialect/Tosa/Utils/*.h", - "include/mlir/Dialect/Tosa/Transforms/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":BytecodeOpInterface", - ":Dialect", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":InferTypeOpInterface", - ":InliningUtils", - ":LoopLikeInterface", - ":MeshDialect", - ":MeshShardingInterface", - ":Pass", - ":QuantOps", - ":SideEffectInterfaces", - ":Support", - ":TensorDialect", - ":TosaDialectBytecodeGen", - ":TosaDialectIncGen", - ":TosaInterfacesIncGen", - ":TosaPassIncGen", - ":TransformUtils", - ":VectorInterfaces", - "//llvm:Support", - ], -) - -cc_library( - name = "TosaToArith", - srcs = glob([ - "lib/Conversion/TosaToArith/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/TosaToArith/*.h", - ]), - includes = [ - "include", - "lib/Conversion/TosaToArith", - ], - deps = [ - ":ArithDialect", - ":ConversionPassIncGen", - ":IR", - ":Pass", - ":TosaDialect", - ":TransformUtils", - ], -) - -cc_library( - name = "TosaToLinalg", - srcs = glob([ - "lib/Conversion/TosaToLinalg/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/TosaToLinalg/*.h", - ]), - includes = [ - "include", - "lib/Conversion/TosaToLinalg", - ], - deps = [ - ":ArithDialect", - ":ArithUtils", - ":ConversionPassIncGen", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":IndexDialect", - ":InferTypeOpInterface", - ":LinalgDialect", - ":MathDialect", - ":Pass", - ":SCFDialect", - ":TensorDialect", - ":TensorUtils", - ":TosaDialect", - ":TransformUtils", - ":Transforms", - "//llvm:Support", - ], -) - -cc_library( - name = "TosaToMLProgram", - srcs = glob([ - "lib/Conversion/TosaToMLProgram/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/TosaToMLProgram/*.h", - ]), - includes = [ - "include", - "lib/Conversion/TosaToMLProgram", - ], - deps = [ - ":ConversionPassIncGen", - ":IR", - ":MLProgramDialect", - ":Pass", - ":TosaDialect", - ":TransformUtils", - ], -) - -cc_library( - name = "TosaToSCF", - srcs = glob([ - "lib/Conversion/TosaToSCF/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/TosaToSCF/*.h", - ]), - includes = [ - "include", - "lib/Conversion/TosaToSCF", - ], - deps = [ - ":ConversionPassIncGen", - ":FuncDialect", - ":IR", - ":Pass", - ":SCFDialect", - ":TensorDialect", - ":TosaDialect", - ":TransformUtils", - ], -) - -cc_library( - name = "TosaToTensor", - srcs = glob([ - "lib/Conversion/TosaToTensor/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/TosaToTensor/*.h", - ]), - includes = [ - "include", - "lib/Conversion/TosaToTensor", - ], - deps = [ - ":ArithDialect", - ":ArithUtils", - ":ConversionPassIncGen", - ":IR", - ":Pass", - ":TensorDialect", - ":TensorUtils", - ":TosaDialect", - ":TransformUtils", - ], -) - -td_library( - name = "TransformInterfacesTdFiles", - srcs = glob(["include/mlir/Dialect/Transform/Interfaces/*.td"]), - deps = [ - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -td_library( - name = "TransformDialectTdFiles", - srcs = glob(["include/mlir/Dialect/Transform/IR/*.td"]), - deps = [ - ":CastInterfacesTdFiles", - ":ControlFlowInterfacesTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ":TransformInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "TransformDialectEnumsIncGen", - tbl_outs = [ - ( - [ - "-gen-enum-decls", - ], - "include/mlir/Dialect/Transform/IR/TransformDialectEnums.h.inc", - ), - ( - [ - "-gen-enum-defs", - ], - "include/mlir/Dialect/Transform/IR/TransformDialectEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Transform/IR/TransformAttrs.td", - deps = [":TransformDialectTdFiles"], -) - -gentbl_cc_library( - name = "TransformDialectMatchInterfacesIncGen", - tbl_outs = [ - ( - [ - "-gen-op-interface-decls", - ], - "include/mlir/Dialect/Transform/Interfaces/MatchInterfaces.h.inc", - ), - ( - [ - "-gen-op-interface-defs", - ], - "include/mlir/Dialect/Transform/Interfaces/MatchInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Transform/Interfaces/MatchInterfaces.td", - deps = [ - ":TransformDialectInterfacesIncGen", - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "TransformDialectInterfacesIncGen", - tbl_outs = [ - ( - [ - "-gen-op-interface-decls", - ], - "include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h.inc", - ), - ( - [ - "-gen-op-interface-defs", - ], - "include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.cpp.inc", - ), - ( - [ - "-gen-type-interface-decls", - ], - "include/mlir/Dialect/Transform/Interfaces/TransformTypeInterfaces.h.inc", - ), - ( - [ - "-gen-type-interface-defs", - ], - "include/mlir/Dialect/Transform/Interfaces/TransformTypeInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.td", - deps = [":TransformDialectTdFiles"], -) - -gentbl_cc_library( - name = "TransformDialectIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - ], - "include/mlir/Dialect/Transform/IR/TransformDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - ], - "include/mlir/Dialect/Transform/IR/TransformDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Transform/IR/TransformDialect.td", - deps = [":TransformDialectTdFiles"], -) - -gentbl_cc_library( - name = "TransformOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Transform/IR/TransformOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Transform/IR/TransformOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Transform/IR/TransformOps.td", - deps = [ - ":CallInterfacesTdFiles", - ":FunctionInterfacesTdFiles", - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "TransformTypesIncGen", - tbl_outs = [ - ( - ["-gen-typedef-decls"], - "include/mlir/Dialect/Transform/IR/TransformTypes.h.inc", - ), - ( - ["-gen-typedef-defs"], - "include/mlir/Dialect/Transform/IR/TransformTypes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Transform/IR/TransformTypes.td", - deps = [":TransformDialectTdFiles"], -) - -cc_library( - name = "TransformDialectInterfaces", - srcs = glob(["lib/Dialect/Transform/Interfaces/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/Transform/Interfaces/*.h"]), - deps = [ - ":CastInterfaces", - ":IR", - ":Rewrite", - ":SideEffectInterfaces", - ":Support", - ":TransformDialectInterfacesIncGen", - ":TransformDialectMatchInterfacesIncGen", - ":TransformDialectUtils", - ":TransformUtils", - ":Transforms", - "//llvm:Support", - ], -) - -cc_library( - name = "TransformDialect", - srcs = glob(["lib/Dialect/Transform/IR/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/Transform/IR/*.h"]), - deps = [ - ":Analysis", - ":CallOpInterfaces", - ":CastInterfaces", - ":ControlFlowInterfaces", - ":ConvertToLLVMInterface", - ":FunctionInterfaces", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":LoopLikeInterface", - ":Pass", - ":Rewrite", - ":SideEffectInterfaces", - ":Support", - ":TransformDialectEnumsIncGen", - ":TransformDialectIncGen", - ":TransformDialectInterfaces", - ":TransformDialectUtils", - ":TransformOpsIncGen", - ":TransformTypesIncGen", - ":TransformUtils", - ":Transforms", - "//llvm:Support", - ], -) - -td_library( - name = "TransformPDLExtensionTdFiles", - srcs = glob(["include/mlir/Dialect/Transform/PDLExtension/*.td"]), - deps = [ - ":PDLDialectTdFiles", - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "TransformPDLExtensionOpsIncGen", - tbl_outs = [ - ( - [ - "-gen-op-decls", - ], - "include/mlir/Dialect/Transform/PDLExtension/PDLExtensionOps.h.inc", - ), - ( - [ - "-gen-op-defs", - ], - "include/mlir/Dialect/Transform/PDLExtension/PDLExtensionOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Transform/PDLExtension/PDLExtensionOps.td", - deps = [":TransformPDLExtensionTdFiles"], -) - -cc_library( - name = "TransformPDLExtension", - srcs = glob(["lib/Dialect/Transform/PDLExtension/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/Transform/PDLExtension/*.h"]), - deps = [ - ":IR", - ":PDLDialect", - ":PDLInterpDialect", - ":Rewrite", - ":SideEffectInterfaces", - ":Support", - ":TransformDialect", - ":TransformDialectInterfaces", - ":TransformPDLExtensionOpsIncGen", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "TransformIRDLExtensionOpsIncGen", - tbl_outs = [ - ( - [ - "-gen-op-decls", - ], - "include/mlir/Dialect/Transform/IRDLExtension/IRDLExtensionOps.h.inc", - ), - ( - [ - "-gen-op-defs", - ], - "include/mlir/Dialect/Transform/IRDLExtension/IRDLExtensionOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Transform/IRDLExtension/IRDLExtensionOps.td", - deps = [":TransformPDLExtensionTdFiles"], -) - -cc_library( - name = "TransformIRDLExtension", - srcs = glob(["lib/Dialect/Transform/IRDLExtension/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/Transform/IRDLExtension/*.h"]), - deps = [ - ":IR", - ":IRDLDialect", - ":IRDLInterfacesIncGen", - ":Rewrite", - ":SideEffectInterfaces", - ":Support", - ":TransformDialect", - ":TransformDialectInterfaces", - ":TransformIRDLExtensionOpsIncGen", - "//llvm:Support", - ], -) - -td_library( - name = "TransformDebugExtensionTdFiles", - srcs = glob(["include/mlir/Dialect/Transform/DebugExtension/*.td"]), - deps = [ - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "TransformDebugExtensionOpsIncGen", - tbl_outs = [ - ( - [ - "-gen-op-decls", - ], - "include/mlir/Dialect/Transform/DebugExtension/DebugExtensionOps.h.inc", - ), - ( - [ - "-gen-op-defs", - ], - "include/mlir/Dialect/Transform/DebugExtension/DebugExtensionOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Transform/DebugExtension/DebugExtensionOps.td", - deps = [":TransformDebugExtensionTdFiles"], -) - -cc_library( - name = "TransformDebugExtension", - srcs = glob(["lib/Dialect/Transform/DebugExtension/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/Transform/DebugExtension/*.h"]), - deps = [ - ":IR", - ":Support", - ":TransformDebugExtensionOpsIncGen", - ":TransformDialect", - ":TransformDialectInterfaces", - "//llvm:Support", - ], -) - -td_library( - name = "TransformLoopExtensionTdFiles", - srcs = glob(["include/mlir/Dialect/Transform/LoopExtension/*.td"]), - deps = [ - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "TransformLoopExtensionOpsIncGen", - tbl_outs = [ - ( - [ - "-gen-op-decls", - ], - "include/mlir/Dialect/Transform/LoopExtension/LoopExtensionOps.h.inc", - ), - ( - [ - "-gen-op-defs", - ], - "include/mlir/Dialect/Transform/LoopExtension/LoopExtensionOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Transform/LoopExtension/LoopExtensionOps.td", - deps = [":TransformLoopExtensionTdFiles"], -) - -cc_library( - name = "TransformLoopExtension", - srcs = glob(["lib/Dialect/Transform/LoopExtension/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/Transform/LoopExtension/*.h"]), - deps = [ - ":IR", - ":LoopLikeInterface", - ":Rewrite", - ":SideEffectInterfaces", - ":Support", - ":TransformDialect", - ":TransformDialectInterfaces", - ":TransformLoopExtensionOpsIncGen", - ":TransformUtils", - ":Transforms", - "//llvm:Support", - ], -) - -td_library( - name = "TransformDialectTransformsTdFiles", - srcs = glob(["include/mlir/Dialect/Transform/Transforms/*.td"]), - deps = [ - ":PassBaseTdFiles", - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "TransformDialectTransformsIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Transform", - ], - "include/mlir/Dialect/Transform/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Transform/Transforms/Passes.td", - deps = [":TransformDialectTransformsTdFiles"], -) - -cc_library( - name = "TransformDialectTransforms", - srcs = glob(["lib/Dialect/Transform/Transforms/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/Transform/Transforms/*.h"]), - deps = [ - ":Analysis", - ":FunctionInterfaces", - ":IR", - ":Parser", - ":Pass", - ":SideEffectInterfaces", - ":Support", - ":TransformDialect", - ":TransformDialectInterfaces", - ":TransformDialectTransformsIncGen", - "//llvm:Support", - ], -) - -cc_library( - name = "TransformDialectUtils", - srcs = glob(["lib/Dialect/Transform/Utils/*cpp"]), - hdrs = glob(["include/mlir/Dialect/Transform/Utils/*.h"]), - includes = ["include"], - deps = [ - ":IR", - ":Support", - ":ViewLikeInterface", - "//llvm:Support", - ], -) - -td_library( - name = "ComplexOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Complex/IR/ComplexBase.td", - "include/mlir/Dialect/Complex/IR/ComplexOps.td", - ], - includes = ["include"], - deps = [ - ":ArithOpsInterfacesTdFiles", - ":ArithOpsTdFiles", - ":BuiltinDialectTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ComplexAttributesIncGen", - tbl_outs = [ - ( - ["-gen-attrdef-decls"], - "include/mlir/Dialect/Complex/IR/ComplexAttributes.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "include/mlir/Dialect/Complex/IR/ComplexAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Complex/IR/ComplexAttributes.td", - deps = [":ComplexOpsTdFiles"], -) - -gentbl_cc_library( - name = "ComplexBaseIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=complex", - ], - "include/mlir/Dialect/Complex/IR/ComplexOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=complex", - ], - "include/mlir/Dialect/Complex/IR/ComplexOpsDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Complex/IR/ComplexBase.td", - deps = [":ComplexOpsTdFiles"], -) - -gentbl_cc_library( - name = "ComplexOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Complex/IR/ComplexOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Complex/IR/ComplexOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Complex/IR/ComplexOps.td", - deps = [":ComplexOpsTdFiles"], -) - -cc_library( - name = "ComplexDialect", - srcs = glob( - [ - "lib/Dialect/Complex/IR/*.cpp", - ], - ), - hdrs = ["include/mlir/Dialect/Complex/IR/Complex.h"], - includes = ["include"], - deps = [ - ":ArithDialect", - ":BytecodeOpInterface", - ":ComplexAttributesIncGen", - ":ComplexBaseIncGen", - ":ComplexOpsIncGen", - ":ConvertToLLVMInterface", - ":IR", - ":InferTypeOpInterface", - ":InliningUtils", - ":SideEffectInterfaces", - "//llvm:Support", - ], -) - -cc_library( - name = "ComplexToLLVM", - srcs = glob([ - "lib/Conversion/ComplexToLLVM/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/ComplexToLLVM/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithAttrToLLVMConversion", - ":ArithDialect", - ":ComplexDialect", - ":ConversionPassIncGen", - ":ConvertToLLVMInterface", - ":LLVMCommonConversion", - ":LLVMDialect", - ":Pass", - ], -) - -cc_library( - name = "ComplexToLibm", - srcs = glob([ - "lib/Conversion/ComplexToLibm/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/ComplexToLibm/*.h", - ]), - includes = ["include"], - deps = [ - ":ComplexDialect", - ":ConversionPassIncGen", - ":FuncDialect", - ":IR", - ":Pass", - ":TransformUtils", - ], -) - -cc_library( - name = "ComplexToSPIRV", - srcs = glob([ - "lib/Conversion/ComplexToSPIRV/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/ComplexToSPIRV/*.h", - ]), - includes = ["include"], - deps = [ - ":ComplexDialect", - ":ConversionPassIncGen", - ":Pass", - ":SPIRVConversion", - ":SPIRVDialect", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "ComplexToStandard", - srcs = glob([ - "lib/Conversion/ComplexToStandard/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/ComplexToStandard/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":ComplexDialect", - ":ConversionPassIncGen", - ":IR", - ":MathDialect", - ":Pass", - ":TransformUtils", - ], -) - -exports_files([ - "include/mlir/Interfaces/CallInterfaces.h", - "include/mlir/Interfaces/CastInterfaces.h", - "include/mlir/Interfaces/ControlFlowInterfaces.h", - "include/mlir/Transforms/InliningUtils.h", -]) - -td_library( - name = "ArithOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Arith/IR/ArithBase.td", - "include/mlir/Dialect/Arith/IR/ArithOps.td", - ], - includes = ["include"], - deps = [ - ":ArithOpsInterfacesTdFiles", - ":BuiltinDialectTdFiles", - ":CastInterfacesTdFiles", - ":InferIntRangeInterfaceTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ":VectorInterfacesTdFiles", - ], -) - -td_library( - name = "ArithOpsInterfacesTdFiles", - srcs = [ - "include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.td", - ], - includes = ["include"], - deps = [ - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "ArithBaseIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=arith", - ], - "include/mlir/Dialect/Arith/IR/ArithOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=arith", - ], - "include/mlir/Dialect/Arith/IR/ArithOpsDialect.cpp.inc", - ), - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/Arith/IR/ArithOpsEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/Arith/IR/ArithOpsEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Arith/IR/ArithBase.td", - deps = [":ArithOpsTdFiles"], -) - -gentbl_cc_library( - name = "ArithOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Arith/IR/ArithOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Arith/IR/ArithOps.cpp.inc", - ), - ( - [ - "-gen-attrdef-decls", - "-attrdefs-dialect=arith", - ], - "include/mlir/Dialect/Arith/IR/ArithOpsAttributes.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "-attrdefs-dialect=arith", - ], - "include/mlir/Dialect/Arith/IR/ArithOpsAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Arith/IR/ArithOps.td", - deps = [ - ":ArithOpsTdFiles", - ], -) - -gentbl_cc_library( - name = "ArithOpsInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.td", - deps = [ - ":ArithOpsInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ArithCanonicalizationIncGen", - strip_include_prefix = "include/mlir/Dialect/Arith/IR", - tbl_outs = [ - ( - ["-gen-rewriters"], - "include/mlir/Dialect/Arith/IR/ArithCanonicalization.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "lib/Dialect/Arith/IR/ArithCanonicalization.td", - deps = [ - ":ArithOpsTdFiles", - ":CastInterfacesTdFiles", - ":FuncTdFiles", - ], -) - -cc_library( - name = "ArithDialect", - srcs = [ - "include/mlir/Interfaces/ValueBoundsOpInterface.h", - "lib/Dialect/Arith/IR/ArithDialect.cpp", - "lib/Dialect/Arith/IR/ArithOps.cpp", - "lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp", - ] + glob([ - "include/mlir/Analysis/**/*.h", - ]), - hdrs = [ - "include/mlir/Dialect/Arith/IR/Arith.h", - ], - includes = ["include"], - deps = [ - ":ArithBaseIncGen", - ":ArithCanonicalizationIncGen", - ":ArithOpsIncGen", - ":ArithOpsInterfacesIncGen", - ":BufferizationInterfaces", - ":BytecodeOpInterface", - ":CallOpInterfaces", - ":CastInterfaces", - ":CommonFolders", - ":ControlFlowInterfaces", - ":ConvertToLLVMInterface", - ":DestinationStyleOpInterface", - ":IR", - ":InferIntRangeCommon", - ":InferIntRangeInterface", - ":InferTypeOpInterface", - ":InliningUtils", - ":Pass", - ":SideEffectInterfaces", - ":Support", - ":UBDialect", - ":ValueBoundsOpInterfaceIncGen", - ":VectorInterfaces", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "ArithPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Arith", - ], - "include/mlir/Dialect/Arith/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Arith/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "ArithTransforms", - srcs = glob([ - "lib/Dialect/Arith/Transforms/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/Arith/Transforms/*.h", - ]), - includes = ["include"], - deps = [ - ":Analysis", - ":ArithDialect", - ":ArithPassIncGen", - ":ArithUtils", - ":BufferizationInterfaces", - ":BufferizationTransforms", - ":DialectUtils", - ":FuncDialect", - ":FuncTransforms", - ":IR", - ":MemRefDialect", - ":Pass", - ":SideEffectInterfaces", - ":Support", - ":TensorDialect", - ":TransformUtils", - ":ValueBoundsOpInterface", - ":VectorDialect", - "//llvm:Support", - ], -) - -cc_library( - name = "ArithUtils", - srcs = glob([ - "lib/Dialect/Arith/Utils/*.cpp", - ]), - hdrs = ["include/mlir/Dialect/Arith/Utils/Utils.h"], - includes = ["include"], - deps = [ - ":ArithDialect", - ":ComplexDialect", - ":DialectUtils", - ":IR", - "//llvm:Support", - ], -) - -td_library( - name = "MathOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Math/IR/MathBase.td", - "include/mlir/Dialect/Math/IR/MathOps.td", - ], - includes = ["include"], - deps = [ - ":ArithOpsTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ":VectorInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "MathBaseIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=math", - ], - "include/mlir/Dialect/Math/IR/MathOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=math", - ], - "include/mlir/Dialect/Math/IR/MathOpsDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Math/IR/MathBase.td", - deps = [":MathOpsTdFiles"], -) - -gentbl_cc_library( - name = "MathOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Math/IR/MathOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Math/IR/MathOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Math/IR/MathOps.td", - deps = [":MathOpsTdFiles"], -) - -gentbl_cc_library( - name = "MathPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Math", - ], - "include/mlir/Dialect/Math/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Math/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "MathDialect", - srcs = glob( - [ - "lib/Dialect/Math/IR/*.cpp", - ], - ), - hdrs = [ - "include/mlir/Dialect/Math/IR/Math.h", - ], - includes = ["include"], - deps = [ - ":ArithDialect", - ":BytecodeOpInterface", - ":CommonFolders", - ":ConvertToLLVMInterface", - ":IR", - ":InferTypeOpInterface", - ":InliningUtils", - ":MathBaseIncGen", - ":MathOpsIncGen", - ":SideEffectInterfaces", - ":UBDialect", - ":VectorInterfaces", - ], -) - -cc_library( - name = "MathTransforms", - srcs = glob([ - "lib/Dialect/Math/Transforms/*.cpp", - ]), - hdrs = glob(["include/mlir/Dialect/Math/Transforms/*.h"]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":DialectUtils", - ":IR", - ":MathDialect", - ":MathPassIncGen", - ":Pass", - ":SCFDialect", - ":TransformUtils", - ":VectorDialect", - ":VectorUtils", - ":X86VectorDialect", - "//llvm:Support", - ], -) - -cc_library( - name = "MathToLibm", - srcs = glob([ - "lib/Conversion/MathToLibm/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/MathToLibm/*.h", - ]), - includes = ["include"], - deps = [ - ":ArithDialect", - ":ConversionPassIncGen", - ":DialectUtils", - ":FuncDialect", - ":IR", - ":LLVMDialect", - ":MathDialect", - ":Pass", - ":TransformUtils", - ":VectorDialect", - ], -) - -td_library( - name = "MemRefOpsTdFiles", - srcs = [ - "include/mlir/Dialect/MemRef/IR/MemRefBase.td", - "include/mlir/Dialect/MemRef/IR/MemRefOps.td", - ], - includes = ["include"], - deps = [ - ":ArithOpsTdFiles", - ":CastInterfacesTdFiles", - ":ControlFlowInterfacesTdFiles", - ":CopyOpInterfaceTdFiles", - ":MemorySlotInterfacesTdFiles", - ":OpBaseTdFiles", - ":ShapedOpInterfacesTdFiles", - ":SideEffectInterfacesTdFiles", - ":ViewLikeInterfaceTdFiles", - ], -) - -gentbl_cc_library( - name = "MemRefBaseIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=memref", - ], - "include/mlir/Dialect/MemRef/IR/MemRefOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=memref", - ], - "include/mlir/Dialect/MemRef/IR/MemRefOpsDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/MemRef/IR/MemRefBase.td", - deps = [":MemRefOpsTdFiles"], -) - -gentbl_cc_library( - name = "MemRefOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/MemRef/IR/MemRefOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/MemRef/IR/MemRefOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/MemRef/IR/MemRefOps.td", - deps = [ - ":MemRefOpsTdFiles", - ], -) - -cc_library( - name = "MemRefDialect", - srcs = glob( - [ - "lib/Dialect/MemRef/IR/*.cpp", - ], - ), - hdrs = [ - "include/mlir/Dialect/MemRef/IR/MemRef.h", - "include/mlir/Dialect/MemRef/IR/MemRefMemorySlot.h", - "include/mlir/Dialect/MemRef/IR/ValueBoundsOpInterfaceImpl.h", - ], - includes = ["include"], - deps = [ - ":AllocationOpInterface", - ":ArithDialect", - ":ArithUtils", - ":BytecodeOpInterface", - ":CallOpInterfaces", - ":CastInterfaces", - ":ControlFlowInterfaces", - ":ConvertToLLVMInterface", - ":CopyOpInterface", - ":DialectUtils", - ":IR", - ":InferTypeOpInterface", - ":InliningUtils", - ":MemRefBaseIncGen", - ":MemRefOpsIncGen", - ":MemorySlotInterfaces", - ":RuntimeVerifiableOpInterface", - ":ShapedOpInterfaces", - ":SideEffectInterfaces", - ":Support", - ":ValueBoundsOpInterface", - ":ViewLikeInterface", - "//llvm:Support", - ], -) - -cc_library( - name = "MemRefUtils", - srcs = glob( - [ - "lib/Dialect/MemRef/Utils/*.cpp", - ], - ), - hdrs = [ - "include/mlir/Dialect/MemRef/Utils/MemRefUtils.h", - ], - includes = ["include"], - deps = [ - ":AffineDialect", - ":ArithUtils", - ":MemRefDialect", - ":VectorDialect", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "MemRefPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=MemRef", - ], - "include/mlir/Dialect/MemRef/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/MemRef/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "MemRefTransforms", - srcs = glob( - [ - "lib/Dialect/MemRef/Transforms/*.cpp", - ], - ), - hdrs = glob(["include/mlir/Dialect/MemRef/Transforms/*.h"]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":AffineTransforms", - ":AffineUtils", - ":AllocationOpInterface", - ":ArithDialect", - ":ArithTransforms", - ":ArithUtils", - ":BufferizationDialect", - ":BufferizationInterfaces", - ":ControlFlowDialect", - ":DialectUtils", - ":FuncDialect", - ":GPUDialect", - ":IR", - ":InferTypeOpInterface", - ":LoopLikeInterface", - ":MemRefDialect", - ":MemRefPassIncGen", - ":MemRefUtils", - ":NVGPUDialect", - ":Pass", - ":RuntimeVerifiableOpInterface", - ":SCFDialect", - ":Support", - ":TensorDialect", - ":TransformUtils", - ":ValueBoundsOpInterface", - ":VectorDialect", - "//llvm:Support", - ], -) - -td_library( - name = "MemRefTransformOpsTdFiles", - srcs = [ - "include/mlir/Dialect/MemRef/TransformOps/MemRefTransformOps.td", - ], - includes = ["include"], - deps = [ - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "MemRefTransformOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/MemRef/TransformOps/MemRefTransformOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/MemRef/TransformOps/MemRefTransformOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/MemRef/TransformOps/MemRefTransformOps.td", - deps = [ - ":MemRefTransformOpsTdFiles", - ], -) - -cc_library( - name = "MemRefTransformOps", - srcs = glob(["lib/Dialect/MemRef/TransformOps/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/MemRef/TransformOps/*.h"]), - includes = ["include"], - deps = [ - ":AffineDialect", - ":Analysis", - ":ArithDialect", - ":BytecodeOpInterface", - ":IR", - ":LLVMCommonConversion", - ":LoopLikeInterface", - ":MemRefDialect", - ":MemRefTransformOpsIncGen", - ":MemRefTransforms", - ":MemRefUtils", - ":NVGPUDialect", - ":SCFDialect", - ":TransformDialect", - ":TransformDialectInterfaces", - ":TransformUtils", - ":VectorDialect", - ":VectorTransforms", - "//llvm:Support", - ], -) - -##---------------------------------------------------------------------------## -# MLProgram dialect -##---------------------------------------------------------------------------## - -td_library( - name = "MLProgramOpsTdFiles", - srcs = [ - "include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.td", - "include/mlir/Dialect/MLProgram/IR/MLProgramBase.td", - "include/mlir/Dialect/MLProgram/IR/MLProgramOps.td", - "include/mlir/Dialect/MLProgram/IR/MLProgramTypes.td", - ], - includes = ["include"], - deps = [ - ":BuiltinDialectTdFiles", - ":CallInterfacesTdFiles", - ":ControlFlowInterfacesTdFiles", - ":FunctionInterfacesTdFiles", - ":OpBaseTdFiles", - ":RegionKindInterfaceIncGen", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "MLProgramOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/MLProgram/IR/MLProgramOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/MLProgram/IR/MLProgramOps.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/MLProgram/IR/MLProgramOps.td", - deps = [":MLProgramOpsTdFiles"], -) - -gentbl_cc_library( - name = "MLProgramAttributesIncGen", - tbl_outs = [ - ( - ["-gen-attrdef-decls"], - "include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.td", - deps = [":MLProgramOpsTdFiles"], -) - -gentbl_cc_library( - name = "MLProgramPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=MLProgram", - ], - "include/mlir/Dialect/MLProgram/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/MLProgram/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -gentbl_cc_library( - name = "MLProgramTypesIncGen", - tbl_outs = [ - ( - ["-gen-typedef-decls"], - "include/mlir/Dialect/MLProgram/IR/MLProgramTypes.h.inc", - ), - ( - ["-gen-typedef-defs"], - "include/mlir/Dialect/MLProgram/IR/MLProgramTypes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/MLProgram/IR/MLProgramTypes.td", - deps = [":MLProgramOpsTdFiles"], -) - -cc_library( - name = "MLProgramDialect", - srcs = glob(["lib/Dialect/MLProgram/IR/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/MLProgram/IR/*.h"]), - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":CallOpInterfaces", - ":ControlFlowInterfaces", - ":FunctionInterfaces", - ":IR", - ":InliningUtils", - ":MLProgramAttributesIncGen", - ":MLProgramOpsIncGen", - ":MLProgramTypesIncGen", - ":SideEffectInterfaces", - "//llvm:Support", - ], -) - -cc_library( - name = "MLProgramTransforms", - srcs = glob([ - "lib/Dialect/MLProgram/Transforms/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Dialect/MLProgram/Transforms/*.h", - ]), - includes = ["include"], - deps = [ - ":BufferizationInterfaces", - ":FuncDialect", - ":IR", - ":MLProgramDialect", - ":MLProgramPassIncGen", - ":MemRefDialect", - ":Pass", - ":TransformUtils", - ], -) - -##---------------------------------------------------------------------------## -# MPI dialect -##---------------------------------------------------------------------------## - -td_library( - name = "MPITdFiles", - srcs = [ - "include/mlir/Dialect/MPI/IR/MPI.td", - "include/mlir/Dialect/MPI/IR/MPIOps.td", - "include/mlir/Dialect/MPI/IR/MPITypes.td", - ], - includes = ["include"], - deps = [ - ":AttrTdFiles", - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "MPIIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/MPI/IR/MPI.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/MPI/IR/MPI.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/mlir/Dialect/MPI/IR/MPIDialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/mlir/Dialect/MPI/IR/MPIDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/MPI/IR/MPI.td", - deps = [":MPITdFiles"], -) - -gentbl_cc_library( - name = "MPIOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/MPI/IR/MPIOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/MPI/IR/MPIOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/MPI/IR/MPIOps.td", - deps = [":MPITdFiles"], -) - -gentbl_cc_library( - name = "MPITypesIncGen", - tbl_outs = [ - ( - ["-gen-typedef-decls"], - "include/mlir/Dialect/MPI/IR/MPITypesGen.h.inc", - ), - ( - ["-gen-typedef-defs"], - "include/mlir/Dialect/MPI/IR/MPITypesGen.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/MPI/IR/MPITypes.td", - deps = [":MPITdFiles"], -) - -gentbl_cc_library( - name = "MPIAttrsIncGen", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/MPI/IR/MPIEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/MPI/IR/MPIEnums.cpp.inc", - ), - ( - ["-gen-attrdef-decls"], - "include/mlir/Dialect/MPI/IR/MPIAttrDefs.h.inc", - ), - ( - ["-gen-attrdef-defs"], - "include/mlir/Dialect/MPI/IR/MPIAttrDefs.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/MPI/IR/MPI.td", - deps = [":MPITdFiles"], -) - -cc_library( - name = "MPIDialect", - srcs = glob(["lib/Dialect/MPI/IR/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/MPI/IR/*.h"]), - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":IR", - ":MPIAttrsIncGen", - ":MPIIncGen", - ":MPIOpsIncGen", - ":MPITypesIncGen", - "//llvm:Support", - ], -) - -##---------------------------------------------------------------------------## -# Allocation interfaces -##---------------------------------------------------------------------------## - -td_library( - name = "AllocationOpInterfaceTdFiles", - srcs = ["include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td"], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -gentbl_cc_library( - name = "AllocationOpInterfaceIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.td", - deps = [":AllocationOpInterfaceTdFiles"], -) - -cc_library( - name = "AllocationOpInterface", - srcs = ["lib/Dialect/Bufferization/IR/AllocationOpInterface.cpp"], - hdrs = ["include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h"], - includes = ["include"], - deps = [ - ":AllocationOpInterfaceIncGen", - ":IR", - ], -) - -td_library( - name = "BufferizationOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Bufferization/IR/BufferizationBase.td", - "include/mlir/Dialect/Bufferization/IR/BufferizationEnums.td", - "include/mlir/Dialect/Bufferization/IR/BufferizationOps.td", - ], - includes = ["include"], - deps = [ - ":AllocationOpInterfaceTdFiles", - ":BufferViewFlowOpInterfaceTdFiles", - ":BufferizableOpInterfaceTdFiles", - ":CopyOpInterfaceTdFiles", - ":DestinationStyleOpInterfaceTdFiles", - ":InferTypeOpInterfaceTdFiles", - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ":SubsetOpInterfaceTdFiles", - ], -) - -gentbl_cc_library( - name = "BufferizationBaseIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=bufferization", - ], - "include/mlir/Dialect/Bufferization/IR/BufferizationOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=bufferization", - ], - "include/mlir/Dialect/Bufferization/IR/BufferizationOpsDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Bufferization/IR/BufferizationBase.td", - deps = [":BufferizationOpsTdFiles"], -) - -td_library( - name = "BufferizationEnumsTdFiles", - srcs = [ - "include/mlir/Dialect/Bufferization/IR/BufferizationEnums.td", - ], - includes = ["include"], - deps = [ - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "BufferizationEnumsIncGen", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "include/mlir/Dialect/Bufferization/IR/BufferizationEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "include/mlir/Dialect/Bufferization/IR/BufferizationEnums.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Bufferization/IR/BufferizationEnums.td", - deps = [":BufferizationEnumsTdFiles"], -) - -td_library( - name = "BufferizationTransformOpsTdFiles", - srcs = [ - "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.td", - ], - includes = ["include"], - deps = [ - ":BufferizationOpsTdFiles", - ":TransformDialectTdFiles", - ], -) - -gentbl_cc_library( - name = "BufferizationTransformOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.td", - deps = [ - ":BufferizationTransformOpsTdFiles", - ], -) - -cc_library( - name = "BufferizationTransformOps", - srcs = [ - "lib/Dialect/Bufferization/TransformOps/BufferizationTransformOps.cpp", - ], - hdrs = [ - "include/mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.h", - ], - includes = ["include"], - deps = [ - ":BufferizationDialect", - ":BufferizationEnumsIncGen", - ":BufferizationInterfaces", - ":BufferizationTransformOpsIncGen", - ":BufferizationTransforms", - ":BytecodeOpInterface", - ":FunctionInterfaces", - ":IR", - ":LinalgDialect", - ":MemRefDialect", - ":TensorDialect", - ":TransformDialect", - ":TransformDialectInterfaces", - ], -) - -gentbl_cc_library( - name = "BufferizationOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/Bufferization/IR/BufferizationOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Bufferization/IR/BufferizationOps.td", - deps = [ - ":BufferizationOpsTdFiles", - ], -) - -cc_library( - name = "BufferizationInterfaces", - srcs = [ - "include/mlir/Analysis/Liveness.h", - ], - hdrs = [ - "include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h", - "include/mlir/Dialect/Bufferization/IR/BufferViewFlowOpInterface.h", - "include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h", - ], - includes = ["include"], - deps = [ - ":BufferDeallocationOpInterfaceIncGen", - ":BufferViewFlowOpInterfaceIncGen", - ":BufferizableOpInterfaceIncGen", - ":BufferizationEnumsIncGen", - ":IR", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "BufferizationDialect", - srcs = [ - "lib/Dialect/Bufferization/IR/BufferDeallocationOpInterface.cpp", - "lib/Dialect/Bufferization/IR/BufferViewFlowOpInterface.cpp", - "lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp", - "lib/Dialect/Bufferization/IR/BufferizationDialect.cpp", - "lib/Dialect/Bufferization/IR/BufferizationOps.cpp", - "lib/Dialect/Bufferization/IR/UnstructuredControlFlow.cpp", - ], - hdrs = [ - "include/mlir/Dialect/Bufferization/IR/Bufferization.h", - "include/mlir/Dialect/Bufferization/IR/DstBufferizableOpInterfaceImpl.h", - "include/mlir/Dialect/Bufferization/IR/UnstructuredControlFlow.h", - ], - includes = ["include"], - deps = [ - ":AffineDialect", - ":AllocationOpInterface", - ":ArithDialect", - ":BufferDeallocationOpInterfaceIncGen", - ":BufferViewFlowOpInterfaceIncGen", - ":BufferizableOpInterfaceIncGen", - ":BufferizationBaseIncGen", - ":BufferizationInterfaces", - ":BufferizationOpsIncGen", - ":BytecodeOpInterface", - ":ControlFlowInterfaces", - ":CopyOpInterface", - ":DestinationStyleOpInterface", - ":FuncDialect", - ":FunctionInterfaces", - ":IR", - ":InferTypeOpInterface", - ":InliningUtils", - ":MemRefDialect", - ":SparseTensorDialect", - ":SubsetOpInterface", - ":TensorDialect", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "BufferizationPassIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Bufferization", - ], - "include/mlir/Dialect/Bufferization/Transforms/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/Bufferization/Transforms/Passes.td", - deps = [":PassBaseTdFiles"], -) - -cc_library( - name = "BufferizationTransforms", - srcs = glob( - [ - "lib/Dialect/Bufferization/Transforms/*.cpp", - ], - ), - hdrs = glob(["include/mlir/Dialect/Bufferization/Transforms/*.h"]), - includes = ["include"], - deps = [ - ":AllocationOpInterface", - ":Analysis", - ":ArithDialect", - ":BufferizationDialect", - ":BufferizationInterfaces", - ":BufferizationPassIncGen", - ":CallOpInterfaces", - ":ControlFlowDialect", - ":ControlFlowInterfaces", - ":FuncDialect", - ":FunctionInterfaces", - ":IR", - ":LoopLikeInterface", - ":MemRefDialect", - ":MemRefUtils", - ":Pass", - ":SCFDialect", - ":SideEffectInterfaces", - ":SubsetOpInterface", - ":Support", - ":TensorDialect", - ":TransformUtils", - ":Transforms", - ":ViewLikeInterface", - "//llvm:Support", - ], -) - -cc_library( - name = "BufferizationToMemRef", - srcs = [ - "lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp", - ], - hdrs = [ - "include/mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h", - ], - includes = ["include"], - deps = [ - ":ArithDialect", - ":BufferizationDialect", - ":BufferizationTransforms", - ":ConversionPassIncGen", - ":FuncDialect", - ":IR", - ":MemRefDialect", - ":Pass", - ":SCFDialect", - ":Support", - ":TransformUtils", - ], -) - -cc_library( - name = "BufferizationPipelines", - srcs = glob(["lib/Dialect/Bufferization/Pipelines/*.cpp"]), - hdrs = ["include/mlir/Dialect/Bufferization/Pipelines/Passes.h"], - includes = ["include"], - deps = [ - ":BufferizationInterfaces", - ":BufferizationTransforms", - ":FuncDialect", - ":MemRefTransforms", - ":Pass", - ":Transforms", - ], -) - -td_library( - name = "DLTIDialectTdFiles", - srcs = [ - "include/mlir/Dialect/DLTI/DLTI.td", - "include/mlir/Dialect/DLTI/DLTIBase.td", - ], - includes = ["include"], - deps = [":OpBaseTdFiles"], -) - -gentbl_cc_library( - name = "DLTIBaseIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=dlti", - ], - "include/mlir/Dialect/DLTI/DLTIDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=dlti", - ], - "include/mlir/Dialect/DLTI/DLTIDialect.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/DLTI/DLTIBase.td", - deps = [":OpBaseTdFiles"], -) - -gentbl_cc_library( - name = "DLTIAttrsIncGen", - tbl_outs = [ - ( - [ - "-gen-attrdef-decls", - "-dialect=dlti", - ], - "include/mlir/Dialect/DLTI/DLTIAttrs.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "-dialect=dlti", - ], - "include/mlir/Dialect/DLTI/DLTIAttrs.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/DLTI/DLTIAttrs.td", - deps = [ - ":AttrTdFiles", - ":DLTIDialectTdFiles", - ], -) - -cc_library( - name = "DLTIDialect", - srcs = glob(["lib/Dialect/DLTI/*.cpp"]), - hdrs = glob(["include/mlir/Dialect/DLTI/*.h"]), - includes = ["include"], - deps = [ - ":DLTIAttrsIncGen", - ":DLTIBaseIncGen", - ":DataLayoutInterfaces", - ":IR", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "ReducerIncGen", - tbl_outs = [ - ( - [ - "-gen-pass-decls", - "-name=Reducer", - ], - "include/mlir/Reducer/Passes.h.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Reducer/Passes.td", - deps = [ - ":PassBaseTdFiles", - ":ReducerTdFiles", - ], -) - -cc_library( - name = "Reducer", - srcs = glob(["lib/Reducer/*.cpp"]), - hdrs = glob(["include/mlir/Reducer/*.h"]), - includes = ["include"], - deps = [ - ":IR", - ":Pass", - ":ReducerIncGen", - ":Rewrite", - ":Support", - ":TransformUtils", - "//llvm:Support", - ], -) - -cc_library( - name = "MlirReduceLib", - srcs = ["lib/Tools/mlir-reduce/MlirReduceMain.cpp"], - hdrs = ["include/mlir/Tools/mlir-reduce/MlirReduceMain.h"], - includes = ["include"], - deps = [ - ":IR", - ":ParseUtilities", - ":Parser", - ":Pass", - ":Reducer", - ":Rewrite", - ":Support", - "//llvm:Support", - ], -) - -cc_binary( - name = "mlir-reduce", - srcs = ["tools/mlir-reduce/mlir-reduce.cpp"], - includes = ["include"], - local_defines = ["MLIR_INCLUDE_TESTS"], - stamp = 0, - deps = [ - ":AllPassesAndDialects", - ":IR", - ":MlirReduceLib", - "//llvm:Support", - "//mlir/test:TestDialect", - ], -) - -cc_library( - name = "PDLLODS", - srcs = glob( - [ - "lib/Tools/PDLL/ODS/*.cpp", - ], - ), - hdrs = glob(["include/mlir/Tools/PDLL/ODS/*.h"]), - includes = ["include"], - deps = [ - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "PDLLAST", - srcs = glob( - [ - "lib/Tools/PDLL/AST/*.cpp", - "lib/Tools/PDLL/AST/*.h", - ], - ), - hdrs = glob(["include/mlir/Tools/PDLL/AST/*.h"]), - includes = ["include"], - deps = [ - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "PDLLCodeGen", - srcs = glob( - [ - "lib/Tools/PDLL/CodeGen/*.cpp", - ], - ), - hdrs = glob(["include/mlir/Tools/PDLL/CodeGen/*.h"]), - includes = ["include"], - deps = [ - ":AsmParser", - ":IR", - ":PDLDialect", - ":PDLLAST", - ":PDLLODS", - ":Support", - "//llvm:Support", - ], -) - -cc_library( - name = "PDLLParser", - srcs = glob( - [ - "lib/Tools/PDLL/Parser/*.cpp", - "lib/Tools/PDLL/Parser/*.h", - ], - ), - hdrs = glob(["include/mlir/Tools/PDLL/Parser/*.h"]), - includes = ["include"], - deps = [ - ":PDLLAST", - ":PDLLODS", - ":Support", - ":TableGen", - "//llvm:Support", - "//llvm:TableGen", - "//llvm:TargetParser", - ], -) - -cc_binary( - name = "mlir-pdll", - srcs = [ - "tools/mlir-pdll/mlir-pdll.cpp", - ], - deps = [ - ":IR", - ":PDLLAST", - ":PDLLCodeGen", - ":PDLLODS", - ":PDLLParser", - ":Support", - "//llvm:Support", - "//llvm:config", - ], -) - -cc_binary( - name = "mlir-pdll-lsp-server", - srcs = ["tools/mlir-pdll-lsp-server/mlir-pdll-lsp-server.cpp"], - includes = ["include"], - deps = [ - ":MlirPdllLspServerLib", - ":Support", - ], -) - -td_library( - name = "DialectConversionPdllFiles", - srcs = ["include/mlir/Transforms/DialectConversion.pdll"], - includes = ["include"], -) - -td_library( - name = "UBDialectTdFiles", - srcs = [ - "include/mlir/Dialect/UB/IR/UBOps.td", - "include/mlir/Dialect/UB/IR/UBOpsInterfaces.td", - ], - includes = ["include"], - deps = [ - ":OpBaseTdFiles", - ":SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "UBOpsInterfacesIncGen", - tbl_outs = [ - ( - ["--gen-attr-interface-decls"], - "include/mlir/Dialect/UB/IR/UBOpsInterfaces.h.inc", - ), - ( - ["--gen-attr-interface-defs"], - "include/mlir/Dialect/UB/IR/UBOpsInterfaces.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/UB/IR/UBOpsInterfaces.td", - deps = [":UBDialectTdFiles"], -) - -gentbl_cc_library( - name = "UBOpsIncGen", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=ub", - ], - "include/mlir/Dialect/UB/IR/UBOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=ub", - ], - "include/mlir/Dialect/UB/IR/UBOpsDialect.cpp.inc", - ), - ( - ["-gen-op-decls"], - "include/mlir/Dialect/UB/IR/UBOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/UB/IR/UBOps.cpp.inc", - ), - ( - ["--gen-attrdef-decls"], - "include/mlir/Dialect/UB/IR/UBOpsAttributes.h.inc", - ), - ( - ["--gen-attrdef-defs"], - "include/mlir/Dialect/UB/IR/UBOpsAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/UB/IR/UBOps.td", - deps = [":UBDialectTdFiles"], -) - -cc_library( - name = "UBDialect", - srcs = [ - "lib/Dialect/UB/IR/UBOps.cpp", - ], - hdrs = ["include/mlir/Dialect/UB/IR/UBOps.h"], - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":ConvertToLLVMInterface", - ":IR", - ":InliningUtils", - ":SideEffectInterfaces", - ":UBOpsIncGen", - ":UBOpsInterfacesIncGen", - "//llvm:Support", - ], -) - -cc_library( - name = "UBToLLVM", - srcs = glob([ - "lib/Conversion/UBToLLVM/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/UBToLLVM/*.h", - ]), - includes = ["include"], - deps = [ - ":ConversionPassIncGen", - ":ConvertToLLVMInterface", - ":IR", - ":LLVMCommonConversion", - ":LLVMDialect", - ":Pass", - ":UBDialect", - ], -) - -cc_library( - name = "UBToSPIRV", - srcs = glob([ - "lib/Conversion/UBToSPIRV/*.cpp", - ]), - hdrs = glob([ - "include/mlir/Conversion/UBToSPIRV/*.h", - ]), - includes = ["include"], - deps = [ - ":ConversionPassIncGen", - ":Pass", - ":SPIRVConversion", - ":SPIRVDialect", - ":UBDialect", - ], -) - -cc_library( - name = "VCIXDialect", - srcs = ["lib/Dialect/LLVMIR/IR/VCIXDialect.cpp"], - hdrs = ["include/mlir/Dialect/LLVMIR/VCIXDialect.h"], - includes = ["include"], - deps = [ - ":BytecodeOpInterface", - ":GPUDialect", - ":IR", - ":LLVMDialect", - ":SideEffectInterfaces", - ":VCIXOpsIncGen", - "//llvm:AsmParser", - "//llvm:Core", - "//llvm:Support", - ], -) - -td_library( - name = "VCIXTdFiles", - srcs = ["include/mlir/Dialect/LLVMIR/VCIXOps.td"], - includes = ["include"], - deps = [ - ":LLVMOpsTdFiles", - ":OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "VCIXOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/mlir/Dialect/LLVMIR/VCIXOps.h.inc", - ), - ( - ["-gen-op-defs"], - "include/mlir/Dialect/LLVMIR/VCIXOps.cpp.inc", - ), - ( - [ - "-gen-dialect-decls", - "-dialect=vcix", - ], - "include/mlir/Dialect/LLVMIR/VCIXOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=vcix", - ], - "include/mlir/Dialect/LLVMIR/VCIXOpsDialect.cpp.inc", - ), - ( - [ - "-gen-attrdef-decls", - "-attrdefs-dialect=vcix", - ], - "include/mlir/Dialect/LLVMIR/VCIXOpsAttributes.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "-attrdefs-dialect=vcix", - ], - "include/mlir/Dialect/LLVMIR/VCIXOpsAttributes.cpp.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/VCIXOps.td", - deps = [":VCIXTdFiles"], -) - -cc_library( - name = "VCIXToLLVMIRTranslation", - srcs = glob(["lib/Target/LLVMIR/Dialect/VCIX/*.cpp"]), - hdrs = glob(["include/mlir/Target/LLVMIR/Dialect/VCIX/*.h"]), - includes = ["include"], - deps = [ - ":IR", - ":ToLLVMIRTranslation", - ":VCIXConversionIncGen", - ":VCIXDialect", - "//llvm:Core", - "//llvm:Support", - ], -) - -gentbl_cc_library( - name = "VCIXConversionIncGen", - tbl_outs = [ - ( - ["-gen-llvmir-conversions"], - "include/mlir/Dialect/LLVMIR/VCIXConversions.inc", - ), - ], - tblgen = ":mlir-tblgen", - td_file = "include/mlir/Dialect/LLVMIR/VCIXOps.td", - deps = [":VCIXTdFiles"], -) diff --git a/utils/bazel/llvm-project-overlay/mlir/build_defs.bzl b/utils/bazel/llvm-project-overlay/mlir/build_defs.bzl deleted file mode 100644 index 53767fd03c44a..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/build_defs.bzl +++ /dev/null @@ -1,72 +0,0 @@ -# This file is licensed 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 - -"""Rules and macros for MLIR""" - -def if_cuda_available(if_true, if_false = []): - return select({ - # CUDA auto-detection is not yet supported. - "//mlir:enable_cuda_config": if_true, - "//conditions:default": if_false, - }) - -def _cc_headers_only_impl(ctx): - return CcInfo(compilation_context = ctx.attr.src[CcInfo].compilation_context) - -cc_headers_only = rule( - implementation = _cc_headers_only_impl, - attrs = { - "src": attr.label( - mandatory = True, - providers = [CcInfo], - ), - }, - doc = "Provides the headers from 'src' without linking anything.", - provides = [CcInfo], -) - -def mlir_c_api_cc_library( - name, - srcs = [], - hdrs = [], - deps = [], - header_deps = [], - capi_deps = [], - **kwargs): - """Macro that generates three targets for MLIR C API libraries. - - * A standard cc_library target ("Name"), - * A header-only cc_library target ("NameHeaders") - * An implementation cc_library target tagged `alwayslink` suitable for - inclusion in a shared library built with cc_binary() ("NameObjects"). - - In order to avoid duplicate symbols, it is important that - mlir_c_api_cc_library targets only depend on other mlir_c_api_cc_library - targets via the "capi_deps" parameter. This makes it so that "FooObjects" - depend on "BarObjects" targets and "Foo" targets depend on "Bar" targets. - Don't cross the streams. - """ - capi_header_deps = ["%sHeaders" % d for d in capi_deps] - capi_object_deps = ["%sObjects" % d for d in capi_deps] - native.cc_library( - name = name, - srcs = srcs, - hdrs = hdrs, - deps = deps + capi_deps + header_deps, - **kwargs - ) - native.cc_library( - name = name + "Headers", - hdrs = hdrs, - deps = header_deps + capi_header_deps, - **kwargs - ) - native.cc_library( - name = name + "Objects", - srcs = srcs, - hdrs = hdrs, - deps = deps + capi_object_deps + capi_header_deps + header_deps, - alwayslink = True, - **kwargs - ) diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch1/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch1/BUILD.bazel deleted file mode 100644 index 2d4e1b5d6986e..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch1/BUILD.bazel +++ /dev/null @@ -1,18 +0,0 @@ -# Description: -# MLIR Tutorial -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -cc_binary( - name = "toyc-ch1", - srcs = [ - "parser/AST.cpp", - "toyc.cpp", - ] + glob(["include/toy/*"]), - includes = ["include/"], - deps = [ - "//llvm:Support", - "//mlir:Support", - ], -) diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch2/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch2/BUILD.bazel deleted file mode 100644 index 321b8d7cb232e..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch2/BUILD.bazel +++ /dev/null @@ -1,68 +0,0 @@ -# Description: -# MLIR Tutorial - -load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -td_library( - name = "ToyOpsTdFiles", - srcs = [ - "include/toy/Ops.td", - ], - includes = ["include"], - deps = [ - "//mlir:FunctionInterfacesTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ToyOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/toy/Ops.h.inc", - ), - ( - ["-gen-op-defs"], - "include/toy/Ops.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/toy/Dialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/toy/Dialect.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "include/toy/Ops.td", - deps = [":ToyOpsTdFiles"], -) - -cc_binary( - name = "toyc-ch2", - srcs = [ - "mlir/Dialect.cpp", - "mlir/MLIRGen.cpp", - "parser/AST.cpp", - "toyc.cpp", - ] + glob(["include/toy/*.h"]), - includes = ["include/"], - deps = [ - ":ToyOpsIncGen", - "//llvm:Support", - "//mlir:Analysis", - "//mlir:BytecodeReader", - "//mlir:FunctionInterfaces", - "//mlir:IR", - "//mlir:Parser", - "//mlir:SideEffectInterfaces", - "//mlir:Support", - ], -) diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch3/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch3/BUILD.bazel deleted file mode 100644 index b776bedab46f9..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch3/BUILD.bazel +++ /dev/null @@ -1,86 +0,0 @@ -# Description: -# MLIR Tutorial - -load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -td_library( - name = "ToyOpsTdFiles", - srcs = [ - "include/toy/Ops.td", - ], - includes = ["include"], - deps = [ - "//mlir:FunctionInterfacesTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ToyOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/toy/Ops.h.inc", - ), - ( - ["-gen-op-defs"], - "include/toy/Ops.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/toy/Dialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/toy/Dialect.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "include/toy/Ops.td", - deps = [":ToyOpsTdFiles"], -) - -gentbl_cc_library( - name = "ToyCombineIncGen", - strip_include_prefix = "mlir", - tbl_outs = [ - ( - ["-gen-rewriters"], - "mlir/ToyCombine.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/ToyCombine.td", - deps = [":ToyOpsTdFiles"], -) - -cc_binary( - name = "toyc-ch3", - srcs = [ - "mlir/Dialect.cpp", - "mlir/MLIRGen.cpp", - "mlir/ToyCombine.cpp", - "parser/AST.cpp", - "toyc.cpp", - ] + glob(["include/toy/*.h"]), - includes = ["include/"], - deps = [ - ":ToyCombineIncGen", - ":ToyOpsIncGen", - "//llvm:Support", - "//mlir:Analysis", - "//mlir:BytecodeReader", - "//mlir:FunctionInterfaces", - "//mlir:IR", - "//mlir:Parser", - "//mlir:Pass", - "//mlir:SideEffectInterfaces", - "//mlir:Support", - "//mlir:Transforms", - ], -) diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch4/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch4/BUILD.bazel deleted file mode 100644 index 68639df2aa2ca..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch4/BUILD.bazel +++ /dev/null @@ -1,112 +0,0 @@ -# Description: -# MLIR Tutorial - -load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -td_library( - name = "ToyOpsTdFiles", - srcs = [ - "include/toy/Ops.td", - "include/toy/ShapeInferenceInterface.td", - ], - includes = ["include"], - deps = [ - "//mlir:CallInterfacesTdFiles", - "//mlir:CastInterfacesTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ToyInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/toy/ShapeInferenceOpInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/toy/ShapeInferenceOpInterfaces.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "include/toy/ShapeInferenceInterface.td", - deps = [":ToyOpsTdFiles"], -) - -gentbl_cc_library( - name = "ToyOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/toy/Ops.h.inc", - ), - ( - ["-gen-op-defs"], - "include/toy/Ops.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/toy/Dialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/toy/Dialect.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "include/toy/Ops.td", - deps = [":ToyOpsTdFiles"], -) - -gentbl_cc_library( - name = "ToyCombineIncGen", - strip_include_prefix = "mlir", - tbl_outs = [ - ( - ["-gen-rewriters"], - "mlir/ToyCombine.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/ToyCombine.td", - deps = [":ToyOpsTdFiles"], -) - -cc_binary( - name = "toyc-ch4", - srcs = [ - "mlir/Dialect.cpp", - "mlir/MLIRGen.cpp", - "mlir/ShapeInferencePass.cpp", - "mlir/ToyCombine.cpp", - "parser/AST.cpp", - "toyc.cpp", - ] + glob(["include/toy/*.h"]), - includes = ["include/"], - deps = [ - ":ToyCombineIncGen", - ":ToyInterfacesIncGen", - ":ToyOpsIncGen", - "//llvm:Support", - "//mlir:Analysis", - "//mlir:BytecodeReader", - "//mlir:CallOpInterfaces", - "//mlir:CastInterfaces", - "//mlir:FunctionInterfaces", - "//mlir:IR", - "//mlir:InliningUtils", - "//mlir:Parser", - "//mlir:Pass", - "//mlir:SideEffectInterfaces", - "//mlir:Support", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch5/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch5/BUILD.bazel deleted file mode 100644 index 9ce23b5d97547..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch5/BUILD.bazel +++ /dev/null @@ -1,120 +0,0 @@ -# Description: -# MLIR Tutorial - -load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -td_library( - name = "ToyOpsTdFiles", - srcs = [ - "include/toy/Ops.td", - "include/toy/ShapeInferenceInterface.td", - ], - includes = ["include"], - deps = [ - "//mlir:CallInterfacesTdFiles", - "//mlir:CastInterfacesTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ToyInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/toy/ShapeInferenceOpInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/toy/ShapeInferenceOpInterfaces.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "include/toy/ShapeInferenceInterface.td", - deps = [":ToyOpsTdFiles"], -) - -gentbl_cc_library( - name = "ToyOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/toy/Ops.h.inc", - ), - ( - ["-gen-op-defs"], - "include/toy/Ops.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/toy/Dialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/toy/Dialect.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "include/toy/Ops.td", - deps = [":ToyOpsTdFiles"], -) - -gentbl_cc_library( - name = "ToyCombineIncGen", - strip_include_prefix = "mlir", - tbl_outs = [ - ( - ["-gen-rewriters"], - "mlir/ToyCombine.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/ToyCombine.td", - deps = [":ToyOpsTdFiles"], -) - -cc_binary( - name = "toyc-ch5", - srcs = [ - "mlir/Dialect.cpp", - "mlir/LowerToAffineLoops.cpp", - "mlir/MLIRGen.cpp", - "mlir/ShapeInferencePass.cpp", - "mlir/ToyCombine.cpp", - "parser/AST.cpp", - "toyc.cpp", - ] + glob(["include/toy/*.h"]), - includes = ["include/"], - deps = [ - ":ToyCombineIncGen", - ":ToyInterfacesIncGen", - ":ToyOpsIncGen", - "//llvm:Support", - "//mlir:AffineDialect", - "//mlir:AffineTransforms", - "//mlir:AllPassesAndDialects", - "//mlir:Analysis", - "//mlir:ArithDialect", - "//mlir:BytecodeReader", - "//mlir:CallOpInterfaces", - "//mlir:CastInterfaces", - "//mlir:FuncDialect", - "//mlir:FuncExtensions", - "//mlir:FunctionInterfaces", - "//mlir:IR", - "//mlir:InliningUtils", - "//mlir:MemRefDialect", - "//mlir:Parser", - "//mlir:Pass", - "//mlir:SideEffectInterfaces", - "//mlir:Support", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch6/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch6/BUILD.bazel deleted file mode 100644 index 86925aa0662c7..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch6/BUILD.bazel +++ /dev/null @@ -1,138 +0,0 @@ -# Description: -# MLIR Tutorial - -load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -td_library( - name = "ToyOpsTdFiles", - srcs = [ - "include/toy/Ops.td", - "include/toy/ShapeInferenceInterface.td", - ], - includes = ["include"], - deps = [ - "//mlir:CallInterfacesTdFiles", - "//mlir:CastInterfacesTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ToyInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/toy/ShapeInferenceOpInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/toy/ShapeInferenceOpInterfaces.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "include/toy/ShapeInferenceInterface.td", - deps = [":ToyOpsTdFiles"], -) - -gentbl_cc_library( - name = "ToyOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/toy/Ops.h.inc", - ), - ( - ["-gen-op-defs"], - "include/toy/Ops.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/toy/Dialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/toy/Dialect.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "include/toy/Ops.td", - deps = [":ToyOpsTdFiles"], -) - -gentbl_cc_library( - name = "ToyCombineIncGen", - strip_include_prefix = "mlir", - tbl_outs = [ - ( - ["-gen-rewriters"], - "mlir/ToyCombine.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/ToyCombine.td", - deps = [":ToyOpsTdFiles"], -) - -cc_binary( - name = "toyc-ch6", - srcs = [ - "mlir/Dialect.cpp", - "mlir/LowerToAffineLoops.cpp", - "mlir/LowerToLLVM.cpp", - "mlir/MLIRGen.cpp", - "mlir/ShapeInferencePass.cpp", - "mlir/ToyCombine.cpp", - "parser/AST.cpp", - "toyc.cpp", - ] + glob(["include/toy/*.h"]), - includes = ["include/"], - deps = [ - ":ToyCombineIncGen", - ":ToyInterfacesIncGen", - ":ToyOpsIncGen", - "//llvm:Core", - "//llvm:OrcJIT", - "//llvm:Support", - "//mlir:AffineDialect", - "//mlir:AffineToStandard", - "//mlir:AffineTransforms", - "//mlir:AllPassesAndDialects", - "//mlir:Analysis", - "//mlir:ArithDialect", - "//mlir:ArithToLLVM", - "//mlir:BuiltinToLLVMIRTranslation", - "//mlir:BytecodeReader", - "//mlir:CallOpInterfaces", - "//mlir:CastInterfaces", - "//mlir:ControlFlowToLLVM", - "//mlir:ExecutionEngine", - "//mlir:ExecutionEngineUtils", - "//mlir:FuncDialect", - "//mlir:FuncExtensions", - "//mlir:FuncToLLVM", - "//mlir:FunctionInterfaces", - "//mlir:IR", - "//mlir:InliningUtils", - "//mlir:LLVMCommonConversion", - "//mlir:LLVMDialect", - "//mlir:LLVMIRTransforms", - "//mlir:LLVMToLLVMIRTranslation", - "//mlir:MemRefDialect", - "//mlir:MemRefToLLVM", - "//mlir:Parser", - "//mlir:Pass", - "//mlir:SCFDialect", - "//mlir:SCFToControlFlow", - "//mlir:SideEffectInterfaces", - "//mlir:Support", - "//mlir:ToLLVMIRTranslation", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch7/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch7/BUILD.bazel deleted file mode 100644 index bf9ab79529b8d..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch7/BUILD.bazel +++ /dev/null @@ -1,138 +0,0 @@ -# Description: -# MLIR Tutorial - -load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -td_library( - name = "ToyOpsTdFiles", - srcs = [ - "include/toy/Ops.td", - "include/toy/ShapeInferenceInterface.td", - ], - includes = ["include"], - deps = [ - "//mlir:CallInterfacesTdFiles", - "//mlir:CastInterfacesTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "ToyInterfacesIncGen", - tbl_outs = [ - ( - ["-gen-op-interface-decls"], - "include/toy/ShapeInferenceOpInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "include/toy/ShapeInferenceOpInterfaces.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "include/toy/ShapeInferenceInterface.td", - deps = [":ToyOpsTdFiles"], -) - -gentbl_cc_library( - name = "ToyOpsIncGen", - tbl_outs = [ - ( - ["-gen-op-decls"], - "include/toy/Ops.h.inc", - ), - ( - ["-gen-op-defs"], - "include/toy/Ops.cpp.inc", - ), - ( - ["-gen-dialect-decls"], - "include/toy/Dialect.h.inc", - ), - ( - ["-gen-dialect-defs"], - "include/toy/Dialect.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "include/toy/Ops.td", - deps = [":ToyOpsTdFiles"], -) - -gentbl_cc_library( - name = "ToyCombineIncGen", - strip_include_prefix = "mlir", - tbl_outs = [ - ( - ["-gen-rewriters"], - "mlir/ToyCombine.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/ToyCombine.td", - deps = [":ToyOpsTdFiles"], -) - -cc_binary( - name = "toyc-ch7", - srcs = [ - "mlir/Dialect.cpp", - "mlir/LowerToAffineLoops.cpp", - "mlir/LowerToLLVM.cpp", - "mlir/MLIRGen.cpp", - "mlir/ShapeInferencePass.cpp", - "mlir/ToyCombine.cpp", - "parser/AST.cpp", - "toyc.cpp", - ] + glob(["include/toy/*.h"]), - includes = ["include/"], - deps = [ - ":ToyCombineIncGen", - ":ToyInterfacesIncGen", - ":ToyOpsIncGen", - "//llvm:Core", - "//llvm:OrcJIT", - "//llvm:Support", - "//mlir:AffineDialect", - "//mlir:AffineToStandard", - "//mlir:AffineTransforms", - "//mlir:AllPassesAndDialects", - "//mlir:Analysis", - "//mlir:ArithDialect", - "//mlir:ArithToLLVM", - "//mlir:BuiltinToLLVMIRTranslation", - "//mlir:BytecodeReader", - "//mlir:CallOpInterfaces", - "//mlir:CastInterfaces", - "//mlir:ControlFlowToLLVM", - "//mlir:ExecutionEngine", - "//mlir:ExecutionEngineUtils", - "//mlir:FuncDialect", - "//mlir:FuncExtensions", - "//mlir:FuncToLLVM", - "//mlir:FunctionInterfaces", - "//mlir:IR", - "//mlir:InliningUtils", - "//mlir:LLVMCommonConversion", - "//mlir:LLVMDialect", - "//mlir:LLVMIRTransforms", - "//mlir:LLVMToLLVMIRTranslation", - "//mlir:MemRefDialect", - "//mlir:MemRefToLLVM", - "//mlir:Parser", - "//mlir:Pass", - "//mlir:SCFDialect", - "//mlir:SCFToControlFlow", - "//mlir:SideEffectInterfaces", - "//mlir:Support", - "//mlir:ToLLVMIRTranslation", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) diff --git a/utils/bazel/llvm-project-overlay/mlir/linalggen.bzl b/utils/bazel/llvm-project-overlay/mlir/linalggen.bzl deleted file mode 100644 index d893471e6249f..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/linalggen.bzl +++ /dev/null @@ -1,42 +0,0 @@ -# This file is licensed 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 - -"""BUILD extensions for MLIR linalg generation.""" - -def genlinalg(name, linalggen, src, linalg_outs): - """genlinalg() generates code from a tc spec file. - - Args: - name: The name of the build rule for use in dependencies. - linalggen: The binary used to produce the output. - src: The tc spec file. - linalg_outs: A list of tuples (opts, out), where each opts is a string of - options passed to linalggen, and the out is the corresponding output file - produced. - """ - - for (opts, out) in linalg_outs: - # All arguments to generate the output except output destination. - base_args = [ - "$(location %s)" % linalggen, - "%s" % opts, - "$(location %s)" % src, - ] - rule_suffix = "_".join(opts.replace("-", "_").replace("=", "_").split(" ")) - - # Rule to generate code using generated shell script. - native.genrule( - name = "%s_%s_genrule" % (name, rule_suffix), - srcs = [src], - outs = [out], - tools = [linalggen], - cmd = (" ".join(base_args)), - ) - - hdrs = [f for (opts, f) in linalg_outs] - native.cc_library( - name = name, - hdrs = hdrs, - textual_hdrs = hdrs, - ) diff --git a/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel deleted file mode 100644 index 254cab0db4a5d..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel +++ /dev/null @@ -1,1627 +0,0 @@ -# This file is licensed 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 - -# Description: -# Python bindings for MLIR. -# -# We define separate filegroups for files in different directories so -# that downstream users can mirror the tree in their own py_library() rules. - -load("//mlir:tblgen.bzl", "gentbl_filegroup", "td_library") - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -##---------------------------------------------------------------------------## -# Core IR modules. -##---------------------------------------------------------------------------## - -filegroup( - name = "DialectCorePyFiles", - srcs = [ - "mlir/dialects/_ods_common.py", - ], -) - -filegroup( - name = "ExecutionEnginePyFiles", - srcs = [ - "mlir/execution_engine.py", - ], -) - -filegroup( - name = "ExecutionEnginePyIFiles", - srcs = [ - "mlir/_mlir_libs/_mlirExecutionEngine.pyi", - ], -) - -filegroup( - name = "IRPyFiles", - srcs = [ - "mlir/ir.py", - ], -) - -filegroup( - name = "ExtrasPyFiles", - srcs = glob([ - "mlir/extras/*.py", - ]), -) - -filegroup( - name = "IRPyIFiles", - srcs = [ - "mlir/_mlir_libs/_mlir/__init__.pyi", - "mlir/_mlir_libs/_mlir/ir.pyi", - ], -) - -filegroup( - name = "MlirLibsPyFiles", - srcs = [ - "mlir/_mlir_libs/__init__.py", - ], -) - -filegroup( - name = "PassManagerPyFiles", - srcs = [ - "mlir/passmanager.py", - ], -) - -filegroup( - name = "PassManagerPyIFiles", - srcs = [ - "mlir/_mlir_libs/_mlir/passmanager.pyi", - ], -) - -filegroup( - name = "RewritePyFiles", - srcs = [ - "mlir/rewrite.py", - ], -) - -filegroup( - name = "RuntimePyFiles", - srcs = glob([ - "mlir/runtime/*.py", - ]), -) - -##---------------------------------------------------------------------------## -# Affine dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "AffineOpsPyTdFiles", - srcs = [ - "mlir/dialects/AffineOps.td", - ], - deps = [ - "//mlir:AffineOpsTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -gentbl_filegroup( - name = "AffineOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=affine", - ], - "mlir/dialects/_affine_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/AffineOps.td", - deps = [ - ":AffineOpsPyTdFiles", - ], -) - -filegroup( - name = "AffineOpsPyFiles", - srcs = [ - "mlir/dialects/affine.py", - ":AffineOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# Builtin dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "BuiltinOpsPyTdFiles", - srcs = [ - "mlir/dialects/BuiltinOps.td", - ], - deps = [ - "//mlir:BuiltinDialectTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -gentbl_filegroup( - name = "BuiltinOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=builtin", - ], - "mlir/dialects/_builtin_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/BuiltinOps.td", - deps = [ - ":BuiltinOpsPyTdFiles", - ], -) - -filegroup( - name = "BuiltinOpsPyFiles", - srcs = [ - "mlir/dialects/builtin.py", - ":BuiltinOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# AMDGPU dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "AMDGPUOpsPyTdFiles", - srcs = [], - includes = ["../include"], - deps = [ - "//mlir:AMDGPUTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -gentbl_filegroup( - name = "AMDGPUOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=amdgpu", - ], - "mlir/dialects/_amdgpu_enum_gen.py", - ), - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=amdgpu", - ], - "mlir/dialects/_amdgpu_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/AMDGPUOps.td", - deps = [ - ":AMDGPUOpsPyTdFiles", - ], -) - -filegroup( - name = "AMDGPUOpsPyFiles", - srcs = [ - "mlir/dialects/amdgpu.py", - ":AMDGPUOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# Linalg dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "LinalgOpsPyTdFiles", - srcs = [ - "mlir/dialects/LinalgOps.td", - ], - deps = [ - "//mlir:LinalgOpsTdFiles", - "//mlir:LinalgStructuredOpsTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -gentbl_filegroup( - name = "LinalgOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=linalg", - ], - "mlir/dialects/_linalg_enum_gen.py", - ), - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=linalg", - ], - "mlir/dialects/_linalg_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/LinalgOps.td", - deps = [ - ":LinalgOpsPyTdFiles", - ], -) - -filegroup( - name = "LinalgOpsPyFiles", - srcs = [ - ":LinalgOpsPyGen", - ], -) - -filegroup( - name = "LinalgOpsPackagePyFiles", - srcs = glob(["mlir/dialects/linalg/*.py"]), -) - -filegroup( - name = "LinalgOpsPackageOpDSLPyFiles", - srcs = glob(["mlir/dialects/linalg/opdsl/*.py"]), -) - -filegroup( - name = "LinalgOpsPackageOpDSLLangPyFiles", - srcs = glob(["mlir/dialects/linalg/opdsl/lang/*.py"]), -) - -filegroup( - name = "LinalgOpsPackageOpDSLOpsPyFiles", - srcs = glob(["mlir/dialects/linalg/opdsl/ops/*.py"]), -) - -filegroup( - name = "LinalgOpsPackagePassesPyFiles", - srcs = glob(["mlir/dialects/linalg/passes/*.py"]), -) - -##---------------------------------------------------------------------------## -# LLVM dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "LLVMOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=llvm", - ], - "mlir/dialects/_llvm_enum_gen.py", - ), - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=llvm", - ], - "mlir/dialects/_llvm_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/LLVMOps.td", - deps = [ - "//mlir:LLVMOpsTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -filegroup( - name = "LLVMOpsPyFiles", - srcs = [ - "mlir/dialects/llvm.py", - ":LLVMOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# Async dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "AsyncOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=async", - ], - "mlir/dialects/_async_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/AsyncOps.td", - deps = [ - "//mlir:AsyncOpsTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -filegroup( - name = "AsyncOpsPyFiles", - srcs = [ - ":AsyncOpsPyGen", - ], -) - -filegroup( - name = "AsyncOpsPackagePyFiles", - srcs = glob(["mlir/dialects/async_dialect/*.py"]), -) - -filegroup( - name = "AsyncOpsPackagePassesPyFiles", - srcs = glob(["mlir/dialects/async_dialect/passes/*.py"]), -) - -##---------------------------------------------------------------------------## -# Arith dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "ArithOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=arith", - ], - "mlir/dialects/_arith_enum_gen.py", - ), - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=arith", - ], - "mlir/dialects/_arith_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/ArithOps.td", - deps = [ - "//mlir:ArithOpsTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -filegroup( - name = "ArithOpsPyFiles", - srcs = [ - "mlir/dialects/arith.py", - ":ArithOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# Bufferization dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "BufferizationOpsPyTdFiles", - srcs = [], - includes = ["../include"], - deps = [ - "//mlir:BufferizableOpInterfaceTdFiles", - "//mlir:BufferizationEnumsTdFiles", - "//mlir:BufferizationOpsTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -gentbl_filegroup( - name = "BufferizationEnumPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=bufferization", - ], - "mlir/dialects/_bufferization_enum_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/BufferizationEnums.td", - deps = [ - ":BufferizationOpsPyTdFiles", - ], -) - -gentbl_filegroup( - name = "BufferizationOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=bufferization", - ], - "mlir/dialects/_bufferization_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/BufferizationOps.td", - deps = [ - ":BufferizationOpsPyTdFiles", - ], -) - -filegroup( - name = "BufferizationOpsPyFiles", - srcs = [ - "mlir/dialects/bufferization.py", - ":BufferizationEnumPyGen", - ":BufferizationOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# Complex dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "ComplexOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=complex", - ], - "mlir/dialects/_complex_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/ComplexOps.td", - deps = [ - "//mlir:ComplexOpsTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -filegroup( - name = "ComplexOpsPyFiles", - srcs = [ - "mlir/dialects/complex.py", - ":ComplexOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# ControlFlow dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "ControlFlowOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=cf", - ], - "mlir/dialects/_cf_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/ControlFlowOps.td", - deps = [ - "//mlir:ControlFlowOpsTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -filegroup( - name = "ControlFlowOpsPyFiles", - srcs = [ - "mlir/dialects/cf.py", - ":ControlFlowOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# Index dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "IndexOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=index", - ], - "mlir/dialects/_index_enum_gen.py", - ), - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=index", - ], - "mlir/dialects/_index_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/IndexOps.td", - deps = [ - "//mlir:IndexOpsTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -filegroup( - name = "IndexOpsPyFiles", - srcs = [ - "mlir/dialects/index.py", - ":IndexOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# Math dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "MathOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=math", - ], - "mlir/dialects/_math_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/MathOps.td", - deps = [ - "//mlir:MathOpsTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -filegroup( - name = "MathOpsPyFiles", - srcs = [ - "mlir/dialects/math.py", - ":MathOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# MemRef dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "MemRefOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=memref", - ], - "mlir/dialects/_memref_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/MemRefOps.td", - deps = [ - "//mlir:MemRefOpsTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -filegroup( - name = "MemRefOpsPyFiles", - srcs = [ - "mlir/dialects/memref.py", - ":MemRefOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# MLProgram dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "MLProgramOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=ml_program", - ], - "mlir/dialects/_ml_program_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/MLProgramOps.td", - deps = [ - "//mlir:MLProgramOpsTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -filegroup( - name = "MLProgramOpsPyFiles", - srcs = [ - "mlir/dialects/ml_program.py", - ":MLProgramOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# OpenMP dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "OpenMPOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=omp", - ], - "mlir/dialects/_omp_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/OpenMPOps.td", - deps = [ - "//mlir:OpBaseTdFiles", - "//mlir:OpenMPOpsTdFiles", - ], -) - -filegroup( - name = "OpenMPOpsPyFiles", - srcs = [ - "mlir/dialects/openmp.py", - ":OpenMPOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# PDL dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "PDLPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=pdl", - ], - "mlir/dialects/_pdl_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/PDLOps.td", - deps = [ - "//mlir:OpBaseTdFiles", - "//mlir:PDLDialectTdFiles", - ], -) - -filegroup( - name = "PDLPyIFiles", - srcs = [ - "mlir/_mlir_libs/_mlir/dialects/pdl.pyi", - ], -) - -filegroup( - name = "PDLPyFiles", - srcs = [ - "mlir/dialects/pdl.py", - ":PDLPyGen", - ], -) - -##---------------------------------------------------------------------------## -# PythonTest dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "PythonTestPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=python_test", - ], - "mlir/dialects/_python_test_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "//mlir/test/python:python_test_ops.td", - deps = [ - "//mlir:InferTypeOpInterfaceTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -filegroup( - name = "PythonTestPyFiles", - srcs = [ - "mlir/dialects/python_test.py", - ":PythonTestPyGen", - ], -) - -##---------------------------------------------------------------------------## -# Quant dialect. -##---------------------------------------------------------------------------## - -filegroup( - name = "QuantPyIFiles", - srcs = [ - "mlir/_mlir_libs/_mlir/dialects/quant.pyi", - ], -) - -filegroup( - name = "QuantPyFiles", - srcs = [ - "mlir/dialects/quant.py", - ], -) - -##---------------------------------------------------------------------------## -# GPU dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "GPUOpsPyTdFiles", - srcs = [], - includes = ["../include"], - deps = [ - "//mlir:GPUOpsTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -gentbl_filegroup( - name = "GPUOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=gpu", - ], - "mlir/dialects/_gpu_enum_gen.py", - ), - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=gpu", - ], - "mlir/dialects/_gpu_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/GPUOps.td", - deps = [ - ":GPUOpsPyTdFiles", - ], -) - -filegroup( - name = "GPUOpsPyFiles", - srcs = [ - ":GPUOpsPyGen", - ], -) - -filegroup( - name = "GPUOpsPackagePyFiles", - srcs = glob(["mlir/dialects/gpu/*.py"]), -) - -filegroup( - name = "GPUOpsPackagePassesPyFiles", - srcs = glob(["mlir/dialects/gpu/passes/*.py"]), -) - -##---------------------------------------------------------------------------## -# NVGPU dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "NVGPUOpsPyTdFiles", - srcs = [], - includes = ["../include"], - deps = [ - "//mlir:NVGPUTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -gentbl_filegroup( - name = "NVGPUOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=nvgpu", - ], - "mlir/dialects/_nvgpu_enum_gen.py", - ), - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=nvgpu", - ], - "mlir/dialects/_nvgpu_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/NVGPUOps.td", - deps = [ - ":NVGPUOpsPyTdFiles", - ], -) - -filegroup( - name = "NVGPUOpsPyFiles", - srcs = [ - "mlir/dialects/nvgpu.py", - ":NVGPUOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# NVVM dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "NVVMOpsPyTdFiles", - srcs = [], - includes = ["../include"], - deps = [ - "//mlir:NVVMOpsTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -gentbl_filegroup( - name = "NVVMOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=nvvm", - ], - "mlir/dialects/_nvvm_enum_gen.py", - ), - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=nvvm", - ], - "mlir/dialects/_nvvm_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/NVVMOps.td", - deps = [ - ":NVVMOpsPyTdFiles", - ], -) - -filegroup( - name = "NVVMOpsPyFiles", - srcs = [ - "mlir/dialects/nvvm.py", - ":NVVMOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# ROCDL dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "ROCDLOpsPyTdFiles", - srcs = [], - includes = ["../include"], - deps = [ - "//mlir:OpBaseTdFiles", - "//mlir:ROCDLOpsTdFiles", - ], -) - -gentbl_filegroup( - name = "ROCDLOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=rocdl", - ], - "mlir/dialects/_rocdl_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/ROCDLOps.td", - deps = [ - ":ROCDLOpsPyTdFiles", - ], -) - -filegroup( - name = "ROCDLOpsPyFiles", - srcs = [ - "mlir/dialects/rocdl.py", - ":ROCDLOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# SCF dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "SCFPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=scf", - ], - "mlir/dialects/_scf_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/SCFOps.td", - deps = [ - "//mlir:OpBaseTdFiles", - "//mlir:SCFTdFiles", - ], -) - -filegroup( - name = "SCFPyFiles", - srcs = [ - "mlir/dialects/scf.py", - ":SCFPyGen", - ], -) - -##---------------------------------------------------------------------------## -# Shape dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "ShapeOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=shape", - ], - "mlir/dialects/_shape_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/ShapeOps.td", - deps = [ - "//mlir:OpBaseTdFiles", - "//mlir:ShapeOpsTdFiles", - ], -) - -filegroup( - name = "ShapeOpsPyFiles", - srcs = [ - "mlir/dialects/shape.py", - ":ShapeOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# Func dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "FuncPyTdFiles", - srcs = [ - ], - deps = [ - "//mlir:FuncTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -gentbl_filegroup( - name = "FuncPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=func", - ], - "mlir/dialects/_func_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/FuncOps.td", - deps = [ - "//mlir:FuncTdFiles", - "//mlir:OpBaseTdFiles", - ], -) - -filegroup( - name = "FuncPyFiles", - srcs = [ - "mlir/dialects/func.py", - ":FuncPyGen", - ], -) - -##---------------------------------------------------------------------------## -# SparseTensor dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "SparseTensorOpsPyTdFiles", - srcs = [ - ], - deps = [ - "//mlir:OpBaseTdFiles", - "//mlir:SparseTensorTdFiles", - ], -) - -gentbl_filegroup( - name = "SparseTensorEnumPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=sparse_tensor", - ], - "mlir/dialects/_sparse_tensor_enum_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/SparseTensorAttrDefs.td", - deps = [ - ":SparseTensorOpsPyTdFiles", - ], -) - -gentbl_filegroup( - name = "SparseTensorOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=sparse_tensor", - ], - "mlir/dialects/_sparse_tensor_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/SparseTensorOps.td", - deps = [ - ":SparseTensorOpsPyTdFiles", - ], -) - -filegroup( - name = "SparseTensorOpsPyFiles", - srcs = [ - "mlir/dialects/sparse_tensor.py", - ":SparseTensorEnumPyGen", - ":SparseTensorOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# SPIRV dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "SPIRVOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=spirv", - ], - "mlir/dialects/_spirv_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/SPIRVOps.td", - deps = [ - "//mlir:OpBaseTdFiles", - "//mlir:SPIRVOpsTdFiles", - ], -) - -filegroup( - name = "SPIRVOpsPyFiles", - srcs = [ - "mlir/dialects/spirv.py", - ":SPIRVOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# Tensor dialect. -##---------------------------------------------------------------------------## - -td_library( - name = "TensorOpsPyTdFiles", - srcs = [ - ], - deps = [ - "//mlir:OpBaseTdFiles", - "//mlir:TensorOpsTdFiles", - ], -) - -gentbl_filegroup( - name = "TensorOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=tensor", - ], - "mlir/dialects/_tensor_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/TensorOps.td", - deps = [ - ":TensorOpsPyTdFiles", - ], -) - -filegroup( - name = "TensorOpsPyFiles", - srcs = [ - "mlir/dialects/tensor.py", - ":TensorOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# Tosa dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "TosaOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=tosa", - ], - "mlir/dialects/_tosa_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/TosaOps.td", - deps = [ - "//mlir:OpBaseTdFiles", - "//mlir:TosaDialectTdFiles", - ], -) - -filegroup( - name = "TosaOpsPyFiles", - srcs = [ - "mlir/dialects/tosa.py", - ":TosaOpsPyGen", - ], -) - -##---------------------------------------------------------------------------## -# Transform dialect and extensions. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "TransformEnumPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=transform", - ], - "mlir/dialects/_transform_enum_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/TransformAttrs.td", - deps = [ - "//mlir:CallInterfacesTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:TransformDialectTdFiles", - ], -) - -gentbl_filegroup( - name = "TransformOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=transform", - ], - "mlir/dialects/_transform_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/TransformOps.td", - deps = [ - "//mlir:CallInterfacesTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:TransformDialectTdFiles", - ], -) - -gentbl_filegroup( - name = "BufferizationTransformOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=transform", - "-dialect-extension=bufferization_transform", - ], - "mlir/dialects/_bufferization_transform_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/BufferizationTransformOps.td", - deps = [ - "//mlir:BufferizationTransformOpsTdFiles", - ], -) - -gentbl_filegroup( - name = "GPUTransformOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=transform", - "-dialect-extension=gpu_transform", - ], - "mlir/dialects/_gpu_transform_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/GPUTransformOps.td", - deps = [ - "//mlir:CallInterfacesTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:GPUTransformOpsTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:TransformDialectTdFiles", - ], -) - -gentbl_filegroup( - name = "StructureTransformEnumPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=transform", - ], - "mlir/dialects/_structured_transform_enum_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/LinalgStructuredTransformEnums.td", - deps = [ - "//mlir:CallInterfacesTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:LinalgTransformOpsTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:TransformDialectTdFiles", - ], -) - -gentbl_filegroup( - name = "StructuredTransformOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=transform", - "-dialect-extension=structured_transform", - ], - "mlir/dialects/_structured_transform_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/LinalgStructuredTransformOps.td", - deps = [ - "//mlir:CallInterfacesTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:LinalgTransformOpsTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:TransformDialectTdFiles", - ], -) - -gentbl_filegroup( - name = "LoopTransformOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=transform", - "-dialect-extension=loop_transform", - ], - "mlir/dialects/_loop_transform_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/SCFLoopTransformOps.td", - deps = [ - "//mlir:CallInterfacesTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:SCFTransformOpsTdFiles", - "//mlir:TransformDialectTdFiles", - ], -) - -gentbl_filegroup( - name = "MemRefTransformOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=transform", - "-dialect-extension=memref_transform", - ], - "mlir/dialects/_memref_transform_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/MemRefTransformOps.td", - deps = [ - "//mlir:MemRefTransformOpsTdFiles", - ], -) - -gentbl_filegroup( - name = "NVGPUTransformOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=transform", - "-dialect-extension=nvgpu_transform", - ], - "mlir/dialects/_nvgpu_transform_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/NVGPUTransformOps.td", - deps = [ - "//mlir:NVGPUTransformOpsTdFiles", - ], -) - -gentbl_filegroup( - name = "PDLTransformOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=transform", - "-dialect-extension=transform_pdl_extension", - ], - "mlir/dialects/_transform_pdl_extension_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/TransformPDLExtensionOps.td", - deps = [ - "//mlir:CallInterfacesTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:TransformDialectTdFiles", - "//mlir:TransformPDLExtensionTdFiles", - ], -) - -gentbl_filegroup( - name = "SparseTensorTransformOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=transform", - "-dialect-extension=sparse_tensor_transform", - ], - "mlir/dialects/_sparse_tensor_transform_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/SparseTensorTransformOps.td", - deps = [ - "//mlir:SparseTensorTransformOpsTdFiles", - ], -) - -gentbl_filegroup( - name = "TensorTransformOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=transform", - "-dialect-extension=tensor_transform", - ], - "mlir/dialects/_tensor_transform_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/TensorTransformOps.td", - deps = [ - "//mlir:TensorTransformOpsTdFiles", - ], -) - -gentbl_filegroup( - name = "VectorTransformEnumPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=transform", - ], - "mlir/dialects/_vector_transform_enum_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/VectorTransformsBase.td", - deps = [ - "//mlir:OpBaseTdFiles", - "//mlir:TransformDialectTdFiles", - "//mlir:VectorTransformOpsTdFiles", - ], -) - -gentbl_filegroup( - name = "VectorTransformOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=transform", - "-dialect-extension=vector_transform", - ], - "mlir/dialects/_vector_transform_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/VectorTransformOps.td", - deps = [ - "//mlir:OpBaseTdFiles", - "//mlir:TransformDialectTdFiles", - "//mlir:VectorTransformOpsTdFiles", - ], -) - -filegroup( - name = "TransformOpsPyFiles", - srcs = [ - ":BufferizationTransformOpsPyGen", - ":GPUTransformOpsPyGen", - ":LoopTransformOpsPyGen", - ":MemRefTransformOpsPyGen", - ":NVGPUTransformOpsPyGen", - ":PDLTransformOpsPyGen", - ":SparseTensorTransformOpsPyGen", - ":StructureTransformEnumPyGen", - ":StructuredTransformOpsPyGen", - ":TensorTransformOpsPyGen", - ":TransformEnumPyGen", - ":TransformOpsPyGen", - ":VectorTransformEnumPyGen", - ":VectorTransformOpsPyGen", - ], -) - -filegroup( - name = "TransformOpsPackagePyFiles", - srcs = glob(["mlir/dialects/transform/*.py"]), -) - -filegroup( - name = "TransformExtrasPackagePyFiles", - srcs = glob(["mlir/dialects/transform/extras/*.py"]), -) - -filegroup( - name = "TransformInterpreterPackagePyFiles", - srcs = glob(["mlir/dialects/transform/interpreter/*.py"]), -) - -##---------------------------------------------------------------------------## -# Vector dialect. -##---------------------------------------------------------------------------## - -gentbl_filegroup( - name = "VectorOpsPyGen", - tbl_outs = [ - ( - [ - "-gen-python-op-bindings", - "-bind-dialect=vector", - ], - "mlir/dialects/_vector_ops_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/VectorOps.td", - deps = [ - "//mlir:ArithOpsTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:VectorOpsTdFiles", - ], -) - -gentbl_filegroup( - name = "VectorAttributesPyGen", - tbl_outs = [ - ( - [ - "-gen-python-enum-bindings", - "-bind-dialect=vector", - ], - "mlir/dialects/_vector_enum_gen.py", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "mlir/dialects/VectorAttributes.td", - deps = [ - "//mlir:ArithOpsTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:VectorOpsTdFiles", - ], -) - -filegroup( - name = "VectorOpsPyFiles", - srcs = [ - "mlir/dialects/vector.py", - ":VectorAttributesPyGen", - ":VectorOpsPyGen", - ], -) diff --git a/utils/bazel/llvm-project-overlay/mlir/tblgen.bzl b/utils/bazel/llvm-project-overlay/mlir/tblgen.bzl deleted file mode 100644 index e45ba1fe0ef72..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/tblgen.bzl +++ /dev/null @@ -1,567 +0,0 @@ -# This file is licensed 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 -"""BUILD extensions for MLIR table generation.""" - -load("@bazel_skylib//lib:paths.bzl", "paths") - -TdInfo = provider( - "Holds TableGen files and the dependencies and include paths necessary to" + - " build them.", - fields = { - "transitive_sources": "td files transitively used by this rule.", - "transitive_includes": ( - "include arguments to add to the final TableGen invocation. These" + - " are the absolute directory paths that will be added with '-I'." - ), - }, -) - -# For now we allow anything that provides DefaultInfo to just forward its files. -# In particular, this allows filegroups to be used. This is mostly to ease -# transition. In the future, the TdInfo provider will be required. -# TODO(gcmn): Switch to enforcing TdInfo provider. -def _get_dep_transitive_srcs(dep): - """Extract TdInfo.transitive_sources, falling back to DefaultInfo.files.""" - if TdInfo in dep: - return dep[TdInfo].transitive_sources - return dep[DefaultInfo].files - -def _get_dep_transitive_includes(dep): - """Extract TdInfo.transitive_includes, falling back to an empty depset().""" - if TdInfo in dep: - return dep[TdInfo].transitive_includes - return depset() - -def _get_transitive_srcs(srcs, deps): - """Obtain the source files for a target and its transitive dependencies. - - Args: - srcs: a list of source files - deps: a list of targets that are direct dependencies - Returns: - a collection of the transitive sources - """ - return depset( - direct = srcs, - transitive = [_get_dep_transitive_srcs(dep) for dep in deps], - ) - -def _get_transitive_includes(includes, deps): - """Obtain the includes paths for a target and its transitive dependencies. - - Args: - includes: a list of include paths - deps: a list of targets that are direct dependencies - Returns: - a collection of the transitive include paths - """ - return depset( - direct = includes, - transitive = [_get_dep_transitive_includes(dep) for dep in deps], - ) - -def _prefix_roots(ctx, includes): - """Map the given includes to be relative to all root directories. - - This will expand them to be relative to all the root directories available - in the execution environment for ctx.run (bin and genfiles in addition to - the normal source root) - """ - prefixed_includes = [] - for include in includes: - prefixed_includes.append(include) - prefixed_includes.append(paths.join(ctx.genfiles_dir.path, include)) - prefixed_includes.append(paths.join(ctx.bin_dir.path, include)) - return prefixed_includes - -def _resolve_includes(ctx, includes): - """Resolves include paths to paths relative to the execution root. - - Relative paths are interpreted as relative to the current label's package. - Absolute paths are interpreted as relative to the current label's workspace - root.""" - package = ctx.label.package - workspace_root = ctx.label.workspace_root - workspace_root = workspace_root if workspace_root else "." - resolved_includes = [] - for include in includes: - if paths.is_absolute(include): - include = include.lstrip("/") - else: - include = paths.join(package, include) - include = paths.join(workspace_root, include) - resolved_includes.extend(_prefix_roots(ctx, [include])) - return resolved_includes - -def _td_library_impl(ctx): - trans_srcs = _get_transitive_srcs(ctx.files.srcs, ctx.attr.deps) - trans_includes = _get_transitive_includes( - _resolve_includes(ctx, ctx.attr.includes), - ctx.attr.deps, - ) - - # Note that we include srcs in runfiles. A td_library doesn't compile to - # produce an output: it's just a depset of source files and include - # directories. So if it is needed for execution of some rule (likely - # something running tblgen as a test action), the files needed are the same - # as the source files. - # Note: not using merge_all, as that is not available in Bazel 4.0 - runfiles = ctx.runfiles(ctx.files.srcs) - for src in ctx.attr.srcs: - runfiles = runfiles.merge(src[DefaultInfo].default_runfiles) - for dep in ctx.attr.deps: - runfiles = runfiles.merge(dep[DefaultInfo].default_runfiles) - - return [ - DefaultInfo(files = trans_srcs, runfiles = runfiles), - TdInfo( - transitive_sources = trans_srcs, - transitive_includes = trans_includes, - ), - ] - -td_library = rule( - _td_library_impl, - attrs = { - "srcs": attr.label_list(allow_files = True), - "includes": attr.string_list( - doc = "Include paths to be added to the final TableGen tool" + - " invocation. Relative paths are interpreted as relative to" + - " the current label's package. Absolute paths are" + - " interpreted as relative to the current label's workspace", - ), - # TODO(gcmn): limit to TdInfo providers. - "deps": attr.label_list( - doc = "Dependencies providing TableGen source files and include" + - " paths.", - ), - }, -) - -def _gentbl_rule_impl(ctx): - td_file = ctx.file.td_file - - trans_srcs = _get_transitive_srcs( - ctx.files.td_srcs + [td_file], - ctx.attr.deps, - ) - - # Note that the td_file.dirname is already relative to the execution root, - # i.e. may contain an `external/` prefix if the current - # workspace is not the main workspace. Therefore it is not included in the - # _resolve_includes call that prepends this prefix. - trans_includes = _get_transitive_includes( - _resolve_includes(ctx, ctx.attr.includes + ["/"]) + - _prefix_roots(ctx, [td_file.dirname]), - ctx.attr.deps, - ) - - args = ctx.actions.args() - args.add_all(ctx.attr.opts) - args.add(td_file) - args.add_all(trans_includes, before_each = "-I") - - args.add("-o", ctx.outputs.out.path) - - ctx.actions.run( - outputs = [ctx.outputs.out], - inputs = trans_srcs, - executable = ctx.executable.tblgen, - arguments = [args], - # Make sure action_env settings are honored so the env is the same as - # when the tool was built. Important for locating shared libraries with - # a custom LD_LIBRARY_PATH. - use_default_shell_env = True, - mnemonic = "TdGenerate", - ) - - return [DefaultInfo()] - -gentbl_rule = rule( - _gentbl_rule_impl, - doc = "Generates tabular code from a table definition file.", - attrs = { - "tblgen": attr.label( - doc = "The TableGen executable with which to generate `out`.", - executable = True, - cfg = "exec", - ), - "td_file": attr.label( - doc = "The TableGen file to run through `tblgen`.", - allow_single_file = True, - mandatory = True, - ), - "td_srcs": attr.label_list( - doc = "Additional TableGen files included by `td_file`. It is not" + - " necessary to list td_file here (though not an error).", - allow_files = True, - ), - # TODO(gcmn): limit to TdInfo providers. - "deps": attr.label_list( - doc = "Dependencies providing TableGen source files and include" + - " paths.", - ), - "out": attr.output( - doc = "The output file for the TableGen invocation.", - mandatory = True, - ), - "opts": attr.string_list( - doc = "Additional command line options to add to the TableGen" + - " invocation. For include arguments, prefer to use" + - " `includes`.", - ), - "includes": attr.string_list( - doc = "Include paths to be added to the final TableGen tool" + - " invocation. Relative paths are interpreted as relative to" + - " the current label's package. Absolute paths are" + - " interpreted as relative to the current label's workspace." + - " Includes are applied from all roots available in the" + - " execution environment (source, genfiles, and bin" + - " directories). The execution roots themselves and the " + - " directory of td_file are always added.", - ), - }, -) - -# TODO(gcmn): Figure out how to reduce duplication with _gentbl_rule_impl -def _gentbl_test_impl(ctx): - td_file = ctx.file.td_file - - # Note that the td_file.dirname is already relative to the execution root, - # i.e. may contain an `external/` prefix if the current - # workspace is not the main workspace. Therefore it is not included in the - # _resolve_includes call that prepends this prefix. - trans_includes = _get_transitive_includes( - _resolve_includes(ctx, ctx.attr.includes + ["/"]) + - _prefix_roots(ctx, [td_file.dirname]), - ctx.attr.deps, - ) - - test_args = [ctx.executable.tblgen.short_path] - test_args.extend(ctx.attr.opts) - test_args.append(td_file.path) - test_args.extend(["-I " + include for include in trans_includes.to_list()]) - - test_args.extend(["-o", "/dev/null"]) - - ctx.actions.write( - ctx.outputs.executable, - content = " ".join(test_args), - is_executable = True, - ) - - # Note: not using merge_all, as that is not available in Bazel 4.0 - runfiles = ctx.runfiles( - files = [ctx.executable.tblgen], - transitive_files = _get_transitive_srcs( - ctx.files.td_srcs + [td_file], - ctx.attr.deps, - ), - ) - for src in ctx.attr.td_srcs: - runfiles = runfiles.merge(src[DefaultInfo].default_runfiles) - for dep in ctx.attr.deps: - runfiles = runfiles.merge(dep[DefaultInfo].default_runfiles) - - return [ - coverage_common.instrumented_files_info( - ctx, - source_attributes = ["td_file", "td_srcs"], - dependency_attributes = ["tblgen", "deps"], - ), - DefaultInfo(runfiles = runfiles), - ] - -gentbl_test = rule( - _gentbl_test_impl, - test = True, - doc = "A shell test that tests the given TablegGen invocation. Note" + - " that unlike gentbl_rule, this builds and invokes `tblgen` in the" + - " target configuration. Takes all the same arguments as gentbl_rule" + - " except for `out` (as it does not generate any output)", - attrs = { - "tblgen": attr.label( - doc = "The TableGen executable run in the shell command. Note" + - " that this is built in the target configuration.", - executable = True, - cfg = "target", - ), - "td_file": attr.label( - doc = "See gentbl_rule.td_file", - allow_single_file = True, - mandatory = True, - ), - "td_srcs": attr.label_list( - doc = "See gentbl_rule.td_srcs", - allow_files = True, - ), - "deps": attr.label_list(doc = "See gentbl_rule.deps"), - "opts": attr.string_list(doc = "See gentbl_rule.opts"), - "includes": attr.string_list(doc = "See gentbl_rule.includes"), - }, -) - -def gentbl_filegroup( - name, - tblgen, - td_file, - tbl_outs, - td_srcs = [], - includes = [], - deps = [], - test = False, - skip_opts = [], - **kwargs): - """Create multiple TableGen generated files using the same tool and input. - - All generated outputs are bundled in a file group with the given name. - - Args: - name: The name of the generated filegroup rule for use in dependencies. - tblgen: The binary used to produce the output. - td_file: The primary table definitions file. - tbl_outs: A list of tuples ([opts], out), where each 'opts' is a list of - options passed to tblgen, each option being a string, and 'out' is the - corresponding output file produced. - td_srcs: See gentbl_rule.td_srcs - includes: See gentbl_rule.includes - deps: See gentbl_rule.deps - test: Whether to create a shell test that invokes the tool too. - skip_opts: Files generated using these opts in tbl_outs will be excluded - from the generated filegroup. - **kwargs: Extra keyword arguments to pass to all generated rules. - """ - - for (opts, out) in tbl_outs: - first_opt = opts[0] if opts else "" - rule_suffix = "_{}_{}".format( - first_opt.replace("-", "_").replace("=", "_"), - str(hash(" ".join(opts))), - ) - gentbl_name = "%s_%s_genrule" % (name, rule_suffix) - gentbl_rule( - name = gentbl_name, - td_file = td_file, - tblgen = tblgen, - opts = opts, - td_srcs = td_srcs, - deps = deps, - includes = includes, - out = out, - **kwargs - ) - - if test: - # Also run the generator in the target configuration as a test. This - # means it gets run with asserts and sanitizers and such when they - # are enabled and is counted in coverage. - gentbl_test( - name = "%s_test" % (gentbl_name,), - td_file = td_file, - tblgen = tblgen, - opts = opts, - td_srcs = td_srcs, - deps = deps, - includes = includes, - # Shell files not executable on Windows. - # TODO(gcmn): Support windows. - tags = ["no_windows"], - **kwargs - ) - - included_srcs = [f for (opts, f) in tbl_outs if not any([skip_opt in opts for skip_opt in skip_opts])] - native.filegroup( - name = name, - srcs = included_srcs, - **kwargs - ) - -def gentbl_cc_library( - name, - tblgen, - td_file, - tbl_outs, - td_srcs = [], - includes = [], - deps = [], - strip_include_prefix = None, - test = False, - copts = None, - **kwargs): - """Create multiple TableGen generated files using the same tool and input. - - All generated outputs are bundled in a cc_library rule. - - Args: - name: The name of the generated cc_library rule for use in dependencies. - tblgen: The binary used to produce the output. - td_file: The primary table definitions file. - tbl_outs: A list of tuples ([opts], out), where each 'opts' is a list of - options passed to tblgen, each option being a string, and 'out' is the - corresponding output file produced. - td_srcs: See gentbl_rule.td_srcs - includes: See gentbl_rule.includes - deps: See gentbl_rule.deps - strip_include_prefix: attribute to pass through to cc_library. - test: whether to create a shell test that invokes the tool too. - copts: list of copts to pass to cc_library. - **kwargs: Extra keyword arguments to pass to all generated rules. - """ - - filegroup_name = name + "_filegroup" - gentbl_filegroup( - name = filegroup_name, - tblgen = tblgen, - td_file = td_file, - tbl_outs = tbl_outs, - td_srcs = td_srcs, - includes = includes, - deps = deps, - test = test, - skip_opts = ["-gen-op-doc"], - **kwargs - ) - native.cc_library( - name = name, - # strip_include_prefix does not apply to textual_hdrs. - # https://github.com/bazelbuild/bazel/issues/12424 - hdrs = [":" + filegroup_name] if strip_include_prefix else [], - strip_include_prefix = strip_include_prefix, - textual_hdrs = [":" + filegroup_name], - copts = copts, - **kwargs - ) - -def _gentbl_shard_impl(ctx): - args = ctx.actions.args() - args.add(ctx.file.src_file) - args.add("-op-shard-index", ctx.attr.index) - args.add("-o", ctx.outputs.out.path) - ctx.actions.run( - outputs = [ctx.outputs.out], - inputs = [ctx.file.src_file], - executable = ctx.executable.sharder, - arguments = [args], - use_default_shell_env = True, - mnemonic = "ShardGenerate", - ) - -gentbl_shard_rule = rule( - _gentbl_shard_impl, - doc = "", - output_to_genfiles = True, - attrs = { - "index": attr.int(mandatory = True, doc = ""), - "sharder": attr.label( - doc = "", - executable = True, - cfg = "exec", - ), - "src_file": attr.label( - doc = "", - allow_single_file = True, - mandatory = True, - ), - "out": attr.output( - doc = "", - mandatory = True, - ), - }, -) - -def gentbl_sharded_ops( - name, - tblgen, - sharder, - td_file, - shard_count, - src_file, - src_out, - hdr_out, - test = False, - includes = [], - strip_include_prefix = None, - deps = []): - """Generate sharded op declarations and definitions. - - This special build rule shards op definitions in a TableGen file and generates multiple copies - of a template source file for including and compiling each shard. The rule defines a filegroup - consisting of the source shards, the generated source file, and the generated header file. - - Args: - name: The name of the filegroup. - tblgen: The binary used to produce the output. - sharder: The source file sharder to use. - td_file: The primary table definitions file. - shard_count: The number of op definition shards to produce. - src_file: The source file template. - src_out: The generated source file. - hdr_out: The generated header file. - test: Whether this is a test target. - includes: See gentbl_rule.includes - deps: See gentbl_rule.deps - strip_include_prefix: Attribute to pass through to cc_library. - """ - cc_lib_name = name + "__gentbl_cc_lib" - gentbl_cc_library( - name = cc_lib_name, - strip_include_prefix = strip_include_prefix, - includes = includes, - tbl_outs = [ - ( - [ - "-gen-op-defs", - "-op-shard-count=" + str(shard_count), - ], - src_out, - ), - ( - [ - "-gen-op-decls", - "-op-shard-count=" + str(shard_count), - ], - hdr_out, - ), - ], - tblgen = tblgen, - td_file = td_file, - test = test, - deps = deps, - ) - all_files = [hdr_out, src_out] - for i in range(0, shard_count): - out_file = "shard_copy_" + str(i) + "_" + src_file - gentbl_shard_rule( - index = i, - name = name + "__src_shard" + str(i), - testonly = test, - out = out_file, - sharder = sharder, - src_file = src_file, - ) - all_files.append(out_file) - native.filegroup(name = name, srcs = all_files) - -def gentbl_sharded_op_defs(name, source_file, shard_count): - """Generates multiple copies of a source file that includes sharded op definitions. - - Args: - name: The name of the rule. - source_file: The source to copy. - shard_count: The number of shards. - - Returns: - A list of the copied filenames to be included in the dialect library. - """ - copies = [] - for i in range(0, shard_count): - out_file = "shard_copy_" + str(i) + "_" + source_file - copies.append(out_file) - native.genrule( - name = name + "_shard_" + str(i), - srcs = [source_file], - outs = [out_file], - cmd = "echo -e \"#define GET_OP_DEFS_" + str(i) + "\n$$(cat $(SRCS))\" > $(OUTS)", - ) - return copies diff --git a/utils/bazel/llvm-project-overlay/mlir/test/Analysis/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/Analysis/BUILD.bazel deleted file mode 100644 index 83a17efbbd660..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/Analysis/BUILD.bazel +++ /dev/null @@ -1,17 +0,0 @@ -load("//llvm:lit_test.bzl", "lit_test") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - data = [ - "//mlir:mlir-opt", - "//mlir/test:lit_data", - ], - ) - for src in glob(["**/*.mlir"]) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel deleted file mode 100644 index a1d2b20a106e6..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel +++ /dev/null @@ -1,1183 +0,0 @@ -# This file is licensed 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 - -load("@bazel_skylib//rules:expand_template.bzl", "expand_template") -load("//llvm:lit_test.bzl", "package_path") -load("//mlir:tblgen.bzl", "gentbl_cc_library", "gentbl_sharded_ops", "td_library") - -package( - default_visibility = ["//visibility:public"], - features = ["layering_check"], -) - -licenses(["notice"]) - -LLVM_LIT_PATH_FUNCTION = " " + \ - "# Allow generated file to be relocatable.\n" + \ - "from pathlib import Path\n" + \ - "def path(p):\n" + \ - " if not p: return ''\n" + \ - " return str((Path(__file__).parent / p).resolve())\n" - -LIT_SITE_CFG_IN_HEADER = "# Autogenerated, do not edit." + LLVM_LIT_PATH_FUNCTION - -expand_template( - name = "lit_site_cfg_py", - testonly = True, - out = "lit.site.cfg.py", - substitutions = { - "@LIT_SITE_CFG_IN_HEADER@": LIT_SITE_CFG_IN_HEADER, - "@LLVM_TOOLS_DIR@": package_path("//llvm:BUILD"), - "@ENABLE_SHARED@": "1", - "@ENABLE_ASSERTIONS@": "1", - "@MLIR_SOURCE_DIR@": package_path("//mlir:BUILD"), - "@MLIR_TOOLS_DIR@": package_path("//mlir:BUILD"), - "\"@MLIR_BINARY_DIR@\"": "os.environ[\"TEST_UNDECLARED_OUTPUTS_DIR\"]", - # All disabled, but required to substituted because they are not in quotes. - "@LLVM_BUILD_EXAMPLES@": "0", - "@LLVM_HAS_NVPTX_TARGET@": "0", - "@MLIR_ENABLE_CUDA_RUNNER@": "0", - "@MLIR_ENABLE_ROCM_CONVERSIONS@": "0", - "@MLIR_ENABLE_ROCM_RUNNER@": "0", - "@MLIR_ENABLE_SYCL_RUNNER@": "0", - "@MLIR_ENABLE_SPIRV_CPU_RUNNER@": "0", - "@MLIR_ENABLE_VULKAN_RUNNER@": "0", - "@MLIR_ENABLE_BINDINGS_PYTHON@": "0", - "@MLIR_RUN_AMX_TESTS@": "0", - "@MLIR_RUN_ARM_SVE_TESTS@": "0", - "@MLIR_RUN_ARM_SME_TESTS@": "0", - "@MLIR_RUN_X86VECTOR_TESTS@": "0", - "@MLIR_RUN_CUDA_TENSOR_CORE_TESTS@": "0", - "@MLIR_RUN_CUDA_SM80_TESTS@": "0", - "@MLIR_RUN_CUDA_SM80_LT_TESTS@": "0", - "@MLIR_RUN_CUDA_SM90_TESTS@": "0", - "@MLIR_INCLUDE_INTEGRATION_TESTS@": "0", - "@SHLIBDIR@": package_path("//llvm:BUILD"), - }, - template = "lit.site.cfg.py.in", -) - -# Common data used by most lit tests. -filegroup( - name = "lit_data", - testonly = True, - data = [ - "lit.cfg.py", - "lit.site.cfg.py", - "//llvm:FileCheck", - "//llvm:count", - "//llvm:not", - ], -) - -cc_library( - name = "IRProducingAPITest", - hdrs = ["APITest.h"], - includes = ["."], -) - -cc_library( - name = "TestAnalysis", - srcs = glob( - [ - "lib/Analysis/*.cpp", - "lib/Analysis/*.h", - "lib/Analysis/DataFlow/*.cpp", - "lib/Analysis/DataFlow/*.h", - ], - ), - includes = ["lib/Dialect/Test"], - deps = [ - ":TestDialect", - "//llvm:Support", - "//mlir:AffineAnalysis", - "//mlir:AffineDialect", - "//mlir:Analysis", - "//mlir:CallOpInterfaces", - "//mlir:ControlFlowInterfaces", - "//mlir:FuncDialect", - "//mlir:FunctionInterfaces", - "//mlir:IR", - "//mlir:MemRefDialect", - "//mlir:Pass", - "//mlir:SideEffectInterfaces", - "//mlir:Support", - ], -) - -td_library( - name = "TestOpTdFiles", - srcs = glob(["lib/Dialect/Test/*.td"]), - deps = [ - "//mlir:BuiltinDialectTdFiles", - "//mlir:CallInterfacesTdFiles", - "//mlir:ControlFlowInterfacesTdFiles", - "//mlir:CopyOpInterfaceTdFiles", - "//mlir:DLTIDialectTdFiles", - "//mlir:DataLayoutInterfacesTdFiles", - "//mlir:DestinationStyleOpInterfaceTdFiles", - "//mlir:FunctionInterfacesTdFiles", - "//mlir:InferIntRangeInterfaceTdFiles", - "//mlir:InferTypeOpInterfaceTdFiles", - "//mlir:LinalgStructuredOpsTdFiles", - "//mlir:MemorySlotInterfacesTdFiles", - "//mlir:OpBaseTdFiles", - "//mlir:PolynomialTdFiles", - "//mlir:SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "TestOpsSyntaxIncGen", - strip_include_prefix = "lib/Dialect/Test", - tbl_outs = [ - ( - ["-gen-op-decls"], - "lib/Dialect/Test/TestOpsSyntax.h.inc", - ), - ( - ["-gen-op-defs"], - "lib/Dialect/Test/TestOpsSyntax.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "lib/Dialect/Test/TestOpsSyntax.td", - test = True, - deps = [ - ":TestOpTdFiles", - ], -) - -gentbl_cc_library( - name = "TestOpsIncGen", - strip_include_prefix = "lib/Dialect/Test", - tbl_outs = [ - ( - [ - "-gen-dialect-decls", - "-dialect=test", - ], - "lib/Dialect/Test/TestOpsDialect.h.inc", - ), - ( - [ - "-gen-dialect-defs", - "-dialect=test", - ], - "lib/Dialect/Test/TestOpsDialect.cpp.inc", - ), - ( - ["-gen-rewriters"], - "lib/Dialect/Test/TestPatterns.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "lib/Dialect/Test/TestOps.td", - test = True, - deps = [ - ":TestOpTdFiles", - ], -) - -gentbl_cc_library( - name = "TestInterfacesIncGen", - strip_include_prefix = "lib/Dialect/Test", - tbl_outs = [ - ( - ["-gen-attr-interface-decls"], - "lib/Dialect/Test/TestAttrInterfaces.h.inc", - ), - ( - ["-gen-attr-interface-defs"], - "lib/Dialect/Test/TestAttrInterfaces.cpp.inc", - ), - ( - ["-gen-type-interface-decls"], - "lib/Dialect/Test/TestTypeInterfaces.h.inc", - ), - ( - ["-gen-type-interface-defs"], - "lib/Dialect/Test/TestTypeInterfaces.cpp.inc", - ), - ( - ["-gen-op-interface-decls"], - "lib/Dialect/Test/TestOpInterfaces.h.inc", - ), - ( - ["-gen-op-interface-defs"], - "lib/Dialect/Test/TestOpInterfaces.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "lib/Dialect/Test/TestInterfaces.td", - test = True, - deps = [ - "//mlir:OpBaseTdFiles", - "//mlir:SideEffectInterfacesTdFiles", - ], -) - -gentbl_cc_library( - name = "TestAttrDefsIncGen", - strip_include_prefix = "lib/Dialect/Test", - tbl_outs = [ - ( - [ - "-gen-attrdef-decls", - "--attrdefs-dialect=test", - ], - "lib/Dialect/Test/TestAttrDefs.h.inc", - ), - ( - [ - "-gen-attrdef-defs", - "--attrdefs-dialect=test", - ], - "lib/Dialect/Test/TestAttrDefs.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "lib/Dialect/Test/TestOps.td", - test = True, - deps = [ - ":TestOpTdFiles", - ], -) - -gentbl_cc_library( - name = "TestEnumDefsIncGen", - strip_include_prefix = "lib/Dialect/Test", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "lib/Dialect/Test/TestOpEnums.h.inc", - ), - ( - ["-gen-enum-defs"], - "lib/Dialect/Test/TestOpEnums.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "lib/Dialect/Test/TestEnumDefs.td", - test = True, - deps = [ - ":TestOpTdFiles", - ], -) - -gentbl_cc_library( - name = "TestTypeDefsIncGen", - strip_include_prefix = "lib/Dialect/Test", - tbl_outs = [ - ( - [ - "-gen-typedef-decls", - "--typedefs-dialect=test", - ], - "lib/Dialect/Test/TestTypeDefs.h.inc", - ), - ( - [ - "-gen-typedef-defs", - "--typedefs-dialect=test", - ], - "lib/Dialect/Test/TestTypeDefs.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "lib/Dialect/Test/TestTypeDefs.td", - test = True, - deps = [ - ":TestOpTdFiles", - "//mlir:BuiltinDialectTdFiles", - ], -) - -cc_library( - name = "TestTestDynDialect", - srcs = glob([ - "lib/Dialect/TestDyn/*.cpp", - ]), - deps = [ - "//mlir:IR", - ], -) - -td_library( - name = "TransformDialectTdFiles", - srcs = glob(["lib/Dialect/Transform/*.td"]), - deps = [ - "//mlir:OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "TestTransformDialectExtensionIncGen", - strip_include_prefix = "lib/Dialect/Transform", - tbl_outs = [ - ( - ["-gen-op-decls"], - "lib/Dialect/Transform/TestTransformDialectExtension.h.inc", - ), - ( - ["-gen-op-defs"], - "lib/Dialect/Transform/TestTransformDialectExtension.cpp.inc", - ), - ( - [ - "-gen-typedef-decls", - "-typedefs-dialect=transform", - ], - "lib/Dialect/Transform/TestTransformDialectExtensionTypes.h.inc", - ), - ( - [ - "-gen-typedef-defs", - "-typedefs-dialect=transform", - ], - "lib/Dialect/Transform/TestTransformDialectExtensionTypes.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "lib/Dialect/Transform/TestTransformDialectExtension.td", - test = True, - deps = [ - ":TransformDialectTdFiles", - "//mlir:PDLDialectTdFiles", - "//mlir:TransformDialectTdFiles", - "//mlir:TransformPDLExtension", - ], -) - -cc_library( - name = "TestTransformDialect", - srcs = glob(["lib/Dialect/Transform/*.cpp"]), - hdrs = glob(["lib/Dialect/Transform/*.h"]), - includes = ["lib/Dialect/Transform"], - deps = [ - ":TestTransformDialectExtensionIncGen", - "//llvm:Support", - "//mlir:BytecodeOpInterface", - "//mlir:IR", - "//mlir:PDLDialect", - "//mlir:Pass", - "//mlir:TransformDebugExtension", - "//mlir:TransformDialect", - "//mlir:TransformDialectInterfaces", - "//mlir:TransformDialectTransforms", - "//mlir:TransformPDLExtension", - ], -) - -gentbl_sharded_ops( - name = "TestDialectOpSrcs", - hdr_out = "lib/Dialect/Test/TestOps.h.inc", - shard_count = 20, - sharder = "//mlir:mlir-src-sharder", - src_file = "lib/Dialect/Test/TestOps.cpp", - src_out = "lib/Dialect/Test/TestOps.cpp.inc", - tblgen = "//mlir:mlir-tblgen", - td_file = "lib/Dialect/Test/TestOps.td", - test = True, - deps = [":TestOpTdFiles"], -) - -cc_library( - name = "TestDialect", - srcs = glob( - ["lib/Dialect/Test/*.cpp"], - exclude = ["lib/Dialect/Test/TestToLLVMIRTranslation.cpp"], - ) + [":TestDialectOpSrcs"], - hdrs = glob(["lib/Dialect/Test/*.h"]), - includes = [ - "lib/Dialect/Test", - ], - deps = [ - ":TestAttrDefsIncGen", - ":TestEnumDefsIncGen", - ":TestInterfacesIncGen", - ":TestOpsIncGen", - ":TestOpsSyntaxIncGen", - ":TestTypeDefsIncGen", - "//llvm:Core", - "//llvm:IRReader", - "//llvm:Support", - "//mlir:ArithDialect", - "//mlir:BytecodeOpInterface", - "//mlir:CallOpInterfaces", - "//mlir:ControlFlowInterfaces", - "//mlir:CopyOpInterface", - "//mlir:DLTIDialect", - "//mlir:DataLayoutInterfaces", - "//mlir:DerivedAttributeOpInterface", - "//mlir:DestinationStyleOpInterface", - "//mlir:Dialect", - "//mlir:DialectUtils", - "//mlir:FromLLVMIRTranslation", - "//mlir:FuncDialect", - "//mlir:FuncTransforms", - "//mlir:FunctionInterfaces", - "//mlir:IR", - "//mlir:InferIntRangeInterface", - "//mlir:InferTypeOpInterface", - "//mlir:InliningUtils", - "//mlir:LLVMDialect", - "//mlir:LLVMIRToLLVMTranslation", - "//mlir:LinalgDialect", - "//mlir:LoopLikeInterface", - "//mlir:MemorySlotInterfaces", - "//mlir:Pass", - "//mlir:PolynomialDialect", - "//mlir:Reducer", - "//mlir:SideEffectInterfaces", - "//mlir:Support", - "//mlir:TensorDialect", - "//mlir:TransformUtils", - "//mlir:Transforms", - "//mlir:TranslateLib", - "//mlir:ValueBoundsOpInterface", - "//mlir:ViewLikeInterface", - ], -) - -cc_library( - name = "TestToLLVMIRTranslation", - srcs = ["lib/Dialect/Test/TestToLLVMIRTranslation.cpp"], - deps = [ - ":TestDialect", - "//llvm:Core", - "//llvm:Support", - "//mlir:BuiltinToLLVMIRTranslation", - "//mlir:IR", - "//mlir:LLVMToLLVMIRTranslation", - "//mlir:ToLLVMIRTranslation", - "//mlir:TranslateLib", - ], -) - -cc_library( - name = "TestIR", - srcs = glob(["lib/IR/*.cpp"]), - deps = [ - ":TestDialect", - "//llvm:Support", - "//mlir:Analysis", - "//mlir:ArithDialect", - "//mlir:BytecodeOpInterface", - "//mlir:BytecodeReader", - "//mlir:BytecodeWriter", - "//mlir:FuncDialect", - "//mlir:FunctionInterfaces", - "//mlir:IR", - "//mlir:LinalgDialect", - "//mlir:Parser", - "//mlir:Pass", - "//mlir:Support", - ], -) - -cc_library( - name = "TestLoopLikeInterface", - srcs = glob(["lib/Interfaces/LoopLikeInterface/*.cpp"]), - deps = [ - "//llvm:Support", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:LoopLikeInterface", - "//mlir:Pass", - ], -) - -gentbl_cc_library( - name = "TestTilingInterfaceTransformOpsIncGen", - includes = ["lib/Interfaces/TilingInterface"], - strip_include_prefix = "lib", - tbl_outs = [ - ( - ["-gen-op-decls"], - "lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.h.inc", - ), - ( - ["-gen-op-defs"], - "lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.td", - deps = [ - "//mlir:SCFTdFiles", - "//mlir:TransformDialectTdFiles", - ], -) - -cc_library( - name = "TestTilingInterface", - srcs = glob(["lib/Interfaces/TilingInterface/*.cpp"]), - includes = ["lib/Interfaces/TilingInterface"], - deps = [ - ":TestTilingInterfaceTransformOpsIncGen", - "//llvm:Support", - "//mlir:AffineDialect", - "//mlir:ArithDialect", - "//mlir:DialectUtils", - "//mlir:FuncDialect", - "//mlir:GPUDialect", - "//mlir:IR", - "//mlir:IndexDialect", - "//mlir:LinalgDialect", - "//mlir:LinalgTransforms", - "//mlir:MemRefDialect", - "//mlir:Pass", - "//mlir:SCFDialect", - "//mlir:SCFTransforms", - "//mlir:TensorDialect", - "//mlir:TensorTilingInterfaceImpl", - "//mlir:TilingInterface", - "//mlir:TransformDialect", - "//mlir:TransformDialectInterfaces", - "//mlir:Transforms", - ], -) - -cc_library( - name = "TestPass", - srcs = glob(["lib/Pass/*.cpp"]), - deps = [ - ":TestDialect", - "//llvm:Support", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:Pass", - "//mlir:Support", - ], -) - -cc_library( - name = "TestRewrite", - srcs = [ - "lib/Rewrite/TestPDLByteCode.cpp", - ], - deps = [ - "//mlir:IR", - "//mlir:PDLInterpDialect", - "//mlir:Pass", - "//mlir:Support", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) - -cc_library( - name = "TestReducer", - srcs = [ - "lib/Reducer/MLIRTestReducer.cpp", - ], - deps = [ - "//mlir:IR", - "//mlir:Pass", - "//mlir:Support", - ], -) - -cc_library( - name = "TestTransforms", - srcs = glob(["lib/Transforms/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - ":TestDialect", - ":TestDialectConversionPDLLPatternsIncGen", - "//llvm:Support", - "//mlir:AffineAnalysis", - "//mlir:AffineDialect", - "//mlir:Analysis", - "//mlir:ArithDialect", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:InliningUtils", - "//mlir:MathDialect", - "//mlir:PDLDialect", - "//mlir:PDLInterpDialect", - "//mlir:Parser", - "//mlir:Pass", - "//mlir:SCFDialect", - "//mlir:SPIRVDialect", - "//mlir:SideEffectInterfaces", - "//mlir:Support", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) - -cc_library( - name = "TestFuncToLLVM", - srcs = glob(["lib/Conversion/FuncToLLVM/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - ":TestDialect", - "//mlir:FuncDialect", - "//mlir:FuncToLLVM", - "//mlir:IR", - "//mlir:LLVMCommonConversion", - "//mlir:LLVMDialect", - "//mlir:Pass", - ], -) - -cc_library( - name = "TestOneToNTypeConversion", - srcs = glob(["lib/Conversion/OneToNTypeConversion/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - ":TestDialect", - "//mlir:FuncDialect", - "//mlir:FuncTransforms", - "//mlir:IR", - "//mlir:Pass", - "//mlir:SCFDialect", - "//mlir:SCFTransforms", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) - -cc_library( - name = "TestVectorToSPIRV", - srcs = glob(["lib/Conversion/VectorToSPIRV/*.cpp"]), - deps = [ - "//mlir:ArithDialect", - "//mlir:FuncDialect", - "//mlir:Pass", - "//mlir:SPIRVDialect", - "//mlir:TransformUtils", - "//mlir:Transforms", - "//mlir:VectorDialect", - "//mlir:VectorToSPIRV", - ], -) - -cc_library( - name = "TestConvertToSPIRV", - srcs = glob(["lib/Conversion/ConvertToSPIRV/*.cpp"]), - deps = [ - "//mlir:ArithDialect", - "//mlir:FuncDialect", - "//mlir:Pass", - "//mlir:SPIRVConversion", - "//mlir:SPIRVDialect", - "//mlir:TransformUtils", - "//mlir:Transforms", - "//mlir:VectorDialect", - ], -) - -cc_library( - name = "TestAffine", - srcs = glob([ - "lib/Dialect/Affine/*.cpp", - ]), - deps = [ - ":TestDialect", - "//llvm:Support", - "//mlir:AffineAnalysis", - "//mlir:AffineDialect", - "//mlir:AffineTransforms", - "//mlir:AffineUtils", - "//mlir:Analysis", - "//mlir:ArithTransforms", - "//mlir:DialectUtils", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:MemRefDialect", - "//mlir:Pass", - "//mlir:SCFDialect", - "//mlir:Support", - "//mlir:TensorDialect", - "//mlir:TransformUtils", - "//mlir:Transforms", - "//mlir:ValueBoundsOpInterface", - "//mlir:VectorDialect", - "//mlir:VectorUtils", - ], -) - -cc_library( - name = "TestDLTI", - srcs = glob(["lib/Dialect/DLTI/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - ":TestDialect", - "//mlir:Analysis", - "//mlir:DLTIDialect", - "//mlir:IR", - "//mlir:Pass", - ], -) - -cc_library( - name = "TestGPU", - srcs = glob(["lib/Dialect/GPU/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//llvm:NVPTXCodeGen", - "//llvm:Support", - "//mlir:AffineDialect", - "//mlir:AffineToStandard", - "//mlir:ArithDialect", - "//mlir:ArithToLLVM", - "//mlir:FuncDialect", - "//mlir:FuncToLLVM", - "//mlir:GPUDialect", - "//mlir:GPUToGPURuntimeTransforms", - "//mlir:GPUToNVVMTransforms", - "//mlir:GPUTransforms", - "//mlir:IR", - "//mlir:IndexDialect", - "//mlir:IndexToLLVM", - "//mlir:LLVMDialect", - "//mlir:LinalgTransforms", - "//mlir:MathToLLVM", - "//mlir:MemRefDialect", - "//mlir:MemRefToLLVM", - "//mlir:MemRefTransforms", - "//mlir:NVGPUToNVVM", - "//mlir:NVVMToLLVM", - "//mlir:NVVMToLLVMIRTranslation", - "//mlir:Pass", - "//mlir:ROCDLToLLVMIRTranslation", - "//mlir:ReconcileUnrealizedCasts", - "//mlir:SCFDialect", - "//mlir:SCFToControlFlow", - "//mlir:SPIRVDialect", - "//mlir:ToLLVMIRTranslation", - "//mlir:TransformUtils", - "//mlir:Transforms", - "//mlir:VectorDialect", - "//mlir:VectorToLLVM", - "//mlir:VectorToSCF", - ], -) - -cc_library( - name = "TestLinalg", - srcs = glob(["lib/Dialect/Linalg/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//llvm:Support", - "//mlir:AffineDialect", - "//mlir:ArithDialect", - "//mlir:ArithTransforms", - "//mlir:BufferizationDialect", - "//mlir:BufferizationTransforms", - "//mlir:FuncDialect", - "//mlir:FuncTransforms", - "//mlir:GPUDialect", - "//mlir:IR", - "//mlir:LinalgDialect", - "//mlir:LinalgTransforms", - "//mlir:LinalgUtils", - "//mlir:MemRefDialect", - "//mlir:Parser", - "//mlir:Pass", - "//mlir:SCFDialect", - "//mlir:SCFTransforms", - "//mlir:TensorDialect", - "//mlir:TensorTransforms", - "//mlir:TransformUtils", - "//mlir:Transforms", - "//mlir:VectorDialect", - "//mlir:VectorToSCF", - "//mlir:VectorTransforms", - ], -) - -cc_library( - name = "TestLLVM", - srcs = glob(["lib/Dialect/LLVM/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//mlir:AffineToStandard", - "//mlir:FuncDialect", - "//mlir:FuncToLLVM", - "//mlir:IR", - "//mlir:IndexToLLVM", - "//mlir:LLVMDialect", - "//mlir:LinalgTransforms", - "//mlir:MathToLLVM", - "//mlir:MemRefToLLVM", - "//mlir:MemRefTransforms", - "//mlir:Pass", - "//mlir:ReconcileUnrealizedCasts", - "//mlir:SCFToControlFlow", - "//mlir:Transforms", - "//mlir:VectorToLLVM", - "//mlir:VectorToSCF", - ], -) - -cc_library( - name = "TestMath", - srcs = glob(["lib/Dialect/Math/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//mlir:ArithDialect", - "//mlir:MathDialect", - "//mlir:MathTransforms", - "//mlir:Pass", - "//mlir:SCFDialect", - "//mlir:TransformUtils", - "//mlir:Transforms", - "//mlir:VectorDialect", - "//mlir:X86VectorDialect", - ], -) - -cc_library( - name = "TestMathToVCIX", - srcs = glob(["lib/Conversion/MathToVCIX/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//mlir:ArithDialect", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:MathDialect", - "//mlir:Pass", - "//mlir:TransformUtils", - "//mlir:Transforms", - "//mlir:VCIXDialect", - "//mlir:VectorDialect", - ], -) - -cc_library( - name = "TestMemRef", - srcs = glob(["lib/Dialect/MemRef/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - ":TestDialect", - "//mlir:AffineDialect", - "//mlir:ArithDialect", - "//mlir:ArithTransforms", - "//mlir:FuncDialect", - "//mlir:MemRefDialect", - "//mlir:MemRefTransforms", - "//mlir:Pass", - "//mlir:TransformUtils", - "//mlir:Transforms", - "//mlir:VectorDialect", - "//mlir:VectorTransforms", - ], -) - -cc_library( - name = "TestMesh", - srcs = glob(["lib/Dialect/Mesh/**/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - ":TestDialect", - "//mlir:ArithDialect", - "//mlir:DialectUtils", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:MeshDialect", - "//mlir:MeshTransforms", - "//mlir:Pass", - "//mlir:SPIRVDialect", - "//mlir:Support", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) - -cc_library( - name = "TestNVGPU", - srcs = glob(["lib/Dialect/NVGPU/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//mlir:AffineDialect", - "//mlir:Analysis", - "//mlir:FuncDialect", - "//mlir:GPUDialect", - "//mlir:IR", - "//mlir:LLVMDialect", - "//mlir:LinalgDialect", - "//mlir:LinalgTransforms", - "//mlir:MemRefDialect", - "//mlir:NVGPUDialect", - "//mlir:NVGPUTransforms", - "//mlir:Pass", - "//mlir:SCFDialect", - "//mlir:Support", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) - -cc_library( - name = "TestSCF", - srcs = glob(["lib/Dialect/SCF/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//llvm:Support", - "//mlir:ArithDialect", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:MathDialect", - "//mlir:MemRefDialect", - "//mlir:Pass", - "//mlir:SCFDialect", - "//mlir:SCFTransforms", - "//mlir:SCFUtils", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) - -cc_library( - name = "TestArith", - srcs = glob(["lib/Dialect/Arith/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//mlir:ArithDialect", - "//mlir:ArithTransforms", - "//mlir:FuncDialect", - "//mlir:LLVMDialect", - "//mlir:MathDialect", - "//mlir:Pass", - "//mlir:TransformUtils", - "//mlir:Transforms", - "//mlir:VectorDialect", - ], -) - -cc_library( - name = "TestArmNeon", - srcs = glob(["lib/Dialect/ArmNeon/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//mlir:ArmNeonDialect", - "//mlir:ArmNeonTransforms", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:Pass", - "//mlir:Support", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) - -cc_library( - name = "TestArmSME", - srcs = glob(["lib/Dialect/ArmSME/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//mlir:ArithToArmSME", - "//mlir:ArmSMEToLLVM", - "//mlir:ArmSMEToSCF", - "//mlir:ArmSMETransforms", - "//mlir:ArmSVETransforms", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:Pass", - "//mlir:SCFToControlFlow", - "//mlir:Transforms", - "//mlir:VectorToArmSME", - "//mlir:VectorToSCF", - ], -) - -cc_library( - name = "TestBufferization", - srcs = glob(["lib/Dialect/Bufferization/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//mlir:BufferizationDialect", - "//mlir:BufferizationTransforms", - "//mlir:IR", - "//mlir:Pass", - ], -) - -cc_library( - name = "TestControlFlow", - srcs = glob(["lib/Dialect/ControlFlow/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//mlir:ControlFlowDialect", - "//mlir:ControlFlowToLLVM", - "//mlir:FuncDialect", - "//mlir:LLVMCommonConversion", - "//mlir:LLVMDialect", - "//mlir:Pass", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) - -cc_library( - name = "TestShapeDialect", - srcs = [ - "lib/Dialect/Shape/TestShapeFunctions.cpp", - "lib/Dialect/Shape/TestShapeMappingAnalysis.cpp", - ], - deps = [ - "//llvm:Support", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:InferTypeOpInterface", - "//mlir:Pass", - "//mlir:ShapeDialect", - "//mlir:ShapeTransforms", - ], -) - -cc_library( - name = "TestSPIRV", - srcs = glob([ - "lib/Dialect/SPIRV/*.cpp", - ]), - deps = [ - "//mlir:FuncDialect", - "//mlir:GPUDialect", - "//mlir:IR", - "//mlir:Pass", - "//mlir:SPIRVConversion", - "//mlir:SPIRVDialect", - "//mlir:SPIRVModuleCombiner", - "//mlir:Transforms", - ], -) - -cc_library( - name = "TestFunc", - srcs = glob(["lib/Dialect/Func/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - ":TestDialect", - "//mlir:AffineDialect", - "//mlir:FuncDialect", - "//mlir:FuncTransforms", - "//mlir:IR", - "//mlir:Pass", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) - -cc_library( - name = "TestTensor", - srcs = glob(["lib/Dialect/Tensor/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//mlir:ArithDialect", - "//mlir:LinalgDialect", - "//mlir:Pass", - "//mlir:SCFDialect", - "//mlir:TensorDialect", - "//mlir:TensorTransforms", - "//mlir:TransformDialect", - "//mlir:TransformDialectInterfaces", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) - -cc_library( - name = "TestVector", - srcs = glob(["lib/Dialect/Vector/*.cpp"]), - includes = ["lib/Dialect/Test"], - deps = [ - "//mlir:AffineDialect", - "//mlir:Analysis", - "//mlir:ArithDialect", - "//mlir:FuncDialect", - "//mlir:GPUDialect", - "//mlir:LLVMDialect", - "//mlir:LinalgDialect", - "//mlir:LinalgTransforms", - "//mlir:MemRefDialect", - "//mlir:NVGPUDialect", - "//mlir:Pass", - "//mlir:SCFDialect", - "//mlir:Support", - "//mlir:TensorDialect", - "//mlir:TransformUtils", - "//mlir:Transforms", - "//mlir:VectorDialect", - "//mlir:VectorToSCF", - "//mlir:VectorTransforms", - "//mlir:X86VectorDialect", - ], -) - -cc_library( - name = "TestTosaDialect", - srcs = glob([ - "lib/Dialect/Tosa/*.cpp", - ]), - deps = [ - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:Pass", - "//mlir:TensorDialect", - "//mlir:TosaDialect", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) - -gentbl_cc_library( - name = "TestPDLLPatternsIncGen", - includes = ["lib/Dialect/Test"], - strip_include_prefix = "lib", - tbl_outs = [ - ( - ["-x=cpp"], - "lib/Tools/PDLL/TestPDLLPatterns.h.inc", - ), - ], - tblgen = "//mlir:mlir-pdll", - td_file = "lib/Tools/PDLL/TestPDLL.pdll", - deps = [ - ":TestDialect", - ":TestOpTdFiles", - ], -) - -gentbl_cc_library( - name = "TestDialectConversionPDLLPatternsIncGen", - includes = ["lib/Dialect/Test"], - strip_include_prefix = "lib", - tbl_outs = [ - ( - ["-x=cpp"], - "lib/TestDialectConversionPDLLPatterns.h.inc", - ), - ], - tblgen = "//mlir:mlir-pdll", - td_file = "lib/Transforms/TestDialectConversion.pdll", - deps = [ - ":TestDialect", - ":TestOpTdFiles", - "//mlir:DialectConversionPdllFiles", - ], -) - -cc_library( - name = "TestPDLL", - srcs = ["lib/Tools/PDLL/TestPDLL.cpp"], - includes = ["lib/Tools/PDLL"], - deps = [ - ":TestDialect", - ":TestPDLLPatternsIncGen", - "//mlir:CastInterfaces", - "//mlir:IR", - "//mlir:PDLDialect", - "//mlir:PDLInterpDialect", - "//mlir:Parser", - "//mlir:Pass", - "//mlir:Support", - "//mlir:TransformUtils", - "//mlir:Transforms", - ], -) diff --git a/utils/bazel/llvm-project-overlay/mlir/test/Conversion/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/Conversion/BUILD.bazel deleted file mode 100644 index b00e8f243c29a..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/Conversion/BUILD.bazel +++ /dev/null @@ -1,20 +0,0 @@ -load("//llvm:lit_test.bzl", "lit_test") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - data = [ - "//mlir:mlir-opt", - "//mlir/test:lit_data", - ], - ) - for src in glob( - include = ["**/*.mlir"], - exclude = ["GPUToROCm/lower-rocdl-kernel-to-hsaco.mlir"], - ) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/test/Dialect/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/Dialect/BUILD.bazel deleted file mode 100644 index 396b89c0a4a33..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/Dialect/BUILD.bazel +++ /dev/null @@ -1,35 +0,0 @@ -load("//llvm:lit_test.bzl", "lit_test") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - data = [ - "//llvm:llvm-symbolizer", - "//mlir:mlir-opt", - "//mlir:mlir-pdll", - "//mlir:mlir-reduce", - "//mlir:mlir-translate", - "//mlir/test:lit_data", - ] + glob([ - "IRDL/*.irdl.mlir", - "LLVM/*-symbol-def.mlir", - "Linalg/transpose-matmul-*.mlir", - "Transform/include/**/*.mlir", - ]), - ) - for src in glob( - include = ["**/*.mlir"], - exclude = [ - "IRDL/*.irdl.mlir", - "LLVM/*-symbol-def.mlir", - "Linalg/transpose-matmul-*.mlir", - "Transform/*-symbol-decl-and-schedule.mlir", - "Transform/include/**/*.mlir", - ], - ) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/test/IR/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/IR/BUILD.bazel deleted file mode 100644 index 83a17efbbd660..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/IR/BUILD.bazel +++ /dev/null @@ -1,17 +0,0 @@ -load("//llvm:lit_test.bzl", "lit_test") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - data = [ - "//mlir:mlir-opt", - "//mlir/test:lit_data", - ], - ) - for src in glob(["**/*.mlir"]) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/test/Pass/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/Pass/BUILD.bazel deleted file mode 100644 index 83a17efbbd660..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/Pass/BUILD.bazel +++ /dev/null @@ -1,17 +0,0 @@ -load("//llvm:lit_test.bzl", "lit_test") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - data = [ - "//mlir:mlir-opt", - "//mlir/test:lit_data", - ], - ) - for src in glob(["**/*.mlir"]) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/test/Rewrite/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/Rewrite/BUILD.bazel deleted file mode 100644 index 83a17efbbd660..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/Rewrite/BUILD.bazel +++ /dev/null @@ -1,17 +0,0 @@ -load("//llvm:lit_test.bzl", "lit_test") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - data = [ - "//mlir:mlir-opt", - "//mlir/test:lit_data", - ], - ) - for src in glob(["**/*.mlir"]) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/test/Target/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/Target/BUILD.bazel deleted file mode 100644 index 5dd22ea50e8da..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/Target/BUILD.bazel +++ /dev/null @@ -1,21 +0,0 @@ -load("//llvm:lit_test.bzl", "lit_test") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - data = [ - "//mlir:mlir-opt", - "//mlir:mlir-translate", - "//mlir/test:lit_data", - ], - ) - for src in glob([ - "**/*.mlir", - "**/*.ll", - ]) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/test/Transforms/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/Transforms/BUILD.bazel deleted file mode 100644 index 83a17efbbd660..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/Transforms/BUILD.bazel +++ /dev/null @@ -1,17 +0,0 @@ -load("//llvm:lit_test.bzl", "lit_test") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - data = [ - "//mlir:mlir-opt", - "//mlir/test:lit_data", - ], - ) - for src in glob(["**/*.mlir"]) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/test/mlir-linalg-ods-gen/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/mlir-linalg-ods-gen/BUILD.bazel deleted file mode 100644 index 70d6bbcda7cdf..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/mlir-linalg-ods-gen/BUILD.bazel +++ /dev/null @@ -1,19 +0,0 @@ -load("//llvm:lit_test.bzl", "lit_test") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - data = [ - "//mlir:LinalgStructuredOpsTdFiles", - "//mlir:mlir-linalg-ods-yaml-gen", - "//mlir:mlir-tblgen", - "//mlir/test:lit_data", - ], - ) - for src in glob(["**/*.yaml"]) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/test/mlir-lsp-server/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/mlir-lsp-server/BUILD.bazel deleted file mode 100644 index 409e44ebab6a4..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/mlir-lsp-server/BUILD.bazel +++ /dev/null @@ -1,17 +0,0 @@ -load("//llvm:lit_test.bzl", "lit_test") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - data = [ - "//mlir:mlir-lsp-server", - "//mlir/test:lit_data", - ], - ) - for src in glob(["**/*.test"]) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/test/mlir-opt/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/mlir-opt/BUILD.bazel deleted file mode 100644 index 83a17efbbd660..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/mlir-opt/BUILD.bazel +++ /dev/null @@ -1,17 +0,0 @@ -load("//llvm:lit_test.bzl", "lit_test") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - data = [ - "//mlir:mlir-opt", - "//mlir/test:lit_data", - ], - ) - for src in glob(["**/*.mlir"]) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/test/mlir-pdll/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/mlir-pdll/BUILD.bazel deleted file mode 100644 index 6d0580d803f6c..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/mlir-pdll/BUILD.bazel +++ /dev/null @@ -1,25 +0,0 @@ -load("//llvm:lit_test.bzl", "lit_test") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - data = glob([ - "Parser/include/**", - "CodeGen/MLIR/include/**", - "CodeGen/CPP/include/**", - ]) + [ - "//mlir:OpBaseTdFiles", - "//mlir:mlir-pdll", - "//mlir/test:lit_data", - ], - ) - for src in glob( - include = ["**/*.pdll"], - exclude = ["Parser/include/included.pdll"], - ) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/test/mlir-tblgen/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/mlir-tblgen/BUILD.bazel deleted file mode 100644 index 3f00adb63b8d3..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/mlir-tblgen/BUILD.bazel +++ /dev/null @@ -1,43 +0,0 @@ -load("//llvm:lit_test.bzl", "lit_test") - -licenses(["notice"]) - -package(default_visibility = ["//visibility:public"]) - -[ - lit_test( - name = "%s.test" % src, - srcs = [src], - data = [ - "//llvm:include/llvm/CodeGen/SDNodeProperties.td", - "//llvm:include/llvm/CodeGen/ValueTypes.td", - "//llvm:include/llvm/Frontend/Directive/DirectiveBase.td", - "//llvm:include/llvm/Frontend/OpenMP/OMP.td", - "//llvm:include/llvm/IR/Intrinsics.td", - "//mlir:BuiltinDialectBytecodeTdFiles", - "//mlir:SideEffectInterfacesTdFiles", - "//mlir:include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td", - "//mlir:include/mlir/Dialect/LLVMIR/LLVMDialect.td", - "//mlir:include/mlir/Dialect/LLVMIR/LLVMInterfaces.td", - "//mlir:include/mlir/Dialect/LLVMIR/LLVMOpBase.td", - "//mlir:include/mlir/Dialect/OpenMP/OpenMPAttrDefs.td", - "//mlir:include/mlir/Dialect/OpenMP/OpenMPDialect.td", - "//mlir:include/mlir/Dialect/OpenMP/OpenMPEnums.td", - "//mlir:include/mlir/Dialect/OpenMP/OpenMPOpBase.td", - "//mlir:include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td", - "//mlir:include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.td", - "//mlir:include/mlir/IR/BuiltinDialectBytecode.td", - "//mlir:include/mlir/IR/BytecodeBase.td", - "//mlir:include/mlir/IR/OpBase.td", - "//mlir:include/mlir/Interfaces/InferTypeOpInterface.td", - "//mlir:include/mlir/Interfaces/SideEffectInterfaces.td", - "//mlir:mlir-opt", - "//mlir:mlir-tblgen", - "//mlir/test:lit_data", - ], - ) - for src in glob([ - "**/*.mlir", - "**/*.td", - ]) -] diff --git a/utils/bazel/llvm-project-overlay/mlir/test/python/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/python/BUILD.bazel deleted file mode 100644 index 74eaa33a2faa2..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/test/python/BUILD.bazel +++ /dev/null @@ -1,10 +0,0 @@ -# This file is licensed 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 - -licenses(["notice"]) - -exports_files( - srcs = ["python_test_ops.td"], - visibility = ["//visibility:public"], -) diff --git a/utils/bazel/llvm-project-overlay/mlir/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/unittests/BUILD.bazel deleted file mode 100644 index 7172beb4de9a6..0000000000000 --- a/utils/bazel/llvm-project-overlay/mlir/unittests/BUILD.bazel +++ /dev/null @@ -1,423 +0,0 @@ -# This file is licensed 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 - -load("//mlir:tblgen.bzl", "gentbl_cc_library") - -package( - default_visibility = ["//visibility:public"], - features = ["layering_check"], -) - -licenses(["notice"]) - -cc_test( - name = "debug_tests", - size = "small", - srcs = glob([ - "Debug/*.cpp", - ]), - deps = [ - "//llvm:Support", - "//llvm:TestingSupport", - "//mlir:Debug", - "//mlir:IR", - "//mlir:Support", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "ir_tests", - size = "small", - srcs = glob([ - "IR/*.cpp", - ]), - deps = [ - "//llvm:Support", - "//mlir:BytecodeReader", - "//mlir:CallOpInterfaces", - "//mlir:FunctionInterfaces", - "//mlir:IR", - "//mlir:Parser", - "//mlir:Support", - "//mlir/test:TestDialect", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "interface_tests", - size = "small", - srcs = glob([ - "Interfaces/*.cpp", - ]), - deps = [ - "//llvm:Support", - "//llvm:TestingSupport", - "//mlir:ArithDialect", - "//mlir:BytecodeReader", - "//mlir:ControlFlowInterfaces", - "//mlir:DLTIDialect", - "//mlir:DataLayoutInterfaces", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:InferIntRangeInterface", - "//mlir:InferTypeOpInterface", - "//mlir:Parser", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "support_tests", - size = "small", - srcs = glob([ - "Support/*.cpp", - ]), - deps = [ - "//llvm:Support", - "//llvm:TestingSupport", - "//mlir:Support", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "pass_tests", - size = "small", - srcs = glob([ - "Pass/*.cpp", - ]), - deps = [ - "//llvm:Support", - "//llvm:TestingSupport", - "//mlir:Analysis", - "//mlir:Debug", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:Pass", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "rewrite_tests", - size = "small", - srcs = glob([ - "Rewrite/*.cpp", - ]), - deps = [ - "//mlir:IR", - "//mlir:Rewrite", - "//mlir:SideEffectInterfaces", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "dialect_tests", - size = "small", - srcs = glob([ - "Dialect/*.cpp", - ]), - deps = [ - "//llvm:Support", - "//mlir:Dialect", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "memref_tests", - size = "small", - srcs = glob([ - "Dialect/MemRef/*.cpp", - ]), - deps = [ - "//llvm:TestingSupport", - "//mlir:IR", - "//mlir:MemRefDialect", - "//mlir:SideEffectInterfaces", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "scf_tests", - size = "small", - srcs = glob([ - "Dialect/SCF/*.cpp", - ]), - deps = [ - "//mlir:ArithDialect", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:Parser", - "//mlir:SCFDialect", - "//mlir:SideEffectInterfaces", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "sparse_tensor_tests", - size = "small", - srcs = glob([ - "Dialect/SparseTensor/*.cpp", - ]), - deps = [ - "//llvm:Support", - "//llvm:TestingSupport", - "//mlir:SideEffectInterfaces", - "//mlir:SparseTensorUtils", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "spirv_tests", - size = "small", - srcs = glob([ - "Dialect/SPIRV/*.cpp", - ]), - deps = [ - "//llvm:Support", - "//llvm:TestingSupport", - "//mlir:IR", - "//mlir:SPIRVBinaryUtils", - "//mlir:SPIRVDeserialization", - "//mlir:SPIRVDialect", - "//mlir:SPIRVSerialization", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "transform_dialect_tests", - size = "small", - srcs = glob([ - "Dialect/Transform/*.cpp", - ]), - deps = [ - "//llvm:Support", - "//llvm:TestingSupport", - "//mlir:BytecodeReader", - "//mlir:FuncDialect", - "//mlir:IR", - "//mlir:MlirOptLib", - "//mlir:Parser", - "//mlir:Pass", - "//mlir:Support", - "//mlir:TransformDebugExtension", - "//mlir:TransformDialect", - "//mlir:TransformDialectTransforms", - "//mlir/test:TestTransformDialect", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "dialect_utils_tests", - size = "small", - srcs = glob([ - "Dialect/Utils/*.cpp", - ]), - deps = [ - "//llvm:Support", - "//llvm:TestingSupport", - "//mlir:DialectUtils", - "//mlir:IR", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -gentbl_cc_library( - name = "EnumsIncGen", - tbl_outs = [ - ( - ["-gen-enum-decls"], - "TableGen/EnumsGenTest.h.inc", - ), - ( - ["-gen-enum-defs"], - "TableGen/EnumsGenTest.cpp.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "TableGen/enums.td", - deps = [ - "//mlir:OpBaseTdFiles", - ], -) - -gentbl_cc_library( - name = "PassIncGen", - tbl_outs = [ - ( - ["-gen-pass-decls"], - "TableGen/PassGenTest.h.inc", - ), - ], - tblgen = "//mlir:mlir-tblgen", - td_file = "TableGen/passes.td", - deps = [ - "//mlir:PassBaseTdFiles", - "//mlir:RewritePassBaseTdFiles", - ], -) - -cc_test( - name = "tablegen_tests", - size = "small", - srcs = glob([ - "TableGen/*.cpp", - ]) + [ - "TableGen/EnumsGenTest.cpp.inc", - "TableGen/EnumsGenTest.h.inc", - ], - includes = ["TableGen/"], - deps = [ - ":EnumsIncGen", - ":PassIncGen", - "//llvm:Support", - "//llvm:TestingSupport", - "//mlir:IR", - "//mlir:Pass", - "//mlir:Support", - "//mlir:TableGen", - "//mlir/test:TestDialect", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "transforms_test", - size = "small", - srcs = glob([ - "Transforms/*.cpp", - ]), - deps = [ - "//mlir:AffineAnalysis", - "//mlir:BytecodeReader", - "//mlir:IR", - "//mlir:Parser", - "//mlir:Pass", - "//mlir:SideEffectInterfaces", - "//mlir:TransformUtils", - "//mlir:Transforms", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "analysis_tests", - size = "small", - srcs = glob([ - "Analysis/*/*.cpp", - "Analysis/*/*.h", - ]), - deps = [ - "//llvm:TestingSupport", - "//mlir:AffineAnalysis", - "//mlir:Analysis", - "//mlir:AsmParser", - "//mlir:IR", - "//mlir:Parser", - "//mlir:Support", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "bytecode_tests", - size = "small", - srcs = glob([ - "Bytecode/*.cpp", - ]), - deps = [ - "//llvm:Support", - "//mlir:BytecodeReader", - "//mlir:BytecodeWriter", - "//mlir:IR", - "//mlir:Parser", - "//mlir:SideEffectInterfaces", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "conversion_tests", - size = "small", - srcs = glob([ - "Conversion/*/*.cpp", - ]), - deps = [ - "//mlir:ArithDialect", - "//mlir:IR", - "//mlir:PDLToPDLInterp", - "//third-party/unittest:gtest", - "//third-party/unittest:gtest_main", - ], -) - -cc_test( - name = "execution_engine_tests", - size = "small", - srcs = glob([ - "ExecutionEngine/*.cpp", - ]), - tags = [ - # MSAN does not work with JIT. - "nomsan", - ], - deps = [ - "//llvm:Support", - "//llvm:TestingSupport", - "//mlir:AllPassesAndDialects", - "//mlir:Analysis", - "//mlir:ArithToLLVM", - "//mlir:BuiltinToLLVMIRTranslation", - "//mlir:BytecodeReader", - "//mlir:ExecutionEngine", - "//mlir:FuncDialect", - "//mlir:FuncToLLVM", - "//mlir:IR", - "//mlir:LLVMToLLVMIRTranslation", - "//mlir:LinalgTransforms", - "//mlir:MemRefToLLVM", - "//mlir:Parser", - "//mlir:Pass", - "//mlir:ReconcileUnrealizedCasts", - "//mlir:ToLLVMIRTranslation", - "//mlir:VectorToLLVM", - "//mlir:VectorToSCF", - "//mlir:mlir_c_runner_utils", - "//mlir:mlir_runner_utils", - "//third-party/unittest:gmock", - "//third-party/unittest:gtest_main", - ], -) diff --git a/utils/bazel/llvm-project-overlay/third-party/unittest/BUILD.bazel b/utils/bazel/llvm-project-overlay/third-party/unittest/BUILD.bazel deleted file mode 100644 index 0b5c084086ed9..0000000000000 --- a/utils/bazel/llvm-project-overlay/third-party/unittest/BUILD.bazel +++ /dev/null @@ -1,113 +0,0 @@ -# This file is licensed 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 - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -exports_files(["LICENSE.TXT"]) - -# It may be tempting to add compiler flags here, but that should be avoided. -# The necessary warnings and other compile flags should be provided by the -# toolchain or the `.bazelrc` file. This is just a workaround until we have a -# widely available feature to enable unlimited stack frame instead of using -# this `Make` variable. -llvm_copts = [ - "$(STACK_FRAME_UNLIMITED)", -] - -# A hacky library to expose some internal headers of gtest to its own -# implementation source files using a stripped include prefix rather than -# file-relative-inclusion. -# -# FIXME: This file should be in `textual_hdrs` instead of `hdrs`, but -# unfortunately that doesn't work with `strip_include_prefix`: -# https://github.com/bazelbuild/bazel/issues/12424 -# -# For now, simply disable parsing and header modules. -cc_library( - name = "gtest_internal_headers", - testonly = True, - hdrs = ["googletest/src/gtest-internal-inl.h"], - features = [ - "-parse_headers", - "-header_modules", - ], - strip_include_prefix = "googletest", -) - -cc_library( - name = "gtest", - testonly = True, - srcs = glob( - [ - "googletest/include/**/*.h", - "googletest/src/*.cc", - ], - exclude = [ - "googletest/src/gtest-all.cc", - "googletest/include/gtest/gtest_pred_impl.h", - ], - ) + [ - ], - hdrs = [ - "googletest/include/gtest/gtest.h", - "googletest/include/gtest/gtest-spi.h", - "googletest/include/gtest/internal/gtest-port.h", - ], - copts = llvm_copts, - defines = [ - "GTEST_HAS_RTTI=0", - "__STDC_LIMIT_MACROS", - "__STDC_CONSTANT_MACROS", - ] + select({ - "@platforms//os:windows": ["GTEST_USE_OWN_TR1_TUPLE=0"], - "//conditions:default": ["GTEST_USE_OWN_TR1_TUPLE=1"], - }), - includes = [ - "googletest/include", - "include", - ], - textual_hdrs = [ - "googletest/include/gtest/gtest_pred_impl.h", - ], - deps = [ - ":gtest_internal_headers", - "//llvm:Support", - ], -) - -cc_library( - name = "gtest_main", - testonly = True, - srcs = ["UnitTestMain/TestMain.cpp"], - copts = llvm_copts, - deps = [ - ":gmock", - ":gtest", - "//llvm:Support", - ], -) - -cc_library( - name = "gmock", - testonly = True, - srcs = glob( - [ - "googlemock/include/**/*.h", - "googlemock/src/*.cc", - ], - exclude = ["googlemock/src/gmock-all.cc"], - ), - hdrs = [ - "googlemock/include/gmock/gmock.h", - "googlemock/include/gmock/gmock-matchers.h", - ], - copts = llvm_copts, - includes = [ - "googlemock/include", - "include", - ], - deps = [":gtest"], -) diff --git a/utils/bazel/llvm-project-overlay/workspace_root.bzl b/utils/bazel/llvm-project-overlay/workspace_root.bzl deleted file mode 100644 index 2932fb143cefc..0000000000000 --- a/utils/bazel/llvm-project-overlay/workspace_root.bzl +++ /dev/null @@ -1,17 +0,0 @@ -def _workspace_root_impl(ctx): - """Dynamically determine the workspace root from the current context. - - The path is made available as a `WORKSPACE_ROOT` environmment variable and - may for instance be consumed in the `toolchains` attributes for `cc_library` - and `genrule` targets. - """ - return [ - platform_common.TemplateVariableInfo({ - "WORKSPACE_ROOT": ctx.label.workspace_root, - }), - ] - -workspace_root = rule( - implementation = _workspace_root_impl, - attrs = {}, -) diff --git a/utils/bazel/llvm_configs/BUILD.bazel b/utils/bazel/llvm_configs/BUILD.bazel deleted file mode 100644 index 5a4f9970c0636..0000000000000 --- a/utils/bazel/llvm_configs/BUILD.bazel +++ /dev/null @@ -1,30 +0,0 @@ -# This file is licensed 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 - -# These diff tests ensure that the current Bazel configuration does not drift -# from the configuration in the .cmake files, since we don't alway use them -# directly (and even if we did we wouldn't necessarily pick up changes there). -# These are literal change-detector tests. We perform diff testing here since -# it isn't really part of building LLVM and we don't want to include the config -# copies in the workspace used by dependent projects. - -load("@bazel_skylib//rules:diff_test.bzl", "diff_test") - -diff_test( - name = "diff_config.h.cmake", - file1 = "@llvm-project//llvm:include/llvm/Config/config.h.cmake", - file2 = "config.h.cmake", -) - -diff_test( - name = "diff_llvm-config.h.cmake", - file1 = "@llvm-project//llvm:include/llvm/Config/llvm-config.h.cmake", - file2 = "llvm-config.h.cmake", -) - -diff_test( - name = "diff_abi-breaking.h.cmake", - file1 = "@llvm-project//llvm:include/llvm/Config/abi-breaking.h.cmake", - file2 = "abi-breaking.h.cmake", -) diff --git a/utils/bazel/llvm_configs/abi-breaking.h.cmake b/utils/bazel/llvm_configs/abi-breaking.h.cmake deleted file mode 100644 index 2d27e02b1d545..0000000000000 --- a/utils/bazel/llvm_configs/abi-breaking.h.cmake +++ /dev/null @@ -1,62 +0,0 @@ -/*===------- llvm/Config/abi-breaking.h - llvm configuration -------*- 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 */ -/* */ -/*===----------------------------------------------------------------------===*/ - -/* This file controls the C++ ABI break introduced in LLVM public header. */ - -#ifndef LLVM_ABI_BREAKING_CHECKS_H -#define LLVM_ABI_BREAKING_CHECKS_H - -/* Define to enable checks that alter the LLVM C++ ABI */ -#cmakedefine01 LLVM_ENABLE_ABI_BREAKING_CHECKS - -/* Define to enable reverse iteration of unordered llvm containers */ -#cmakedefine01 LLVM_ENABLE_REVERSE_ITERATION - -/* Allow selectively disabling link-time mismatch checking so that header-only - ADT content from LLVM can be used without linking libSupport. */ -#if !defined(LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING) || !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING - -// ABI_BREAKING_CHECKS protection: provides link-time failure when clients build -// mismatch with LLVM -#if defined(_MSC_VER) -// Use pragma with MSVC -#define LLVM_XSTR(s) LLVM_STR(s) -#define LLVM_STR(s) #s -#pragma detect_mismatch("LLVM_ENABLE_ABI_BREAKING_CHECKS", LLVM_XSTR(LLVM_ENABLE_ABI_BREAKING_CHECKS)) -#undef LLVM_XSTR -#undef LLVM_STR -#elif defined(_WIN32) || defined(__CYGWIN__) // Win32 w/o #pragma detect_mismatch -// FIXME: Implement checks without weak. -#elif defined(__cplusplus) -#if !(defined(_AIX) && defined(__GNUC__) && !defined(__clang__)) -#define LLVM_HIDDEN_VISIBILITY __attribute__ ((visibility("hidden"))) -#else -// GCC on AIX does not support visibility attributes. Symbols are not -// exported by default on AIX. -#define LLVM_HIDDEN_VISIBILITY -#endif -namespace llvm { -#if LLVM_ENABLE_ABI_BREAKING_CHECKS -extern int EnableABIBreakingChecks; -LLVM_HIDDEN_VISIBILITY -__attribute__((weak)) int *VerifyEnableABIBreakingChecks = - &EnableABIBreakingChecks; -#else -extern int DisableABIBreakingChecks; -LLVM_HIDDEN_VISIBILITY -__attribute__((weak)) int *VerifyDisableABIBreakingChecks = - &DisableABIBreakingChecks; -#endif -} -#undef LLVM_HIDDEN_VISIBILITY -#endif // _MSC_VER - -#endif // LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING - -#endif diff --git a/utils/bazel/llvm_configs/config.h.cmake b/utils/bazel/llvm_configs/config.h.cmake deleted file mode 100644 index ff30741c8f360..0000000000000 --- a/utils/bazel/llvm_configs/config.h.cmake +++ /dev/null @@ -1,336 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -// Include this header only under the llvm source tree. -// This is a private header. - -/* Exported configuration */ -#include "llvm/Config/llvm-config.h" - -/* Bug report URL. */ -#define BUG_REPORT_URL "${BUG_REPORT_URL}" - -/* Define to 1 to enable backtraces, and to 0 otherwise. */ -#cmakedefine01 ENABLE_BACKTRACES - -/* Define to 1 to enable crash overrides, and to 0 otherwise. */ -#cmakedefine01 ENABLE_CRASH_OVERRIDES - -/* Define to 1 to enable crash memory dumps, and to 0 otherwise. */ -#cmakedefine01 LLVM_ENABLE_CRASH_DUMPS - -/* Define to 1 to prefer forward slashes on Windows, and to 0 prefer - backslashes. */ -#cmakedefine01 LLVM_WINDOWS_PREFER_FORWARD_SLASH - -/* Define to 1 if you have the `backtrace' function. */ -#cmakedefine HAVE_BACKTRACE ${HAVE_BACKTRACE} - -#define BACKTRACE_HEADER <${BACKTRACE_HEADER}> - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_CRASHREPORTERCLIENT_H - -/* can use __crashreporter_info__ */ -#cmakedefine01 HAVE_CRASHREPORTER_INFO - -/* Define to 1 if you have the declaration of `arc4random', and to 0 if you - don't. */ -#cmakedefine01 HAVE_DECL_ARC4RANDOM - -/* Define to 1 if you have the declaration of `FE_ALL_EXCEPT', and to 0 if you - don't. */ -#cmakedefine01 HAVE_DECL_FE_ALL_EXCEPT - -/* Define to 1 if you have the declaration of `FE_INEXACT', and to 0 if you - don't. */ -#cmakedefine01 HAVE_DECL_FE_INEXACT - -/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you - don't. */ -#cmakedefine01 HAVE_DECL_STRERROR_S - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H} - -/* Define if dlopen() is available on this platform. */ -#cmakedefine HAVE_DLOPEN ${HAVE_DLOPEN} - -/* Define if dladdr() is available on this platform. */ -#cmakedefine HAVE_DLADDR ${HAVE_DLADDR} - -/* Define to 1 if we can register EH frames on this platform. */ -#cmakedefine HAVE_REGISTER_FRAME ${HAVE_REGISTER_FRAME} - -/* Define to 1 if we can deregister EH frames on this platform. */ -#cmakedefine HAVE_DEREGISTER_FRAME ${HAVE_DEREGISTER_FRAME} - -/* Define if __unw_add_dynamic_fde() is available on this platform. */ -#cmakedefine HAVE_UNW_ADD_DYNAMIC_FDE ${HAVE_UNW_ADD_DYNAMIC_FDE} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_ERRNO_H ${HAVE_ERRNO_H} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_FCNTL_H ${HAVE_FCNTL_H} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_FENV_H ${HAVE_FENV_H} - -/* Define if libffi is available on this platform. */ -#cmakedefine HAVE_FFI_CALL ${HAVE_FFI_CALL} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_FFI_FFI_H ${HAVE_FFI_FFI_H} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_FFI_H ${HAVE_FFI_H} - -/* Define to 1 if you have the `futimens' function. */ -#cmakedefine HAVE_FUTIMENS ${HAVE_FUTIMENS} - -/* Define to 1 if you have the `futimes' function. */ -#cmakedefine HAVE_FUTIMES ${HAVE_FUTIMES} - -/* Define to 1 if you have the `getpagesize' function. */ -#cmakedefine HAVE_GETPAGESIZE ${HAVE_GETPAGESIZE} - -/* Define to 1 if you have the `getrlimit' function. */ -#cmakedefine HAVE_GETRLIMIT ${HAVE_GETRLIMIT} - -/* Define to 1 if you have the `getrusage' function. */ -#cmakedefine HAVE_GETRUSAGE ${HAVE_GETRUSAGE} - -/* Define to 1 if you have the `isatty' function. */ -#cmakedefine HAVE_ISATTY 1 - -/* Define to 1 if you have the `edit' library (-ledit). */ -#cmakedefine HAVE_LIBEDIT ${HAVE_LIBEDIT} - -/* Define to 1 if you have the `pfm' library (-lpfm). */ -#cmakedefine HAVE_LIBPFM ${HAVE_LIBPFM} - -/* Define to 1 if the `perf_branch_entry' struct has field cycles. */ -#cmakedefine LIBPFM_HAS_FIELD_CYCLES ${LIBPFM_HAS_FIELD_CYCLES} - -/* Define to 1 if you have the `psapi' library (-lpsapi). */ -#cmakedefine HAVE_LIBPSAPI ${HAVE_LIBPSAPI} - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -#cmakedefine HAVE_LIBPTHREAD ${HAVE_LIBPTHREAD} - -/* Define to 1 if you have the `pthread_getname_np' function. */ -#cmakedefine HAVE_PTHREAD_GETNAME_NP ${HAVE_PTHREAD_GETNAME_NP} - -/* Define to 1 if you have the `pthread_setname_np' function. */ -#cmakedefine HAVE_PTHREAD_SETNAME_NP ${HAVE_PTHREAD_SETNAME_NP} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LINK_H ${HAVE_LINK_H} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H} - -/* Define to 1 if you have the `mallctl' function. */ -#cmakedefine HAVE_MALLCTL ${HAVE_MALLCTL} - -/* Define to 1 if you have the `mallinfo' function. */ -#cmakedefine HAVE_MALLINFO ${HAVE_MALLINFO} - -/* Define to 1 if you have the `mallinfo2' function. */ -#cmakedefine HAVE_MALLINFO2 ${HAVE_MALLINFO2} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_MALLOC_MALLOC_H ${HAVE_MALLOC_MALLOC_H} - -/* Define to 1 if you have the `malloc_zone_statistics' function. */ -#cmakedefine HAVE_MALLOC_ZONE_STATISTICS ${HAVE_MALLOC_ZONE_STATISTICS} - -/* Define to 1 if you have the `posix_spawn' function. */ -#cmakedefine HAVE_POSIX_SPAWN ${HAVE_POSIX_SPAWN} - -/* Define to 1 if you have the `pread' function. */ -#cmakedefine HAVE_PREAD ${HAVE_PREAD} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_PTHREAD_H ${HAVE_PTHREAD_H} - -/* Have pthread_mutex_lock */ -#cmakedefine HAVE_PTHREAD_MUTEX_LOCK ${HAVE_PTHREAD_MUTEX_LOCK} - -/* Have pthread_rwlock_init */ -#cmakedefine HAVE_PTHREAD_RWLOCK_INIT ${HAVE_PTHREAD_RWLOCK_INIT} - -/* Define to 1 if you have the `sbrk' function. */ -#cmakedefine HAVE_SBRK ${HAVE_SBRK} - -/* Define to 1 if you have the `setenv' function. */ -#cmakedefine HAVE_SETENV ${HAVE_SETENV} - -/* Define to 1 if you have the `setrlimit' function. */ -#cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT} - -/* Define to 1 if you have the `sigaltstack' function. */ -#cmakedefine HAVE_SIGALTSTACK ${HAVE_SIGALTSTACK} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SIGNAL_H ${HAVE_SIGNAL_H} - -/* Define to 1 if you have the `strerror_r' function. */ -#cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R} - -/* Define to 1 if you have the `sysconf' function. */ -#cmakedefine HAVE_SYSCONF ${HAVE_SYSCONF} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_IOCTL_H ${HAVE_SYS_IOCTL_H} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_MMAN_H ${HAVE_SYS_MMAN_H} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_PARAM_H ${HAVE_SYS_PARAM_H} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TIME_H ${HAVE_SYS_TIME_H} - -/* Define to 1 if stat struct has st_mtimespec member .*/ -#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC ${HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC} - -/* Define to 1 if stat struct has st_mtim member. */ -#cmakedefine HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC ${HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_TERMIOS_H ${HAVE_TERMIOS_H} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H} - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_VALGRIND_VALGRIND_H ${HAVE_VALGRIND_VALGRIND_H} - -/* Have host's _alloca */ -#cmakedefine HAVE__ALLOCA ${HAVE__ALLOCA} - -/* Define to 1 if you have the `_chsize_s' function. */ -#cmakedefine HAVE__CHSIZE_S ${HAVE__CHSIZE_S} - -/* Define to 1 if you have the `_Unwind_Backtrace' function. */ -#cmakedefine HAVE__UNWIND_BACKTRACE ${HAVE__UNWIND_BACKTRACE} - -/* Have host's __alloca */ -#cmakedefine HAVE___ALLOCA ${HAVE___ALLOCA} - -/* Have host's __ashldi3 */ -#cmakedefine HAVE___ASHLDI3 ${HAVE___ASHLDI3} - -/* Have host's __ashrdi3 */ -#cmakedefine HAVE___ASHRDI3 ${HAVE___ASHRDI3} - -/* Have host's __chkstk */ -#cmakedefine HAVE___CHKSTK ${HAVE___CHKSTK} - -/* Have host's __chkstk_ms */ -#cmakedefine HAVE___CHKSTK_MS ${HAVE___CHKSTK_MS} - -/* Have host's __cmpdi2 */ -#cmakedefine HAVE___CMPDI2 ${HAVE___CMPDI2} - -/* Have host's __divdi3 */ -#cmakedefine HAVE___DIVDI3 ${HAVE___DIVDI3} - -/* Have host's __fixdfdi */ -#cmakedefine HAVE___FIXDFDI ${HAVE___FIXDFDI} - -/* Have host's __fixsfdi */ -#cmakedefine HAVE___FIXSFDI ${HAVE___FIXSFDI} - -/* Have host's __floatdidf */ -#cmakedefine HAVE___FLOATDIDF ${HAVE___FLOATDIDF} - -/* Have host's __lshrdi3 */ -#cmakedefine HAVE___LSHRDI3 ${HAVE___LSHRDI3} - -/* Have host's __main */ -#cmakedefine HAVE___MAIN ${HAVE___MAIN} - -/* Have host's __moddi3 */ -#cmakedefine HAVE___MODDI3 ${HAVE___MODDI3} - -/* Have host's __udivdi3 */ -#cmakedefine HAVE___UDIVDI3 ${HAVE___UDIVDI3} - -/* Have host's __umoddi3 */ -#cmakedefine HAVE___UMODDI3 ${HAVE___UMODDI3} - -/* Have host's ___chkstk */ -#cmakedefine HAVE____CHKSTK ${HAVE____CHKSTK} - -/* Have host's ___chkstk_ms */ -#cmakedefine HAVE____CHKSTK_MS ${HAVE____CHKSTK_MS} - -/* Linker version detected at compile time. */ -#cmakedefine HOST_LINK_VERSION "${HOST_LINK_VERSION}" - -/* Define if overriding target triple is enabled */ -#cmakedefine LLVM_TARGET_TRIPLE_ENV "${LLVM_TARGET_TRIPLE_ENV}" - -/* Whether tools show host and target info when invoked with --version */ -#cmakedefine01 LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO - -/* Whether tools show optional build config flags when invoked with --version */ -#cmakedefine01 LLVM_VERSION_PRINTER_SHOW_BUILD_CONFIG - -/* Define if libxml2 is supported on this platform. */ -#cmakedefine LLVM_ENABLE_LIBXML2 ${LLVM_ENABLE_LIBXML2} - -/* Define to the extension used for shared libraries, say, ".so". */ -#cmakedefine LTDL_SHLIB_EXT "${LTDL_SHLIB_EXT}" - -/* Define to the extension used for plugin libraries, say, ".so". */ -#cmakedefine LLVM_PLUGIN_EXT "${LLVM_PLUGIN_EXT}" - -/* Define to the address where bug reports for this package should be sent. */ -#cmakedefine PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}" - -/* Define to the full name of this package. */ -#cmakedefine PACKAGE_NAME "${PACKAGE_NAME}" - -/* Define to the full name and version of this package. */ -#cmakedefine PACKAGE_STRING "${PACKAGE_STRING}" - -/* Define to the version of this package. */ -#cmakedefine PACKAGE_VERSION "${PACKAGE_VERSION}" - -/* Define to the vendor of this package. */ -#cmakedefine PACKAGE_VENDOR "${PACKAGE_VENDOR}" - -/* Define to a function implementing stricmp */ -#cmakedefine stricmp ${stricmp} - -/* Define to a function implementing strdup */ -#cmakedefine strdup ${strdup} - -/* Whether GlobalISel rule coverage is being collected */ -#cmakedefine01 LLVM_GISEL_COV_ENABLED - -/* Define to the default GlobalISel coverage file prefix */ -#cmakedefine LLVM_GISEL_COV_PREFIX "${LLVM_GISEL_COV_PREFIX}" - -/* Whether Timers signpost passes in Xcode Instruments */ -#cmakedefine01 LLVM_SUPPORT_XCODE_SIGNPOSTS - -#cmakedefine HAVE_PROC_PID_RUSAGE 1 - -#cmakedefine HAVE_BUILTIN_THREAD_POINTER ${HAVE_BUILTIN_THREAD_POINTER} - -#endif diff --git a/utils/bazel/llvm_configs/llvm-config.h.cmake b/utils/bazel/llvm_configs/llvm-config.h.cmake deleted file mode 100644 index 629977cc11d68..0000000000000 --- a/utils/bazel/llvm_configs/llvm-config.h.cmake +++ /dev/null @@ -1,204 +0,0 @@ -/*===------- llvm/Config/llvm-config.h - llvm configuration -------*- 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 */ -/* */ -/*===----------------------------------------------------------------------===*/ - -/* This file enumerates variables from the LLVM configuration so that they - can be in exported headers and won't override package specific directives. - This is a C header that can be included in the llvm-c headers. */ - -#ifndef LLVM_CONFIG_H -#define LLVM_CONFIG_H - -/* Define if LLVM_ENABLE_DUMP is enabled */ -#cmakedefine LLVM_ENABLE_DUMP - -/* Target triple LLVM will generate code for by default */ -/* Doesn't use `cmakedefine` because it is allowed to be empty. */ -#define LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" - -/* Define if threads enabled */ -#cmakedefine01 LLVM_ENABLE_THREADS - -/* Has gcc/MSVC atomic intrinsics */ -#cmakedefine01 LLVM_HAS_ATOMICS - -/* Host triple LLVM will be executed on */ -#cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}" - -/* LLVM architecture name for the native architecture, if available */ -#cmakedefine LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH} - -/* LLVM name for the native AsmParser init function, if available */ -#cmakedefine LLVM_NATIVE_ASMPARSER LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser - -/* LLVM name for the native AsmPrinter init function, if available */ -#cmakedefine LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter - -/* LLVM name for the native Disassembler init function, if available */ -#cmakedefine LLVM_NATIVE_DISASSEMBLER LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler - -/* LLVM name for the native Target init function, if available */ -#cmakedefine LLVM_NATIVE_TARGET LLVMInitialize${LLVM_NATIVE_ARCH}Target - -/* LLVM name for the native TargetInfo init function, if available */ -#cmakedefine LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo - -/* LLVM name for the native target MC init function, if available */ -#cmakedefine LLVM_NATIVE_TARGETMC LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC - -/* LLVM name for the native target MCA init function, if available */ -#cmakedefine LLVM_NATIVE_TARGETMCA LLVMInitialize${LLVM_NATIVE_ARCH}TargetMCA - -/* Define if the AArch64 target is built in */ -#cmakedefine01 LLVM_HAS_AARCH64_TARGET - -/* Define if the AMDGPU target is built in */ -#cmakedefine01 LLVM_HAS_AMDGPU_TARGET - -/* Define if the ARC target is built in */ -#cmakedefine01 LLVM_HAS_ARC_TARGET - -/* Define if the ARM target is built in */ -#cmakedefine01 LLVM_HAS_ARM_TARGET - -/* Define if the AVR target is built in */ -#cmakedefine01 LLVM_HAS_AVR_TARGET - -/* Define if the BPF target is built in */ -#cmakedefine01 LLVM_HAS_BPF_TARGET - -/* Define if the CSKY target is built in */ -#cmakedefine01 LLVM_HAS_CSKY_TARGET - -/* Define if the DirectX target is built in */ -#cmakedefine01 LLVM_HAS_DIRECTX_TARGET - -/* Define if the Hexagon target is built in */ -#cmakedefine01 LLVM_HAS_HEXAGON_TARGET - -/* Define if the Lanai target is built in */ -#cmakedefine01 LLVM_HAS_LANAI_TARGET - -/* Define if the LoongArch target is built in */ -#cmakedefine01 LLVM_HAS_LOONGARCH_TARGET - -/* Define if the M68k target is built in */ -#cmakedefine01 LLVM_HAS_M68K_TARGET - -/* Define if the Mips target is built in */ -#cmakedefine01 LLVM_HAS_MIPS_TARGET - -/* Define if the MSP430 target is built in */ -#cmakedefine01 LLVM_HAS_MSP430_TARGET - -/* Define if the NVPTX target is built in */ -#cmakedefine01 LLVM_HAS_NVPTX_TARGET - -/* Define if the PowerPC target is built in */ -#cmakedefine01 LLVM_HAS_POWERPC_TARGET - -/* Define if the RISCV target is built in */ -#cmakedefine01 LLVM_HAS_RISCV_TARGET - -/* Define if the Sparc target is built in */ -#cmakedefine01 LLVM_HAS_SPARC_TARGET - -/* Define if the SPIRV target is built in */ -#cmakedefine01 LLVM_HAS_SPIRV_TARGET - -/* Define if the SystemZ target is built in */ -#cmakedefine01 LLVM_HAS_SYSTEMZ_TARGET - -/* Define if the VE target is built in */ -#cmakedefine01 LLVM_HAS_VE_TARGET - -/* Define if the WebAssembly target is built in */ -#cmakedefine01 LLVM_HAS_WEBASSEMBLY_TARGET - -/* Define if the X86 target is built in */ -#cmakedefine01 LLVM_HAS_X86_TARGET - -/* Define if the XCore target is built in */ -#cmakedefine01 LLVM_HAS_XCORE_TARGET - -/* Define if the Xtensa target is built in */ -#cmakedefine01 LLVM_HAS_XTENSA_TARGET - -/* Define if this is Unixish platform */ -#cmakedefine LLVM_ON_UNIX ${LLVM_ON_UNIX} - -/* Define if we have the Intel JIT API runtime support library */ -#cmakedefine01 LLVM_USE_INTEL_JITEVENTS - -/* Define if we have the oprofile JIT-support library */ -#cmakedefine01 LLVM_USE_OPROFILE - -/* Define if we have the perf JIT-support library */ -#cmakedefine01 LLVM_USE_PERF - -/* Major version of the LLVM API */ -#define LLVM_VERSION_MAJOR ${LLVM_VERSION_MAJOR} - -/* Minor version of the LLVM API */ -#define LLVM_VERSION_MINOR ${LLVM_VERSION_MINOR} - -/* Patch version of the LLVM API */ -#define LLVM_VERSION_PATCH ${LLVM_VERSION_PATCH} - -/* LLVM version string */ -#define LLVM_VERSION_STRING "${PACKAGE_VERSION}" - -/* Whether LLVM records statistics for use with GetStatistics(), - * PrintStatistics() or PrintStatisticsJSON() - */ -#cmakedefine01 LLVM_FORCE_ENABLE_STATS - -/* Define if we have z3 and want to build it */ -#cmakedefine LLVM_WITH_Z3 ${LLVM_WITH_Z3} - -/* Define if we have curl and want to use it */ -#cmakedefine LLVM_ENABLE_CURL ${LLVM_ENABLE_CURL} - -/* Define if we have cpp-httplib and want to use it */ -#cmakedefine LLVM_ENABLE_HTTPLIB ${LLVM_ENABLE_HTTPLIB} - -/* Define if zlib compression is available */ -#cmakedefine01 LLVM_ENABLE_ZLIB - -/* Define if zstd compression is available */ -#cmakedefine01 LLVM_ENABLE_ZSTD - -/* Define if LLVM is using tflite */ -#cmakedefine LLVM_HAVE_TFLITE - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYSEXITS_H ${HAVE_SYSEXITS_H} - -/* Define if building libLLVM shared library */ -#cmakedefine LLVM_BUILD_LLVM_DYLIB - -/* Define if building LLVM with BUILD_SHARED_LIBS */ -#cmakedefine LLVM_BUILD_SHARED_LIBS - -/* Define if building LLVM with LLVM_FORCE_USE_OLD_TOOLCHAIN_LIBS */ -#cmakedefine LLVM_FORCE_USE_OLD_TOOLCHAIN ${LLVM_FORCE_USE_OLD_TOOLCHAIN} - -/* Define if llvm_unreachable should be optimized with undefined behavior - * in non assert builds */ -#cmakedefine01 LLVM_UNREACHABLE_OPTIMIZE - -/* Define to 1 if you have the DIA SDK installed, and to 0 if you don't. */ -#cmakedefine01 LLVM_ENABLE_DIA_SDK - -/* Define if plugins enabled */ -#cmakedefine LLVM_ENABLE_PLUGINS - -/* Define if logf128 is available */ -#cmakedefine LLVM_HAS_LOGF128 - -#endif diff --git a/utils/bazel/overlay_directories.py b/utils/bazel/overlay_directories.py deleted file mode 100755 index 526a78e978e5d..0000000000000 --- a/utils/bazel/overlay_directories.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/python3 - -# This file is licensed 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 -"""Overlays two directories into a target directory using symlinks. - -Tries to minimize the number of symlinks created (that is, does not symlink -every single file). Symlinks every file in the overlay directory. Only symlinks -individual files in the source directory if their parent directory is also -contained in the overlay directory tree. -""" - -import argparse -import errno -import os -import sys - - -def _check_python_version(): - if sys.version_info[0] < 3: - raise RuntimeError( - "Must be invoked with a python 3 interpreter but was %s" % sys.executable - ) - - -def _check_dir_exists(path): - if not os.path.isdir(path): - raise OSError(errno.ENOENT, os.strerror(errno.ENOENT), path) - - -def parse_arguments(): - parser = argparse.ArgumentParser( - description=""" - Overlays two directories into a target directory using symlinks. - - Tries to minimize the number of symlinks created (that is, does not symlink - every single file). Symlinks every file in the overlay directory. Only - symlinks individual files in the source directory if their parent directory - is also contained in the overlay directory tree. - """ - ) - parser.add_argument( - "--src", - required=True, - help="Directory that contains most of the content to symlink.", - ) - parser.add_argument( - "--overlay", - required=True, - help="Directory to overlay on top of the source directory.", - ) - parser.add_argument( - "--target", - required=True, - help="Directory in which to place the fused symlink directories.", - ) - - args = parser.parse_args() - - _check_dir_exists(args.target) - _check_dir_exists(args.overlay) - _check_dir_exists(args.src) - - return args - - -def _symlink_abs(from_path, to_path): - os.symlink(os.path.abspath(from_path), os.path.abspath(to_path)) - - -def main(args): - for root, dirs, files in os.walk(args.overlay): - # We could do something more intelligent here and only symlink individual - # files if the directory is present in both overlay and src. This could also - # be generalized to an arbitrary number of directories without any - # "src/overlay" distinction. In the current use case we only have two and - # the overlay directory is always small, so putting that off for now. - rel_root = os.path.relpath(root, start=args.overlay) - if rel_root != ".": - os.mkdir(os.path.join(args.target, rel_root)) - - for file in files: - relpath = os.path.join(rel_root, file) - _symlink_abs( - os.path.join(args.overlay, relpath), os.path.join(args.target, relpath) - ) - - for src_entry in os.listdir(os.path.join(args.src, rel_root)): - if src_entry not in dirs: - relpath = os.path.join(rel_root, src_entry) - _symlink_abs( - os.path.join(args.src, relpath), os.path.join(args.target, relpath) - ) - - -if __name__ == "__main__": - _check_python_version() - main(parse_arguments()) diff --git a/utils/bazel/third_party_build/BUILD b/utils/bazel/third_party_build/BUILD deleted file mode 100644 index 98077a0651d9d..0000000000000 --- a/utils/bazel/third_party_build/BUILD +++ /dev/null @@ -1,5 +0,0 @@ -# This file is licensed 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 - -licenses(["notice"]) diff --git a/utils/bazel/third_party_build/gmp.BUILD b/utils/bazel/third_party_build/gmp.BUILD deleted file mode 100644 index fb0c3bf75b7ed..0000000000000 --- a/utils/bazel/third_party_build/gmp.BUILD +++ /dev/null @@ -1,20 +0,0 @@ -# This file is licensed 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 - -load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make_variant") - -filegroup( - name = "sources", - srcs = glob(["**"]), -) - -configure_make_variant( - name = "gmp", - configure_options = ["--with-pic"], - copts = ["-w"], - lib_name = "libgmp", - lib_source = ":sources", - toolchain = "@rules_foreign_cc//toolchains:preinstalled_autoconf_toolchain", - visibility = ["//visibility:public"], -) diff --git a/utils/bazel/third_party_build/mpfr.BUILD b/utils/bazel/third_party_build/mpfr.BUILD deleted file mode 100644 index 6b47874824c74..0000000000000 --- a/utils/bazel/third_party_build/mpfr.BUILD +++ /dev/null @@ -1,33 +0,0 @@ -# This file is licensed 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 - -load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make_variant") - -filegroup( - name = "sources", - srcs = glob(["**"]), -) - -configure_make_variant( - name = "mpfr", - configure_options = ["--with-pic"], - copts = ["-w"], - lib_name = "libmpfr", - lib_source = ":sources", - toolchain = "@rules_foreign_cc//toolchains:preinstalled_autoconf_toolchain", - visibility = ["//visibility:public"], - deps = ["@gmp//:gmp_"], -) - -alias( - name = "mpfr_external", - actual = "@mpfr//:mpfr_", - visibility = ["//visibility:public"], -) - -cc_library( - name = "mpfr_system", - linkopts = ["-lmpfr"], - visibility = ["//visibility:public"], -) diff --git a/utils/bazel/third_party_build/pfm.BUILD b/utils/bazel/third_party_build/pfm.BUILD deleted file mode 100644 index dba7464d17df3..0000000000000 --- a/utils/bazel/third_party_build/pfm.BUILD +++ /dev/null @@ -1,39 +0,0 @@ -# This file is licensed 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 - -load("@rules_foreign_cc//foreign_cc:defs.bzl", "make_variant") - -filegroup( - name = "sources", - srcs = glob(["**"]), -) - -make_variant( - name = "pfm", - copts = ["-w"], - lib_name = "libpfm", - lib_source = ":sources", - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - toolchain = "@rules_foreign_cc//toolchains:preinstalled_autoconf_toolchain", - visibility = ["//visibility:private"], -) - -alias( - name = "pfm_external", - actual = "@pfm//:pfm_", - visibility = ["//visibility:public"], -) - -cc_library( - name = "pfm_system", - linkopts = ["-lpfm"], - target_compatible_with = select({ - "@platforms//os:linux": [], - "//conditions:default": ["@platforms//:incompatible"], - }), - visibility = ["//visibility:public"], -) diff --git a/utils/bazel/third_party_build/vulkan_headers.BUILD b/utils/bazel/third_party_build/vulkan_headers.BUILD deleted file mode 100644 index 33c0d98f53493..0000000000000 --- a/utils/bazel/third_party_build/vulkan_headers.BUILD +++ /dev/null @@ -1,30 +0,0 @@ -# This file is licensed 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 - -package( - default_visibility = ["//visibility:public"], - licenses = ["notice"], -) - -# Exports all headers but defining VK_NO_PROTOTYPES to disable the -# inclusion of C function prototypes. Useful if dynamically loading -# all symbols via dlopen/etc. -# Not all headers are hermetic, so they are just included as textual -# headers to disable additional validation. -cc_library( - name = "vulkan_headers_no_prototypes", - defines = ["VK_NO_PROTOTYPES"], - includes = ["include"], - textual_hdrs = glob(["include/vulkan/*.h"]), -) - -# Exports all headers, including C function prototypes. Useful if statically -# linking against the Vulkan SDK. -# Not all headers are hermetic, so they are just included as textual -# headers to disable additional validation. -cc_library( - name = "vulkan_headers", - includes = ["include"], - textual_hdrs = glob(["include/vulkan/*.h"]), -) diff --git a/utils/bazel/third_party_build/zlib-ng.BUILD b/utils/bazel/third_party_build/zlib-ng.BUILD deleted file mode 100644 index 055261acb0f69..0000000000000 --- a/utils/bazel/third_party_build/zlib-ng.BUILD +++ /dev/null @@ -1,108 +0,0 @@ -# This file is licensed 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 -load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") -load("@bazel_skylib//rules:expand_template.bzl", "expand_template") - -package( - default_visibility = ["//visibility:public"], - # BSD/MIT-like license (for zlib) - licenses = ["notice"], -) - -bool_flag( - name = "llvm_enable_zlib", - build_setting_default = True, -) - -config_setting( - name = "llvm_zlib_enabled", - flag_values = {":llvm_enable_zlib": "true"}, -) - -genrule( - # The input template is identical to the CMake output. - name = "zconf_gen", - srcs = ["zconf.h.in"], - outs = ["zconf.h"], - cmd = "cp $(SRCS) $(OUTS)", -) - -cc_library( - name = "zlib", - srcs = select({ - ":llvm_zlib_enabled": [ - "adler32.c", - "adler32_p.h", - "chunkset.c", - "chunkset_tpl.h", - "compare258.c", - "compress.c", - "crc32.c", - "crc32_comb.c", - "crc32_comb_tbl.h", - "crc32_p.h", - "crc32_tbl.h", - "deflate.c", - "deflate.h", - "deflate_fast.c", - "deflate_medium.c", - "deflate_p.h", - "deflate_quick.c", - "deflate_slow.c", - "fallback_builtins.h", - "functable.c", - "functable.h", - "infback.c", - "inffast.c", - "inffast.h", - "inffixed_tbl.h", - "inflate.c", - "inflate.h", - "inflate_p.h", - "inftrees.c", - "inftrees.h", - "insert_string.c", - "insert_string_tpl.h", - "match_tpl.h", - "trees.c", - "trees.h", - "trees_emit.h", - "trees_tbl.h", - "uncompr.c", - "zbuild.h", - "zendian.h", - "zutil.c", - "zutil.h", - "zutil_p.h", - ], - "//conditions:default": [], - }), - hdrs = select({ - ":llvm_zlib_enabled": [ - "zlib.h", - ":zconf_gen", - ], - "//conditions:default": [], - }), - copts = [ - "-std=c11", - "-DZLIB_COMPAT", - "-DWITH_GZFILEOP", - "-DWITH_OPTIM", - "-DWITH_NEW_STRATEGIES", - # For local builds you might want to add "-DWITH_NATIVE_INSTRUCTIONS" - # here to improve performance. Native instructions aren't enabled in - # the default config for reproducibility. - ], - defines = select({ - ":llvm_zlib_enabled": [ - "LLVM_ENABLE_ZLIB=1", - ], - "//conditions:default": [], - }), - # Clang includes zlib with angled instead of quoted includes, so we need - # strip_include_prefix here. - strip_include_prefix = ".", - visibility = ["//visibility:public"], -) diff --git a/utils/bazel/third_party_build/zstd.BUILD b/utils/bazel/third_party_build/zstd.BUILD deleted file mode 100644 index 7d022d4226de1..0000000000000 --- a/utils/bazel/third_party_build/zstd.BUILD +++ /dev/null @@ -1,54 +0,0 @@ -# This file is licensed 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 -load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") - -package( - default_visibility = ["//visibility:public"], - # BSD/MIT-like license (for zstd) - licenses = ["notice"], -) - -bool_flag( - name = "llvm_enable_zstd", - build_setting_default = True, -) - -config_setting( - name = "llvm_zstd_enabled", - flag_values = {":llvm_enable_zstd": "true"}, -) - -cc_library( - name = "zstd", - srcs = select({ - ":llvm_zstd_enabled": glob([ - "lib/common/*.c", - "lib/common/*.h", - "lib/compress/*.c", - "lib/compress/*.h", - "lib/decompress/*.c", - "lib/decompress/*.h", - "lib/decompress/*.S", - "lib/dictBuilder/*.c", - "lib/dictBuilder/*.h", - ]), - "//conditions:default": [], - }), - hdrs = select({ - ":llvm_zstd_enabled": [ - "lib/zdict.h", - "lib/zstd.h", - "lib/zstd_errors.h", - ], - "//conditions:default": [], - }), - defines = select({ - ":llvm_zstd_enabled": [ - "LLVM_ENABLE_ZSTD=1", - "ZSTD_MULTITHREAD", - ], - "//conditions:default": [], - }), - strip_include_prefix = "lib", -) diff --git a/utils/bazel/vulkan_sdk.bzl b/utils/bazel/vulkan_sdk.bzl deleted file mode 100644 index e23dc42131c4c..0000000000000 --- a/utils/bazel/vulkan_sdk.bzl +++ /dev/null @@ -1,43 +0,0 @@ -# This file is licensed 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 - -"""Repository rule to statically link against the Vulkan SDK. - -Requires installing the Vulkan SDK from https://vulkan.lunarg.com/. - -If the Vulkan SDK is not installed, this generates an empty rule and you may -encounter linker errors like `error: undefined reference to 'vkCreateInstance'`. -""" - -def _impl(repository_ctx): - if "VULKAN_SDK" in repository_ctx.os.environ: - sdk_path = repository_ctx.os.environ["VULKAN_SDK"] - repository_ctx.symlink(sdk_path, "vulkan-sdk") - - repository_ctx.file("BUILD", """ -cc_library( - name = "sdk", - srcs = select({ - "@platforms//os:windows": [ - "vulkan-sdk/Lib/vulkan-1.lib" - ], - "//conditions:default": [ - "vulkan-sdk/lib/libvulkan.so.1", - ], - }), - visibility = ["//visibility:public"], -)""") - else: - # Empty rule. Will fail to link for just targets that use Vulkan. - repository_ctx.file("BUILD", """ -cc_library( - name = "sdk", - srcs = [], - visibility = ["//visibility:public"], -)""") - -vulkan_sdk_setup = repository_rule( - implementation = _impl, - local = True, -)