Skip to content

Commit

Permalink
Merge llvm-project release/14.x llvmorg-14.0.3-0-g1f9140064dfb
Browse files Browse the repository at this point in the history
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.3-0-g1f9140064dfb.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit 3a9a9c0)
  • Loading branch information
DimitryAndric committed Jun 4, 2022
1 parent d3978dc commit a13b6fc
Show file tree
Hide file tree
Showing 88 changed files with 985 additions and 660 deletions.
4 changes: 2 additions & 2 deletions ObsoleteFiles.inc
Expand Up @@ -36,7 +36,7 @@
# xargs -n1 | sort | uniq -d;
# done

# 20220604: new clang import which bumps version from 13.0.0 to 14.0.0
# 20220604: new clang import which bumps version from 13.0.0 to 14.0.3
OLD_FILES+=usr/lib/clang/13.0.0/include/cuda_wrappers/algorithm
OLD_FILES+=usr/lib/clang/13.0.0/include/cuda_wrappers/complex
OLD_FILES+=usr/lib/clang/13.0.0/include/cuda_wrappers/new
Expand Down Expand Up @@ -333,7 +333,7 @@ OLD_DIRS+=usr/lib/clang/13.0.0/lib/freebsd
OLD_DIRS+=usr/lib/clang/13.0.0/lib
OLD_DIRS+=usr/lib/clang/13.0.0

# 20220604: new libc++ import which bumps version from 13.0.0 to 14.0.0
# 20220604: new libc++ import which bumps version from 13.0.0 to 14.0.3
OLD_FILES+=usr/include/c++/v1/__function_like.h
OLD_FILES+=usr/include/c++/v1/__memory/pointer_safety.h
OLD_FILES+=usr/include/c++/v1/__utility/__decay_copy.h
Expand Down
3 changes: 2 additions & 1 deletion contrib/llvm-project/clang/include/clang/Driver/Options.td
Expand Up @@ -3372,7 +3372,7 @@ def mmark_bti_property : Flag<["-"], "mmark-bti-property">,
def mno_bti_at_return_twice : Flag<["-"], "mno-bti-at-return-twice">,
Group<m_arm_Features_Group>,
HelpText<"Do not add a BTI instruction after a setjmp or other"
" return-twice construct (Arm only)">;
" return-twice construct (Arm/AArch64 only)">;

foreach i = {1-31} in
def ffixed_x#i : Flag<["-"], "ffixed-x"#i>, Group<m_Group>,
Expand Down Expand Up @@ -3400,6 +3400,7 @@ def msign_return_address_EQ : Joined<["-"], "msign-return-address=">,
Flags<[CC1Option]>, Group<m_Group>, Values<"none,all,non-leaf">,
HelpText<"Select return address signing scope">;
def mbranch_protection_EQ : Joined<["-"], "mbranch-protection=">,
Group<m_Group>,
HelpText<"Enforce targets of indirect branches and function returns">;

def mharden_sls_EQ : Joined<["-"], "mharden-sls=">,
Expand Down
Expand Up @@ -26,6 +26,7 @@

