Skip to content

Commit

Permalink
Update to LLVM 15
Browse files Browse the repository at this point in the history
* `-analyze` was removed from `opt` in https://reviews.llvm.org/D122420.
  All affected tests in llvm-tutor are updated accordingly (the
  corresponding `RUN` lines are removed).
* Starting with LLVM 15, Homebrew LLVM packages are built with
  `LLVM_ENABLE_LTO=ON`. This affects how `static` is linked when using
  Homebrew packages. See https://github.com/orgs/Homebrew/discussions/3666
  and #75 for a
  complete discussion.
* Introduced opaque pointers in tests.
* Remove some references to the legacy PM, update examples to the new
  PM.

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
  • Loading branch information
banach-space and carlocab committed Sep 27, 2022
1 parent 43344cf commit af9d193
Show file tree
Hide file tree
Showing 27 changed files with 175 additions and 199 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-archlinux.yml
Expand Up @@ -13,4 +13,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile_archlinux --tag llvm-tutor:llvm-14
run: docker build . --file Dockerfile_archlinux --tag llvm-tutor:llvm-15
2 changes: 1 addition & 1 deletion .github/workflows/docker-fedora.yml
Expand Up @@ -13,4 +13,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile_fedora --tag llvm-tutor:llvm-14
run: docker build . --file Dockerfile_fedora --tag llvm-tutor:llvm-15
2 changes: 1 addition & 1 deletion .github/workflows/docker-ubuntu.yml
Expand Up @@ -13,4 +13,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile_ubuntu --tag llvm-tutor:llvm-14
run: docker build . --file Dockerfile_ubuntu --tag llvm-tutor:llvm-15
2 changes: 1 addition & 1 deletion .github/workflows/docker-ubunut-apt.yml
Expand Up @@ -13,4 +13,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile_ubuntu_apt --tag llvm-tutor:llvm-14
run: docker build . --file Dockerfile_ubuntu_apt --tag llvm-tutor:llvm-15
5 changes: 3 additions & 2 deletions .github/workflows/x86-darwin-llvm-from-sources.yml
Expand Up @@ -21,17 +21,18 @@ jobs:
echo "${GITHUB_WORKSPACE}/ninja" >> $GITHUB_PATH
- name: Clone llvm-project
run: |
git clone --depth 1 --single-branch --branch release/14.x https://github.com/llvm/llvm-project
git clone --depth 1 --single-branch --branch release/15.x https://github.com/llvm/llvm-project
- name: Build LLVM
run: |
cd llvm-project
mkdir build && cd build
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_OPTIMIZED_TABLEGEN=ON \
-DLLVM_BUILD_LLVM_DYLIB=ON \
../llvm
# Note that only the required tools are built
ninja clang opt lli not FileCheck
ninja clang opt lli not FileCheck LLVM
- name: Install lit
run: |
sudo pip3 install lit
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/x86-darwin.yml
Expand Up @@ -19,18 +19,18 @@ jobs:
- name: Install Dependencies
run: |
brew update
brew install llvm@14
brew install llvm@15
pip3 install lit
- name: Build HelloWorld
run: |
cd HelloWorld
mkdir build && cd build
cmake -DLT_LLVM_INSTALL_DIR="/usr/local/opt/llvm@14/" -DCMAKE_BUILD_TYPE=${{ matrix.type }} ../
cmake -DLT_LLVM_INSTALL_DIR="/usr/local/opt/llvm@15/" -DCMAKE_BUILD_TYPE=${{ matrix.type }} ../
make -j2
- name: Build llvm-tutor + run tests
run: |
cd $GITHUB_WORKSPACE
mkdir build && cd build
cmake -DLT_LLVM_INSTALL_DIR="/usr/local/opt/llvm@14/" -DCMAKE_BUILD_TYPE=${{ matrix.type }} ../
cmake -DLT_LLVM_INSTALL_DIR="/usr/local/opt/llvm@15/" -DCMAKE_BUILD_TYPE=${{ matrix.type }} ../
make -j2
lit test/
3 changes: 2 additions & 1 deletion .github/workflows/x86-ubuntu-llvm-from-sources-static.yml
Expand Up @@ -21,7 +21,7 @@ jobs:
echo "${GITHUB_WORKSPACE}/ninja" >> $GITHUB_PATH
- name: Clone llvm-project
run: |
git clone --depth 1 --single-branch --branch release/14.x https://github.com/llvm/llvm-project
git clone --depth 1 --single-branch --branch release/15.x https://github.com/llvm/llvm-project
cd llvm-project
- name: Register MBAAdd statically
run: |
Expand All @@ -34,6 +34,7 @@ jobs:
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_TARGETS_TO_BUILD="host" -DLLVM_OPTIMIZED_TABLEGEN=ON \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_BUILD_EXAMPLES=On -DLLVM_MBASUB_LINK_INTO_TOOLS=On \
../llvm
# Note that only the required tools are built
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/x86-ubuntu-llvm-from-sources.yml
Expand Up @@ -23,7 +23,7 @@ jobs:
echo "${GITHUB_WORKSPACE}/ninja" >> $GITHUB_PATH
- name: Clone llvm-project
run: |
git clone --depth 10 --single-branch --branch release/14.x https://github.com/llvm/llvm-project
git clone --depth 10 --single-branch --branch release/15.x https://github.com/llvm/llvm-project
- name: Build LLVM
run: |
cd llvm-project
Expand All @@ -32,9 +32,10 @@ jobs:
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_OPTIMIZED_TABLEGEN=ON \
-DBUILD_SHARED_LIBS=On ../llvm
-DLLVM_BUILD_LLVM_DYLIB=ON \
../llvm
# Note that only the required tools are built
ninja clang opt lli not FileCheck
ninja clang opt lli not FileCheck LLVM
- name: Install lit
run: |
sudo apt-get install python3-setuptools
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/x86-ubuntu.yml
Expand Up @@ -25,9 +25,9 @@ jobs:
CXX: ${{ matrix.compiler.CXX }}
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main"
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main"
sudo apt-get update
sudo apt-get install -y llvm-14 llvm-14-dev llvm-14-tools clang-14
sudo apt-get install -y llvm-15 llvm-15-dev llvm-15-tools clang-15
sudo apt-get install python3-setuptools
sudo pip3 install lit
- name: Build HelloWorld
Expand All @@ -37,12 +37,12 @@ jobs:
run: |
cd HelloWorld
mkdir build && cd build
cmake -DLT_LLVM_INSTALL_DIR="/usr/lib/llvm-14/" -DCMAKE_BUILD_TYPE=${{ matrix.type }} ../
cmake -DLT_LLVM_INSTALL_DIR="/usr/lib/llvm-15/" -DCMAKE_BUILD_TYPE=${{ matrix.type }} ../
make -j2
- name: Build llvm-tutor + run tests
run: |
cd $GITHUB_WORKSPACE
mkdir build && cd build
cmake -DLT_LLVM_INSTALL_DIR="/usr/lib/llvm-14/" -DCMAKE_BUILD_TYPE=${{ matrix.type }} ../
cmake -DLT_LLVM_INSTALL_DIR="/usr/lib/llvm-15/" -DCMAKE_BUILD_TYPE=${{ matrix.type }} ../
make -j2
lit -va test/
10 changes: 5 additions & 5 deletions CMakeLists.txt
Expand Up @@ -46,11 +46,11 @@ endif()
# `find_package(llvm)`. So there's no need to add it here.
list(APPEND CMAKE_PREFIX_PATH "${LT_LLVM_INSTALL_DIR}/lib/cmake/llvm/")

