Skip to content

Commit

Permalink
Add cases in getTgtMemIntrinsic and fix lewering issues
Browse files Browse the repository at this point in the history
Created using spr 1.3.6-beta.1
  • Loading branch information
wangpc-pp committed Jun 18, 2024
2 parents 7b008d4 + 94a6b9c commit 6c2d3a6
Show file tree
Hide file tree
Showing 3,700 changed files with 333,435 additions and 88,348 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 4 additions & 4 deletions .ci/generate-buildkite-pipeline-premerge
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ function compute-projects-to-test() {
fi
;;
clang)
for p in clang-tools-extra compiler-rt lldb cross-project-tests; do
# lldb is temporarily removed to alleviate Linux pre-commit CI waiting times
for p in clang-tools-extra compiler-rt cross-project-tests; do
echo $p
done
;;
Expand Down Expand Up @@ -153,7 +154,6 @@ function exclude-linux() {
for project in ${projects}; do
case ${project} in
cross-project-tests) ;; # tests failing
lldb) ;; # tests failing
openmp) ;; # https://github.com/google/llvm-premerge-checks/issues/410
*)
echo "${project}"
Expand All @@ -170,7 +170,7 @@ function exclude-windows() {
compiler-rt) ;; # tests taking too long
openmp) ;; # TODO: having trouble with the Perl installation
libc) ;; # no Windows support
lldb) ;; # tests failing
lldb) ;; # custom environment requirements (https://github.com/llvm/llvm-project/pull/94208#issuecomment-2146256857)
bolt) ;; # tests are not supported yet
*)
echo "${project}"
Expand Down Expand Up @@ -213,7 +213,7 @@ function check-targets() {
echo "check-unwind"
;;
lldb)
echo "check-all" # TODO: check-lldb may not include all the LLDB tests?
echo "check-lldb"
;;
pstl)
echo "check-all"
Expand Down
1 change: 1 addition & 0 deletions .ci/monolithic-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ targets="${2}"

echo "--- cmake"
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_PROJECTS="${projects}" \
-G Ninja \
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/ci-post-commit-analyzer-run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import json
import multiprocessing
import os
import re
import subprocess
import sys


def run_analyzer(data):
os.chdir(data["directory"])
command = (
data["command"]
+ f" --analyze --analyzer-output html -o analyzer-results -Xclang -analyzer-config -Xclang max-nodes=75000"
)
print(command)
subprocess.run(command, shell=True, check=True)


def pool_error(e):
print("Error analyzing file:", e)


def main():
db_path = sys.argv[1]
database = json.load(open(db_path))

with multiprocessing.Pool() as pool:
pool.map_async(run_analyzer, [k for k in database], error_callback=pool_error)
pool.close()
pool.join()


if __name__ == "__main__":
main()
95 changes: 95 additions & 0 deletions .github/workflows/ci-post-commit-analyzer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Post-Commit Static Analyzer

permissions:
contents: read

on:
push:
branches:
- 'release/**'
paths:
- 'clang/**'
- 'llvm/**'
- '.github/workflows/ci-post-commit-analyzer.yml'
pull_request:
types:
- opened
- synchronize
- reopened
- closed
paths:
- '.github/workflows/ci-post-commit-analyzer.yml'
- '.github/workflows/ci-post-commit-analyzer-run.py'
schedule:
- cron: '30 0 * * *'