namespace llvm {
namespace orc {
class LLJIT;
class ThreadSafeContext;
}
} // namespace llvm
Expand Down Expand Up @@ -56,6 +57,7 @@ class Interpreter {
static llvm::Expected<std::unique_ptr<Interpreter>>
create(std::unique_ptr<CompilerInstance> CI);
const CompilerInstance *getCompilerInstance() const;
const llvm::orc::LLJIT *getExecutionEngine() const;
llvm::Expected<PartialTranslationUnit &> Parse(llvm::StringRef Code);
llvm::Error Execute(PartialTranslationUnit &T);
llvm::Error ParseAndExecute(llvm::StringRef Code) {
Expand Down
14 changes: 12 additions & 2 deletions contrib/llvm-project/clang/lib/CodeGen/CGExpr.cpp
Expand Up @@ -4895,15 +4895,25 @@ RValue CodeGenFunction::EmitSimpleCallExpr(const CallExpr *E,
return EmitCall(E->getCallee()->getType(), Callee, E, ReturnValue);
}

// Detect the unusual situation where an inline version is shadowed by a
// non-inline version. In that case we should pick the external one
// everywhere. That's GCC behavior too.
static bool OnlyHasInlineBuiltinDeclaration(const FunctionDecl *FD) {
for (const FunctionDecl *PD = FD; PD; PD = PD->getPreviousDecl())
if (!PD->isInlineBuiltinDeclaration())
return false;
return true;
}

static CGCallee EmitDirectCallee(CodeGenFunction &CGF, GlobalDecl GD) {
const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl());

if (auto builtinID = FD->getBuiltinID()) {
std::string FDInlineName = (FD->getName() + ".inline").str();
// When directing calling an inline builtin, call it through it's mangled
// name to make it clear it's not the actual builtin.
if (FD->isInlineBuiltinDeclaration() &&
CGF.CurFn->getName() != FDInlineName) {
if (CGF.CurFn->getName() != FDInlineName &&
OnlyHasInlineBuiltinDeclaration(FD)) {
llvm::Constant *CalleePtr = EmitFunctionDeclPointer(CGF.CGM, GD);
llvm::Function *Fn = llvm::cast<llvm::Function>(CalleePtr);
llvm::Module *M = Fn->getParent();
Expand Down
Expand Up @@ -592,4 +592,7 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
// Enabled A53 errata (835769) workaround by default on android
Features.push_back("+fix-cortex-a53-835769");
}

if (Args.getLastArg(options::OPT_mno_bti_at_return_twice))
Features.push_back("+no-bti-at-return-twice");
}
9 changes: 9 additions & 0 deletions contrib/llvm-project/clang/lib/Driver/ToolChains/OpenBSD.cpp
Expand Up @@ -342,3 +342,12 @@ Tool *OpenBSD::buildAssembler() const {
Tool *OpenBSD::buildLinker() const { return new tools::openbsd::Linker(*this); }

bool OpenBSD::HasNativeLLVMSupport() const { return true; }

bool OpenBSD::IsUnwindTablesDefault(const ArgList &Args) const {
switch (getArch()) {
case llvm::Triple::arm:
return false;
default:
return true;
}
}
4 changes: 1 addition & 3 deletions contrib/llvm-project/clang/lib/Driver/ToolChains/OpenBSD.h
Expand Up @@ -82,9 +82,7 @@ class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF {
std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
FileType Type = ToolChain::FT_Static) const override;

bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override {
return true;
}
bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override;

LangOptions::StackProtectorMode
GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
Expand Down
Expand Up @@ -45,6 +45,7 @@ class IncrementalExecutor {
llvm::Error runCtors() const;
llvm::Expected<llvm::JITTargetAddress>
getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const;
llvm::orc::LLJIT *getExecutionEngine() const { return Jit.get(); }
};

} // end namespace clang
Expand Down
6 changes: 6 additions & 0 deletions contrib/llvm-project/clang/lib/Interpreter/Interpreter.cpp
Expand Up @@ -196,6 +196,12 @@ const CompilerInstance *Interpreter::getCompilerInstance() const {
return IncrParser->getCI();
}

const llvm::orc::LLJIT *Interpreter::getExecutionEngine() const {
if (IncrExecutor)
return IncrExecutor->getExecutionEngine();
return nullptr;
}

llvm::Expected<PartialTranslationUnit &>
Interpreter::Parse(llvm::StringRef Code) {
return IncrParser->Parse(Code);
Expand Down
23 changes: 16 additions & 7 deletions contrib/llvm-project/clang/utils/TableGen/NeonEmitter.cpp
Expand Up @@ -502,6 +502,7 @@ class Intrinsic {
void emitBody(StringRef CallPrefix);
void emitShadowedArgs();
void emitArgumentReversal();
void emitReturnVarDecl();
void emitReturnReversal();
void emitReverseVariable(Variable &Dest, Variable &Src);
void emitNewLine();
Expand Down Expand Up @@ -1228,6 +1229,15 @@ void Intrinsic::emitArgumentReversal() {
}
}

void Intrinsic::emitReturnVarDecl() {
assert(RetVar.getType() == Types[0]);
// Create a return variable, if we're not void.
if (!RetVar.getType().isVoid()) {
OS << " " << RetVar.getType().str() << " " << RetVar.getName() << ";";
emitNewLine();
}
}

void Intrinsic::emitReturnReversal() {
if (isBigEndianSafe())
return;
Expand Down Expand Up @@ -1353,13 +1363,6 @@ void Intrinsic::emitBodyAsBuiltinCall() {
void Intrinsic::emitBody(StringRef CallPrefix) {
std::vector<std::string> Lines;

assert(RetVar.getType() == Types[0]);
// Create a return variable, if we're not void.
if (!RetVar.getType().isVoid()) {
OS << " " << RetVar.getType().str() << " " << RetVar.getName() << ";";
emitNewLine();
}

if (!Body || Body->getValues().empty()) {
// Nothing specific to output - must output a builtin.
emitBodyAsBuiltinCall();
Expand Down Expand Up @@ -1849,6 +1852,9 @@ void Intrinsic::generateImpl(bool ReverseArguments,
OS << " __attribute__((unavailable));";
} else {
emitOpeningBrace();
// Emit return variable declaration first as to not trigger
// -Wdeclaration-after-statement.
emitReturnVarDecl();
emitShadowedArgs();
if (ReverseArguments)
emitArgumentReversal();
Expand All @@ -1867,6 +1873,9 @@ void Intrinsic::indexBody() {
CurrentRecord = R;

initVariables();
// Emit return variable declaration first as to not trigger
// -Wdeclaration-after-statement.
emitReturnVarDecl();
emitBody("");
OS.str("");

Expand Down
30 changes: 12 additions & 18 deletions contrib/llvm-project/compiler-rt/lib/asan/asan_linux.cpp
Expand Up @@ -131,30 +131,24 @@ static int FindFirstDSOCallback(struct dl_phdr_info *info, size_t size,
VReport(2, "info->dlpi_name = %s\tinfo->dlpi_addr = %p\n", info->dlpi_name,
(void *)info->dlpi_addr);

// Continue until the first dynamic library is found
if (!info->dlpi_name || info->dlpi_name[0] == 0)
return 0;

// Ignore vDSO
if (internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0)
return 0;
const char **name = (const char **)data;

#if SANITIZER_FREEBSD || SANITIZER_NETBSD
// Ignore first entry (the main program)
char **p = (char **)data;
if (!(*p)) {
*p = (char *)-1;
if (!*name) {
*name = "";
return 0;
}
#endif

#if SANITIZER_SOLARIS
// Ignore executable on Solaris
if (info->dlpi_addr == 0)
# if SANITIZER_LINUX
// Ignore vDSO. glibc versions earlier than 2.15 (and some patched
// by distributors) return an empty name for the vDSO entry, so
// detect this as well.
if (!info->dlpi_name[0] ||
internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0)
return 0;
#endif
# endif

*(const char **)data = info->dlpi_name;
*name = info->dlpi_name;
return 1;
}

Expand All @@ -175,7 +169,7 @@ void AsanCheckDynamicRTPrereqs() {
// Ensure that dynamic RT is the first DSO in the list
const char *first_dso_name = nullptr;
dl_iterate_phdr(FindFirstDSOCallback, &first_dso_name);
if (first_dso_name && !IsDynamicRTName(first_dso_name)) {
if (first_dso_name && first_dso_name[0] && !IsDynamicRTName(first_dso_name)) {
Report("ASan runtime does not come first in initial library list; "
"you should either link runtime to your application or "
"manually preload it with LD_PRELOAD.\n");
Expand Down
Expand Up @@ -49,7 +49,7 @@ inline u32 computeCRC32(u32 Crc, uptr Value, uptr *Array, uptr ArraySize) {
// as opposed to only for scudo_crc32.cpp. This means that other hardware
// specific instructions were likely emitted at other places, and as a
// result there is no reason to not use it here.
#if defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
#if defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
Crc = CRC32_INTRINSIC(Crc, Value);
for (uptr i = 0; i < ArraySize; i++)
Crc = CRC32_INTRINSIC(Crc, Array[i]);
Expand All @@ -65,7 +65,7 @@ inline u32 computeCRC32(u32 Crc, uptr Value, uptr *Array, uptr ArraySize) {
for (uptr i = 0; i < ArraySize; i++)
Crc = computeSoftwareCRC32(Crc, Array[i]);
return Crc;
#endif // defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
#endif // defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
}

static BackendT &getBackend();
Expand Down
4 changes: 2 additions & 2 deletions contrib/llvm-project/compiler-rt/lib/scudo/scudo_crc32.cpp
Expand Up @@ -15,10 +15,10 @@

namespace __scudo {

#if defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
#if defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
u32 computeHardwareCRC32(u32 Crc, uptr Data) {
return CRC32_INTRINSIC(Crc, Data);
}
#endif // defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
#endif // defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)

} // namespace __scudo
12 changes: 8 additions & 4 deletions contrib/llvm-project/compiler-rt/lib/scudo/scudo_crc32.h
Expand Up @@ -16,21 +16,25 @@
#include "sanitizer_common/sanitizer_internal_defs.h"

// Hardware CRC32 is supported at compilation via the following:
// - for i386 & x86_64: -msse4.2
// - for i386 & x86_64: -mcrc32 (earlier: -msse4.2)
// - for ARM & AArch64: -march=armv8-a+crc or -mcrc
// An additional check must be performed at runtime as well to make sure the
// emitted instructions are valid on the target host.

#if defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
# ifdef __SSE4_2__
#if defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
# if defined(__CRC32__)
// NB: clang has <crc32intrin.h> but GCC does not
# include <smmintrin.h>
# define CRC32_INTRINSIC FIRST_32_SECOND_64(__builtin_ia32_crc32si, __builtin_ia32_crc32di)
# elif defined(__SSE4_2__)
# include <smmintrin.h>
# define CRC32_INTRINSIC FIRST_32_SECOND_64(_mm_crc32_u32, _mm_crc32_u64)
# endif
# ifdef __ARM_FEATURE_CRC32
# include <arm_acle.h>
# define CRC32_INTRINSIC FIRST_32_SECOND_64(__crc32cw, __crc32cd)
# endif
#endif // defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
#endif // defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)

namespace __scudo {

Expand Down
Expand Up @@ -12,12 +12,16 @@
#include "internal_defs.h"

// Hardware CRC32 is supported at compilation via the following:
// - for i386 & x86_64: -msse4.2
// - for i386 & x86_64: -mcrc32 (earlier: -msse4.2)
// - for ARM & AArch64: -march=armv8-a+crc or -mcrc
// An additional check must be performed at runtime as well to make sure the
// emitted instructions are valid on the target host.

#ifdef __SSE4_2__
#if defined(__CRC32__)
// NB: clang has <crc32intrin.h> but GCC does not
#include <smmintrin.h>
#define CRC32_INTRINSIC FIRST_32_SECOND_64(__builtin_ia32_crc32si, __builtin_ia32_crc32di)
#elif defined(__SSE4_2__)
#include <smmintrin.h>
#define CRC32_INTRINSIC FIRST_32_SECOND_64(_mm_crc32_u32, _mm_crc32_u64)
#endif
Expand Down
4 changes: 2 additions & 2 deletions contrib/llvm-project/compiler-rt/lib/scudo/standalone/chunk.h
Expand Up @@ -25,7 +25,7 @@ inline u16 computeChecksum(u32 Seed, uptr Value, uptr *Array, uptr ArraySize) {
// as opposed to only for crc32_hw.cpp. This means that other hardware
// specific instructions were likely emitted at other places, and as a result
// there is no reason to not use it here.
#if defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
#if defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
u32 Crc = static_cast<u32>(CRC32_INTRINSIC(Seed, Value));
for (uptr I = 0; I < ArraySize; I++)
Crc = static_cast<u32>(CRC32_INTRINSIC(Crc, Array[I]));
Expand All @@ -42,7 +42,7 @@ inline u16 computeChecksum(u32 Seed, uptr Value, uptr *Array, uptr ArraySize) {
Checksum = computeBSDChecksum(Checksum, Array[I]);
return Checksum;
}
#endif // defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
#endif // defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
}

namespace Chunk {
Expand Down
Expand Up @@ -10,10 +10,10 @@

namespace scudo {

#if defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
#if defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
u32 computeHardwareCRC32(u32 Crc, uptr Data) {
return static_cast<u32>(CRC32_INTRINSIC(Crc, Data));
}
#endif // defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)
#endif // defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32)

} // namespace scudo
2 changes: 1 addition & 1 deletion contrib/llvm-project/libcxx/src/random.cpp
Expand Up @@ -210,7 +210,7 @@ random_device::entropy() const noexcept
return std::numeric_limits<result_type>::digits;

return ent;
#elif defined(__OpenBSD__) || defined(_LIBCPP_USING_FUCHSIA_CPRNG)
#elif defined(_LIBCPP_USING_ARC4_RANDOM) || defined(_LIBCPP_USING_FUCHSIA_CPRNG)
return std::numeric_limits<result_type>::digits;
#else
return 0;
Expand Down

0 comments on commit a13b6fc

Please sign in to comment.