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
This commit is contained in:
commit
a4a491e223
@ -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 @@ class Preprocessor {
|
||||
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.
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -1094,7 +1094,7 @@ class CodeGenFunction : public CodeGenTypeCache {
|
||||
|
||||
void ForceCleanup() {
|
||||
RunCleanupsScope::ForceCleanup();
|
||||
MappedVars.restore(CGF);
|
||||
restoreMap();
|
||||
}
|
||||
|
||||
/// Exit scope - all the mapped variables are restored.
|
||||
@ -1108,6 +1108,11 @@ class CodeGenFunction : public CodeGenTypeCache {
|
||||
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
|
||||
|
@ -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()) {
|
||||
|
@ -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
|
||||
|
@ -2329,25 +2329,6 @@ class AnnotatingParser {
|
||||
!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)) {
|
||||
|
@ -232,6 +232,7 @@
|
||||
|
||||
/* Features in %ebx for leaf 0x80000008 */
|
||||
#define bit_CLZERO 0x00000001
|
||||
#define bit_RDPRU 0x00000010
|
||||
#define bit_WBNOINVD 0x00000200
|
||||
|
||||
|
||||
|
@ -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!");
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
------------------------
|
||||
|
@ -253,6 +253,8 @@ class MemoryDepChecker {
|
||||
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
|
||||
|
@ -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 @@ class MarkupFilter {
|
||||
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 @@ class MarkupFilter {
|
||||
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 @@ class MarkupFilter {
|
||||
|
||||
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 @@ class MarkupFilter {
|
||||
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 @@ class MarkupFilter {
|
||||
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;
|
||||
|
@ -190,7 +190,8 @@ class MCContext {
|
||||
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 @@ class MCContext {
|
||||
/// 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();
|
||||
|
||||
|
@ -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 @@ class MCDwarfLineStr {
|
||||
/// 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 @@ class MCDwarfLineTable {
|
||||
|
||||
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).
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
// 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));
|
||||
// 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)));
|
||||
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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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.
|
||||
std::string CompDir = std::string(CompilationDir.str());
|
||||
RemapDebugPath(CompDir);
|
||||
CompilationDir = CompDir;
|
||||
remapDebugPath(CompilationDir);
|
||||
|
||||
// Remap MCDwarfDirs in all compilation units.
|
||||
for (auto &CUIDTablePair : MCDwarfLineTablesCUMap)
|
||||
for (auto &Dir : CUIDTablePair.second.getMCDwarfDirs())
|
||||
RemapDebugPath(Dir);
|
||||
// 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);
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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 =
|
||||
|
@ -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:
|
||||
|
@ -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.
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ SparcELFMCAsmInfo::SparcELFMCAsmInfo(const Triple &TheTriple) {
|
||||
|
||||
ExceptionsType = ExceptionHandling::DwarfCFI;
|
||||
|
||||
SunStyleELFSectionSwitchSyntax = true;
|
||||
UsesELFSectionDirectiveForBSS = true;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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(),
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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())))) {
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
|
@ -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) ")"
|
||||
|
@ -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"
|
||||
|
@ -51,7 +51,7 @@ CWARNEXTRA+= -Wno-address-of-packed-member
|
||||
# variables. Make these non-fatal for the time being.
|
||||
CWARNEXTRA+= -Wno-error=array-parameter
|
||||
CWARNEXTRA+= -Wno-error=deprecated-non-prototype
|
||||
CWARNEXTRA+= -Wno-error=strict-protoypes
|
||||
CWARNEXTRA+= -Wno-error=strict-prototypes
|
||||
CWARNEXTRA+= -Wno-error=unused-but-set-variable
|
||||
.endif
|
||||
.endif # clang
|
||||
|
Loading…
Reference in New Issue
Block a user