Skip to content

Commit 4236e86

Browse files
Jenkinsronlieb
authored andcommitted
merge main into amd-stg-open
reverts [Documentation] Replace recommonmark by myst-parser (llvm#65664) needs pip install magic in the builder Change-Id: I99886b000c8142c772388022f2172352938e5a3a
2 parents ec0f6ac + 10edd5d commit 4236e86

File tree

326 files changed

+9739
-4230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

326 files changed

+9739
-4230
lines changed

bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,22 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
471471
return true;
472472
}
473473

474+
void getCalleeSavedRegs(BitVector &Regs) const override {
475+
Regs |= getAliases(AArch64::X18);
476+
Regs |= getAliases(AArch64::X19);
477+
Regs |= getAliases(AArch64::X20);
478+
Regs |= getAliases(AArch64::X21);
479+
Regs |= getAliases(AArch64::X22);
480+
Regs |= getAliases(AArch64::X23);
481+
Regs |= getAliases(AArch64::X24);
482+
Regs |= getAliases(AArch64::X25);
483+
Regs |= getAliases(AArch64::X26);
484+
Regs |= getAliases(AArch64::X27);
485+
Regs |= getAliases(AArch64::X28);
486+
Regs |= getAliases(AArch64::LR);
487+
Regs |= getAliases(AArch64::FP);
488+
}
489+
474490
const MCExpr *getTargetExprFor(MCInst &Inst, const MCExpr *Expr,
475491
MCContext &Ctx,
476492
uint64_t RelType) const override {

bolt/test/assume-abi.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Validate the usage of the `--assume-abi` option in conjunction with
2+
# options related to the RegAnalysis Pass.
3+
4+
REQUIRES: system-linux
5+
6+
RUN: %clang %cflags %p/Inputs/hello.c -o %t -Wl,-q
7+
RUN: llvm-bolt %t -o %t.bolt --assume-abi --indirect-call-promotion=all

clang/cmake/caches/VectorEngine.cmake

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# This file sets up a CMakeCache for the simple VE build.
2+
#
3+
# VE is a CPU with vector engine. But it is a connected to a host CPU as
4+
# an accelerator. So, we compile programs for VE on a host using clang/llvm
5+
# as a cross compiler. Therefore, the purpose of this cache file is to
6+
# compile clang/llvm supporting both targets.
7+
#
8+
# Configure:
9+
# cmake -G Ninja -DCMAKE_BUILD_TYPE=Release
10+
# -C <llvm_src_root>/clang/cmake/caches/VectorEngine.cmake
11+
# <llvm_src_root>/llvm-project/llvm
12+
# Build:
13+
# ninja
14+
#
15+
16+
# Disable TERMINFO, ZLIB, and ZSTD for VE since there is no pre-compiled
17+
# libraries.
18+
set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
19+
set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
20+
set(LLVM_ENABLE_ZSTD OFF CACHE BOOL "")
21+
22+
# Enable per-target runtimes directory
23+
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR On CACHE BOOL "")
24+
25+
# The lld is not supported for VE yet.
26+
set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra" CACHE STRING "")
27+
set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind;openmp" CACHE STRING "")
28+
29+
# Compile for X86 and VE
30+
set(LLVM_TARGETS_TO_BUILD "X86;VE" CACHE STRING "")
31+
32+
# Not use default here to use RUNTIMES_x86_64-unknown-linux-gnu_* variables.
33+
set(LLVM_BUILTIN_TARGETS "x86_64-unknown-linux-gnu;ve-unknown-linux-gnu" CACHE STRING "")
34+
set(LLVM_RUNTIME_TARGETS "x86_64-unknown-linux-gnu;ve-unknown-linux-gnu" CACHE STRING "")
35+
36+
# For the case of X86, we don't want to test compiler-rt for x86,
37+
# so disable them as much as possible.
38+
set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
39+
set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_CRT OFF CACHE BOOL "")
40+
set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
41+
set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
42+
set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
43+
set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "")
44+
set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "")
45+
set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_ORC OFF CACHE BOOL "")
46+
set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "")
47+
48+
# VE supports builtins, crt, and profile only.
49+
set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
50+
set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_CRT ON CACHE BOOL "")
51+
set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
52+
set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
53+
set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
54+
set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_PROFILE ON CACHE BOOL "")
55+
set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "")
56+
set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_ORC OFF CACHE BOOL "")
57+
set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "")
58+
59+
# VE uses builtins from Compiler-RT.
60+
set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_USE_BUILTINS_LIBRARY TRUE CACHE BOOL "")
61+
62+
# VE uses libunwind and Compiler-RT from libcxxabi.
63+
set(RUNTIMES_ve-unknown-linux-gnu_LIBCXXABI_USE_LLVM_UNWINDER TRUE CACHE BOOL "")
64+
set(RUNTIMES_ve-unknown-linux-gnu_LIBCXXABI_USE_COMPILER_RT TRUE CACHE BOOL "")
65+
66+
# VE uses Compiler-RT from libcxx.
67+
set(RUNTIMES_ve-unknown-linux-gnu_LIBCXX_USE_COMPILER_RT TRUE CACHE BOOL "")
68+
69+
# Pretended standalone build for OpenMP since OpenMP doesn't support
70+
# LLVM_ENABLE_PER_TARGET_RUNTIME_DIR yet.
71+
# - Use OPENMP_STANDALONE_BUILD
72+
# - Define OPENMP_LIBDIR_SUFFIX to pretend per-target openmp directory
73+
# - Define OPENMP_LLVM_TOOLS_DIR for test
74+
set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_STANDALONE_BUILD ON CACHE BOOL "")
75+
set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_STANDALONE_BUILD ON CACHE BOOL "")
76+
77+
# Specify LIBDIR_SUFFIX for OpenMP to install them at following directories.
78+
# install/lib/clang/${VERSION}/lib/x86_64-unknown-linux-gnu
79+
# install/lib/clang/${VERSION}/lib/ve-unknown-linux-gnu
80+
set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_LIBDIR_SUFFIX "/x86_64-unknown-linux-gnu" CACHE STRING "")
81+
set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_LIBDIR_SUFFIX "/ve-unknown-linux-gnu" CACHE STRING "")
82+
83+
# Specify OPENMP_LLVM_TOOLS_DIR for test
84+
set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE STRING "")
85+
set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE STRING "")
86+
87+
# VE doesn't support libomptarget. Disable it for x86_64 also.
88+
set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_ENABLE_LIBOMPTARGET FALSE CACHE BOOL "")
89+
set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_ENABLE_LIBOMPTARGET FALSE CACHE BOOL "")
90+
91+
# VE requires -lrt flag for shm_open.
92+
set(RUNTIMES_ve-unknown-linux-gnu_LIBOMP_HAVE_SHM_OPEN_WITH_LRT TRUE CACHE BOOL "")
93+
94+
# Compiler flags for testing
95+
set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_TEST_COMPILER_CFLAGS "--target=ve-unknown-linux-gnu" CACHE BOOL "")
96+
set(RUNTIMES_ve-unknown-linux-gnu_LIBCXXABI_TEST_COMPILER_CFLAGS "--target=ve-unknown-linux-gnu" CACHE BOOL "")
97+
set(RUNTIMES_ve-unknown-linux-gnu_LIBCXX_TEST_COMPILER_CFLAGS "--target=ve-unknown-linux-gnu" CACHE BOOL "")
98+
set(RUNTIMES_ve-unknown-linux-gnu_LIBUNWIND_TEST_COMPILER_CFLAGS "--target=ve-unknown-linux-gnu" CACHE BOOL "")
99+
set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_TEST_OPENMP_FLAGS "--target=ve-unknown-linux-gnu -fopenmp -pthread -lrt -ldl -Wl,-rpath,${CMAKE_BINARY_DIR}/lib/ve-unknown-linux-gnu" CACHE BOOL "")
100+
101+
# setup toolchain
102+
set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
103+
set(LLVM_TOOLCHAIN_TOOLS
104+
dsymutil
105+
llc
106+
llvm-ar
107+
llvm-cxxfilt
108+
llvm-cov
109+
llvm-dwarfdump
110+
llvm-link
111+
llvm-nm
112+
llvm-objdump
113+
llvm-profdata
114+
llvm-ranlib
115+
llvm-readelf
116+
llvm-readobj
117+
llvm-size
118+
llvm-symbolizer
119+
opt
120+
CACHE STRING "")
121+
122+
set(LLVM_DISTRIBUTION_COMPONENTS
123+
clang
124+
clang-format
125+
clang-resource-headers
126+
builtins
127+
runtimes
128+
${LLVM_TOOLCHAIN_TOOLS}
129+
CACHE STRING "")