find_package(LLVM 14 REQUIRED CONFIG)
find_package(LLVM 15 REQUIRED CONFIG)

# Another sanity check
if(NOT "14" VERSION_EQUAL "${LLVM_VERSION_MAJOR}")
message(FATAL_ERROR "Found LLVM ${LLVM_VERSION_MAJOR}, but need LLVM 14")
if(NOT "15" VERSION_EQUAL "${LLVM_VERSION_MAJOR}")
message(FATAL_ERROR "Found LLVM ${LLVM_VERSION_MAJOR}, but need LLVM 15")
endif()

message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
Expand All @@ -72,7 +72,7 @@ add_definitions(${LLVM_DEFINITIONS})
# 3. LLVM-TUTOR BUILD CONFIGURATION
#===============================================================================
# Use the same C++ standard as LLVM does
set(CMAKE_CXX_STANDARD 14 CACHE STRING "")
set(CMAKE_CXX_STANDARD 17 CACHE STRING "")

# Build type
if (NOT CMAKE_BUILD_TYPE)
Expand All @@ -82,7 +82,7 @@ endif()

# Compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall\
-fdiagnostics-color=always")
-fdiagnostics-color=always")

# LLVM is normally built without RTTI. Be consistent with that.
if(NOT LLVM_ENABLE_RTTI)
Expand Down
4 changes: 2 additions & 2 deletions HelloWorld/CMakeLists.txt
Expand Up @@ -12,7 +12,7 @@ set(LT_LLVM_INSTALL_DIR "" CACHE PATH "LLVM installation directory")
list(APPEND CMAKE_PREFIX_PATH "${LT_LLVM_INSTALL_DIR}/lib/cmake/llvm/")

# FIXME: This is a warkaround for #25. Remove once resolved and use
find_package(LLVM 14 REQUIRED CONFIG)
find_package(LLVM 15 REQUIRED CONFIG)

# HelloWorld includes headers from LLVM - update the include paths accordingly
include_directories(SYSTEM ${LLVM_INCLUDE_DIRS})
Expand All @@ -21,7 +21,7 @@ include_directories(SYSTEM ${LLVM_INCLUDE_DIRS})
# 2. LLVM-TUTOR BUILD CONFIGURATION
#===============================================================================
# Use the same C++ standard as LLVM does
set(CMAKE_CXX_STANDARD 14 CACHE STRING "")
set(CMAKE_CXX_STANDARD 17 CACHE STRING "")

# LLVM is normally built without RTTI. Be consistent with that.
if(NOT LLVM_ENABLE_RTTI)
Expand Down

0 comments on commit af9d193

Please sign in to comment.