Skip to content

Commit 05ae9b9

Browse files
authored
Merge branch 'main' into main
2 parents 32699e3 + 59b3d18 commit 05ae9b9

File tree

1,774 files changed

+29277
-132456
lines changed

Some content is hidden

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

1,774 files changed

+29277
-132456
lines changed

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,6 +1869,20 @@ class MCPlusBuilder {
18691869
llvm_unreachable("not implemented");
18701870
}
18711871

1872+
/// Check if an Instruction is a BTI landing pad with the required properties.
1873+
/// Takes both explicit and implicit BTIs into account.
1874+
virtual bool isBTILandingPad(MCInst &Inst, bool CallTarget,
1875+
bool JumpTarget) const {
1876+
llvm_unreachable("not implemented");
1877+
return false;
1878+
}
1879+
1880+
/// Check if an Instruction is an implicit BTI c landing pad.
1881+
virtual bool isImplicitBTIC(MCInst &Inst) const {
1882+
llvm_unreachable("not implemented");
1883+
return false;
1884+
}
1885+
18721886
/// Create a BTI landing pad instruction.
18731887
virtual void createBTI(MCInst &Inst, bool CallTarget, bool JumpTarget) const {
18741888
llvm_unreachable("not implemented");

bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2782,6 +2782,24 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
27822782
Inst.addOperand(MCOperand::createImm(HintNum));
27832783
}
27842784

2785+
bool isBTILandingPad(MCInst &Inst, bool CallTarget,
2786+
bool JumpTarget) const override {
2787+
unsigned HintNum = getBTIHintNum(CallTarget, JumpTarget);
2788+
bool IsExplicitBTI =
2789+
Inst.getOpcode() == AArch64::HINT && Inst.getNumOperands() == 1 &&
2790+
Inst.getOperand(0).isImm() && Inst.getOperand(0).getImm() == HintNum;
2791+
2792+
bool IsImplicitBTI = HintNum == 34 && isImplicitBTIC(Inst);
2793+
return IsExplicitBTI || IsImplicitBTI;
2794+
}
2795+
2796+
bool isImplicitBTIC(MCInst &Inst) const override {
2797+
// PACI[AB]SP are always implicitly BTI C, independently of
2798+
// SCTLR_EL1.BT[01].
2799+
return Inst.getOpcode() == AArch64::PACIASP ||
2800+
Inst.getOpcode() == AArch64::PACIBSP;
2801+
}
2802+
27852803
InstructionListType materializeAddress(const MCSymbol *Target, MCContext *Ctx,
27862804
MCPhysReg RegName,
27872805
int64_t Addend = 0) const override {

bolt/test/X86/lit.local.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
if not "X86" in config.root.targets:
22
config.unsupported = True
33

4-
flags = "--target=x86_64-unknown-linux-gnu -nostdlib"
4+
flags = "--target=x86_64-unknown-linux-gnu -nostdlib -mllvm -x86-asm-syntax=att"
55

66
config.substitutions.insert(0, ("%cflags", f"%cflags {flags}"))
77
config.substitutions.insert(0, ("%cxxflags", f"%cxxflags {flags}"))

bolt/test/lit.local.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if not "linux" in host_triple:
55
host_triple = host_triple.split("-")[0] + "-unknown-linux-gnu"
66

77
common_linker_flags = "-fuse-ld=lld -Wl,--unresolved-symbols=ignore-all -Wl,--build-id=none -pie"
8-
flags = f"--target={host_triple} -fPIE {common_linker_flags} -mllvm -x86-asm-syntax=att"
8+
flags = f"--target={host_triple} -fPIE {common_linker_flags}"
99

1010
config.substitutions.insert(0, ("%cflags", f"%cflags {flags}"))
1111
config.substitutions.insert(0, ("%cxxflags", f"%cxxflags {flags}"))

bolt/unittests/Core/MCPlusBuilder.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,41 @@ TEST_P(MCPlusBuilderTester, AArch64_BTI) {
155155
auto II = BB->begin();
156156
ASSERT_EQ(II->getOpcode(), AArch64::HINT);
157157
ASSERT_EQ(II->getOperand(0).getImm(), 38);
158+
ASSERT_TRUE(BC->MIB->isBTILandingPad(*II, true, true));
158159

159160
MCInst BTIj;
160161
BC->MIB->createBTI(BTIj, false, true);
161162
II = BB->addInstruction(BTIj);
162163
ASSERT_EQ(II->getOpcode(), AArch64::HINT);
163164
ASSERT_EQ(II->getOperand(0).getImm(), 36);
165+
ASSERT_TRUE(BC->MIB->isBTILandingPad(*II, false, true));
164166

165167
MCInst BTIc;
166168
BC->MIB->createBTI(BTIc, true, false);
167169
II = BB->addInstruction(BTIc);
168170
ASSERT_EQ(II->getOpcode(), AArch64::HINT);
169171
ASSERT_EQ(II->getOperand(0).getImm(), 34);
172+
ASSERT_TRUE(BC->MIB->isBTILandingPad(*II, true, false));
170173

174+
#ifndef NDEBUG
171175
MCInst BTIinvalid;
172176
ASSERT_DEATH(BC->MIB->createBTI(BTIinvalid, false, false),
173177
"No target kinds!");
178+
#endif
179+
180+
MCInst Paciasp = MCInstBuilder(AArch64::PACIASP);
181+
II = BB->addInstruction(Paciasp);
182+
ASSERT_TRUE(BC->MIB->isBTILandingPad(*II, true, false));
183+
ASSERT_FALSE(BC->MIB->isBTILandingPad(*II, true, true));
184+
ASSERT_FALSE(BC->MIB->isBTILandingPad(*II, false, true));
185+
ASSERT_TRUE(BC->MIB->isImplicitBTIC(*II));
186+
187+
MCInst Pacibsp = MCInstBuilder(AArch64::PACIBSP);
188+
II = BB->addInstruction(Pacibsp);
189+
ASSERT_TRUE(BC->MIB->isBTILandingPad(*II, true, false));
190+
ASSERT_FALSE(BC->MIB->isBTILandingPad(*II, true, true));
191+
ASSERT_FALSE(BC->MIB->isBTILandingPad(*II, false, true));
192+
ASSERT_TRUE(BC->MIB->isImplicitBTIC(*II));
174193
}
175194

176195
TEST_P(MCPlusBuilderTester, AArch64_CmpJNE) {

clang-tools-extra/clangd/CompileCommands.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ std::optional<std::string> detectSysroot() {
132132

133133
std::string detectStandardResourceDir() {
134134
static int StaticForMainAddr; // Just an address in this process.
135-
return CompilerInvocation::GetResourcesPath("clangd",
136-
(void *)&StaticForMainAddr);
135+
return GetResourcesPath("clangd", (void *)&StaticForMainAddr);
137136
}
138137

139138
// The path passed to argv[0] is important:

clang-tools-extra/clangd/Compiler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "Compiler.h"
1010
#include "support/Logger.h"
1111
#include "clang/Basic/TargetInfo.h"
12+
#include "clang/Driver/CreateInvocationFromArgs.h"
1213
#include "clang/Frontend/CompilerInvocation.h"
1314
#include "clang/Lex/PreprocessorOptions.h"
1415
#include "clang/Serialization/PCHContainerOperations.h"

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ set(CMAKE_CXX_VISIBILITY_PRESET default CACHE STRING "")
5858

5959
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
6060
if (APPLE)
61-
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "")
61+
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "")
6262
elseif(WIN32)
6363
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE STRING "")
6464
endif()
@@ -83,7 +83,7 @@ if(APPLE)
8383
set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
8484
set(LIBCXX_HARDENING_MODE "none" CACHE STRING "")
8585
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
86-
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13;-DCMAKE_OSX_ARCHITECTURES=arm64|x86_64" CACHE STRING "")
86+
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0;-DCMAKE_OSX_ARCHITECTURES=arm64|x86_64" CACHE STRING "")
8787
endif()
8888