clang/lib/ASTMatchers/ASTMatchFinder.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
#include "clang/ASTMatchers/ASTMatchFinder.h"
1919
#include "clang/AST/ASTConsumer.h"
2020
#include "clang/AST/ASTContext.h"
21+
#include "clang/AST/DeclCXX.h"
2122
#include "clang/AST/RecursiveASTVisitor.h"
2223
#include "llvm/ADT/DenseMap.h"
24+
#include "llvm/ADT/SmallPtrSet.h"
2325
#include "llvm/ADT/StringMap.h"
2426
#include "llvm/Support/PrettyStackTrace.h"
2527
#include "llvm/Support/Timer.h"
@@ -651,11 +653,20 @@ class MatchASTVisitor : public RecursiveASTVisitor<MatchASTVisitor>,
651653
BoundNodesTreeBuilder *Builder,
652654
bool Directly) override;
653655

656+
private:
657+
bool
658+
classIsDerivedFromImpl(const CXXRecordDecl *Declaration,
659+
const Matcher<NamedDecl> &Base,
660+
BoundNodesTreeBuilder *Builder, bool Directly,
661+
llvm::SmallPtrSetImpl<const CXXRecordDecl *> &Visited);
662+
663+
public:
654664
bool objcClassIsDerivedFrom(const ObjCInterfaceDecl *Declaration,
655665
const Matcher<NamedDecl> &Base,
656666
BoundNodesTreeBuilder *Builder,
657667
bool Directly) override;
658668

