Skip to content

Commit

Permalink
Update LLVM commit to 582e1d5 (#187)
Browse files Browse the repository at this point in the history
This is a fairly big change.

- Bump comgr to keep amdgpu toolchains working.
- Fix broken clang-tidy warnings with modules.
- Fix new clang-tidy warnings in examples.
- Remove patches that are no longer required.
  • Loading branch information
aaronmondal authored Jul 18, 2023
1 parent 6a33844 commit 37b5721
Show file tree
Hide file tree
Showing 18 changed files with 115 additions and 173 deletions.
8 changes: 3 additions & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ llvm_project_overlay = use_extension(
"llvm_project_overlay",
)
llvm_project_overlay.configure(
commit = "9feed59a9143cce23f26b4dd939078a9cbbd9002",
sha256 = "4740a02bf379bf51936587b5b3434c7d2c04b482e10152ffb1809dd57bfd12b2",
targets = ["AMDGPU", "NVPTX", "X86", "WebAssembly"],
commit = "582e1d58bd43af138033b98b736d97cc89c7b228",
sha256 = "1b9f2f4ca426716a54fec16835cdf756ed8040fe98c7d67e047f8305ab7aae08",
targets = ["AMDGPU", "NVPTX", "WebAssembly", "X86"],
patches = [
"@rules_ll//patches:back_inserter_patch.diff",
"@rules_ll//patches:compiler-rt_float128_patch.diff",
"@rules_ll//patches:mallinfo2_patch.diff",
"@rules_ll//patches:rules_ll_overlay_patch.diff",
],
Expand Down
42 changes: 40 additions & 2 deletions examples/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,54 @@
Checks: |
-*
bugprone-*
google-*
cppcoreguidelines-*
google-*
misc-*
modernize-*
performance-*
portability-*
readability-*
-bugprone-dangling-handle
-bugprone-fold-init-type
-bugprone-implicit-widening-of-multiplication-result
-bugprone-move-forwarding-reference
-bugprone-narrowing-conversions
-bugprone-shared-ptr-array-mismatch
-bugprone-string-integer-assignment
-bugprone-stringview-nullptr
-bugprone-swapped-arguments
-bugprone-unique-ptr-array-mismatch
-bugprone-use-after-move
-cppcoreguidelines-missing-std-forward
-cppcoreguidelines-narrowing-conversions
-cppcoreguidelines-pro-bounds-array-to-pointer-decay
-cppcoreguidelines-rvalue-reference-param-not-moved
-google-build-explicit-make-pair
-misc-const-correctness
-misc-include-cleaner
-misc-uniqueptr-reset-release
-modernize-make-shared
-modernize-make-unique
-modernize-use-nullptr
-modernize-use-transparent-functors
-performance-avoid-endl
-performance-inefficient-algorithm
-performance-inefficient-string-concatenation
-performance-move-const-arg
-performance-unnecessary-value-param
-portability-std-allocator-const
-readability-redundant-declaration
-readability-redundant-smartptr-get
-readability-redundant-string-cstr
-readability-redundant-string-init
-readability-uppercase-literal-suffix
# Note: misc-include-cleaner is pointless with modules and doesn't work well
# with headers like hip_runtime.h and cuda_runtime.h. Since includes in
# rules_ll are already fairly strict, we'll disable this.

# Note: readability-redundant-declaration is broken when working with modules.
# TODO: All other warnings should be re-enabled after module compatibility is
# fixed. Progress at https://github.com/llvm/llvm-project/issues/63939.

WarningsAsErrors: "*"

Expand Down
10 changes: 4 additions & 6 deletions examples/clang_tidy_example/executable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ auto main() -> int {
int an_unitinialized_variable; // Triggers clang-tidy.

#ifndef A_LOCAL_DEFINE
std::cout << "PASS: A_LOCAL_DEFINE was not defined in executable."
<< std::endl;
std::cout << "PASS: A_LOCAL_DEFINE was not defined in executable." << '\n';
#else
std::cout << "FAIL: A_LOCAL_DEFINE was defined in executable." << std::endl;
std::cout << "FAIL: A_LOCAL_DEFINE was defined in executable." << '\n';
#endif

#ifdef A_PUBLIC_DEFINE
std::cout << "PASS: A_PUBLIC_DEFINE was defined in executable." << std::endl;
std::cout << "PASS: A_PUBLIC_DEFINE was defined in executable." << '\n';
#else
std::cout << "FAIL: A PUBLIC_DEFINE was not defined in executable."
<< std::endl;
std::cout << "FAIL: A PUBLIC_DEFINE was not defined in executable." << '\n';
#endif

print_lib_1_string();
Expand Down
1 change: 0 additions & 1 deletion examples/cuda_example/example.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <array>
#include <cassert>
#include <iostream>
#include <vector>

#include "cuda_runtime.h"

Expand Down
2 changes: 1 addition & 1 deletion examples/format_example/format_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ auto main() -> int {
"to ll_library and ll_binary to enable this feature.";

std::cout << std::format("{}, {}!\n{}", "Hello", "world", kExplanation)
<< std::endl;
<< '\n';
return 0;
}
5 changes: 5 additions & 0 deletions examples/frontend_action_example/main.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
// Adapted from https://clang.llvm.org/docs/RAVFrontendAction.html

#include <cstddef>
#include <memory>
#include <span>

#include "clang/AST/ASTConsumer.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"

class FindNamedClassVisitor
: public clang::RecursiveASTVisitor<FindNamedClassVisitor> {
Expand Down
2 changes: 1 addition & 1 deletion ll/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ ll_toolchain(
":bootstrap": [],
"//conditions:default": [
"@llvm-project//compiler-rt:libll_compiler-rt",
"@llvm-project//compiler-rt/lib/crt:crt",
"@llvm-project//compiler-rt/lib/builtins:crt",
],
}),
cpp_abihdrs = select({
Expand Down
6 changes: 3 additions & 3 deletions ll/init.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ def _initialize_rules_ll_impl(_):
http_archive(
name = "comgr",
build_file = "@rules_ll//third-party-overlays:comgr.BUILD.bazel",
sha256 = "50f87b928a12241b56b2eecede5dec6c87758b9e64958f78023097d9aff4d839",
strip_prefix = "ROCm-CompilerSupport-65abd4d61e2c15ecdf2c5ec802d98987f1dd427a",
sha256 = "b94a9f187255dda577b94343c2c8e3e2c1bd0ecff8ee4b17e9cb3a0d08138324",
strip_prefix = "ROCm-CompilerSupport-8c0f3bc3e1ad6d6f693c066a9ab96e612f86e606",
urls = [
"https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/archive/65abd4d61e2c15ecdf2c5ec802d98987f1dd427a.zip",
"https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/archive/8c0f3bc3e1ad6d6f693c066a9ab96e612f86e606.zip",
],
patches = [
"@rules_ll//patches:comgr_bc2h.diff",
Expand Down
1 change: 1 addition & 0 deletions ll/llvm_project_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ LLVM_PROJECT_DEPS = [
"@llvm-project//llvm:Coverage",
"@llvm-project//llvm:DWP",
"@llvm-project//llvm:DebugInfo",
"@llvm-project//llvm:DebugInfoBTF",
"@llvm-project//llvm:DebugInfoCodeView",
"@llvm-project//llvm:DebugInfoDWARF",
"@llvm-project//llvm:DebugInfoGSYM",
Expand Down
2 changes: 1 addition & 1 deletion llvm-project-overlay/compiler-rt/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ ll_library(
visibility = ["//visibility:public"],
deps = [
"//compiler-rt/lib/builtins",
"//compiler-rt/lib/crt",
"//compiler-rt/lib/builtins:crt",
],
)
27 changes: 27 additions & 0 deletions llvm-project-overlay/compiler-rt/lib/builtins/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,30 @@ ll_library(
compilation_mode = "bootstrap",
visibility = ["//visibility:public"],
)

ll_library(
name = "crtbegin",
srcs = ["crtbegin.c"],
compilation_mode = "bootstrap",
defines = ["EH_USE_FRAME_REGISTRY"],
emit = ["objects"],
visibility = ["//visibility:public"],
)

ll_library(
name = "crtend",
srcs = ["crtend.c"],
compilation_mode = "bootstrap",
emit = ["objects"],
visibility = ["//visibility:public"],
)

ll_library(
name = "crt",
compilation_mode = "bootstrap",
visibility = ["//visibility:public"],
deps = [
":crtbegin",
":crtend",
],
)
28 changes: 0 additions & 28 deletions llvm-project-overlay/compiler-rt/lib/crt/BUILD.bazel

This file was deleted.

2 changes: 2 additions & 0 deletions llvm-project-overlay/compiler-rt/lib/msan/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ filegroup(
"msan.h",
"msan_allocator.h",
"msan_chained_origin_depot.h",
"msan_dl.h",
"msan_flags.h",
"msan_flags.inc",
"msan_interface_internal.h",
Expand All @@ -23,6 +24,7 @@ ll_library(
"msan.cpp",
"msan_allocator.cpp",
"msan_chained_origin_depot.cpp",
"msan_dl.cpp",
"msan_interceptors.cpp",
"msan_linux.cpp",
"msan_poisoning.cpp",
Expand Down
13 changes: 8 additions & 5 deletions llvm-project-overlay/libcxx/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ expand_template(
template = "include/module.modulemap.in",
)

NO = "/* undefined by Bazel. */"
NO = "/* Undefined by Bazel. */"

expand_template(
name = "__config_site_gen",
Expand All @@ -142,20 +142,23 @@ expand_template(
"#cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD": NO,
"#cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL": NO,
"#cmakedefine _LIBCPP_HAS_THREAD_API_WIN32": NO,
"#cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL": NO,
"#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS": NO,
"#cmakedefine _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS": "#define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS",
"#cmakedefine _LIBCPP_NO_VCRUNTIME": NO,
"#cmakedefine _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION @_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION@": NO,
"#cmakedefine _LIBCPP_HAS_NO_FILESYSTEM": NO,
"#cmakedefine _LIBCPP_HAS_PARALLEL_ALGORITHMS": NO,
"#cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE": NO,
"#cmakedefine _LIBCPP_HAS_NO_LOCALIZATION": NO,
"#cmakedefine _LIBCPP_HAS_NO_WIDE_CHARACTERS": NO,
"#cmakedefine01 _LIBCPP_ENABLE_ASSERTIONS_DEFAULT": "#define _LIBCPP_ENABLE_ASSERTIONS_DEFAULT 0",
"#cmakedefine _LIBCPP_ENABLE_DEBUG_MODE": NO,
# PSTL backends.
"#cmakedefine _LIBCPP_PSTL_CPU_BACKEND_SERIAL": "#define _LIBCPP_PSTL_CPU_BACKEND_SERIAL",
"#cmakedefine _LIBCPP_PSTL_CPU_BACKEND_THREAD": NO,
"#cmakedefine _LIBCPP_PSTL_CPU_BACKEND_LIBDISPATCH": NO,
# Hardening.
# TODO: Evaluate performance impact of this. If it isn't noticeable for
# most use-cases, enable it.
"#cmakedefine01 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT": "#define _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT 0",
"#cmakedefine01 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT": "#define _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT 0",
"@_LIBCPP_ABI_DEFINES@": NO,
"@_LIBCPP_EXTRA_SITE_DEFINES@": NO,
},
Expand Down
14 changes: 0 additions & 14 deletions patches/back_inserter_patch.diff

This file was deleted.

85 changes: 0 additions & 85 deletions patches/compiler-rt_float128_patch.diff

This file was deleted.

Loading

0 comments on commit 37b5721

Please sign in to comment.