concurrency:
group: >-
llvm-project-${{ github.workflow }}-${{ github.event_name == 'pull_request' &&
( github.event.pull_request.number || github.ref) }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
post-commit-analyzer:
if: >-
github.repository_owner == 'llvm' &&
github.event.action != 'closed'
runs-on: ubuntu-22.04
container:
image: 'ghcr.io/llvm/ci-ubuntu-22.04:latest'
env:
LLVM_VERSION: 18
steps:
- name: Checkout Source
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
# A full build of llvm, clang, lld, and lldb takes about 250MB
# of ccache space. There's not much reason to have more than this,
# because we usually won't need to save cache entries from older
# builds. Also, there is an overall 10GB cache limit, and each
# run creates a new cache entry so we want to ensure that we have
# enough cache space for all the tests to run at once and still
# fit under the 10 GB limit.
# Default to 2G to workaround: https://github.com/hendrikmuhs/ccache-action/issues/174
max-size: 2G
key: post-commit-analyzer
variant: sccache

- name: Configure
run: |
cmake -B build -S llvm -G Ninja \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_PROJECTS=clang \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DLLVM_INCLUDE_TESTS=OFF \
-DCLANG_INCLUDE_TESTS=OFF \
-DCMAKE_BUILD_TYPE=Release
- name: Build
run: |
# FIXME: We need to build all the generated header files in order to be able to run
# the analyzer on every file. Building libLLVM and libclang is probably overkill for
# this, but it's better than building every target.
ninja -v -C build libLLVM.so libclang.so
# Run the analyzer.
python3 .github/workflows/ci-post-commit-analyzer-run.py build/compile_commands.json
scan-build --generate-index-only build/analyzer-results
- name: Upload Results
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
if: always()
with:
name: analyzer-results
path: 'build/analyzer-results/*'

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN cmake -B ./build -G Ninja ./llvm \
-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" \
-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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
with:
fetch-depth: 1
- name: Setup Python env
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/libclang-python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.11"]
python-version: ["3.8", "3.11"]
uses: ./.github/workflows/llvm-project-tests.yml
with:
build_target: check-clang-python
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/libcxx-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,16 @@ jobs:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
choco install -y ninja wget
choco install -y ninja
pip install psutil
- name: Install a current LLVM
if: ${{ matrix.mingw != true }}
run: |
choco install -y llvm --version=17.0.6
choco install -y llvm --version=18.1.6 --allow-downgrade
- name: Install llvm-mingw
if: ${{ matrix.mingw == true }}
run: |
curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/llvm-mingw-20231128-ucrt-x86_64.zip
curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20240606/llvm-mingw-20240606-ucrt-x86_64.zip
powershell Expand-Archive llvm-mingw*.zip -DestinationPath .
del llvm-mingw*.zip
mv llvm-mingw* c:\llvm-mingw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
script: |
const failure_regex = /Process completed with exit code 1./
const preemption_regex = /The runner has received a shutdown signal/
const wf_run = context.payload.workflow_run
core.notice(`Running on "${wf_run.display_title}" by @${wf_run.actor.login} (event: ${wf_run.event})\nWorkflow run URL: ${wf_run.html_url}`)
Expand Down Expand Up @@ -80,30 +80,30 @@ jobs:
}
check_run_ids.push(check_run.id);
}
has_preempted_job = false;
for (check_run_id of check_run_ids) {
console.log('Listing annotations for check run: ' + check_run_id);
annotations = await github.rest.checks.listAnnotations({
owner: context.repo.owner,
repo: context.repo.repo,
check_run_id: check_run_id
})
for (annotation of annotations.data) {
if (annotation.annotation_level != 'failure') {
continue;
}
const preemption_match = annotation.message.match(preemption_regex);
if (preemption_match != null) {
console.log('Found preemption message: ' + annotation.message);
has_preempted_job = true;
}
const failure_match = annotation.message.match(failure_regex);
if (failure_match != null) {
// We only want to restart the workflow if all of the failures were due to preemption.
Expand All @@ -115,20 +115,18 @@ jobs:
return;
}
}
}
}
if (!has_preempted_job) {
core.notice('No preempted jobs found. Not restarting workflow.');
await create_check_run('neutral', 'No preempted jobs found. Not restarting workflow.')
return;
}
core.notice("Restarted workflow: " + context.payload.workflow_run.id);
await github.rest.actions.reRunWorkflowFailedJobs({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id
})
await create_check_run('success', 'Restarted workflow run due to preempted job')
2 changes: 1 addition & 1 deletion .github/workflows/llvm-project-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
# lldb. Using this setup-python action to make 3.10 the default
# python fixes this.
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}
- name: Install Ninja
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-code-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
clangformat: 18.1.1

- name: Setup Python env
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ jobs:
- id: package-info
run: |
filename="LLVM-${{ needs.prepare.outputs.release-version }}-Linux.tar.gz"
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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup Python env
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
cache: 'pip'
cache-dependency-path: './llvm/docs/requirements.txt'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-doxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup Python env
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
cache: 'pip'
cache-dependency-path: './llvm/docs/requirements.txt'
Expand Down
61 changes: 61 additions & 0 deletions bolt/include/bolt/Core/GDBIndex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//===-- bolt/Core/GDBIndex.h - GDB Index support ----------------*- 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 declaration of classes required for generation of
/// .gdb_index section.
///
//===----------------------------------------------------------------------===//

#ifndef BOLT_CORE_GDB_INDEX_H
#define BOLT_CORE_GDB_INDEX_H

#include "bolt/Core/BinaryContext.h"
#include <vector>

namespace llvm {
namespace bolt {

class GDBIndex {
public:
/// Contains information about TU so we can write out correct entries in GDB
/// index.
struct GDBIndexTUEntry {
uint64_t UnitOffset;
uint64_t TypeHash;
uint64_t TypeDIERelativeOffset;
};

private:
BinaryContext &BC;

/// Entries for GDB Index Types CU List.
using GDBIndexTUEntryType = std::vector<GDBIndexTUEntry>;
GDBIndexTUEntryType GDBIndexTUEntryVector;

public:
GDBIndex(BinaryContext &BC) : BC(BC) {}

std::mutex GDBIndexMutex;

/// Adds an GDBIndexTUEntry if .gdb_index section exists.
void addGDBTypeUnitEntry(const GDBIndexTUEntry &&Entry);

/// Rewrite .gdb_index section if present.
void updateGdbIndexSection(const CUOffsetMap &CUMap, const uint32_t NumCUs,
DebugARangesSectionWriter &ARangesSectionWriter);

/// Returns all entries needed for Types CU list.
const GDBIndexTUEntryType &getGDBIndexTUEntryVector() const {
return GDBIndexTUEntryVector;
}
};

} // namespace bolt
} // namespace llvm

#endif
Loading

0 comments on commit 6c2d3a6

Please sign in to comment.