669+
public:
659670
// Implements ASTMatchFinder::matchesChildOf.
660671
bool matchesChildOf(const DynTypedNode &Node, ASTContext &Ctx,
661672
const DynTypedMatcher &Matcher,
@@ -1361,8 +1372,18 @@ bool MatchASTVisitor::classIsDerivedFrom(const CXXRecordDecl *Declaration,
13611372
const Matcher<NamedDecl> &Base,
13621373
BoundNodesTreeBuilder *Builder,
13631374
bool Directly) {
1375+
llvm::SmallPtrSet<const CXXRecordDecl *, 8> Visited;
1376+
return classIsDerivedFromImpl(Declaration, Base, Builder, Directly, Visited);
1377+
}
1378+
1379+
bool MatchASTVisitor::classIsDerivedFromImpl(
1380+
const CXXRecordDecl *Declaration, const Matcher<NamedDecl> &Base,
1381+
BoundNodesTreeBuilder *Builder, bool Directly,
1382+
llvm::SmallPtrSetImpl<const CXXRecordDecl *> &Visited) {
13641383
if (!Declaration->hasDefinition())
13651384
return false;
1385+
if (!Visited.insert(Declaration).second)
1386+
return false;
13661387
for (const auto &It : Declaration->bases()) {
13671388
const Type *TypeNode = It.getType().getTypePtr();
13681389

@@ -1384,7 +1405,8 @@ bool MatchASTVisitor::classIsDerivedFrom(const CXXRecordDecl *Declaration,
13841405
*Builder = std::move(Result);
13851406
return true;
13861407
}
1387-
if (!Directly && classIsDerivedFrom(ClassDecl, Base, Builder, Directly))
1408+
if (!Directly &&
1409+
classIsDerivedFromImpl(ClassDecl, Base, Builder, Directly, Visited))
13881410
return true;
13891411
}
13901412
return false;

clang/lib/Basic/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ add_custom_command(OUTPUT "${version_inc}"
3939
"-DHEADER_FILE=${version_inc}"
4040
"-DLLVM_VC_REPOSITORY=${llvm_vc_repository}"
4141
"-DLLVM_VC_REVISION=${llvm_vc_revision}"
42+
"-DLLVM_FORCE_VC_REVISION=${LLVM_FORCE_VC_REVISION}"
43+
"-DLLVM_FORCE_VC_REPOSITORY=${LLVM_FORCE_VC_REPOSITORY}"
4244
-P "${generate_vcs_version_script}")
4345

4446
# Mark the generated header as being generated.

clang/lib/Basic/Targets.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,6 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
430430

431431
case llvm::Triple::riscv32:
432432
switch (os) {
433-
case llvm::Triple::FreeBSD:
434-
return std::make_unique<FreeBSDTargetInfo<RISCV32TargetInfo>>(Triple,
435-
Opts);
436433
case llvm::Triple::NetBSD:
437434
return std::make_unique<NetBSDTargetInfo<RISCV32TargetInfo>>(Triple,
438435
Opts);

clang/lib/CodeGen/CGAtomic.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ namespace {
8787
llvm::Value *StoragePtr = CGF.Builder.CreateConstGEP1_64(
8888
CGF.Int8Ty, BitFieldPtr, OffsetInChars.getQuantity());
8989
StoragePtr = CGF.Builder.CreateAddrSpaceCast(
90-
StoragePtr, llvm::PointerType::getUnqual(CGF.getLLVMContext()),
91-
"atomic_bitfield_base");
90+
StoragePtr, CGF.UnqualPtrTy, "atomic_bitfield_base");
9291
BFI = OrigBFI;
9392
BFI.Offset = Offset;
9493
BFI.StorageSize = AtomicSizeInBits;

clang/lib/CodeGen/CGBlocks.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,8 +1189,8 @@ RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr *E,
11891189
}
11901190
} else {
11911191
// Bitcast the block literal to a generic block literal.
1192-
BlockPtr = Builder.CreatePointerCast(
1193-
BlockPtr, llvm::PointerType::get(GenBlockTy, 0), "block.literal");
1192+
BlockPtr =
1193+
Builder.CreatePointerCast(BlockPtr, UnqualPtrTy, "block.literal");
11941194
// Get pointer to the block invoke function
11951195
llvm::Value *FuncPtr = Builder.CreateStructGEP(GenBlockTy, BlockPtr, 3);
11961196

@@ -1208,12 +1208,6 @@ RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr *E,
12081208
const CGFunctionInfo &FnInfo =
12091209
CGM.getTypes().arrangeBlockFunctionCall(Args, FuncTy);
12101210

1211-
// Cast the function pointer to the right type.
1212-
llvm::Type *BlockFTy = CGM.getTypes().GetFunctionType(FnInfo);
1213-
1214-
llvm::Type *BlockFTyPtr = llvm::PointerType::getUnqual(BlockFTy);
1215-
Func = Builder.CreatePointerCast(Func, BlockFTyPtr);
1216-
12171211
// Prepare the callee.
12181212
CGCallee Callee(CGCalleeInfo(), Func);
12191213

@@ -2589,11 +2583,11 @@ const BlockByrefInfo &CodeGenFunction::getBlockByrefInfo(const VarDecl *D) {
25892583
SmallVector<llvm::Type *, 8> types;
25902584

25912585
// void *__isa;
2592-
types.push_back(Int8PtrTy);
2586+
types.push_back(VoidPtrTy);
25932587
size += getPointerSize();
25942588

25952589
// void *__forwarding;
2596-
types.push_back(llvm::PointerType::getUnqual(byrefType));
2590+
types.push_back(VoidPtrTy);
25972591
size += getPointerSize();
25982592

25992593
// int32_t __flags;
@@ -2608,11 +2602,11 @@ const BlockByrefInfo &CodeGenFunction::getBlockByrefInfo(const VarDecl *D) {
26082602
bool hasCopyAndDispose = getContext().BlockRequiresCopying(Ty, D);
26092603
if (hasCopyAndDispose) {
26102604
/// void *__copy_helper;
2611-
types.push_back(Int8PtrTy);
2605+
types.push_back(VoidPtrTy);
26122606
size += getPointerSize();
26132607

26142608
/// void *__destroy_helper;
2615-
types.push_back(Int8PtrTy);
2609+
types.push_back(VoidPtrTy);
26162610
size += getPointerSize();
26172611
}
26182612

@@ -2621,7 +2615,7 @@ const BlockByrefInfo &CodeGenFunction::getBlockByrefInfo(const VarDecl *D) {
26212615
if (getContext().getByrefLifetime(Ty, Lifetime, HasByrefExtendedLayout) &&
26222616
HasByrefExtendedLayout) {
26232617
/// void *__byref_variable_layout;
2624-
types.push_back(Int8PtrTy);
2618+
types.push_back(VoidPtrTy);
26252619
size += CharUnits::fromQuantity(PointerSizeInBytes);
26262620
}
26272621

0 commit comments

Comments
 (0)