8989
if(WIN32 OR LLVM_WINSYSROOT)

clang/cmake/caches/Fuchsia.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
9797
set(LLVM_ENABLE_BACKTRACES ON CACHE BOOL "")
9898
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
9999
if(APPLE)
100-
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "")
100+
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "")
101101
elseif(WIN32)
102102
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE STRING "")
103103
endif()
@@ -140,7 +140,7 @@ else()
140140
set(SANITIZER_TEST_CXX "libc++" CACHE STRING "")
141141
set(SANITIZER_TEST_CXX_INTREE ON CACHE BOOL "")
142142
set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
143-
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13;-DCMAKE_OSX_ARCHITECTURES=arm64|x86_64" CACHE STRING "")
143+
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0;-DCMAKE_OSX_ARCHITECTURES=arm64|x86_64" CACHE STRING "")
144144
endif()
145145

146146
if(BOOTSTRAP_CMAKE_SYSTEM_NAME)

clang/docs/LanguageExtensions.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4854,6 +4854,14 @@ memory scope argument. These are designed to be a generic alternative to the
48544854
``__opencl_atomic_*`` builtin functions for targets that support atomic memory
48554855
scopes.
48564856
4857+
Clang provides two additional __scoped_atomic builtins:
4858+
4859+
* ``__scoped_atomic_uinc_wrap``
4860+
* ``__scoped_atomic_udec_wrap``
4861+
4862+
See LLVM IR `atomicrmw <https://llvm.org/docs/LangRef.html#atomicrmw-instruction>`_
4863+
instruction for the semantics of uinc_wrap and udec_wrap.
4864+
48574865
Atomic memory scopes are designed to assist optimizations for systems with
48584866
several levels of memory hierarchy like GPUs. The following memory scopes are
48594867
currently supported:

0 commit comments

Comments
 (0)