aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2022-09-10 18:56:18 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-04-09 14:54:50 +0000
commit5d976198a6de2c316a9f371a4ca587cc8545d941 (patch)
tree4ed3162b0c42610f1f159e18e3d0cdf2f32451d3
parenta2e927433f9d66b477247c4d36da79c008cfa8a4 (diff)
downloadsrc-5d976198a6de2c316a9f371a4ca587cc8545d941.tar.gz
src-5d976198a6de2c316a9f371a4ca587cc8545d941.zip
Merge llvm-project release/15.x llvmorg-15.0.0-9-g1c73596d3454
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-15.0.0-9-g1c73596d3454. PR: 265425 MFC after: 2 weeks (cherry picked from commit a4a491e2238b12ccd64d3faf9e6401487f6f1f1b)
-rw-r--r--contrib/llvm-project/clang/include/clang/Lex/Preprocessor.h7
-rw-r--r--contrib/llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp7
-rw-r--r--contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp5
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp13
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.h7
-rw-r--r--contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp15
-rw-r--r--contrib/llvm-project/clang/lib/Driver/ToolChains/Cuda.cpp4
-rw-r--r--contrib/llvm-project/clang/lib/Format/TokenAnnotator.cpp19
-rw-r--r--contrib/llvm-project/clang/lib/Headers/cpuid.h1
-rw-r--r--contrib/llvm-project/clang/lib/Lex/PPMacroExpansion.cpp55
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp7
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp2
-rw-r--r--contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp3
-rw-r--r--contrib/llvm-project/clang/utils/TableGen/SveEmitter.cpp2
-rw-r--r--contrib/llvm-project/libcxx/include/regex2
-rw-r--r--contrib/llvm-project/libcxx/include/span7
-rw-r--r--contrib/llvm-project/lld/COFF/Driver.cpp15
-rw-r--r--contrib/llvm-project/lld/docs/ReleaseNotes.rst11
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Analysis/LoopAccessAnalysis.h2
-rw-r--r--contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h30
-rw-r--r--contrib/llvm-project/llvm/include/llvm/MC/MCContext.h6
-rw-r--r--contrib/llvm-project/llvm/include/llvm/MC/MCDwarf.h6
-rw-r--r--contrib/llvm-project/llvm/lib/Analysis/LoopAccessAnalysis.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp56
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp5
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp10
-rw-r--r--contrib/llvm-project/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp302
-rw-r--r--contrib/llvm-project/llvm/lib/MC/MCContext.cpp39
-rw-r--r--contrib/llvm-project/llvm/lib/MC/MCDwarf.cpp14
-rw-r--r--contrib/llvm-project/llvm/lib/MC/MCParser/ELFAsmParser.cpp3
-rw-r--r--contrib/llvm-project/llvm/lib/Support/Host.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp11
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/TargetInfo/RISCVTargetInfo.cpp8
-rw-r--r--contrib/llvm-project/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp1
-rw-r--r--contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp49
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp4
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Utils/LoopUtils.cpp5
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp12
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp18
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp28
-rw-r--r--lib/clang/include/VCSVersion.inc6
-rw-r--r--lib/clang/include/lld/Common/Version.inc2
-rw-r--r--lib/clang/include/llvm/Support/VCSRevision.h2
44 files changed, 616 insertions, 193 deletions
diff --git a/contrib/llvm-project/clang/include/clang/Lex/Preprocessor.h b/contrib/llvm-project/clang/include/clang/Lex/Preprocessor.h
index 79454b5addea..7c5df05069ed 100644
--- a/contrib/llvm-project/clang/include/clang/Lex/Preprocessor.h
+++ b/contrib/llvm-project/clang/include/clang/Lex/Preprocessor.h
@@ -178,6 +178,8 @@ class Preprocessor {
IdentifierInfo *Ident__is_target_vendor; // __is_target_vendor
IdentifierInfo *Ident__is_target_os; // __is_target_os
IdentifierInfo *Ident__is_target_environment; // __is_target_environment
+ IdentifierInfo *Ident__is_target_variant_os;
+ IdentifierInfo *Ident__is_target_variant_environment;
IdentifierInfo *Ident__FLT_EVAL_METHOD__; // __FLT_EVAL_METHOD
// Weak, only valid (and set) while InMacroArgs is true.
@@ -1353,6 +1355,11 @@ public:
StringRef getLastMacroWithSpelling(SourceLocation Loc,
ArrayRef<TokenValue> Tokens) const;
+ /// Get the predefines for this processor.
+ /// Used by some third-party tools to inspect and add predefines (see
+ /// https://github.com/llvm/llvm-project/issues/57483).
+ const std::string &getPredefines() const { return Predefines; }
+
/// Set the predefines for this Preprocessor.
///
/// These predefines are automatically injected when parsing the main file.
diff --git a/contrib/llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp b/contrib/llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp
index 6f3ede2ce42a..5ddd95e2ecca 100644
--- a/contrib/llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/contrib/llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -1889,12 +1889,7 @@ void ItaniumRecordLayoutBuilder::LayoutField(const FieldDecl *D,
UnfilledBitsInLastUnit = 0;
LastBitfieldStorageUnitSize = 0;
- llvm::Triple Target = Context.getTargetInfo().getTriple();
- bool FieldPacked = (Packed && (!FieldClass || FieldClass->isPOD() ||
- Context.getLangOpts().getClangABICompat() <=
- LangOptions::ClangABI::Ver14 ||
- Target.isPS() || Target.isOSDarwin())) ||
- D->hasAttr<PackedAttr>();
+ bool FieldPacked = Packed || D->hasAttr<PackedAttr>();
AlignRequirementKind AlignRequirement = AlignRequirementKind::None;
CharUnits FieldSize;
diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp b/contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp
index 60ef52ac3f0d..8d8972c1613a 100644
--- a/contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp
@@ -489,9 +489,12 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__FP_FAST_FMA", "1");
Builder.defineMacro("__FP_FAST_FMAF", "1");
+ // C/C++ operators work on both VLS and VLA SVE types
+ if (FPU & SveMode)
+ Builder.defineMacro("__ARM_FEATURE_SVE_VECTOR_OPERATORS", "2");
+
if (Opts.VScaleMin && Opts.VScaleMin == Opts.VScaleMax) {
Builder.defineMacro("__ARM_FEATURE_SVE_BITS", Twine(Opts.VScaleMin * 128));
- Builder.defineMacro("__ARM_FEATURE_SVE_VECTOR_OPERATORS");
}
}
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp
index aa55cdaca5dc..570424dae7fc 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -2582,8 +2582,9 @@ static void emitOMPSimdRegion(CodeGenFunction &CGF, const OMPLoopDirective &S,
CGF.EmitOMPReductionClauseFinal(S, /*ReductionKind=*/OMPD_simd);
emitPostUpdateForReductionClause(CGF, S,
[](CodeGenFunction &) { return nullptr; });
+ LoopScope.restoreMap();
+ CGF.EmitOMPLinearClauseFinal(S, [](CodeGenFunction &) { return nullptr; });
}
- CGF.EmitOMPLinearClauseFinal(S, [](CodeGenFunction &) { return nullptr; });
// Emit: if (PreCond) - end.
if (ContBlock) {
CGF.EmitBranch(ContBlock);
@@ -3426,11 +3427,12 @@ bool CodeGenFunction::EmitOMPWorksharingLoop(
EmitOMPLastprivateClauseFinal(
S, isOpenMPSimdDirective(S.getDirectiveKind()),
Builder.CreateIsNotNull(EmitLoadOfScalar(IL, S.getBeginLoc())));
+ LoopScope.restoreMap();
+ EmitOMPLinearClauseFinal(S, [IL, &S](CodeGenFunction &CGF) {
+ return CGF.Builder.CreateIsNotNull(
+ CGF.EmitLoadOfScalar(IL, S.getBeginLoc()));
+ });
}
- EmitOMPLinearClauseFinal(S, [IL, &S](CodeGenFunction &CGF) {
- return CGF.Builder.CreateIsNotNull(
- CGF.EmitLoadOfScalar(IL, S.getBeginLoc()));
- });
DoacrossCleanupScope.ForceCleanup();
// We're now done with the loop, so jump to the continuation block.
if (ContBlock) {
@@ -7658,6 +7660,7 @@ void CodeGenFunction::EmitOMPTaskLoopBasedDirective(const OMPLoopDirective &S) {
CGF.GetAddrOfLocalVar(*LIP), /*Volatile=*/false,
(*LIP)->getType(), S.getBeginLoc())));
}
+ LoopScope.restoreMap();
CGF.EmitOMPLinearClauseFinal(S, [LIP, &S](CodeGenFunction &CGF) {
return CGF.Builder.CreateIsNotNull(
CGF.EmitLoadOfScalar(CGF.GetAddrOfLocalVar(*LIP), /*Volatile=*/false,
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.h b/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.h
index fe0890f433e8..672acd844525 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.h
+++ b/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.h
@@ -1094,7 +1094,7 @@ public:
void ForceCleanup() {
RunCleanupsScope::ForceCleanup();
- MappedVars.restore(CGF);
+ restoreMap();
}
/// Exit scope - all the mapped variables are restored.
@@ -1108,6 +1108,11 @@ public:
VD = VD->getCanonicalDecl();
return !VD->isLocalVarDeclOrParm() && CGF.LocalDeclMap.count(VD) > 0;
}
+
+ /// Restore all mapped variables w/o clean up. This is usefully when we want
+ /// to reference the original variables but don't want the clean up because
+ /// that could emit lifetime end too early, causing backend issue #56913.
+ void restoreMap() { MappedVars.restore(CGF); }
};
/// Save/restore original map of previously emitted local vars in case when we
diff --git a/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp b/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp
index 195ad8cdc13e..36e10e4df4c1 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp
@@ -11002,9 +11002,22 @@ bool RISCVABIInfo::detectFPCCEligibleStructHelper(QualType Ty, CharUnits CurOff,
// Unions aren't eligible unless they're empty (which is caught above).
if (RD->isUnion())
return false;
+ const ASTRecordLayout &Layout = getContext().getASTRecordLayout(RD);
+ // If this is a C++ record, check the bases first.
+ if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
+ for (const CXXBaseSpecifier &B : CXXRD->bases()) {
+ const auto *BDecl =
+ cast<CXXRecordDecl>(B.getType()->castAs<RecordType>()->getDecl());
+ CharUnits BaseOff = Layout.getBaseClassOffset(BDecl);
+ bool Ret = detectFPCCEligibleStructHelper(B.getType(), CurOff + BaseOff,
+ Field1Ty, Field1Off, Field2Ty,
+ Field2Off);
+ if (!Ret)
+ return false;
+ }
+ }
int ZeroWidthBitFieldCount = 0;
for (const FieldDecl *FD : RD->fields()) {
- const ASTRecordLayout &Layout = getContext().getASTRecordLayout(RD);
uint64_t FieldOffInBits = Layout.getFieldOffset(FD->getFieldIndex());
QualType QTy = FD->getType();
if (FD->isBitField()) {
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/Cuda.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/Cuda.cpp
index 5e59677947e6..7ad990dda467 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -693,8 +693,8 @@ CudaToolChain::CudaToolChain(const Driver &D, const llvm::Triple &Triple,
std::string CudaToolChain::getInputFilename(const InputInfo &Input) const {
// Only object files are changed, for example assembly files keep their .s
- // extensions.
- if (Input.getType() != types::TY_Object)
+ // extensions. If the user requested device-only compilation don't change it.
+ if (Input.getType() != types::TY_Object || getDriver().offloadDeviceOnly())
return ToolChain::getInputFilename(Input);
// Replace extension for object files with cubin because nvlink relies on
diff --git a/contrib/llvm-project/clang/lib/Format/TokenAnnotator.cpp b/contrib/llvm-project/clang/lib/Format/TokenAnnotator.cpp
index 5991cf23d5dc..cf6549e2a5bd 100644
--- a/contrib/llvm-project/clang/lib/Format/TokenAnnotator.cpp
+++ b/contrib/llvm-project/clang/lib/Format/TokenAnnotator.cpp
@@ -2329,25 +2329,6 @@ private:
!PrevToken->MatchingParen)
return TT_PointerOrReference;
- // For "} &&"
- if (PrevToken->is(tok::r_brace) && Tok.is(tok::ampamp)) {
- const FormatToken *MatchingLBrace = PrevToken->MatchingParen;
-
- // We check whether there is a TemplateCloser(">") to indicate it's a
- // template or not. If it's not a template, "&&" is likely a reference
- // operator.
- // struct {} &&ref = {};
- if (!MatchingLBrace)
- return TT_PointerOrReference;
- FormatToken *BeforeLBrace = MatchingLBrace->getPreviousNonComment();
- if (!BeforeLBrace || BeforeLBrace->isNot(TT_TemplateCloser))
- return TT_PointerOrReference;
-
- // If it is a template, "&&" is a binary operator.
- // enable_if<>{} && ...
- return TT_BinaryOperator;
- }
-
if (PrevToken->Tok.isLiteral() ||
PrevToken->isOneOf(tok::r_paren, tok::r_square, tok::kw_true,
tok::kw_false, tok::r_brace)) {
diff --git a/contrib/llvm-project/clang/lib/Headers/cpuid.h b/contrib/llvm-project/clang/lib/Headers/cpuid.h
index 5d262a60735f..caa0069c2e1f 100644
--- a/contrib/llvm-project/clang/lib/Headers/cpuid.h
+++ b/contrib/llvm-project/clang/lib/Headers/cpuid.h
@@ -232,6 +232,7 @@
/* Features in %ebx for leaf 0x80000008 */
#define bit_CLZERO 0x00000001
+#define bit_RDPRU 0x00000010
#define bit_WBNOINVD 0x00000200
diff --git a/contrib/llvm-project/clang/lib/Lex/PPMacroExpansion.cpp b/contrib/llvm-project/clang/lib/Lex/PPMacroExpansion.cpp
index f3be2107f985..c56f41c4495e 100644
--- a/contrib/llvm-project/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/contrib/llvm-project/clang/lib/Lex/PPMacroExpansion.cpp
@@ -387,6 +387,10 @@ void Preprocessor::RegisterBuiltinMacros() {
Ident__is_target_os = RegisterBuiltinMacro(*this, "__is_target_os");
Ident__is_target_environment =
RegisterBuiltinMacro(*this, "__is_target_environment");
+ Ident__is_target_variant_os =
+ RegisterBuiltinMacro(*this, "__is_target_variant_os");
+ Ident__is_target_variant_environment =
+ RegisterBuiltinMacro(*this, "__is_target_variant_environment");
// Modules.
Ident__building_module = RegisterBuiltinMacro(*this, "__building_module");
@@ -1431,6 +1435,39 @@ static bool isTargetEnvironment(const TargetInfo &TI,
return TI.getTriple().getEnvironment() == Env.getEnvironment();
}
+/// Implements the __is_target_variant_os builtin macro.
+static bool isTargetVariantOS(const TargetInfo &TI, const IdentifierInfo *II) {
+ if (TI.getTriple().isOSDarwin()) {
+ const llvm::Triple *VariantTriple = TI.getDarwinTargetVariantTriple();
+ if (!VariantTriple)
+ return false;
+
+ std::string OSName =
+ (llvm::Twine("unknown-unknown-") + II->getName().lower()).str();
+ llvm::Triple OS(OSName);
+ if (OS.getOS() == llvm::Triple::Darwin) {
+ // Darwin matches macos, ios, etc.
+ return VariantTriple->isOSDarwin();
+ }
+ return VariantTriple->getOS() == OS.getOS();
+ }
+ return false;
+}
+
+/// Implements the __is_target_variant_environment builtin macro.
+static bool isTargetVariantEnvironment(const TargetInfo &TI,
+ const IdentifierInfo *II) {
+ if (TI.getTriple().isOSDarwin()) {
+ const llvm::Triple *VariantTriple = TI.getDarwinTargetVariantTriple();
+ if (!VariantTriple)
+ return false;
+ std::string EnvName = (llvm::Twine("---") + II->getName().lower()).str();
+ llvm::Triple Env(EnvName);
+ return VariantTriple->getEnvironment() == Env.getEnvironment();
+ }
+ return false;
+}
+
/// ExpandBuiltinMacro - If an identifier token is read that is to be expanded
/// as a builtin macro, handle it and return the next token as 'Tok'.
void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
@@ -1677,6 +1714,8 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
.Case("__is_target_vendor", true)
.Case("__is_target_os", true)
.Case("__is_target_environment", true)
+ .Case("__is_target_variant_os", true)
+ .Case("__is_target_variant_environment", true)
.Default(false);
}
});
@@ -1877,6 +1916,22 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
Tok, *this, diag::err_feature_check_malformed);
return II && isTargetEnvironment(getTargetInfo(), II);
});
+ } else if (II == Ident__is_target_variant_os) {
+ EvaluateFeatureLikeBuiltinMacro(
+ OS, Tok, II, *this, false,
+ [this](Token &Tok, bool &HasLexedNextToken) -> int {
+ IdentifierInfo *II = ExpectFeatureIdentifierInfo(
+ Tok, *this, diag::err_feature_check_malformed);
+ return II && isTargetVariantOS(getTargetInfo(), II);
+ });
+ } else if (II == Ident__is_target_variant_environment) {
+ EvaluateFeatureLikeBuiltinMacro(
+ OS, Tok, II, *this, false,
+ [this](Token &Tok, bool &HasLexedNextToken) -> int {
+ IdentifierInfo *II = ExpectFeatureIdentifierInfo(
+ Tok, *this, diag::err_feature_check_malformed);
+ return II && isTargetVariantEnvironment(getTargetInfo(), II);
+ });
} else {
llvm_unreachable("Unknown identifier!");
}
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp b/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp
index 0f79978b0911..83081bbf0aa0 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp
@@ -15603,6 +15603,8 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc,
resultType->castAs<VectorType>()->getVectorKind() !=
VectorType::AltiVecBool))
break;
+ else if (resultType->isVLSTBuiltinType()) // SVE vectors allow + and -
+ break;
else if (getLangOpts().CPlusPlus && // C++ [expr.unary.op]p6
Opc == UO_Plus &&
resultType->isPointerType())
@@ -17598,6 +17600,11 @@ static void RemoveNestedImmediateInvocation(
DRSet.erase(E);
return E;
}
+ ExprResult TransformLambdaExpr(LambdaExpr *E) {
+ // Do not rebuild lambdas to avoid creating a new type.
+ // Lambdas have already been processed inside their eval context.
+ return E;
+ }
bool AlwaysRebuild() { return false; }
bool ReplacingOriginal() { return true; }
bool AllowSkippingCXXConstructExpr() {
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp b/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
index 5331193de863..6f9e025283f5 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
@@ -5412,6 +5412,8 @@ void DiagnoseBuiltinDeprecation(Sema& S, TypeTrait Kind,
Replacement = BTT_IsTriviallyAssignable;
break;
case UTT_HasTrivialCopy:
+ Replacement = UTT_IsTriviallyCopyable;
+ break;
case UTT_HasTrivialDefaultConstructor:
case UTT_HasTrivialMoveConstructor:
Replacement = TT_IsTriviallyConstructible;
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp b/contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp
index dc1470bf7a9d..a92fec6a0232 100644
--- a/contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp
+++ b/contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp
@@ -2270,6 +2270,9 @@ bool Sema::isInOpenMPTargetExecutionDirective() const {
}
bool Sema::isOpenMPRebuildMemberExpr(ValueDecl *D) {
+ // Only rebuild for Field.
+ if (!dyn_cast<FieldDecl>(D))
+ return false;
DSAStackTy::DSAVarData DVarPrivate = DSAStack->hasDSA(
D,
[](OpenMPClauseKind C, bool AppliedToPointee,
diff --git a/contrib/llvm-project/clang/utils/TableGen/SveEmitter.cpp b/contrib/llvm-project/clang/utils/TableGen/SveEmitter.cpp
index b2f6ede56522..e1e1c078ccbf 100644
--- a/contrib/llvm-project/clang/utils/TableGen/SveEmitter.cpp
+++ b/contrib/llvm-project/clang/utils/TableGen/SveEmitter.cpp
@@ -1282,6 +1282,8 @@ void SVEEmitter::createHeader(raw_ostream &OS) {
OS << "#ifdef __cplusplus\n";
OS << "} // extern \"C\"\n";
OS << "#endif\n\n";
+ OS << "#undef __ai\n\n";
+ OS << "#undef __aio\n\n";
OS << "#endif /*__ARM_FEATURE_SVE */\n\n";
OS << "#endif /* __ARM_SVE_H */\n";
}
diff --git a/contrib/llvm-project/libcxx/include/regex b/contrib/llvm-project/libcxx/include/regex
index 850fe099df1e..26887e84bf28 100644
--- a/contrib/llvm-project/libcxx/include/regex
+++ b/contrib/llvm-project/libcxx/include/regex
@@ -1355,7 +1355,7 @@ inline _LIBCPP_INLINE_VISIBILITY
unsigned char __to_lower(unsigned char __c)
{
#if defined(__MVS__) && !defined(__NATIVE_ASCII_F)
- return c & 0xBF;
+ return __c & 0xBF;
#else
return __c | 0x20;
#endif
diff --git a/contrib/llvm-project/libcxx/include/span b/contrib/llvm-project/libcxx/include/span
index 00793a210cbe..67d2ac241ff2 100644
--- a/contrib/llvm-project/libcxx/include/span
+++ b/contrib/llvm-project/libcxx/include/span
@@ -453,9 +453,10 @@ public:
: __data{_VSTD::to_address(__first)}, __size{__count} {}
template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End>
- _LIBCPP_INLINE_VISIBILITY
- constexpr span(_It __first, _End __last)
- : __data(_VSTD::to_address(__first)), __size(__last - __first) {}
+ _LIBCPP_INLINE_VISIBILITY constexpr span(_It __first, _End __last)
+ : __data(_VSTD::to_address(__first)), __size(__last - __first) {
+ _LIBCPP_ASSERT(__last - __first >= 0, "invalid range in span's constructor (iterator, sentinel)");
+ }
template <size_t _Sz>
_LIBCPP_INLINE_VISIBILITY
diff --git a/contrib/llvm-project/lld/COFF/Driver.cpp b/contrib/llvm-project/lld/COFF/Driver.cpp
index 680f89b79b95..5b21337bb45e 100644
--- a/contrib/llvm-project/lld/COFF/Driver.cpp
+++ b/contrib/llvm-project/lld/COFF/Driver.cpp
@@ -2228,15 +2228,14 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
// Windows specific -- if __load_config_used can be resolved, resolve it.
if (ctx.symtab.findUnderscore("_load_config_used"))
addUndefined(mangle("_load_config_used"));
- } while (run());
- if (args.hasArg(OPT_include_optional)) {
- // Handle /includeoptional
- for (auto *arg : args.filtered(OPT_include_optional))
- if (isa_and_nonnull<LazyArchive>(ctx.symtab.find(arg->getValue())))
- addUndefined(arg->getValue());
- while (run());
- }
+ if (args.hasArg(OPT_include_optional)) {
+ // Handle /includeoptional
+ for (auto *arg : args.filtered(OPT_include_optional))
+ if (isa_and_nonnull<LazyArchive>(ctx.symtab.find(arg->getValue())))
+ addUndefined(arg->getValue());
+ }
+ } while (run());
// Create wrapped symbols for -wrap option.
std::vector<WrappedSymbol> wrapped = addWrappedSymbols(ctx, args);
diff --git a/contrib/llvm-project/lld/docs/ReleaseNotes.rst b/contrib/llvm-project/lld/docs/ReleaseNotes.rst
index 5819d67d3297..db0b66a3807c 100644
--- a/contrib/llvm-project/lld/docs/ReleaseNotes.rst
+++ b/contrib/llvm-project/lld/docs/ReleaseNotes.rst
@@ -5,13 +5,6 @@ lld |release| Release Notes
.. contents::
:local:
-.. only:: PreRelease
-
- .. warning::
- These are in-progress notes for the upcoming LLVM |release| release.
- Release notes for previous releases can be found on
- `the Download Page <https://releases.llvm.org/download.html>`_.
-
Introduction
============
@@ -98,7 +91,7 @@ MachO Improvements
* We now support proper relocation and pruning of EH frames. **Note:** this
comes at some performance overhead on x86_64 builds, and we recommend adding
- the ``-femit-compact-unwind=no-compact-unwind`` compile flag to avoid it.
+ the ``-femit-dwarf-unwind=no-compact-unwind`` compile flag to avoid it.
(`D129540 <https://reviews.llvm.org/D129540>`_,
`D122258 <https://reviews.llvm.org/D122258>`_)
@@ -212,6 +205,8 @@ Fixes
errors. (`D122624 <https://reviews.llvm.org/D122624>`_)
* Fixed handling of relocatable object files within frameworks.
(`D114841 <https://reviews.llvm.org/D114841>`_)
+* Fixed the PPC64R2SaveStub to only use non-pc-relative code.
+ (`D129580 <https://reviews.llvm.org/D129580>`_)
WebAssembly Improvements
------------------------
diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/LoopAccessAnalysis.h b/contrib/llvm-project/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
index 8f71ce9e96c0..af8e8d22269e 100644
--- a/contrib/llvm-project/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+++ b/contrib/llvm-project/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -253,6 +253,8 @@ public:
return {};
}
+ const Loop *getInnermostLoop() const { return InnermostLoop; }
+
private:
/// A wrapper around ScalarEvolution, used to add runtime SCEV checks, and
/// applies dynamic knowledge to simplify SCEV expressions and convert them
diff --git a/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h b/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h
index 26686143af95..a54f8f5d2db8 100644
--- a/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h
+++ b/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h
@@ -26,11 +26,14 @@
namespace llvm {
namespace symbolize {
+class LLVMSymbolizer;
+
/// Filter to convert parsed log symbolizer markup elements into human-readable
/// text.
class MarkupFilter {
public:
- MarkupFilter(raw_ostream &OS, Optional<bool> ColorsEnabled = llvm::None);
+ MarkupFilter(raw_ostream &OS, LLVMSymbolizer &Symbolizer,
+ Optional<bool> ColorsEnabled = llvm::None);
/// Filters a line containing symbolizer markup and writes the human-readable
/// results to the output stream.
@@ -57,6 +60,7 @@ private:
uint64_t ModuleRelativeAddr;
bool contains(uint64_t Addr) const;
+ uint64_t getModuleRelativeAddr(uint64_t Addr) const;
};
// An informational module line currently being constructed. As many mmap
@@ -67,6 +71,15 @@ private:
SmallVector<const MMap *> MMaps = {};
};
+ // The semantics of a possible program counter value.
+ enum class PCType {
+ // The address is a return address and must be adjusted to point to the call
+ // itself.
+ ReturnAddress,
+ // The address is the precise location in the code and needs no adjustment.
+ PreciseCode,
+ };
+
bool tryContextualElement(const MarkupNode &Node,
const SmallVector<MarkupNode> &DeferredNodes);
bool tryMMap(const MarkupNode &Element,
@@ -83,6 +96,9 @@ private:
bool tryPresentation(const MarkupNode &Node);
bool trySymbol(const MarkupNode &Node);
+ bool tryPC(const MarkupNode &Node);
+ bool tryBackTrace(const MarkupNode &Node);
+ bool tryData(const MarkupNode &Node);
bool trySGR(const MarkupNode &Node);
@@ -91,6 +107,9 @@ private:
void restoreColor();
void resetColor();
+ void printRawElement(const MarkupNode &Element);
+ void printValue(Twine Value);
+
Optional<Module> parseModule(const MarkupNode &Element) const;
Optional<MMap> parseMMap(const MarkupNode &Element) const;
@@ -99,19 +118,26 @@ private:
Optional<uint64_t> parseSize(StringRef Str) const;
Optional<SmallVector<uint8_t>> parseBuildID(StringRef Str) const;
Optional<std::string> parseMode(StringRef Str) const;
+ Optional<PCType> parsePCType(StringRef Str) const;
+ Optional<uint64_t> parseFrameNumber(StringRef Str) const;
bool checkTag(const MarkupNode &Node) const;
bool checkNumFields(const MarkupNode &Element, size_t Size) const;
bool checkNumFieldsAtLeast(const MarkupNode &Element, size_t Size) const;
+ bool checkNumFieldsAtMost(const MarkupNode &Element, size_t Size) const;
void reportTypeError(StringRef Str, StringRef TypeName) const;
void reportLocation(StringRef::iterator Loc) const;
- const MMap *overlappingMMap(const MMap &Map) const;
+ const MMap *getOverlappingMMap(const MMap &Map) const;
+ const MMap *getContainingMMap(uint64_t Addr) const;
+
+ uint64_t adjustAddr(uint64_t Addr, PCType Type) const;
StringRef lineEnding() const;
raw_ostream &OS;
+ LLVMSymbolizer &Symbolizer;
const bool ColorsEnabled;
MarkupParser Parser;
diff --git a/contrib/llvm-project/llvm/include/llvm/MC/MCContext.h b/contrib/llvm-project/llvm/include/llvm/MC/MCContext.h
index 61520c4f29bf..c20ce79ee4d0 100644
--- a/contrib/llvm-project/llvm/include/llvm/MC/MCContext.h
+++ b/contrib/llvm-project/llvm/include/llvm/MC/MCContext.h
@@ -190,7 +190,8 @@ private:
SmallString<128> CompilationDir;
/// Prefix replacement map for source file information.
- std::map<const std::string, const std::string> DebugPrefixMap;
+ std::map<std::string, const std::string, std::greater<std::string>>
+ DebugPrefixMap;
/// The main file name if passed in explicitly.
std::string MainFileName;
@@ -698,6 +699,9 @@ public:
/// Add an entry to the debug prefix map.
void addDebugPrefixMapEntry(const std::string &From, const std::string &To);
+ /// Remap one path in-place as per the debug prefix map.
+ void remapDebugPath(SmallVectorImpl<char> &Path);
+
// Remaps all debug directory paths in-place as per the debug prefix map.
void RemapDebugPaths();
diff --git a/contrib/llvm-project/llvm/include/llvm/MC/MCDwarf.h b/contrib/llvm-project/llvm/include/llvm/MC/MCDwarf.h
index 8b2ae84749b4..557c713575e4 100644
--- a/contrib/llvm-project/llvm/include/llvm/MC/MCDwarf.h
+++ b/contrib/llvm-project/llvm/include/llvm/MC/MCDwarf.h
@@ -22,6 +22,7 @@
#include "llvm/MC/StringTableBuilder.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MD5.h"
+#include "llvm/Support/StringSaver.h"
#include <cassert>
#include <cstdint>
#include <string>
@@ -48,6 +49,8 @@ MCSymbol *emitListsTableHeaderStart(MCStreamer &S);
/// Manage the .debug_line_str section contents, if we use it.
class MCDwarfLineStr {
+ BumpPtrAllocator Alloc;
+ StringSaver Saver{Alloc};
MCSymbol *LineStrLabel = nullptr;
StringTableBuilder LineStrings{StringTableBuilder::DWARF};
bool UseRelocs = false;
@@ -57,6 +60,8 @@ public:
/// v5 line table).
explicit MCDwarfLineStr(MCContext &Ctx);
+ StringSaver &getSaver() { return Saver; }
+
/// Emit a reference to the string.
void emitRef(MCStreamer *MCOS, StringRef Path);
@@ -382,6 +387,7 @@ public:
bool hasRootFile() const { return !Header.RootFile.Name.empty(); }
+ MCDwarfFile &getRootFile() { return Header.RootFile; }
const MCDwarfFile &getRootFile() const { return Header.RootFile; }
// Report whether MD5 usage has been consistent (all-or-none).
diff --git a/contrib/llvm-project/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/contrib/llvm-project/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index aa35f253bc5f..8311b480ab09 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/contrib/llvm-project/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -280,7 +280,8 @@ void RuntimePointerChecking::tryToCreateDiffCheck(
auto *SrcAR = dyn_cast<SCEVAddRecExpr>(Src->Expr);
auto *SinkAR = dyn_cast<SCEVAddRecExpr>(Sink->Expr);
- if (!SrcAR || !SinkAR) {
+ if (!SrcAR || !SinkAR || SrcAR->getLoop() != DC.getInnermostLoop() ||
+ SinkAR->getLoop() != DC.getInnermostLoop()) {
CanUseDiffCheck = false;
return;
}
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 8d465b9520de..a7f9382478d4 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -6360,7 +6360,8 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
SDValue Extendee = Ext->getOperand(0);
unsigned ScalarWidth = Extendee.getValueType().getScalarSizeInBits();
- if (N1C->getAPIntValue().isMask(ScalarWidth)) {
+ if (N1C->getAPIntValue().isMask(ScalarWidth) &&
+ (!LegalOperations || TLI.isOperationLegal(ISD::ZERO_EXTEND, ExtVT))) {
// (and (extract_subvector (zext|anyext|sext v) _) iN_mask)
// => (extract_subvector (iN_zeroext v))
SDValue ZeroExtExtendee =
@@ -7162,9 +7163,8 @@ static SDValue extractShiftForRotate(SelectionDAG &DAG, SDValue OppShift,
SDValue ExtractFrom, SDValue &Mask,
const SDLoc &DL) {
assert(OppShift && ExtractFrom && "Empty SDValue");
- assert(
- (OppShift.getOpcode() == ISD::SHL || OppShift.getOpcode() == ISD::SRL) &&
- "Existing shift must be valid as a rotate half");
+ if (OppShift.getOpcode() != ISD::SHL && OppShift.getOpcode() != ISD::SRL)
+ return SDValue();
ExtractFrom = stripConstantMask(DAG, ExtractFrom, Mask);
@@ -7573,6 +7573,10 @@ SDValue DAGCombiner::MatchRotate(SDValue LHS, SDValue RHS, const SDLoc &DL) {
std::swap(LHSMask, RHSMask);
}
+ // Something has gone wrong - we've lost the shl/srl pair - bail.
+ if (LHSShift.getOpcode() != ISD::SHL || RHSShift.getOpcode() != ISD::SRL)
+ return SDValue();
+
unsigned EltSizeInBits = VT.getScalarSizeInBits();
SDValue LHSShiftArg = LHSShift.getOperand(0);
SDValue LHSShiftAmt = LHSShift.getOperand(1);
@@ -22729,25 +22733,31 @@ SDValue DAGCombiner::visitVECTOR_SHUFFLE(SDNode *N) {
SDLoc DL(N);
EVT IntVT = VT.changeVectorElementTypeToInteger();
EVT IntSVT = VT.getVectorElementType().changeTypeToInteger();
- IntSVT = TLI.getTypeToTransformTo(*DAG.getContext(), IntSVT);
- SDValue ZeroElt = DAG.getConstant(0, DL, IntSVT);
- SDValue AllOnesElt = DAG.getAllOnesConstant(DL, IntSVT);
- SmallVector<SDValue, 16> AndMask(NumElts, DAG.getUNDEF(IntSVT));
- for (int I = 0; I != (int)NumElts; ++I)
- if (0 <= Mask[I])
- AndMask[I] = Mask[I] == I ? AllOnesElt : ZeroElt;
-
- // See if a clear mask is legal instead of going via
- // XformToShuffleWithZero which loses UNDEF mask elements.
- if (TLI.isVectorClearMaskLegal(ClearMask, IntVT))
- return DAG.getBitcast(
- VT, DAG.getVectorShuffle(IntVT, DL, DAG.getBitcast(IntVT, N0),
- DAG.getConstant(0, DL, IntVT), ClearMask));
-
- if (TLI.isOperationLegalOrCustom(ISD::AND, IntVT))
- return DAG.getBitcast(
- VT, DAG.getNode(ISD::AND, DL, IntVT, DAG.getBitcast(IntVT, N0),
- DAG.getBuildVector(IntVT, DL, AndMask)));
+ // Transform the type to a legal type so that the buildvector constant
+ // elements are not illegal. Make sure that the result is larger than the
+ // original type, incase the value is split into two (eg i64->i32).
+ if (!TLI.isTypeLegal(IntSVT) && LegalTypes)
+ IntSVT = TLI.getTypeToTransformTo(*DAG.getContext(), IntSVT);
+ if (IntSVT.getSizeInBits() >= IntVT.getScalarSizeInBits()) {
+ SDValue ZeroElt = DAG.getConstant(0, DL, IntSVT);
+ SDValue AllOnesElt = DAG.getAllOnesConstant(DL, IntSVT);
+ SmallVector<SDValue, 16> AndMask(NumElts, DAG.getUNDEF(IntSVT));
+ for (int I = 0; I != (int)NumElts; ++I)
+ if (0 <= Mask[I])
+ AndMask[I] = Mask[I] == I ? AllOnesElt : ZeroElt;
+
+ // See if a clear mask is legal instead of going via
+ // XformToShuffleWithZero which loses UNDEF mask elements.
+ if (TLI.isVectorClearMaskLegal(ClearMask, IntVT))
+ return DAG.getBitcast(
+ VT, DAG.getVectorShuffle(IntVT, DL, DAG.getBitcast(IntVT, N0),
+ DAG.getConstant(0, DL, IntVT), ClearMask));
+
+ if (TLI.isOperationLegalOrCustom(ISD::AND, IntVT))
+ return DAG.getBitcast(
+ VT, DAG.getNode(ISD::AND, DL, IntVT, DAG.getBitcast(IntVT, N0),
+ DAG.getBuildVector(IntVT, DL, AndMask)));
+ }
}
}
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index 228d4a43ccde..e2173879c218 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -4428,7 +4428,10 @@ void DAGTypeLegalizer::ExpandIntRes_XMULO(SDNode *N,
else if (VT == MVT::i128)
LC = RTLIB::MULO_I128;
- if (LC == RTLIB::UNKNOWN_LIBCALL || !TLI.getLibcallName(LC)) {
+ // If we don't have the libcall or if the function we are compiling is the
+ // implementation of the expected libcall (avoid inf-loop), expand inline.
+ if (LC == RTLIB::UNKNOWN_LIBCALL || !TLI.getLibcallName(LC) ||
+ TLI.getLibcallName(LC) == DAG.getMachineFunction().getName()) {
// FIXME: This is not an optimal expansion, but better than crashing.
EVT WideVT =
EVT::getIntegerVT(*DAG.getContext(), VT.getScalarSizeInBits() * 2);
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index d2ed4fe018b5..5ea4c4cded7f 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -1382,10 +1382,12 @@ bool DWARFDebugLine::Prologue::getFileNameByIndex(
IncludeDir = dwarf::toStringRef(IncludeDirectories[Entry.DirIdx - 1]);
}
- // For absolute paths only, include the compilation directory of compile unit.
- // We know that FileName is not absolute, the only way to have an absolute
- // path at this point would be if IncludeDir is absolute.
- if (Kind == FileLineInfoKind::AbsoluteFilePath && !CompDir.empty() &&
+ // For absolute paths only, include the compilation directory of compile unit,
+ // unless v5 DirIdx == 0 (IncludeDir indicates the compilation directory). We
+ // know that FileName is not absolute, the only way to have an absolute path
+ // at this point would be if IncludeDir is absolute.
+ if (Kind == FileLineInfoKind::AbsoluteFilePath &&
+ (getVersion() < 5 || Entry.DirIdx != 0) && !CompDir.empty() &&
!isPathAbsoluteOnWindowsOrPosix(IncludeDir))
sys::path::append(FilePath, Style, CompDir);
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
index 91a51485026e..d96c0c85d5bd 100644
--- a/contrib/llvm-project/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
+++ b/contrib/llvm-project/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
@@ -20,11 +20,14 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/Symbolize/Markup.h"
+#include "llvm/DebugInfo/Symbolize/Symbolize.h"
#include "llvm/Debuginfod/Debuginfod.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/Error.h"
+#include "llvm/Support/Format.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
@@ -32,9 +35,11 @@
using namespace llvm;
using namespace llvm::symbolize;
-MarkupFilter::MarkupFilter(raw_ostream &OS, Optional<bool> ColorsEnabled)
- : OS(OS), ColorsEnabled(ColorsEnabled.value_or(
- WithColor::defaultAutoDetectFunction()(OS))) {}
+MarkupFilter::MarkupFilter(raw_ostream &OS, LLVMSymbolizer &Symbolizer,
+ Optional<bool> ColorsEnabled)
+ : OS(OS), Symbolizer(Symbolizer),
+ ColorsEnabled(
+ ColorsEnabled.value_or(WithColor::defaultAutoDetectFunction()(OS))) {}
void MarkupFilter::filter(StringRef Line) {
this->Line = Line;
@@ -94,10 +99,10 @@ bool MarkupFilter::tryMMap(const MarkupNode &Node,
if (!ParsedMMap)
return true;
- if (const MMap *M = overlappingMMap(*ParsedMMap)) {
+ if (const MMap *M = getOverlappingMMap(*ParsedMMap)) {
WithColor::error(errs())
- << formatv("overlapping mmap: #{0:x} [{1:x},{2:x})\n", M->Mod->ID,
- M->Addr, M->Addr + M->Size);
+ << formatv("overlapping mmap: #{0:x} [{1:x}-{2:x}]\n", M->Mod->ID,
+ M->Addr, M->Addr + M->Size - 1);
reportLocation(Node.Fields[0].begin());
return true;
}
@@ -160,18 +165,17 @@ bool MarkupFilter::tryModule(const MarkupNode &Node,
filterNode(Node);
beginModuleInfoLine(&Module);
OS << "; BuildID=";
- highlightValue();
- OS << toHex(Module.BuildID, /*LowerCase=*/true);
- highlight();
+ printValue(toHex(Module.BuildID, /*LowerCase=*/true));
return true;
}
void MarkupFilter::beginModuleInfoLine(const Module *M) {
highlight();
OS << "[[[ELF module";
- highlightValue();
- OS << formatv(" #{0:x} \"{1}\"", M->ID, M->Name);
- highlight();
+ printValue(formatv(" #{0:x} ", M->ID));
+ OS << '"';
+ printValue(M->Name);
+ OS << '"';
MIL = ModuleInfoLine{M};
}
@@ -182,14 +186,13 @@ void MarkupFilter::endAnyModuleInfoLine() {
return A->Addr < B->Addr;
});
for (const MMap *M : MIL->MMaps) {
- OS << (M == MIL->MMaps.front() ? ' ' : '-');
- highlightValue();
- OS << formatv("{0:x}", M->Addr);
- highlight();
- OS << '(';
- highlightValue();
- OS << M->Mode;
- highlight();
+ OS << (M == MIL->MMaps.front() ? ' ' : ',');
+ OS << '[';
+ printValue(formatv("{0:x}", M->Addr));
+ OS << '-';
+ printValue(formatv("{0:x}", M->Addr + M->Size - 1));
+ OS << "](";
+ printValue(M->Mode);
OS << ')';
}
OS << "]]]" << lineEnding();
@@ -210,7 +213,13 @@ void MarkupFilter::filterNode(const MarkupNode &Node) {
}
bool MarkupFilter::tryPresentation(const MarkupNode &Node) {
- return trySymbol(Node);
+ if (trySymbol(Node))
+ return true;
+ if (tryPC(Node))
+ return true;
+ if (tryBackTrace(Node))
+ return true;
+ return tryData(Node);
}
bool MarkupFilter::trySymbol(const MarkupNode &Node) {
@@ -225,6 +234,172 @@ bool MarkupFilter::trySymbol(const MarkupNode &Node) {
return true;
}
+bool MarkupFilter::tryPC(const MarkupNode &Node) {
+ if (Node.Tag != "pc")
+ return false;
+ if (!checkNumFieldsAtLeast(Node, 1))
+ return true;
+ if (!checkNumFieldsAtMost(Node, 2))
+ return true;
+
+ Optional<uint64_t> Addr = parseAddr(Node.Fields[0]);
+ if (!Addr)
+ return true;
+
+ // PC addresses that aren't part of a backtrace are assumed to be precise code
+ // locations.
+ PCType Type = PCType::PreciseCode;
+ if (Node.Fields.size() == 2) {
+ Optional<PCType> ParsedType = parsePCType(Node.Fields[1]);
+ if (!ParsedType)
+ return true;
+ Type = *ParsedType;
+ }
+ *Addr = adjustAddr(*Addr, Type);
+
+ const MMap *MMap = getContainingMMap(*Addr);
+ if (!MMap) {
+ WithColor::error() << "no mmap covers address\n";
+ reportLocation(Node.Fields[0].begin());
+ printRawElement(Node);
+ return true;
+ }
+
+ Expected<DILineInfo> LI = Symbolizer.symbolizeCode(
+ MMap->Mod->BuildID, {MMap->getModuleRelativeAddr(*Addr)});
+ if (!LI) {
+ WithColor::defaultErrorHandler(LI.takeError());
+ printRawElement(Node);
+ return true;
+ }
+ if (!*LI) {
+ printRawElement(Node);
+ return true;
+ }
+
+ highlight();
+ printValue(LI->FunctionName);
+ OS << '[';
+ printValue(LI->FileName);
+ OS << ':';
+ printValue(Twine(LI->Line));
+ OS << ']';
+ restoreColor();
+ return true;
+}
+
+bool MarkupFilter::tryBackTrace(const MarkupNode &Node) {
+ if (Node.Tag != "bt")
+ return false;
+ if (!checkNumFieldsAtLeast(Node, 2))
+ return true;
+ if (!checkNumFieldsAtMost(Node, 3))
+ return true;
+
+ Optional<uint64_t> FrameNumber = parseFrameNumber(Node.Fields[0]);
+ if (!FrameNumber)
+ return true;
+
+ Optional<uint64_t> Addr = parseAddr(Node.Fields[1]);
+ if (!Addr)
+ return true;
+
+ // Backtrace addresses are assumed to be return addresses by default.
+ PCType Type = PCType::ReturnAddress;
+ if (Node.Fields.size() == 3) {
+ Optional<PCType> ParsedType = parsePCType(Node.Fields[2]);
+ if (!ParsedType)
+ return true;
+ Type = *ParsedType;
+ }
+ *Addr = adjustAddr(*Addr, Type);
+
+ const MMap *MMap = getContainingMMap(*Addr);
+ if (!MMap) {
+ WithColor::error() << "no mmap covers address\n";
+ reportLocation(Node.Fields[0].begin());
+ printRawElement(Node);
+ return true;
+ }
+ uint64_t MRA = MMap->getModuleRelativeAddr(*Addr);
+
+ Expected<DIInliningInfo> II =
+ Symbolizer.symbolizeInlinedCode(MMap->Mod->BuildID, {MRA});
+ if (!II) {
+ WithColor::defaultErrorHandler(II.takeError());
+ printRawElement(Node);
+ return true;
+ }
+
+ highlight();
+ for (unsigned I = 0, E = II->getNumberOfFrames(); I != E; ++I) {
+ auto Header = formatv("{0, +6}", formatv("#{0}", FrameNumber)).sstr<16>();
+ // Don't highlight the # sign as a value.
+ size_t NumberIdx = Header.find("#") + 1;
+ OS << Header.substr(0, NumberIdx);
+ printValue(Header.substr(NumberIdx));
+ if (I == E - 1) {
+ OS << " ";
+ } else {
+ OS << '.';
+ printValue(formatv("{0, -2}", I + 1));
+ }
+ printValue(formatv(" {0:x16} ", *Addr));
+
+ DILineInfo LI = II->getFrame(I);
+ if (LI) {
+ printValue(LI.FunctionName);
+ OS << ' ';
+ printValue(LI.FileName);
+ OS << ':';
+ printValue(Twine(LI.Line));
+ OS << ':';
+ printValue(Twine(LI.Column));
+ OS << ' ';
+ }
+ OS << '(';
+ printValue(MMap->Mod->Name);
+ OS << "+";
+ printValue(formatv("{0:x}", MRA));
+ OS << ')';
+ if (I != E - 1)
+ OS << lineEnding();
+ }
+ restoreColor();
+ return true;
+}
+
+bool MarkupFilter::tryData(const MarkupNode &Node) {
+ if (Node.Tag != "data")
+ return false;
+ if (!checkNumFields(Node, 1))
+ return true;
+ Optional<uint64_t> Addr = parseAddr(Node.Fields[0]);
+ if (!Addr)
+ return true;
+
+ const MMap *MMap = getContainingMMap(*Addr);
+ if (!MMap) {
+ WithColor::error() << "no mmap covers address\n";
+ reportLocation(Node.Fields[0].begin());
+ printRawElement(Node);
+ return true;
+ }
+
+ Expected<DIGlobal> Symbol = Symbolizer.symbolizeData(
+ MMap->Mod->BuildID, {MMap->getModuleRelativeAddr(*Addr)});
+ if (!Symbol) {
+ WithColor::defaultErrorHandler(Symbol.takeError());
+ printRawElement(Node);
+ return true;
+ }
+
+ highlight();
+ OS << Symbol->Name;
+ restoreColor();
+ return true;
+}
+
bool MarkupFilter::trySGR(const MarkupNode &Node) {
if (Node.Text == "\033[0m") {
resetColor();
@@ -297,6 +472,24 @@ void MarkupFilter::resetColor() {
OS.resetColor();
}
+void MarkupFilter::printRawElement(const MarkupNode &Element) {
+ highlight();
+ OS << "[[[";
+ printValue(Element.Tag);
+ for (StringRef Field : Element.Fields) {
+ OS << ':';
+ printValue(Field);
+ }
+ OS << "]]]";
+ restoreColor();
+}
+
+void MarkupFilter::printValue(Twine Value) {
+ highlightValue();
+ OS << Value;
+ highlight();
+}
+
// This macro helps reduce the amount of indirection done through Optional
// below, since the usual case upon returning a None Optional is to return None.
#define ASSIGN_OR_RETURN_NONE(TYPE, NAME, EXPR) \
@@ -392,6 +585,16 @@ Optional<uint64_t> MarkupFilter::parseSize(StringRef Str) const {
return ID;
}
+// Parse a frame number (%i in the spec).
+Optional<uint64_t> MarkupFilter::parseFrameNumber(StringRef Str) const {
+ uint64_t ID;
+ if (Str.getAsInteger(10, ID)) {
+ reportTypeError(Str, "frame number");
+ return None;
+ }
+ return ID;
+}
+
// Parse a build ID (%x in the spec).
Optional<SmallVector<uint8_t>> MarkupFilter::parseBuildID(StringRef Str) const {
std::string Bytes;
@@ -430,6 +633,17 @@ Optional<std::string> MarkupFilter::parseMode(StringRef Str) const {
return Str.lower();
}
+Optional<MarkupFilter::PCType> MarkupFilter::parsePCType(StringRef Str) const {
+ Optional<MarkupFilter::PCType> Type =
+ StringSwitch<Optional<MarkupFilter::PCType>>(Str)
+ .Case("ra", MarkupFilter::PCType::ReturnAddress)
+ .Case("pc", MarkupFilter::PCType::PreciseCode)
+ .Default(None);
+ if (!Type)
+ reportTypeError(Str, "PC type");
+ return Type;
+}
+
bool MarkupFilter::checkTag(const MarkupNode &Node) const {
if (any_of(Node.Tag, [](char C) { return C < 'a' || C > 'z'; })) {
WithColor::error(errs()) << "tags must be all lowercase characters\n";
@@ -442,7 +656,7 @@ bool MarkupFilter::checkTag(const MarkupNode &Node) const {
bool MarkupFilter::checkNumFields(const MarkupNode &Element,
size_t Size) const {
if (Element.Fields.size() != Size) {
- WithColor::error(errs()) << "expected " << Size << " fields; found "
+ WithColor::error(errs()) << "expected " << Size << " field(s); found "
<< Element.Fields.size() << "\n";
reportLocation(Element.Tag.end());
return false;
@@ -454,7 +668,19 @@ bool MarkupFilter::checkNumFieldsAtLeast(const MarkupNode &Element,
size_t Size) const {
if (Element.Fields.size() < Size) {
WithColor::error(errs())
- << "expected at least " << Size << " fields; found "
+ << "expected at least " << Size << " field(s); found "
+ << Element.Fields.size() << "\n";
+ reportLocation(Element.Tag.end());
+ return false;
+ }
+ return true;
+}
+
+bool MarkupFilter::checkNumFieldsAtMost(const MarkupNode &Element,
+ size_t Size) const {
+ if (Element.Fields.size() > Size) {
+ WithColor::error(errs())
+ << "expected at most " << Size << " field(s); found "
<< Element.Fields.size() << "\n";
reportLocation(Element.Tag.end());
return false;
@@ -479,7 +705,8 @@ void MarkupFilter::reportLocation(StringRef::iterator Loc) const {
// Checks for an existing mmap that overlaps the given one and returns a
// pointer to one of them.
-const MarkupFilter::MMap *MarkupFilter::overlappingMMap(const MMap &Map) const {
+const MarkupFilter::MMap *
+MarkupFilter::getOverlappingMMap(const MMap &Map) const {
// If the given map contains the start of another mmap, they overlap.
auto I = MMaps.upper_bound(Map.Addr);
if (I != MMaps.end() && Map.contains(I->second.Addr))
@@ -495,6 +722,28 @@ const MarkupFilter::MMap *MarkupFilter::overlappingMMap(const MMap &Map) const {
return nullptr;
}
+// Returns the MMap that contains the given address or nullptr if none.
+const MarkupFilter::MMap *MarkupFilter::getContainingMMap(uint64_t Addr) const {
+ // Find the first mmap starting >= Addr.
+ auto I = MMaps.lower_bound(Addr);
+ if (I != MMaps.end() && I->second.contains(Addr))
+ return &I->second;
+
+ // The previous mmap is the last one starting < Addr.
+ if (I == MMaps.begin())
+ return nullptr;
+ --I;
+ return I->second.contains(Addr) ? &I->second : nullptr;
+}
+
+uint64_t MarkupFilter::adjustAddr(uint64_t Addr, PCType Type) const {
+ // Decrementing return addresses by one moves them into the call instruction.
+ // The address doesn't have to be the start of the call instruction, just some
+ // byte on the inside. Subtracting one avoids needing detailed instruction
+ // length information here.
+ return Type == MarkupFilter::PCType::ReturnAddress ? Addr - 1 : Addr;
+}
+
StringRef MarkupFilter::lineEnding() const {
return Line.endswith("\r\n") ? "\r\n" : "\n";
}
@@ -502,3 +751,8 @@ StringRef MarkupFilter::lineEnding() const {
bool MarkupFilter::MMap::contains(uint64_t Addr) const {
return this->Addr <= Addr && Addr < this->Addr + Size;
}
+
+// Returns the module-relative address for a given virtual address.
+uint64_t MarkupFilter::MMap::getModuleRelativeAddr(uint64_t Addr) const {
+ return Addr - this->Addr + ModuleRelativeAddr;
+}
diff --git a/contrib/llvm-project/llvm/lib/MC/MCContext.cpp b/contrib/llvm-project/llvm/lib/MC/MCContext.cpp
index 322ed8e23eb6..062246f9c7ee 100644
--- a/contrib/llvm-project/llvm/lib/MC/MCContext.cpp
+++ b/contrib/llvm-project/llvm/lib/MC/MCContext.cpp
@@ -855,30 +855,35 @@ void MCContext::addDebugPrefixMapEntry(const std::string &From,
DebugPrefixMap.insert(std::make_pair(From, To));
}
+void MCContext::remapDebugPath(SmallVectorImpl<char> &Path) {
+ for (const auto &V : DebugPrefixMap)
+ if (llvm::sys::path::replace_path_prefix(Path, V.first, V.second))
+ break;
+}
+
void MCContext::RemapDebugPaths() {
const auto &DebugPrefixMap = this->DebugPrefixMap;
if (DebugPrefixMap.empty())
return;
- const auto RemapDebugPath = [&DebugPrefixMap](std::string &Path) {
- SmallString<256> P(Path);
- for (const auto &Entry : DebugPrefixMap) {
- if (llvm::sys::path::replace_path_prefix(P, Entry.first, Entry.second)) {
- Path = P.str().str();
- break;
- }
+ // Remap compilation directory.
+ remapDebugPath(CompilationDir);
+
+ // Remap MCDwarfDirs and RootFile.Name in all compilation units.
+ SmallString<256> P;
+ for (auto &CUIDTablePair : MCDwarfLineTablesCUMap) {
+ for (auto &Dir : CUIDTablePair.second.getMCDwarfDirs()) {
+ P = Dir;
+ remapDebugPath(P);
+ Dir = std::string(P);
}
- };
- // Remap compilation directory.
- std::string CompDir = std::string(CompilationDir.str());
- RemapDebugPath(CompDir);
- CompilationDir = CompDir;
-
- // Remap MCDwarfDirs in all compilation units.
- for (auto &CUIDTablePair : MCDwarfLineTablesCUMap)
- for (auto &Dir : CUIDTablePair.second.getMCDwarfDirs())
- RemapDebugPath(Dir);
+ // Used by DW_TAG_compile_unit's DT_AT_name and DW_TAG_label's
+ // DW_AT_decl_file for DWARF v5 generated for assembly source.
+ P = CUIDTablePair.second.getRootFile().Name;
+ remapDebugPath(P);
+ CUIDTablePair.second.getRootFile().Name = std::string(P);
+ }
}
//===----------------------------------------------------------------------===//
diff --git a/contrib/llvm-project/llvm/lib/MC/MCDwarf.cpp b/contrib/llvm-project/llvm/lib/MC/MCDwarf.cpp
index 4cbb9981fde2..cc1a662da87e 100644
--- a/contrib/llvm-project/llvm/lib/MC/MCDwarf.cpp
+++ b/contrib/llvm-project/llvm/lib/MC/MCDwarf.cpp
@@ -266,7 +266,7 @@ void MCDwarfLineTable::emit(MCStreamer *MCOS, MCDwarfLineTableParams Params) {
// In a v5 non-split line table, put the strings in a separate section.
Optional<MCDwarfLineStr> LineStr;
if (context.getDwarfVersion() >= 5)
- LineStr = MCDwarfLineStr(context);
+ LineStr.emplace(context);
// Switch to the section where the table will be emitted into.
MCOS->switchSection(context.getObjectFileInfo()->getDwarfLineSection());
@@ -416,9 +416,15 @@ void MCDwarfLineTableHeader::emitV5FileDirTables(
: dwarf::DW_FORM_string);
MCOS->emitULEB128IntValue(MCDwarfDirs.size() + 1);
// Try not to emit an empty compilation directory.
- const StringRef CompDir = CompilationDir.empty()
- ? MCOS->getContext().getCompilationDir()
- : StringRef(CompilationDir);
+ SmallString<256> Dir;
+ StringRef CompDir = MCOS->getContext().getCompilationDir();
+ if (!CompilationDir.empty()) {
+ Dir = CompilationDir;
+ MCOS->getContext().remapDebugPath(Dir);
+ CompDir = Dir.str();
+ if (LineStr)
+ CompDir = LineStr->getSaver().save(CompDir);
+ }
if (LineStr) {
// Record path strings, emit references here.
LineStr->emitRef(MCOS, CompDir);
diff --git a/contrib/llvm-project/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/contrib/llvm-project/llvm/lib/MC/MCParser/ELFAsmParser.cpp
index 563d3487ef50..38977b7641a0 100644
--- a/contrib/llvm-project/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/contrib/llvm-project/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -566,8 +566,7 @@ bool ELFAsmParser::ParseSectionArguments(bool IsPush, SMLoc loc) {
}
if (getLexer().isNot(AsmToken::String)) {
- if (!getContext().getAsmInfo()->usesSunStyleELFSectionSwitchSyntax()
- || getLexer().isNot(AsmToken::Hash))
+ if (getLexer().isNot(AsmToken::Hash))
return TokError("expected string in directive");
extraFlags = parseSunStyleSectionFlags();
} else {
diff --git a/contrib/llvm-project/llvm/lib/Support/Host.cpp b/contrib/llvm-project/llvm/lib/Support/Host.cpp
index c97f273b0739..94a1536f4690 100644
--- a/contrib/llvm-project/llvm/lib/Support/Host.cpp
+++ b/contrib/llvm-project/llvm/lib/Support/Host.cpp
@@ -1734,6 +1734,7 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features) {
bool HasExtLeaf8 = MaxExtLevel >= 0x80000008 &&
!getX86CpuIDAndInfo(0x80000008, &EAX, &EBX, &ECX, &EDX);
Features["clzero"] = HasExtLeaf8 && ((EBX >> 0) & 1);
+ Features["rdpru"] = HasExtLeaf8 && ((EBX >> 4) & 1);
Features["wbnoinvd"] = HasExtLeaf8 && ((EBX >> 9) & 1);
bool HasLeaf7 =
diff --git a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
index bf520a560404..c0a94cc758bb 100644
--- a/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
@@ -4600,9 +4600,16 @@ void AMDGPUTargetLowering::computeKnownBitsForTargetNode(
case Intrinsic::amdgcn_mbcnt_hi: {
const GCNSubtarget &ST =
DAG.getMachineFunction().getSubtarget<GCNSubtarget>();
- // These return at most the wavefront size - 1.
+ // These return at most the (wavefront size - 1) + src1
+ // As long as src1 is an immediate we can calc known bits
+ KnownBits Src1Known = DAG.computeKnownBits(Op.getOperand(2), Depth + 1);
+ unsigned Src1ValBits = Src1Known.countMaxActiveBits();
+ unsigned MaxActiveBits = std::max(Src1ValBits, ST.getWavefrontSizeLog2());
+ // Cater for potential carry
+ MaxActiveBits += Src1ValBits ? 1 : 0;
unsigned Size = Op.getValueType().getSizeInBits();
- Known.Zero.setHighBits(Size - ST.getWavefrontSizeLog2());
+ if (MaxActiveBits < Size)
+ Known.Zero.setHighBits(Size - MaxActiveBits);
break;
}
case Intrinsic::amdgcn_workitem_id_x:
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp
index a19253da440e..1b5bd4c00089 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVCodeGenPrepare.cpp
@@ -71,7 +71,7 @@ bool RISCVCodeGenPrepare::optimizeZExt(ZExtInst *ZExt) {
// This often occurs with widened induction variables.
if (isImpliedByDomCondition(ICmpInst::ICMP_SGE, Src,
Constant::getNullValue(Src->getType()), ZExt,
- *DL)) {
+ *DL).value_or(false)) {
auto *SExt = new SExtInst(Src, ZExt->getType(), "", ZExt);
SExt->takeName(ZExt);
SExt->setDebugLoc(ZExt->getDebugLoc());
@@ -140,7 +140,7 @@ bool RISCVCodeGenPrepare::optimizeAndExt(BinaryOperator *BO) {
// And mask constant.
if (!isImpliedByDomCondition(ICmpInst::ICMP_SGE, LHSSrc,
Constant::getNullValue(LHSSrc->getType()),
- LHS, *DL))
+ LHS, *DL).value_or(false))
return false;
// Sign extend the constant and replace the And operand.
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/TargetInfo/RISCVTargetInfo.cpp b/contrib/llvm-project/llvm/lib/Target/RISCV/TargetInfo/RISCVTargetInfo.cpp
index 27d1326d5f6c..7b63b060dd9c 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/TargetInfo/RISCVTargetInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/TargetInfo/RISCVTargetInfo.cpp
@@ -21,8 +21,8 @@ Target &llvm::getTheRISCV64Target() {
}
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTargetInfo() {
- RegisterTarget<Triple::riscv32> X(getTheRISCV32Target(), "riscv32",
- "32-bit RISC-V", "RISCV");
- RegisterTarget<Triple::riscv64> Y(getTheRISCV64Target(), "riscv64",
- "64-bit RISC-V", "RISCV");
+ RegisterTarget<Triple::riscv32, /*HasJIT=*/true> X(
+ getTheRISCV32Target(), "riscv32", "32-bit RISC-V", "RISCV");
+ RegisterTarget<Triple::riscv64, /*HasJIT=*/true> Y(
+ getTheRISCV64Target(), "riscv64", "64-bit RISC-V", "RISCV");
}
diff --git a/contrib/llvm-project/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp b/contrib/llvm-project/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
index c5cc2ea34bb7..c4545ff56f74 100644
--- a/contrib/llvm-project/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
@@ -40,7 +40,6 @@ SparcELFMCAsmInfo::SparcELFMCAsmInfo(const Triple &TheTriple) {
ExceptionsType = ExceptionHandling::DwarfCFI;
- SunStyleELFSectionSwitchSyntax = true;
UsesELFSectionDirectiveForBSS = true;
}
diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp
index 7d0fc4e8a8c6..cd45c48259bb 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -1362,6 +1362,8 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
setOperationAction(ISD::SINT_TO_FP, MVT::v8i32, Custom);
setOperationAction(ISD::STRICT_SINT_TO_FP, MVT::v8i32, Custom);
+ setOperationAction(ISD::FP_EXTEND, MVT::v8f32, Expand);
+ setOperationAction(ISD::FP_ROUND, MVT::v8f16, Expand);
setOperationAction(ISD::FP_EXTEND, MVT::v4f64, Custom);
setOperationAction(ISD::STRICT_FP_EXTEND, MVT::v4f64, Custom);
@@ -1519,7 +1521,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
// Extract subvector is special because the value type
// (result) is 128-bit but the source is 256-bit wide.
for (auto VT : { MVT::v16i8, MVT::v8i16, MVT::v4i32, MVT::v2i64,
- MVT::v4f32, MVT::v2f64 }) {
+ MVT::v8f16, MVT::v4f32, MVT::v2f64 }) {
setOperationAction(ISD::EXTRACT_SUBVECTOR, VT, Legal);
}
@@ -1859,7 +1861,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
// (result) is 256-bit but the source is 512-bit wide.
// 128-bit was made Legal under AVX1.
for (auto VT : { MVT::v32i8, MVT::v16i16, MVT::v8i32, MVT::v4i64,
- MVT::v8f32, MVT::v4f64 })
+ MVT::v16f16, MVT::v8f32, MVT::v4f64 })
setOperationAction(ISD::EXTRACT_SUBVECTOR, VT, Legal);
for (auto VT : { MVT::v64i8, MVT::v32i16, MVT::v16i32, MVT::v8i64,
@@ -16120,16 +16122,18 @@ static SDValue lowerV8F16Shuffle(const SDLoc &DL, ArrayRef<int> Mask,
assert(Mask.size() == 8 && "Unexpected mask size for v8 shuffle!");
int NumV2Elements = count_if(Mask, [](int M) { return M >= 8; });
- if (NumV2Elements == 0) {
- // Check for being able to broadcast a single element.
- if (SDValue Broadcast = lowerShuffleAsBroadcast(DL, MVT::v8f16, V1, V2,
- Mask, Subtarget, DAG))
- return Broadcast;
+ if (Subtarget.hasFP16()) {
+ if (NumV2Elements == 0) {
+ // Check for being able to broadcast a single element.
+ if (SDValue Broadcast = lowerShuffleAsBroadcast(DL, MVT::v8f16, V1, V2,
+ Mask, Subtarget, DAG))
+ return Broadcast;
+ }
+ if (NumV2Elements == 1 && Mask[0] >= 8)
+ if (SDValue V = lowerShuffleAsElementInsertion(
+ DL, MVT::v8f16, V1, V2, Mask, Zeroable, Subtarget, DAG))
+ return V;
}
- if (NumV2Elements == 1 && Mask[0] >= 8)
- if (SDValue V = lowerShuffleAsElementInsertion(DL, MVT::v8f16, V1, V2, Mask,
- Zeroable, Subtarget, DAG))
- return V;
V1 = DAG.getBitcast(MVT::v8i16, V1);
V2 = DAG.getBitcast(MVT::v8i16, V2);
@@ -32701,8 +32705,29 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N,
N->getOpcode() == ISD::STRICT_FP_TO_SINT;
EVT VT = N->getValueType(0);
SDValue Src = N->getOperand(IsStrict ? 1 : 0);
+ SDValue Chain = IsStrict ? N->getOperand(0) : SDValue();
EVT SrcVT = Src.getValueType();
+ SDValue Res;
+ if (isSoftFP16(SrcVT)) {
+ EVT NVT = VT.isVector() ? VT.changeVectorElementType(MVT::f32) : MVT::f32;
+ if (IsStrict) {
+ Res =
+ DAG.getNode(N->getOpcode(), dl, {VT, MVT::Other},
+ {Chain, DAG.getNode(ISD::STRICT_FP_EXTEND, dl,
+ {NVT, MVT::Other}, {Chain, Src})});
+ Chain = Res.getValue(1);
+ } else {
+ Res = DAG.getNode(N->getOpcode(), dl, VT,
+ DAG.getNode(ISD::FP_EXTEND, dl, NVT, Src));
+ }
+ Results.push_back(Res);
+ if (IsStrict)
+ Results.push_back(Chain);
+
+ return;
+ }
+
if (VT.isVector() && Subtarget.hasFP16() &&
SrcVT.getVectorElementType() == MVT::f16) {
EVT EleVT = VT.getVectorElementType();
@@ -32716,7 +32741,6 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N,
Src = DAG.getNode(ISD::CONCAT_VECTORS, dl, MVT::v8f16, Ops);
}
- SDValue Res, Chain;
if (IsStrict) {
unsigned Opc =
IsSigned ? X86ISD::STRICT_CVTTP2SI : X86ISD::STRICT_CVTTP2UI;
@@ -32908,7 +32932,6 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N,
return;
}
- SDValue Chain;
if (SDValue V = FP_TO_INTHelper(SDValue(N, 0), DAG, IsSigned, Chain)) {
Results.push_back(V);
if (IsStrict)
diff --git a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 158d2e8289e0..edbd4091d1d2 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -2040,9 +2040,7 @@ Instruction *InstCombinerImpl::foldICmpMulConstant(ICmpInst &Cmp,
NewC = ConstantInt::get(
Mul->getType(),
APIntOps::RoundingSDiv(C, *MulC, APInt::Rounding::DOWN));
- }
-
- if (Mul->hasNoUnsignedWrap()) {
+ } else if (Mul->hasNoUnsignedWrap()) {
if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE)
NewC = ConstantInt::get(
Mul->getType(),
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopUtils.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopUtils.cpp
index 349063dd5e89..bbba76a5c5ef 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -1394,7 +1394,10 @@ int llvm::rewriteLoopExitValues(Loop *L, LoopInfo *LI, TargetLibraryInfo *TLI,
// and next SCEV may errneously get smaller cost.
// Collect all the candidate PHINodes to be rewritten.
- RewritePhiSet.emplace_back(PN, i, ExitValue, Inst, HighCost);
+ Instruction *InsertPt =
+ (isa<PHINode>(Inst) || isa<LandingPadInst>(Inst)) ?
+ &*Inst->getParent()->getFirstInsertionPt() : Inst;
+ RewritePhiSet.emplace_back(PN, i, ExitValue, InsertPt, HighCost);
}
}
}
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index 03087d8370d5..245f2d4e442a 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -89,10 +89,12 @@ static Value *convertStrToInt(CallInst *CI, StringRef &Str, Value *EndPtr,
// Fail for an invalid base (required by POSIX).
return nullptr;
+ // Current offset into the original string to reflect in EndPtr.
+ size_t Offset = 0;
// Strip leading whitespace.
- for (unsigned i = 0; i != Str.size(); ++i)
- if (!isSpace((unsigned char)Str[i])) {
- Str = Str.substr(i);
+ for ( ; Offset != Str.size(); ++Offset)
+ if (!isSpace((unsigned char)Str[Offset])) {
+ Str = Str.substr(Offset);
break;
}
@@ -108,6 +110,7 @@ static Value *convertStrToInt(CallInst *CI, StringRef &Str, Value *EndPtr,
if (Str.empty())
// Fail for a sign with nothing after it.
return nullptr;
+ ++Offset;
}
// Set Max to the absolute value of the minimum (for signed), or
@@ -127,6 +130,7 @@ static Value *convertStrToInt(CallInst *CI, StringRef &Str, Value *EndPtr,
return nullptr;
Str = Str.drop_front(2);
+ Offset += 2;
Base = 16;
}
else if (Base == 0)
@@ -167,7 +171,7 @@ static Value *convertStrToInt(CallInst *CI, StringRef &Str, Value *EndPtr,
if (EndPtr) {
// Store the pointer to the end.
- Value *Off = B.getInt64(Str.size());
+ Value *Off = B.getInt64(Offset + Str.size());
Value *StrBeg = CI->getArgOperand(0);
Value *StrEnd = B.CreateInBoundsGEP(B.getInt8Ty(), StrBeg, Off, "endptr");
B.CreateStore(StrEnd, EndPtr);
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/contrib/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index d69d1e3d19f3..53c11c58f73d 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -4696,10 +4696,12 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
};
SmallVector<unsigned> SortedIndices;
BasicBlock *BB = nullptr;
+ bool IsScatterVectorizeUserTE =
+ UserTreeIdx.UserTE &&
+ UserTreeIdx.UserTE->State == TreeEntry::ScatterVectorize;
bool AreAllSameInsts =
(S.getOpcode() && allSameBlock(VL)) ||
- (S.OpValue->getType()->isPointerTy() && UserTreeIdx.UserTE &&
- UserTreeIdx.UserTE->State == TreeEntry::ScatterVectorize &&
+ (S.OpValue->getType()->isPointerTy() && IsScatterVectorizeUserTE &&
VL.size() > 2 &&
all_of(VL,
[&BB](Value *V) {
@@ -4760,10 +4762,9 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
// Check that none of the instructions in the bundle are already in the tree.
for (Value *V : VL) {
- auto *I = dyn_cast<Instruction>(V);
- if (!I)
+ if (!IsScatterVectorizeUserTE && !isa<Instruction>(V))
continue;
- if (getTreeEntry(I)) {
+ if (getTreeEntry(V)) {
LLVM_DEBUG(dbgs() << "SLP: The instruction (" << *V
<< ") is already in tree.\n");
if (TryToFindDuplicates(S))
@@ -5213,9 +5214,6 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
}
}
- bool IsScatterUser =
- UserTreeIdx.UserTE &&
- UserTreeIdx.UserTE->State == TreeEntry::ScatterVectorize;
// We don't combine GEPs with non-constant indexes.
Type *Ty1 = VL0->getOperand(1)->getType();
for (Value *V : VL) {
@@ -5223,9 +5221,9 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
if (!I)
continue;
auto *Op = I->getOperand(1);
- if ((!IsScatterUser && !isa<ConstantInt>(Op)) ||
+ if ((!IsScatterVectorizeUserTE && !isa<ConstantInt>(Op)) ||
(Op->getType() != Ty1 &&
- ((IsScatterUser && !isa<ConstantInt>(Op)) ||
+ ((IsScatterVectorizeUserTE && !isa<ConstantInt>(Op)) ||
Op->getType()->getScalarSizeInBits() >
DL->getIndexSizeInBits(
V->getType()->getPointerAddressSpace())))) {
diff --git a/contrib/llvm-project/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp b/contrib/llvm-project/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
index 7ec70e42f1c1..34c93be67f80 100644
--- a/contrib/llvm-project/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ b/contrib/llvm-project/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -366,8 +366,8 @@ static SmallVector<uint8_t> parseBuildIDArg(const opt::InputArgList &Args,
}
// Symbolize markup from stdin and write the result to stdout.
-static void filterMarkup(const opt::InputArgList &Args) {
- MarkupFilter Filter(outs(), parseColorArg(Args));
+static void filterMarkup(const opt::InputArgList &Args, LLVMSymbolizer &Symbolizer) {
+ MarkupFilter Filter(outs(), Symbolizer, parseColorArg(Args));
std::string InputString;
while (std::getline(std::cin, InputString)) {
InputString += '\n';
@@ -437,8 +437,19 @@ int main(int argc, char **argv) {
}
}
+ LLVMSymbolizer Symbolizer(Opts);
+
+ // A debuginfod lookup could succeed if a HTTP client is available and at
+ // least one backing URL is configured.
+ bool ShouldUseDebuginfodByDefault =
+ HTTPClient::isAvailable() &&
+ !ExitOnErr(getDefaultDebuginfodUrls()).empty();
+ if (Args.hasFlag(OPT_debuginfod, OPT_no_debuginfod,
+ ShouldUseDebuginfodByDefault))
+ enableDebuginfod(Symbolizer);
+
if (Args.hasArg(OPT_filter_markup)) {
- filterMarkup(Args);
+ filterMarkup(Args, Symbolizer);
return 0;
}
@@ -458,17 +469,6 @@ int main(int argc, char **argv) {
}
SmallVector<uint8_t> BuildID = parseBuildIDArg(Args, OPT_build_id_EQ);
- LLVMSymbolizer Symbolizer(Opts);
-
- // A debuginfod lookup could succeed if a HTTP client is available and at
- // least one backing URL is configured.
- bool ShouldUseDebuginfodByDefault =
- HTTPClient::isAvailable() &&
- !ExitOnErr(getDefaultDebuginfodUrls()).empty();
- if (Args.hasFlag(OPT_debuginfod, OPT_no_debuginfod,
- ShouldUseDebuginfodByDefault))
- enableDebuginfod(Symbolizer);
-
std::unique_ptr<DIPrinter> Printer;
if (Style == OutputStyle::GNU)
Printer = std::make_unique<GNUPrinter>(outs(), errs(), Config);
diff --git a/lib/clang/include/VCSVersion.inc b/lib/clang/include/VCSVersion.inc
index 4756d002a956..4441e4d4aafa 100644
--- a/lib/clang/include/VCSVersion.inc
+++ b/lib/clang/include/VCSVersion.inc
@@ -1,10 +1,10 @@
// $FreeBSD$
-#define LLVM_REVISION "llvmorg-15.0.0-rc2-40-gfbd2950d8d0d"
+#define LLVM_REVISION "llvmorg-15.0.0-9-g1c73596d3454"
#define LLVM_REPOSITORY "https://github.com/llvm/llvm-project.git"
-#define CLANG_REVISION "llvmorg-15.0.0-rc2-40-gfbd2950d8d0d"
+#define CLANG_REVISION "llvmorg-15.0.0-9-g1c73596d3454"
#define CLANG_REPOSITORY "https://github.com/llvm/llvm-project.git"
-#define LLDB_REVISION "llvmorg-15.0.0-rc2-40-gfbd2950d8d0d"
+#define LLDB_REVISION "llvmorg-15.0.0-9-g1c73596d3454"
#define LLDB_REPOSITORY "https://github.com/llvm/llvm-project.git"
diff --git a/lib/clang/include/lld/Common/Version.inc b/lib/clang/include/lld/Common/Version.inc
index eaf7ae8ff492..7325d25e08a6 100644
--- a/lib/clang/include/lld/Common/Version.inc
+++ b/lib/clang/include/lld/Common/Version.inc
@@ -1,4 +1,4 @@
// Local identifier in __FreeBSD_version style
#define LLD_FREEBSD_VERSION 1400005
-#define LLD_VERSION_STRING "15.0.0 (FreeBSD llvmorg-15.0.0-rc2-40-gfbd2950d8d0d-" __XSTRING(LLD_FREEBSD_VERSION) ")"
+#define LLD_VERSION_STRING "15.0.0 (FreeBSD llvmorg-15.0.0-9-g1c73596d3454-" __XSTRING(LLD_FREEBSD_VERSION) ")"
diff --git a/lib/clang/include/llvm/Support/VCSRevision.h b/lib/clang/include/llvm/Support/VCSRevision.h
index 8fd2403121b2..a655458a3666 100644
--- a/lib/clang/include/llvm/Support/VCSRevision.h
+++ b/lib/clang/include/llvm/Support/VCSRevision.h
@@ -1,3 +1,3 @@
/* $FreeBSD$ */
-#define LLVM_REVISION "llvmorg-15.0.0-rc2-40-gfbd2950d8d0d"
+#define LLVM_REVISION "llvmorg-15.0.0-9-g1c73596d3454"
#define LLVM_REPOSITORY "https://github.com/llvm/llvm-project.git"