diff --git a/clang-tools-extra/clang-tidy/abseil/NoInternalDependenciesCheck.cpp b/clang-tools-extra/clang-tidy/abseil/NoInternalDependenciesCheck.cpp index dcb8585d55a973..3ce937a756494b 100644 --- a/clang-tools-extra/clang-tidy/abseil/NoInternalDependenciesCheck.cpp +++ b/clang-tools-extra/clang-tidy/abseil/NoInternalDependenciesCheck.cpp @@ -37,7 +37,13 @@ void NoInternalDependenciesCheck::check(const MatchFinder::MatchResult &Result) const auto *InternalDependency = Result.Nodes.getNodeAs("InternalDep"); - diag(InternalDependency->getBeginLoc(), + SourceLocation LocAtFault = + Result.SourceManager->getSpellingLoc(InternalDependency->getBeginLoc()); + + if (!LocAtFault.isValid()) + return; + + diag(LocAtFault, "do not reference any 'internal' namespaces; those implementation " "details are reserved to Abseil"); } diff --git a/clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp index bf6f2f6ed03584..8953f95159a988 100644 --- a/clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp @@ -33,7 +33,7 @@ static void replaceMoveWithForward(const UnresolvedLookupExpr *Callee, if (CallRange.isValid()) { const std::string TypeName = - TypeParmDecl->getIdentifier() + (TypeParmDecl->getIdentifier() && !TypeParmDecl->isImplicit()) ? TypeParmDecl->getName().str() : (llvm::Twine("decltype(") + ParmVar->getName() + ")").str(); diff --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/absl/strings/internal-file.h b/clang-tools-extra/test/clang-tidy/checkers/Inputs/absl/strings/internal-file.h index 6014278e26060c..31798661a80fc5 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/Inputs/absl/strings/internal-file.h +++ b/clang-tools-extra/test/clang-tidy/checkers/Inputs/absl/strings/internal-file.h @@ -15,6 +15,8 @@ template P InternalTemplateFunction(P a) {} namespace container_internal { struct InternalStruct {}; + +template struct InternalTemplate {}; } // namespace container_internal } // namespace absl diff --git a/clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp b/clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp index 272d0060bdb7c5..2949d7fdd0274b 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/abseil-no-internal-dependencies.cpp @@ -44,5 +44,18 @@ std::string Str = absl::StringsFunction("a"); void MacroUse() { USE_INTERNAL(Function); // no-warning USE_EXTERNAL(Function); - // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil + // CHECK-MESSAGES: :[[@LINE-5]]:25: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil } + +class A : absl::container_internal::InternalStruct {}; +// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil + +template +class B : absl::container_internal::InternalTemplate {}; +// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil + +template class C : absl::container_internal::InternalTemplate { +public: + template static C Make(U *p) { return C{}; } +}; +// CHECK-MESSAGES: :[[@LINE-4]]:33: warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil diff --git a/clang/examples/clang-interpreter/main.cpp b/clang/examples/clang-interpreter/main.cpp index db6b0cce4fd170..c0aae47223068e 100644 --- a/clang/examples/clang-interpreter/main.cpp +++ b/clang/examples/clang-interpreter/main.cpp @@ -56,7 +56,8 @@ class SimpleJIT { MangleAndInterner Mangle{ES, DL}; JITDylib &MainJD{ES.createJITDylib("
")}; RTDyldObjectLinkingLayer ObjectLayer{ES, createMemMgr}; - IRCompileLayer CompileLayer{ES, ObjectLayer, SimpleCompiler(*TM)}; + IRCompileLayer CompileLayer{ES, ObjectLayer, + std::make_unique(*TM)}; static std::unique_ptr createMemMgr() { return std::make_unique(); diff --git a/clang/include/clang/AST/ASTConcept.h b/clang/include/clang/AST/ASTConcept.h index 84a611c14e0b2b..30c4706d2a1569 100644 --- a/clang/include/clang/AST/ASTConcept.h +++ b/clang/include/clang/AST/ASTConcept.h @@ -24,9 +24,23 @@ namespace clang { class ConceptDecl; class ConceptSpecializationExpr; -/// \brief The result of a constraint satisfaction check, containing the -/// necessary information to diagnose an unsatisfied constraint. -struct ConstraintSatisfaction { +/// The result of a constraint satisfaction check, containing the necessary +/// information to diagnose an unsatisfied constraint. +class ConstraintSatisfaction : public llvm::FoldingSetNode { + // The template-like entity that 'owns' the constraint checked here (can be a + // constrained entity or a concept). + NamedDecl *ConstraintOwner = nullptr; + llvm::SmallVector TemplateArgs; + +public: + + ConstraintSatisfaction() = default; + + ConstraintSatisfaction(NamedDecl *ConstraintOwner, + ArrayRef TemplateArgs) : + ConstraintOwner(ConstraintOwner), TemplateArgs(TemplateArgs.begin(), + TemplateArgs.end()) { } + using SubstitutionDiagnostic = std::pair; using Detail = llvm::PointerUnion; @@ -38,9 +52,13 @@ struct ConstraintSatisfaction { /// invalid expression. llvm::SmallVector, 4> Details; - // This can leak if used in an AST node, use ASTConstraintSatisfaction - // instead. - void *operator new(size_t bytes, ASTContext &C) = delete; + void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C) { + Profile(ID, C, ConstraintOwner, TemplateArgs); + } + + static void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C, + NamedDecl *ConstraintOwner, + ArrayRef TemplateArgs); }; /// Pairs of unsatisfied atomic constraint expressions along with the diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 10db2a868dce6d..7d01181e7c0188 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -2567,10 +2567,6 @@ def Capability : InheritableAttr { let Accessors = [Accessor<"isShared", [Clang<"shared_capability", 0>]>]; let Documentation = [Undocumented]; - let AdditionalMembers = [{ - bool isMutex() const { return getName().equals_lower("mutex"); } - bool isRole() const { return getName().equals_lower("role"); } - }]; } def AssertCapability : InheritableAttr { diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index 456edd1daafc65..8fd59a0c9b38cf 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -260,6 +260,7 @@ The ``sycl_kernel`` attribute specifies that a function template will be used to outline device code and to generate an OpenCL kernel. Here is a code example of the SYCL program, which demonstrates the compiler's outlining job: + .. code-block:: c++ int foo(int x) { return ++x; } @@ -282,27 +283,29 @@ compilation of functions for the device part can be found in the SYCL 1.2.1 specification Section 6.4. To show to the compiler entry point to the "device part" of the code, the SYCL runtime can use the ``sycl_kernel`` attribute in the following way: + .. code-block:: c++ -namespace cl { -namespace sycl { -class handler { - template - __attribute__((sycl_kernel)) void sycl_kernel_function(KernelType KernelFuncObj) { - // ... - KernelFuncObj(); - } - template - void parallel_for(range NumWorkItems, KernelType KernelFunc) { -#ifdef __SYCL_DEVICE_ONLY__ - sycl_kernel_function(KernelFunc); -#else - // Host implementation -#endif - } -}; -} // namespace sycl -} // namespace cl + namespace cl { + namespace sycl { + class handler { + template + __attribute__((sycl_kernel)) void sycl_kernel_function(KernelType KernelFuncObj) { + // ... + KernelFuncObj(); + } + + template + void parallel_for(range NumWorkItems, KernelType KernelFunc) { + #ifdef __SYCL_DEVICE_ONLY__ + sycl_kernel_function(KernelFunc); + #else + // Host implementation + #endif + } + }; + } // namespace sycl + } // namespace cl The compiler will also generate an OpenCL kernel using the function marked with the ``sycl_kernel`` attribute. diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index a4d0427108587e..b87419d393e2c8 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3252,9 +3252,6 @@ def warn_at_available_unchecked_use : Warning< InGroup>; // Thread Safety Attributes -def warn_invalid_capability_name : Warning< - "invalid capability name '%0'; capability name must be 'mutex' or 'role'">, - InGroup, DefaultIgnore; def warn_thread_attribute_ignored : Warning< "ignoring %0 attribute because its argument is invalid">, InGroup, DefaultIgnore; diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def index 068f206f44847d..b8112eb2691367 100644 --- a/clang/include/clang/Basic/LangOptions.def +++ b/clang/include/clang/Basic/LangOptions.def @@ -238,6 +238,7 @@ LANGOPT(AlignedAllocation , 1, 0, "aligned allocation") LANGOPT(AlignedAllocationUnavailable, 1, 0, "aligned allocation functions are unavailable") LANGOPT(NewAlignOverride , 32, 0, "maximum alignment guaranteed by '::operator new(size_t)'") LANGOPT(ConceptsTS , 1, 0, "enable C++ Extensions for Concepts") +LANGOPT(ConceptSatisfactionCaching , 1, 1, "enable satisfaction caching for C++2a Concepts") BENIGN_LANGOPT(ModulesCodegen , 1, 0, "Modules code generation") BENIGN_LANGOPT(ModulesDebugInfo , 1, 0, "Modules debug info") BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision") diff --git a/clang/include/clang/Driver/CC1Options.td b/clang/include/clang/Driver/CC1Options.td index df05529643132b..d5cf57d00a46a9 100644 --- a/clang/include/clang/Driver/CC1Options.td +++ b/clang/include/clang/Driver/CC1Options.td @@ -559,6 +559,9 @@ def ftest_module_file_extension_EQ : "The argument is parsed as blockname:major:minor:hashed:user info">; def fconcepts_ts : Flag<["-"], "fconcepts-ts">, HelpText<"Enable C++ Extensions for Concepts.">; +def fno_concept_satisfaction_caching : Flag<["-"], + "fno-concept-satisfaction-caching">, + HelpText<"Disable satisfaction caching for C++2a Concepts.">; let Group = Action_Group in { diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 6e3ae96b3afc21..08f657374bcfc0 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -6200,6 +6200,9 @@ class Sema final { llvm::DenseMap NormalizationCache; + llvm::ContextualFoldingSet + SatisfactionCache; + public: const NormalizedConstraint * getNormalizedAssociatedConstraints( @@ -6226,6 +6229,8 @@ class Sema final { /// \brief Check whether the given list of constraint expressions are /// satisfied (as if in a 'conjunction') given template arguments. + /// \param Template the template-like entity that triggered the constraints + /// check (either a concept or a constrained entity). /// \param ConstraintExprs a list of constraint expressions, treated as if /// they were 'AND'ed together. /// \param TemplateArgs the list of template arguments to substitute into the @@ -6237,23 +6242,10 @@ class Sema final { /// expression. /// \returns true if an error occurred and satisfaction could not be checked, /// false otherwise. - bool CheckConstraintSatisfaction(TemplateDecl *Template, - ArrayRef ConstraintExprs, - ArrayRef TemplateArgs, - SourceRange TemplateIDRange, - ConstraintSatisfaction &Satisfaction); - - bool CheckConstraintSatisfaction(ClassTemplatePartialSpecializationDecl *TD, - ArrayRef ConstraintExprs, - ArrayRef TemplateArgs, - SourceRange TemplateIDRange, - ConstraintSatisfaction &Satisfaction); - - bool CheckConstraintSatisfaction(VarTemplatePartialSpecializationDecl *TD, - ArrayRef ConstraintExprs, - ArrayRef TemplateArgs, - SourceRange TemplateIDRange, - ConstraintSatisfaction &Satisfaction); + bool CheckConstraintSatisfaction( + NamedDecl *Template, ArrayRef ConstraintExprs, + ArrayRef TemplateArgs, + SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction); /// \brief Check whether the given non-dependent constraint expression is /// satisfied. Returns false and updates Satisfaction with the satisfaction diff --git a/clang/include/clang/Sema/TemplateDeduction.h b/clang/include/clang/Sema/TemplateDeduction.h index b60939c97872dc..f787c2689d850d 100644 --- a/clang/include/clang/Sema/TemplateDeduction.h +++ b/clang/include/clang/Sema/TemplateDeduction.h @@ -15,6 +15,7 @@ #define LLVM_CLANG_SEMA_TEMPLATEDEDUCTION_H #include "clang/Sema/Ownership.h" +#include "clang/Sema/SemaConcept.h" #include "clang/AST/ASTConcept.h" #include "clang/AST/DeclAccessPair.h" #include "clang/AST/DeclTemplate.h" diff --git a/clang/lib/AST/ASTConcept.cpp b/clang/lib/AST/ASTConcept.cpp index fc32e768d92f8c..c28a06bdf0b24a 100644 --- a/clang/lib/AST/ASTConcept.cpp +++ b/clang/lib/AST/ASTConcept.cpp @@ -14,6 +14,10 @@ #include "clang/AST/ASTConcept.h" #include "clang/AST/ASTContext.h" +#include "clang/AST/Decl.h" +#include "clang/AST/TemplateBase.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/FoldingSet.h" using namespace clang; ASTConstraintSatisfaction::ASTConstraintSatisfaction(const ASTContext &C, @@ -53,3 +57,12 @@ ASTConstraintSatisfaction::Create(const ASTContext &C, void *Mem = C.Allocate(size, alignof(ASTConstraintSatisfaction)); return new (Mem) ASTConstraintSatisfaction(C, Satisfaction); } + +void ConstraintSatisfaction::Profile( + llvm::FoldingSetNodeID &ID, const ASTContext &C, NamedDecl *ConstraintOwner, + ArrayRef TemplateArgs) { + ID.AddPointer(ConstraintOwner); + ID.AddInteger(TemplateArgs.size()); + for (auto &Arg : TemplateArgs) + Arg.Profile(ID, C); +} diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 17a3751f271680..69c0b0b036665a 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -2440,9 +2440,8 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, EmitScalarExpr(AVAttr->getAlignment()); llvm::ConstantInt *AlignmentCI = cast(AlignmentValue); - unsigned Alignment = std::min((unsigned)AlignmentCI->getZExtValue(), - +llvm::Value::MaximumAlignment); - AI->addAttrs(llvm::AttrBuilder().addAlignmentAttr(Alignment)); + AI->addAttrs(llvm::AttrBuilder().addAlignmentAttr(llvm::MaybeAlign( + AlignmentCI->getLimitedValue(llvm::Value::MaximumAlignment)))); } } @@ -4628,7 +4627,8 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, llvm::ConstantInt *AlignmentCI = cast(Alignment); EmitAlignmentAssumption(Ret.getScalarVal(), RetTy, Loc, AA->getLocation(), AlignmentCI, OffsetValue); - } else if (const auto *AA = TargetDecl->getAttr()) { + } + if (const auto *AA = TargetDecl->getAttr()) { llvm::Value *AlignmentVal = CallArgs[AA->getParamIndex().getLLVMIndex()] .getRValue(*this) .getScalarVal(); diff --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp index 9f86231530c203..50a85c149f0402 100644 --- a/clang/lib/Driver/Compilation.cpp +++ b/clang/lib/Driver/Compilation.cpp @@ -176,7 +176,7 @@ int Compilation::ExecuteCommand(const Command &C, } if (getDriver().CCPrintOptions) - *OS << "[Logging clang options]"; + *OS << "[Logging clang options]\n"; C.Print(*OS, "\n", /*Quote=*/getDriver().CCPrintOptions); } diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp index bc2a3e7ef61bd0..344a14fe1ea7ce 100644 --- a/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/clang/lib/Driver/ToolChains/Darwin.cpp @@ -1149,7 +1149,6 @@ void Darwin::addProfileRTLibs(const ArgList &Args, } else { addExportedSymbol(CmdArgs, "___llvm_profile_filename"); addExportedSymbol(CmdArgs, "___llvm_profile_raw_version"); - addExportedSymbol(CmdArgs, "___llvm_profile_counter_bias"); } addExportedSymbol(CmdArgs, "_lprofDirMode"); } diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 4747dd7f6a7839..ce14a39da5ce9a 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -2854,6 +2854,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.NewAlignOverride = 0; } Opts.ConceptsTS = Args.hasArg(OPT_fconcepts_ts); + Opts.ConceptSatisfactionCaching = + !Args.hasArg(OPT_fno_concept_satisfaction_caching); Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions); Opts.AccessControl = !Args.hasArg(OPT_fno_access_control); Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors); diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index f8da1cb89b9d9c..7eb8c8d2f7601b 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -153,10 +153,10 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, TUKind(TUKind), NumSFINAEErrors(0), FullyCheckedComparisonCategories( static_cast(ComparisonCategoryType::Last) + 1), - AccessCheckingSFINAE(false), InNonInstantiationSFINAEContext(false), - NonInstantiationEntries(0), ArgumentPackSubstitutionIndex(-1), - CurrentInstantiationScope(nullptr), DisableTypoCorrection(false), - TyposCorrected(0), AnalysisWarnings(*this), + SatisfactionCache(Context), AccessCheckingSFINAE(false), + InNonInstantiationSFINAEContext(false), NonInstantiationEntries(0), + ArgumentPackSubstitutionIndex(-1), CurrentInstantiationScope(nullptr), + DisableTypoCorrection(false), TyposCorrected(0), AnalysisWarnings(*this), ThreadSafetyDeclCache(nullptr), VarDataSharingAttributesStack(nullptr), CurScope(nullptr), Ident_super(nullptr), Ident___float128(nullptr) { TUScope = nullptr; @@ -379,6 +379,14 @@ Sema::~Sema() { if (isMultiplexExternalSource) delete ExternalSource; + // Delete cached satisfactions. + std::vector Satisfactions; + Satisfactions.reserve(Satisfactions.size()); + for (auto &Node : SatisfactionCache) + Satisfactions.push_back(&Node); + for (auto *Node : Satisfactions) + delete Node; + threadSafety::threadSafetyCleanup(ThreadSafetyDeclCache); // Destroys data sharing attributes stack for OpenMP diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp index 93e5b4511da961..81601b09ce0d64 100755 --- a/clang/lib/Sema/SemaConcept.cpp +++ b/clang/lib/Sema/SemaConcept.cpp @@ -272,36 +272,56 @@ static bool CheckConstraintSatisfaction(Sema &S, TemplateDeclT *Template, return false; } -bool Sema::CheckConstraintSatisfaction(TemplateDecl *Template, - ArrayRef ConstraintExprs, - ArrayRef TemplateArgs, - SourceRange TemplateIDRange, - ConstraintSatisfaction &Satisfaction) { - return ::CheckConstraintSatisfaction(*this, Template, ConstraintExprs, - TemplateArgs, TemplateIDRange, - Satisfaction); -} +bool Sema::CheckConstraintSatisfaction( + NamedDecl *Template, ArrayRef ConstraintExprs, + ArrayRef TemplateArgs, SourceRange TemplateIDRange, + ConstraintSatisfaction &OutSatisfaction) { + if (ConstraintExprs.empty()) { + OutSatisfaction.IsSatisfied = true; + return false; + } -bool -Sema::CheckConstraintSatisfaction(ClassTemplatePartialSpecializationDecl* Part, - ArrayRef ConstraintExprs, - ArrayRef TemplateArgs, - SourceRange TemplateIDRange, - ConstraintSatisfaction &Satisfaction) { - return ::CheckConstraintSatisfaction(*this, Part, ConstraintExprs, - TemplateArgs, TemplateIDRange, - Satisfaction); -} + llvm::FoldingSetNodeID ID; + void *InsertPos; + ConstraintSatisfaction *Satisfaction = nullptr; + if (LangOpts.ConceptSatisfactionCaching) { + ConstraintSatisfaction::Profile(ID, Context, Template, TemplateArgs); + Satisfaction = SatisfactionCache.FindNodeOrInsertPos(ID, InsertPos); + if (Satisfaction) { + OutSatisfaction = *Satisfaction; + return false; + } + Satisfaction = new ConstraintSatisfaction(Template, TemplateArgs); + } else { + Satisfaction = &OutSatisfaction; + } + bool Failed; + if (auto *T = dyn_cast(Template)) + Failed = ::CheckConstraintSatisfaction(*this, T, ConstraintExprs, + TemplateArgs, TemplateIDRange, + *Satisfaction); + else if (auto *P = + dyn_cast(Template)) + Failed = ::CheckConstraintSatisfaction(*this, P, ConstraintExprs, + TemplateArgs, TemplateIDRange, + *Satisfaction); + else + Failed = ::CheckConstraintSatisfaction( + *this, cast(Template), + ConstraintExprs, TemplateArgs, TemplateIDRange, *Satisfaction); + if (Failed) { + if (LangOpts.ConceptSatisfactionCaching) + delete Satisfaction; + return true; + } -bool -Sema::CheckConstraintSatisfaction(VarTemplatePartialSpecializationDecl* Partial, - ArrayRef ConstraintExprs, - ArrayRef TemplateArgs, - SourceRange TemplateIDRange, - ConstraintSatisfaction &Satisfaction) { - return ::CheckConstraintSatisfaction(*this, Partial, ConstraintExprs, - TemplateArgs, TemplateIDRange, - Satisfaction); + if (LangOpts.ConceptSatisfactionCaching) { + // We cannot use InsertNode here because CheckConstraintSatisfaction might + // have invalidated it. + SatisfactionCache.InsertNode(Satisfaction); + OutSatisfaction = *Satisfaction; + } + return false; } bool Sema::CheckConstraintSatisfaction(const Expr *ConstraintExpr, diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 5c51b0f9b8cb7c..040a2695643346 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -4937,11 +4937,7 @@ static void handlePatchableFunctionEntryAttr(Sema &S, Decl *D, static bool ArmMveAliasValid(unsigned BuiltinID, StringRef AliasName) { if (AliasName.startswith("__arm_")) AliasName = AliasName.substr(6); - switch (BuiltinID) { #include "clang/Basic/arm_mve_builtin_aliases.inc" - default: - return false; - } } static void handleArmMveAliasAttr(Sema &S, Decl *D, const ParsedAttr &AL) { @@ -6199,11 +6195,6 @@ static void handleCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { !S.checkStringLiteralArgumentAttr(AL, 0, N, &LiteralLoc)) return; - // Currently, there are only two names allowed for a capability: role and - // mutex (case insensitive). Diagnose other capability names. - if (!N.equals_lower("mutex") && !N.equals_lower("role")) - S.Diag(LiteralLoc, diag::warn_invalid_capability_name) << N; - D->addAttr(::new (S.Context) CapabilityAttr(S.Context, AL, N)); } diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index d6c3af9e84c80a..ff64810062801f 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -2838,6 +2838,9 @@ static void DiagnoseForRangeConstVariableCopies(Sema &SemaRef, /// Suggest "const foo &x" to prevent the copy. static void DiagnoseForRangeVariableCopies(Sema &SemaRef, const CXXForRangeStmt *ForStmt) { + if (SemaRef.inTemplateInstantiation()) + return; + if (SemaRef.Diags.isIgnored(diag::warn_for_range_const_reference_copy, ForStmt->getBeginLoc()) && SemaRef.Diags.isIgnored(diag::warn_for_range_variable_always_copy, @@ -2860,6 +2863,9 @@ static void DiagnoseForRangeVariableCopies(Sema &SemaRef, if (!InitExpr) return; + if (InitExpr->getExprLoc().isMacroID()) + return; + if (VariableType->isReferenceType()) { DiagnoseForRangeReferenceVariableCopies(SemaRef, VD, ForStmt->getRangeInit()->getType()); diff --git a/clang/test/CodeGen/assume-aligned-and-alloc-align-attributes.c b/clang/test/CodeGen/assume-aligned-and-alloc-align-attributes.c new file mode 100644 index 00000000000000..948537189686f7 --- /dev/null +++ b/clang/test/CodeGen/assume-aligned-and-alloc-align-attributes.c @@ -0,0 +1,77 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s + +void *my_aligned_alloc(int size, int alignment) __attribute__((assume_aligned(32), alloc_align(2))); + +// CHECK-LABEL: @t0_immediate0( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[CALL:%.*]] = call i8* @my_aligned_alloc(i32 320, i32 16) +// CHECK-NEXT: [[PTRINT:%.*]] = ptrtoint i8* [[CALL]] to i64 +// CHECK-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], 31 +// CHECK-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0 +// CHECK-NEXT: call void @llvm.assume(i1 [[MASKCOND]]) +// CHECK-NEXT: [[PTRINT1:%.*]] = ptrtoint i8* [[CALL]] to i64 +// CHECK-NEXT: [[MASKEDPTR2:%.*]] = and i64 [[PTRINT1]], 15 +// CHECK-NEXT: [[MASKCOND3:%.*]] = icmp eq i64 [[MASKEDPTR2]], 0 +// CHECK-NEXT: call void @llvm.assume(i1 [[MASKCOND3]]) +// CHECK-NEXT: ret i8* [[CALL]] +// +void *t0_immediate0() { + return my_aligned_alloc(320, 16); +}; + +// CHECK-LABEL: @t1_immediate1( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[CALL:%.*]] = call i8* @my_aligned_alloc(i32 320, i32 32) +// CHECK-NEXT: [[PTRINT:%.*]] = ptrtoint i8* [[CALL]] to i64 +// CHECK-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], 31 +// CHECK-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0 +// CHECK-NEXT: call void @llvm.assume(i1 [[MASKCOND]]) +// CHECK-NEXT: [[PTRINT1:%.*]] = ptrtoint i8* [[CALL]] to i64 +// CHECK-NEXT: [[MASKEDPTR2:%.*]] = and i64 [[PTRINT1]], 31 +// CHECK-NEXT: [[MASKCOND3:%.*]] = icmp eq i64 [[MASKEDPTR2]], 0 +// CHECK-NEXT: call void @llvm.assume(i1 [[MASKCOND3]]) +// CHECK-NEXT: ret i8* [[CALL]] +// +void *t1_immediate1() { + return my_aligned_alloc(320, 32); +}; + +// CHECK-LABEL: @t2_immediate2( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[CALL:%.*]] = call i8* @my_aligned_alloc(i32 320, i32 64) +// CHECK-NEXT: [[PTRINT:%.*]] = ptrtoint i8* [[CALL]] to i64 +// CHECK-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], 31 +// CHECK-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0 +// CHECK-NEXT: call void @llvm.assume(i1 [[MASKCOND]]) +// CHECK-NEXT: [[PTRINT1:%.*]] = ptrtoint i8* [[CALL]] to i64 +// CHECK-NEXT: [[MASKEDPTR2:%.*]] = and i64 [[PTRINT1]], 63 +// CHECK-NEXT: [[MASKCOND3:%.*]] = icmp eq i64 [[MASKEDPTR2]], 0 +// CHECK-NEXT: call void @llvm.assume(i1 [[MASKCOND3]]) +// CHECK-NEXT: ret i8* [[CALL]] +// +void *t2_immediate2() { + return my_aligned_alloc(320, 64); +}; + +// CHECK-LABEL: @t3_variable( +// CHECK-NEXT: entry: +// CHECK-NEXT: [[ALIGNMENT_ADDR:%.*]] = alloca i32, align 4 +// CHECK-NEXT: store i32 [[ALIGNMENT:%.*]], i32* [[ALIGNMENT_ADDR]], align 4 +// CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[ALIGNMENT_ADDR]], align 4 +// CHECK-NEXT: [[CALL:%.*]] = call i8* @my_aligned_alloc(i32 320, i32 [[TMP0]]) +// CHECK-NEXT: [[PTRINT:%.*]] = ptrtoint i8* [[CALL]] to i64 +// CHECK-NEXT: [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], 31 +// CHECK-NEXT: [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0 +// CHECK-NEXT: call void @llvm.assume(i1 [[MASKCOND]]) +// CHECK-NEXT: [[ALIGNMENTCAST:%.*]] = zext i32 [[TMP0]] to i64 +// CHECK-NEXT: [[MASK:%.*]] = sub i64 [[ALIGNMENTCAST]], 1 +// CHECK-NEXT: [[PTRINT1:%.*]] = ptrtoint i8* [[CALL]] to i64 +// CHECK-NEXT: [[MASKEDPTR2:%.*]] = and i64 [[PTRINT1]], [[MASK]] +// CHECK-NEXT: [[MASKCOND3:%.*]] = icmp eq i64 [[MASKEDPTR2]], 0 +// CHECK-NEXT: call void @llvm.assume(i1 [[MASKCOND3]]) +// CHECK-NEXT: ret i8* [[CALL]] +// +void *t3_variable(int alignment) { + return my_aligned_alloc(320, alignment); +}; diff --git a/clang/test/CodeGenCXX/virtual-compare.cpp b/clang/test/CodeGenCXX/virtual-compare.cpp index 6ffbe8eb86aee1..ef75513ec0fe95 100644 --- a/clang/test/CodeGenCXX/virtual-compare.cpp +++ b/clang/test/CodeGenCXX/virtual-compare.cpp @@ -43,11 +43,11 @@ struct A : X, Y { // For Y: // CHECK-SAME: @_ZTI1A -// CHECK-SAME: @_ZThn8_N1AD1Ev -// CHECK-SAME: @_ZThn8_N1AD0Ev +// CHECK-SAME: @_ZThn{{[0-9]*}}_N1AD1Ev +// CHECK-SAME: @_ZThn{{[0-9]*}}_N1AD0Ev // virtual ~Y(); -// CHECK-SAME: @_ZThn8_N1AaSERKS_ +// CHECK-SAME: @_ZThn{{[0-9]*}}_N1AaSERKS_ // virtual A &operator=(const A &); void A::f() {} diff --git a/clang/test/Driver/cc-print-options.c b/clang/test/Driver/cc-print-options.c index 77dd0fef5f983c..dc7f4a3ac35c38 100644 --- a/clang/test/Driver/cc-print-options.c +++ b/clang/test/Driver/cc-print-options.c @@ -3,5 +3,6 @@ // RUN: %clang -no-canonical-prefixes -S -o %t.s %s // RUN: FileCheck %s < %t.log -// CHECK: [Logging clang options]{{.*}}clang{{.*}}"-S" +// CHECK: [Logging clang options] +// CHECK: {{.*}}clang{{.*}}"-S" diff --git a/clang/test/InterfaceStubs/driver-test.c b/clang/test/InterfaceStubs/driver-test.c index 9ca5577a5c2022..894d896bb219e6 100644 --- a/clang/test/InterfaceStubs/driver-test.c +++ b/clang/test/InterfaceStubs/driver-test.c @@ -1,8 +1,17 @@ // REQUIRES: x86-registered-target // REQUIRES: shell +// NOTE: -fno-integrated-cc1 has been added to work around an ASAN failure +// caused by in-process cc1 invocation. Clang InterfaceStubs is not the +// culprit, but Clang Interface Stubs' Driver pipeline setup uncovers an +// existing ASAN issue when invoking multiple normal cc1 jobs along with +// multiple Clang Interface Stubs cc1 jobs together. +// There is currently a discussion of this going on at: +// https://reviews.llvm.org/D69825 // RUN: mkdir -p %t; cd %t -// RUN: %clang -target x86_64-unknown-linux-gnu -x c -S -emit-interface-stubs %s %S/object.c %S/weak.cpp && \ +// RUN: %clang -target x86_64-unknown-linux-gnu -x c -S \ +// RUN: -fno-integrated-cc1 \ +// RUN: -emit-interface-stubs %s %S/object.c %S/weak.cpp && \ // RUN: llvm-nm %t/a.out.ifso 2>&1 | FileCheck --check-prefix=CHECK-IFS %s // CHECK-IFS-DAG: data diff --git a/clang/test/InterfaceStubs/driver-test2.c b/clang/test/InterfaceStubs/driver-test2.c index c3a3b31b212d53..905b27922264ca 100644 --- a/clang/test/InterfaceStubs/driver-test2.c +++ b/clang/test/InterfaceStubs/driver-test2.c @@ -1,10 +1,19 @@ // REQUIRES: x86-registered-target // REQUIRES: shell +// NOTE: -fno-integrated-cc1 has been added to work around an ASAN failure +// caused by in-process cc1 invocation. Clang InterfaceStubs is not the +// culprit, but Clang Interface Stubs' Driver pipeline setup uncovers an +// existing ASAN issue when invoking multiple normal cc1 jobs along with +// multiple Clang Interface Stubs cc1 jobs together. +// There is currently a discussion of this going on at: +// https://reviews.llvm.org/D69825 // RUN: mkdir -p %t; cd %t // RUN: %clang -target x86_64-unknown-linux-gnu -c -emit-interface-stubs \ +// RUN: -fno-integrated-cc1 \ // RUN: %s %S/object.c %S/weak.cpp // RUN: %clang -emit-interface-stubs -emit-merged-ifs \ +// RUN: -fno-integrated-cc1 \ // RUN: %t/driver-test2.o %t/object.o %t/weak.o -S -o - 2>&1 | FileCheck %s // CHECK-DAG: data diff --git a/clang/test/Sema/attr-capabilities.c b/clang/test/Sema/attr-capabilities.c index 8bfc4a50654326..b28c437935a130 100644 --- a/clang/test/Sema/attr-capabilities.c +++ b/clang/test/Sema/attr-capabilities.c @@ -8,8 +8,8 @@ struct NotACapability {}; union __attribute__((capability("mutex"))) MutexUnion { int a; char* b; }; typedef union { int a; char* b; } __attribute__((capability("mutex"))) MutexUnion2; -// Test an invalid capability name -struct __attribute__((capability("wrong"))) IncorrectName {}; // expected-warning {{invalid capability name 'wrong'; capability name must be 'mutex' or 'role'}} +// Test a different capability name +struct __attribute__((capability("custom"))) CustomName {}; int Test1 __attribute__((capability("test1"))); // expected-error {{'capability' attribute only applies to structs, unions, classes, and typedefs}} int Test2 __attribute__((shared_capability("test2"))); // expected-error {{'shared_capability' attribute only applies to structs, unions, classes, and typedefs}} diff --git a/clang/test/SemaCXX/warn-range-loop-analysis.cpp b/clang/test/SemaCXX/warn-range-loop-analysis.cpp index 53b0ca288194f1..951844c953ef92 100644 --- a/clang/test/SemaCXX/warn-range-loop-analysis.cpp +++ b/clang/test/SemaCXX/warn-range-loop-analysis.cpp @@ -454,3 +454,75 @@ void test10() { // expected-note@-2 {{'Bar'}} // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:17-[[@LINE-3]]:18}:" " } + +template +void test_template_function() { + // In a template instantiation the diagnostics should not be emitted for + // loops with dependent types. + Container C; + for (const Bar &x : C) {} + // expected-warning@-1 {{always a copy}} + // expected-note@-2 {{'Bar'}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:18-[[@LINE-3]]:19}:"" + + Container Dependent; + for (const T &x : Dependent) {} +} +template void test_template_function(); + +template +struct test_template_struct { + static void static_member() { + Container C; + for (const Bar &x : C) {} + // expected-warning@-1 {{always a copy}} + // expected-note@-2 {{'Bar'}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:20-[[@LINE-3]]:21}:"" + + Container Dependent; + for (const T &x : Dependent) {} + } + + void member() { + Container C; + for (const Bar &x : C) {} + // expected-warning@-1 {{always a copy}} + // expected-note@-2 {{'Bar'}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:20-[[@LINE-3]]:21}:"" + + Container Dependent; + for (const T &x : Dependent) {} + } +}; +template struct test_template_struct; + +struct test_struct_with_templated_member { + void member() { + Container C; + for (const Bar &x : C) {} + // expected-warning@-1 {{always a copy}} + // expected-note@-2 {{'Bar'}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:20-[[@LINE-3]]:21}:"" + } + + template + void template_member() { + Container C; + for (const Bar &x : C) {} + // expected-warning@-1 {{always a copy}} + // expected-note@-2 {{'Bar'}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:20-[[@LINE-3]]:21}:"" + + Container Dependent; + for (const T &x : Dependent) {} + } +}; +template void test_struct_with_templated_member::template_member(); + +#define TEST_MACRO \ + void test_macro() { \ + Container C; \ + for (const Bar &x : C) {} \ + } + +TEST_MACRO diff --git a/clang/test/SemaTemplate/cxx2a-constraint-caching.cpp b/clang/test/SemaTemplate/cxx2a-constraint-caching.cpp new file mode 100644 index 00000000000000..fd95c80ff61e78 --- /dev/null +++ b/clang/test/SemaTemplate/cxx2a-constraint-caching.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=c++2a -fconcepts-ts -verify %s +// RUN: %clang_cc1 -std=c++2a -fconcepts-ts -verify %s -fno-concept-satisfaction-caching -DNO_CACHE +// expected-no-diagnostics + +template +concept C = (f(T()), true); + +template +constexpr bool foo() { return false; } + +template + requires (f(T()), true) +constexpr bool foo() requires (f(T()), true) { return true; } + +namespace a { + struct A {}; + void f(A a); +} + +static_assert(C); +static_assert(foo()); + +namespace a { + // This makes calls to f ambiguous, but the second check will still succeed + // because the constraint satisfaction results are cached. + void f(A a, int = 2); +} +#ifdef NO_CACHE +static_assert(!C); +static_assert(!foo()); +#else +static_assert(C); +static_assert(foo()); +#endif \ No newline at end of file diff --git a/clang/utils/TableGen/MveEmitter.cpp b/clang/utils/TableGen/MveEmitter.cpp index c39e41ac6e5b34..165c757d9a8472 100644 --- a/clang/utils/TableGen/MveEmitter.cpp +++ b/clang/utils/TableGen/MveEmitter.cpp @@ -64,6 +64,7 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" +#include "llvm/TableGen/StringToOffsetTable.h" #include #include #include @@ -1846,14 +1847,46 @@ void MveEmitter::EmitBuiltinCG(raw_ostream &OS) { } void MveEmitter::EmitBuiltinAliases(raw_ostream &OS) { + // Build a sorted table of: + // - intrinsic id number + // - full name + // - polymorphic name or -1 + StringToOffsetTable StringTable; + OS << "struct IntrinToName {\n" + " uint32_t Id;\n" + " int32_t FullName;\n" + " int32_t ShortName;\n" + "};\n"; + OS << "static const IntrinToName Map[] = {\n"; for (const auto &kv : ACLEIntrinsics) { const ACLEIntrinsic &Int = *kv.second; - OS << "case ARM::BI__builtin_arm_mve_" << Int.fullName() << ":\n" - << " return AliasName == \"" << Int.fullName() << "\""; - if (Int.polymorphic()) - OS << " || AliasName == \"" << Int.shortName() << "\""; - OS << ";\n"; - } + int32_t ShortNameOffset = + Int.polymorphic() ? StringTable.GetOrAddStringOffset(Int.shortName()) + : -1; + OS << " { ARM::BI__builtin_arm_mve_" << Int.fullName() << ", " + << StringTable.GetOrAddStringOffset(Int.fullName()) << ", " + << ShortNameOffset << "},\n"; + } + OS << "};\n\n"; + + OS << "static const char IntrinNames[] = {\n"; + StringTable.EmitString(OS); + OS << "};\n\n"; + + OS << "auto It = std::lower_bound(std::begin(Map), " + "std::end(Map), BuiltinID,\n" + " [](const IntrinToName &L, unsigned Id) {\n" + " return L.Id < Id;\n" + " });\n"; + OS << "if (It == std::end(Map) || It->Id != BuiltinID)\n" + " return false;\n"; + OS << "StringRef FullName(&IntrinNames[It->FullName]);\n"; + OS << "if (AliasName == FullName)\n" + " return true;\n"; + OS << "if (It->ShortName == -1)\n" + " return false;\n"; + OS << "StringRef ShortName(&IntrinNames[It->ShortName]);\n"; + OS << "return AliasName == ShortName;\n"; } } // namespace diff --git a/compiler-rt/lib/scudo/standalone/common.h b/compiler-rt/lib/scudo/standalone/common.h index a700eb5eaa3f4b..e026e34c0045c0 100644 --- a/compiler-rt/lib/scudo/standalone/common.h +++ b/compiler-rt/lib/scudo/standalone/common.h @@ -126,6 +126,7 @@ inline uptr getPageSizeCached() { return getPageSizeSlow(); } +// Returns 0 if the number of CPUs could not be determined. u32 getNumberOfCPUs(); const char *getEnv(const char *Name); diff --git a/compiler-rt/lib/scudo/standalone/linux.cpp b/compiler-rt/lib/scudo/standalone/linux.cpp index 3c120845c2d8d2..3b7562844d72b5 100644 --- a/compiler-rt/lib/scudo/standalone/linux.cpp +++ b/compiler-rt/lib/scudo/standalone/linux.cpp @@ -132,7 +132,10 @@ u64 getMonotonicTime() { u32 getNumberOfCPUs() { cpu_set_t CPUs; - CHECK_EQ(sched_getaffinity(0, sizeof(cpu_set_t), &CPUs), 0); + // sched_getaffinity can fail for a variety of legitimate reasons (lack of + // CAP_SYS_NICE, syscall filtering, etc), in which case we shall return 0. + if (sched_getaffinity(0, sizeof(cpu_set_t), &CPUs) != 0) + return 0; return static_cast(CPU_COUNT(&CPUs)); } diff --git a/compiler-rt/lib/scudo/standalone/tsd_shared.h b/compiler-rt/lib/scudo/standalone/tsd_shared.h index 5ab8269519a90b..1626732c70f49e 100644 --- a/compiler-rt/lib/scudo/standalone/tsd_shared.h +++ b/compiler-rt/lib/scudo/standalone/tsd_shared.h @@ -18,7 +18,9 @@ template struct TSDRegistrySharedT { void initLinkerInitialized(Allocator *Instance) { Instance->initLinkerInitialized(); CHECK_EQ(pthread_key_create(&PThreadKey, nullptr), 0); // For non-TLS - NumberOfTSDs = Min(Max(1U, getNumberOfCPUs()), MaxTSDCount); + const u32 NumberOfCPUs = getNumberOfCPUs(); + NumberOfTSDs = + (NumberOfCPUs == 0) ? MaxTSDCount : Min(NumberOfCPUs, MaxTSDCount); TSDs = reinterpret_cast *>( map(nullptr, sizeof(TSD) * NumberOfTSDs, "scudo:tsd")); for (u32 I = 0; I < NumberOfTSDs; I++) diff --git a/libcxx/include/__config b/libcxx/include/__config index 84cd46bcc02d78..77700098281c24 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -463,6 +463,10 @@ typedef __char32_t char32_t; #define _LIBCPP_HAS_OBJC_ARC_WEAK #endif +#if __has_extension(blocks) +# define _LIBCPP_HAS_EXTENSION_BLOCKS +#endif + #if !(__has_feature(cxx_relaxed_constexpr)) #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR #endif diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index c0c3934afccc57..f8ee5648d35813 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -1016,11 +1016,17 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_fundamental_v // is_scalar +template struct __is_block : false_type {}; +#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) +template struct __is_block<_Rp (^)(_Args...)> : true_type {}; +#endif + template struct _LIBCPP_TEMPLATE_VIS is_scalar : public integral_constant::value || is_member_pointer<_Tp>::value || is_pointer<_Tp>::value || __is_nullptr_t<_Tp>::value || + __is_block<_Tp>::value || is_enum<_Tp>::value > {}; template <> struct _LIBCPP_TEMPLATE_VIS is_scalar : public true_type {}; diff --git a/libcxx/test/libcxx/type_traits/is_scalar.objc.pass.mm b/libcxx/test/libcxx/type_traits/is_scalar.objc.pass.mm new file mode 100644 index 00000000000000..1f7ffec8efda18 --- /dev/null +++ b/libcxx/test/libcxx/type_traits/is_scalar.objc.pass.mm @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: c++98, c++03 + +// + +// std::is_scalar + +// Make sure we report that blocks are scalar types. + +#include +#include + +struct Foo { }; +template struct Arg { }; + +static_assert(std::is_scalar::value, ""); +static_assert(std::is_scalar::value, ""); +static_assert(std::is_scalar)>::value, ""); +static_assert(std::is_scalar, Arg<1>)>::value, ""); +static_assert(std::is_scalar, Arg<1>, Arg<2>)>::value, ""); +static_assert(std::is_scalar::value, ""); +static_assert(std::is_scalar::value, ""); +static_assert(std::is_scalar)>::value, ""); +static_assert(std::is_scalar, Arg<1>)>::value, ""); +static_assert(std::is_scalar, Arg<1>, Arg<2>)>::value, ""); + + +int main(int, char**) { + std::optional)> opt; (void)opt; + return 0; +} diff --git a/libcxx/test/libcxx/utilities/optional/block.objc.pass.mm b/libcxx/test/libcxx/utilities/optional/block.objc.pass.mm new file mode 100644 index 00000000000000..8d2722bf853409 --- /dev/null +++ b/libcxx/test/libcxx/utilities/optional/block.objc.pass.mm @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// This test makes sure that we can create a `std::optional` containing +// an Objective-C++ block. + +#include +#include + +int main(int, char**) +{ + using Block = void (^)(void); + std::optional block; + assert(!block); + + return 0; +} diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt index b38973b0b17945..b584bde8c668ea 100644 --- a/libcxxabi/src/CMakeLists.txt +++ b/libcxxabi/src/CMakeLists.txt @@ -255,7 +255,7 @@ if (LIBCXXABI_ENABLE_STATIC) set(MERGE_ARCHIVES_LIBTOOL "--use-libtool" "--libtool" "${CMAKE_LIBTOOL}") endif() - # Merge the the libc++abi.a and libunwind.a into one. + # Merge the libc++abi.a and libunwind.a into one. if(LIBCXXABI_USE_LLVM_UNWINDER AND LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY) add_custom_command(TARGET cxxabi_static POST_BUILD COMMAND ${PYTHON_EXECUTABLE} ${LIBCXXABI_LIBCXX_PATH}/utils/merge_archives.py diff --git a/libcxxabi/test/test_demangle.pass.cpp b/libcxxabi/test/test_demangle.pass.cpp index a68ec85615e644..edab9ad827e6ce 100644 --- a/libcxxabi/test/test_demangle.pass.cpp +++ b/libcxxabi/test/test_demangle.pass.cpp @@ -30022,7 +30022,7 @@ int main() std::free(demang); break; case 1: - std::cout << "not immplemented\n"; + std::cout << "not implemented\n"; break; } std::cout << '\n'; diff --git a/lld/ELF/Arch/Hexagon.cpp b/lld/ELF/Arch/Hexagon.cpp index 106bc9bab5bd24..51e34910e6cc9a 100644 --- a/lld/ELF/Arch/Hexagon.cpp +++ b/lld/ELF/Arch/Hexagon.cpp @@ -55,6 +55,8 @@ Hexagon::Hexagon() { defaultMaxPageSize = 0x10000; noneRel = R_HEX_NONE; tlsGotRel = R_HEX_TPREL_32; + tlsModuleIndexRel = R_HEX_DTPMOD_32; + tlsOffsetRel = R_HEX_DTPREL_32; } uint32_t Hexagon::calcEFlags() const { @@ -102,6 +104,7 @@ RelExpr Hexagon::getRelExpr(RelType type, const Symbol &s, case R_HEX_32_6_X: case R_HEX_HI16: case R_HEX_LO16: + case R_HEX_DTPREL_32: return R_ABS; case R_HEX_B9_PCREL: case R_HEX_B13_PCREL: @@ -121,6 +124,10 @@ RelExpr Hexagon::getRelExpr(RelType type, const Symbol &s, case R_HEX_IE_HI16: case R_HEX_IE_LO16: return R_GOT; + case R_HEX_GD_GOT_11_X: + case R_HEX_GD_GOT_16_X: + case R_HEX_GD_GOT_32_6_X: + return R_TLSGD_GOTPLT; case R_HEX_GOTREL_11_X: case R_HEX_GOTREL_16_X: case R_HEX_GOTREL_32_6_X: @@ -240,6 +247,7 @@ void Hexagon::relocateOne(uint8_t *loc, RelType type, uint64_t val) const { or32le(loc, applyMask(0x00203fe0, val & 0x3f)); break; case R_HEX_11_X: + case R_HEX_GD_GOT_11_X: case R_HEX_IE_GOT_11_X: case R_HEX_GOT_11_X: case R_HEX_GOTREL_11_X: @@ -252,6 +260,7 @@ void Hexagon::relocateOne(uint8_t *loc, RelType type, uint64_t val) const { case R_HEX_16_X: // These relocs only have 6 effective bits. case R_HEX_IE_16_X: case R_HEX_IE_GOT_16_X: + case R_HEX_GD_GOT_16_X: case R_HEX_GOT_16_X: case R_HEX_GOTREL_16_X: case R_HEX_TPREL_16_X: @@ -262,9 +271,11 @@ void Hexagon::relocateOne(uint8_t *loc, RelType type, uint64_t val) const { break; case R_HEX_32: case R_HEX_32_PCREL: + case R_HEX_DTPREL_32: or32le(loc, val); break; case R_HEX_32_6_X: + case R_HEX_GD_GOT_32_6_X: case R_HEX_GOT_32_6_X: case R_HEX_GOTREL_32_6_X: case R_HEX_IE_GOT_32_6_X: diff --git a/lld/test/ELF/hexagon-tls-gd.s b/lld/test/ELF/hexagon-tls-gd.s new file mode 100644 index 00000000000000..9727518f79c247 --- /dev/null +++ b/lld/test/ELF/hexagon-tls-gd.s @@ -0,0 +1,51 @@ +# REQUIRES: hexagon +# RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %s -o %t.o +# RUN: llvm-readobj -r %t.o | FileCheck -check-prefix=RELOC %s +# RUN: ld.lld %t.o -o %t +# RUN: ld.lld -shared %t.o -o %t.so +# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t | FileCheck %s +# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t.so | FileCheck %s +# RUN: llvm-readobj -x .got %t | FileCheck -check-prefix=GOT %s +# RUN: llvm-readobj -x .got %t.so | FileCheck -check-prefix=GOT-SHARED %s +# RUN: llvm-readobj -x .tdata %t | FileCheck -check-prefix=TDATA %s +# RUN: llvm-readobj -x .tdata %t.so | FileCheck -check-prefix=TDATA %s +# RUN: llvm-readobj -r %t | FileCheck -check-prefix=RELA %s +# RUN: llvm-readobj -r %t.so | FileCheck -check-prefix=RELA-SHARED %s + +.globl _start +.type _start, @function + +_start: +# RELOC: 0x0 R_HEX_GD_GOT_32_6_X a 0x0 +# RELOC-NEXT: 0x4 R_HEX_GD_GOT_16_X a 0x0 +# CHECK: { immext(#0xfffeffc0) +# CHECK-NEXT: r0 = add(r1,##-0x10008) } + r0 = add(r1, ##a@GDGOT) + +# RELOC: 0x8 R_HEX_GD_GOT_32_6_X a 0x0 +# RELOC-NEXT: 0xC R_HEX_GD_GOT_11_X a 0x0 +# CHECK-NEXT: { immext(#0xfffeffc0) +# CHECK-NEXT: r0 = memw(r1+##-0x10008) } + r0 = memw(r1+##a@GDGOT) + +# GOT: Hex dump of section '.got': +# GOT-NEXT: 0x{{[0-9a-f]+}} 01000000 00000000 + +# GOT-SHARED: Hex dump of section '.got': +# GOT-SHARED-NEXT: 0x{{[0-9a-f]+}} 00000000 00000000 + +# TDATA: Hex dump of section '.tdata': +# TDATA-NEXT: 01000000 + +# RELA: Relocations [ +# RELA-NEXT: ] + +# RELA-SHARED: .rela.dyn { +# RELA-SHARED-NEXT: 0x2024C R_HEX_DTPMOD_32 a 0x0 +# RELA-SHARED-NEXT: 0x20250 R_HEX_DTPREL_32 a 0x0 +# RELA-SHARED-NEXT: } + +.section .tdata,"awT",@progbits +.globl a +a: +.word 1 diff --git a/lldb/docs/use/symbols.rst b/lldb/docs/use/symbols.rst index fe79782959a3a8..757d165b9e239c 100644 --- a/lldb/docs/use/symbols.rst +++ b/lldb/docs/use/symbols.rst @@ -267,7 +267,7 @@ contains the DWARF. Whenever DebugSymbols.framework is asked to lookup a dSYM file, it will first look in any file mapped UUID directories for a quick match if the defaults are appropriately set. -For example, if we take the sample UUID plist inforamtion from above, we can +For example, if we take the sample UUID plist information from above, we can create a File Mapped UUID directory cache in **~/Library/SymbolCache/dsyms/uuids**. We can easily see how things are laid out: diff --git a/lldb/docs/use/variable.rst b/lldb/docs/use/variable.rst index 13a56637eceaa6..4e3f25eb6a4a85 100644 --- a/lldb/docs/use/variable.rst +++ b/lldb/docs/use/variable.rst @@ -846,7 +846,7 @@ adheres to a given interface (the word is italicized because Python has no explicit notion of interface, by that word we mean a given set of methods must be implemented by the Python class): -:: +.. code-block:: python class SyntheticChildrenProvider: def __init__(self, valobj, internal_dict): @@ -885,7 +885,28 @@ returning default no-children responses. If a synthetic child provider supplies a special child named ``$$dereference$$`` then it will be used when evaluating ``operator *`` and -``operator ->`` in the frame variable command and related SB API functions. +``operator ->`` in the frame variable command and related SB API +functions. It is possible to declare this synthetic child without +including it in the range of children displayed by LLDB. For example, +this subset of a synthetic children provider class would allow the +synthetic value to be dereferenced without actually showing any +synthtic children in the UI: + +.. code-block:: python + + class SyntheticChildrenProvider: + [...] + def num_children(self): + return 0 + def get_child_index(self, name): + if name == '$$dereference$$': + return 0 + return -1 + def get_child_at_index(self, index): + if index == 0: + return + return None + For examples of how synthetic children are created, you are encouraged to look at examples/synthetic in the LLDB trunk. Please, be aware that the code in diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index 1e9153c401ef19..4396f05c75aac9 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -207,6 +207,8 @@ class TargetProperties : public Properties { bool GetRequireHardwareBreakpoints() const; + bool GetAutoInstallMainExecutable() const; + private: // Callbacks for m_launch_info. void Arg0ValueChangedCallback(); diff --git a/lldb/packages/Python/lldbsuite/test/commands/target/auto-install-main-executable/Makefile b/lldb/packages/Python/lldbsuite/test/commands/target/auto-install-main-executable/Makefile new file mode 100644 index 00000000000000..1354ec49464a82 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/target/auto-install-main-executable/Makefile @@ -0,0 +1,9 @@ +CXX_SOURCES := main.cpp +CXXFLAGS := -DBUILD=\"stock\" + +a.out: a.device.out + +include Makefile.rules + +a.device.out: + $(CXX) $(CXXFLAGS) -DBUILD=\"device\" -o $@ $(SRCDIR)/main.cpp diff --git a/lldb/packages/Python/lldbsuite/test/commands/target/auto-install-main-executable/TestAutoInstallMainExecutable.py b/lldb/packages/Python/lldbsuite/test/commands/target/auto-install-main-executable/TestAutoInstallMainExecutable.py new file mode 100644 index 00000000000000..0169cd494f54fa --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/target/auto-install-main-executable/TestAutoInstallMainExecutable.py @@ -0,0 +1,137 @@ +""" +Test target commands: target.auto-install-main-executable. +""" + +import time +import gdbremote_testcase + +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestAutoInstallMainExecutable(gdbremote_testcase.GdbRemoteTestCaseBase): + mydir = TestBase.compute_mydir(__file__) + + def setUp(self): + super(TestAutoInstallMainExecutable, self).setUp() + self._initial_platform = lldb.DBG.GetSelectedPlatform() + + def tearDown(self): + lldb.DBG.SetSelectedPlatform(self._initial_platform) + super(TestAutoInstallMainExecutable, self).tearDown() + + @llgs_test + @no_debug_info_test + @skipIf(remote=False) + @expectedFailureAll(hostoslist=["windows"], triple='.*-android') + def test_target_auto_install_main_executable(self): + self.build() + self.init_llgs_test(False) + + # Manually install the modified binary. + working_dir = lldb.remote_platform.GetWorkingDirectory() + src_device = lldb.SBFileSpec(self.getBuildArtifact("a.device.out")) + dest = lldb.SBFileSpec(os.path.join(working_dir, "a.out")) + err = lldb.remote_platform.Put(src_device, dest) + if err.Fail(): + raise RuntimeError( + "Unable copy '%s' to '%s'.\n>>> %s" % + (src_device.GetFilename(), working_dir, err.GetCString())) + + m = re.search("^(.*)://([^/]*):(.*)$", configuration.lldb_platform_url) + protocol = m.group(1) + hostname = m.group(2) + hostport = int(m.group(3)) + listen_url = "*:"+str(hostport+1) + + commandline_args = [ + "platform", + "--listen", + listen_url, + "--server" + ] + + self.spawnSubprocess( + self.debug_monitor_exe, + commandline_args, + install_remote=False) + self.addTearDownHook(self.cleanupSubprocesses) + + # Wait for the new process gets ready. + time.sleep(0.1) + + new_debugger = lldb.SBDebugger.Create() + new_debugger.SetAsync(False) + + def del_debugger(new_debugger=new_debugger): + del new_debugger + self.addTearDownHook(del_debugger) + + new_platform = lldb.SBPlatform(lldb.remote_platform.GetName()) + new_debugger.SetSelectedPlatform(new_platform) + new_interpreter = new_debugger.GetCommandInterpreter() + + connect_url = "%s://%s:%s" % (protocol, hostname, str(hostport+1)) + + command = "platform connect %s" % (connect_url) + + result = lldb.SBCommandReturnObject() + + # Test the default setting. + new_interpreter.HandleCommand("settings show target.auto-install-main-executable", result) + self.assertTrue( + result.Succeeded() and + "target.auto-install-main-executable (boolean) = true" in result.GetOutput(), + "Default settings for target.auto-install-main-executable failed.: %s - %s" % + (result.GetOutput(), result.GetError())) + + # Disable the auto install. + new_interpreter.HandleCommand("settings set target.auto-install-main-executable false", result) + new_interpreter.HandleCommand("settings show target.auto-install-main-executable", result) + self.assertTrue( + result.Succeeded() and + "target.auto-install-main-executable (boolean) = false" in result.GetOutput(), + "Default settings for target.auto-install-main-executable failed.: %s - %s" % + (result.GetOutput(), result.GetError())) + + new_interpreter.HandleCommand("platform select %s"%configuration.lldb_platform_name, result) + new_interpreter.HandleCommand(command, result) + + self.assertTrue( + result.Succeeded(), + "platform process connect failed: %s - %s" % + (result.GetOutput(),result.GetError())) + + # Create the target with the original file. + new_interpreter.HandleCommand("target create --remote-file %s %s "% + (os.path.join(working_dir,dest.GetFilename()), self.getBuildArtifact("a.out")), + result) + self.assertTrue( + result.Succeeded(), + "platform create failed: %s - %s" % + (result.GetOutput(),result.GetError())) + + target = new_debugger.GetSelectedTarget() + breakpoint = target.BreakpointCreateByName("main") + + launch_info = lldb.SBLaunchInfo(None) + error = lldb.SBError() + process = target.Launch(launch_info, error) + self.assertTrue(process, PROCESS_IS_VALID) + + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertTrue( + thread.IsValid(), + "There should be a thread stopped due to breakpoint") + + frame = thread.GetFrameAtIndex(0) + self.assertEqual(frame.GetFunction().GetName(), "main") + + new_interpreter.HandleCommand("target variable build", result) + self.assertTrue( + result.Succeeded() and + '"device"' in result.GetOutput(), + "Magic in the binary is wrong: %s " % result.GetOutput()) + + process.Continue() diff --git a/lldb/packages/Python/lldbsuite/test/commands/target/auto-install-main-executable/main.cpp b/lldb/packages/Python/lldbsuite/test/commands/target/auto-install-main-executable/main.cpp new file mode 100644 index 00000000000000..373f1a724e288a --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/commands/target/auto-install-main-executable/main.cpp @@ -0,0 +1,8 @@ +#include + +const char* build = BUILD; + +int main(int argc, char **argv) { + printf("argc: %d\n", argc); + return argv[0][0]; +} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py index 5f908f76b0abc9..9d4759100ce2eb 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py @@ -38,19 +38,9 @@ def setUp(self): def data_formatter_commands(self): """Test using Python synthetic children provider.""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) - - self.runCmd("run", RUN_SUCCEEDED) - - process = self.dbg.GetSelectedTarget().GetProcess() - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs=['stopped', - 'stop reason = breakpoint']) + _, process, thread, _ = lldbutil.run_to_line_breakpoint( + self, lldb.SBFileSpec("main.cpp"), self.line) # This is the function to remove the custom formats in order to have a # clean slate for the next test case. @@ -72,6 +62,7 @@ def cleanup(): # now set up the synth self.runCmd("script from fooSynthProvider import *") self.runCmd("type synth add -l fooSynthProvider foo") + self.runCmd("type synth add -l wrapfooSynthProvider wrapfoo") self.expect("type synthetic list foo", substrs=['fooSynthProvider']) # note that the value of fake_a depends on target byte order @@ -147,6 +138,10 @@ def cleanup(): substrs=['r = 45', 'fake_a = %d' % fake_a_val, 'a = 12']) + self.expect("frame variable --ptr-depth 1 wrapper", + substrs=['r = 45', + 'fake_a = %d' % fake_a_val, + 'a = 12']) # now add a filter.. it should fail self.expect("type filter add foo --child b --child j", error=True, @@ -160,9 +155,24 @@ def cleanup(): substrs=['r = 45', 'fake_a = %d' % fake_a_val, 'a = 12']) + self.expect("frame variable --ptr-depth 1 wrapper", + substrs=['r = 45', + 'fake_a = %d' % fake_a_val, + 'a = 12']) + + # Test that the custom dereference operator for `wrapfoo` works through + # the Python API. The synthetic children provider gets queried at + # slightly different times in this case. + wrapper_var = thread.GetSelectedFrame().FindVariable('wrapper') + foo_var = wrapper_var.Dereference() + self.assertEqual(foo_var.GetNumChildren(), 3) + self.assertEqual(foo_var.GetChildAtIndex(0).GetName(), 'a') + self.assertEqual(foo_var.GetChildAtIndex(1).GetName(), 'fake_a') + self.assertEqual(foo_var.GetChildAtIndex(2).GetName(), 'r') # now delete the synth and add the filter self.runCmd("type synth delete foo") + self.runCmd("type synth delete wrapfoo") self.runCmd("type filter add foo --child b --child j") self.expect('frame variable f00_1', @@ -172,6 +182,10 @@ def cleanup(): substrs=['r = 45', 'fake_a = %d' % fake_a_val, 'a = 12']) + self.expect("frame variable --ptr-depth 1 wrapper", matching=False, + substrs=['r = 45', + 'fake_a = %d' % fake_a_val, + 'a = 12']) # now add the synth and it should fail self.expect("type synth add -l fooSynthProvider foo", error=True, @@ -197,6 +211,10 @@ def cleanup(): substrs=['r = 45', 'fake_a = %d' % fake_a_val, 'a = 12']) + self.expect("frame variable --ptr-depth 1 wrapper", + substrs=['r = 45', + 'fake_a = %d' % fake_a_val, + 'a = 12']) # check the listing self.expect('type synth list', diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/fooSynthProvider.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/fooSynthProvider.py index 45fb00468e083f..6ee749b720b2c4 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/fooSynthProvider.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/fooSynthProvider.py @@ -28,3 +28,29 @@ def get_child_index(self, name): def update(self): return True + + +class wrapfooSynthProvider: + + def __init__(self, valobj, dict): + self.valobj = valobj + + def num_children(self): + return 1 + + def get_child_at_index(self, index): + if index == 0: + return self.valobj.GetChildMemberWithName('ptr') + if index == 1: + return self.valobj.GetChildMemberWithName('ptr').Dereference() + return None + + def get_child_index(self, name): + if name == 'ptr': + return 0 + if name == '$$dereference$$': + return 1 + return -1 + + def update(self): + return True diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp index f45a2abfb9f1ea..5cf4b634592714 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp @@ -46,11 +46,17 @@ struct wrapint wrapint(int X) : x(X) {} }; +struct wrapfoo +{ + foo *ptr; +}; + int main() { foo f00_1(1); foo *f00_ptr = new foo(12); - + wrapfoo wrapper{f00_ptr}; + f00_1.a++; // Set break point at this line. wrapint test_cast('A' + diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile b/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile index c39743d999da3d..f42ac2e81cc76e 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile @@ -5,7 +5,7 @@ all: limit nolimit include Makefile.rules -# Force a.cpp to be built with no debug inforamtion +# Force a.cpp to be built with no debug information a.o: CFLAGS = $(CFLAGS_NO_DEBUG) # The default testsuite setup forces -fno-limit-debug-info. Let's not rely on diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index ecb75413a0c05d..4ae54561a28f30 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -43,9 +43,9 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../ # The test harness invokes the test Makefiles with an explicit 'all' # target, but its handy to be able to recursively call this Makefile -# without speficying a goal. You almost certainly want to build 'all', +# without specifying a goal. You almost certainly want to build 'all', # and not only the first target defined in this file (which might vary -# according to varaible values). +# according to variable values). .DEFAULT_GOAL := all #---------------------------------------------------------------------- diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp index 80f92a8709d5d1..6ae538045ffbf3 100644 --- a/lldb/source/API/SystemInitializerFull.cpp +++ b/lldb/source/API/SystemInitializerFull.cpp @@ -43,7 +43,7 @@ #include "Plugins/Architecture/Arm/ArchitectureArm.h" #include "Plugins/Architecture/Mips/ArchitectureMips.h" #include "Plugins/Architecture/PPC64/ArchitecturePPC64.h" -#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h" +#include "Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h" #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h" #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h" #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h" @@ -54,10 +54,10 @@ #include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h" #include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h" #include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h" -#include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h" -#include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h" -#include "Plugins/InstrumentationRuntime/TSan/TSanRuntime.h" -#include "Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h" +#include "Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h" +#include "Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h" +#include "Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h" +#include "Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h" #include "Plugins/JITLoader/GDB/JITLoaderGDB.h" #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" #include "Plugins/Language/ObjC/ObjCLanguage.h" @@ -222,10 +222,10 @@ llvm::Error SystemInitializerFull::Initialize() { ProcessMachCore::Initialize(); minidump::ProcessMinidump::Initialize(); MemoryHistoryASan::Initialize(); - AddressSanitizerRuntime::Initialize(); - ThreadSanitizerRuntime::Initialize(); - UndefinedBehaviorSanitizerRuntime::Initialize(); - MainThreadCheckerRuntime::Initialize(); + InstrumentationRuntimeASan::Initialize(); + InstrumentationRuntimeTSan::Initialize(); + InstrumentationRuntimeUBSan::Initialize(); + InstrumentationRuntimeMainThreadChecker::Initialize(); SymbolVendorELF::Initialize(); breakpad::SymbolFileBreakpad::Initialize(); @@ -316,10 +316,11 @@ void SystemInitializerFull::Terminate() { ProcessMachCore::Terminate(); minidump::ProcessMinidump::Terminate(); MemoryHistoryASan::Terminate(); - AddressSanitizerRuntime::Terminate(); - ThreadSanitizerRuntime::Terminate(); - UndefinedBehaviorSanitizerRuntime::Terminate(); - MainThreadCheckerRuntime::Terminate(); + InstrumentationRuntimeASan::Terminate(); + InstrumentationRuntimeTSan::Terminate(); + InstrumentationRuntimeUBSan::Terminate(); + InstrumentationRuntimeMainThreadChecker::Terminate(); + wasm::SymbolVendorWasm::Terminate(); SymbolVendorELF::Terminate(); breakpad::SymbolFileBreakpad::Terminate(); diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 1dd9a6cf62c388..1e553596fcfcdb 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -2859,6 +2859,9 @@ ValueObjectSP ValueObject::Dereference(Status &error) { GetSyntheticValue() ->GetChildMemberWithName(ConstString("$$dereference$$"), true) .get(); + } else if (IsSynthetic()) { + m_deref_valobj = + GetChildMemberWithName(ConstString("$$dereference$$"), true).get(); } if (m_deref_valobj) { diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm index 9febb8fb8b2918..233734109c41cd 100644 --- a/lldb/source/Host/macosx/objcxx/Host.mm +++ b/lldb/source/Host/macosx/objcxx/Host.mm @@ -153,33 +153,6 @@ return NULL; } -static bool WaitForProcessToSIGSTOP(const lldb::pid_t pid, - const int timeout_in_seconds) { - const int time_delta_usecs = 100000; - const int num_retries = timeout_in_seconds / time_delta_usecs; - for (int i = 0; i < num_retries; i++) { - struct proc_bsdinfo bsd_info; - int error = ::proc_pidinfo(pid, PROC_PIDTBSDINFO, (uint64_t)0, &bsd_info, - PROC_PIDTBSDINFO_SIZE); - - switch (error) { - case EINVAL: - case ENOTSUP: - case ESRCH: - case EPERM: - return false; - - default: - break; - - case 0: - if (bsd_info.pbi_status == SSTOP) - return true; - } - ::usleep(time_delta_usecs); - } - return false; -} #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__) const char *applscript_in_new_tty = "tell application \"Terminal\"\n" @@ -325,11 +298,6 @@ repeat with the_window in (get windows)\n\ lldb_error = accept_thread->Join(&accept_thread_result); if (lldb_error.Success() && accept_thread_result) { pid = (intptr_t)accept_thread_result; - - // Wait for process to be stopped at the entry point by watching - // for the process status to be set to SSTOP which indicates it it - // SIGSTOP'ed at the entry point - WaitForProcessToSIGSTOP(pid, 5); } llvm::sys::fs::remove(unix_socket_name); diff --git a/lldb/source/Plugins/Disassembler/CMakeLists.txt b/lldb/source/Plugins/Disassembler/CMakeLists.txt index 6e3c904d5a6056..bec56765b60fd7 100644 --- a/lldb/source/Plugins/Disassembler/CMakeLists.txt +++ b/lldb/source/Plugins/Disassembler/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory(llvm) +add_subdirectory(LLVMC) diff --git a/lldb/source/Plugins/Disassembler/llvm/CMakeLists.txt b/lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt similarity index 100% rename from lldb/source/Plugins/Disassembler/llvm/CMakeLists.txt rename to lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp similarity index 100% rename from lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp rename to lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h similarity index 100% rename from lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h rename to lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h diff --git a/lldb/source/Plugins/InstrumentationRuntime/ASan/CMakeLists.txt b/lldb/source/Plugins/InstrumentationRuntime/ASan/CMakeLists.txt index dc7464fd1939fe..0b29027018463f 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/ASan/CMakeLists.txt +++ b/lldb/source/Plugins/InstrumentationRuntime/ASan/CMakeLists.txt @@ -1,5 +1,5 @@ add_lldb_library(lldbPluginInstrumentationRuntimeASan PLUGIN - ASanRuntime.cpp + InstrumentationRuntimeASan.cpp LINK_LIBS lldbBreakpoint diff --git a/lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp similarity index 89% rename from lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp rename to lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp index 2e5dd5989e774a..b84b8a1f4a59b9 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp +++ b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp @@ -1,4 +1,4 @@ -//===-- ASanRuntime.cpp -----------------------------------------*- C++ -*-===// +//===-- InstrumentationRuntimeASan.cpp --------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "ASanRuntime.h" +#include "InstrumentationRuntimeASan.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Core/Debugger.h" @@ -31,39 +31,39 @@ using namespace lldb; using namespace lldb_private; lldb::InstrumentationRuntimeSP -AddressSanitizerRuntime::CreateInstance(const lldb::ProcessSP &process_sp) { - return InstrumentationRuntimeSP(new AddressSanitizerRuntime(process_sp)); +InstrumentationRuntimeASan::CreateInstance(const lldb::ProcessSP &process_sp) { + return InstrumentationRuntimeSP(new InstrumentationRuntimeASan(process_sp)); } -void AddressSanitizerRuntime::Initialize() { +void InstrumentationRuntimeASan::Initialize() { PluginManager::RegisterPlugin( GetPluginNameStatic(), "AddressSanitizer instrumentation runtime plugin.", CreateInstance, GetTypeStatic); } -void AddressSanitizerRuntime::Terminate() { +void InstrumentationRuntimeASan::Terminate() { PluginManager::UnregisterPlugin(CreateInstance); } -lldb_private::ConstString AddressSanitizerRuntime::GetPluginNameStatic() { +lldb_private::ConstString InstrumentationRuntimeASan::GetPluginNameStatic() { return ConstString("AddressSanitizer"); } -lldb::InstrumentationRuntimeType AddressSanitizerRuntime::GetTypeStatic() { +lldb::InstrumentationRuntimeType InstrumentationRuntimeASan::GetTypeStatic() { return eInstrumentationRuntimeTypeAddressSanitizer; } -AddressSanitizerRuntime::~AddressSanitizerRuntime() { Deactivate(); } +InstrumentationRuntimeASan::~InstrumentationRuntimeASan() { Deactivate(); } const RegularExpression & -AddressSanitizerRuntime::GetPatternForRuntimeLibrary() { +InstrumentationRuntimeASan::GetPatternForRuntimeLibrary() { // FIXME: This shouldn't include the "dylib" suffix. static RegularExpression regex( llvm::StringRef("libclang_rt.asan_(.*)_dynamic\\.dylib")); return regex; } -bool AddressSanitizerRuntime::CheckIfRuntimeIsValid( +bool InstrumentationRuntimeASan::CheckIfRuntimeIsValid( const lldb::ModuleSP module_sp) { const Symbol *symbol = module_sp->FindFirstSymbolWithNameAndType( ConstString("__asan_get_alloc_stack"), lldb::eSymbolTypeAny); @@ -108,7 +108,7 @@ t.description = __asan_get_report_description(); t )"; -StructuredData::ObjectSP AddressSanitizerRuntime::RetrieveReportData() { +StructuredData::ObjectSP InstrumentationRuntimeASan::RetrieveReportData() { ProcessSP process_sp = GetProcessSP(); if (!process_sp) return StructuredData::ObjectSP(); @@ -189,7 +189,7 @@ StructuredData::ObjectSP AddressSanitizerRuntime::RetrieveReportData() { } std::string -AddressSanitizerRuntime::FormatDescription(StructuredData::ObjectSP report) { +InstrumentationRuntimeASan::FormatDescription(StructuredData::ObjectSP report) { std::string description = report->GetAsDictionary() ->GetValueForKey("description") ->GetAsString() @@ -235,15 +235,15 @@ AddressSanitizerRuntime::FormatDescription(StructuredData::ObjectSP report) { .Default("AddressSanitizer detected: " + description); } -bool AddressSanitizerRuntime::NotifyBreakpointHit( +bool InstrumentationRuntimeASan::NotifyBreakpointHit( void *baton, StoppointCallbackContext *context, user_id_t break_id, user_id_t break_loc_id) { assert(baton && "null baton"); if (!baton) return false; - AddressSanitizerRuntime *const instance = - static_cast(baton); + InstrumentationRuntimeASan *const instance = + static_cast(baton); ProcessSP process_sp = instance->GetProcessSP(); @@ -275,7 +275,7 @@ bool AddressSanitizerRuntime::NotifyBreakpointHit( return false; // Let target run } -void AddressSanitizerRuntime::Activate() { +void InstrumentationRuntimeASan::Activate() { if (IsActive()) return; @@ -305,7 +305,7 @@ void AddressSanitizerRuntime::Activate() { process_sp->GetTarget() .CreateBreakpoint(symbol_address, internal, hardware) .get(); - breakpoint->SetCallback(AddressSanitizerRuntime::NotifyBreakpointHit, this, + breakpoint->SetCallback(InstrumentationRuntimeASan::NotifyBreakpointHit, this, true); breakpoint->SetBreakpointKind("address-sanitizer-report"); SetBreakpointID(breakpoint->GetID()); @@ -313,7 +313,7 @@ void AddressSanitizerRuntime::Activate() { SetActive(true); } -void AddressSanitizerRuntime::Deactivate() { +void InstrumentationRuntimeASan::Deactivate() { if (GetBreakpointID() != LLDB_INVALID_BREAK_ID) { ProcessSP process_sp = GetProcessSP(); if (process_sp) { diff --git a/lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h similarity index 87% rename from lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h rename to lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h index 0771e624ff6b81..eb7024c9ffc747 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h +++ b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h @@ -1,4 +1,4 @@ -//===-- ASanRuntime.h -------------------------------------------*- C++ -*-===// +//===-- InstrumentationRuntimeASan.h ----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -16,9 +16,9 @@ namespace lldb_private { -class AddressSanitizerRuntime : public lldb_private::InstrumentationRuntime { +class InstrumentationRuntimeASan : public lldb_private::InstrumentationRuntime { public: - ~AddressSanitizerRuntime() override; + ~InstrumentationRuntimeASan() override; static lldb::InstrumentationRuntimeSP CreateInstance(const lldb::ProcessSP &process_sp); @@ -40,7 +40,7 @@ class AddressSanitizerRuntime : public lldb_private::InstrumentationRuntime { uint32_t GetPluginVersion() override { return 1; } private: - AddressSanitizerRuntime(const lldb::ProcessSP &process_sp) + InstrumentationRuntimeASan(const lldb::ProcessSP &process_sp) : lldb_private::InstrumentationRuntime(process_sp) {} const RegularExpression &GetPatternForRuntimeLibrary() override; diff --git a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/CMakeLists.txt b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/CMakeLists.txt index 440b176b270921..8095658452d1f2 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/CMakeLists.txt +++ b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/CMakeLists.txt @@ -1,5 +1,5 @@ add_lldb_library(lldbPluginInstrumentationRuntimeMainThreadChecker PLUGIN - MainThreadCheckerRuntime.cpp + InstrumentationRuntimeMainThreadChecker.cpp LINK_LIBS lldbBreakpoint diff --git a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp similarity index 80% rename from lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp rename to lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp index b73b6c09536834..6f4663b5df0b83 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp +++ b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp @@ -1,4 +1,4 @@ -//===-- MainThreadCheckerRuntime.cpp ----------------------------*- C++ -*-===// +//===-- InstrumentationRuntimeMainThreadChecker.cpp -------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "MainThreadCheckerRuntime.h" +#include "InstrumentationRuntimeMainThreadChecker.h" +#include "Plugins/Process/Utility/HistoryThread.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" @@ -22,47 +23,52 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/RegularExpression.h" -#include "Plugins/Process/Utility/HistoryThread.h" #include using namespace lldb; using namespace lldb_private; -MainThreadCheckerRuntime::~MainThreadCheckerRuntime() { +InstrumentationRuntimeMainThreadChecker:: + ~InstrumentationRuntimeMainThreadChecker() { Deactivate(); } lldb::InstrumentationRuntimeSP -MainThreadCheckerRuntime::CreateInstance(const lldb::ProcessSP &process_sp) { - return InstrumentationRuntimeSP(new MainThreadCheckerRuntime(process_sp)); +InstrumentationRuntimeMainThreadChecker::CreateInstance( + const lldb::ProcessSP &process_sp) { + return InstrumentationRuntimeSP( + new InstrumentationRuntimeMainThreadChecker(process_sp)); } -void MainThreadCheckerRuntime::Initialize() { +void InstrumentationRuntimeMainThreadChecker::Initialize() { PluginManager::RegisterPlugin( - GetPluginNameStatic(), "MainThreadChecker instrumentation runtime plugin.", - CreateInstance, GetTypeStatic); + GetPluginNameStatic(), + "MainThreadChecker instrumentation runtime plugin.", CreateInstance, + GetTypeStatic); } -void MainThreadCheckerRuntime::Terminate() { +void InstrumentationRuntimeMainThreadChecker::Terminate() { PluginManager::UnregisterPlugin(CreateInstance); } -lldb_private::ConstString MainThreadCheckerRuntime::GetPluginNameStatic() { +lldb_private::ConstString +InstrumentationRuntimeMainThreadChecker::GetPluginNameStatic() { return ConstString("MainThreadChecker"); } -lldb::InstrumentationRuntimeType MainThreadCheckerRuntime::GetTypeStatic() { +lldb::InstrumentationRuntimeType +InstrumentationRuntimeMainThreadChecker::GetTypeStatic() { return eInstrumentationRuntimeTypeMainThreadChecker; } const RegularExpression & -MainThreadCheckerRuntime::GetPatternForRuntimeLibrary() { +InstrumentationRuntimeMainThreadChecker::GetPatternForRuntimeLibrary() { static RegularExpression regex(llvm::StringRef("libMainThreadChecker.dylib")); return regex; } -bool MainThreadCheckerRuntime::CheckIfRuntimeIsValid( +bool InstrumentationRuntimeMainThreadChecker::CheckIfRuntimeIsValid( const lldb::ModuleSP module_sp) { static ConstString test_sym("__main_thread_checker_on_report"); const Symbol *symbol = @@ -71,7 +77,8 @@ bool MainThreadCheckerRuntime::CheckIfRuntimeIsValid( } StructuredData::ObjectSP -MainThreadCheckerRuntime::RetrieveReportData(ExecutionContextRef exe_ctx_ref) { +InstrumentationRuntimeMainThreadChecker::RetrieveReportData( + ExecutionContextRef exe_ctx_ref) { ProcessSP process_sp = GetProcessSP(); if (!process_sp) return StructuredData::ObjectSP(); @@ -148,15 +155,15 @@ MainThreadCheckerRuntime::RetrieveReportData(ExecutionContextRef exe_ctx_ref) { return dict_sp; } -bool MainThreadCheckerRuntime::NotifyBreakpointHit( +bool InstrumentationRuntimeMainThreadChecker::NotifyBreakpointHit( void *baton, StoppointCallbackContext *context, user_id_t break_id, user_id_t break_loc_id) { assert(baton && "null baton"); if (!baton) return false; ///< false => resume execution. - MainThreadCheckerRuntime *const instance = - static_cast(baton); + InstrumentationRuntimeMainThreadChecker *const instance = + static_cast(baton); ProcessSP process_sp = instance->GetProcessSP(); ThreadSP thread_sp = context->exe_ctx_ref.GetThreadSP(); @@ -172,9 +179,9 @@ bool MainThreadCheckerRuntime::NotifyBreakpointHit( if (report) { std::string description = report->GetAsDictionary() - ->GetValueForKey("description") - ->GetAsString() - ->GetValue(); + ->GetValueForKey("description") + ->GetAsString() + ->GetValue(); thread_sp->SetStopInfo( InstrumentationRuntimeStopInfo::CreateStopReasonWithInstrumentationData( *thread_sp, description, report)); @@ -184,7 +191,7 @@ bool MainThreadCheckerRuntime::NotifyBreakpointHit( return false; } -void MainThreadCheckerRuntime::Activate() { +void InstrumentationRuntimeMainThreadChecker::Activate() { if (IsActive()) return; @@ -215,15 +222,15 @@ void MainThreadCheckerRuntime::Activate() { .CreateBreakpoint(symbol_address, /*internal=*/true, /*hardware=*/false) .get(); - breakpoint->SetCallback(MainThreadCheckerRuntime::NotifyBreakpointHit, this, - true); + breakpoint->SetCallback( + InstrumentationRuntimeMainThreadChecker::NotifyBreakpointHit, this, true); breakpoint->SetBreakpointKind("main-thread-checker-report"); SetBreakpointID(breakpoint->GetID()); SetActive(true); } -void MainThreadCheckerRuntime::Deactivate() { +void InstrumentationRuntimeMainThreadChecker::Deactivate() { SetActive(false); auto BID = GetBreakpointID(); @@ -237,7 +244,7 @@ void MainThreadCheckerRuntime::Deactivate() { } lldb::ThreadCollectionSP -MainThreadCheckerRuntime::GetBacktracesFromExtendedStopInfo( +InstrumentationRuntimeMainThreadChecker::GetBacktracesFromExtendedStopInfo( StructuredData::ObjectSP info) { ThreadCollectionSP threads; threads = std::make_shared(); @@ -245,7 +252,7 @@ MainThreadCheckerRuntime::GetBacktracesFromExtendedStopInfo( ProcessSP process_sp = GetProcessSP(); if (info->GetObjectForDotSeparatedPath("instrumentation_class") - ->GetStringValue() != "MainThreadChecker") + ->GetStringValue() != "MainThreadChecker") return threads; std::vector PCs; diff --git a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h new file mode 100644 index 00000000000000..290e3a80d8495a --- /dev/null +++ b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h @@ -0,0 +1,68 @@ +//===-- InstrumentationRuntimeMainThreadChecker.h----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_MainThreadCheckerRuntime_h_ +#define liblldb_MainThreadCheckerRuntime_h_ + +#include "lldb/Target/ABI.h" +#include "lldb/Target/InstrumentationRuntime.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-private.h" + +namespace lldb_private { + +class InstrumentationRuntimeMainThreadChecker + : public lldb_private::InstrumentationRuntime { +public: + ~InstrumentationRuntimeMainThreadChecker() override; + + static lldb::InstrumentationRuntimeSP + CreateInstance(const lldb::ProcessSP &process_sp); + + static void Initialize(); + + static void Terminate(); + + static lldb_private::ConstString GetPluginNameStatic(); + + static lldb::InstrumentationRuntimeType GetTypeStatic(); + + lldb_private::ConstString GetPluginName() override { + return GetPluginNameStatic(); + } + + virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); } + + uint32_t GetPluginVersion() override { return 1; } + + lldb::ThreadCollectionSP + GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override; + +private: + InstrumentationRuntimeMainThreadChecker(const lldb::ProcessSP &process_sp) + : lldb_private::InstrumentationRuntime(process_sp) {} + + const RegularExpression &GetPatternForRuntimeLibrary() override; + + bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override; + + void Activate() override; + + void Deactivate(); + + static bool NotifyBreakpointHit(void *baton, + StoppointCallbackContext *context, + lldb::user_id_t break_id, + lldb::user_id_t break_loc_id); + + StructuredData::ObjectSP RetrieveReportData(ExecutionContextRef exe_ctx_ref); +}; + +} // namespace lldb_private + +#endif // liblldb_MainThreadCheckerRuntime_h_ diff --git a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h b/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h deleted file mode 100644 index 1dcbc0f6bc89aa..00000000000000 --- a/lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h +++ /dev/null @@ -1,67 +0,0 @@ -//===-- MainThreadCheckerRuntime.h ------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_MainThreadCheckerRuntime_h_ -#define liblldb_MainThreadCheckerRuntime_h_ - -#include "lldb/Target/ABI.h" -#include "lldb/Target/InstrumentationRuntime.h" -#include "lldb/Utility/StructuredData.h" -#include "lldb/lldb-private.h" - -namespace lldb_private { - - class MainThreadCheckerRuntime : public lldb_private::InstrumentationRuntime { - public: - ~MainThreadCheckerRuntime() override; - - static lldb::InstrumentationRuntimeSP - CreateInstance(const lldb::ProcessSP &process_sp); - - static void Initialize(); - - static void Terminate(); - - static lldb_private::ConstString GetPluginNameStatic(); - - static lldb::InstrumentationRuntimeType GetTypeStatic(); - - lldb_private::ConstString GetPluginName() override { - return GetPluginNameStatic(); - } - - virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); } - - uint32_t GetPluginVersion() override { return 1; } - - lldb::ThreadCollectionSP - GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override; - - private: - MainThreadCheckerRuntime(const lldb::ProcessSP &process_sp) - : lldb_private::InstrumentationRuntime(process_sp) {} - - const RegularExpression &GetPatternForRuntimeLibrary() override; - - bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override; - - void Activate() override; - - void Deactivate(); - - static bool NotifyBreakpointHit(void *baton, - StoppointCallbackContext *context, - lldb::user_id_t break_id, - lldb::user_id_t break_loc_id); - - StructuredData::ObjectSP RetrieveReportData(ExecutionContextRef exe_ctx_ref); - }; - -} // namespace lldb_private - -#endif // liblldb_MainThreadCheckerRuntime_h_ diff --git a/lldb/source/Plugins/InstrumentationRuntime/TSan/CMakeLists.txt b/lldb/source/Plugins/InstrumentationRuntime/TSan/CMakeLists.txt index 4dcd34131b8eb3..a388cbb2ddfeac 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/TSan/CMakeLists.txt +++ b/lldb/source/Plugins/InstrumentationRuntime/TSan/CMakeLists.txt @@ -1,5 +1,5 @@ add_lldb_library(lldbPluginInstrumentationRuntimeTSan PLUGIN - TSanRuntime.cpp + InstrumentationRuntimeTSan.cpp LINK_LIBS lldbBreakpoint diff --git a/lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp similarity index 95% rename from lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp rename to lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp index 45a3aeeb204ef3..699876690fae00 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp +++ b/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp @@ -1,4 +1,4 @@ -//===-- TSanRuntime.cpp -----------------------------------------*- C++ -*-===// +//===-- InstrumentationRuntimeTSan.cpp --------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "TSanRuntime.h" +#include "InstrumentationRuntimeTSan.h" #include "Plugins/Process/Utility/HistoryThread.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" @@ -36,29 +36,29 @@ using namespace lldb; using namespace lldb_private; lldb::InstrumentationRuntimeSP -ThreadSanitizerRuntime::CreateInstance(const lldb::ProcessSP &process_sp) { - return InstrumentationRuntimeSP(new ThreadSanitizerRuntime(process_sp)); +InstrumentationRuntimeTSan::CreateInstance(const lldb::ProcessSP &process_sp) { + return InstrumentationRuntimeSP(new InstrumentationRuntimeTSan(process_sp)); } -void ThreadSanitizerRuntime::Initialize() { +void InstrumentationRuntimeTSan::Initialize() { PluginManager::RegisterPlugin( GetPluginNameStatic(), "ThreadSanitizer instrumentation runtime plugin.", CreateInstance, GetTypeStatic); } -void ThreadSanitizerRuntime::Terminate() { +void InstrumentationRuntimeTSan::Terminate() { PluginManager::UnregisterPlugin(CreateInstance); } -lldb_private::ConstString ThreadSanitizerRuntime::GetPluginNameStatic() { +lldb_private::ConstString InstrumentationRuntimeTSan::GetPluginNameStatic() { return ConstString("ThreadSanitizer"); } -lldb::InstrumentationRuntimeType ThreadSanitizerRuntime::GetTypeStatic() { +lldb::InstrumentationRuntimeType InstrumentationRuntimeTSan::GetTypeStatic() { return eInstrumentationRuntimeTypeThreadSanitizer; } -ThreadSanitizerRuntime::~ThreadSanitizerRuntime() { Deactivate(); } +InstrumentationRuntimeTSan::~InstrumentationRuntimeTSan() { Deactivate(); } const char *thread_sanitizer_retrieve_report_data_prefix = R"( extern "C" @@ -84,7 +84,7 @@ extern "C" int *running, const char **name, int *parent_tid, void **trace, unsigned long trace_size); int __tsan_get_report_unique_tid(void *report, unsigned long idx, int *tid); - + // TODO: dlsym won't work on Windows. void *dlsym(void* handle, const char* symbol); int (*ptr__tsan_get_report_loc_object_type)(void *report, unsigned long idx, const char **object_type); @@ -97,15 +97,15 @@ struct data { void *report; const char *description; int report_count; - + void *sleep_trace[REPORT_TRACE_SIZE]; - + int stack_count; struct { int idx; void *trace[REPORT_TRACE_SIZE]; } stacks[REPORT_ARRAY_SIZE]; - + int mop_count; struct { int idx; @@ -116,7 +116,7 @@ struct data { void *addr; void *trace[REPORT_TRACE_SIZE]; } mops[REPORT_ARRAY_SIZE]; - + int loc_count; struct { int idx; @@ -130,7 +130,7 @@ struct data { void *trace[REPORT_TRACE_SIZE]; const char *object_type; } locs[REPORT_ARRAY_SIZE]; - + int mutex_count; struct { int idx; @@ -139,7 +139,7 @@ struct data { int destroyed; void *trace[REPORT_TRACE_SIZE]; } mutexes[REPORT_ARRAY_SIZE]; - + int thread_count; struct { int idx; @@ -150,7 +150,7 @@ struct data { int parent_tid; void *trace[REPORT_TRACE_SIZE]; } threads[REPORT_ARRAY_SIZE]; - + int unique_tid_count; struct { int idx; @@ -299,8 +299,8 @@ static user_id_t Renumber(uint64_t id, return IT->second; } -StructuredData::ObjectSP -ThreadSanitizerRuntime::RetrieveReportData(ExecutionContextRef exe_ctx_ref) { +StructuredData::ObjectSP InstrumentationRuntimeTSan::RetrieveReportData( + ExecutionContextRef exe_ctx_ref) { ProcessSP process_sp = GetProcessSP(); if (!process_sp) return StructuredData::ObjectSP(); @@ -486,7 +486,7 @@ ThreadSanitizerRuntime::RetrieveReportData(ExecutionContextRef exe_ctx_ref) { } std::string -ThreadSanitizerRuntime::FormatDescription(StructuredData::ObjectSP report) { +InstrumentationRuntimeTSan::FormatDescription(StructuredData::ObjectSP report) { std::string description = report->GetAsDictionary() ->GetValueForKey("issue_type") ->GetAsString() @@ -580,7 +580,7 @@ static void GetSymbolDeclarationFromAddress(ProcessSP process_sp, addr_t addr, decl = var->GetDeclaration(); } -addr_t ThreadSanitizerRuntime::GetFirstNonInternalFramePc( +addr_t InstrumentationRuntimeTSan::GetFirstNonInternalFramePc( StructuredData::ObjectSP trace, bool skip_one_frame) { ProcessSP process_sp = GetProcessSP(); ModuleSP runtime_module_sp = GetRuntimeModuleSP(); @@ -609,7 +609,7 @@ addr_t ThreadSanitizerRuntime::GetFirstNonInternalFramePc( } std::string -ThreadSanitizerRuntime::GenerateSummary(StructuredData::ObjectSP report) { +InstrumentationRuntimeTSan::GenerateSummary(StructuredData::ObjectSP report) { ProcessSP process_sp = GetProcessSP(); std::string summary = report->GetAsDictionary() @@ -695,8 +695,8 @@ ThreadSanitizerRuntime::GenerateSummary(StructuredData::ObjectSP report) { return summary; } -addr_t -ThreadSanitizerRuntime::GetMainRacyAddress(StructuredData::ObjectSP report) { +addr_t InstrumentationRuntimeTSan::GetMainRacyAddress( + StructuredData::ObjectSP report) { addr_t result = (addr_t)-1; report->GetObjectForDotSeparatedPath("mops")->GetAsArray()->ForEach( @@ -711,7 +711,7 @@ ThreadSanitizerRuntime::GetMainRacyAddress(StructuredData::ObjectSP report) { return (result == (addr_t)-1) ? 0 : result; } -std::string ThreadSanitizerRuntime::GetLocationDescription( +std::string InstrumentationRuntimeTSan::GetLocationDescription( StructuredData::ObjectSP report, addr_t &global_addr, std::string &global_name, std::string &filename, uint32_t &line) { std::string result = ""; @@ -791,15 +791,15 @@ std::string ThreadSanitizerRuntime::GetLocationDescription( return result; } -bool ThreadSanitizerRuntime::NotifyBreakpointHit( +bool InstrumentationRuntimeTSan::NotifyBreakpointHit( void *baton, StoppointCallbackContext *context, user_id_t break_id, user_id_t break_loc_id) { assert(baton && "null baton"); if (!baton) return false; - ThreadSanitizerRuntime *const instance = - static_cast(baton); + InstrumentationRuntimeTSan *const instance = + static_cast(baton); ProcessSP process_sp = instance->GetProcessSP(); @@ -873,12 +873,13 @@ bool ThreadSanitizerRuntime::NotifyBreakpointHit( return false; // Let target run } -const RegularExpression &ThreadSanitizerRuntime::GetPatternForRuntimeLibrary() { +const RegularExpression & +InstrumentationRuntimeTSan::GetPatternForRuntimeLibrary() { static RegularExpression regex(llvm::StringRef("libclang_rt.tsan_")); return regex; } -bool ThreadSanitizerRuntime::CheckIfRuntimeIsValid( +bool InstrumentationRuntimeTSan::CheckIfRuntimeIsValid( const lldb::ModuleSP module_sp) { static ConstString g_tsan_get_current_report("__tsan_get_current_report"); const Symbol *symbol = module_sp->FindFirstSymbolWithNameAndType( @@ -886,7 +887,7 @@ bool ThreadSanitizerRuntime::CheckIfRuntimeIsValid( return symbol != nullptr; } -void ThreadSanitizerRuntime::Activate() { +void InstrumentationRuntimeTSan::Activate() { if (IsActive()) return; @@ -916,7 +917,7 @@ void ThreadSanitizerRuntime::Activate() { process_sp->GetTarget() .CreateBreakpoint(symbol_address, internal, hardware) .get(); - breakpoint->SetCallback(ThreadSanitizerRuntime::NotifyBreakpointHit, this, + breakpoint->SetCallback(InstrumentationRuntimeTSan::NotifyBreakpointHit, this, true); breakpoint->SetBreakpointKind("thread-sanitizer-report"); SetBreakpointID(breakpoint->GetID()); @@ -924,7 +925,7 @@ void ThreadSanitizerRuntime::Activate() { SetActive(true); } -void ThreadSanitizerRuntime::Deactivate() { +void InstrumentationRuntimeTSan::Deactivate() { if (GetBreakpointID() != LLDB_INVALID_BREAK_ID) { ProcessSP process_sp = GetProcessSP(); if (process_sp) { @@ -1043,7 +1044,7 @@ static void AddThreadsForPath(const std::string &path, } lldb::ThreadCollectionSP -ThreadSanitizerRuntime::GetBacktracesFromExtendedStopInfo( +InstrumentationRuntimeTSan::GetBacktracesFromExtendedStopInfo( StructuredData::ObjectSP info) { ThreadCollectionSP threads; threads = std::make_shared(); diff --git a/lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h b/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h similarity index 90% rename from lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h rename to lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h index db8bb1db79960f..7f2e142b79bf9c 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h +++ b/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h @@ -1,4 +1,4 @@ -//===-- TSanRuntime.h -------------------------------------------*- C++ -*-===// +//===-- InstrumentationRuntimeTSan.h ----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -16,9 +16,9 @@ namespace lldb_private { -class ThreadSanitizerRuntime : public lldb_private::InstrumentationRuntime { +class InstrumentationRuntimeTSan : public lldb_private::InstrumentationRuntime { public: - ~ThreadSanitizerRuntime() override; + ~InstrumentationRuntimeTSan() override; static lldb::InstrumentationRuntimeSP CreateInstance(const lldb::ProcessSP &process_sp); @@ -43,7 +43,7 @@ class ThreadSanitizerRuntime : public lldb_private::InstrumentationRuntime { GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override; private: - ThreadSanitizerRuntime(const lldb::ProcessSP &process_sp) + InstrumentationRuntimeTSan(const lldb::ProcessSP &process_sp) : lldb_private::InstrumentationRuntime(process_sp) {} const RegularExpression &GetPatternForRuntimeLibrary() override; diff --git a/lldb/source/Plugins/InstrumentationRuntime/UBSan/CMakeLists.txt b/lldb/source/Plugins/InstrumentationRuntime/UBSan/CMakeLists.txt index 984bf86f83b5cd..12e1956bbe88ee 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/UBSan/CMakeLists.txt +++ b/lldb/source/Plugins/InstrumentationRuntime/UBSan/CMakeLists.txt @@ -1,5 +1,5 @@ add_lldb_library(lldbPluginInstrumentationRuntimeUBSan PLUGIN - UBSanRuntime.cpp + InstrumentationRuntimeUBSan.cpp LINK_LIBS lldbBreakpoint diff --git a/lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp similarity index 87% rename from lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp rename to lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp index 137ecab224bc4e..a85fddf6720ab7 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp +++ b/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp @@ -1,4 +1,4 @@ -//===-- UBSanRuntime.cpp ----------------------------------------*- C++ -*-===// +//===-- InstrumentationRuntimeUBSan.cpp -------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "UBSanRuntime.h" +#include "InstrumentationRuntimeUBSan.h" #include "Plugins/Process/Utility/HistoryThread.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" @@ -36,35 +36,29 @@ using namespace lldb; using namespace lldb_private; -UndefinedBehaviorSanitizerRuntime::~UndefinedBehaviorSanitizerRuntime() { - Deactivate(); -} +InstrumentationRuntimeUBSan::~InstrumentationRuntimeUBSan() { Deactivate(); } lldb::InstrumentationRuntimeSP -UndefinedBehaviorSanitizerRuntime::CreateInstance( - const lldb::ProcessSP &process_sp) { - return InstrumentationRuntimeSP( - new UndefinedBehaviorSanitizerRuntime(process_sp)); +InstrumentationRuntimeUBSan::CreateInstance(const lldb::ProcessSP &process_sp) { + return InstrumentationRuntimeSP(new InstrumentationRuntimeUBSan(process_sp)); } -void UndefinedBehaviorSanitizerRuntime::Initialize() { +void InstrumentationRuntimeUBSan::Initialize() { PluginManager::RegisterPlugin( GetPluginNameStatic(), "UndefinedBehaviorSanitizer instrumentation runtime plugin.", CreateInstance, GetTypeStatic); } -void UndefinedBehaviorSanitizerRuntime::Terminate() { +void InstrumentationRuntimeUBSan::Terminate() { PluginManager::UnregisterPlugin(CreateInstance); } -lldb_private::ConstString -UndefinedBehaviorSanitizerRuntime::GetPluginNameStatic() { +lldb_private::ConstString InstrumentationRuntimeUBSan::GetPluginNameStatic() { return ConstString("UndefinedBehaviorSanitizer"); } -lldb::InstrumentationRuntimeType -UndefinedBehaviorSanitizerRuntime::GetTypeStatic() { +lldb::InstrumentationRuntimeType InstrumentationRuntimeUBSan::GetTypeStatic() { return eInstrumentationRuntimeTypeUndefinedBehaviorSanitizer; } @@ -110,7 +104,7 @@ static std::string RetrieveString(ValueObjectSP return_value_sp, return str; } -StructuredData::ObjectSP UndefinedBehaviorSanitizerRuntime::RetrieveReportData( +StructuredData::ObjectSP InstrumentationRuntimeUBSan::RetrieveReportData( ExecutionContextRef exe_ctx_ref) { ProcessSP process_sp = GetProcessSP(); if (!process_sp) @@ -187,8 +181,8 @@ StructuredData::ObjectSP UndefinedBehaviorSanitizerRuntime::RetrieveReportData( static std::string GetStopReasonDescription(StructuredData::ObjectSP report) { llvm::StringRef stop_reason_description_ref; - report->GetAsDictionary()->GetValueForKeyAsString("description", - stop_reason_description_ref); + report->GetAsDictionary()->GetValueForKeyAsString( + "description", stop_reason_description_ref); std::string stop_reason_description = stop_reason_description_ref; if (!stop_reason_description.size()) { @@ -202,15 +196,15 @@ static std::string GetStopReasonDescription(StructuredData::ObjectSP report) { return stop_reason_description; } -bool UndefinedBehaviorSanitizerRuntime::NotifyBreakpointHit( +bool InstrumentationRuntimeUBSan::NotifyBreakpointHit( void *baton, StoppointCallbackContext *context, user_id_t break_id, user_id_t break_loc_id) { assert(baton && "null baton"); if (!baton) return false; ///< false => resume execution. - UndefinedBehaviorSanitizerRuntime *const instance = - static_cast(baton); + InstrumentationRuntimeUBSan *const instance = + static_cast(baton); ProcessSP process_sp = instance->GetProcessSP(); ThreadSP thread_sp = context->exe_ctx_ref.GetThreadSP(); @@ -235,12 +229,12 @@ bool UndefinedBehaviorSanitizerRuntime::NotifyBreakpointHit( } const RegularExpression & -UndefinedBehaviorSanitizerRuntime::GetPatternForRuntimeLibrary() { +InstrumentationRuntimeUBSan::GetPatternForRuntimeLibrary() { static RegularExpression regex(llvm::StringRef("libclang_rt\\.(a|t|ub)san_")); return regex; } -bool UndefinedBehaviorSanitizerRuntime::CheckIfRuntimeIsValid( +bool InstrumentationRuntimeUBSan::CheckIfRuntimeIsValid( const lldb::ModuleSP module_sp) { static ConstString ubsan_test_sym("__ubsan_on_report"); const Symbol *symbol = module_sp->FindFirstSymbolWithNameAndType( @@ -249,7 +243,7 @@ bool UndefinedBehaviorSanitizerRuntime::CheckIfRuntimeIsValid( } // FIXME: Factor out all the logic we have in common with the {a,t}san plugins. -void UndefinedBehaviorSanitizerRuntime::Activate() { +void InstrumentationRuntimeUBSan::Activate() { if (IsActive()) return; @@ -280,15 +274,15 @@ void UndefinedBehaviorSanitizerRuntime::Activate() { .CreateBreakpoint(symbol_address, /*internal=*/true, /*hardware=*/false) .get(); - breakpoint->SetCallback( - UndefinedBehaviorSanitizerRuntime::NotifyBreakpointHit, this, true); + breakpoint->SetCallback(InstrumentationRuntimeUBSan::NotifyBreakpointHit, + this, true); breakpoint->SetBreakpointKind("undefined-behavior-sanitizer-report"); SetBreakpointID(breakpoint->GetID()); SetActive(true); } -void UndefinedBehaviorSanitizerRuntime::Deactivate() { +void InstrumentationRuntimeUBSan::Deactivate() { SetActive(false); auto BID = GetBreakpointID(); @@ -302,7 +296,7 @@ void UndefinedBehaviorSanitizerRuntime::Deactivate() { } lldb::ThreadCollectionSP -UndefinedBehaviorSanitizerRuntime::GetBacktracesFromExtendedStopInfo( +InstrumentationRuntimeUBSan::GetBacktracesFromExtendedStopInfo( StructuredData::ObjectSP info) { ThreadCollectionSP threads; threads = std::make_shared(); diff --git a/lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h b/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h similarity index 89% rename from lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h rename to lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h index 1d854b7bf06f6d..8345bf2ff3d4af 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h +++ b/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h @@ -1,4 +1,4 @@ -//===-- UBSanRuntime.h ------------------------------------------*- C++ -*-===// +//===-- InstrumentationRuntimeUBSan.h ---------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -16,10 +16,10 @@ namespace lldb_private { -class UndefinedBehaviorSanitizerRuntime +class InstrumentationRuntimeUBSan : public lldb_private::InstrumentationRuntime { public: - ~UndefinedBehaviorSanitizerRuntime() override; + ~InstrumentationRuntimeUBSan() override; static lldb::InstrumentationRuntimeSP CreateInstance(const lldb::ProcessSP &process_sp); @@ -44,7 +44,7 @@ class UndefinedBehaviorSanitizerRuntime GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override; private: - UndefinedBehaviorSanitizerRuntime(const lldb::ProcessSP &process_sp) + InstrumentationRuntimeUBSan(const lldb::ProcessSP &process_sp) : lldb_private::InstrumentationRuntime(process_sp) {} const RegularExpression &GetPatternForRuntimeLibrary() override; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index 081fed2322dbae..745918f255abc6 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "PlatformMacOSX.h" +#if defined(__APPLE__) #include "PlatformAppleTVSimulator.h" #include "PlatformAppleWatchSimulator.h" #include "PlatformDarwinKernel.h" @@ -14,6 +15,7 @@ #include "PlatformRemoteAppleTV.h" #include "PlatformRemoteAppleWatch.h" #include "PlatformiOSSimulator.h" +#endif #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleList.h" @@ -40,6 +42,7 @@ static uint32_t g_initialize_count = 0; void PlatformMacOSX::Initialize() { PlatformDarwin::Initialize(); +#if defined(__APPLE__) PlatformiOSSimulator::Initialize(); PlatformDarwinKernel::Initialize(); PlatformAppleTVSimulator::Initialize(); @@ -47,6 +50,7 @@ void PlatformMacOSX::Initialize() { PlatformRemoteAppleTV::Initialize(); PlatformRemoteAppleWatch::Initialize(); PlatformRemoteAppleBridge::Initialize(); +#endif if (g_initialize_count++ == 0) { #if defined(__APPLE__) @@ -67,6 +71,7 @@ void PlatformMacOSX::Terminate() { } } +#if defined(__APPLE__) PlatformRemoteAppleBridge::Terminate(); PlatformRemoteAppleWatch::Terminate(); PlatformRemoteAppleTV::Terminate(); @@ -74,6 +79,7 @@ void PlatformMacOSX::Terminate() { PlatformAppleTVSimulator::Terminate(); PlatformDarwinKernel::Terminate(); PlatformiOSSimulator::Terminate(); +#endif PlatformDarwin::Terminate(); } diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp index 7bef47e8eaee11..f7f0b404eae8d7 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -1225,7 +1225,7 @@ void SymbolFilePDB::CacheFunctionNames() { // To search a method name, like NS::Class:MemberFunc, LLDB searches // its base name, i.e. MemberFunc by default. Since PDBSymbolFunc does - // not have inforamtion of this, we extract base names and cache them + // not have information of this, we extract base names and cache them // by our own effort. llvm::StringRef basename = MSVCUndecoratedNameParser::DropScope(name); if (!basename.empty()) diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 1b691e1332b6d0..9ac244ca027fa6 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -2691,8 +2691,10 @@ Status Target::Install(ProcessLaunchInfo *launch_info) { if (platform_sp) { if (platform_sp->IsRemote()) { if (platform_sp->IsConnected()) { - // Install all files that have an install path, and always install the - // main executable when connected to a remote platform + // Install all files that have an install path when connected to a + // remote platform. If target.auto-install-main-executable is set then + // also install the main executable even if it does not have an explicit + // install path specified. const ModuleList &modules = GetImages(); const size_t num_images = modules.GetSize(); for (size_t idx = 0; idx < num_images; ++idx) { @@ -2703,10 +2705,8 @@ Status Target::Install(ProcessLaunchInfo *launch_info) { if (local_file) { FileSpec remote_file(module_sp->GetRemoteInstallFileSpec()); if (!remote_file) { - if (is_main_executable) // TODO: add setting for always - // installing main executable??? - { - // Always install the main executable + if (is_main_executable && GetAutoInstallMainExecutable()) { + // Automatically install the main executable. remote_file = platform_sp->GetRemoteWorkingDirectory(); remote_file.AppendPathComponent( module_sp->GetFileSpec().GetFilename().GetCString()); @@ -3970,6 +3970,12 @@ void TargetProperties::SetRequireHardwareBreakpoints(bool b) { m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b); } +bool TargetProperties::GetAutoInstallMainExecutable() const { + const uint32_t idx = ePropertyAutoInstallMainExecutable; + return m_collection_sp->GetPropertyAtIndexAsBoolean( + nullptr, idx, g_target_properties[idx].default_uint_value != 0); +} + void TargetProperties::Arg0ValueChangedCallback() { m_launch_info.SetArg0(GetArg0()); } diff --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td index ff8062aaa2cb3f..ce08e44acb9bf7 100644 --- a/lldb/source/Target/TargetProperties.td +++ b/lldb/source/Target/TargetProperties.td @@ -154,6 +154,9 @@ let Definition = "target" in { def RequireHardwareBreakpoints: Property<"require-hardware-breakpoint", "Boolean">, DefaultFalse, Desc<"Require all breakpoints to be hardware breakpoints.">; + def AutoInstallMainExecutable: Property<"auto-install-main-executable", "Boolean">, + DefaultTrue, + Desc<"Always install the main executable when connected to a remote platform.">; } let Definition = "process" in { diff --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt index 0fe88337ba5840..9aad9fc750cae1 100644 --- a/lldb/test/API/CMakeLists.txt +++ b/lldb/test/API/CMakeLists.txt @@ -179,3 +179,11 @@ configure_lit_site_cfg( ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py MAIN_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py) + +if (CMAKE_GENERATOR STREQUAL "Xcode") + # Xcode does not get the auto-generated targets. We need to create + # check-lldb-api manually. + add_lit_testsuite(check-lldb-api "Running lldb api test suite" + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS lldb-test-deps) +endif() diff --git a/lldb/test/Shell/CMakeLists.txt b/lldb/test/Shell/CMakeLists.txt index 91b4e282204b4d..d203f1e093c74c 100644 --- a/lldb/test/Shell/CMakeLists.txt +++ b/lldb/test/Shell/CMakeLists.txt @@ -7,3 +7,11 @@ configure_lit_site_cfg( configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/lit-lldb-init.in ${CMAKE_CURRENT_BINARY_DIR}/lit-lldb-init) + +if (CMAKE_GENERATOR STREQUAL "Xcode") + # Xcode does not get the auto-generated targets. We need to create + # check-lldb-shell manually. + add_lit_testsuite(check-lldb-shell "Running lldb shell test suite" + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS lldb-test-deps) +endif() diff --git a/lldb/tools/darwin-debug/CMakeLists.txt b/lldb/tools/darwin-debug/CMakeLists.txt index b902788f05ab28..ab3dbf0060ab72 100644 --- a/lldb/tools/darwin-debug/CMakeLists.txt +++ b/lldb/tools/darwin-debug/CMakeLists.txt @@ -1,3 +1,11 @@ + +# Create an LC_SEGMENT with the special name ExecExtraSuspend which +# debugserver can detect - it tells debugserver that it will exec a +# process and that process will start suspended, so debugserver will +# need to double-resume it to make it run. A random file is copied +# into the segment. +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-sectcreate,ExecExtraSuspend,ExecExtraSuspend,${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt") + add_lldb_tool(darwin-debug ADD_TO_FRAMEWORK darwin-debug.cpp ) diff --git a/lldb/tools/debugserver/source/DNBArch.h b/lldb/tools/debugserver/source/DNBArch.h index b5e2e25ef47e61..03b6b60ed86de2 100644 --- a/lldb/tools/debugserver/source/DNBArch.h +++ b/lldb/tools/debugserver/source/DNBArch.h @@ -120,7 +120,6 @@ class DNBArchProtocol { #include "MacOSX/arm/DNBArchImpl.h" #include "MacOSX/arm64/DNBArchImplARM64.h" #include "MacOSX/i386/DNBArchImplI386.h" -#include "MacOSX/ppc/DNBArchImpl.h" #include "MacOSX/x86_64/DNBArchImplX86_64.h" #endif diff --git a/lldb/tools/debugserver/source/DNBDefs.h b/lldb/tools/debugserver/source/DNBDefs.h index 22cfce1757f7fa..2136eb6d5c44d8 100644 --- a/lldb/tools/debugserver/source/DNBDefs.h +++ b/lldb/tools/debugserver/source/DNBDefs.h @@ -20,15 +20,13 @@ #include // Define nub_addr_t and the invalid address value from the architecture -#if defined(__x86_64__) || defined(__ppc64__) || defined(__arm64__) || \ - defined(__aarch64__) +#if defined(__x86_64__) || defined(__arm64__) || defined(__aarch64__) // 64 bit address architectures typedef uint64_t nub_addr_t; #define INVALID_NUB_ADDRESS ((nub_addr_t)~0ull) -#elif defined(__i386__) || defined(__powerpc__) || defined(__ppc__) || \ - defined(__arm__) +#elif defined(__i386__) || defined(__powerpc__) || defined(__arm__) // 32 bit address architectures diff --git a/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt b/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt index 73ba6492a0ef57..001f861d271848 100644 --- a/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt +++ b/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt @@ -26,11 +26,6 @@ if(NOT LLDB_DEBUGSERVER_ARCH OR "${LLDB_DEBUGSERVER_ARCH}" MATCHES ".*86.*") include_directories(${CURRENT_SOURCE_DIR}/i386 ${CURRENT_SOURCE_DIR}/x86_64) endif() -if("${LLDB_DEBUGSERVER_ARCH}" MATCHES ".*ppc.*") - list(APPEND SOURCES ppc/DNBArchImpl.cpp) - include_directories(${CURRENT_SOURCE_DIR}/ppc) -endif() - add_subdirectory(DarwinLog) include_directories(..) diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm index 40facdfb5cf9ba..e4ec6129f70c58 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm +++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm @@ -734,6 +734,8 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options, this_seg.nsects = seg.nsects; this_seg.flags = seg.flags; inf.segments.push_back(this_seg); + if (this_seg.name == "ExecExtraSuspend") + m_task.TaskWillExecProcessesSuspended(); } if (lc.cmd == LC_SEGMENT_64) { struct segment_command_64 seg; @@ -755,6 +757,8 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options, this_seg.nsects = seg.nsects; this_seg.flags = seg.flags; inf.segments.push_back(this_seg); + if (this_seg.name == "ExecExtraSuspend") + m_task.TaskWillExecProcessesSuspended(); } if (lc.cmd == LC_UUID) { struct uuid_command uuidcmd; diff --git a/lldb/tools/debugserver/source/MacOSX/MachTask.h b/lldb/tools/debugserver/source/MacOSX/MachTask.h index c975e15a55518f..62f90729393c88 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachTask.h +++ b/lldb/tools/debugserver/source/MacOSX/MachTask.h @@ -85,6 +85,7 @@ class MachTask { const MachProcess *Process() const { return m_process; } nub_size_t PageSize(); + void TaskWillExecProcessesSuspended() { m_exec_will_be_suspended = true; } protected: MachProcess *m_process; // The mach process that owns this MachTask @@ -97,6 +98,12 @@ class MachTask { // need it mach_port_t m_exception_port; // Exception port on which we will receive child // exceptions + bool m_exec_will_be_suspended; // If this task exec's another process, that + // process will be launched suspended and we will + // need to execute one extra Resume to get it + // to progress from dyld_start. + bool m_do_double_resume; // next time we task_resume(), do it twice to + // fix a too-high suspend count. typedef std::map allocation_collection; allocation_collection m_allocations; diff --git a/lldb/tools/debugserver/source/MacOSX/MachTask.mm b/lldb/tools/debugserver/source/MacOSX/MachTask.mm index 0d5a63a28f20a7..5d18c5628c632f 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachTask.mm +++ b/lldb/tools/debugserver/source/MacOSX/MachTask.mm @@ -69,7 +69,8 @@ //---------------------------------------------------------------------- MachTask::MachTask(MachProcess *process) : m_process(process), m_task(TASK_NULL), m_vm_memory(), - m_exception_thread(0), m_exception_port(MACH_PORT_NULL) { + m_exception_thread(0), m_exception_port(MACH_PORT_NULL), + m_exec_will_be_suspended(false), m_do_double_resume(false) { memset(&m_exc_port_info, 0, sizeof(m_exc_port_info)); } @@ -103,6 +104,14 @@ err = BasicInfo(task, &task_info); if (err.Success()) { + if (m_do_double_resume && task_info.suspend_count == 2) { + err = ::task_resume(task); + if (DNBLogCheckLogBit(LOG_TASK) || err.Fail()) + err.LogThreaded("::task_resume double-resume after exec-start-stopped " + "( target_task = 0x%4.4x )", task); + } + m_do_double_resume = false; + // task_resume isn't counted like task_suspend calls are, are, so if the // task is not suspended, don't try and resume it since it is already // running @@ -135,6 +144,8 @@ m_task = TASK_NULL; m_exception_thread = 0; m_exception_port = MACH_PORT_NULL; + m_exec_will_be_suspended = false; + m_do_double_resume = false; } //---------------------------------------------------------------------- @@ -651,6 +662,9 @@ static void get_threads_profile_data(DNBProfileDataScanType scanType, err.LogThreaded("::mach_port_deallocate ( task = 0x%4.4x, name = 0x%4.4x )", task_self, exception_port); + m_exec_will_be_suspended = false; + m_do_double_resume = false; + return err.Status(); } @@ -960,4 +974,14 @@ static void get_threads_profile_data(DNBProfileDataScanType scanType, void MachTask::TaskPortChanged(task_t task) { m_task = task; + + // If we've just exec'd to a new process, and it + // is started suspended, we'll need to do two + // task_resume's to get the inferior process to + // continue. + if (m_exec_will_be_suspended) + m_do_double_resume = true; + else + m_do_double_resume = false; + m_exec_will_be_suspended = false; } diff --git a/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp b/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp deleted file mode 100644 index c6671b5066a4b3..00000000000000 --- a/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp +++ /dev/null @@ -1,487 +0,0 @@ -//===-- DNBArchImpl.cpp -----------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// Created by Greg Clayton on 6/25/07. -// -//===----------------------------------------------------------------------===// - -#if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) - -#if __DARWIN_UNIX03 -#define PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(reg) __##reg -#else -#define PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(reg) reg -#endif - -#include "MacOSX/ppc/DNBArchImpl.h" -#include "DNBBreakpoint.h" -#include "DNBLog.h" -#include "DNBRegisterInfo.h" -#include "MacOSX/MachThread.h" - -static const uint8_t g_breakpoint_opcode[] = {0x7F, 0xC0, 0x00, 0x08}; - -const uint8_t *DNBArchMachPPC::SoftwareBreakpointOpcode(nub_size_t size) { - if (size == 4) - return g_breakpoint_opcode; - return NULL; -} - -uint32_t DNBArchMachPPC::GetCPUType() { return CPU_TYPE_POWERPC; } - -uint64_t DNBArchMachPPC::GetPC(uint64_t failValue) { - // Get program counter - if (GetGPRState(false) == KERN_SUCCESS) - return m_state.gpr.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(srr0); - return failValue; -} - -kern_return_t DNBArchMachPPC::SetPC(uint64_t value) { - // Get program counter - kern_return_t err = GetGPRState(false); - if (err == KERN_SUCCESS) { - m_state.gpr.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(srr0) = value; - err = SetGPRState(); - } - return err == KERN_SUCCESS; -} - -uint64_t DNBArchMachPPC::GetSP(uint64_t failValue) { - // Get stack pointer - if (GetGPRState(false) == KERN_SUCCESS) - return m_state.gpr.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(r1); - return failValue; -} - -kern_return_t DNBArchMachPPC::GetGPRState(bool force) { - if (force || m_state.GetError(e_regSetGPR, Read)) { - mach_msg_type_number_t count = e_regSetWordSizeGPR; - m_state.SetError(e_regSetGPR, Read, - ::thread_get_state(m_thread->MachPortNumber(), e_regSetGPR, - (thread_state_t)&m_state.gpr, &count)); - } - return m_state.GetError(e_regSetGPR, Read); -} - -kern_return_t DNBArchMachPPC::GetFPRState(bool force) { - if (force || m_state.GetError(e_regSetFPR, Read)) { - mach_msg_type_number_t count = e_regSetWordSizeFPR; - m_state.SetError(e_regSetFPR, Read, - ::thread_get_state(m_thread->MachPortNumber(), e_regSetFPR, - (thread_state_t)&m_state.fpr, &count)); - } - return m_state.GetError(e_regSetFPR, Read); -} - -kern_return_t DNBArchMachPPC::GetEXCState(bool force) { - if (force || m_state.GetError(e_regSetEXC, Read)) { - mach_msg_type_number_t count = e_regSetWordSizeEXC; - m_state.SetError(e_regSetEXC, Read, - ::thread_get_state(m_thread->MachPortNumber(), e_regSetEXC, - (thread_state_t)&m_state.exc, &count)); - } - return m_state.GetError(e_regSetEXC, Read); -} - -kern_return_t DNBArchMachPPC::GetVECState(bool force) { - if (force || m_state.GetError(e_regSetVEC, Read)) { - mach_msg_type_number_t count = e_regSetWordSizeVEC; - m_state.SetError(e_regSetVEC, Read, - ::thread_get_state(m_thread->MachPortNumber(), e_regSetVEC, - (thread_state_t)&m_state.vec, &count)); - } - return m_state.GetError(e_regSetVEC, Read); -} - -kern_return_t DNBArchMachPPC::SetGPRState() { - m_state.SetError(e_regSetGPR, Write, - ::thread_set_state(m_thread->MachPortNumber(), e_regSetGPR, - (thread_state_t)&m_state.gpr, - e_regSetWordSizeGPR)); - return m_state.GetError(e_regSetGPR, Write); -} - -kern_return_t DNBArchMachPPC::SetFPRState() { - m_state.SetError(e_regSetFPR, Write, - ::thread_set_state(m_thread->MachPortNumber(), e_regSetFPR, - (thread_state_t)&m_state.fpr, - e_regSetWordSizeFPR)); - return m_state.GetError(e_regSetFPR, Write); -} - -kern_return_t DNBArchMachPPC::SetEXCState() { - m_state.SetError(e_regSetEXC, Write, - ::thread_set_state(m_thread->MachPortNumber(), e_regSetEXC, - (thread_state_t)&m_state.exc, - e_regSetWordSizeEXC)); - return m_state.GetError(e_regSetEXC, Write); -} - -kern_return_t DNBArchMachPPC::SetVECState() { - m_state.SetError(e_regSetVEC, Write, - ::thread_set_state(m_thread->MachPortNumber(), e_regSetVEC, - (thread_state_t)&m_state.vec, - e_regSetWordSizeVEC)); - return m_state.GetError(e_regSetVEC, Write); -} - -bool DNBArchMachPPC::ThreadWillResume() { - bool success = true; - - // Do we need to step this thread? If so, let the mach thread tell us so. - if (m_thread->IsStepping()) { - // This is the primary thread, let the arch do anything it needs - success = EnableHardwareSingleStep(true) == KERN_SUCCESS; - } - return success; -} - -bool DNBArchMachPPC::ThreadDidStop() { - bool success = true; - - m_state.InvalidateAllRegisterStates(); - - // Are we stepping a single instruction? - if (GetGPRState(true) == KERN_SUCCESS) { - // We are single stepping, was this the primary thread? - if (m_thread->IsStepping()) { - // This was the primary thread, we need to clear the trace - // bit if so. - success = EnableHardwareSingleStep(false) == KERN_SUCCESS; - } else { - // The MachThread will automatically restore the suspend count - // in ThreadDidStop(), so we don't need to do anything here if - // we weren't the primary thread the last time - } - } - return success; -} - -// Set the single step bit in the processor status register. -kern_return_t DNBArchMachPPC::EnableHardwareSingleStep(bool enable) { - DNBLogThreadedIf(LOG_STEP, - "DNBArchMachPPC::EnableHardwareSingleStep( enable = %d )", - enable); - if (GetGPRState(false) == KERN_SUCCESS) { - const uint32_t trace_bit = 0x400; - if (enable) - m_state.gpr.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(srr1) |= trace_bit; - else - m_state.gpr.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(srr1) &= ~trace_bit; - return SetGPRState(); - } - return m_state.GetError(e_regSetGPR, Read); -} - -// Register information definitions for 32 bit PowerPC. - -enum gpr_regnums { - e_regNumGPR_srr0, - e_regNumGPR_srr1, - e_regNumGPR_r0, - e_regNumGPR_r1, - e_regNumGPR_r2, - e_regNumGPR_r3, - e_regNumGPR_r4, - e_regNumGPR_r5, - e_regNumGPR_r6, - e_regNumGPR_r7, - e_regNumGPR_r8, - e_regNumGPR_r9, - e_regNumGPR_r10, - e_regNumGPR_r11, - e_regNumGPR_r12, - e_regNumGPR_r13, - e_regNumGPR_r14, - e_regNumGPR_r15, - e_regNumGPR_r16, - e_regNumGPR_r17, - e_regNumGPR_r18, - e_regNumGPR_r19, - e_regNumGPR_r20, - e_regNumGPR_r21, - e_regNumGPR_r22, - e_regNumGPR_r23, - e_regNumGPR_r24, - e_regNumGPR_r25, - e_regNumGPR_r26, - e_regNumGPR_r27, - e_regNumGPR_r28, - e_regNumGPR_r29, - e_regNumGPR_r30, - e_regNumGPR_r31, - e_regNumGPR_cr, - e_regNumGPR_xer, - e_regNumGPR_lr, - e_regNumGPR_ctr, - e_regNumGPR_mq, - e_regNumGPR_vrsave -}; - -// General purpose registers -static DNBRegisterInfo g_gpr_registers[] = { - {"srr0", Uint, 4, Hex}, {"srr1", Uint, 4, Hex}, {"r0", Uint, 4, Hex}, - {"r1", Uint, 4, Hex}, {"r2", Uint, 4, Hex}, {"r3", Uint, 4, Hex}, - {"r4", Uint, 4, Hex}, {"r5", Uint, 4, Hex}, {"r6", Uint, 4, Hex}, - {"r7", Uint, 4, Hex}, {"r8", Uint, 4, Hex}, {"r9", Uint, 4, Hex}, - {"r10", Uint, 4, Hex}, {"r11", Uint, 4, Hex}, {"r12", Uint, 4, Hex}, - {"r13", Uint, 4, Hex}, {"r14", Uint, 4, Hex}, {"r15", Uint, 4, Hex}, - {"r16", Uint, 4, Hex}, {"r17", Uint, 4, Hex}, {"r18", Uint, 4, Hex}, - {"r19", Uint, 4, Hex}, {"r20", Uint, 4, Hex}, {"r21", Uint, 4, Hex}, - {"r22", Uint, 4, Hex}, {"r23", Uint, 4, Hex}, {"r24", Uint, 4, Hex}, - {"r25", Uint, 4, Hex}, {"r26", Uint, 4, Hex}, {"r27", Uint, 4, Hex}, - {"r28", Uint, 4, Hex}, {"r29", Uint, 4, Hex}, {"r30", Uint, 4, Hex}, - {"r31", Uint, 4, Hex}, {"cr", Uint, 4, Hex}, {"xer", Uint, 4, Hex}, - {"lr", Uint, 4, Hex}, {"ctr", Uint, 4, Hex}, {"mq", Uint, 4, Hex}, - {"vrsave", Uint, 4, Hex}, -}; - -// Floating point registers -static DNBRegisterInfo g_fpr_registers[] = { - {"fp0", IEEE754, 8, Float}, {"fp1", IEEE754, 8, Float}, - {"fp2", IEEE754, 8, Float}, {"fp3", IEEE754, 8, Float}, - {"fp4", IEEE754, 8, Float}, {"fp5", IEEE754, 8, Float}, - {"fp6", IEEE754, 8, Float}, {"fp7", IEEE754, 8, Float}, - {"fp8", IEEE754, 8, Float}, {"fp9", IEEE754, 8, Float}, - {"fp10", IEEE754, 8, Float}, {"fp11", IEEE754, 8, Float}, - {"fp12", IEEE754, 8, Float}, {"fp13", IEEE754, 8, Float}, - {"fp14", IEEE754, 8, Float}, {"fp15", IEEE754, 8, Float}, - {"fp16", IEEE754, 8, Float}, {"fp17", IEEE754, 8, Float}, - {"fp18", IEEE754, 8, Float}, {"fp19", IEEE754, 8, Float}, - {"fp20", IEEE754, 8, Float}, {"fp21", IEEE754, 8, Float}, - {"fp22", IEEE754, 8, Float}, {"fp23", IEEE754, 8, Float}, - {"fp24", IEEE754, 8, Float}, {"fp25", IEEE754, 8, Float}, - {"fp26", IEEE754, 8, Float}, {"fp27", IEEE754, 8, Float}, - {"fp28", IEEE754, 8, Float}, {"fp29", IEEE754, 8, Float}, - {"fp30", IEEE754, 8, Float}, {"fp31", IEEE754, 8, Float}, - {"fpscr", Uint, 4, Hex}}; - -// Exception registers - -static DNBRegisterInfo g_exc_registers[] = {{"dar", Uint, 4, Hex}, - {"dsisr", Uint, 4, Hex}, - {"exception", Uint, 4, Hex}}; - -// Altivec registers -static DNBRegisterInfo g_vec_registers[] = { - {"vr0", Vector, 16, VectorOfFloat32}, - {"vr1", Vector, 16, VectorOfFloat32}, - {"vr2", Vector, 16, VectorOfFloat32}, - {"vr3", Vector, 16, VectorOfFloat32}, - {"vr4", Vector, 16, VectorOfFloat32}, - {"vr5", Vector, 16, VectorOfFloat32}, - {"vr6", Vector, 16, VectorOfFloat32}, - {"vr7", Vector, 16, VectorOfFloat32}, - {"vr8", Vector, 16, VectorOfFloat32}, - {"vr9", Vector, 16, VectorOfFloat32}, - {"vr10", Vector, 16, VectorOfFloat32}, - {"vr11", Vector, 16, VectorOfFloat32}, - {"vr12", Vector, 16, VectorOfFloat32}, - {"vr13", Vector, 16, VectorOfFloat32}, - {"vr14", Vector, 16, VectorOfFloat32}, - {"vr15", Vector, 16, VectorOfFloat32}, - {"vr16", Vector, 16, VectorOfFloat32}, - {"vr17", Vector, 16, VectorOfFloat32}, - {"vr18", Vector, 16, VectorOfFloat32}, - {"vr19", Vector, 16, VectorOfFloat32}, - {"vr20", Vector, 16, VectorOfFloat32}, - {"vr21", Vector, 16, VectorOfFloat32}, - {"vr22", Vector, 16, VectorOfFloat32}, - {"vr23", Vector, 16, VectorOfFloat32}, - {"vr24", Vector, 16, VectorOfFloat32}, - {"vr25", Vector, 16, VectorOfFloat32}, - {"vr26", Vector, 16, VectorOfFloat32}, - {"vr27", Vector, 16, VectorOfFloat32}, - {"vr28", Vector, 16, VectorOfFloat32}, - {"vr29", Vector, 16, VectorOfFloat32}, - {"vr30", Vector, 16, VectorOfFloat32}, - {"vr31", Vector, 16, VectorOfFloat32}, - {"vscr", Uint, 16, Hex}, - {"vrvalid", Uint, 4, Hex}}; - -// Number of registers in each register set -const size_t k_num_gpr_registers = - sizeof(g_gpr_registers) / sizeof(DNBRegisterInfo); -const size_t k_num_fpr_registers = - sizeof(g_fpr_registers) / sizeof(DNBRegisterInfo); -const size_t k_num_exc_registers = - sizeof(g_exc_registers) / sizeof(DNBRegisterInfo); -const size_t k_num_vec_registers = - sizeof(g_vec_registers) / sizeof(DNBRegisterInfo); -// Total number of registers for this architecture -const size_t k_num_ppc_registers = k_num_gpr_registers + k_num_fpr_registers + - k_num_exc_registers + k_num_vec_registers; - -// Register set definitions. The first definitions at register set index -// of zero is for all registers, followed by other registers sets. The -// register information for the all register set need not be filled in. -static const DNBRegisterSetInfo g_reg_sets[] = { - {"PowerPC Registers", NULL, k_num_ppc_registers}, - {"General Purpose Registers", g_gpr_registers, k_num_gpr_registers}, - {"Floating Point Registers", g_fpr_registers, k_num_fpr_registers}, - {"Exception State Registers", g_exc_registers, k_num_exc_registers}, - {"Altivec Registers", g_vec_registers, k_num_vec_registers}}; -// Total number of register sets for this architecture -const size_t k_num_register_sets = - sizeof(g_reg_sets) / sizeof(DNBRegisterSetInfo); - -const DNBRegisterSetInfo * -DNBArchMachPPC::GetRegisterSetInfo(nub_size_t *num_reg_sets) const { - *num_reg_sets = k_num_register_sets; - return g_reg_sets; -} - -bool DNBArchMachPPC::GetRegisterValue(uint32_t set, uint32_t reg, - DNBRegisterValue *value) const { - if (set == REGISTER_SET_GENERIC) { - switch (reg) { - case GENERIC_REGNUM_PC: // Program Counter - set = e_regSetGPR; - reg = e_regNumGPR_srr0; - break; - - case GENERIC_REGNUM_SP: // Stack Pointer - set = e_regSetGPR; - reg = e_regNumGPR_r1; - break; - - case GENERIC_REGNUM_FP: // Frame Pointer - // Return false for now instead of returning r30 as gcc 3.x would - // use a variety of registers for the FP and it takes inspecting - // the stack to make sure there is a frame pointer before we can - // determine the FP. - return false; - - case GENERIC_REGNUM_RA: // Return Address - set = e_regSetGPR; - reg = e_regNumGPR_lr; - break; - - case GENERIC_REGNUM_FLAGS: // Processor flags register - set = e_regSetGPR; - reg = e_regNumGPR_srr1; - break; - - default: - return false; - } - } - - if (!m_state.RegsAreValid(set)) - return false; - - const DNBRegisterInfo *regInfo = m_thread->GetRegisterInfo(set, reg); - if (regInfo) { - value->info = *regInfo; - switch (set) { - case e_regSetGPR: - if (reg < k_num_gpr_registers) { - value->value.uint32 = - (&m_state.gpr.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(srr0))[reg]; - return true; - } - break; - - case e_regSetFPR: - if (reg < 32) { - value->value.float64 = - m_state.fpr.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(fpregs)[reg]; - return true; - } else if (reg == 32) { - value->value.uint32 = - m_state.fpr.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(fpscr); - return true; - } - break; - - case e_regSetEXC: - if (reg < k_num_exc_registers) { - value->value.uint32 = - (&m_state.exc.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(dar))[reg]; - return true; - } - break; - - case e_regSetVEC: - if (reg < k_num_vec_registers) { - if (reg < 33) // FP0 - FP31 and VSCR - { - // Copy all 4 uint32 values for this vector register - value->value.v_uint32[0] = - m_state.vec.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(save_vr)[reg] - [0]; - value->value.v_uint32[1] = - m_state.vec.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(save_vr)[reg] - [1]; - value->value.v_uint32[2] = - m_state.vec.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(save_vr)[reg] - [2]; - value->value.v_uint32[3] = - m_state.vec.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(save_vr)[reg] - [3]; - return true; - } else if (reg == 34) // VRVALID - { - value->value.uint32 = - m_state.vec.PREFIX_DOUBLE_UNDERSCORE_DARWIN_UNIX03(save_vrvalid); - return true; - } - } - break; - } - } - return false; -} - -kern_return_t DNBArchMachPPC::GetRegisterState(int set, bool force) { - switch (set) { - case e_regSetALL: - return GetGPRState(force) | GetFPRState(force) | GetEXCState(force) | - GetVECState(force); - case e_regSetGPR: - return GetGPRState(force); - case e_regSetFPR: - return GetFPRState(force); - case e_regSetEXC: - return GetEXCState(force); - case e_regSetVEC: - return GetVECState(force); - default: - break; - } - return KERN_INVALID_ARGUMENT; -} - -kern_return_t DNBArchMachPPC::SetRegisterState(int set) { - // Make sure we have a valid context to set. - kern_return_t err = GetRegisterState(set, false); - if (err != KERN_SUCCESS) - return err; - - switch (set) { - case e_regSetALL: - return SetGPRState() | SetFPRState() | SetEXCState() | SetVECState(); - case e_regSetGPR: - return SetGPRState(); - case e_regSetFPR: - return SetFPRState(); - case e_regSetEXC: - return SetEXCState(); - case e_regSetVEC: - return SetVECState(); - default: - break; - } - return KERN_INVALID_ARGUMENT; -} - -bool DNBArchMachPPC::RegisterSetStateIsValid(int set) const { - return m_state.RegsAreValid(set); -} - -#endif // #if defined (__powerpc__) || defined (__ppc__) || defined (__ppc64__) diff --git a/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.h b/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.h deleted file mode 100644 index 7d20f18d0276b7..00000000000000 --- a/lldb/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.h +++ /dev/null @@ -1,159 +0,0 @@ -//===-- DNBArchImpl.h -------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// Created by Greg Clayton on 6/25/07. -// -//===----------------------------------------------------------------------===// - -#ifndef __DebugNubArchMachPPC_h__ -#define __DebugNubArchMachPPC_h__ - -#if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) - -#include "DNBArch.h" - -class MachThread; - -class DNBArchMachPPC : public DNBArchProtocol { -public: - DNBArchMachPPC(MachThread *thread) : m_thread(thread), m_state() {} - - virtual ~DNBArchMachPPC() {} - - virtual const DNBRegisterSetInfo * - GetRegisterSetInfo(nub_size_t *num_reg_sets) const; - virtual bool GetRegisterValue(uint32_t set, uint32_t reg, - DNBRegisterValue *value) const; - virtual kern_return_t GetRegisterState(int set, bool force); - virtual kern_return_t SetRegisterState(int set); - virtual bool RegisterSetStateIsValid(int set) const; - - virtual uint64_t GetPC(uint64_t failValue); // Get program counter - virtual kern_return_t SetPC(uint64_t value); - virtual uint64_t GetSP(uint64_t failValue); // Get stack pointer - virtual bool ThreadWillResume(); - virtual bool ThreadDidStop(); - - static const uint8_t *SoftwareBreakpointOpcode(nub_size_t byte_size); - static uint32_t GetCPUType(); - -protected: - kern_return_t EnableHardwareSingleStep(bool enable); - - enum RegisterSet { - e_regSetALL = REGISTER_SET_ALL, - e_regSetGPR, - e_regSetFPR, - e_regSetEXC, - e_regSetVEC, - kNumRegisterSets - }; - - typedef enum RegisterSetWordSizeTag { - e_regSetWordSizeGPR = PPC_THREAD_STATE_COUNT, - e_regSetWordSizeFPR = PPC_FLOAT_STATE_COUNT, - e_regSetWordSizeEXC = PPC_EXCEPTION_STATE_COUNT, - e_regSetWordSizeVEC = PPC_VECTOR_STATE_COUNT - } RegisterSetWordSize; - - enum { Read = 0, Write = 1, kNumErrors = 2 }; - - struct State { - ppc_thread_state_t gpr; - ppc_float_state_t fpr; - ppc_exception_state_t exc; - ppc_vector_state_t vec; - kern_return_t gpr_errs[2]; // Read/Write errors - kern_return_t fpr_errs[2]; // Read/Write errors - kern_return_t exc_errs[2]; // Read/Write errors - kern_return_t vec_errs[2]; // Read/Write errors - - State() { - uint32_t i; - for (i = 0; i < kNumErrors; i++) { - gpr_errs[i] = -1; - fpr_errs[i] = -1; - exc_errs[i] = -1; - vec_errs[i] = -1; - } - } - void InvalidateAllRegisterStates() { SetError(e_regSetALL, Read, -1); } - kern_return_t GetError(int set, uint32_t err_idx) const { - if (err_idx < kNumErrors) { - switch (set) { - // When getting all errors, just OR all values together to see if - // we got any kind of error. - case e_regSetALL: - return gpr_errs[err_idx] | fpr_errs[err_idx] | exc_errs[err_idx] | - vec_errs[err_idx]; - case e_regSetGPR: - return gpr_errs[err_idx]; - case e_regSetFPR: - return fpr_errs[err_idx]; - case e_regSetEXC: - return exc_errs[err_idx]; - case e_regSetVEC: - return vec_errs[err_idx]; - default: - break; - } - } - return -1; - } - bool SetError(int set, uint32_t err_idx, kern_return_t err) { - if (err_idx < kNumErrors) { - switch (set) { - case e_regSetALL: - gpr_errs[err_idx] = fpr_errs[err_idx] = exc_errs[err_idx] = - vec_errs[err_idx] = err; - return true; - - case e_regSetGPR: - gpr_errs[err_idx] = err; - return true; - - case e_regSetFPR: - fpr_errs[err_idx] = err; - return true; - - case e_regSetEXC: - exc_errs[err_idx] = err; - return true; - - case e_regSetVEC: - vec_errs[err_idx] = err; - return true; - - default: - break; - } - } - return false; - } - bool RegsAreValid(int set) const { - return GetError(set, Read) == KERN_SUCCESS; - } - }; - - kern_return_t GetGPRState(bool force); - kern_return_t GetFPRState(bool force); - kern_return_t GetEXCState(bool force); - kern_return_t GetVECState(bool force); - - kern_return_t SetGPRState(); - kern_return_t SetFPRState(); - kern_return_t SetEXCState(); - kern_return_t SetVECState(); - -protected: - MachThread *m_thread; - State m_state; -}; - -#endif // #if defined (__powerpc__) || defined (__ppc__) || defined (__ppc64__) -#endif // #ifndef __DebugNubArchMachPPC_h__ diff --git a/lldb/tools/debugserver/source/RNBDefs.h b/lldb/tools/debugserver/source/RNBDefs.h index 4cc7c220b7f29a..fe5d9de04cbe04 100644 --- a/lldb/tools/debugserver/source/RNBDefs.h +++ b/lldb/tools/debugserver/source/RNBDefs.h @@ -50,14 +50,6 @@ extern "C" const double CONCAT(DEBUGSERVER_PROGRAM_SYMBOL, VersionNumber); #define RNB_ARCH "x86_64" -#elif defined(__ppc64__) - -#define RNB_ARCH "ppc64" - -#elif defined(__powerpc__) || defined(__ppc__) - -#define RNB_ARCH "ppc" - #elif defined(__arm64__) || defined(__aarch64__) #define RNB_ARCH "arm64" diff --git a/lldb/tools/debugserver/source/RNBServices.cpp b/lldb/tools/debugserver/source/RNBServices.cpp index 085aaddfaf15d1..7b2ab7c9b73768 100644 --- a/lldb/tools/debugserver/source/RNBServices.cpp +++ b/lldb/tools/debugserver/source/RNBServices.cpp @@ -62,9 +62,8 @@ int GetProcesses(CFMutableArrayRef plistMutableArray, bool all_users) { proc_info.kp_proc.p_stat == SZOMB || // Zombies are bad, they like brains... proc_info.kp_proc.p_flag & P_TRACED || // Being debugged? - proc_info.kp_proc.p_flag & P_WEXIT || // Working on exiting? - proc_info.kp_proc.p_flag & - P_TRANSLATED) // Skip translated ppc (Rosetta) + proc_info.kp_proc.p_flag & P_WEXIT // Working on exiting? + ) continue; // Create a new mutable dictionary for each application diff --git a/lldb/tools/lldb-test/SystemInitializerTest.cpp b/lldb/tools/lldb-test/SystemInitializerTest.cpp index 16d39d7cae5626..d6c52f54998ae2 100644 --- a/lldb/tools/lldb-test/SystemInitializerTest.cpp +++ b/lldb/tools/lldb-test/SystemInitializerTest.cpp @@ -33,7 +33,7 @@ #include "Plugins/Architecture/Arm/ArchitectureArm.h" #include "Plugins/Architecture/Mips/ArchitectureMips.h" #include "Plugins/Architecture/PPC64/ArchitecturePPC64.h" -#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h" +#include "Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h" #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h" #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h" #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h" @@ -44,10 +44,10 @@ #include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h" #include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h" #include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h" -#include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h" -#include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h" -#include "Plugins/InstrumentationRuntime/TSan/TSanRuntime.h" -#include "Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h" +#include "Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h" +#include "Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h" +#include "Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h" +#include "Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h" #include "Plugins/JITLoader/GDB/JITLoaderGDB.h" #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" #include "Plugins/Language/ObjC/ObjCLanguage.h" @@ -193,10 +193,10 @@ llvm::Error SystemInitializerTest::Initialize() { ProcessMachCore::Initialize(); minidump::ProcessMinidump::Initialize(); MemoryHistoryASan::Initialize(); - AddressSanitizerRuntime::Initialize(); - ThreadSanitizerRuntime::Initialize(); - UndefinedBehaviorSanitizerRuntime::Initialize(); - MainThreadCheckerRuntime::Initialize(); + InstrumentationRuntimeASan::Initialize(); + InstrumentationRuntimeTSan::Initialize(); + InstrumentationRuntimeUBSan::Initialize(); + InstrumentationRuntimeMainThreadChecker::Initialize(); SymbolVendorELF::Initialize(); breakpad::SymbolFileBreakpad::Initialize(); @@ -286,10 +286,11 @@ void SystemInitializerTest::Terminate() { ProcessMachCore::Terminate(); minidump::ProcessMinidump::Terminate(); MemoryHistoryASan::Terminate(); - AddressSanitizerRuntime::Terminate(); - ThreadSanitizerRuntime::Terminate(); - UndefinedBehaviorSanitizerRuntime::Terminate(); - MainThreadCheckerRuntime::Terminate(); + InstrumentationRuntimeASan::Terminate(); + InstrumentationRuntimeTSan::Terminate(); + InstrumentationRuntimeUBSan::Terminate(); + InstrumentationRuntimeMainThreadChecker::Terminate(); + wasm::SymbolVendorWasm::Terminate(); SymbolVendorELF::Terminate(); breakpad::SymbolFileBreakpad::Terminate(); diff --git a/lldb/unittests/Disassembler/TestArm64Disassembly.cpp b/lldb/unittests/Disassembler/TestArm64Disassembly.cpp index 2f631a64a0c536..23c8b668570114 100644 --- a/lldb/unittests/Disassembler/TestArm64Disassembly.cpp +++ b/lldb/unittests/Disassembler/TestArm64Disassembly.cpp @@ -15,7 +15,7 @@ #include "lldb/Utility/ArchSpec.h" #include "lldb/Target/ExecutionContext.h" -#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h" +#include "Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h" #include "llvm/Support/TargetSelect.h" using namespace lldb; diff --git a/lldb/unittests/Disassembler/TestArmv7Disassembly.cpp b/lldb/unittests/Disassembler/TestArmv7Disassembly.cpp index 2acf818ff012b4..2b1253137df541 100644 --- a/lldb/unittests/Disassembler/TestArmv7Disassembly.cpp +++ b/lldb/unittests/Disassembler/TestArmv7Disassembly.cpp @@ -15,7 +15,7 @@ #include "lldb/Utility/ArchSpec.h" #include "lldb/Target/ExecutionContext.h" -#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h" +#include "Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h" #include "llvm/Support/TargetSelect.h" using namespace lldb; diff --git a/lldb/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp b/lldb/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp index d853e6fb43c0de..6429b0718fcae7 100644 --- a/lldb/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp +++ b/lldb/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp @@ -20,7 +20,7 @@ #include "lldb/Target/UnwindAssembly.h" #include "lldb/Utility/ArchSpec.h" -#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h" +#include "Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h" #include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h" #include "Plugins/Process/Utility/lldb-arm64-register-enums.h" #include "llvm/Support/TargetSelect.h" diff --git a/lldb/unittests/UnwindAssembly/PPC64/TestPPC64InstEmulation.cpp b/lldb/unittests/UnwindAssembly/PPC64/TestPPC64InstEmulation.cpp index faae6063841fa9..2178196bb3ec90 100644 --- a/lldb/unittests/UnwindAssembly/PPC64/TestPPC64InstEmulation.cpp +++ b/lldb/unittests/UnwindAssembly/PPC64/TestPPC64InstEmulation.cpp @@ -18,7 +18,7 @@ #include "lldb/Target/UnwindAssembly.h" #include "lldb/Utility/ArchSpec.h" -#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h" +#include "Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h" #include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h" #include "Plugins/Process/Utility/lldb-ppc64le-register-enums.h" #include "llvm/Support/TargetSelect.h" diff --git a/llvm/docs/AMDGPU/AMDGPUAsmGFX10.rst b/llvm/docs/AMDGPU/AMDGPUAsmGFX10.rst index bc2b4f74ecfef9..d0f65ee6d89fa1 100644 --- a/llvm/docs/AMDGPU/AMDGPUAsmGFX10.rst +++ b/llvm/docs/AMDGPU/AMDGPUAsmGFX10.rst @@ -22,8 +22,8 @@ Notation Notation used in this document is explained :ref:`here`. -Overvew -======= +Overview +======== An overview of generic syntax and other features of AMDGPU instructions may be found :ref:`in this document`. diff --git a/llvm/docs/AMDGPU/AMDGPUAsmGFX7.rst b/llvm/docs/AMDGPU/AMDGPUAsmGFX7.rst index e96862bcf03234..c1b8512367f8a6 100644 --- a/llvm/docs/AMDGPU/AMDGPUAsmGFX7.rst +++ b/llvm/docs/AMDGPU/AMDGPUAsmGFX7.rst @@ -22,8 +22,8 @@ Notation Notation used in this document is explained :ref:`here`. -Overvew -======= +Overview +======== An overview of generic syntax and other features of AMDGPU instructions may be found :ref:`in this document`. diff --git a/llvm/docs/AMDGPU/AMDGPUAsmGFX8.rst b/llvm/docs/AMDGPU/AMDGPUAsmGFX8.rst index 4dd0439c6fdb87..b41d5e6eaf94e0 100644 --- a/llvm/docs/AMDGPU/AMDGPUAsmGFX8.rst +++ b/llvm/docs/AMDGPU/AMDGPUAsmGFX8.rst @@ -22,8 +22,8 @@ Notation Notation used in this document is explained :ref:`here`. -Overvew -======= +Overview +======== An overview of generic syntax and other features of AMDGPU instructions may be found :ref:`in this document`. diff --git a/llvm/docs/AMDGPU/AMDGPUAsmGFX9.rst b/llvm/docs/AMDGPU/AMDGPUAsmGFX9.rst index 7131718df7e7d9..9f17b34fc1a01c 100644 --- a/llvm/docs/AMDGPU/AMDGPUAsmGFX9.rst +++ b/llvm/docs/AMDGPU/AMDGPUAsmGFX9.rst @@ -22,8 +22,8 @@ Notation Notation used in this document is explained :ref:`here`. -Overvew -======= +Overview +======== An overview of generic syntax and other features of AMDGPU instructions may be found :ref:`in this document`. diff --git a/llvm/docs/AMDGPU/AMDGPUAsmGFX900.rst b/llvm/docs/AMDGPU/AMDGPUAsmGFX900.rst index 7832e08dbb3746..4e81f974ad7356 100644 --- a/llvm/docs/AMDGPU/AMDGPUAsmGFX900.rst +++ b/llvm/docs/AMDGPU/AMDGPUAsmGFX900.rst @@ -24,8 +24,8 @@ Notation Notation used in this document is explained :ref:`here`. -Overvew -======= +Overview +======== An overview of generic syntax and other features of AMDGPU instructions may be found :ref:`in this document`. diff --git a/llvm/docs/AMDGPU/AMDGPUAsmGFX904.rst b/llvm/docs/AMDGPU/AMDGPUAsmGFX904.rst index 23f79fc96a43d1..230d689f3a0e74 100644 --- a/llvm/docs/AMDGPU/AMDGPUAsmGFX904.rst +++ b/llvm/docs/AMDGPU/AMDGPUAsmGFX904.rst @@ -24,8 +24,8 @@ Notation Notation used in this document is explained :ref:`here`. -Overvew -======= +Overview +======== An overview of generic syntax and other features of AMDGPU instructions may be found :ref:`in this document`. diff --git a/llvm/docs/AMDGPU/AMDGPUAsmGFX906.rst b/llvm/docs/AMDGPU/AMDGPUAsmGFX906.rst index 8119af4392eb3d..ee9c45d65c92a9 100644 --- a/llvm/docs/AMDGPU/AMDGPUAsmGFX906.rst +++ b/llvm/docs/AMDGPU/AMDGPUAsmGFX906.rst @@ -24,8 +24,8 @@ Notation Notation used in this document is explained :ref:`here`. -Overvew -======= +Overview +======== An overview of generic syntax and other features of AMDGPU instructions may be found :ref:`in this document`. diff --git a/llvm/docs/AMDGPU/AMDGPUAsmGFX908.rst b/llvm/docs/AMDGPU/AMDGPUAsmGFX908.rst index 7e90837cdf0b1b..bae8f7701a0a5e 100644 --- a/llvm/docs/AMDGPU/AMDGPUAsmGFX908.rst +++ b/llvm/docs/AMDGPU/AMDGPUAsmGFX908.rst @@ -24,8 +24,8 @@ Notation Notation used in this document is explained :ref:`here`. -Overvew -======= +Overview +======== An overview of generic syntax and other features of AMDGPU instructions may be found :ref:`in this document`. diff --git a/llvm/docs/Atomics.rst b/llvm/docs/Atomics.rst index 00f29c285b3f41..7d57740ded7c35 100644 --- a/llvm/docs/Atomics.rst +++ b/llvm/docs/Atomics.rst @@ -562,7 +562,7 @@ various reasons, it is not practical to emit the instructions inline. There's two typical examples of this. -Some CPUs support multiple instruction sets which can be swiched back and forth +Some CPUs support multiple instruction sets which can be switched back and forth on function-call boundaries. For example, MIPS supports the MIPS16 ISA, which has a smaller instruction encoding than the usual MIPS32 ISA. ARM, similarly, has the Thumb ISA. In MIPS16 and earlier versions of Thumb, the atomic diff --git a/llvm/docs/BigEndianNEON.rst b/llvm/docs/BigEndianNEON.rst index 242eb0e73d2fe9..aa564c14dee6c0 100644 --- a/llvm/docs/BigEndianNEON.rst +++ b/llvm/docs/BigEndianNEON.rst @@ -12,7 +12,7 @@ Generating code for big endian ARM processors is for the most part straightforwa The aim of this document is to explain the problem with NEON loads and stores, and the solution that has been implemented in LLVM. -In this document the term "vector" refers to what the ARM ABI calls a "short vector", which is a sequence of items that can fit in a NEON register. This sequence can be 64 or 128 bits in length, and can constitute 8, 16, 32 or 64 bit items. This document refers to A64 instructions throughout, but is almost applicable to the A32/ARMv7 instruction sets also. The ABI format for passing vectors in A32 is sligtly different to A64. Apart from that, the same concepts apply. +In this document the term "vector" refers to what the ARM ABI calls a "short vector", which is a sequence of items that can fit in a NEON register. This sequence can be 64 or 128 bits in length, and can constitute 8, 16, 32 or 64 bit items. This document refers to A64 instructions throughout, but is almost applicable to the A32/ARMv7 instruction sets also. The ABI format for passing vectors in A32 is slightly different to A64. Apart from that, the same concepts apply. Example: C-level intrinsics -> assembly --------------------------------------- diff --git a/llvm/docs/BlockFrequencyTerminology.rst b/llvm/docs/BlockFrequencyTerminology.rst index 41f89f8ce965a5..a424be2aa7f8bb 100644 --- a/llvm/docs/BlockFrequencyTerminology.rst +++ b/llvm/docs/BlockFrequencyTerminology.rst @@ -82,7 +82,7 @@ by a cut edge should equal ``UINT64_MAX``. In other words, mass is conserved as it "falls" through the DAG. If a function's basic block graph is a DAG, then block masses are valid block -frequencies. This works poorly in practise though, since downstream users rely +frequencies. This works poorly in practice though, since downstream users rely on adding block frequencies together without hitting the maximum. Loop Scale diff --git a/llvm/docs/Bugpoint.rst b/llvm/docs/Bugpoint.rst index 19efaf2bdee7b7..2dd504520d5098 100644 --- a/llvm/docs/Bugpoint.rst +++ b/llvm/docs/Bugpoint.rst @@ -121,7 +121,7 @@ non-obvious ways. Here are some hints and tips: miscompilation. Programs should be temporarily modified to disable outputs that are likely to vary from run to run. -* In the `crash debugger`_, ``bugpoint`` does not distiguish different crashes +* In the `crash debugger`_, ``bugpoint`` does not distinguish different crashes during reduction. Thus, if new crash or miscompilation happens, ``bugpoint`` will continue with the new crash instead. If you would like to stick to particular crash, you should write check scripts to validate the error diff --git a/llvm/docs/CMakePrimer.rst b/llvm/docs/CMakePrimer.rst index 72ebffa5bdd6dd..abfd08017fbfad 100644 --- a/llvm/docs/CMakePrimer.rst +++ b/llvm/docs/CMakePrimer.rst @@ -333,7 +333,7 @@ When defining a CMake command handling arguments is very useful. The examples in this section will all use the CMake ``function`` block, but this all applies to the ``macro`` block as well. -CMake commands can have named arguments that are requried at every call site. In +CMake commands can have named arguments that are required at every call site. In addition, all commands will implicitly accept a variable number of extra arguments (In C parlance, all commands are varargs functions). When a command is invoked with extra arguments (beyond the named ones) CMake will store the full diff --git a/llvm/docs/CodeGenerator.rst b/llvm/docs/CodeGenerator.rst index e38464a0f80f7e..875a96ca4e2af1 100644 --- a/llvm/docs/CodeGenerator.rst +++ b/llvm/docs/CodeGenerator.rst @@ -1272,7 +1272,7 @@ compatible with a given physical, this code can be used: Sometimes, mostly for debugging purposes, it is useful to change the number of physical registers available in the target architecture. This must be done -statically, inside the ``TargetRegsterInfo.td`` file. Just ``grep`` for +statically, inside the ``TargetRegisterInfo.td`` file. Just ``grep`` for ``RegisterClass``, the last parameter of which is a list of registers. Just commenting some out is one simple way to avoid them being used. A more polite way is to explicitly exclude some registers from the *allocation order*. See the @@ -2418,7 +2418,7 @@ to spill registers r3-r10. This allows callees blind to the call signature, such as thunks and vararg functions, enough space to cache the argument registers. Therefore, the parameter area is minimally 32 bytes (64 bytes in 64 bit mode.) Also note that since the parameter area is a fixed offset from the -top of the frame, that a callee can access its spilt arguments using fixed +top of the frame, that a callee can access its split arguments using fixed offsets from the stack pointer (or base pointer.) Combining the information about the linkage, parameter areas and alignment. A diff --git a/llvm/docs/CodingStandards.rst b/llvm/docs/CodingStandards.rst index 0478bd2707893d..394b1c602e051b 100644 --- a/llvm/docs/CodingStandards.rst +++ b/llvm/docs/CodingStandards.rst @@ -647,7 +647,7 @@ Beware of non-deterministic sorting order of equal elements ``std::sort`` uses a non-stable sorting algorithm in which the order of equal elements is not guaranteed to be preserved. Thus using ``std::sort`` for a -container having equal elements may result in non-determinstic behavior. +container having equal elements may result in non-deterministic behavior. To uncover such instances of non-determinism, LLVM has introduced a new llvm::sort wrapper function. For an EXPENSIVE_CHECKS build this will randomly shuffle the container before sorting. Default to using ``llvm::sort`` instead @@ -1206,7 +1206,7 @@ Don't evaluate ``end()`` every time through a loop In cases where range-based ``for`` loops can't be used and it is necessary to write an explicit iterator-based loop, pay close attention to whether -``end()`` is re-evaluted on each loop iteration. One common mistake is to +``end()`` is re-evaluated on each loop iteration. One common mistake is to write a loop in this style: .. code-block:: c++ diff --git a/llvm/docs/CommandGuide/lit.rst b/llvm/docs/CommandGuide/lit.rst index 40aeecdf2c81af..ebc0bf2c27fdc9 100644 --- a/llvm/docs/CommandGuide/lit.rst +++ b/llvm/docs/CommandGuide/lit.rst @@ -176,7 +176,7 @@ SELECTION OPTIONS "shards", and run only one of them. Must be used with the ``--run-shard=N`` option, which selects the shard to run. The environment variable ``LIT_NUM_SHARDS`` can also be used in place of this - option. These two options provide a coarse mechanism for paritioning large + option. These two options provide a coarse mechanism for partitioning large testsuites, for parallel execution on separate machines (say in a large testing farm). diff --git a/llvm/docs/CommandGuide/tblgen.rst b/llvm/docs/CommandGuide/tblgen.rst index 372d1b2a73086f..2a468fa95fdddc 100644 --- a/llvm/docs/CommandGuide/tblgen.rst +++ b/llvm/docs/CommandGuide/tblgen.rst @@ -98,7 +98,7 @@ OPTIONS .. option:: -gen-dag-isel - Generate a DAG (Directed Acycle Graph) instruction selector. + Generate a DAG (Directed Acyclic Graph) instruction selector. .. option:: -gen-asm-matcher diff --git a/llvm/docs/CompileCudaWithLLVM.rst b/llvm/docs/CompileCudaWithLLVM.rst index 6e181c84e6881b..b4479771f803a9 100644 --- a/llvm/docs/CompileCudaWithLLVM.rst +++ b/llvm/docs/CompileCudaWithLLVM.rst @@ -512,7 +512,7 @@ LLVM to make it generate good GPU code. Among these changes are: * `Memory space inference `_ -- - In PTX, we can operate on pointers that are in a paricular "address space" + In PTX, we can operate on pointers that are in a particular "address space" (global, shared, constant, or local), or we can operate on pointers in the "generic" address space, which can point to anything. Operations in a non-generic address space are faster, but pointers in CUDA are not explicitly @@ -528,7 +528,7 @@ LLVM to make it generate good GPU code. Among these changes are: which fit in 32-bits at runtime. This optimization provides a fast path for this common case. -* Aggressive loop unrooling and function inlining -- Loop unrolling and +* Aggressive loop unrolling and function inlining -- Loop unrolling and function inlining need to be more aggressive for GPUs than for CPUs because control flow transfer in GPU is more expensive. More aggressive unrolling and inlining also promote other optimizations, such as constant propagation and diff --git a/llvm/docs/CoverageMappingFormat.rst b/llvm/docs/CoverageMappingFormat.rst index 30b11fe2f31d6f..133c63418ac4ba 100644 --- a/llvm/docs/CoverageMappingFormat.rst +++ b/llvm/docs/CoverageMappingFormat.rst @@ -12,7 +12,7 @@ Introduction ============ LLVM's code coverage mapping format is used to provide code coverage -analysis using LLVM's and Clang's instrumenation based profiling +analysis using LLVM's and Clang's instrumentation based profiling (Clang's ``-fprofile-instr-generate`` option). This document is aimed at those who use LLVM's code coverage mapping to provide diff --git a/llvm/docs/DependenceGraphs/index.rst b/llvm/docs/DependenceGraphs/index.rst index c53ee9051d5fc9..e3e6447df2f6a7 100644 --- a/llvm/docs/DependenceGraphs/index.rst +++ b/llvm/docs/DependenceGraphs/index.rst @@ -131,7 +131,7 @@ graph described in [1]_ in the following ways: 1. The graph nodes in the paper represent three main program components, namely *assignment statements*, *for loop headers* and *while loop headers*. In this implementation, DDG nodes naturally represent LLVM IR instructions. An assignment statement in this implementation typically involves a node representing the ``store`` instruction along with a number of individual nodes computing the right-hand-side of the assignment that connect to the ``store`` node via a def-use edge. The loop header instructions are not represented as special nodes in this implementation because they have limited uses and can be easily identified, for example, through ``LoopAnalysis``. 2. The paper describes five types of dependency edges between nodes namely *loop dependency*, *flow-*, *anti-*, *output-*, and *input-* dependencies. In this implementation *memory* edges represent the *flow-*, *anti-*, *output-*, and *input-* dependencies. However, *loop dependencies* are not made explicit, because they mainly represent association between a loop structure and the program elements inside the loop and this association is fairly obvious in LLVM IR itself. - 3. The paper describes two types of pi-blocks; *recurrences* whose bodies are SCCs and *IN* nodes whose bodies are not part of any SCC. In this impelmentation, pi-blocks are only created for *recurrences*. *IN* nodes remain as simple DDG nodes in the graph. + 3. The paper describes two types of pi-blocks; *recurrences* whose bodies are SCCs and *IN* nodes whose bodies are not part of any SCC. In this implementation, pi-blocks are only created for *recurrences*. *IN* nodes remain as simple DDG nodes in the graph. References diff --git a/llvm/docs/DeveloperPolicy.rst b/llvm/docs/DeveloperPolicy.rst index b31ef42c15db71..c4d0ceb73c8e91 100644 --- a/llvm/docs/DeveloperPolicy.rst +++ b/llvm/docs/DeveloperPolicy.rst @@ -384,8 +384,8 @@ after they are committed, depending on the nature of the change). You are encouraged to review other peoples' patches as well, but you aren't required to do so. -Current Contributors - Transfering from SVN -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Current Contributors - Transferring from SVN +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you had commit access to SVN and would like to request commit access to GitHub, please email `llvm-admin `_ with your SVN username and GitHub username. @@ -744,7 +744,7 @@ OpenMP, etc), Polly, and all other subprojects. There are a few exceptions: is used by LLVM. * Some subprojects are impractical or uninteresting to relicense (e.g. llvm-gcc and dragonegg). These will be split off from the LLVM project (e.g. to - separate Github projects), allowing interested people to continue their + separate GitHub projects), allowing interested people to continue their development elsewhere. To relicense LLVM, we will be seeking approval from all of the copyright holders @@ -875,7 +875,7 @@ holds though):: Q2: If at any time after my contribution, I am able to license other patent claims that would have been subject to Apache's Grant of Patent License if - they were licenseable by me at the time of my contribution, do those other + they were licensable by me at the time of my contribution, do those other claims become subject to the Grant of Patent License? A2: Yes. diff --git a/llvm/docs/Extensions.rst b/llvm/docs/Extensions.rst index e6f7fdd50447bb..4062d2088fec2c 100644 --- a/llvm/docs/Extensions.rst +++ b/llvm/docs/Extensions.rst @@ -213,7 +213,7 @@ ELF-Dependent ^^^^^^^^^^^^^^^^^^^^^^ In order to support creating multiple sections with the same name and comdat, -it is possible to add an unique number at the end of the ``.seciton`` directive. +it is possible to add an unique number at the end of the ``.section`` directive. For example, the following code creates two sections named ``.text``. .. code-block:: gas diff --git a/llvm/docs/Frontend/PerformanceTips.rst b/llvm/docs/Frontend/PerformanceTips.rst index f0f63f3f9d6b70..7873087a14f02c 100644 --- a/llvm/docs/Frontend/PerformanceTips.rst +++ b/llvm/docs/Frontend/PerformanceTips.rst @@ -255,7 +255,7 @@ couple specific suggestions: #. For languages with numerous rarely executed guard conditions (e.g. null checks, type checks, range checks) consider adding an extra execution or - two of LoopUnswith and LICM to your pass order. The standard pass order, + two of LoopUnswitch and LICM to your pass order. The standard pass order, which is tuned for C and C++ applications, may not be sufficient to remove all dischargeable checks from loops. diff --git a/llvm/docs/FuzzingLLVM.rst b/llvm/docs/FuzzingLLVM.rst index ab4b9b557cde4d..e471020aab7615 100644 --- a/llvm/docs/FuzzingLLVM.rst +++ b/llvm/docs/FuzzingLLVM.rst @@ -106,7 +106,7 @@ llvm-opt-fuzzer A |LLVM IR fuzzer| aimed at finding bugs in optimization passes. -It receives optimzation pipeline and runs it for each fuzzer input. +It receives optimization pipeline and runs it for each fuzzer input. Interface of this fuzzer almost directly mirrors ``llvm-isel-fuzzer``. Both ``mtriple`` and ``passes`` arguments are required. Passes are specified in a diff --git a/llvm/docs/GettingStarted.rst b/llvm/docs/GettingStarted.rst index 35c021ee3209bc..8a5476fd924f84 100644 --- a/llvm/docs/GettingStarted.rst +++ b/llvm/docs/GettingStarted.rst @@ -599,7 +599,7 @@ used by people developing LLVM. | | overridden with ``LLVM_DYLIB_COMPONENTS``. The | | | default contains most of LLVM and is defined in | | | ``tools/llvm-shlib/CMakelists.txt``. This option is| -| | not avialable on Windows. | +| | not available on Windows. | +-------------------------+----------------------------------------------------+ | LLVM_OPTIMIZED_TABLEGEN | Builds a release tablegen that gets used during | | | the LLVM build. This can dramatically speed up | diff --git a/llvm/docs/GlobalISel/GenericOpcode.rst b/llvm/docs/GlobalISel/GenericOpcode.rst index 5cc1023db235c5..3c083a523a6123 100644 --- a/llvm/docs/GlobalISel/GenericOpcode.rst +++ b/llvm/docs/GlobalISel/GenericOpcode.rst @@ -633,7 +633,7 @@ G_INTRINSIC, G_INTRINSIC_W_SIDE_EFFECTS Call an intrinsic The _W_SIDE_EFFECTS version is considered to have unknown side-effects and -as such cannot be reordered acrosss other side-effecting instructions. +as such cannot be reordered across other side-effecting instructions. .. note:: diff --git a/llvm/docs/GwpAsan.rst b/llvm/docs/GwpAsan.rst index 67193bfe001f8c..647c2a038a5a9c 100644 --- a/llvm/docs/GwpAsan.rst +++ b/llvm/docs/GwpAsan.rst @@ -55,7 +55,7 @@ Allocator Support GWP-ASan is not a replacement for a traditional allocator. Instead, it works by inserting stubs into a supporting allocator to redirect allocations to GWP-ASan when they're chosen to be sampled. These stubs are generally implemented in the -implementaion of ``malloc()``, ``free()`` and ``realloc()``. The stubs are +implementation of ``malloc()``, ``free()`` and ``realloc()``. The stubs are extremely small, which makes using GWP-ASan in most allocators fairly trivial. The stubs follow the same general pattern (example ``malloc()`` pseudocode below): diff --git a/llvm/docs/HowToBuildOnARM.rst b/llvm/docs/HowToBuildOnARM.rst index 356c846d82bc94..f28f8b3ae2d509 100644 --- a/llvm/docs/HowToBuildOnARM.rst +++ b/llvm/docs/HowToBuildOnARM.rst @@ -22,7 +22,7 @@ on the ARMv6 and ARMv7 architectures and may be inapplicable to older chips. Pandaboard, have become hard-float platforms. There are a number of choices when using CMake. Autoconf usage is deprecated as of 3.8. - Building LLVM/Clang in ``Relese`` mode is preferred since it consumes + Building LLVM/Clang in ``Release`` mode is preferred since it consumes a lot less memory. Otherwise, the building process will very likely fail due to insufficient memory. It's also a lot quicker to only build the relevant back-ends (ARM and AArch64), since it's very unlikely that @@ -42,7 +42,7 @@ on the ARMv6 and ARMv7 architectures and may be inapplicable to older chips. Use Ninja instead of Make: "-G Ninja" Build with assertions on: "-DLLVM_ENABLE_ASSERTIONS=True" Force Python2: "-DPYTHON_EXECUTABLE=/usr/bin/python2" - Local (non-sudo) install path: "-DCMAKE_INSTALL_PREFIX=$HOME/llvm/instal" + Local (non-sudo) install path: "-DCMAKE_INSTALL_PREFIX=$HOME/llvm/install" CPU flags: "DCMAKE_C_FLAGS=-mcpu=cortex-a15" (same for CXX_FLAGS) After that, just typing ``make -jN`` or ``ninja`` will build everything. diff --git a/llvm/docs/HowToCrossCompileBuiltinsOnArm.rst b/llvm/docs/HowToCrossCompileBuiltinsOnArm.rst index 6ad93c773b2575..72dfea4eb687ec 100644 --- a/llvm/docs/HowToCrossCompileBuiltinsOnArm.rst +++ b/llvm/docs/HowToCrossCompileBuiltinsOnArm.rst @@ -43,7 +43,7 @@ compiler-rt must be placed in the runtimes directory. ``qemu-arm`` should be available as a package for your Linux distribution. -The most complicated of the prequisites to satisfy is the arm-linux-gnueabihf +The most complicated of the prerequisites to satisfy is the arm-linux-gnueabihf sysroot. In theory it is possible to use the Linux distributions multiarch support to fulfill the dependencies for building but unfortunately due to /usr/local/include being added some host includes are selected. The easiest way diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index ce1fb17cbac523..90744000682885 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -4866,9 +4866,9 @@ refines this address to produce a concrete location for the source variable. A ``llvm.dbg.value`` intrinsic describes the direct value of a source variable. The first operand of the intrinsic may be a direct or indirect value. A -DIExpresion attached to the intrinsic refines the first operand to produce a +DIExpression attached to the intrinsic refines the first operand to produce a direct value. For example, if the first operand is an indirect value, it may be -necessary to insert ``DW_OP_deref`` into the DIExpresion in order to produce a +necessary to insert ``DW_OP_deref`` into the DIExpression in order to produce a valid debug intrinsic. .. note:: @@ -6349,7 +6349,7 @@ The list is encoded in the IR using named metadata with the name ``!llvm.dependent-libraries``. Each operand is expected to be a metadata node which should contain a single string operand. -For example, the following metadata section contains two library specfiers:: +For example, the following metadata section contains two library specifiers:: !0 = !{!"a library specifier"} !1 = !{!"another library specifier"} @@ -15138,7 +15138,7 @@ This is an overloaded intrinsic. Several values of integer, floating point or po Overview: """"""""" -Reads a number of scalar values sequentially from memory location provided in '``ptr``' and spreads them in a vector. The '``mask``' holds a bit for each vector lane. The number of elements read from memory is equal to the number of '1' bits in the mask. The loaded elements are positioned in the destination vector according to the sequence of '1' and '0' bits in the mask. E.g., if the mask vector is '10010001', "explandload" reads 3 values from memory addresses ptr, ptr+1, ptr+2 and places them in lanes 0, 3 and 7 accordingly. The masked-off lanes are filled by elements from the corresponding lanes of the '``passthru``' operand. +Reads a number of scalar values sequentially from memory location provided in '``ptr``' and spreads them in a vector. The '``mask``' holds a bit for each vector lane. The number of elements read from memory is equal to the number of '1' bits in the mask. The loaded elements are positioned in the destination vector according to the sequence of '1' and '0' bits in the mask. E.g., if the mask vector is '10010001', "expandload" reads 3 values from memory addresses ptr, ptr+1, ptr+2 and places them in lanes 0, 3 and 7 accordingly. The masked-off lanes are filled by elements from the corresponding lanes of the '``passthru``' operand. Arguments: diff --git a/llvm/docs/LibFuzzer.rst b/llvm/docs/LibFuzzer.rst index 9ab013e721e1d4..8196bc52e90bff 100644 --- a/llvm/docs/LibFuzzer.rst +++ b/llvm/docs/LibFuzzer.rst @@ -287,7 +287,7 @@ The most important command line options are: that trigger new code coverage will be merged into the first corpus directory. Defaults to 0. This flag can be used to minimize a corpus. ``-merge_control_file`` - Specify a control file used for the merge proccess. + Specify a control file used for the merge process. If a merge process gets killed it tries to leave this file in a state suitable for resuming the merge. By default a temporary file will be used. ``-minimize_crash`` @@ -515,7 +515,7 @@ and extra run-time flag ``-use_value_profile=1`` the fuzzer will collect value profiles for the parameters of compare instructions and treat some new values as new coverage. -The current imlpementation does roughly the following: +The current implementation does roughly the following: * The compiler instruments all CMP instructions with a callback that receives both CMP arguments. * The callback computes `(caller_pc&4095) | (popcnt(Arg1 ^ Arg2) << 12)` and uses this value to set a bit in a bitset. diff --git a/llvm/docs/MarkedUpDisassembly.rst b/llvm/docs/MarkedUpDisassembly.rst index df8befe45cd0d8..05feee158e1284 100644 --- a/llvm/docs/MarkedUpDisassembly.rst +++ b/llvm/docs/MarkedUpDisassembly.rst @@ -41,7 +41,7 @@ Instruction Annotations Contextual markups ------------------ -Annoated assembly display will supply contextual markup to help clients more +Annotated assembly display will supply contextual markup to help clients more efficiently implement things like pretty printers. Most markup will be target independent, so clients can effectively provide good display without any target specific knowledge. diff --git a/llvm/docs/MemTagSanitizer.rst b/llvm/docs/MemTagSanitizer.rst index a27370368b463f..988c11b69bf618 100644 --- a/llvm/docs/MemTagSanitizer.rst +++ b/llvm/docs/MemTagSanitizer.rst @@ -37,7 +37,7 @@ Implementation ============== See `HardwareAssistedAddressSanitizer`_ for a general overview of a -tag-based approach to memory safety. MemTagSanitizer followes a +tag-based approach to memory safety. MemTagSanitizer follows a similar implementation strategy, but with the tag storage (shadow) provided by the hardware. diff --git a/llvm/docs/ORCv2.rst b/llvm/docs/ORCv2.rst index 488ce262ee306d..d1faaaa8fde6ba 100644 --- a/llvm/docs/ORCv2.rst +++ b/llvm/docs/ORCv2.rst @@ -124,7 +124,7 @@ module ``M`` loaded on a ThreadSafeContext ``Ctx``: // Call into JIT'd code. Entry(); -The builder clasess provide a number of configuration options that can be +The builder classes provide a number of configuration options that can be specified before the JIT instance is constructed. For example: .. code-block:: c++ @@ -483,7 +483,7 @@ to be aware of: references are resolved, and symbol resolvers are no longer used. See the section `Design Overview`_ for more details. - Unless multiple JITDylibs are needed to model linkage relationsips, ORCv1 + Unless multiple JITDylibs are needed to model linkage relationships, ORCv1 clients should place all code in the main JITDylib (returned by ``ExecutionSession::getMainJITDylib()``). MCJIT clients should use LLJIT (see `LLJIT and LLLazyJIT`_). diff --git a/llvm/docs/ProgrammersManual.rst b/llvm/docs/ProgrammersManual.rst index a96f8b4b714ca5..e4fb8615d75902 100644 --- a/llvm/docs/ProgrammersManual.rst +++ b/llvm/docs/ProgrammersManual.rst @@ -2996,7 +2996,7 @@ proper operation in multithreaded mode. Note that, on Unix-like platforms, LLVM requires the presence of GCC's atomic intrinsics in order to support threaded operation. If you need a -multhreading-capable LLVM on a platform without a suitably modern system +multithreading-capable LLVM on a platform without a suitably modern system compiler, consider compiling LLVM and LLVM-GCC in single-threaded mode, and using the resultant compiler to build a copy of LLVM with multithreading support. @@ -3307,7 +3307,7 @@ place the ``vptr`` in the first word of the instances.) .. _polymorphism: -Designing Type Hiercharies and Polymorphic Interfaces +Designing Type Hierarchies and Polymorphic Interfaces ----------------------------------------------------- There are two different design patterns that tend to result in the use of @@ -3351,7 +3351,7 @@ by Sean Parent in several of his talks and papers: describing this technique in more detail. #. `Sean Parent's Papers and Presentations `_ - - A Github project full of links to slides, video, and sometimes code. + - A GitHub project full of links to slides, video, and sometimes code. When deciding between creating a type hierarchy (with either tagged or virtual dispatch) and using templates or concepts-based polymorphism, consider whether @@ -3400,7 +3400,7 @@ The Core LLVM Class Hierarchy Reference header source: `Type.h `_ -doxygen info: `Type Clases `_ +doxygen info: `Type Classes `_ The Core LLVM classes are the primary means of representing the program being inspected or transformed. The core LLVM classes are defined in header files in diff --git a/llvm/docs/Proposals/GitHubMove.rst b/llvm/docs/Proposals/GitHubMove.rst index ed46f5ae199f6d..ae799b57af7956 100644 --- a/llvm/docs/Proposals/GitHubMove.rst +++ b/llvm/docs/Proposals/GitHubMove.rst @@ -202,14 +202,14 @@ Step #4 : Post Move 14. Update links on the LLVM website pointing to viewvc/klaus/phab etc. to point to GitHub instead. -Github Repository Description +GitHub Repository Description ============================= Monorepo ---------------- The LLVM git repository hosted at https://github.com/llvm/llvm-project contains all -sub-projects in a single source tree. It is often refered to as a monorepo and +sub-projects in a single source tree. It is often referred to as a monorepo and mimics an export of the current SVN repository, with each sub-project having its own top-level directory. Not all sub-projects are used for building toolchains. For example, www/ and test-suite/ are not part of the monorepo. @@ -281,7 +281,7 @@ Monorepo Drawbacks 1GB for the monorepo), and the commit rate of LLVM may cause more frequent `git push` collisions when upstreaming. Affected contributors may be able to use the SVN bridge or the single-subproject Git mirrors. However, it's - undecided if these projects will continue to be mantained. + undecided if these projects will continue to be maintained. * Using the monolithic repository may add overhead for those *integrating* a standalone sub-project, even if they aren't contributing to it, due to the same disk space concern as the point above. The availability of the @@ -356,7 +356,7 @@ Before you push, you'll need to fetch and rebase (`git pull --rebase`) as usual. Note that when you fetch you'll likely pull in changes to sub-projects you don't -care about. If you are using spasre checkout, the files from other projects +care about. If you are using sparse checkout, the files from other projects won't appear on your disk. The only effect is that your commit hash changes. You can check whether the changes in the last fetch are relevant to your commit @@ -657,7 +657,7 @@ done for each branch. Ref paths will need to be updated to map the local branch to the corresponding upstream branch. If local branches have no corresponding upstream branch, then the creation of ``local/octopus/`` need not use ``git-merge-base`` to -pinpont its root commit; it may simply be branched from the +pinpoint its root commit; it may simply be branched from the appropriate component branch (say, ``llvm/local_release_X``). Zipping local history @@ -812,7 +812,7 @@ The tool handles nested submodules (e.g. llvm is a submodule in umbrella and clang is a submodule in llvm). The file ``submodule-map.txt`` is a list of pairs, one per line. The first pair item describes the path to a submodule in the umbrella -repository. The second pair item secribes the path where trees for +repository. The second pair item describes the path where trees for that submodule should be written in the zipped history. Let's say your umbrella repository is actually the llvm repository and @@ -945,7 +945,7 @@ getting them into the monorepo. A recipe follows:: --tag-prefix="myrepo-" ) - # Preserve release braches. + # Preserve release branches. for ref in $(git -C my-monorepo for-each-ref --format="%(refname)" \ refs/remotes/myrepo/release); do branch=${ref#refs/remotes/myrepo/} diff --git a/llvm/docs/Proposals/TestSuite.rst b/llvm/docs/Proposals/TestSuite.rst index 85f3642a2e922c..29507495c11685 100644 --- a/llvm/docs/Proposals/TestSuite.rst +++ b/llvm/docs/Proposals/TestSuite.rst @@ -1,5 +1,5 @@ ===================== -Test-Suite Extentions +Test-Suite Extensions ===================== .. contents:: @@ -191,7 +191,7 @@ CORAL-2 Benchmarks ------------------ https://asc.llnl.gov/coral-2-benchmarks/ -Many of its programs have already been integreated in +Many of its programs have already been integrated in MultiSource/Benchmarks/DOE-ProxyApps-C and MultiSource/Benchmarks/DOE-ProxyApps-C++. diff --git a/llvm/docs/Proposals/VariableNames.rst b/llvm/docs/Proposals/VariableNames.rst index 3e07fc5606de5a..1739695a5185f4 100644 --- a/llvm/docs/Proposals/VariableNames.rst +++ b/llvm/docs/Proposals/VariableNames.rst @@ -153,7 +153,7 @@ TargetRegisterInfo tri In some cases renaming acronyms to the full type name will result in overly verbose code. Unlike most classes, a variable's scope is limited and therefore some of its purpose can implied from that scope, meaning that fewer words are -necessary to give it a clear name. For example, in an optization pass the reader +necessary to give it a clear name. For example, in an optimization pass the reader can assume that a variable's purpose relates to optimization and therefore an ``OptimizationRemarkEmitter`` variable could be given the name ``remarkEmitter`` or even ``remarker``. diff --git a/llvm/docs/ReleaseProcess.rst b/llvm/docs/ReleaseProcess.rst index 0cd455fdb79a6e..6a14e28d189a8b 100644 --- a/llvm/docs/ReleaseProcess.rst +++ b/llvm/docs/ReleaseProcess.rst @@ -204,7 +204,7 @@ and that will be the official binary. * Rename (or link) ``clang+llvm-REL-ARCH-ENV`` to the .install directory -* Tar that into the same name with ``.tar.gz`` extensioan from outside the +* Tar that into the same name with ``.tar.gz`` extension from outside the directory * Make it available for the release manager to download diff --git a/llvm/docs/ReportingGuide.rst b/llvm/docs/ReportingGuide.rst index f7ecbb38d45e40..ad2a035e86473c 100644 --- a/llvm/docs/ReportingGuide.rst +++ b/llvm/docs/ReportingGuide.rst @@ -102,7 +102,7 @@ appropriateness of our response, but we don't guarantee we'll act on it. After any incident, the advisory committee will make a report on the situation to the LLVM Foundation board. The board may choose to make a public statement about the incident. If that's the case, the identities of anyone involved will -remain confidential unless instructed by those inviduals otherwise. +remain confidential unless instructed by those individuals otherwise. Appealing ========= @@ -114,7 +114,7 @@ the case. In general, it is **not** appropriate to appeal a particular decision on a public mailing list. Doing so would involve disclosure of information which -whould be confidential. Disclosing this kind of information publicly may be +would be confidential. Disclosing this kind of information publicly may be considered a separate and (potentially) more serious violation of the Code of Conduct. This is not meant to limit discussion of the Code of Conduct, the advisory board itself, or the appropriateness of responses in general, but diff --git a/llvm/docs/SourceLevelDebugging.rst b/llvm/docs/SourceLevelDebugging.rst index f6db104a0755ba..3be01eeb795cf3 100644 --- a/llvm/docs/SourceLevelDebugging.rst +++ b/llvm/docs/SourceLevelDebugging.rst @@ -1006,13 +1006,13 @@ Given a class declaration with copy constructor declared as deleted: foo(const foo&) = deleted; }; -A C++ frontend would generate follwing: +A C++ frontend would generate following: .. code-block:: text !17 = !DISubprogram(name: "foo", scope: !11, file: !1, line: 5, type: !18, scopeLine: 5, flags: DIFlagPublic | DIFlagPrototyped, spFlags: DISPFlagDeleted) -and this will produce an additional DWARF attibute as: +and this will produce an additional DWARF attribute as: .. code-block:: text @@ -2107,7 +2107,7 @@ The most straightforward way to use ``debugify`` is as follows:: This will inject synthetic DI to ``sample.ll`` run the ``pass-to-test`` and then check for missing DI. -Some other ways to run debugify are avaliable: +Some other ways to run debugify are available: .. code-block:: bash diff --git a/llvm/docs/TableGen/LangRef.rst b/llvm/docs/TableGen/LangRef.rst index 74af1ee659f5b6..d7b869a9f8a87b 100644 --- a/llvm/docs/TableGen/LangRef.rst +++ b/llvm/docs/TableGen/LangRef.rst @@ -142,7 +142,7 @@ values can be used in the class body. A given class can only be defined once. A ``class`` declaration is considered to define the class if any of the following is true: -.. break ObjectBody into its consituents so that they are present here? +.. break ObjectBody into its constituents so that they are present here? #. The :token:`TemplateArgList` is present. #. The :token:`Body` in the :token:`ObjectBody` is present and is not empty. diff --git a/llvm/docs/TransformMetadata.rst b/llvm/docs/TransformMetadata.rst index 68649424b717c0..817b41b43711d1 100644 --- a/llvm/docs/TransformMetadata.rst +++ b/llvm/docs/TransformMetadata.rst @@ -343,7 +343,7 @@ all of the aforementioned output loops. It is recommended to add ``llvm.loop.disable_nonforced`` to ``llvm.loop.distribute.followup_fallback``. This avoids that the -fallback version (which is likely never executed) is further optimzed +fallback version (which is likely never executed) is further optimized which would increase the code size. Versioning LICM diff --git a/llvm/docs/XRayFDRFormat.rst b/llvm/docs/XRayFDRFormat.rst index 46f72c54228b6a..eb11a3c8fb8832 100644 --- a/llvm/docs/XRayFDRFormat.rst +++ b/llvm/docs/XRayFDRFormat.rst @@ -28,7 +28,7 @@ Each trace file corresponds to a sequence of events in a particular thread. The file has a header followed by a sequence of discriminated record types. -The endianness of byte fields matches the endianess of the platform which +The endianness of byte fields matches the endianness of the platform which produced the trace file. diff --git a/llvm/docs/YamlIO.rst b/llvm/docs/YamlIO.rst index ac4f8d183220cc..561e06985c7a27 100644 --- a/llvm/docs/YamlIO.rst +++ b/llvm/docs/YamlIO.rst @@ -730,7 +730,7 @@ The YAML syntax supports tags as a way to specify the type of a node before it is parsed. This allows dynamic types of nodes. But the YAML I/O model uses static typing, so there are limits to how you can use tags with the YAML I/O model. Recently, we added support to YAML I/O for checking/setting the optional -tag on a map. Using this functionality it is even possbile to support different +tag on a map. Using this functionality it is even possible to support different mappings, as long as they are convertible. To check a tag, inside your mapping() method you can use io.mapTag() to specify diff --git a/llvm/docs/tutorial/BuildingAJIT1.rst b/llvm/docs/tutorial/BuildingAJIT1.rst index 00ad94aa08ac57..5c711fcba141f1 100644 --- a/llvm/docs/tutorial/BuildingAJIT1.rst +++ b/llvm/docs/tutorial/BuildingAJIT1.rst @@ -174,7 +174,7 @@ The ConcurrentIRCompiler utility will use the JITTargetMachineBuilder to build llvm TargetMachines (which are not thread safe) as needed for compiles. After this, we initialize our supporting members: ``DL``, ``Mangler`` and ``Ctx`` with the input DataLayout, the ExecutionSession and DL member, and a new default -constucted LLVMContext respectively. Now that our members have been initialized, +constructed LLVMContext respectively. Now that our members have been initialized, so the one thing that remains to do is to tweak the configuration of the *JITDylib* that we will store our code in. We want to modify this dylib to contain not only the symbols that we add to it, but also the symbols from our @@ -204,7 +204,7 @@ REPL process as well. We do this by attaching a Next we have a named constructor, ``Create``, which will build a KaleidoscopeJIT instance that is configured to generate code for our host process. It does this -by first generating a JITTargetMachineBuilder instance using that clases's +by first generating a JITTargetMachineBuilder instance using that classes' detectHost method and then using that instance to generate a datalayout for the target process. Each of these operations can fail, so each returns its result wrapped in an Expected value [3]_ that we must check for error before @@ -320,4 +320,4 @@ Here is the code: +-----------------------------+-----------------------------------------------+ .. [3] See the ErrorHandling section in the LLVM Programmer's Manual - (http://llvm.org/docs/ProgrammersManual.html#error-handling) \ No newline at end of file + (http://llvm.org/docs/ProgrammersManual.html#error-handling) diff --git a/llvm/docs/tutorial/BuildingAJIT2.rst b/llvm/docs/tutorial/BuildingAJIT2.rst index 1f818d94566495..f1dc0aa7f4e9d8 100644 --- a/llvm/docs/tutorial/BuildingAJIT2.rst +++ b/llvm/docs/tutorial/BuildingAJIT2.rst @@ -170,7 +170,7 @@ can be implemented. TransformFunction Transform; }; - // From IRTransfomrLayer.cpp: + // From IRTransformLayer.cpp: IRTransformLayer::IRTransformLayer(ExecutionSession &ES, IRLayer &BaseLayer, diff --git a/llvm/docs/tutorial/OCamlLangImpl3.rst b/llvm/docs/tutorial/OCamlLangImpl3.rst index a76b46d1bf6b31..fb0648928caa40 100644 --- a/llvm/docs/tutorial/OCamlLangImpl3.rst +++ b/llvm/docs/tutorial/OCamlLangImpl3.rst @@ -59,7 +59,7 @@ parser, which will be used to report errors found during code generation let double_type = double_type context The static variables will be used during code generation. -``Codgen.the_module`` is the LLVM construct that contains all of the +``Codegen.the_module`` is the LLVM construct that contains all of the functions and global variables in a chunk of code. In many ways, it is the top-level structure that the LLVM IR uses to contain code. @@ -78,7 +78,7 @@ function body. With these basics in place, we can start talking about how to generate code for each expression. Note that this assumes that the -``Codgen.builder`` has been set up to generate code *into* something. +``Codegen.builder`` has been set up to generate code *into* something. For now, we'll assume that this has already been done, and we'll just use it to emit code. diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h index 020b72c23947a0..b7404baf1ff0c0 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h @@ -45,7 +45,8 @@ class KaleidoscopeJIT { KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL) : ObjectLayer(ES, []() { return std::make_unique(); }), - CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))), + CompileLayer(ES, ObjectLayer, + std::make_unique(std::move(JTMB))), DL(std::move(DL)), Mangle(ES, this->DL), Ctx(std::make_unique()), MainJD(ES.createJITDylib("
")) { diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h index c8f01c04cf5f0b..efb19349e3e1dc 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h @@ -51,7 +51,8 @@ class KaleidoscopeJIT { KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL) : ObjectLayer(ES, []() { return std::make_unique(); }), - CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))), + CompileLayer(ES, ObjectLayer, + std::make_unique(std::move(JTMB))), OptimizeLayer(ES, CompileLayer, optimizeModule), DL(std::move(DL)), Mangle(ES, this->DL), Ctx(std::make_unique()), MainJD(ES.createJITDylib("
")) { diff --git a/llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp b/llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp index f4cfb7403dbd7d..3828e0a5f82b37 100644 --- a/llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp +++ b/llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp @@ -104,7 +104,7 @@ class SpeculativeJIT { : ES(std::move(ES)), DL(std::move(DL)), MainJD(this->ES->createJITDylib("
")), LCTMgr(std::move(LCTMgr)), CompileLayer(*this->ES, ObjLayer, - ConcurrentIRCompiler(std::move(JTMB))), + std::make_unique(std::move(JTMB))), S(Imps, *this->ES), SpeculateLayer(*this->ES, CompileLayer, S, Mangle, BlockFreqQuery()), CODLayer(*this->ES, SpeculateLayer, *this->LCTMgr, diff --git a/llvm/include/llvm/Analysis/LegacyDivergenceAnalysis.h b/llvm/include/llvm/Analysis/LegacyDivergenceAnalysis.h index 0770093bcd48a0..0335599a976e42 100644 --- a/llvm/include/llvm/Analysis/LegacyDivergenceAnalysis.h +++ b/llvm/include/llvm/Analysis/LegacyDivergenceAnalysis.h @@ -54,7 +54,8 @@ class LegacyDivergenceAnalysis : public FunctionPass { private: // Whether analysis should be performed by GPUDivergenceAnalysis. - bool shouldUseGPUDivergenceAnalysis(const Function &F) const; + bool shouldUseGPUDivergenceAnalysis(const Function &F, + const TargetTransformInfo &TTI) const; // (optional) handle to new DivergenceAnalysis std::unique_ptr gpuDA; diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h index 5382d76813a715..8a1e720d77f6bb 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfo.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h @@ -342,6 +342,10 @@ class TargetTransformInfo { /// branches. bool hasBranchDivergence() const; + /// Return true if the target prefers to use GPU divergence analysis to + /// replace the legacy version. + bool useGPUDivergenceAnalysis() const; + /// Returns whether V is a source of divergence. /// /// This function provides the target-dependent information for @@ -1198,6 +1202,7 @@ class TargetTransformInfo::Concept { virtual int getUserCost(const User *U, ArrayRef Operands) = 0; virtual bool hasBranchDivergence() = 0; + virtual bool useGPUDivergenceAnalysis() = 0; virtual bool isSourceOfDivergence(const Value *V) = 0; virtual bool isAlwaysUniform(const Value *V) = 0; virtual unsigned getFlatAddressSpace() = 0; @@ -1452,6 +1457,7 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept { return Impl.getUserCost(U, Operands); } bool hasBranchDivergence() override { return Impl.hasBranchDivergence(); } + bool useGPUDivergenceAnalysis() override { return Impl.useGPUDivergenceAnalysis(); } bool isSourceOfDivergence(const Value *V) override { return Impl.isSourceOfDivergence(V); } diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h index ac0609e29270ee..eb35f457034765 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -152,6 +152,8 @@ class TargetTransformInfoImplBase { bool hasBranchDivergence() { return false; } + bool useGPUDivergenceAnalysis() { return false; } + bool isSourceOfDivergence(const Value *V) { return false; } bool isAlwaysUniform(const Value *V) { return false; } diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h index 30533d90bbf7f6..f0145387c5e1ed 100644 --- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h @@ -207,6 +207,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase { bool hasBranchDivergence() { return false; } + bool useGPUDivergenceAnalysis() { return false; } + bool isSourceOfDivergence(const Value *V) { return false; } bool isAlwaysUniform(const Value *V) { return false; } diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h b/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h index d44612f54ae558..8c7a7571942b35 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h @@ -31,9 +31,10 @@ class GISelKnownBits : public GISelChangeObserver { MachineRegisterInfo &MRI; const TargetLowering &TL; const DataLayout &DL; + unsigned MaxDepth; public: - GISelKnownBits(MachineFunction &MF); + GISelKnownBits(MachineFunction &MF, unsigned MaxDepth = 6); virtual ~GISelKnownBits() = default; void setMF(MachineFunction &MF); virtual void computeKnownBitsImpl(Register R, KnownBits &Known, @@ -82,7 +83,7 @@ class GISelKnownBits : public GISelChangeObserver { void changedInstr(MachineInstr &MI) override{}; protected: - unsigned getMaxDepth() const { return 6; } + unsigned getMaxDepth() const { return MaxDepth; } }; /// To use KnownBitsInfo analysis in a pass, diff --git a/llvm/include/llvm/CodeGen/TargetInstrInfo.h b/llvm/include/llvm/CodeGen/TargetInstrInfo.h index 536fd2489092c1..4d1dfe1b0c652b 100644 --- a/llvm/include/llvm/CodeGen/TargetInstrInfo.h +++ b/llvm/include/llvm/CodeGen/TargetInstrInfo.h @@ -838,15 +838,17 @@ class TargetInstrInfo : public MCInstrInfo { /// /// @param MBB Block where select instruction would be inserted. /// @param Cond Condition returned by analyzeBranch. + /// @param DstReg Virtual dest register that the result should write to. /// @param TrueReg Virtual register to select when Cond is true. /// @param FalseReg Virtual register to select when Cond is false. /// @param CondCycles Latency from Cond+Branch to select output. /// @param TrueCycles Latency from TrueReg to select output. /// @param FalseCycles Latency from FalseReg to select output. virtual bool canInsertSelect(const MachineBasicBlock &MBB, - ArrayRef Cond, unsigned TrueReg, - unsigned FalseReg, int &CondCycles, - int &TrueCycles, int &FalseCycles) const { + ArrayRef Cond, unsigned DstReg, + unsigned TrueReg, unsigned FalseReg, + int &CondCycles, int &TrueCycles, + int &FalseCycles) const { return false; } diff --git a/llvm/include/llvm/ExecutionEngine/Orc/CompileUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/CompileUtils.h index eb6d84e8cbb405..218afda1b5465e 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/CompileUtils.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/CompileUtils.h @@ -13,7 +13,9 @@ #ifndef LLVM_EXECUTIONENGINE_ORC_COMPILEUTILS_H #define LLVM_EXECUTIONENGINE_ORC_COMPILEUTILS_H +#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h" #include "llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h" +#include "llvm/ExecutionEngine/Orc/Layer.h" #include namespace llvm { @@ -28,24 +30,31 @@ namespace orc { class JITTargetMachineBuilder; +IRMaterializationUnit::ManglingOptions +irManglingOptionsFromTargetOptions(const TargetOptions &Opts); + /// Simple compile functor: Takes a single IR module and returns an ObjectFile. /// This compiler supports a single compilation thread and LLVMContext only. /// For multithreaded compilation, use ConcurrentIRCompiler below. -class SimpleCompiler { +class SimpleCompiler : public IRCompileLayer::IRCompiler { public: using CompileResult = std::unique_ptr; /// Construct a simple compile functor with the given target. SimpleCompiler(TargetMachine &TM, ObjectCache *ObjCache = nullptr) - : TM(TM), ObjCache(ObjCache) {} + : IRCompiler(irManglingOptionsFromTargetOptions(TM.Options)), TM(TM), + ObjCache(ObjCache) {} /// Set an ObjectCache to query before compiling. void setObjectCache(ObjectCache *NewCache) { ObjCache = NewCache; } /// Compile a Module to an ObjectFile. - CompileResult operator()(Module &M); + Expected operator()(Module &M) override; private: + IRMaterializationUnit::ManglingOptions + manglingOptionsForTargetMachine(const TargetMachine &TM); + CompileResult tryToLoadFromObjectCache(const Module &M); void notifyObjectCompiled(const Module &M, const MemoryBuffer &ObjBuffer); @@ -73,14 +82,14 @@ class TMOwningSimpleCompiler : public SimpleCompiler { /// /// This class creates a new TargetMachine and SimpleCompiler instance for each /// compile. -class ConcurrentIRCompiler { +class ConcurrentIRCompiler : public IRCompileLayer::IRCompiler { public: ConcurrentIRCompiler(JITTargetMachineBuilder JTMB, ObjectCache *ObjCache = nullptr); void setObjectCache(ObjectCache *ObjCache) { this->ObjCache = ObjCache; } - std::unique_ptr operator()(Module &M); + Expected> operator()(Module &M) override; private: JITTargetMachineBuilder JTMB; diff --git a/llvm/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h b/llvm/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h index 52223a83ad420b..bb8270fe80a3f0 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h @@ -29,14 +29,29 @@ namespace orc { class IRCompileLayer : public IRLayer { public: - using CompileFunction = - std::function>(Module &)>; + class IRCompiler { + public: + IRCompiler(IRMaterializationUnit::ManglingOptions MO) : MO(std::move(MO)) {} + virtual ~IRCompiler(); + const IRMaterializationUnit::ManglingOptions &getManglingOptions() const { + return MO; + } + virtual Expected> operator()(Module &M) = 0; + + protected: + IRMaterializationUnit::ManglingOptions &manglingOptions() { return MO; } + + private: + IRMaterializationUnit::ManglingOptions MO; + }; using NotifyCompiledFunction = std::function; IRCompileLayer(ExecutionSession &ES, ObjectLayer &BaseLayer, - CompileFunction Compile); + std::unique_ptr Compile); + + IRCompiler &getCompiler() { return *Compile; } void setNotifyCompiled(NotifyCompiledFunction NotifyCompiled); @@ -45,7 +60,8 @@ class IRCompileLayer : public IRLayer { private: mutable std::mutex IRLayerMutex; ObjectLayer &BaseLayer; - CompileFunction Compile; + std::unique_ptr Compile; + const IRMaterializationUnit::ManglingOptions *ManglingOpts; NotifyCompiledFunction NotifyCompiled = NotifyCompiledFunction(); }; @@ -90,7 +106,10 @@ class LegacyIRCompileLayer { /// Compile the module, and add the resulting object to the base layer /// along with the given memory manager and symbol resolver. Error addModule(VModuleKey K, std::unique_ptr M) { - if (auto Err = BaseLayer.addObject(std::move(K), Compile(*M))) + auto Obj = Compile(*M); + if (!Obj) + return Obj.takeError(); + if (auto Err = BaseLayer.addObject(std::move(K), std::move(*Obj))) return Err; if (NotifyCompiled) NotifyCompiled(std::move(K), std::move(M)); diff --git a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h index 209c598498b043..3374a29f04dff9 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h @@ -130,7 +130,7 @@ class LLJIT { static std::unique_ptr createObjectLinkingLayer(LLJITBuilderState &S, ExecutionSession &ES); - static Expected + static Expected> createCompileFunction(LLJITBuilderState &S, JITTargetMachineBuilder JTMB); /// Create an LLJIT instance with a single compile thread. @@ -193,7 +193,7 @@ class LLJITBuilderState { ExecutionSession &, const Triple &TT)>; using CompileFunctionCreator = - std::function( + std::function>( JITTargetMachineBuilder JTMB)>; std::unique_ptr ES; diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Layer.h b/llvm/include/llvm/ExecutionEngine/Orc/Layer.h index 8f9bd704395e62..95e32b2431a05b 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Layer.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Layer.h @@ -21,15 +21,62 @@ namespace llvm { namespace orc { +/// IRMaterializationUnit is a convenient base class for MaterializationUnits +/// wrapping LLVM IR. Represents materialization responsibility for all symbols +/// in the given module. If symbols are overridden by other definitions, then +/// their linkage is changed to available-externally. +class IRMaterializationUnit : public MaterializationUnit { +public: + struct ManglingOptions { + bool EmulatedTLS = false; + }; + + using SymbolNameToDefinitionMap = std::map; + + /// Create an IRMaterializationLayer. Scans the module to build the + /// SymbolFlags and SymbolToDefinition maps. + IRMaterializationUnit(ExecutionSession &ES, const ManglingOptions &MO, + ThreadSafeModule TSM, VModuleKey K); + + /// Create an IRMaterializationLayer from a module, and pre-existing + /// SymbolFlags and SymbolToDefinition maps. The maps must provide + /// entries for each definition in M. + /// This constructor is useful for delegating work from one + /// IRMaterializationUnit to another. + IRMaterializationUnit(ThreadSafeModule TSM, VModuleKey K, + SymbolFlagsMap SymbolFlags, + SymbolNameToDefinitionMap SymbolToDefinition); + + /// Return the ModuleIdentifier as the name for this MaterializationUnit. + StringRef getName() const override; + + const ThreadSafeModule &getModule() const { return TSM; } + +protected: + ThreadSafeModule TSM; + SymbolNameToDefinitionMap SymbolToDefinition; + +private: + void discard(const JITDylib &JD, const SymbolStringPtr &Name) override; +}; + /// Interface for layers that accept LLVM IR. class IRLayer { public: - IRLayer(ExecutionSession &ES); + IRLayer(ExecutionSession &ES, + const IRMaterializationUnit::ManglingOptions *&MO) + : ES(ES), MO(MO) {} + virtual ~IRLayer(); /// Returns the ExecutionSession for this layer. ExecutionSession &getExecutionSession() { return ES; } + /// Get the mangling options for this layer. + const IRMaterializationUnit::ManglingOptions *&getManglingOptions() const { + return MO; + } + /// Sets the CloneToNewContextOnEmit flag (false by default). /// /// When set, IR modules added to this layer will be cloned on to a new @@ -57,49 +104,15 @@ class IRLayer { private: bool CloneToNewContextOnEmit = false; ExecutionSession &ES; -}; - -/// IRMaterializationUnit is a convenient base class for MaterializationUnits -/// wrapping LLVM IR. Represents materialization responsibility for all symbols -/// in the given module. If symbols are overridden by other definitions, then -/// their linkage is changed to available-externally. -class IRMaterializationUnit : public MaterializationUnit { -public: - using SymbolNameToDefinitionMap = std::map; - - /// Create an IRMaterializationLayer. Scans the module to build the - /// SymbolFlags and SymbolToDefinition maps. - IRMaterializationUnit(ExecutionSession &ES, ThreadSafeModule TSM, - VModuleKey K); - - /// Create an IRMaterializationLayer from a module, and pre-existing - /// SymbolFlags and SymbolToDefinition maps. The maps must provide - /// entries for each definition in M. - /// This constructor is useful for delegating work from one - /// IRMaterializationUnit to another. - IRMaterializationUnit(ThreadSafeModule TSM, VModuleKey K, - SymbolFlagsMap SymbolFlags, - SymbolNameToDefinitionMap SymbolToDefinition); - - /// Return the ModuleIdentifier as the name for this MaterializationUnit. - StringRef getName() const override; - - const ThreadSafeModule &getModule() const { return TSM; } - -protected: - ThreadSafeModule TSM; - SymbolNameToDefinitionMap SymbolToDefinition; - -private: - void discard(const JITDylib &JD, const SymbolStringPtr &Name) override; + const IRMaterializationUnit::ManglingOptions *&MO; }; /// MaterializationUnit that materializes modules by calling the 'emit' method /// on the given IRLayer. class BasicIRLayerMaterializationUnit : public IRMaterializationUnit { public: - BasicIRLayerMaterializationUnit(IRLayer &L, VModuleKey K, - ThreadSafeModule TSM); + BasicIRLayerMaterializationUnit(IRLayer &L, const ManglingOptions &MO, + ThreadSafeModule TSM, VModuleKey K); private: diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h b/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h index f6b86bb231678c..97a3dc365457cc 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h @@ -182,8 +182,8 @@ class IRSpeculationLayer : public IRLayer { IRSpeculationLayer(ExecutionSession &ES, IRCompileLayer &BaseLayer, Speculator &Spec, MangleAndInterner &Mangle, ResultEval Interpreter) - : IRLayer(ES), NextLayer(BaseLayer), S(Spec), Mangle(Mangle), - QueryAnalysis(Interpreter) {} + : IRLayer(ES, BaseLayer.getManglingOptions()), NextLayer(BaseLayer), + S(Spec), Mangle(Mangle), QueryAnalysis(Interpreter) {} void emit(MaterializationResponsibility R, ThreadSafeModule TSM); diff --git a/llvm/include/llvm/Target/TargetMachine.h b/llvm/include/llvm/Target/TargetMachine.h index 176ae39b17a7cd..67afbee4681fae 100644 --- a/llvm/include/llvm/Target/TargetMachine.h +++ b/llvm/include/llvm/Target/TargetMachine.h @@ -361,11 +361,13 @@ class LLVMTargetMachine : public TargetMachine { raw_pwrite_stream *DwoOut, CodeGenFileType FileType, MCContext &Context); - /// True if the target uses physical regs at Prolog/Epilog insertion - /// time. If true (most machines), all vregs must be allocated before - /// PEI. If false (virtual-register machines), then callee-save register - /// spilling and scavenging are not needed or used. - virtual bool usesPhysRegsForPEI() const { return true; } + /// True if the target uses physical regs (as nearly all targets do). False + /// for stack machines such as WebAssembly and other virtual-register + /// machines. If true, all vregs must be allocated before PEI. If false, then + /// callee-save register spilling and scavenging are not needed or used. If + /// false, implicitly defined registers will still be assumed to be physical + /// registers, except that variadic defs will be allocated vregs. + virtual bool usesPhysRegsForValues() const { return true; } /// True if the target wants to use interprocedural register allocation by /// default. The -enable-ipra flag can be used to override this. diff --git a/llvm/lib/Analysis/LegacyDivergenceAnalysis.cpp b/llvm/lib/Analysis/LegacyDivergenceAnalysis.cpp index 0f274429f11fd7..10ead101920603 100644 --- a/llvm/lib/Analysis/LegacyDivergenceAnalysis.cpp +++ b/llvm/lib/Analysis/LegacyDivergenceAnalysis.cpp @@ -301,14 +301,13 @@ FunctionPass *llvm::createLegacyDivergenceAnalysisPass() { void LegacyDivergenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); AU.addRequired(); - if (UseGPUDA) - AU.addRequired(); + AU.addRequired(); AU.setPreservesAll(); } bool LegacyDivergenceAnalysis::shouldUseGPUDivergenceAnalysis( - const Function &F) const { - if (!UseGPUDA) + const Function &F, const TargetTransformInfo &TTI) const { + if (!(UseGPUDA || TTI.useGPUDivergenceAnalysis())) return false; // GPUDivergenceAnalysis requires a reducible CFG. @@ -337,7 +336,7 @@ bool LegacyDivergenceAnalysis::runOnFunction(Function &F) { auto &DT = getAnalysis().getDomTree(); auto &PDT = getAnalysis().getPostDomTree(); - if (shouldUseGPUDivergenceAnalysis(F)) { + if (shouldUseGPUDivergenceAnalysis(F, TTI)) { // run the new GPU divergence analysis auto &LI = getAnalysis().getLoopInfo(); gpuDA = std::make_unique(F, DT, PDT, LI, TTI); diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp index f2c63f789d8921..62c021435b33c3 100644 --- a/llvm/lib/Analysis/TargetTransformInfo.cpp +++ b/llvm/lib/Analysis/TargetTransformInfo.cpp @@ -212,6 +212,10 @@ bool TargetTransformInfo::hasBranchDivergence() const { return TTIImpl->hasBranchDivergence(); } +bool TargetTransformInfo::useGPUDivergenceAnalysis() const { + return TTIImpl->useGPUDivergenceAnalysis(); +} + bool TargetTransformInfo::isSourceOfDivergence(const Value *V) const { return TTIImpl->isSourceOfDivergence(V); } diff --git a/llvm/lib/CodeGen/EarlyIfConversion.cpp b/llvm/lib/CodeGen/EarlyIfConversion.cpp index fc31a9449e7288..a67072ce340eba 100644 --- a/llvm/lib/CodeGen/EarlyIfConversion.cpp +++ b/llvm/lib/CodeGen/EarlyIfConversion.cpp @@ -520,8 +520,9 @@ bool SSAIfConv::canConvertIf(MachineBasicBlock *MBB, bool Predicate) { assert(Register::isVirtualRegister(PI.FReg) && "Bad PHI"); // Get target information. - if (!TII->canInsertSelect(*Head, Cond, PI.TReg, PI.FReg, - PI.CondCycles, PI.TCycles, PI.FCycles)) { + if (!TII->canInsertSelect(*Head, Cond, PI.PHI->getOperand(0).getReg(), + PI.TReg, PI.FReg, PI.CondCycles, PI.TCycles, + PI.FCycles)) { LLVM_DEBUG(dbgs() << "Can't convert: " << *PI.PHI); return false; } diff --git a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp index 64023ecfad82ed..b970f34867989c 100644 --- a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp +++ b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp @@ -24,14 +24,12 @@ using namespace llvm; char llvm::GISelKnownBitsAnalysis::ID = 0; -INITIALIZE_PASS_BEGIN(GISelKnownBitsAnalysis, DEBUG_TYPE, - "Analysis for ComputingKnownBits", false, true) -INITIALIZE_PASS_END(GISelKnownBitsAnalysis, DEBUG_TYPE, - "Analysis for ComputingKnownBits", false, true) +INITIALIZE_PASS(GISelKnownBitsAnalysis, DEBUG_TYPE, + "Analysis for ComputingKnownBits", false, true) -GISelKnownBits::GISelKnownBits(MachineFunction &MF) +GISelKnownBits::GISelKnownBits(MachineFunction &MF, unsigned MaxDepth) : MF(MF), MRI(MF.getRegInfo()), TL(*MF.getSubtarget().getTargetLowering()), - DL(MF.getFunction().getParent()->getDataLayout()) {} + DL(MF.getFunction().getParent()->getDataLayout()), MaxDepth(MaxDepth) {} Align GISelKnownBits::inferAlignmentForFrameIdx(int FrameIdx, int Offset, const MachineFunction &MF) { diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index d583643ac68f7f..889d0261c7cee5 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -237,7 +237,7 @@ bool PEI::runOnMachineFunction(MachineFunction &MF) { stashEntryDbgValues(*SaveBlock, EntryDbgValues); // Handle CSR spilling and restoring, for targets that need it. - if (MF.getTarget().usesPhysRegsForPEI()) + if (MF.getTarget().usesPhysRegsForValues()) spillCalleeSavedRegs(MF); // Allow the target machine to make final modifications to the function diff --git a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp index c613c25406285f..02de072ea601a2 100644 --- a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp @@ -195,7 +195,10 @@ void InstrEmitter::CreateVirtualRegisters(SDNode *Node, "IMPLICIT_DEF should have been handled as a special case elsewhere!"); unsigned NumResults = CountResults(Node); - for (unsigned i = 0; i < II.getNumDefs(); ++i) { + bool HasVRegVariadicDefs = !MF->getTarget().usesPhysRegsForValues() && + II.isVariadic() && II.variadicOpsAreDefs(); + unsigned NumVRegs = HasVRegVariadicDefs ? NumResults : II.getNumDefs(); + for (unsigned i = 0; i < NumVRegs; ++i) { // If the specific node value is only used by a CopyToReg and the dest reg // is a vreg in the same register class, use the CopyToReg'd destination // register instead of creating a new vreg. @@ -216,7 +219,7 @@ void InstrEmitter::CreateVirtualRegisters(SDNode *Node, RC = VTRC; } - if (II.OpInfo[i].isOptionalDef()) { + if (II.OpInfo != nullptr && II.OpInfo[i].isOptionalDef()) { // Optional def must be a physical register. VRBase = cast(Node->getOperand(i-NumResults))->getReg(); assert(Register::isPhysicalRegister(VRBase)); @@ -828,7 +831,10 @@ EmitMachineNode(SDNode *Node, bool IsClone, bool IsCloned, unsigned NumImpUses = 0; unsigned NodeOperands = countOperands(Node, II.getNumOperands() - NumDefs, NumImpUses); - bool HasPhysRegOuts = NumResults > NumDefs && II.getImplicitDefs()!=nullptr; + bool HasVRegVariadicDefs = !MF->getTarget().usesPhysRegsForValues() && + II.isVariadic() && II.variadicOpsAreDefs(); + bool HasPhysRegOuts = NumResults > NumDefs && + II.getImplicitDefs() != nullptr && !HasVRegVariadicDefs; #ifndef NDEBUG unsigned NumMIOperands = NodeOperands + NumResults; if (II.isVariadic()) diff --git a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp index f26835ff8a0855..9c504da611e0da 100644 --- a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp +++ b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp @@ -67,9 +67,11 @@ namespace orc { class PartitioningIRMaterializationUnit : public IRMaterializationUnit { public: - PartitioningIRMaterializationUnit(ExecutionSession &ES, ThreadSafeModule TSM, - VModuleKey K, CompileOnDemandLayer &Parent) - : IRMaterializationUnit(ES, std::move(TSM), std::move(K)), + PartitioningIRMaterializationUnit(ExecutionSession &ES, + const ManglingOptions &MO, + ThreadSafeModule TSM, VModuleKey K, + CompileOnDemandLayer &Parent) + : IRMaterializationUnit(ES, MO, std::move(TSM), std::move(K)), Parent(Parent) {} PartitioningIRMaterializationUnit( @@ -111,7 +113,8 @@ CompileOnDemandLayer::compileWholeModule(GlobalValueSet Requested) { CompileOnDemandLayer::CompileOnDemandLayer( ExecutionSession &ES, IRLayer &BaseLayer, LazyCallThroughManager &LCTMgr, IndirectStubsManagerBuilder BuildIndirectStubsManager) - : IRLayer(ES), BaseLayer(BaseLayer), LCTMgr(LCTMgr), + : IRLayer(ES, BaseLayer.getManglingOptions()), BaseLayer(BaseLayer), + LCTMgr(LCTMgr), BuildIndirectStubsManager(std::move(BuildIndirectStubsManager)) {} void CompileOnDemandLayer::setPartitionFunction(PartitionFunction Partition) { @@ -136,27 +139,23 @@ void CompileOnDemandLayer::emit(MaterializationResponsibility R, TSM.withModuleDo([&](Module &M) { // First, do some cleanup on the module: cleanUpModule(M); - - MangleAndInterner Mangle(ES, M.getDataLayout()); - for (auto &GV : M.global_values()) { - if (GV.isDeclaration() || GV.hasLocalLinkage() || - GV.hasAppendingLinkage()) - continue; - - auto Name = Mangle(GV.getName()); - auto Flags = JITSymbolFlags::fromGlobalValue(GV); - if (Flags.isCallable()) - Callables[Name] = SymbolAliasMapEntry(Name, Flags); - else - NonCallables[Name] = SymbolAliasMapEntry(Name, Flags); - } }); + for (auto &KV : R.getSymbols()) { + auto &Name = KV.first; + auto &Flags = KV.second; + if (Flags.isCallable()) + Callables[Name] = SymbolAliasMapEntry(Name, Flags); + else + NonCallables[Name] = SymbolAliasMapEntry(Name, Flags); + } + // Create a partitioning materialization unit and lodge it with the // implementation dylib. if (auto Err = PDR.getImplDylib().define( std::make_unique( - ES, std::move(TSM), R.getVModuleKey(), *this))) { + ES, *getManglingOptions(), std::move(TSM), R.getVModuleKey(), + *this))) { ES.reportError(std::move(Err)); R.failMaterialization(); return; @@ -316,7 +315,7 @@ void CompileOnDemandLayer::emitPartition( } R.replace(std::make_unique( - ES, std::move(TSM), R.getVModuleKey(), *this)); + ES, *getManglingOptions(), std::move(TSM), R.getVModuleKey(), *this)); BaseLayer.emit(std::move(R), std::move(*ExtractedTSM)); } diff --git a/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp b/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp index f5671d90420a7c..160e5ba50311c4 100644 --- a/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp +++ b/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp @@ -24,11 +24,20 @@ namespace llvm { namespace orc { +IRMaterializationUnit::ManglingOptions +irManglingOptionsFromTargetOptions(const TargetOptions &Opts) { + IRMaterializationUnit::ManglingOptions MO; + + MO.EmulatedTLS = Opts.EmulatedTLS; + + return MO; +} + /// Compile a Module to an ObjectFile. -SimpleCompiler::CompileResult SimpleCompiler::operator()(Module &M) { +Expected SimpleCompiler::operator()(Module &M) { CompileResult CachedObject = tryToLoadFromObjectCache(M); if (CachedObject) - return CachedObject; + return std::move(CachedObject); SmallVector ObjBufferSV; @@ -38,7 +47,8 @@ SimpleCompiler::CompileResult SimpleCompiler::operator()(Module &M) { legacy::PassManager PM; MCContext *Ctx; if (TM.addPassesToEmitMC(PM, Ctx, ObjStream)) - llvm_unreachable("Target does not support MC emission."); + return make_error("Target does not support MC emission", + inconvertibleErrorCode()); PM.run(M); } @@ -47,14 +57,11 @@ SimpleCompiler::CompileResult SimpleCompiler::operator()(Module &M) { auto Obj = object::ObjectFile::createObjectFile(ObjBuffer->getMemBufferRef()); - if (Obj) { - notifyObjectCompiled(M, *ObjBuffer); - return std::move(ObjBuffer); - } + if (!Obj) + return Obj.takeError(); - // TODO: Actually report errors helpfully. - consumeError(Obj.takeError()); - return nullptr; + notifyObjectCompiled(M, *ObjBuffer); + return std::move(ObjBuffer); } SimpleCompiler::CompileResult @@ -73,9 +80,11 @@ void SimpleCompiler::notifyObjectCompiled(const Module &M, ConcurrentIRCompiler::ConcurrentIRCompiler(JITTargetMachineBuilder JTMB, ObjectCache *ObjCache) - : JTMB(std::move(JTMB)), ObjCache(ObjCache) {} + : IRCompiler(irManglingOptionsFromTargetOptions(JTMB.getOptions())), + JTMB(std::move(JTMB)), ObjCache(ObjCache) {} -std::unique_ptr ConcurrentIRCompiler::operator()(Module &M) { +Expected> +ConcurrentIRCompiler::operator()(Module &M) { auto TM = cantFail(JTMB.createTargetMachine()); SimpleCompiler C(*TM, ObjCache); return C(M); diff --git a/llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp b/llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp index d311f34179c7c0..023940dc829825 100644 --- a/llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp +++ b/llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp @@ -11,9 +11,14 @@ namespace llvm { namespace orc { +IRCompileLayer::IRCompiler::~IRCompiler() {} + IRCompileLayer::IRCompileLayer(ExecutionSession &ES, ObjectLayer &BaseLayer, - CompileFunction Compile) - : IRLayer(ES), BaseLayer(BaseLayer), Compile(std::move(Compile)) {} + std::unique_ptr Compile) + : IRLayer(ES, ManglingOpts), BaseLayer(BaseLayer), + Compile(std::move(Compile)) { + ManglingOpts = &this->Compile->getManglingOptions(); +} void IRCompileLayer::setNotifyCompiled(NotifyCompiledFunction NotifyCompiled) { std::lock_guard Lock(IRLayerMutex); @@ -24,7 +29,7 @@ void IRCompileLayer::emit(MaterializationResponsibility R, ThreadSafeModule TSM) { assert(TSM && "Module must not be null"); - if (auto Obj = TSM.withModuleDo(Compile)) { + if (auto Obj = TSM.withModuleDo(*Compile)) { { std::lock_guard Lock(IRLayerMutex); if (NotifyCompiled) diff --git a/llvm/lib/ExecutionEngine/Orc/IRTransformLayer.cpp b/llvm/lib/ExecutionEngine/Orc/IRTransformLayer.cpp index 845ecc71eb8708..511248f83b2592 100644 --- a/llvm/lib/ExecutionEngine/Orc/IRTransformLayer.cpp +++ b/llvm/lib/ExecutionEngine/Orc/IRTransformLayer.cpp @@ -12,10 +12,10 @@ namespace llvm { namespace orc { -IRTransformLayer::IRTransformLayer(ExecutionSession &ES, - IRLayer &BaseLayer, - TransformFunction Transform) - : IRLayer(ES), BaseLayer(BaseLayer), Transform(std::move(Transform)) {} +IRTransformLayer::IRTransformLayer(ExecutionSession &ES, IRLayer &BaseLayer, + TransformFunction Transform) + : IRLayer(ES, BaseLayer.getManglingOptions()), BaseLayer(BaseLayer), + Transform(std::move(Transform)) {} void IRTransformLayer::emit(MaterializationResponsibility R, ThreadSafeModule TSM) { diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp index 4ffcade975da37..f81e584b3b2dce 100644 --- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp +++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp @@ -107,7 +107,7 @@ LLJIT::createObjectLinkingLayer(LLJITBuilderState &S, ExecutionSession &ES) { return std::unique_ptr(std::move(ObjLinkingLayer)); } -Expected +Expected> LLJIT::createCompileFunction(LLJITBuilderState &S, JITTargetMachineBuilder JTMB) { @@ -118,13 +118,13 @@ LLJIT::createCompileFunction(LLJITBuilderState &S, // Otherwise default to creating a SimpleCompiler, or ConcurrentIRCompiler, // depending on the number of threads requested. if (S.NumCompileThreads > 0) - return ConcurrentIRCompiler(std::move(JTMB)); + return std::make_unique(std::move(JTMB)); auto TM = JTMB.createTargetMachine(); if (!TM) return TM.takeError(); - return TMOwningSimpleCompiler(std::move(*TM)); + return std::make_unique(std::move(*TM)); } LLJIT::LLJIT(LLJITBuilderState &S, Error &Err) diff --git a/llvm/lib/ExecutionEngine/Orc/Layer.cpp b/llvm/lib/ExecutionEngine/Orc/Layer.cpp index 580e2682ec8c60..ebc7801f11ffaa 100644 --- a/llvm/lib/ExecutionEngine/Orc/Layer.cpp +++ b/llvm/lib/ExecutionEngine/Orc/Layer.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "llvm/ExecutionEngine/Orc/Layer.h" +#include "llvm/IR/Constants.h" #include "llvm/Object/ObjectFile.h" #include "llvm/Support/Debug.h" @@ -15,15 +16,15 @@ namespace llvm { namespace orc { -IRLayer::IRLayer(ExecutionSession &ES) : ES(ES) {} IRLayer::~IRLayer() {} Error IRLayer::add(JITDylib &JD, ThreadSafeModule TSM, VModuleKey K) { return JD.define(std::make_unique( - *this, std::move(K), std::move(TSM))); + *this, *getManglingOptions(), std::move(TSM), std::move(K))); } IRMaterializationUnit::IRMaterializationUnit(ExecutionSession &ES, + const ManglingOptions &MO, ThreadSafeModule TSM, VModuleKey K) : MaterializationUnit(SymbolFlagsMap(), std::move(K)), TSM(std::move(TSM)) { @@ -32,12 +33,44 @@ IRMaterializationUnit::IRMaterializationUnit(ExecutionSession &ES, MangleAndInterner Mangle(ES, this->TSM.getModuleUnlocked()->getDataLayout()); this->TSM.withModuleDo([&](Module &M) { for (auto &G : M.global_values()) { - if (G.hasName() && !G.isDeclaration() && !G.hasLocalLinkage() && - !G.hasAvailableExternallyLinkage() && !G.hasAppendingLinkage()) { - auto MangledName = Mangle(G.getName()); - SymbolFlags[MangledName] = JITSymbolFlags::fromGlobalValue(G); - SymbolToDefinition[MangledName] = &G; + // Skip globals that don't generate symbols. + if (!G.hasName() || G.isDeclaration() || G.hasLocalLinkage() || + G.hasAvailableExternallyLinkage() || G.hasAppendingLinkage()) + continue; + + // thread locals generate different symbols depending on whether or not + // emulated TLS is enabled. + if (G.isThreadLocal() && MO.EmulatedTLS) { + auto &GV = cast(G); + + auto Flags = JITSymbolFlags::fromGlobalValue(GV); + + auto EmuTLSV = Mangle(("__emutls_v." + GV.getName()).str()); + SymbolFlags[EmuTLSV] = Flags; + SymbolToDefinition[EmuTLSV] = &GV; + + // If this GV has a non-zero initializer we'll need to emit an + // __emutls.t symbol too. + if (GV.hasInitializer()) { + const auto *InitVal = GV.getInitializer(); + + // Skip zero-initializers. + if (isa(InitVal)) + continue; + const auto *InitIntValue = dyn_cast(InitVal); + if (InitIntValue && InitIntValue->isZero()) + continue; + + auto EmuTLST = Mangle(("__emutls_t." + GV.getName()).str()); + SymbolFlags[EmuTLST] = Flags; + } + continue; } + + // Otherwise we just need a normal linker mangling. + auto MangledName = Mangle(G.getName()); + SymbolFlags[MangledName] = JITSymbolFlags::fromGlobalValue(G); + SymbolToDefinition[MangledName] = &G; } }); } @@ -72,8 +105,8 @@ void IRMaterializationUnit::discard(const JITDylib &JD, } BasicIRLayerMaterializationUnit::BasicIRLayerMaterializationUnit( - IRLayer &L, VModuleKey K, ThreadSafeModule TSM) - : IRMaterializationUnit(L.getExecutionSession(), std::move(TSM), + IRLayer &L, const ManglingOptions &MO, ThreadSafeModule TSM, VModuleKey K) + : IRMaterializationUnit(L.getExecutionSession(), MO, std::move(TSM), std::move(K)), L(L), K(std::move(K)) {} diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index cf9d08f6fc021c..8e2d49fbb9c854 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -729,6 +729,17 @@ MaybeAlign Value::getPointerAlignment(const DataLayout &DL) const { ConstantInt *CI = mdconst::extract(MD->getOperand(0)); return MaybeAlign(CI->getLimitedValue()); } + } else if (auto *CstPtr = dyn_cast(this)) { + if (auto *CstInt = dyn_cast_or_null(ConstantExpr::getPtrToInt( + const_cast(CstPtr), DL.getIntPtrType(getType()), + /*OnlyIfReduced=*/true))) { + size_t TrailingZeros = CstInt->getValue().countTrailingZeros(); + // While the actual alignment may be large, elsewhere we have + // an arbitrary upper alignmet limit, so let's clamp to it. + return Align(TrailingZeros < Value::MaxAlignmentExponent + ? uint64_t(1) << TrailingZeros + : Value::MaximumAlignment); + } } return llvm::None; } diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 050c37baefb87e..03f0bb1f705eb9 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -1439,25 +1439,26 @@ IEEEFloat::opStatus IEEEFloat::addOrSubtractSpecials(const IEEEFloat &rhs, default: llvm_unreachable(nullptr); + case PackCategoriesIntoKey(fcZero, fcNaN): + case PackCategoriesIntoKey(fcNormal, fcNaN): + case PackCategoriesIntoKey(fcInfinity, fcNaN): + assign(rhs); + LLVM_FALLTHROUGH; case PackCategoriesIntoKey(fcNaN, fcZero): case PackCategoriesIntoKey(fcNaN, fcNormal): case PackCategoriesIntoKey(fcNaN, fcInfinity): case PackCategoriesIntoKey(fcNaN, fcNaN): + if (isSignaling()) { + makeQuiet(); + return opInvalidOp; + } + return rhs.isSignaling() ? opInvalidOp : opOK; + case PackCategoriesIntoKey(fcNormal, fcZero): case PackCategoriesIntoKey(fcInfinity, fcNormal): case PackCategoriesIntoKey(fcInfinity, fcZero): return opOK; - case PackCategoriesIntoKey(fcZero, fcNaN): - case PackCategoriesIntoKey(fcNormal, fcNaN): - case PackCategoriesIntoKey(fcInfinity, fcNaN): - // We need to be sure to flip the sign here for subtraction because we - // don't have a separate negate operation so -NaN becomes 0 - NaN here. - sign = rhs.sign ^ subtract; - category = fcNaN; - copySignificand(rhs); - return opOK; - case PackCategoriesIntoKey(fcNormal, fcInfinity): case PackCategoriesIntoKey(fcZero, fcInfinity): category = fcInfinity; @@ -1562,20 +1563,22 @@ IEEEFloat::opStatus IEEEFloat::multiplySpecials(const IEEEFloat &rhs) { default: llvm_unreachable(nullptr); - case PackCategoriesIntoKey(fcNaN, fcZero): - case PackCategoriesIntoKey(fcNaN, fcNormal): - case PackCategoriesIntoKey(fcNaN, fcInfinity): - case PackCategoriesIntoKey(fcNaN, fcNaN): - sign = false; - return opOK; - case PackCategoriesIntoKey(fcZero, fcNaN): case PackCategoriesIntoKey(fcNormal, fcNaN): case PackCategoriesIntoKey(fcInfinity, fcNaN): + assign(rhs); sign = false; - category = fcNaN; - copySignificand(rhs); - return opOK; + LLVM_FALLTHROUGH; + case PackCategoriesIntoKey(fcNaN, fcZero): + case PackCategoriesIntoKey(fcNaN, fcNormal): + case PackCategoriesIntoKey(fcNaN, fcInfinity): + case PackCategoriesIntoKey(fcNaN, fcNaN): + sign ^= rhs.sign; // restore the original sign + if (isSignaling()) { + makeQuiet(); + return opInvalidOp; + } + return rhs.isSignaling() ? opInvalidOp : opOK; case PackCategoriesIntoKey(fcNormal, fcInfinity): case PackCategoriesIntoKey(fcInfinity, fcNormal): @@ -1607,15 +1610,20 @@ IEEEFloat::opStatus IEEEFloat::divideSpecials(const IEEEFloat &rhs) { case PackCategoriesIntoKey(fcZero, fcNaN): case PackCategoriesIntoKey(fcNormal, fcNaN): case PackCategoriesIntoKey(fcInfinity, fcNaN): - category = fcNaN; - copySignificand(rhs); + assign(rhs); + sign = false; LLVM_FALLTHROUGH; case PackCategoriesIntoKey(fcNaN, fcZero): case PackCategoriesIntoKey(fcNaN, fcNormal): case PackCategoriesIntoKey(fcNaN, fcInfinity): case PackCategoriesIntoKey(fcNaN, fcNaN): - sign = false; - LLVM_FALLTHROUGH; + sign ^= rhs.sign; // restore the original sign + if (isSignaling()) { + makeQuiet(); + return opInvalidOp; + } + return rhs.isSignaling() ? opInvalidOp : opOK; + case PackCategoriesIntoKey(fcInfinity, fcZero): case PackCategoriesIntoKey(fcInfinity, fcNormal): case PackCategoriesIntoKey(fcZero, fcInfinity): @@ -1645,23 +1653,26 @@ IEEEFloat::opStatus IEEEFloat::modSpecials(const IEEEFloat &rhs) { default: llvm_unreachable(nullptr); + case PackCategoriesIntoKey(fcZero, fcNaN): + case PackCategoriesIntoKey(fcNormal, fcNaN): + case PackCategoriesIntoKey(fcInfinity, fcNaN): + assign(rhs); + LLVM_FALLTHROUGH; case PackCategoriesIntoKey(fcNaN, fcZero): case PackCategoriesIntoKey(fcNaN, fcNormal): case PackCategoriesIntoKey(fcNaN, fcInfinity): case PackCategoriesIntoKey(fcNaN, fcNaN): + if (isSignaling()) { + makeQuiet(); + return opInvalidOp; + } + return rhs.isSignaling() ? opInvalidOp : opOK; + case PackCategoriesIntoKey(fcZero, fcInfinity): case PackCategoriesIntoKey(fcZero, fcNormal): case PackCategoriesIntoKey(fcNormal, fcInfinity): return opOK; - case PackCategoriesIntoKey(fcZero, fcNaN): - case PackCategoriesIntoKey(fcNormal, fcNaN): - case PackCategoriesIntoKey(fcInfinity, fcNaN): - sign = false; - category = fcNaN; - copySignificand(rhs); - return opOK; - case PackCategoriesIntoKey(fcNormal, fcZero): case PackCategoriesIntoKey(fcInfinity, fcZero): case PackCategoriesIntoKey(fcInfinity, fcNormal): @@ -2621,24 +2632,70 @@ IEEEFloat::convertFromDecimalString(StringRef str, roundingMode rounding_mode) { } bool IEEEFloat::convertFromStringSpecials(StringRef str) { + const size_t MIN_NAME_SIZE = 3; + + if (str.size() < MIN_NAME_SIZE) + return false; + if (str.equals("inf") || str.equals("INFINITY") || str.equals("+Inf")) { makeInf(false); return true; } - if (str.equals("-inf") || str.equals("-INFINITY") || str.equals("-Inf")) { - makeInf(true); - return true; + bool IsNegative = str.front() == '-'; + if (IsNegative) { + str = str.drop_front(); + if (str.size() < MIN_NAME_SIZE) + return false; + + if (str.equals("inf") || str.equals("INFINITY") || str.equals("Inf")) { + makeInf(true); + return true; + } } - if (str.equals("nan") || str.equals("NaN")) { - makeNaN(false, false); - return true; + // If we have a 's' (or 'S') prefix, then this is a Signaling NaN. + bool IsSignaling = str.front() == 's' || str.front() == 'S'; + if (IsSignaling) { + str = str.drop_front(); + if (str.size() < MIN_NAME_SIZE) + return false; } - if (str.equals("-nan") || str.equals("-NaN")) { - makeNaN(false, true); - return true; + if (str.startswith("nan") || str.startswith("NaN")) { + str = str.drop_front(3); + + // A NaN without payload. + if (str.empty()) { + makeNaN(IsSignaling, IsNegative); + return true; + } + + // Allow the payload to be inside parentheses. + if (str.front() == '(') { + // Parentheses should be balanced (and not empty). + if (str.size() <= 2 || str.back() != ')') + return false; + + str = str.slice(1, str.size() - 1); + } + + // Determine the payload number's radix. + unsigned Radix = 10; + if (str[0] == '0') { + if (str.size() > 1 && tolower(str[1]) == 'x') { + str = str.drop_front(2); + Radix = 16; + } else + Radix = 8; + } + + // Parse the payload and make the NaN. + APInt Payload; + if (!str.getAsInteger(Radix, Payload)) { + makeNaN(IsSignaling, IsNegative, &Payload); + return true; + } } return false; diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 38756a847e225f..0e871c22920454 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -525,6 +525,17 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM, setOperationAction(ISD::LOAD, MVT::i128, Custom); setOperationAction(ISD::STORE, MVT::i128, Custom); + // 256 bit non-temporal stores can be lowered to STNP. Do this as part of the + // custom lowering, as there are no un-paired non-temporal stores and + // legalization will break up 256 bit inputs. + setOperationAction(ISD::STORE, MVT::v32i8, Custom); + setOperationAction(ISD::STORE, MVT::v16i16, Custom); + setOperationAction(ISD::STORE, MVT::v16f16, Custom); + setOperationAction(ISD::STORE, MVT::v8i32, Custom); + setOperationAction(ISD::STORE, MVT::v8f32, Custom); + setOperationAction(ISD::STORE, MVT::v4f64, Custom); + setOperationAction(ISD::STORE, MVT::v4i64, Custom); + // Lower READCYCLECOUNTER using an mrs from PMCCNTR_EL0. // This requires the Performance Monitors extension. if (Subtarget->hasPerfMon()) @@ -1382,6 +1393,7 @@ const char *AArch64TargetLowering::getTargetNodeName(unsigned Opcode) const { case AArch64ISD::SST1_IMM: return "AArch64ISD::SST1_IMM"; case AArch64ISD::LDP: return "AArch64ISD::LDP"; case AArch64ISD::STP: return "AArch64ISD::STP"; + case AArch64ISD::STNP: return "AArch64ISD::STNP"; } return nullptr; } @@ -3070,6 +3082,30 @@ SDValue AArch64TargetLowering::LowerSTORE(SDValue Op, if (StoreNode->isTruncatingStore()) { return LowerTruncateVectorStore(Dl, StoreNode, VT, MemVT, DAG); } + // 256 bit non-temporal stores can be lowered to STNP. Do this as part of + // the custom lowering, as there are no un-paired non-temporal stores and + // legalization will break up 256 bit inputs. + if (StoreNode->isNonTemporal() && MemVT.getSizeInBits() == 256u && + MemVT.getVectorElementCount().Min % 2u == 0 && + ((MemVT.getScalarSizeInBits() == 8u || + MemVT.getScalarSizeInBits() == 16u || + MemVT.getScalarSizeInBits() == 32u || + MemVT.getScalarSizeInBits() == 64u))) { + SDValue Lo = + DAG.getNode(ISD::EXTRACT_SUBVECTOR, Dl, + MemVT.getHalfNumVectorElementsVT(*DAG.getContext()), + StoreNode->getValue(), DAG.getConstant(0, Dl, MVT::i64)); + SDValue Hi = DAG.getNode( + ISD::EXTRACT_SUBVECTOR, Dl, + MemVT.getHalfNumVectorElementsVT(*DAG.getContext()), + StoreNode->getValue(), + DAG.getConstant(MemVT.getVectorElementCount().Min / 2, Dl, MVT::i64)); + SDValue Result = DAG.getMemIntrinsicNode( + AArch64ISD::STNP, Dl, DAG.getVTList(MVT::Other), + {StoreNode->getChain(), Lo, Hi, StoreNode->getBasePtr()}, + StoreNode->getMemoryVT(), StoreNode->getMemOperand()); + return Result; + } } else if (MemVT == MVT::i128 && StoreNode->isVolatile()) { assert(StoreNode->getValue()->getValueType(0) == MVT::i128); SDValue Lo = diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.h b/llvm/lib/Target/AArch64/AArch64ISelLowering.h index 2377e0a07d1485..5aaeebef3088a8 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.h +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.h @@ -272,7 +272,8 @@ enum NodeType : unsigned { STZ2G, LDP, - STP + STP, + STNP }; } // end namespace AArch64ISD diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp index 0ed2a678c4f010..c07fb3a44b6f2e 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -496,8 +496,9 @@ static unsigned canFoldIntoCSel(const MachineRegisterInfo &MRI, unsigned VReg, bool AArch64InstrInfo::canInsertSelect(const MachineBasicBlock &MBB, ArrayRef Cond, - unsigned TrueReg, unsigned FalseReg, - int &CondCycles, int &TrueCycles, + unsigned DstReg, unsigned TrueReg, + unsigned FalseReg, int &CondCycles, + int &TrueCycles, int &FalseCycles) const { // Check register classes. const MachineRegisterInfo &MRI = MBB.getParent()->getRegInfo(); @@ -506,6 +507,12 @@ bool AArch64InstrInfo::canInsertSelect(const MachineBasicBlock &MBB, if (!RC) return false; + // Also need to check the dest regclass, in case we're trying to optimize + // something like: + // %1(gpr) = PHI %2(fpr), bb1, %(fpr), bb2 + if (!RI.getCommonSubClass(RC, MRI.getRegClass(DstReg))) + return false; + // Expanding cbz/tbz requires an extra cycle of latency on the condition. unsigned ExtraCondLat = Cond.size() != 1; diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.h b/llvm/lib/Target/AArch64/AArch64InstrInfo.h index 66e517e5490359..f041624225e40a 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.h +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.h @@ -191,7 +191,8 @@ class AArch64InstrInfo final : public AArch64GenInstrInfo { bool reverseBranchCondition(SmallVectorImpl &Cond) const override; bool canInsertSelect(const MachineBasicBlock &, ArrayRef Cond, - unsigned, unsigned, int &, int &, int &) const override; + unsigned, unsigned, unsigned, int &, int &, + int &) const override; void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, unsigned DstReg, ArrayRef Cond, unsigned TrueReg, diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td index 5650d9140821b9..c2853da050f1b6 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td @@ -245,6 +245,7 @@ def SDT_AArch64TLSDescCall : SDTypeProfile<0, -2, [SDTCisPtrTy<0>, def SDT_AArch64ldp : SDTypeProfile<2, 1, [SDTCisVT<0, i64>, SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>; def SDT_AArch64stp : SDTypeProfile<0, 3, [SDTCisVT<0, i64>, SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>; +def SDT_AArch64stnp : SDTypeProfile<0, 3, [SDTCisVT<0, v4i32>, SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>; // Generates the general dynamic sequences, i.e. // adrp x0, :tlsdesc:var @@ -544,6 +545,7 @@ def AArch64uunpklo : SDNode<"AArch64ISD::UUNPKLO", SDT_AArch64unpk>; def AArch64ldp : SDNode<"AArch64ISD::LDP", SDT_AArch64ldp, [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; def AArch64stp : SDNode<"AArch64ISD::STP", SDT_AArch64stp, [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>; +def AArch64stnp : SDNode<"AArch64ISD::STNP", SDT_AArch64stnp, [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>; def AArch64tbl : SDNode<"AArch64ISD::TBL", SDT_AArch64TBL>; @@ -2734,6 +2736,10 @@ defm STNPQ : StorePairNoAlloc<0b10, 1, FPR128Op, simm7s16, "stnp">; def : Pat<(AArch64stp GPR64z:$Rt, GPR64z:$Rt2, (am_indexed7s64 GPR64sp:$Rn, simm7s8:$offset)), (STPXi GPR64z:$Rt, GPR64z:$Rt2, GPR64sp:$Rn, simm7s8:$offset)>; +def : Pat<(AArch64stnp FPR128:$Rt, FPR128:$Rt2, (am_indexed7s128 GPR64sp:$Rn, simm7s16:$offset)), + (STNPQi FPR128:$Rt, FPR128:$Rt2, GPR64sp:$Rn, simm7s16:$offset)>; + + //--- // (Register offset) diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.h b/llvm/lib/Target/AMDGPU/AMDGPU.h index 1992d5b0b1edc3..4f1bb79593b6bd 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPU.h +++ b/llvm/lib/Target/AMDGPU/AMDGPU.h @@ -156,6 +156,9 @@ extern char &SIWholeQuadModeID; void initializeSILowerControlFlowPass(PassRegistry &); extern char &SILowerControlFlowID; +void initializeSIRemoveShortExecBranchesPass(PassRegistry &); +extern char &SIRemoveShortExecBranchesID; + void initializeSIInsertSkipsPass(PassRegistry &); extern char &SIInsertSkipsPassID; diff --git a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp index 3cb7c660f2b563..b6a06b8f3601c7 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp @@ -303,9 +303,6 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_, .clampScalar(0, S32, S32) .scalarize(0); // TODO: Implement. - getActionDefinitionsBuilder({G_SADDO, G_SSUBO}) - .lower(); - getActionDefinitionsBuilder(G_BITCAST) // Don't worry about the size constraint. .legalIf(all(isRegisterType(0), isRegisterType(1))) @@ -314,6 +311,13 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_, .lower(); + getActionDefinitionsBuilder(G_CONSTANT) + .legalFor({S1, S32, S64, S16, GlobalPtr, + LocalPtr, ConstantPtr, PrivatePtr, FlatPtr }) + .clampScalar(0, S32, S64) + .widenScalarToNextPow2(0) + .legalIf(isPointer(0)); + getActionDefinitionsBuilder(G_FCONSTANT) .legalFor({S32, S64, S16}) .clampScalar(0, S16, S64); @@ -327,21 +331,10 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_, .widenScalarToNextPow2(0, 32) .clampMaxNumElements(0, S32, 16); - - // FIXME: i1 operands to intrinsics should always be legal, but other i1 - // values may not be legal. We need to figure out how to distinguish - // between these two scenarios. - getActionDefinitionsBuilder(G_CONSTANT) - .legalFor({S1, S32, S64, S16, GlobalPtr, - LocalPtr, ConstantPtr, PrivatePtr, FlatPtr }) - .clampScalar(0, S32, S64) - .widenScalarToNextPow2(0) - .legalIf(isPointer(0)); - setAction({G_FRAME_INDEX, PrivatePtr}, Legal); getActionDefinitionsBuilder(G_GLOBAL_VALUE) .customFor({LocalPtr, GlobalPtr, ConstantPtr, Constant32Ptr}); - + setAction({G_BLOCK_ADDR, CodePtr}, Legal); auto &FPOpActions = getActionDefinitionsBuilder( { G_FADD, G_FMUL, G_FMA, G_FCANONICALIZE}) @@ -401,9 +394,6 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_, .scalarize(0) .clampScalar(0, S16, S64); - // TODO: Implement - getActionDefinitionsBuilder({G_FMINIMUM, G_FMAXIMUM}).lower(); - if (ST.has16BitInsts()) { getActionDefinitionsBuilder({G_FSQRT, G_FFLOOR}) .legalFor({S32, S64, S16}) @@ -425,9 +415,6 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_, .lowerFor({{S64, S16}}) // FIXME: Implement .scalarize(0); - // TODO: Verify V_BFI_B32 is generated from expanded bit ops. - getActionDefinitionsBuilder(G_FCOPYSIGN).lower(); - getActionDefinitionsBuilder(G_FSUB) // Use actual fsub instruction .legalFor({S32}) @@ -498,17 +485,10 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_, .scalarize(0); } - getActionDefinitionsBuilder(G_PTR_ADD) - .legalForCartesianProduct(AddrSpaces64, {S64}) - .legalForCartesianProduct(AddrSpaces32, {S32}) - .scalarize(0); - - getActionDefinitionsBuilder(G_PTR_MASK) + getActionDefinitionsBuilder({G_PTR_ADD, G_PTR_MASK}) .scalarize(0) .alwaysLegal(); - setAction({G_BLOCK_ADDR, CodePtr}, Legal); - auto &CmpBuilder = getActionDefinitionsBuilder(G_ICMP) // The compare output type differs based on the register bank of the output, @@ -900,10 +880,6 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_, {S32, FlatPtr}, {S64, FlatPtr}}) .legalFor({{S32, LocalPtr}, {S64, LocalPtr}, {S32, RegionPtr}, {S64, RegionPtr}}); - - getActionDefinitionsBuilder(G_ATOMIC_CMPXCHG_WITH_SUCCESS) - .lower(); - // TODO: Pointer types, any 32-bit or 64-bit vector // Condition should be s32 for scalar, s1 for vector. @@ -1124,11 +1100,23 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_, .clampScalar(0, MinLegalScalarShiftTy, S64) .lower(); - getActionDefinitionsBuilder({G_READ_REGISTER, G_WRITE_REGISTER}).lower(); - getActionDefinitionsBuilder(G_READCYCLECOUNTER) .legalFor({S64}); + getActionDefinitionsBuilder({ + // TODO: Verify V_BFI_B32 is generated from expanded bit ops + G_FCOPYSIGN, + + G_ATOMIC_CMPXCHG_WITH_SUCCESS, + G_READ_REGISTER, + G_WRITE_REGISTER, + + G_SADDO, G_SSUBO, + + // TODO: Implement + G_FMINIMUM, G_FMAXIMUM + }).lower(); + getActionDefinitionsBuilder({G_VASTART, G_VAARG, G_BRJT, G_JUMP_TABLE, G_DYN_STACKALLOC, G_INDEXED_LOAD, G_INDEXED_SEXTLOAD, G_INDEXED_ZEXTLOAD, G_INDEXED_STORE}) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index e5df3f8330b659..e35a8d01c3b720 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -229,6 +229,7 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget() { initializeSIModeRegisterPass(*PR); initializeSIWholeQuadModePass(*PR); initializeSILowerControlFlowPass(*PR); + initializeSIRemoveShortExecBranchesPass(*PR); initializeSIInsertSkipsPass(*PR); initializeSIMemoryLegalizerPass(*PR); initializeSIOptimizeExecMaskingPass(*PR); @@ -1000,6 +1001,7 @@ void GCNPassConfig::addPreEmitPass() { // be better for it to emit S_NOP when possible. addPass(&PostRAHazardRecognizerID); + addPass(&SIRemoveShortExecBranchesID); addPass(&SIInsertSkipsPassID); addPass(&BranchRelaxationPassID); } diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp index c4eeb81c5133e2..a255a49b26b635 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp @@ -69,6 +69,11 @@ static cl::opt UnrollThresholdIf( cl::desc("Unroll threshold increment for AMDGPU for each if statement inside loop"), cl::init(150), cl::Hidden); +static cl::opt UseLegacyDA( + "amdgpu-use-legacy-divergence-analysis", + cl::desc("Enable legacy divergence analysis for AMDGPU"), + cl::init(false), cl::Hidden); + static bool dependsOnLocalPhi(const Loop *L, const Value *Cond, unsigned Depth = 0) { const Instruction *I = dyn_cast(Cond); @@ -601,6 +606,11 @@ static bool isArgPassedInSGPR(const Argument *A) { } } +/// \returns true if the new GPU divergence analysis is enabled. +bool GCNTTIImpl::useGPUDivergenceAnalysis() const { + return !UseLegacyDA; +} + /// \returns true if the result of the value could potentially be /// different across workitems in a wavefront. bool GCNTTIImpl::isSourceOfDivergence(const Value *V) const { diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h index 0b48f9f602b713..7dd692be5530f7 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h @@ -136,6 +136,7 @@ class GCNTTIImpl final : public BasicTTIImplBase { HasFP32Denormals(ST->hasFP32Denormals(F)) { } bool hasBranchDivergence() { return true; } + bool useGPUDivergenceAnalysis() const; void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP); diff --git a/llvm/lib/Target/AMDGPU/CMakeLists.txt b/llvm/lib/Target/AMDGPU/CMakeLists.txt index 8b614528258890..189141512978ff 100644 --- a/llvm/lib/Target/AMDGPU/CMakeLists.txt +++ b/llvm/lib/Target/AMDGPU/CMakeLists.txt @@ -118,6 +118,7 @@ add_llvm_target(AMDGPUCodeGen SIOptimizeExecMaskingPreRA.cpp SIPeepholeSDWA.cpp SIRegisterInfo.cpp + SIRemoveShortExecBranches.cpp SIShrinkInstructions.cpp SIWholeQuadMode.cpp GCNILPSched.cpp diff --git a/llvm/lib/Target/AMDGPU/SIInsertSkips.cpp b/llvm/lib/Target/AMDGPU/SIInsertSkips.cpp index 87e63fcc4a04fa..80c044ec00cb39 100644 --- a/llvm/lib/Target/AMDGPU/SIInsertSkips.cpp +++ b/llvm/lib/Target/AMDGPU/SIInsertSkips.cpp @@ -41,7 +41,7 @@ using namespace llvm; #define DEBUG_TYPE "si-insert-skips" static cl::opt SkipThresholdFlag( - "amdgpu-skip-threshold", + "amdgpu-skip-threshold-legacy", cl::desc("Number of instructions before jumping over divergent control flow"), cl::init(12), cl::Hidden); @@ -466,6 +466,9 @@ bool SIInsertSkips::runOnMachineFunction(MachineFunction &MF) { MachineInstr &MI = *I; switch (MI.getOpcode()) { + case AMDGPU::S_CBRANCH_EXECZ: + ExecBranchStack.push_back(MI.getOperand(0).getMBB()); + break; case AMDGPU::SI_MASK_BRANCH: ExecBranchStack.push_back(MI.getOperand(0).getMBB()); MadeChange |= skipMaskBranch(MI, MBB); diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp index e1ee5b721d5656..c2ac27553ae879 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp @@ -2128,8 +2128,8 @@ bool SIInstrInfo::reverseBranchCondition( bool SIInstrInfo::canInsertSelect(const MachineBasicBlock &MBB, ArrayRef Cond, - unsigned TrueReg, unsigned FalseReg, - int &CondCycles, + unsigned DstReg, unsigned TrueReg, + unsigned FalseReg, int &CondCycles, int &TrueCycles, int &FalseCycles) const { switch (Cond[0].getImm()) { case VCCNZ: diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.h b/llvm/lib/Target/AMDGPU/SIInstrInfo.h index b151a94b0d118a..d988a00686c92c 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.h +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.h @@ -293,9 +293,8 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo { SmallVectorImpl &Cond) const override; bool canInsertSelect(const MachineBasicBlock &MBB, - ArrayRef Cond, - unsigned TrueReg, unsigned FalseReg, - int &CondCycles, + ArrayRef Cond, unsigned DstReg, + unsigned TrueReg, unsigned FalseReg, int &CondCycles, int &TrueCycles, int &FalseCycles) const override; void insertSelect(MachineBasicBlock &MBB, diff --git a/llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp b/llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp index bf052dc3c9304e..61d2719a3aad61 100644 --- a/llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp +++ b/llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp @@ -244,9 +244,9 @@ void SILowerControlFlow::emitIf(MachineInstr &MI) { BuildMI(MBB, I, DL, TII->get(MovTermOpc), Exec) .addReg(Tmp, RegState::Kill); - // Insert a pseudo terminator to help keep the verifier happy. This will also - // be used later when inserting skips. - MachineInstr *NewBr = BuildMI(MBB, I, DL, TII->get(AMDGPU::SI_MASK_BRANCH)) + // Insert the S_CBRANCH_EXECZ instruction which will be optimized later + // during SIRemoveShortExecBranches. + MachineInstr *NewBr = BuildMI(MBB, I, DL, TII->get(AMDGPU::S_CBRANCH_EXECZ)) .add(MI.getOperand(2)); if (!LIS) { @@ -323,8 +323,8 @@ void SILowerControlFlow::emitElse(MachineInstr &MI) { .addReg(DstReg); MachineInstr *Branch = - BuildMI(MBB, ElsePt, DL, TII->get(AMDGPU::SI_MASK_BRANCH)) - .addMBB(DestBB); + BuildMI(MBB, ElsePt, DL, TII->get(AMDGPU::S_CBRANCH_EXECZ)) + .addMBB(DestBB); if (!LIS) { MI.eraseFromParent(); diff --git a/llvm/lib/Target/AMDGPU/SIRemoveShortExecBranches.cpp b/llvm/lib/Target/AMDGPU/SIRemoveShortExecBranches.cpp new file mode 100644 index 00000000000000..aaadc1604e70ae --- /dev/null +++ b/llvm/lib/Target/AMDGPU/SIRemoveShortExecBranches.cpp @@ -0,0 +1,157 @@ +//===-- SIRemoveShortExecBranches.cpp ------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +/// \file +/// This pass optmizes the s_cbranch_execz instructions. +/// The pass removes this skip instruction for short branches, +/// if there is no unwanted sideeffect in the fallthrough code sequence. +/// +//===----------------------------------------------------------------------===// + +#include "AMDGPU.h" +#include "AMDGPUSubtarget.h" +#include "MCTargetDesc/AMDGPUMCTargetDesc.h" +#include "SIInstrInfo.h" +#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/Support/CommandLine.h" + +using namespace llvm; + +#define DEBUG_TYPE "si-remove-short-exec-branches" + +static unsigned SkipThreshold; + +static cl::opt SkipThresholdFlag( + "amdgpu-skip-threshold", cl::Hidden, + cl::desc( + "Number of instructions before jumping over divergent control flow"), + cl::location(SkipThreshold), cl::init(12)); + +namespace { + +class SIRemoveShortExecBranches : public MachineFunctionPass { +private: + const SIInstrInfo *TII = nullptr; + bool getBlockDestinations(MachineBasicBlock &SrcMBB, + MachineBasicBlock *&TrueMBB, + MachineBasicBlock *&FalseMBB, + SmallVectorImpl &Cond); + bool mustRetainExeczBranch(const MachineBasicBlock &From, + const MachineBasicBlock &To) const; + bool removeExeczBranch(MachineInstr &MI, MachineBasicBlock &SrcMBB); + +public: + static char ID; + + SIRemoveShortExecBranches() : MachineFunctionPass(ID) { + initializeSIRemoveShortExecBranchesPass(*PassRegistry::getPassRegistry()); + } + + bool runOnMachineFunction(MachineFunction &MF) override; +}; + +} // End anonymous namespace. + +INITIALIZE_PASS(SIRemoveShortExecBranches, DEBUG_TYPE, + "SI remove short exec branches", false, false) + +char SIRemoveShortExecBranches::ID = 0; + +char &llvm::SIRemoveShortExecBranchesID = SIRemoveShortExecBranches::ID; + +bool SIRemoveShortExecBranches::getBlockDestinations( + MachineBasicBlock &SrcMBB, MachineBasicBlock *&TrueMBB, + MachineBasicBlock *&FalseMBB, SmallVectorImpl &Cond) { + if (TII->analyzeBranch(SrcMBB, TrueMBB, FalseMBB, Cond)) + return false; + + if (!FalseMBB) + FalseMBB = SrcMBB.getNextNode(); + + return true; +} + +bool SIRemoveShortExecBranches::mustRetainExeczBranch( + const MachineBasicBlock &From, const MachineBasicBlock &To) const { + unsigned NumInstr = 0; + const MachineFunction *MF = From.getParent(); + + for (MachineFunction::const_iterator MBBI(&From), ToI(&To), End = MF->end(); + MBBI != End && MBBI != ToI; ++MBBI) { + const MachineBasicBlock &MBB = *MBBI; + + for (MachineBasicBlock::const_iterator I = MBB.begin(), E = MBB.end(); + I != E; ++I) { + // When a uniform loop is inside non-uniform control flow, the branch + // leaving the loop might never be taken when EXEC = 0. + // Hence we should retain cbranch out of the loop lest it become infinite. + if (I->isConditionalBranch()) + return true; + + if (TII->hasUnwantedEffectsWhenEXECEmpty(*I)) + return true; + + // These instructions are potentially expensive even if EXEC = 0. + if (TII->isSMRD(*I) || TII->isVMEM(*I) || TII->isFLAT(*I) || + I->getOpcode() == AMDGPU::S_WAITCNT) + return true; + + ++NumInstr; + if (NumInstr >= SkipThreshold) + return true; + } + } + + return false; +} + +// Returns true if the skip branch instruction is removed. +bool SIRemoveShortExecBranches::removeExeczBranch(MachineInstr &MI, + MachineBasicBlock &SrcMBB) { + MachineBasicBlock *TrueMBB = nullptr; + MachineBasicBlock *FalseMBB = nullptr; + SmallVector Cond; + + if (!getBlockDestinations(SrcMBB, TrueMBB, FalseMBB, Cond)) + return false; + + // Consider only the forward branches. + if ((SrcMBB.getNumber() >= TrueMBB->getNumber()) || + mustRetainExeczBranch(*FalseMBB, *TrueMBB)) + return false; + + LLVM_DEBUG(dbgs() << "Removing the execz branch: " << MI); + MI.eraseFromParent(); + SrcMBB.removeSuccessor(TrueMBB); + + return true; +} + +bool SIRemoveShortExecBranches::runOnMachineFunction(MachineFunction &MF) { + const GCNSubtarget &ST = MF.getSubtarget(); + TII = ST.getInstrInfo(); + MF.RenumberBlocks(); + bool Changed = false; + + for (MachineBasicBlock &MBB : MF) { + MachineBasicBlock::iterator MBBI = MBB.getFirstTerminator(); + if (MBBI == MBB.end()) + continue; + + MachineInstr &MI = *MBBI; + switch (MI.getOpcode()) { + case AMDGPU::S_CBRANCH_EXECZ: + Changed = removeExeczBranch(MI, MBB); + break; + default: + break; + } + } + + return Changed; +} diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp index c8adbbb8704e06..6b448365215db3 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -753,9 +753,10 @@ unsigned PPCInstrInfo::insertBranch(MachineBasicBlock &MBB, // Select analysis. bool PPCInstrInfo::canInsertSelect(const MachineBasicBlock &MBB, - ArrayRef Cond, - unsigned TrueReg, unsigned FalseReg, - int &CondCycles, int &TrueCycles, int &FalseCycles) const { + ArrayRef Cond, + unsigned DstReg, unsigned TrueReg, + unsigned FalseReg, int &CondCycles, + int &TrueCycles, int &FalseCycles) const { if (Cond.size() != 2) return false; diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.h b/llvm/lib/Target/PowerPC/PPCInstrInfo.h index 21da3457dc9e33..a549b8221a7530 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.h +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.h @@ -273,7 +273,8 @@ class PPCInstrInfo : public PPCGenInstrInfo { // Select analysis. bool canInsertSelect(const MachineBasicBlock &, ArrayRef Cond, - unsigned, unsigned, int &, int &, int &) const override; + unsigned, unsigned, unsigned, int &, int &, + int &) const override; void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, unsigned DstReg, ArrayRef Cond, unsigned TrueReg, diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp index 97c8fa7aa32e16..191792ad41e174 100644 --- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp +++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp @@ -532,8 +532,9 @@ bool SystemZInstrInfo::analyzeCompare(const MachineInstr &MI, unsigned &SrcReg, bool SystemZInstrInfo::canInsertSelect(const MachineBasicBlock &MBB, ArrayRef Pred, - unsigned TrueReg, unsigned FalseReg, - int &CondCycles, int &TrueCycles, + unsigned DstReg, unsigned TrueReg, + unsigned FalseReg, int &CondCycles, + int &TrueCycles, int &FalseCycles) const { // Not all subtargets have LOCR instructions. if (!STI.hasLoadStoreOnCond()) diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.h b/llvm/lib/Target/SystemZ/SystemZInstrInfo.h index 8391970c7d9d9e..c3daf9e9c62829 100644 --- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.h +++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.h @@ -221,8 +221,9 @@ class SystemZInstrInfo : public SystemZGenInstrInfo { int *BytesAdded = nullptr) const override; bool analyzeCompare(const MachineInstr &MI, unsigned &SrcReg, unsigned &SrcReg2, int &Mask, int &Value) const override; - bool canInsertSelect(const MachineBasicBlock&, ArrayRef Cond, - unsigned, unsigned, int&, int&, int&) const override; + bool canInsertSelect(const MachineBasicBlock &, ArrayRef Cond, + unsigned, unsigned, unsigned, int &, int &, + int &) const override; void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, unsigned DstReg, ArrayRef Cond, unsigned TrueReg, diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h index b339860a381d08..f7d1aeb9ec683c 100644 --- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h +++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h @@ -509,8 +509,8 @@ inline bool isCallIndirect(unsigned Opc) { /// Returns the operand number of a callee, assuming the argument is a call /// instruction. -inline unsigned getCalleeOpNo(unsigned Opc) { - switch (Opc) { +inline const MachineOperand &getCalleeOp(const MachineInstr &MI) { + switch (MI.getOpcode()) { case WebAssembly::CALL_VOID: case WebAssembly::CALL_VOID_S: case WebAssembly::CALL_INDIRECT_VOID: @@ -519,7 +519,7 @@ inline unsigned getCalleeOpNo(unsigned Opc) { case WebAssembly::RET_CALL_S: case WebAssembly::RET_CALL_INDIRECT: case WebAssembly::RET_CALL_INDIRECT_S: - return 0; + return MI.getOperand(0); case WebAssembly::CALL_i32: case WebAssembly::CALL_i32_S: case WebAssembly::CALL_i64: @@ -564,7 +564,10 @@ inline unsigned getCalleeOpNo(unsigned Opc) { case WebAssembly::CALL_INDIRECT_v2f64_S: case WebAssembly::CALL_INDIRECT_exnref: case WebAssembly::CALL_INDIRECT_exnref_S: - return 1; + return MI.getOperand(1); + case WebAssembly::CALL: + case WebAssembly::CALL_S: + return MI.getOperand(MI.getNumDefs()); default: llvm_unreachable("Not a call instruction"); } diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISD.def b/llvm/lib/Target/WebAssembly/WebAssemblyISD.def index ba04fd4eb9dd24..f9cb87ff7da40f 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyISD.def +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISD.def @@ -15,6 +15,7 @@ HANDLE_NODETYPE(CALL1) HANDLE_NODETYPE(CALL0) +HANDLE_NODETYPE(CALL) HANDLE_NODETYPE(RET_CALL) HANDLE_NODETYPE(RETURN) HANDLE_NODETYPE(ARGUMENT) diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp index 531a07b829c85e..e99feaaaff7b25 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp @@ -206,6 +206,27 @@ void WebAssemblyDAGToDAGISel::Select(SDNode *Node) { } break; } + case WebAssemblyISD::CALL: { + // CALL has both variable operands and variable results, but ISel only + // supports one or the other. Split calls into two nodes glued together, one + // for the operands and one for the results. These two nodes will be + // recombined in a custom inserter hook into a single MachineInstr. + SmallVector Ops; + for (size_t i = 1; i < Node->getNumOperands(); ++i) { + SDValue Op = Node->getOperand(i); + if (Op->getOpcode() == WebAssemblyISD::Wrapper) + Op = Op->getOperand(0); + Ops.push_back(Op); + } + Ops.push_back(Node->getOperand(0)); + MachineSDNode *CallParams = + CurDAG->getMachineNode(WebAssembly::CALL_PARAMS, DL, MVT::Glue, Ops); + SDValue Link(CallParams, 0); + MachineSDNode *CallResults = CurDAG->getMachineNode( + WebAssembly::CALL_RESULTS, DL, Node->getVTList(), Link); + ReplaceNode(Node, CallResults); + return; + } default: break; diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index 5b177c0c5d9d51..e91a9ea0376750 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -434,6 +434,29 @@ static MachineBasicBlock *LowerFPToInt(MachineInstr &MI, DebugLoc DL, return DoneMBB; } +static MachineBasicBlock *LowerCallResults(MachineInstr &CallResults, + DebugLoc DL, MachineBasicBlock *BB, + const TargetInstrInfo &TII) { + MachineInstr &CallParams = *CallResults.getPrevNode(); + assert(CallParams.getOpcode() == WebAssembly::CALL_PARAMS); + assert(CallResults.getOpcode() == WebAssembly::CALL_RESULTS); + + MachineFunction &MF = *BB->getParent(); + const MCInstrDesc &MCID = TII.get(WebAssembly::CALL); + MachineInstrBuilder MIB(MF, MF.CreateMachineInstr(MCID, DL)); + + for (auto Def : CallResults.defs()) + MIB.add(Def); + for (auto Use : CallParams.uses()) + MIB.add(Use); + + BB->insert(CallResults.getIterator(), MIB); + CallParams.eraseFromParent(); + CallResults.eraseFromParent(); + + return BB; +} + MachineBasicBlock *WebAssemblyTargetLowering::EmitInstrWithCustomInserter( MachineInstr &MI, MachineBasicBlock *BB) const { const TargetInstrInfo &TII = *Subtarget->getInstrInfo(); @@ -466,7 +489,8 @@ MachineBasicBlock *WebAssemblyTargetLowering::EmitInstrWithCustomInserter( case WebAssembly::FP_TO_UINT_I64_F64: return LowerFPToInt(MI, DL, BB, TII, true, true, true, WebAssembly::I64_TRUNC_U_F64); - llvm_unreachable("Unexpected instruction to emit with custom inserter"); + case WebAssembly::CALL_RESULTS: + return LowerCallResults(MI, DL, BB, TII); } } @@ -702,9 +726,6 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI, } SmallVectorImpl &Ins = CLI.Ins; - if (Ins.size() > 1) - fail(DL, DAG, "WebAssembly doesn't support more than 1 returned value yet"); - SmallVectorImpl &Outs = CLI.Outs; SmallVectorImpl &OutVals = CLI.OutVals; @@ -850,18 +871,27 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI, } InTys.push_back(MVT::Other); - SDVTList InTyList = DAG.getVTList(InTys); - SDValue Res = - DAG.getNode(Ins.empty() ? WebAssemblyISD::CALL0 : WebAssemblyISD::CALL1, - DL, InTyList, Ops); - if (Ins.empty()) { - Chain = Res; - } else { - InVals.push_back(Res); - Chain = Res.getValue(1); + unsigned Opc; + // TODO: Remove CALL0 and CALL1 in favor of CALL + switch (Ins.size()) { + case 0: + Opc = WebAssemblyISD::CALL0; + break; + case 1: + Opc = WebAssemblyISD::CALL1; + break; + default: + Opc = WebAssemblyISD::CALL; + break; } + SDVTList InTyList = DAG.getVTList(InTys); + SDValue Res = DAG.getNode(Opc, DL, InTyList, Ops); - return Chain; + for (size_t I = 0; I < Ins.size(); ++I) + InVals.push_back(Res.getValue(I)); + + // Return the chain + return Res.getValue(Ins.size()); } bool WebAssemblyTargetLowering::CanLowerReturn( diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td index 703c15d58c93ad..d3e7493fafa1aa 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td @@ -54,7 +54,31 @@ multiclass CALL; } +// CALL should take both variadic arguments and produce variadic results, but +// this is not possible to model directly. Instead, we select calls to a +// CALL_PARAMS taking variadic aguments linked with a CALL_RESULTS that handles +// producing the call's variadic results. We recombine the two in a custom +// inserter hook after DAG ISel, so passes over MachineInstrs will only ever +// observe CALL nodes with all of the expected variadic uses and defs. +let isPseudo = 1 in +defm CALL_PARAMS : + I<(outs), (ins function32_op:$callee, variable_ops), + (outs), (ins function32_op:$callee), [], + "call_params\t$callee", "call_params\t$callee", -1>; + +let variadicOpsAreDefs = 1, usesCustomInserter = 1, isPseudo = 1 in +defm CALL_RESULTS : + I<(outs), (ins variable_ops), (outs), (ins), [], + "call_results", "call_results", -1>; + let Uses = [SP32, SP64], isCall = 1 in { + +// TODO: Add an indirect version of the variadic call, delete CALL_* +defm CALL : + I<(outs), (ins function32_op:$callee, variable_ops), + (outs), (ins function32_op:$callee), [], + "call\t$callee", "call\t$callee", 0x10>; + defm "" : CALL; defm "" : CALL; defm "" : CALL; @@ -68,6 +92,7 @@ defm "" : CALL; defm "" : CALL; let IsCanonical = 1 in { + defm CALL_VOID : I<(outs), (ins function32_op:$callee, variable_ops), (outs), (ins function32_op:$callee), diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp index 421d353a89e885..58082bb8c5f95c 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp @@ -135,12 +135,12 @@ static void convertImplicitDefToConstZero(MachineInstr *MI, // Determine whether a call to the callee referenced by // MI->getOperand(CalleeOpNo) reads memory, writes memory, and/or has side // effects. -static void queryCallee(const MachineInstr &MI, unsigned CalleeOpNo, bool &Read, - bool &Write, bool &Effects, bool &StackPointer) { +static void queryCallee(const MachineInstr &MI, bool &Read, bool &Write, + bool &Effects, bool &StackPointer) { // All calls can use the stack pointer. StackPointer = true; - const MachineOperand &MO = MI.getOperand(CalleeOpNo); + const MachineOperand &MO = WebAssembly::getCalleeOp(MI); if (MO.isGlobal()) { const Constant *GV = MO.getGlobal(); if (const auto *GA = dyn_cast(GV)) @@ -252,8 +252,7 @@ static void query(const MachineInstr &MI, AliasAnalysis &AA, bool &Read, // Analyze calls. if (MI.isCall()) { - unsigned CalleeOpNo = WebAssembly::getCalleeOpNo(MI.getOpcode()); - queryCallee(MI, CalleeOpNo, Read, Write, Effects, StackPointer); + queryCallee(MI, Read, Write, Effects, StackPointer); } } diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.h b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.h index 850e6b9a9e9e0e..dd5b39773313e9 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.h +++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.h @@ -47,7 +47,7 @@ class WebAssemblyTargetMachine final : public LLVMTargetMachine { TargetTransformInfo getTargetTransformInfo(const Function &F) override; - bool usesPhysRegsForPEI() const override { return false; } + bool usesPhysRegsForValues() const override { return false; } yaml::MachineFunctionInfo *createDefaultFuncInfoYAML() const override; yaml::MachineFunctionInfo * diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp index a237da8154ab7d..5b777984ffa640 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp @@ -49,7 +49,7 @@ bool WebAssembly::mayThrow(const MachineInstr &MI) { if (!MI.isCall()) return false; - const MachineOperand &MO = MI.getOperand(getCalleeOpNo(MI.getOpcode())); + const MachineOperand &MO = getCalleeOp(MI); assert(MO.isGlobal() || MO.isSymbol()); if (MO.isSymbol()) { @@ -79,3 +79,67 @@ bool WebAssembly::mayThrow(const MachineInstr &MI) { // original LLVm IR? (Even when the callee may throw) return true; } + +inline const MachineOperand &getCalleeOp(const MachineInstr &MI) { + switch (MI.getOpcode()) { + case WebAssembly::CALL_VOID: + case WebAssembly::CALL_VOID_S: + case WebAssembly::CALL_INDIRECT_VOID: + case WebAssembly::CALL_INDIRECT_VOID_S: + case WebAssembly::RET_CALL: + case WebAssembly::RET_CALL_S: + case WebAssembly::RET_CALL_INDIRECT: + case WebAssembly::RET_CALL_INDIRECT_S: + return MI.getOperand(0); + case WebAssembly::CALL_i32: + case WebAssembly::CALL_i32_S: + case WebAssembly::CALL_i64: + case WebAssembly::CALL_i64_S: + case WebAssembly::CALL_f32: + case WebAssembly::CALL_f32_S: + case WebAssembly::CALL_f64: + case WebAssembly::CALL_f64_S: + case WebAssembly::CALL_v16i8: + case WebAssembly::CALL_v16i8_S: + case WebAssembly::CALL_v8i16: + case WebAssembly::CALL_v8i16_S: + case WebAssembly::CALL_v4i32: + case WebAssembly::CALL_v4i32_S: + case WebAssembly::CALL_v2i64: + case WebAssembly::CALL_v2i64_S: + case WebAssembly::CALL_v4f32: + case WebAssembly::CALL_v4f32_S: + case WebAssembly::CALL_v2f64: + case WebAssembly::CALL_v2f64_S: + case WebAssembly::CALL_exnref: + case WebAssembly::CALL_exnref_S: + case WebAssembly::CALL_INDIRECT_i32: + case WebAssembly::CALL_INDIRECT_i32_S: + case WebAssembly::CALL_INDIRECT_i64: + case WebAssembly::CALL_INDIRECT_i64_S: + case WebAssembly::CALL_INDIRECT_f32: + case WebAssembly::CALL_INDIRECT_f32_S: + case WebAssembly::CALL_INDIRECT_f64: + case WebAssembly::CALL_INDIRECT_f64_S: + case WebAssembly::CALL_INDIRECT_v16i8: + case WebAssembly::CALL_INDIRECT_v16i8_S: + case WebAssembly::CALL_INDIRECT_v8i16: + case WebAssembly::CALL_INDIRECT_v8i16_S: + case WebAssembly::CALL_INDIRECT_v4i32: + case WebAssembly::CALL_INDIRECT_v4i32_S: + case WebAssembly::CALL_INDIRECT_v2i64: + case WebAssembly::CALL_INDIRECT_v2i64_S: + case WebAssembly::CALL_INDIRECT_v4f32: + case WebAssembly::CALL_INDIRECT_v4f32_S: + case WebAssembly::CALL_INDIRECT_v2f64: + case WebAssembly::CALL_INDIRECT_v2f64_S: + case WebAssembly::CALL_INDIRECT_exnref: + case WebAssembly::CALL_INDIRECT_exnref_S: + return MI.getOperand(1); + case WebAssembly::CALL: + case WebAssembly::CALL_S: + return MI.getOperand(MI.getNumDefs()); + default: + llvm_unreachable("Not a call instruction"); + } +} diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.h b/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.h index 26cf84de89b927..4f0ed43a24816d 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.h +++ b/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.h @@ -44,6 +44,10 @@ template MachineBasicBlock *getBottom(const T *Unit) { return Bottom; } +/// Returns the operand number of a callee, assuming the argument is a call +/// instruction. +const MachineOperand &getCalleeOp(const MachineInstr &MI); + } // end namespace WebAssembly } // end namespace llvm diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index 245346d827311e..6cefb15fe9cd19 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -2826,11 +2826,11 @@ unsigned X86InstrInfo::insertBranch(MachineBasicBlock &MBB, return Count; } -bool X86InstrInfo:: -canInsertSelect(const MachineBasicBlock &MBB, - ArrayRef Cond, - unsigned TrueReg, unsigned FalseReg, - int &CondCycles, int &TrueCycles, int &FalseCycles) const { +bool X86InstrInfo::canInsertSelect(const MachineBasicBlock &MBB, + ArrayRef Cond, + unsigned DstReg, unsigned TrueReg, + unsigned FalseReg, int &CondCycles, + int &TrueCycles, int &FalseCycles) const { // Not all subtargets have cmov instructions. if (!Subtarget.hasCMov()) return false; diff --git a/llvm/lib/Target/X86/X86InstrInfo.h b/llvm/lib/Target/X86/X86InstrInfo.h index 1d2da53053573f..7c7124383f1f35 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.h +++ b/llvm/lib/Target/X86/X86InstrInfo.h @@ -306,7 +306,8 @@ class X86InstrInfo final : public X86GenInstrInfo { const DebugLoc &DL, int *BytesAdded = nullptr) const override; bool canInsertSelect(const MachineBasicBlock &, ArrayRef Cond, - unsigned, unsigned, int &, int &, int &) const override; + unsigned, unsigned, unsigned, int &, int &, + int &) const override; void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, unsigned DstReg, ArrayRef Cond, unsigned TrueReg, diff --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp index 0ff6ee8bcfcc28..3f997aa4726ed2 100644 --- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp +++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp @@ -37,8 +37,10 @@ using namespace PatternMatch; #define DEBUG_TYPE "lower-matrix-intrinsics" -static cl::opt EnableShapePropagation("matrix-propagate-shape", - cl::init(true)); +static cl::opt EnableShapePropagation( + "matrix-propagate-shape", cl::init(true), cl::Hidden, + cl::desc("Enable/disable shape propagation from matrix intrinsics to other " + "instructions.")); static cl::opt AllowContractEnabled( "matrix-allow-contract", cl::init(false), cl::Hidden, diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index aabd974cd73e4d..479bca83b51e4f 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -377,6 +377,18 @@ static Value *isOneOf(const InstructionsState &S, Value *Op) { return S.OpValue; } +/// \returns true if \p Opcode is allowed as part of of the main/alternate +/// instruction for SLP vectorization. +/// +/// Example of unsupported opcode is SDIV that can potentially cause UB if the +/// "shuffled out" lane would result in division by zero. +static bool isValidForAlternation(unsigned Opcode) { + if (Instruction::isIntDivRem(Opcode)) + return false; + + return true; +} + /// \returns analysis of the Instructions in \p VL described in /// InstructionsState, the Opcode that we suppose the whole list /// could be vectorized even if its structure is diverse. @@ -399,7 +411,8 @@ static InstructionsState getSameOpcode(ArrayRef VL, if (IsBinOp && isa(VL[Cnt])) { if (InstOpcode == Opcode || InstOpcode == AltOpcode) continue; - if (Opcode == AltOpcode) { + if (Opcode == AltOpcode && isValidForAlternation(InstOpcode) && + isValidForAlternation(Opcode)) { AltOpcode = InstOpcode; AltIndex = Cnt; continue; @@ -411,6 +424,9 @@ static InstructionsState getSameOpcode(ArrayRef VL, if (InstOpcode == Opcode || InstOpcode == AltOpcode) continue; if (Opcode == AltOpcode) { + assert(isValidForAlternation(Opcode) && + isValidForAlternation(InstOpcode) && + "Cast isn't safe for alternation, logic needs to be updated!"); AltOpcode = InstOpcode; AltIndex = Cnt; continue; diff --git a/llvm/test/CodeGen/AArch64/early-ifcvt-regclass-mismatch.mir b/llvm/test/CodeGen/AArch64/early-ifcvt-regclass-mismatch.mir new file mode 100644 index 00000000000000..436baae1a2b299 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/early-ifcvt-regclass-mismatch.mir @@ -0,0 +1,171 @@ +# RUN: llc -mtriple=aarch64-unknown-unknown -run-pass=early-ifcvt -verify-machineinstrs %s -o - | FileCheck %s +--- | + target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" + target triple = "arm64-apple-ios13.3.0" + define hidden void @phi_operands_regclasses_different() #0 { + entry: + br i1 undef, label %if.then139.i, label %if.else142.i + + if.then139.i: ; preds = %entry + %0 = load double, double* undef, align 8 + br label %if.end161.i + + if.else142.i: ; preds = %entry + %tobool154.i = icmp eq i8 undef, 0 + br i1 %tobool154.i, label %if.then155.i, label %if.end161.i + + if.then155.i: ; preds = %if.else142.i + %add158.i = fadd double undef, 0.000000e+00 + br label %if.end161.i + + if.end161.i: ; preds = %if.then155.i, %if.else142.i, %if.then139.i + %y2.0.i = phi double [ %0, %if.then139.i ], [ 0.000000e+00, %if.else142.i ], [ 0.000000e+00, %if.then155.i ] + %add169.i = fadd double 0.000000e+00, %y2.0.i + %1 = fmul double undef, %add169.i + %add174.i = fsub double undef, %1 + %2 = call double @llvm.fabs.f64(double %add174.i) #2 + %cmp.i516.i = fcmp olt double %2, 0x3BC79CA10C924223 + br i1 %cmp.i516.i, label %if.then.i.i, label %if.end9.i.i + + if.then.i.i: ; preds = %if.end161.i + %3 = call double @llvm.fabs.f64(double undef) #2 + unreachable + + if.end9.i.i: ; preds = %if.end161.i + ret void + } + declare double @llvm.fabs.f64(double) #1 + declare void @llvm.stackprotector(i8*, i8**) #2 + + attributes #0 = { "target-cpu"="apple-a7" } + attributes #1 = { nounwind readnone speculatable willreturn } + attributes #2 = { nounwind } + + !llvm.ident = !{!0} + + !0 = !{!"clang"} + +... +--- +name: phi_operands_regclasses_different +alignment: 4 +exposesReturnsTwice: false +legalized: true +regBankSelected: true +selected: true +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +registers: + - { id: 0, class: gpr32, preferred-register: '' } + - { id: 1, class: _, preferred-register: '' } + - { id: 2, class: _, preferred-register: '' } + - { id: 3, class: gpr, preferred-register: '' } + - { id: 4, class: gpr64, preferred-register: '' } + - { id: 5, class: fpr, preferred-register: '' } + - { id: 6, class: _, preferred-register: '' } + - { id: 7, class: gpr64, preferred-register: '' } + - { id: 8, class: gpr64common, preferred-register: '' } + - { id: 9, class: gpr64, preferred-register: '' } + - { id: 10, class: fpr64, preferred-register: '' } + - { id: 11, class: fpr64, preferred-register: '' } + - { id: 12, class: fpr, preferred-register: '' } + - { id: 13, class: fpr64, preferred-register: '' } + - { id: 14, class: fpr, preferred-register: '' } + - { id: 15, class: gpr32, preferred-register: '' } + - { id: 16, class: _, preferred-register: '' } + - { id: 17, class: gpr32, preferred-register: '' } + - { id: 18, class: gpr32, preferred-register: '' } + - { id: 19, class: gpr32, preferred-register: '' } + - { id: 20, class: gpr, preferred-register: '' } + - { id: 21, class: fpr64, preferred-register: '' } + - { id: 22, class: fpr64, preferred-register: '' } + - { id: 23, class: fpr64, preferred-register: '' } + - { id: 24, class: fpr64, preferred-register: '' } + - { id: 25, class: fpr64, preferred-register: '' } + - { id: 26, class: fpr64, preferred-register: '' } + - { id: 27, class: fpr64, preferred-register: '' } + - { id: 28, class: gpr64, preferred-register: '' } +liveins: [] +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 1 + adjustsStack: false + hasCalls: false + stackProtector: '' + maxCallFrameSize: 0 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: [] +stack: [] +callSites: [] +constants: [] +machineFunctionInfo: {} +body: | + ; Here we check that we don't ifcvt to a CSEL that uses GPRs, because + ; some operands to the PHI have the fpr64 regclass. + ; CHECK-LABEL: name: phi_operands_regclasses_different + ; CHECK-NOT: CSELXr + bb.1.entry: + successors: %bb.2(0x40000000), %bb.3(0x40000000) + + %0:gpr32 = IMPLICIT_DEF + %4:gpr64 = IMPLICIT_DEF + %8:gpr64common = IMPLICIT_DEF + TBNZW %0, 0, %bb.2 + B %bb.3 + + bb.2.if.then139.i: + successors: %bb.5(0x80000000) + + %7:gpr64 = LDRXui %8, 0 :: (load 8 from `double* undef`) + B %bb.5 + + bb.3.if.else142.i: + successors: %bb.4(0x40000000), %bb.5(0x40000000) + + %26:fpr64 = FMOVD0 + %19:gpr32 = COPY $wzr + CBNZW %19, %bb.5 + + bb.4.if.then155.i: + successors: %bb.5(0x80000000) + + %27:fpr64 = FMOVD0 + + bb.5.if.end161.i: + successors: %bb.6(0x40000000), %bb.7(0x40000000) + + %9:gpr64 = PHI %7, %bb.2, %26, %bb.3, %27, %bb.4 + %21:fpr64 = COPY %9 + %25:fpr64 = FMOVD0 + %10:fpr64 = FADDDrr %25, %21 + %22:fpr64 = COPY %4 + %11:fpr64 = FMULDrr %22, %10 + %23:fpr64 = COPY %4 + %13:fpr64 = FABD64 %23, %11 + %28:gpr64 = MOVi64imm 4307583784117748259 + %24:fpr64 = COPY %28 + FCMPDrr %13, %24, implicit-def $nzcv + %17:gpr32 = CSINCWr $wzr, $wzr, 5, implicit $nzcv + TBNZW %17, 0, %bb.6 + B %bb.7 + + bb.6.if.then.i.i: + successors: + + + bb.7.if.end9.i.i: + RET_ReallyLR + +... diff --git a/llvm/test/CodeGen/AArch64/nontemporal.ll b/llvm/test/CodeGen/AArch64/nontemporal.ll index d8785f845c29d7..241879ad5d5d41 100644 --- a/llvm/test/CodeGen/AArch64/nontemporal.ll +++ b/llvm/test/CodeGen/AArch64/nontemporal.ll @@ -2,10 +2,7 @@ define void @test_stnp_v4i64(<4 x i64>* %p, <4 x i64> %v) #0 { ; CHECK-LABEL: test_stnp_v4i64: -; CHECK-NEXT: mov d[[HI1:[0-9]+]], v1[1] -; CHECK-NEXT: mov d[[HI0:[0-9]+]], v0[1] -; CHECK-NEXT: stnp d1, d[[HI1]], [x0, #16] -; CHECK-NEXT: stnp d0, d[[HI0]], [x0] +; CHECK-NEXT: stnp q0, q1, [x0] ; CHECK-NEXT: ret store <4 x i64> %v, <4 x i64>* %p, align 1, !nontemporal !0 ret void @@ -334,6 +331,149 @@ define void @test_stnp_v4f32_offset_alloca_2(<4 x float> %v) #0 { ret void } +define void @test_stnp_v32i8(<32 x i8> %v, <32 x i8>* %ptr) { +; CHECK-LABEL: _test_stnp_v32i8: +; CHECK-NEXT: .cfi_startproc +; CHECK-NEXT: stnp q0, q1, [x0] +; CHECK-NEXT: ret + +entry: + store <32 x i8> %v, <32 x i8>* %ptr, align 4, !nontemporal !0 + ret void +} + +define void @test_stnp_v32i16(<32 x i16> %v, <32 x i16>* %ptr) { +; CHECK-LABEL: _test_stnp_v32i16: +; CHECK-NEXT: .cfi_startproc +; CHECK-NEXT: stnp q2, q3, [x0, #32] +; CHECK-NEXT: stnp q0, q1, [x0] +; CHECK-NEXT: ret + +entry: + store <32 x i16> %v, <32 x i16>* %ptr, align 4, !nontemporal !0 + ret void +} + +define void @test_stnp_v32f16(<32 x half> %v, <32 x half>* %ptr) { +; CHECK-LABEL: _test_stnp_v32f16: +; CHECK-NEXT: .cfi_startproc +; CHECK-NEXT: stnp q2, q3, [x0, #32] +; CHECK-NEXT: stnp q0, q1, [x0] +; CHECK-NEXT: ret + +entry: + store <32 x half> %v, <32 x half>* %ptr, align 4, !nontemporal !0 + ret void +} + +define void @test_stnp_v16i32(<16 x i32> %v, <16 x i32>* %ptr) { +; CHECK-LABEL: _test_stnp_v16i32: +; CHECK-NEXT: .cfi_startproc +; CHECK-NEXT: stnp q2, q3, [x0, #32] +; CHECK-NEXT: stnp q0, q1, [x0] +; CHECK-NEXT: ret + +entry: + store <16 x i32> %v, <16 x i32>* %ptr, align 4, !nontemporal !0 + ret void +} + +define void @test_stnp_v16f32(<16 x float> %v, <16 x float>* %ptr) { +; CHECK-LABEL: _test_stnp_v16f32: +; CHECK-NEXT: .cfi_startproc +; CHECK-NEXT: stnp q2, q3, [x0, #32] +; CHECK-NEXT: stnp q0, q1, [x0] +; CHECK-NEXT: ret + +entry: + store <16 x float> %v, <16 x float>* %ptr, align 4, !nontemporal !0 + ret void +} + +define void @test_stnp_v17f32(<17 x float> %v, <17 x float>* %ptr) { +; CHECK-LABEL: _test_stnp_v17f32: +; CHECK-NEXT: .cfi_startproc +; CHECK-NEXT: ldr s16, [sp, #16] +; CHECK-NEXT: mov.s v0[1], v1[0] +; CHECK-NEXT: mov.s v4[1], v5[0] +; CHECK-NEXT: ldr s1, [sp] +; CHECK-NEXT: add x8, sp, #20 +; CHECK-NEXT: ld1.s { v16 }[1], [x8] +; CHECK-NEXT: add x8, sp, #4 +; CHECK-NEXT: ld1.s { v1 }[1], [x8] +; CHECK-NEXT: add x8, sp, #24 +; CHECK-NEXT: ld1.s { v16 }[2], [x8] +; CHECK-NEXT: add x8, sp, #8 +; CHECK-NEXT: ld1.s { v1 }[2], [x8] +; CHECK-NEXT: add x8, sp, #28 +; CHECK-NEXT: ld1.s { v16 }[3], [x8] +; CHECK-NEXT: add x8, sp, #12 +; CHECK-NEXT: mov.s v0[2], v2[0] +; CHECK-NEXT: ldr s2, [sp, #32] +; CHECK-NEXT: mov.s v4[2], v6[0] +; CHECK-NEXT: mov.s v0[3], v3[0] +; CHECK-NEXT: mov.s v4[3], v7[0] +; CHECK-NEXT: mov d3, v4[1] +; CHECK-NEXT: mov d5, v0[1] +; CHECK-NEXT: ld1.s { v1 }[3], [x8] +; CHECK-NEXT: stnp d4, d3, [x0, #16] +; CHECK-NEXT: stnp d0, d5, [x0] +; CHECK-NEXT: mov d0, v16[1] +; CHECK-NEXT: mov d3, v1[1] +; CHECK-NEXT: stnp d16, d0, [x0, #48] +; CHECK-NEXT: stnp d1, d3, [x0, #32] +; CHECK-NEXT: str s2, [x0, #64] +; CHECK-NEXT: ret + +entry: + store <17 x float> %v, <17 x float>* %ptr, align 4, !nontemporal !0 + ret void +} +define void @test_stnp_v16i32_invalid_offset(<16 x i32> %v, <16 x i32>* %ptr) { +; CHECK-LABEL: _test_stnp_v16i32_invalid_offset: +; CHECK-NEXT: .cfi_startproc +; CHECK-NEXT: mov w8, #32000 +; CHECK-NEXT: mov w9, #32032 +; CHECK-NEXT: add x8, x0, x8 +; CHECK-NEXT: add x9, x0, x9 +; CHECK-NEXT: stnp q2, q3, [x9] +; CHECK-NEXT: stnp q0, q1, [x8] +; CHECK-NEXT: ret + +entry: + %gep = getelementptr <16 x i32>, <16 x i32>* %ptr, i32 500 + store <16 x i32> %v, <16 x i32>* %gep, align 4, !nontemporal !0 + ret void +} + +define void @test_stnp_v16f64(<16 x double> %v, <16 x double>* %ptr) { +; CHECK-LABEL: _test_stnp_v16f64: +; CHECK-NEXT: .cfi_startproc +; CHECK-NEXT: stnp q6, q7, [x0, #96] +; CHECK-NEXT: stnp q4, q5, [x0, #64] +; CHECK-NEXT: stnp q2, q3, [x0, #32] +; CHECK-NEXT: stnp q0, q1, [x0] +; CHECK-NEXT: ret + +entry: + store <16 x double> %v, <16 x double>* %ptr, align 4, !nontemporal !0 + ret void +} + +define void @test_stnp_v16i64(<16 x i64> %v, <16 x i64>* %ptr) { +; CHECK-LABEL: _test_stnp_v16i64: +; CHECK-NEXT: .cfi_startproc +; CHECK-NEXT: stnp q6, q7, [x0, #96] +; CHECK-NEXT: stnp q4, q5, [x0, #64] +; CHECK-NEXT: stnp q2, q3, [x0, #32] +; CHECK-NEXT: stnp q0, q1, [x0] +; CHECK-NEXT: ret + +entry: + store <16 x i64> %v, <16 x i64>* %ptr, align 4, !nontemporal !0 + ret void +} + !0 = !{ i32 1 } attributes #0 = { nounwind } diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/divergent-control-flow.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/divergent-control-flow.ll index 40e182067023dc..d787e40707be37 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/divergent-control-flow.ll +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/divergent-control-flow.ll @@ -10,9 +10,8 @@ define i32 @divergent_if_swap_brtarget_order0(i32 %value) { ; CHECK-NEXT: v_cmp_ne_u32_e32 vcc, 0, v0 ; CHECK-NEXT: ; implicit-def: $vgpr0 ; CHECK-NEXT: s_and_saveexec_b64 s[4:5], vcc -; CHECK-NEXT: ; mask branch BB0_2 ; CHECK-NEXT: s_cbranch_execz BB0_2 -; CHECK-NEXT: BB0_1: ; %if.true +; CHECK-NEXT: ; %bb.1: ; %if.true ; CHECK-NEXT: global_load_dword v0, v[0:1], off ; CHECK-NEXT: BB0_2: ; %endif ; CHECK-NEXT: s_or_b64 exec, exec, s[4:5] @@ -38,12 +37,10 @@ define i32 @divergent_if_swap_brtarget_order1(i32 %value) { ; CHECK-NEXT: v_cmp_ne_u32_e32 vcc, 0, v0 ; CHECK-NEXT: ; implicit-def: $vgpr0 ; CHECK-NEXT: s_and_saveexec_b64 s[4:5], vcc -; CHECK-NEXT: ; mask branch BB1_2 -; CHECK-NEXT: BB1_1: ; %endif -; CHECK-NEXT: s_or_b64 exec, exec, s[4:5] -; CHECK-NEXT: s_setpc_b64 s[30:31] -; CHECK-NEXT: BB1_2: ; %if.true +; CHECK-NEXT: s_cbranch_execnz BB1_2 +; CHECK-NEXT: ; %bb.1: ; %if.true ; CHECK-NEXT: global_load_dword v0, v[0:1], off +; CHECK-NEXT: BB1_2: ; %endif ; CHECK-NEXT: s_or_b64 exec, exec, s[4:5] ; CHECK-NEXT: s_waitcnt vmcnt(0) ; CHECK-NEXT: s_setpc_b64 s[30:31] diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-ptr-add.mir b/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-ptr-add.mir index 01f43cd5a27c34..ce94f146fbce4a 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-ptr-add.mir +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-ptr-add.mir @@ -438,3 +438,149 @@ body: | S_ENDPGM 0, implicit %2 ... + +--- +name: gep_p999_sgpr_sgpr +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $sgpr0_sgpr1, $sgpr2_sgpr3 + ; GFX6-LABEL: name: gep_p999_sgpr_sgpr + ; GFX6: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1 + ; GFX6: [[COPY1:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3 + ; GFX6: [[COPY2:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0 + ; GFX6: [[COPY3:%[0-9]+]]:sreg_32 = COPY [[COPY1]].sub0 + ; GFX6: [[COPY4:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1 + ; GFX6: [[COPY5:%[0-9]+]]:sreg_32 = COPY [[COPY1]].sub1 + ; GFX6: [[S_ADD_U32_:%[0-9]+]]:sreg_32 = S_ADD_U32 [[COPY2]], [[COPY3]], implicit-def $scc + ; GFX6: [[S_ADDC_U32_:%[0-9]+]]:sreg_32 = S_ADDC_U32 [[COPY4]], [[COPY5]], implicit-def $scc, implicit $scc + ; GFX6: [[REG_SEQUENCE:%[0-9]+]]:sreg_64_xexec = REG_SEQUENCE [[S_ADD_U32_]], %subreg.sub0, [[S_ADDC_U32_]], %subreg.sub1 + ; GFX6: S_ENDPGM 0, implicit [[REG_SEQUENCE]] + ; GFX8-LABEL: name: gep_p999_sgpr_sgpr + ; GFX8: $vcc_hi = IMPLICIT_DEF + ; GFX8: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1 + ; GFX8: [[COPY1:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3 + ; GFX8: [[COPY2:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0 + ; GFX8: [[COPY3:%[0-9]+]]:sreg_32 = COPY [[COPY1]].sub0 + ; GFX8: [[COPY4:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1 + ; GFX8: [[COPY5:%[0-9]+]]:sreg_32 = COPY [[COPY1]].sub1 + ; GFX8: [[S_ADD_U32_:%[0-9]+]]:sreg_32 = S_ADD_U32 [[COPY2]], [[COPY3]], implicit-def $scc + ; GFX8: [[S_ADDC_U32_:%[0-9]+]]:sreg_32 = S_ADDC_U32 [[COPY4]], [[COPY5]], implicit-def $scc, implicit $scc + ; GFX8: [[REG_SEQUENCE:%[0-9]+]]:sreg_64_xexec = REG_SEQUENCE [[S_ADD_U32_]], %subreg.sub0, [[S_ADDC_U32_]], %subreg.sub1 + ; GFX8: S_ENDPGM 0, implicit [[REG_SEQUENCE]] + ; GFX9-LABEL: name: gep_p999_sgpr_sgpr + ; GFX9: $vcc_hi = IMPLICIT_DEF + ; GFX9: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1 + ; GFX9: [[COPY1:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3 + ; GFX9: [[COPY2:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0 + ; GFX9: [[COPY3:%[0-9]+]]:sreg_32 = COPY [[COPY1]].sub0 + ; GFX9: [[COPY4:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1 + ; GFX9: [[COPY5:%[0-9]+]]:sreg_32 = COPY [[COPY1]].sub1 + ; GFX9: [[S_ADD_U32_:%[0-9]+]]:sreg_32 = S_ADD_U32 [[COPY2]], [[COPY3]], implicit-def $scc + ; GFX9: [[S_ADDC_U32_:%[0-9]+]]:sreg_32 = S_ADDC_U32 [[COPY4]], [[COPY5]], implicit-def $scc, implicit $scc + ; GFX9: [[REG_SEQUENCE:%[0-9]+]]:sreg_64_xexec = REG_SEQUENCE [[S_ADD_U32_]], %subreg.sub0, [[S_ADDC_U32_]], %subreg.sub1 + ; GFX9: S_ENDPGM 0, implicit [[REG_SEQUENCE]] + ; GFX10-WAVE64-LABEL: name: gep_p999_sgpr_sgpr + ; GFX10-WAVE64: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1 + ; GFX10-WAVE64: [[COPY1:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3 + ; GFX10-WAVE64: [[COPY2:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0 + ; GFX10-WAVE64: [[COPY3:%[0-9]+]]:sreg_32 = COPY [[COPY1]].sub0 + ; GFX10-WAVE64: [[COPY4:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1 + ; GFX10-WAVE64: [[COPY5:%[0-9]+]]:sreg_32 = COPY [[COPY1]].sub1 + ; GFX10-WAVE64: [[S_ADD_U32_:%[0-9]+]]:sreg_32 = S_ADD_U32 [[COPY2]], [[COPY3]], implicit-def $scc + ; GFX10-WAVE64: [[S_ADDC_U32_:%[0-9]+]]:sreg_32 = S_ADDC_U32 [[COPY4]], [[COPY5]], implicit-def $scc, implicit $scc + ; GFX10-WAVE64: [[REG_SEQUENCE:%[0-9]+]]:sreg_64_xexec = REG_SEQUENCE [[S_ADD_U32_]], %subreg.sub0, [[S_ADDC_U32_]], %subreg.sub1 + ; GFX10-WAVE64: S_ENDPGM 0, implicit [[REG_SEQUENCE]] + ; GFX10-WAVE32-LABEL: name: gep_p999_sgpr_sgpr + ; GFX10-WAVE32: $vcc_hi = IMPLICIT_DEF + ; GFX10-WAVE32: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1 + ; GFX10-WAVE32: [[COPY1:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3 + ; GFX10-WAVE32: [[COPY2:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0 + ; GFX10-WAVE32: [[COPY3:%[0-9]+]]:sreg_32 = COPY [[COPY1]].sub0 + ; GFX10-WAVE32: [[COPY4:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1 + ; GFX10-WAVE32: [[COPY5:%[0-9]+]]:sreg_32 = COPY [[COPY1]].sub1 + ; GFX10-WAVE32: [[S_ADD_U32_:%[0-9]+]]:sreg_32 = S_ADD_U32 [[COPY2]], [[COPY3]], implicit-def $scc + ; GFX10-WAVE32: [[S_ADDC_U32_:%[0-9]+]]:sreg_32 = S_ADDC_U32 [[COPY4]], [[COPY5]], implicit-def $scc, implicit $scc + ; GFX10-WAVE32: [[REG_SEQUENCE:%[0-9]+]]:sreg_64_xexec = REG_SEQUENCE [[S_ADD_U32_]], %subreg.sub0, [[S_ADDC_U32_]], %subreg.sub1 + ; GFX10-WAVE32: S_ENDPGM 0, implicit [[REG_SEQUENCE]] + %0:sgpr(p999) = COPY $sgpr0_sgpr1 + %1:sgpr(s64) = COPY $sgpr2_sgpr3 + %2:sgpr(p999) = G_PTR_ADD %0, %1 + S_ENDPGM 0, implicit %2 + +... + +--- +name: gep_p999_vgpr_vgpr +legalized: true +regBankSelected: true + +body: | + bb.0: + liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 + ; GFX6-LABEL: name: gep_p999_vgpr_vgpr + ; GFX6: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1 + ; GFX6: [[COPY1:%[0-9]+]]:vreg_64 = COPY $vgpr2_vgpr3 + ; GFX6: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0 + ; GFX6: [[COPY3:%[0-9]+]]:vgpr_32 = COPY [[COPY1]].sub0 + ; GFX6: [[COPY4:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub1 + ; GFX6: [[COPY5:%[0-9]+]]:vgpr_32 = COPY [[COPY1]].sub1 + ; GFX6: [[V_ADD_I32_e64_:%[0-9]+]]:vgpr_32, [[V_ADD_I32_e64_1:%[0-9]+]]:sreg_64_xexec = V_ADD_I32_e64 [[COPY2]], [[COPY3]], 0, implicit $exec + ; GFX6: %8:vgpr_32, dead %10:sreg_64_xexec = V_ADDC_U32_e64 [[COPY4]], [[COPY5]], killed [[V_ADD_I32_e64_1]], 0, implicit $exec + ; GFX6: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[V_ADD_I32_e64_]], %subreg.sub0, %8, %subreg.sub1 + ; GFX6: S_ENDPGM 0, implicit [[REG_SEQUENCE]] + ; GFX8-LABEL: name: gep_p999_vgpr_vgpr + ; GFX8: $vcc_hi = IMPLICIT_DEF + ; GFX8: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1 + ; GFX8: [[COPY1:%[0-9]+]]:vreg_64 = COPY $vgpr2_vgpr3 + ; GFX8: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0 + ; GFX8: [[COPY3:%[0-9]+]]:vgpr_32 = COPY [[COPY1]].sub0 + ; GFX8: [[COPY4:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub1 + ; GFX8: [[COPY5:%[0-9]+]]:vgpr_32 = COPY [[COPY1]].sub1 + ; GFX8: [[V_ADD_I32_e64_:%[0-9]+]]:vgpr_32, [[V_ADD_I32_e64_1:%[0-9]+]]:sreg_32_xm0_xexec = V_ADD_I32_e64 [[COPY2]], [[COPY3]], 0, implicit $exec + ; GFX8: %8:vgpr_32, dead %10:sreg_32_xm0_xexec = V_ADDC_U32_e64 [[COPY4]], [[COPY5]], killed [[V_ADD_I32_e64_1]], 0, implicit $exec + ; GFX8: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[V_ADD_I32_e64_]], %subreg.sub0, %8, %subreg.sub1 + ; GFX8: S_ENDPGM 0, implicit [[REG_SEQUENCE]] + ; GFX9-LABEL: name: gep_p999_vgpr_vgpr + ; GFX9: $vcc_hi = IMPLICIT_DEF + ; GFX9: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1 + ; GFX9: [[COPY1:%[0-9]+]]:vreg_64 = COPY $vgpr2_vgpr3 + ; GFX9: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0 + ; GFX9: [[COPY3:%[0-9]+]]:vgpr_32 = COPY [[COPY1]].sub0 + ; GFX9: [[COPY4:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub1 + ; GFX9: [[COPY5:%[0-9]+]]:vgpr_32 = COPY [[COPY1]].sub1 + ; GFX9: [[V_ADD_I32_e64_:%[0-9]+]]:vgpr_32, [[V_ADD_I32_e64_1:%[0-9]+]]:sreg_32_xm0_xexec = V_ADD_I32_e64 [[COPY2]], [[COPY3]], 0, implicit $exec + ; GFX9: %8:vgpr_32, dead %10:sreg_32_xm0_xexec = V_ADDC_U32_e64 [[COPY4]], [[COPY5]], killed [[V_ADD_I32_e64_1]], 0, implicit $exec + ; GFX9: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[V_ADD_I32_e64_]], %subreg.sub0, %8, %subreg.sub1 + ; GFX9: S_ENDPGM 0, implicit [[REG_SEQUENCE]] + ; GFX10-WAVE64-LABEL: name: gep_p999_vgpr_vgpr + ; GFX10-WAVE64: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1 + ; GFX10-WAVE64: [[COPY1:%[0-9]+]]:vreg_64 = COPY $vgpr2_vgpr3 + ; GFX10-WAVE64: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0 + ; GFX10-WAVE64: [[COPY3:%[0-9]+]]:vgpr_32 = COPY [[COPY1]].sub0 + ; GFX10-WAVE64: [[COPY4:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub1 + ; GFX10-WAVE64: [[COPY5:%[0-9]+]]:vgpr_32 = COPY [[COPY1]].sub1 + ; GFX10-WAVE64: [[V_ADD_I32_e64_:%[0-9]+]]:vgpr_32, [[V_ADD_I32_e64_1:%[0-9]+]]:sreg_64_xexec = V_ADD_I32_e64 [[COPY2]], [[COPY3]], 0, implicit $exec + ; GFX10-WAVE64: %8:vgpr_32, dead %10:sreg_64_xexec = V_ADDC_U32_e64 [[COPY4]], [[COPY5]], killed [[V_ADD_I32_e64_1]], 0, implicit $exec + ; GFX10-WAVE64: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[V_ADD_I32_e64_]], %subreg.sub0, %8, %subreg.sub1 + ; GFX10-WAVE64: S_ENDPGM 0, implicit [[REG_SEQUENCE]] + ; GFX10-WAVE32-LABEL: name: gep_p999_vgpr_vgpr + ; GFX10-WAVE32: $vcc_hi = IMPLICIT_DEF + ; GFX10-WAVE32: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1 + ; GFX10-WAVE32: [[COPY1:%[0-9]+]]:vreg_64 = COPY $vgpr2_vgpr3 + ; GFX10-WAVE32: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0 + ; GFX10-WAVE32: [[COPY3:%[0-9]+]]:vgpr_32 = COPY [[COPY1]].sub0 + ; GFX10-WAVE32: [[COPY4:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub1 + ; GFX10-WAVE32: [[COPY5:%[0-9]+]]:vgpr_32 = COPY [[COPY1]].sub1 + ; GFX10-WAVE32: [[V_ADD_I32_e64_:%[0-9]+]]:vgpr_32, [[V_ADD_I32_e64_1:%[0-9]+]]:sreg_32_xm0_xexec = V_ADD_I32_e64 [[COPY2]], [[COPY3]], 0, implicit $exec + ; GFX10-WAVE32: %8:vgpr_32, dead %10:sreg_32_xm0_xexec = V_ADDC_U32_e64 [[COPY4]], [[COPY5]], killed [[V_ADD_I32_e64_1]], 0, implicit $exec + ; GFX10-WAVE32: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[V_ADD_I32_e64_]], %subreg.sub0, %8, %subreg.sub1 + ; GFX10-WAVE32: S_ENDPGM 0, implicit [[REG_SEQUENCE]] + %0:vgpr(p999) = COPY $vgpr0_vgpr1 + %1:vgpr(s64) = COPY $vgpr2_vgpr3 + %2:vgpr(p999) = G_PTR_ADD %0, %1 + S_ENDPGM 0, implicit %2 + +... diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-ptr-add.mir b/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-ptr-add.mir index b54ab98bb78c61..709e9a24493c6f 100644 --- a/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-ptr-add.mir +++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-ptr-add.mir @@ -10,8 +10,8 @@ body: | ; CHECK-LABEL: name: test_gep_global_i64_idx ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3 - ; CHECK: [[GEP:%[0-9]+]]:_(p1) = G_PTR_ADD [[COPY]], [[COPY1]](s64) - ; CHECK: $vgpr0_vgpr1 = COPY [[GEP]](p1) + ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p1) = G_PTR_ADD [[COPY]], [[COPY1]](s64) + ; CHECK: $vgpr0_vgpr1 = COPY [[PTR_ADD]](p1) %0:_(p1) = COPY $vgpr0_vgpr1 %1:_(s64) = COPY $vgpr2_vgpr3 %2:_(p1) = G_PTR_ADD %0, %1 @@ -28,8 +28,8 @@ body: | ; CHECK-LABEL: name: test_gep_flat_i64_idx ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3 - ; CHECK: [[GEP:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[COPY1]](s64) - ; CHECK: $vgpr0_vgpr1 = COPY [[GEP]](p0) + ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[COPY1]](s64) + ; CHECK: $vgpr0_vgpr1 = COPY [[PTR_ADD]](p0) %0:_(p0) = COPY $vgpr0_vgpr1 %1:_(s64) = COPY $vgpr2_vgpr3 %2:_(p0) = G_PTR_ADD %0, %1 @@ -46,8 +46,8 @@ body: | ; CHECK-LABEL: name: test_gep_constant_i64_idx ; CHECK: [[COPY:%[0-9]+]]:_(p4) = COPY $vgpr0_vgpr1 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3 - ; CHECK: [[GEP:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY]], [[COPY1]](s64) - ; CHECK: $vgpr0_vgpr1 = COPY [[GEP]](p4) + ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p4) = G_PTR_ADD [[COPY]], [[COPY1]](s64) + ; CHECK: $vgpr0_vgpr1 = COPY [[PTR_ADD]](p4) %0:_(p4) = COPY $vgpr0_vgpr1 %1:_(s64) = COPY $vgpr2_vgpr3 %2:_(p4) = G_PTR_ADD %0, %1 @@ -64,8 +64,8 @@ body: | ; CHECK-LABEL: name: test_gep_local_i32_idx ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1 - ; CHECK: [[GEP:%[0-9]+]]:_(p3) = G_PTR_ADD [[COPY]], [[COPY1]](s32) - ; CHECK: $vgpr0 = COPY [[GEP]](p3) + ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p3) = G_PTR_ADD [[COPY]], [[COPY1]](s32) + ; CHECK: $vgpr0 = COPY [[PTR_ADD]](p3) %0:_(p3) = COPY $vgpr0 %1:_(s32) = COPY $vgpr1 %2:_(p3) = G_PTR_ADD %0, %1 @@ -82,8 +82,8 @@ body: | ; CHECK-LABEL: name: test_gep_private_i32_idx ; CHECK: [[COPY:%[0-9]+]]:_(p5) = COPY $vgpr0 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1 - ; CHECK: [[GEP:%[0-9]+]]:_(p5) = G_PTR_ADD [[COPY]], [[COPY1]](s32) - ; CHECK: $vgpr0 = COPY [[GEP]](p5) + ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p5) = G_PTR_ADD [[COPY]], [[COPY1]](s32) + ; CHECK: $vgpr0 = COPY [[PTR_ADD]](p5) %0:_(p5) = COPY $vgpr0 %1:_(s32) = COPY $vgpr1 %2:_(p5) = G_PTR_ADD %0, %1 @@ -100,8 +100,8 @@ body: | ; CHECK-LABEL: name: test_gep_constant32_i32_idx ; CHECK: [[COPY:%[0-9]+]]:_(p6) = COPY $sgpr0 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $sgpr1 - ; CHECK: [[GEP:%[0-9]+]]:_(p6) = G_PTR_ADD [[COPY]], [[COPY1]](s32) - ; CHECK: $sgpr0 = COPY [[GEP]](p6) + ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p6) = G_PTR_ADD [[COPY]], [[COPY1]](s32) + ; CHECK: $sgpr0 = COPY [[PTR_ADD]](p6) %0:_(p6) = COPY $sgpr0 %1:_(s32) = COPY $sgpr1 %2:_(p6) = G_PTR_ADD %0, %1 @@ -118,11 +118,28 @@ body: | ; CHECK-LABEL: name: test_gep_region_i32_idx ; CHECK: [[COPY:%[0-9]+]]:_(p2) = COPY $vgpr0 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1 - ; CHECK: [[GEP:%[0-9]+]]:_(p2) = G_PTR_ADD [[COPY]], [[COPY1]](s32) - ; CHECK: $vgpr0 = COPY [[GEP]](p2) + ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p2) = G_PTR_ADD [[COPY]], [[COPY1]](s32) + ; CHECK: $vgpr0 = COPY [[PTR_ADD]](p2) %0:_(p2) = COPY $vgpr0 %1:_(s32) = COPY $vgpr1 %2:_(p2) = G_PTR_ADD %0, %1 $vgpr0 = COPY %2 ... + +--- +name: test_gep_p999_i64_idx +body: | + bb.0: + liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 + + ; CHECK-LABEL: name: test_gep_p999_i64_idx + ; CHECK: [[COPY:%[0-9]+]]:_(p999) = COPY $vgpr0_vgpr1 + ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3 + ; CHECK: [[PTR_ADD:%[0-9]+]]:_(p999) = G_PTR_ADD [[COPY]], [[COPY1]](s64) + ; CHECK: $vgpr0_vgpr1 = COPY [[PTR_ADD]](p999) + %0:_(p999) = COPY $vgpr0_vgpr1 + %1:_(s64) = COPY $vgpr2_vgpr3 + %2:_(p999) = G_PTR_ADD %0, %1 + $vgpr0_vgpr1 = COPY %2 +... diff --git a/llvm/test/CodeGen/AMDGPU/atomic_optimizations_local_pointer.ll b/llvm/test/CodeGen/AMDGPU/atomic_optimizations_local_pointer.ll index 2fec729a3da9c5..84d39acb17febe 100644 --- a/llvm/test/CodeGen/AMDGPU/atomic_optimizations_local_pointer.ll +++ b/llvm/test/CodeGen/AMDGPU/atomic_optimizations_local_pointer.ll @@ -24,9 +24,8 @@ define amdgpu_kernel void @add_i32_constant(i32 addrspace(1)* %out) { ; GFX7LESS-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX7LESS-NEXT: ; implicit-def: $vgpr1 ; GFX7LESS-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX7LESS-NEXT: ; mask branch BB0_2 ; GFX7LESS-NEXT: s_cbranch_execz BB0_2 -; GFX7LESS-NEXT: BB0_1: +; GFX7LESS-NEXT: ; %bb.1: ; GFX7LESS-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX7LESS-NEXT: v_mov_b32_e32 v1, local_var32@abs32@lo ; GFX7LESS-NEXT: v_mul_u32_u24_e64 v2, s4, 5 @@ -54,9 +53,8 @@ define amdgpu_kernel void @add_i32_constant(i32 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr1 ; GFX8-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX8-NEXT: ; mask branch BB0_2 ; GFX8-NEXT: s_cbranch_execz BB0_2 -; GFX8-NEXT: BB0_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX8-NEXT: v_mul_u32_u24_e64 v1, s4, 5 ; GFX8-NEXT: v_mov_b32_e32 v2, local_var32@abs32@lo @@ -85,9 +83,8 @@ define amdgpu_kernel void @add_i32_constant(i32 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr1 ; GFX9-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX9-NEXT: ; mask branch BB0_2 ; GFX9-NEXT: s_cbranch_execz BB0_2 -; GFX9-NEXT: BB0_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX9-NEXT: v_mul_u32_u24_e64 v1, s4, 5 ; GFX9-NEXT: v_mov_b32_e32 v2, local_var32@abs32@lo @@ -115,9 +112,8 @@ define amdgpu_kernel void @add_i32_constant(i32 addrspace(1)* %out) { ; GFX1064-NEXT: v_mbcnt_hi_u32_b32_e64 v0, s3, v0 ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB0_2 ; GFX1064-NEXT: s_cbranch_execz BB0_2 -; GFX1064-NEXT: BB0_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: s_bcnt1_i32_b64 s2, s[2:3] ; GFX1064-NEXT: v_mov_b32_e32 v2, local_var32@abs32@lo ; GFX1064-NEXT: v_mul_u32_u24_e64 v1, s2, 5 @@ -148,9 +144,8 @@ define amdgpu_kernel void @add_i32_constant(i32 addrspace(1)* %out) { ; GFX1032-NEXT: v_mbcnt_lo_u32_b32_e64 v0, s3, 0 ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: s_and_saveexec_b32 s2, vcc_lo -; GFX1032-NEXT: ; mask branch BB0_2 ; GFX1032-NEXT: s_cbranch_execz BB0_2 -; GFX1032-NEXT: BB0_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: s_bcnt1_i32_b32 s3, s3 ; GFX1032-NEXT: v_mov_b32_e32 v2, local_var32@abs32@lo ; GFX1032-NEXT: v_mul_u32_u24_e64 v1, s3, 5 @@ -190,9 +185,8 @@ define amdgpu_kernel void @add_i32_uniform(i32 addrspace(1)* %out, i32 %additive ; GFX7LESS-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX7LESS-NEXT: ; implicit-def: $vgpr1 ; GFX7LESS-NEXT: s_and_saveexec_b64 s[0:1], vcc -; GFX7LESS-NEXT: ; mask branch BB1_2 ; GFX7LESS-NEXT: s_cbranch_execz BB1_2 -; GFX7LESS-NEXT: BB1_1: +; GFX7LESS-NEXT: ; %bb.1: ; GFX7LESS-NEXT: s_bcnt1_i32_b64 s3, s[6:7] ; GFX7LESS-NEXT: s_waitcnt lgkmcnt(0) ; GFX7LESS-NEXT: s_mul_i32 s3, s2, s3 @@ -224,9 +218,8 @@ define amdgpu_kernel void @add_i32_uniform(i32 addrspace(1)* %out, i32 %additive ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr1 ; GFX8-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX8-NEXT: ; mask branch BB1_2 ; GFX8-NEXT: s_cbranch_execz BB1_2 -; GFX8-NEXT: BB1_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: s_bcnt1_i32_b64 s1, s[6:7] ; GFX8-NEXT: s_waitcnt lgkmcnt(0) ; GFX8-NEXT: s_mul_i32 s1, s0, s1 @@ -258,9 +251,8 @@ define amdgpu_kernel void @add_i32_uniform(i32 addrspace(1)* %out, i32 %additive ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr1 ; GFX9-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX9-NEXT: ; mask branch BB1_2 ; GFX9-NEXT: s_cbranch_execz BB1_2 -; GFX9-NEXT: BB1_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: s_bcnt1_i32_b64 s1, s[6:7] ; GFX9-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-NEXT: s_mul_i32 s1, s0, s1 @@ -291,9 +283,8 @@ define amdgpu_kernel void @add_i32_uniform(i32 addrspace(1)* %out, i32 %additive ; GFX1064-NEXT: v_mbcnt_hi_u32_b32_e64 v0, s3, v0 ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: s_and_saveexec_b64 s[6:7], vcc -; GFX1064-NEXT: ; mask branch BB1_2 ; GFX1064-NEXT: s_cbranch_execz BB1_2 -; GFX1064-NEXT: BB1_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: s_bcnt1_i32_b64 s1, s[2:3] ; GFX1064-NEXT: v_mov_b32_e32 v1, local_var32@abs32@lo ; GFX1064-NEXT: s_waitcnt lgkmcnt(0) @@ -327,9 +318,8 @@ define amdgpu_kernel void @add_i32_uniform(i32 addrspace(1)* %out, i32 %additive ; GFX1032-NEXT: v_mbcnt_lo_u32_b32_e64 v0, s2, 0 ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: s_and_saveexec_b32 s1, vcc_lo -; GFX1032-NEXT: ; mask branch BB1_2 ; GFX1032-NEXT: s_cbranch_execz BB1_2 -; GFX1032-NEXT: BB1_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: s_bcnt1_i32_b32 s2, s2 ; GFX1032-NEXT: v_mov_b32_e32 v1, local_var32@abs32@lo ; GFX1032-NEXT: s_waitcnt lgkmcnt(0) @@ -415,9 +405,8 @@ define amdgpu_kernel void @add_i32_varying(i32 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr0 ; GFX8-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX8-NEXT: ; mask branch BB2_2 ; GFX8-NEXT: s_cbranch_execz BB2_2 -; GFX8-NEXT: BB2_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v3, s2 ; GFX8-NEXT: s_mov_b32 m0, -1 @@ -469,9 +458,8 @@ define amdgpu_kernel void @add_i32_varying(i32 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr0 ; GFX9-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX9-NEXT: ; mask branch BB2_2 ; GFX9-NEXT: s_cbranch_execz BB2_2 -; GFX9-NEXT: BB2_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v3, s2 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -527,9 +515,8 @@ define amdgpu_kernel void @add_i32_varying(i32 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: ; implicit-def: $vgpr0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB2_2 ; GFX1064-NEXT: s_cbranch_execz BB2_2 -; GFX1064-NEXT: BB2_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v7, s3 ; GFX1064-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -580,9 +567,8 @@ define amdgpu_kernel void @add_i32_varying(i32 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: ; implicit-def: $vgpr0 ; GFX1032-NEXT: s_and_saveexec_b32 s4, vcc_lo -; GFX1032-NEXT: ; mask branch BB2_2 ; GFX1032-NEXT: s_cbranch_execz BB2_2 -; GFX1032-NEXT: BB2_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v7, s3 ; GFX1032-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -658,9 +644,8 @@ define amdgpu_kernel void @add_i32_varying_gfx1032(i32 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr0 ; GFX8-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX8-NEXT: ; mask branch BB3_2 ; GFX8-NEXT: s_cbranch_execz BB3_2 -; GFX8-NEXT: BB3_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v3, s2 ; GFX8-NEXT: s_mov_b32 m0, -1 @@ -712,9 +697,8 @@ define amdgpu_kernel void @add_i32_varying_gfx1032(i32 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr0 ; GFX9-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX9-NEXT: ; mask branch BB3_2 ; GFX9-NEXT: s_cbranch_execz BB3_2 -; GFX9-NEXT: BB3_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v3, s2 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -770,9 +754,8 @@ define amdgpu_kernel void @add_i32_varying_gfx1032(i32 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: ; implicit-def: $vgpr0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB3_2 ; GFX1064-NEXT: s_cbranch_execz BB3_2 -; GFX1064-NEXT: BB3_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v7, s3 ; GFX1064-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -823,9 +806,8 @@ define amdgpu_kernel void @add_i32_varying_gfx1032(i32 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: ; implicit-def: $vgpr0 ; GFX1032-NEXT: s_and_saveexec_b32 s4, vcc_lo -; GFX1032-NEXT: ; mask branch BB3_2 ; GFX1032-NEXT: s_cbranch_execz BB3_2 -; GFX1032-NEXT: BB3_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v7, s3 ; GFX1032-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -901,9 +883,8 @@ define amdgpu_kernel void @add_i32_varying_gfx1064(i32 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr0 ; GFX8-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX8-NEXT: ; mask branch BB4_2 ; GFX8-NEXT: s_cbranch_execz BB4_2 -; GFX8-NEXT: BB4_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v3, s2 ; GFX8-NEXT: s_mov_b32 m0, -1 @@ -955,9 +936,8 @@ define amdgpu_kernel void @add_i32_varying_gfx1064(i32 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr0 ; GFX9-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX9-NEXT: ; mask branch BB4_2 ; GFX9-NEXT: s_cbranch_execz BB4_2 -; GFX9-NEXT: BB4_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v3, s2 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -1013,9 +993,8 @@ define amdgpu_kernel void @add_i32_varying_gfx1064(i32 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: ; implicit-def: $vgpr0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB4_2 ; GFX1064-NEXT: s_cbranch_execz BB4_2 -; GFX1064-NEXT: BB4_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v7, s3 ; GFX1064-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -1066,9 +1045,8 @@ define amdgpu_kernel void @add_i32_varying_gfx1064(i32 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: ; implicit-def: $vgpr0 ; GFX1032-NEXT: s_and_saveexec_b32 s4, vcc_lo -; GFX1032-NEXT: ; mask branch BB4_2 ; GFX1032-NEXT: s_cbranch_execz BB4_2 -; GFX1032-NEXT: BB4_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v7, s3 ; GFX1032-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -1107,9 +1085,8 @@ define amdgpu_kernel void @add_i64_constant(i64 addrspace(1)* %out) { ; GFX7LESS-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX7LESS-NEXT: ; implicit-def: $vgpr1_vgpr2 ; GFX7LESS-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX7LESS-NEXT: ; mask branch BB5_2 ; GFX7LESS-NEXT: s_cbranch_execz BB5_2 -; GFX7LESS-NEXT: BB5_1: +; GFX7LESS-NEXT: ; %bb.1: ; GFX7LESS-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX7LESS-NEXT: v_mov_b32_e32 v3, local_var64@abs32@lo ; GFX7LESS-NEXT: v_mul_hi_u32_u24_e64 v2, s4, 5 @@ -1143,9 +1120,8 @@ define amdgpu_kernel void @add_i64_constant(i64 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr1_vgpr2 ; GFX8-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX8-NEXT: ; mask branch BB5_2 ; GFX8-NEXT: s_cbranch_execz BB5_2 -; GFX8-NEXT: BB5_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX8-NEXT: v_mul_hi_u32_u24_e64 v2, s4, 5 ; GFX8-NEXT: v_mul_u32_u24_e64 v1, s4, 5 @@ -1178,9 +1154,8 @@ define amdgpu_kernel void @add_i64_constant(i64 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr1_vgpr2 ; GFX9-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX9-NEXT: ; mask branch BB5_2 ; GFX9-NEXT: s_cbranch_execz BB5_2 -; GFX9-NEXT: BB5_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX9-NEXT: v_mul_hi_u32_u24_e64 v2, s4, 5 ; GFX9-NEXT: v_mul_u32_u24_e64 v1, s4, 5 @@ -1212,9 +1187,8 @@ define amdgpu_kernel void @add_i64_constant(i64 addrspace(1)* %out) { ; GFX1064-NEXT: v_mbcnt_hi_u32_b32_e64 v0, s5, v0 ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX1064-NEXT: ; mask branch BB5_2 ; GFX1064-NEXT: s_cbranch_execz BB5_2 -; GFX1064-NEXT: BB5_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX1064-NEXT: v_mov_b32_e32 v3, local_var64@abs32@lo ; GFX1064-NEXT: v_mul_hi_u32_u24_e64 v2, s4, 5 @@ -1247,9 +1221,8 @@ define amdgpu_kernel void @add_i64_constant(i64 addrspace(1)* %out) { ; GFX1032-NEXT: v_mbcnt_lo_u32_b32_e64 v0, s3, 0 ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: s_and_saveexec_b32 s2, vcc_lo -; GFX1032-NEXT: ; mask branch BB5_2 ; GFX1032-NEXT: s_cbranch_execz BB5_2 -; GFX1032-NEXT: BB5_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: s_bcnt1_i32_b32 s3, s3 ; GFX1032-NEXT: v_mov_b32_e32 v3, local_var64@abs32@lo ; GFX1032-NEXT: v_mul_hi_u32_u24_e64 v2, s3, 5 @@ -1290,9 +1263,8 @@ define amdgpu_kernel void @add_i64_uniform(i64 addrspace(1)* %out, i64 %additive ; GFX7LESS-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX7LESS-NEXT: ; implicit-def: $vgpr1_vgpr2 ; GFX7LESS-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX7LESS-NEXT: ; mask branch BB6_2 ; GFX7LESS-NEXT: s_cbranch_execz BB6_2 -; GFX7LESS-NEXT: BB6_1: +; GFX7LESS-NEXT: ; %bb.1: ; GFX7LESS-NEXT: s_bcnt1_i32_b64 s6, s[6:7] ; GFX7LESS-NEXT: v_mov_b32_e32 v3, local_var64@abs32@lo ; GFX7LESS-NEXT: s_waitcnt lgkmcnt(0) @@ -1335,9 +1307,8 @@ define amdgpu_kernel void @add_i64_uniform(i64 addrspace(1)* %out, i64 %additive ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr1_vgpr2 ; GFX8-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX8-NEXT: ; mask branch BB6_2 ; GFX8-NEXT: s_cbranch_execz BB6_2 -; GFX8-NEXT: BB6_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: s_bcnt1_i32_b64 s6, s[6:7] ; GFX8-NEXT: v_mov_b32_e32 v1, s6 ; GFX8-NEXT: s_waitcnt lgkmcnt(0) @@ -1380,9 +1351,8 @@ define amdgpu_kernel void @add_i64_uniform(i64 addrspace(1)* %out, i64 %additive ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr1_vgpr2 ; GFX9-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX9-NEXT: ; mask branch BB6_2 ; GFX9-NEXT: s_cbranch_execz BB6_2 -; GFX9-NEXT: BB6_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: s_bcnt1_i32_b64 s6, s[6:7] ; GFX9-NEXT: v_mov_b32_e32 v1, s6 ; GFX9-NEXT: s_waitcnt lgkmcnt(0) @@ -1424,9 +1394,8 @@ define amdgpu_kernel void @add_i64_uniform(i64 addrspace(1)* %out, i64 %additive ; GFX1064-NEXT: v_mbcnt_hi_u32_b32_e64 v0, s7, v0 ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB6_2 ; GFX1064-NEXT: s_cbranch_execz BB6_2 -; GFX1064-NEXT: BB6_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: s_bcnt1_i32_b64 s6, s[6:7] ; GFX1064-NEXT: v_mov_b32_e32 v3, local_var64@abs32@lo ; GFX1064-NEXT: s_waitcnt lgkmcnt(0) @@ -1467,9 +1436,8 @@ define amdgpu_kernel void @add_i64_uniform(i64 addrspace(1)* %out, i64 %additive ; GFX1032-NEXT: v_mbcnt_lo_u32_b32_e64 v0, s5, 0 ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: s_and_saveexec_b32 s4, vcc_lo -; GFX1032-NEXT: ; mask branch BB6_2 ; GFX1032-NEXT: s_cbranch_execz BB6_2 -; GFX1032-NEXT: BB6_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: s_bcnt1_i32_b32 s5, s5 ; GFX1032-NEXT: v_mov_b32_e32 v3, local_var64@abs32@lo ; GFX1032-NEXT: s_waitcnt lgkmcnt(0) @@ -1608,9 +1576,8 @@ define amdgpu_kernel void @sub_i32_constant(i32 addrspace(1)* %out) { ; GFX7LESS-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX7LESS-NEXT: ; implicit-def: $vgpr1 ; GFX7LESS-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX7LESS-NEXT: ; mask branch BB8_2 ; GFX7LESS-NEXT: s_cbranch_execz BB8_2 -; GFX7LESS-NEXT: BB8_1: +; GFX7LESS-NEXT: ; %bb.1: ; GFX7LESS-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX7LESS-NEXT: v_mov_b32_e32 v1, local_var32@abs32@lo ; GFX7LESS-NEXT: v_mul_u32_u24_e64 v2, s4, 5 @@ -1639,9 +1606,8 @@ define amdgpu_kernel void @sub_i32_constant(i32 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr1 ; GFX8-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX8-NEXT: ; mask branch BB8_2 ; GFX8-NEXT: s_cbranch_execz BB8_2 -; GFX8-NEXT: BB8_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX8-NEXT: v_mul_u32_u24_e64 v1, s4, 5 ; GFX8-NEXT: v_mov_b32_e32 v2, local_var32@abs32@lo @@ -1671,9 +1637,8 @@ define amdgpu_kernel void @sub_i32_constant(i32 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr1 ; GFX9-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX9-NEXT: ; mask branch BB8_2 ; GFX9-NEXT: s_cbranch_execz BB8_2 -; GFX9-NEXT: BB8_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX9-NEXT: v_mul_u32_u24_e64 v1, s4, 5 ; GFX9-NEXT: v_mov_b32_e32 v2, local_var32@abs32@lo @@ -1702,9 +1667,8 @@ define amdgpu_kernel void @sub_i32_constant(i32 addrspace(1)* %out) { ; GFX1064-NEXT: v_mbcnt_hi_u32_b32_e64 v0, s3, v0 ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB8_2 ; GFX1064-NEXT: s_cbranch_execz BB8_2 -; GFX1064-NEXT: BB8_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: s_bcnt1_i32_b64 s2, s[2:3] ; GFX1064-NEXT: v_mov_b32_e32 v2, local_var32@abs32@lo ; GFX1064-NEXT: v_mul_u32_u24_e64 v1, s2, 5 @@ -1736,9 +1700,8 @@ define amdgpu_kernel void @sub_i32_constant(i32 addrspace(1)* %out) { ; GFX1032-NEXT: v_mbcnt_lo_u32_b32_e64 v0, s3, 0 ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: s_and_saveexec_b32 s2, vcc_lo -; GFX1032-NEXT: ; mask branch BB8_2 ; GFX1032-NEXT: s_cbranch_execz BB8_2 -; GFX1032-NEXT: BB8_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: s_bcnt1_i32_b32 s3, s3 ; GFX1032-NEXT: v_mov_b32_e32 v2, local_var32@abs32@lo ; GFX1032-NEXT: v_mul_u32_u24_e64 v1, s3, 5 @@ -1779,9 +1742,8 @@ define amdgpu_kernel void @sub_i32_uniform(i32 addrspace(1)* %out, i32 %subitive ; GFX7LESS-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX7LESS-NEXT: ; implicit-def: $vgpr1 ; GFX7LESS-NEXT: s_and_saveexec_b64 s[0:1], vcc -; GFX7LESS-NEXT: ; mask branch BB9_2 ; GFX7LESS-NEXT: s_cbranch_execz BB9_2 -; GFX7LESS-NEXT: BB9_1: +; GFX7LESS-NEXT: ; %bb.1: ; GFX7LESS-NEXT: s_bcnt1_i32_b64 s3, s[6:7] ; GFX7LESS-NEXT: s_waitcnt lgkmcnt(0) ; GFX7LESS-NEXT: s_mul_i32 s3, s2, s3 @@ -1813,9 +1775,8 @@ define amdgpu_kernel void @sub_i32_uniform(i32 addrspace(1)* %out, i32 %subitive ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr1 ; GFX8-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX8-NEXT: ; mask branch BB9_2 ; GFX8-NEXT: s_cbranch_execz BB9_2 -; GFX8-NEXT: BB9_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: s_bcnt1_i32_b64 s1, s[6:7] ; GFX8-NEXT: s_waitcnt lgkmcnt(0) ; GFX8-NEXT: s_mul_i32 s1, s0, s1 @@ -1847,9 +1808,8 @@ define amdgpu_kernel void @sub_i32_uniform(i32 addrspace(1)* %out, i32 %subitive ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr1 ; GFX9-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX9-NEXT: ; mask branch BB9_2 ; GFX9-NEXT: s_cbranch_execz BB9_2 -; GFX9-NEXT: BB9_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: s_bcnt1_i32_b64 s1, s[6:7] ; GFX9-NEXT: s_waitcnt lgkmcnt(0) ; GFX9-NEXT: s_mul_i32 s1, s0, s1 @@ -1880,9 +1840,8 @@ define amdgpu_kernel void @sub_i32_uniform(i32 addrspace(1)* %out, i32 %subitive ; GFX1064-NEXT: v_mbcnt_hi_u32_b32_e64 v0, s3, v0 ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: s_and_saveexec_b64 s[6:7], vcc -; GFX1064-NEXT: ; mask branch BB9_2 ; GFX1064-NEXT: s_cbranch_execz BB9_2 -; GFX1064-NEXT: BB9_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: s_bcnt1_i32_b64 s1, s[2:3] ; GFX1064-NEXT: v_mov_b32_e32 v1, local_var32@abs32@lo ; GFX1064-NEXT: s_waitcnt lgkmcnt(0) @@ -1916,9 +1875,8 @@ define amdgpu_kernel void @sub_i32_uniform(i32 addrspace(1)* %out, i32 %subitive ; GFX1032-NEXT: v_mbcnt_lo_u32_b32_e64 v0, s2, 0 ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: s_and_saveexec_b32 s1, vcc_lo -; GFX1032-NEXT: ; mask branch BB9_2 ; GFX1032-NEXT: s_cbranch_execz BB9_2 -; GFX1032-NEXT: BB9_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: s_bcnt1_i32_b32 s2, s2 ; GFX1032-NEXT: v_mov_b32_e32 v1, local_var32@abs32@lo ; GFX1032-NEXT: s_waitcnt lgkmcnt(0) @@ -2004,9 +1962,8 @@ define amdgpu_kernel void @sub_i32_varying(i32 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr0 ; GFX8-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX8-NEXT: ; mask branch BB10_2 ; GFX8-NEXT: s_cbranch_execz BB10_2 -; GFX8-NEXT: BB10_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v3, s2 ; GFX8-NEXT: s_mov_b32 m0, -1 @@ -2058,9 +2015,8 @@ define amdgpu_kernel void @sub_i32_varying(i32 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr0 ; GFX9-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX9-NEXT: ; mask branch BB10_2 ; GFX9-NEXT: s_cbranch_execz BB10_2 -; GFX9-NEXT: BB10_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v3, s2 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -2116,9 +2072,8 @@ define amdgpu_kernel void @sub_i32_varying(i32 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: ; implicit-def: $vgpr0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB10_2 ; GFX1064-NEXT: s_cbranch_execz BB10_2 -; GFX1064-NEXT: BB10_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v7, s3 ; GFX1064-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -2169,9 +2124,8 @@ define amdgpu_kernel void @sub_i32_varying(i32 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: ; implicit-def: $vgpr0 ; GFX1032-NEXT: s_and_saveexec_b32 s4, vcc_lo -; GFX1032-NEXT: ; mask branch BB10_2 ; GFX1032-NEXT: s_cbranch_execz BB10_2 -; GFX1032-NEXT: BB10_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v7, s3 ; GFX1032-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -2210,9 +2164,8 @@ define amdgpu_kernel void @sub_i64_constant(i64 addrspace(1)* %out) { ; GFX7LESS-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX7LESS-NEXT: ; implicit-def: $vgpr1_vgpr2 ; GFX7LESS-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX7LESS-NEXT: ; mask branch BB11_2 ; GFX7LESS-NEXT: s_cbranch_execz BB11_2 -; GFX7LESS-NEXT: BB11_1: +; GFX7LESS-NEXT: ; %bb.1: ; GFX7LESS-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX7LESS-NEXT: v_mov_b32_e32 v3, local_var64@abs32@lo ; GFX7LESS-NEXT: v_mul_hi_u32_u24_e64 v2, s4, 5 @@ -2246,9 +2199,8 @@ define amdgpu_kernel void @sub_i64_constant(i64 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr1_vgpr2 ; GFX8-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX8-NEXT: ; mask branch BB11_2 ; GFX8-NEXT: s_cbranch_execz BB11_2 -; GFX8-NEXT: BB11_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX8-NEXT: v_mul_hi_u32_u24_e64 v2, s4, 5 ; GFX8-NEXT: v_mul_u32_u24_e64 v1, s4, 5 @@ -2282,9 +2234,8 @@ define amdgpu_kernel void @sub_i64_constant(i64 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr1_vgpr2 ; GFX9-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX9-NEXT: ; mask branch BB11_2 ; GFX9-NEXT: s_cbranch_execz BB11_2 -; GFX9-NEXT: BB11_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX9-NEXT: v_mul_hi_u32_u24_e64 v2, s4, 5 ; GFX9-NEXT: v_mul_u32_u24_e64 v1, s4, 5 @@ -2317,9 +2268,8 @@ define amdgpu_kernel void @sub_i64_constant(i64 addrspace(1)* %out) { ; GFX1064-NEXT: v_mbcnt_hi_u32_b32_e64 v0, s5, v0 ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX1064-NEXT: ; mask branch BB11_2 ; GFX1064-NEXT: s_cbranch_execz BB11_2 -; GFX1064-NEXT: BB11_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: s_bcnt1_i32_b64 s4, s[4:5] ; GFX1064-NEXT: v_mov_b32_e32 v3, local_var64@abs32@lo ; GFX1064-NEXT: v_mul_hi_u32_u24_e64 v2, s4, 5 @@ -2354,9 +2304,8 @@ define amdgpu_kernel void @sub_i64_constant(i64 addrspace(1)* %out) { ; GFX1032-NEXT: v_mbcnt_lo_u32_b32_e64 v0, s3, 0 ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: s_and_saveexec_b32 s2, vcc_lo -; GFX1032-NEXT: ; mask branch BB11_2 ; GFX1032-NEXT: s_cbranch_execz BB11_2 -; GFX1032-NEXT: BB11_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: s_bcnt1_i32_b32 s3, s3 ; GFX1032-NEXT: v_mov_b32_e32 v3, local_var64@abs32@lo ; GFX1032-NEXT: v_mul_hi_u32_u24_e64 v2, s3, 5 @@ -2399,9 +2348,8 @@ define amdgpu_kernel void @sub_i64_uniform(i64 addrspace(1)* %out, i64 %subitive ; GFX7LESS-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX7LESS-NEXT: ; implicit-def: $vgpr1_vgpr2 ; GFX7LESS-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX7LESS-NEXT: ; mask branch BB12_2 ; GFX7LESS-NEXT: s_cbranch_execz BB12_2 -; GFX7LESS-NEXT: BB12_1: +; GFX7LESS-NEXT: ; %bb.1: ; GFX7LESS-NEXT: s_bcnt1_i32_b64 s6, s[6:7] ; GFX7LESS-NEXT: v_mov_b32_e32 v3, local_var64@abs32@lo ; GFX7LESS-NEXT: s_waitcnt lgkmcnt(0) @@ -2444,9 +2392,8 @@ define amdgpu_kernel void @sub_i64_uniform(i64 addrspace(1)* %out, i64 %subitive ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr1_vgpr2 ; GFX8-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX8-NEXT: ; mask branch BB12_2 ; GFX8-NEXT: s_cbranch_execz BB12_2 -; GFX8-NEXT: BB12_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: s_bcnt1_i32_b64 s6, s[6:7] ; GFX8-NEXT: v_mov_b32_e32 v1, s6 ; GFX8-NEXT: s_waitcnt lgkmcnt(0) @@ -2489,9 +2436,8 @@ define amdgpu_kernel void @sub_i64_uniform(i64 addrspace(1)* %out, i64 %subitive ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr1_vgpr2 ; GFX9-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX9-NEXT: ; mask branch BB12_2 ; GFX9-NEXT: s_cbranch_execz BB12_2 -; GFX9-NEXT: BB12_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: s_bcnt1_i32_b64 s6, s[6:7] ; GFX9-NEXT: v_mov_b32_e32 v1, s6 ; GFX9-NEXT: s_waitcnt lgkmcnt(0) @@ -2533,9 +2479,8 @@ define amdgpu_kernel void @sub_i64_uniform(i64 addrspace(1)* %out, i64 %subitive ; GFX1064-NEXT: v_mbcnt_hi_u32_b32_e64 v0, s7, v0 ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB12_2 ; GFX1064-NEXT: s_cbranch_execz BB12_2 -; GFX1064-NEXT: BB12_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: s_bcnt1_i32_b64 s6, s[6:7] ; GFX1064-NEXT: v_mov_b32_e32 v3, local_var64@abs32@lo ; GFX1064-NEXT: s_waitcnt lgkmcnt(0) @@ -2576,9 +2521,8 @@ define amdgpu_kernel void @sub_i64_uniform(i64 addrspace(1)* %out, i64 %subitive ; GFX1032-NEXT: v_mbcnt_lo_u32_b32_e64 v0, s5, 0 ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: s_and_saveexec_b32 s4, vcc_lo -; GFX1032-NEXT: ; mask branch BB12_2 ; GFX1032-NEXT: s_cbranch_execz BB12_2 -; GFX1032-NEXT: BB12_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: s_bcnt1_i32_b32 s5, s5 ; GFX1032-NEXT: v_mov_b32_e32 v3, local_var64@abs32@lo ; GFX1032-NEXT: s_waitcnt lgkmcnt(0) @@ -2757,9 +2701,8 @@ define amdgpu_kernel void @and_i32_varying(i32 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v3 ; GFX8-NEXT: ; implicit-def: $vgpr0 ; GFX8-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX8-NEXT: ; mask branch BB14_2 ; GFX8-NEXT: s_cbranch_execz BB14_2 -; GFX8-NEXT: BB14_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v3, s2 ; GFX8-NEXT: s_mov_b32 m0, -1 @@ -2811,9 +2754,8 @@ define amdgpu_kernel void @and_i32_varying(i32 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v3 ; GFX9-NEXT: ; implicit-def: $vgpr0 ; GFX9-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX9-NEXT: ; mask branch BB14_2 ; GFX9-NEXT: s_cbranch_execz BB14_2 -; GFX9-NEXT: BB14_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v3, s2 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -2869,9 +2811,8 @@ define amdgpu_kernel void @and_i32_varying(i32 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v4 ; GFX1064-NEXT: ; implicit-def: $vgpr0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB14_2 ; GFX1064-NEXT: s_cbranch_execz BB14_2 -; GFX1064-NEXT: BB14_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v7, s3 ; GFX1064-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -2922,9 +2863,8 @@ define amdgpu_kernel void @and_i32_varying(i32 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v4 ; GFX1032-NEXT: ; implicit-def: $vgpr0 ; GFX1032-NEXT: s_and_saveexec_b32 s4, vcc_lo -; GFX1032-NEXT: ; mask branch BB14_2 ; GFX1032-NEXT: s_cbranch_execz BB14_2 -; GFX1032-NEXT: BB14_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v7, s3 ; GFX1032-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -3003,9 +2943,8 @@ define amdgpu_kernel void @or_i32_varying(i32 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr0 ; GFX8-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX8-NEXT: ; mask branch BB15_2 ; GFX8-NEXT: s_cbranch_execz BB15_2 -; GFX8-NEXT: BB15_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v3, s2 ; GFX8-NEXT: s_mov_b32 m0, -1 @@ -3057,9 +2996,8 @@ define amdgpu_kernel void @or_i32_varying(i32 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr0 ; GFX9-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX9-NEXT: ; mask branch BB15_2 ; GFX9-NEXT: s_cbranch_execz BB15_2 -; GFX9-NEXT: BB15_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v3, s2 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -3115,9 +3053,8 @@ define amdgpu_kernel void @or_i32_varying(i32 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: ; implicit-def: $vgpr0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB15_2 ; GFX1064-NEXT: s_cbranch_execz BB15_2 -; GFX1064-NEXT: BB15_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v7, s3 ; GFX1064-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -3168,9 +3105,8 @@ define amdgpu_kernel void @or_i32_varying(i32 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: ; implicit-def: $vgpr0 ; GFX1032-NEXT: s_and_saveexec_b32 s4, vcc_lo -; GFX1032-NEXT: ; mask branch BB15_2 ; GFX1032-NEXT: s_cbranch_execz BB15_2 -; GFX1032-NEXT: BB15_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v7, s3 ; GFX1032-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -3249,9 +3185,8 @@ define amdgpu_kernel void @xor_i32_varying(i32 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr0 ; GFX8-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX8-NEXT: ; mask branch BB16_2 ; GFX8-NEXT: s_cbranch_execz BB16_2 -; GFX8-NEXT: BB16_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v3, s2 ; GFX8-NEXT: s_mov_b32 m0, -1 @@ -3303,9 +3238,8 @@ define amdgpu_kernel void @xor_i32_varying(i32 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr0 ; GFX9-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX9-NEXT: ; mask branch BB16_2 ; GFX9-NEXT: s_cbranch_execz BB16_2 -; GFX9-NEXT: BB16_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v3, s2 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -3361,9 +3295,8 @@ define amdgpu_kernel void @xor_i32_varying(i32 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: ; implicit-def: $vgpr0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB16_2 ; GFX1064-NEXT: s_cbranch_execz BB16_2 -; GFX1064-NEXT: BB16_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v7, s3 ; GFX1064-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -3414,9 +3347,8 @@ define amdgpu_kernel void @xor_i32_varying(i32 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: ; implicit-def: $vgpr0 ; GFX1032-NEXT: s_and_saveexec_b32 s4, vcc_lo -; GFX1032-NEXT: ; mask branch BB16_2 ; GFX1032-NEXT: s_cbranch_execz BB16_2 -; GFX1032-NEXT: BB16_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v7, s3 ; GFX1032-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -3495,9 +3427,8 @@ define amdgpu_kernel void @max_i32_varying(i32 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v3 ; GFX8-NEXT: ; implicit-def: $vgpr0 ; GFX8-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX8-NEXT: ; mask branch BB17_2 ; GFX8-NEXT: s_cbranch_execz BB17_2 -; GFX8-NEXT: BB17_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v3, s2 ; GFX8-NEXT: s_mov_b32 m0, -1 @@ -3549,9 +3480,8 @@ define amdgpu_kernel void @max_i32_varying(i32 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v3 ; GFX9-NEXT: ; implicit-def: $vgpr0 ; GFX9-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX9-NEXT: ; mask branch BB17_2 ; GFX9-NEXT: s_cbranch_execz BB17_2 -; GFX9-NEXT: BB17_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v3, s2 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -3607,9 +3537,8 @@ define amdgpu_kernel void @max_i32_varying(i32 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v4 ; GFX1064-NEXT: ; implicit-def: $vgpr0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB17_2 ; GFX1064-NEXT: s_cbranch_execz BB17_2 -; GFX1064-NEXT: BB17_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v7, s3 ; GFX1064-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -3660,9 +3589,8 @@ define amdgpu_kernel void @max_i32_varying(i32 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v4 ; GFX1032-NEXT: ; implicit-def: $vgpr0 ; GFX1032-NEXT: s_and_saveexec_b32 s4, vcc_lo -; GFX1032-NEXT: ; mask branch BB17_2 ; GFX1032-NEXT: s_cbranch_execz BB17_2 -; GFX1032-NEXT: BB17_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v7, s3 ; GFX1032-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -3701,9 +3629,8 @@ define amdgpu_kernel void @max_i64_constant(i64 addrspace(1)* %out) { ; GFX7LESS-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX7LESS-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX7LESS-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX7LESS-NEXT: ; mask branch BB18_2 ; GFX7LESS-NEXT: s_cbranch_execz BB18_2 -; GFX7LESS-NEXT: BB18_1: +; GFX7LESS-NEXT: ; %bb.1: ; GFX7LESS-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX7LESS-NEXT: v_mov_b32_e32 v0, 5 ; GFX7LESS-NEXT: v_mov_b32_e32 v1, 0 @@ -3739,9 +3666,8 @@ define amdgpu_kernel void @max_i64_constant(i64 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX8-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX8-NEXT: ; mask branch BB18_2 ; GFX8-NEXT: s_cbranch_execz BB18_2 -; GFX8-NEXT: BB18_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, 5 ; GFX8-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v1, 0 @@ -3777,9 +3703,8 @@ define amdgpu_kernel void @max_i64_constant(i64 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX9-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX9-NEXT: ; mask branch BB18_2 ; GFX9-NEXT: s_cbranch_execz BB18_2 -; GFX9-NEXT: BB18_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, 5 ; GFX9-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v1, 0 @@ -3814,9 +3739,8 @@ define amdgpu_kernel void @max_i64_constant(i64 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX1064-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX1064-NEXT: ; mask branch BB18_2 ; GFX1064-NEXT: s_cbranch_execz BB18_2 -; GFX1064-NEXT: BB18_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, 5 ; GFX1064-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v1, 0 @@ -3851,9 +3775,8 @@ define amdgpu_kernel void @max_i64_constant(i64 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX1032-NEXT: s_and_saveexec_b32 s2, vcc_lo -; GFX1032-NEXT: ; mask branch BB18_2 ; GFX1032-NEXT: s_cbranch_execz BB18_2 -; GFX1032-NEXT: BB18_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, 5 ; GFX1032-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v1, 0 @@ -3936,9 +3859,8 @@ define amdgpu_kernel void @min_i32_varying(i32 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v3 ; GFX8-NEXT: ; implicit-def: $vgpr0 ; GFX8-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX8-NEXT: ; mask branch BB19_2 ; GFX8-NEXT: s_cbranch_execz BB19_2 -; GFX8-NEXT: BB19_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v3, s2 ; GFX8-NEXT: s_mov_b32 m0, -1 @@ -3990,9 +3912,8 @@ define amdgpu_kernel void @min_i32_varying(i32 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v3 ; GFX9-NEXT: ; implicit-def: $vgpr0 ; GFX9-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX9-NEXT: ; mask branch BB19_2 ; GFX9-NEXT: s_cbranch_execz BB19_2 -; GFX9-NEXT: BB19_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v3, s2 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -4048,9 +3969,8 @@ define amdgpu_kernel void @min_i32_varying(i32 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v4 ; GFX1064-NEXT: ; implicit-def: $vgpr0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB19_2 ; GFX1064-NEXT: s_cbranch_execz BB19_2 -; GFX1064-NEXT: BB19_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v7, s3 ; GFX1064-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -4101,9 +4021,8 @@ define amdgpu_kernel void @min_i32_varying(i32 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v4 ; GFX1032-NEXT: ; implicit-def: $vgpr0 ; GFX1032-NEXT: s_and_saveexec_b32 s4, vcc_lo -; GFX1032-NEXT: ; mask branch BB19_2 ; GFX1032-NEXT: s_cbranch_execz BB19_2 -; GFX1032-NEXT: BB19_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v7, s3 ; GFX1032-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -4142,9 +4061,8 @@ define amdgpu_kernel void @min_i64_constant(i64 addrspace(1)* %out) { ; GFX7LESS-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX7LESS-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX7LESS-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX7LESS-NEXT: ; mask branch BB20_2 ; GFX7LESS-NEXT: s_cbranch_execz BB20_2 -; GFX7LESS-NEXT: BB20_1: +; GFX7LESS-NEXT: ; %bb.1: ; GFX7LESS-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX7LESS-NEXT: v_mov_b32_e32 v0, 5 ; GFX7LESS-NEXT: v_mov_b32_e32 v1, 0 @@ -4180,9 +4098,8 @@ define amdgpu_kernel void @min_i64_constant(i64 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX8-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX8-NEXT: ; mask branch BB20_2 ; GFX8-NEXT: s_cbranch_execz BB20_2 -; GFX8-NEXT: BB20_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, 5 ; GFX8-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v1, 0 @@ -4218,9 +4135,8 @@ define amdgpu_kernel void @min_i64_constant(i64 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX9-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX9-NEXT: ; mask branch BB20_2 ; GFX9-NEXT: s_cbranch_execz BB20_2 -; GFX9-NEXT: BB20_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, 5 ; GFX9-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v1, 0 @@ -4255,9 +4171,8 @@ define amdgpu_kernel void @min_i64_constant(i64 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX1064-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX1064-NEXT: ; mask branch BB20_2 ; GFX1064-NEXT: s_cbranch_execz BB20_2 -; GFX1064-NEXT: BB20_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, 5 ; GFX1064-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v1, 0 @@ -4292,9 +4207,8 @@ define amdgpu_kernel void @min_i64_constant(i64 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX1032-NEXT: s_and_saveexec_b32 s2, vcc_lo -; GFX1032-NEXT: ; mask branch BB20_2 ; GFX1032-NEXT: s_cbranch_execz BB20_2 -; GFX1032-NEXT: BB20_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, 5 ; GFX1032-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v1, 0 @@ -4377,9 +4291,8 @@ define amdgpu_kernel void @umax_i32_varying(i32 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr0 ; GFX8-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX8-NEXT: ; mask branch BB21_2 ; GFX8-NEXT: s_cbranch_execz BB21_2 -; GFX8-NEXT: BB21_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v3, s2 ; GFX8-NEXT: s_mov_b32 m0, -1 @@ -4431,9 +4344,8 @@ define amdgpu_kernel void @umax_i32_varying(i32 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr0 ; GFX9-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX9-NEXT: ; mask branch BB21_2 ; GFX9-NEXT: s_cbranch_execz BB21_2 -; GFX9-NEXT: BB21_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v3, s2 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -4489,9 +4401,8 @@ define amdgpu_kernel void @umax_i32_varying(i32 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: ; implicit-def: $vgpr0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB21_2 ; GFX1064-NEXT: s_cbranch_execz BB21_2 -; GFX1064-NEXT: BB21_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v7, s3 ; GFX1064-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -4542,9 +4453,8 @@ define amdgpu_kernel void @umax_i32_varying(i32 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: ; implicit-def: $vgpr0 ; GFX1032-NEXT: s_and_saveexec_b32 s4, vcc_lo -; GFX1032-NEXT: ; mask branch BB21_2 ; GFX1032-NEXT: s_cbranch_execz BB21_2 -; GFX1032-NEXT: BB21_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v7, s3 ; GFX1032-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -4583,9 +4493,8 @@ define amdgpu_kernel void @umax_i64_constant(i64 addrspace(1)* %out) { ; GFX7LESS-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX7LESS-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX7LESS-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX7LESS-NEXT: ; mask branch BB22_2 ; GFX7LESS-NEXT: s_cbranch_execz BB22_2 -; GFX7LESS-NEXT: BB22_1: +; GFX7LESS-NEXT: ; %bb.1: ; GFX7LESS-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX7LESS-NEXT: v_mov_b32_e32 v0, 5 ; GFX7LESS-NEXT: v_mov_b32_e32 v1, 0 @@ -4620,9 +4529,8 @@ define amdgpu_kernel void @umax_i64_constant(i64 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX8-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX8-NEXT: ; mask branch BB22_2 ; GFX8-NEXT: s_cbranch_execz BB22_2 -; GFX8-NEXT: BB22_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, 5 ; GFX8-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v1, 0 @@ -4657,9 +4565,8 @@ define amdgpu_kernel void @umax_i64_constant(i64 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX9-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX9-NEXT: ; mask branch BB22_2 ; GFX9-NEXT: s_cbranch_execz BB22_2 -; GFX9-NEXT: BB22_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, 5 ; GFX9-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v1, 0 @@ -4693,9 +4600,8 @@ define amdgpu_kernel void @umax_i64_constant(i64 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX1064-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX1064-NEXT: ; mask branch BB22_2 ; GFX1064-NEXT: s_cbranch_execz BB22_2 -; GFX1064-NEXT: BB22_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, 5 ; GFX1064-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v1, 0 @@ -4730,9 +4636,8 @@ define amdgpu_kernel void @umax_i64_constant(i64 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX1032-NEXT: s_and_saveexec_b32 s2, vcc_lo -; GFX1032-NEXT: ; mask branch BB22_2 ; GFX1032-NEXT: s_cbranch_execz BB22_2 -; GFX1032-NEXT: BB22_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, 5 ; GFX1032-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v1, 0 @@ -4815,9 +4720,8 @@ define amdgpu_kernel void @umin_i32_varying(i32 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v3 ; GFX8-NEXT: ; implicit-def: $vgpr0 ; GFX8-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX8-NEXT: ; mask branch BB23_2 ; GFX8-NEXT: s_cbranch_execz BB23_2 -; GFX8-NEXT: BB23_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v3, s2 ; GFX8-NEXT: s_mov_b32 m0, -1 @@ -4869,9 +4773,8 @@ define amdgpu_kernel void @umin_i32_varying(i32 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v3 ; GFX9-NEXT: ; implicit-def: $vgpr0 ; GFX9-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX9-NEXT: ; mask branch BB23_2 ; GFX9-NEXT: s_cbranch_execz BB23_2 -; GFX9-NEXT: BB23_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v3, s2 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -4927,9 +4830,8 @@ define amdgpu_kernel void @umin_i32_varying(i32 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v4 ; GFX1064-NEXT: ; implicit-def: $vgpr0 ; GFX1064-NEXT: s_and_saveexec_b64 s[4:5], vcc -; GFX1064-NEXT: ; mask branch BB23_2 ; GFX1064-NEXT: s_cbranch_execz BB23_2 -; GFX1064-NEXT: BB23_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v7, s3 ; GFX1064-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -4980,9 +4882,8 @@ define amdgpu_kernel void @umin_i32_varying(i32 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v4 ; GFX1032-NEXT: ; implicit-def: $vgpr0 ; GFX1032-NEXT: s_and_saveexec_b32 s4, vcc_lo -; GFX1032-NEXT: ; mask branch BB23_2 ; GFX1032-NEXT: s_cbranch_execz BB23_2 -; GFX1032-NEXT: BB23_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, local_var32@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v7, s3 ; GFX1032-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0) @@ -5021,9 +4922,8 @@ define amdgpu_kernel void @umin_i64_constant(i64 addrspace(1)* %out) { ; GFX7LESS-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX7LESS-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX7LESS-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX7LESS-NEXT: ; mask branch BB24_2 ; GFX7LESS-NEXT: s_cbranch_execz BB24_2 -; GFX7LESS-NEXT: BB24_1: +; GFX7LESS-NEXT: ; %bb.1: ; GFX7LESS-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX7LESS-NEXT: v_mov_b32_e32 v0, 5 ; GFX7LESS-NEXT: v_mov_b32_e32 v1, 0 @@ -5058,9 +4958,8 @@ define amdgpu_kernel void @umin_i64_constant(i64 addrspace(1)* %out) { ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX8-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX8-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX8-NEXT: ; mask branch BB24_2 ; GFX8-NEXT: s_cbranch_execz BB24_2 -; GFX8-NEXT: BB24_1: +; GFX8-NEXT: ; %bb.1: ; GFX8-NEXT: v_mov_b32_e32 v0, 5 ; GFX8-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX8-NEXT: v_mov_b32_e32 v1, 0 @@ -5095,9 +4994,8 @@ define amdgpu_kernel void @umin_i64_constant(i64 addrspace(1)* %out) { ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX9-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX9-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX9-NEXT: ; mask branch BB24_2 ; GFX9-NEXT: s_cbranch_execz BB24_2 -; GFX9-NEXT: BB24_1: +; GFX9-NEXT: ; %bb.1: ; GFX9-NEXT: v_mov_b32_e32 v0, 5 ; GFX9-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX9-NEXT: v_mov_b32_e32 v1, 0 @@ -5131,9 +5029,8 @@ define amdgpu_kernel void @umin_i64_constant(i64 addrspace(1)* %out) { ; GFX1064-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0 ; GFX1064-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX1064-NEXT: s_and_saveexec_b64 s[2:3], vcc -; GFX1064-NEXT: ; mask branch BB24_2 ; GFX1064-NEXT: s_cbranch_execz BB24_2 -; GFX1064-NEXT: BB24_1: +; GFX1064-NEXT: ; %bb.1: ; GFX1064-NEXT: v_mov_b32_e32 v0, 5 ; GFX1064-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX1064-NEXT: v_mov_b32_e32 v1, 0 @@ -5168,9 +5065,8 @@ define amdgpu_kernel void @umin_i64_constant(i64 addrspace(1)* %out) { ; GFX1032-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0, v0 ; GFX1032-NEXT: ; implicit-def: $vgpr0_vgpr1 ; GFX1032-NEXT: s_and_saveexec_b32 s2, vcc_lo -; GFX1032-NEXT: ; mask branch BB24_2 ; GFX1032-NEXT: s_cbranch_execz BB24_2 -; GFX1032-NEXT: BB24_1: +; GFX1032-NEXT: ; %bb.1: ; GFX1032-NEXT: v_mov_b32_e32 v0, 5 ; GFX1032-NEXT: v_mov_b32_e32 v2, local_var64@abs32@lo ; GFX1032-NEXT: v_mov_b32_e32 v1, 0 diff --git a/llvm/test/CodeGen/AMDGPU/atomic_optimizations_pixelshader.ll b/llvm/test/CodeGen/AMDGPU/atomic_optimizations_pixelshader.ll index 5442376b4adc01..d41c1404b3cb03 100644 --- a/llvm/test/CodeGen/AMDGPU/atomic_optimizations_pixelshader.ll +++ b/llvm/test/CodeGen/AMDGPU/atomic_optimizations_pixelshader.ll @@ -11,7 +11,7 @@ declare void @llvm.amdgcn.raw.buffer.store.f32(float, <4 x i32>, i32, i32, i32 i ; Show that what the atomic optimization pass will do for raw buffers. ; GCN-LABEL: add_i32_constant: -; GCN-LABEL: BB0_1: +; %bb.{{[0-9]+}}: ; GCN32: v_cmp_ne_u32_e64 s[[exec_lo:[0-9]+]], 1, 0 ; GCN64: v_cmp_ne_u32_e64 s{{\[}}[[exec_lo:[0-9]+]]:[[exec_hi:[0-9]+]]{{\]}}, 1, 0 ; GCN: v_mbcnt_lo_u32_b32{{(_e[0-9]+)?}} v[[mbcnt:[0-9]+]], s[[exec_lo]], 0 diff --git a/llvm/test/CodeGen/AMDGPU/branch-condition-and.ll b/llvm/test/CodeGen/AMDGPU/branch-condition-and.ll index d1fcd1547d57d4..4f03978c515968 100644 --- a/llvm/test/CodeGen/AMDGPU/branch-condition-and.ll +++ b/llvm/test/CodeGen/AMDGPU/branch-condition-and.ll @@ -14,12 +14,11 @@ ; GCN-DAG: v_cmp_lt_f32_e32 vcc, ; GCN: s_and_b64 [[AND:s\[[0-9]+:[0-9]+\]]], vcc, [[OTHERCC]] ; GCN: s_and_saveexec_b64 [[SAVED:s\[[0-9]+:[0-9]+\]]], [[AND]] -; GCN: ; mask branch [[BB5:BB[0-9]+_[0-9]+]] -; GCN-NEXT: BB{{[0-9]+_[0-9]+}}: ; %bb4 +; GCN-NEXT: ; %bb.{{[0-9]+}}: ; %bb4 ; GCN: ds_write_b32 -; GCN: [[BB5]] +; GCN: ; %bb.{{[0-9]+}}: ; GCN-NEXT: s_endpgm ; GCN-NEXT: .Lfunc_end define amdgpu_ps void @ham(float %arg, float %arg1) #0 { diff --git a/llvm/test/CodeGen/AMDGPU/branch-relaxation.ll b/llvm/test/CodeGen/AMDGPU/branch-relaxation.ll index cab4fdb8c1e6ef..0a83e604de7aab 100644 --- a/llvm/test/CodeGen/AMDGPU/branch-relaxation.ll +++ b/llvm/test/CodeGen/AMDGPU/branch-relaxation.ll @@ -389,7 +389,6 @@ bb3: ; GCN-LABEL: {{^}}uniform_inside_divergent: ; GCN: v_cmp_gt_u32_e32 vcc, 16, v{{[0-9]+}} ; GCN-NEXT: s_and_saveexec_b64 [[MASK:s\[[0-9]+:[0-9]+\]]], vcc -; GCN-NEXT: ; mask branch [[ENDIF:BB[0-9]+_[0-9]+]] ; GCN-NEXT: s_cbranch_execnz [[IF:BB[0-9]+_[0-9]+]] ; GCN-NEXT: [[LONGBB:BB[0-9]+_[0-9]+]]: ; %entry @@ -401,7 +400,7 @@ bb3: ; GCN-NEXT: [[IF]]: ; %if ; GCN: buffer_store_dword ; GCN: s_cmp_lg_u32 -; GCN: s_cbranch_scc1 [[ENDIF]] +; GCN: s_cbranch_scc1 [[ENDIF:BB[0-9]+_[0-9]+]] ; GCN-NEXT: ; %bb.2: ; %if_uniform ; GCN: buffer_store_dword @@ -438,12 +437,10 @@ endif: ; GCN: v_cmp_nlt_f32_e32 vcc ; GCN-NEXT: s_and_saveexec_b64 [[TEMP_MASK:s\[[0-9]+:[0-9]+\]]], vcc ; GCN-NEXT: s_xor_b64 [[MASK:s\[[0-9]+:[0-9]+\]]], exec, [[TEMP_MASK]] -; GCN-NEXT: ; mask branch [[FLOW:BB[0-9]+_[0-9]+]] -; GCN: [[FLOW]]: ; %Flow +; GCN: BB{{[0-9]+_[0-9]+}}: ; %Flow ; GCN-NEXT: s_or_saveexec_b64 [[TEMP_MASK1:s\[[0-9]+:[0-9]+\]]], [[MASK]] ; GCN-NEXT: s_xor_b64 exec, exec, [[TEMP_MASK1]] -; GCN-NEXT: ; mask branch [[RET:BB[0-9]+_[0-9]+]] ; GCN: [[LOOP_BODY:BB[0-9]+_[0-9]+]]: ; %loop{{$}} ; GCN: ;;#ASMSTART @@ -454,7 +451,7 @@ endif: ; GCN: v_nop_e64 ; GCN: v_nop_e64 ; GCN: ;;#ASMEND -; GCN: s_cbranch_vccz [[RET]] +; GCN: s_cbranch_vccz [[RET:BB[0-9]+_[0-9]+]] ; GCN-NEXT: [[LONGBB:BB[0-9]+_[0-9]+]]: ; %loop ; GCN-NEXT: ; in Loop: Header=[[LOOP_BODY]] Depth=1 diff --git a/llvm/test/CodeGen/AMDGPU/call-skip.ll b/llvm/test/CodeGen/AMDGPU/call-skip.ll index cd963df6c499c7..d99226ac45b717 100644 --- a/llvm/test/CodeGen/AMDGPU/call-skip.ll +++ b/llvm/test/CodeGen/AMDGPU/call-skip.ll @@ -8,8 +8,7 @@ define hidden void @func() #1 { ; GCN-LABEL: {{^}}if_call: ; GCN: s_and_saveexec_b64 -; GCN-NEXT: ; mask branch [[END:BB[0-9]+_[0-9]+]] -; GCN-NEXT: s_cbranch_execz [[END]] +; GCN-NEXT: s_cbranch_execz [[END:BB[0-9]+_[0-9]+]] ; GCN: s_swappc_b64 ; GCN: [[END]]: define void @if_call(i32 %flag) #0 { @@ -26,8 +25,7 @@ end: ; GCN-LABEL: {{^}}if_asm: ; GCN: s_and_saveexec_b64 -; GCN-NEXT: ; mask branch [[END:BB[0-9]+_[0-9]+]] -; GCN-NEXT: s_cbranch_execz [[END]] +; GCN-NEXT: s_cbranch_execz [[END:BB[0-9]+_[0-9]+]] ; GCN: ; sample asm ; GCN: [[END]]: define void @if_asm(i32 %flag) #0 { @@ -44,8 +42,7 @@ end: ; GCN-LABEL: {{^}}if_call_kernel: ; GCN: s_and_saveexec_b64 -; GCN-NEXT: ; mask branch [[END:BB[0-9]+_[0-9]+]] -; GCN-NEXT: s_cbranch_execz [[END]] +; GCN-NEXT: s_cbranch_execz BB3_2 ; GCN: s_swappc_b64 define amdgpu_kernel void @if_call_kernel() #0 { %id = call i32 @llvm.amdgcn.workitem.id.x() diff --git a/llvm/test/CodeGen/AMDGPU/collapse-endcf.ll b/llvm/test/CodeGen/AMDGPU/collapse-endcf.ll index 6a8456d99bcebc..bb00e67fca25eb 100644 --- a/llvm/test/CodeGen/AMDGPU/collapse-endcf.ll +++ b/llvm/test/CodeGen/AMDGPU/collapse-endcf.ll @@ -3,12 +3,10 @@ ; ALL-LABEL: {{^}}simple_nested_if: ; GCN: s_and_saveexec_b64 [[SAVEEXEC:s\[[0-9:]+\]]] -; GCN-NEXT: ; mask branch [[ENDIF:BB[0-9_]+]] -; GCN-NEXT: s_cbranch_execz [[ENDIF]] +; GCN-NEXT: s_cbranch_execz [[ENDIF:BB[0-9_]+]] ; GCN: s_and_b64 exec, exec, vcc -; GCN-NEXT: ; mask branch [[ENDIF]] ; GCN-NEXT: s_cbranch_execz [[ENDIF]] -; GCN-NEXT: {{^BB[0-9_]+}}: +; GCN-NEXT: ; %bb.{{[0-9]+}}: ; GCN: store_dword ; GCN-NEXT: {{^}}[[ENDIF]]: ; GCN-NEXT: s_or_b64 exec, exec, [[SAVEEXEC]] @@ -43,12 +41,10 @@ bb.outer.end: ; preds = %bb.outer.then, %bb. ; ALL-LABEL: {{^}}uncollapsable_nested_if: ; GCN: s_and_saveexec_b64 [[SAVEEXEC_OUTER:s\[[0-9:]+\]]] -; GCN-NEXT: ; mask branch [[ENDIF_OUTER:BB[0-9_]+]] -; GCN-NEXT: s_cbranch_execz [[ENDIF_OUTER]] +; GCN-NEXT: s_cbranch_execz [[ENDIF_OUTER:BB[0-9_]+]] ; GCN: s_and_saveexec_b64 [[SAVEEXEC_INNER:s\[[0-9:]+\]]] -; GCN-NEXT: ; mask branch [[ENDIF_INNER:BB[0-9_]+]] -; GCN-NEXT: s_cbranch_execz [[ENDIF_INNER]] -; GCN-NEXT: {{^BB[0-9_]+}}: +; GCN-NEXT: s_cbranch_execz [[ENDIF_INNER:BB[0-9_]+]] +; GCN-NEXT: ; %bb.{{[0-9]+}}: ; GCN: store_dword ; GCN-NEXT: {{^}}[[ENDIF_INNER]]: ; GCN-NEXT: s_or_b64 exec, exec, [[SAVEEXEC_INNER]] @@ -88,18 +84,16 @@ bb.outer.end: ; preds = %bb.inner.then, %bb ; ALL-LABEL: {{^}}nested_if_if_else: ; GCN: s_and_saveexec_b64 [[SAVEEXEC_OUTER:s\[[0-9:]+\]]] -; GCN-NEXT: ; mask branch [[ENDIF_OUTER:BB[0-9_]+]] -; GCN-NEXT: s_cbranch_execz [[ENDIF_OUTER]] +; GCN-NEXT: s_cbranch_execz [[ENDIF_OUTER:BB[0-9_]+]] ; GCN: s_and_saveexec_b64 [[SAVEEXEC_INNER:s\[[0-9:]+\]]] ; GCN-NEXT: s_xor_b64 [[SAVEEXEC_INNER2:s\[[0-9:]+\]]], exec, [[SAVEEXEC_INNER]] -; GCN-NEXT: ; mask branch [[THEN_INNER:BB[0-9_]+]] -; GCN-NEXT: s_cbranch_execz [[THEN_INNER]] -; GCN-NEXT: {{^BB[0-9_]+}}: +; GCN-NEXT: s_cbranch_execz [[THEN_INNER:BB[0-9_]+]] +; GCN-NEXT: ; %bb.{{[0-9]+}}: ; GCN: store_dword ; GCN-NEXT: {{^}}[[THEN_INNER]]: ; GCN-NEXT: s_or_saveexec_b64 [[SAVEEXEC_INNER3:s\[[0-9:]+\]]], [[SAVEEXEC_INNER2]] ; GCN-NEXT: s_xor_b64 exec, exec, [[SAVEEXEC_INNER3]] -; GCN-NEXT: ; mask branch [[ENDIF_OUTER]] +; GCN-NEXT: s_cbranch_execz [[ENDIF_OUTER]] ; GCN: store_dword ; GCN-NEXT: {{^}}[[ENDIF_OUTER]]: ; GCN-NEXT: s_or_b64 exec, exec, [[SAVEEXEC_OUTER]] @@ -137,28 +131,24 @@ bb.outer.end: ; preds = %bb, %bb.then, %b ; ALL-LABEL: {{^}}nested_if_else_if: ; GCN: s_and_saveexec_b64 [[SAVEEXEC_OUTER:s\[[0-9:]+\]]] ; GCN-NEXT: s_xor_b64 [[SAVEEXEC_OUTER2:s\[[0-9:]+\]]], exec, [[SAVEEXEC_OUTER]] -; GCN-NEXT: ; mask branch [[THEN_OUTER:BB[0-9_]+]] -; GCN-NEXT: s_cbranch_execz [[THEN_OUTER]] -; GCN-NEXT: {{^BB[0-9_]+}}: +; GCN-NEXT: s_cbranch_execz [[THEN_OUTER:BB[0-9_]+]] +; GCN-NEXT: ; %bb.{{[0-9]+}}: ; GCN: store_dword ; GCN-NEXT: s_and_saveexec_b64 [[SAVEEXEC_INNER_IF_OUTER_ELSE:s\[[0-9:]+\]]] -; GCN-NEXT: ; mask branch [[THEN_OUTER_FLOW:BB[0-9_]+]] -; GCN-NEXT: s_cbranch_execz [[THEN_OUTER_FLOW]] -; GCN-NEXT: {{^BB[0-9_]+}}: +; GCN-NEXT: s_cbranch_execz [[THEN_OUTER_FLOW:BB[0-9_]+]] +; GCN-NEXT: ; %bb.{{[0-9]+}}: ; GCN: store_dword ; GCN-NEXT: {{^}}[[THEN_OUTER_FLOW]]: ; GCN-NEXT: s_or_b64 exec, exec, [[SAVEEXEC_INNER_IF_OUTER_ELSE]] ; GCN-NEXT: {{^}}[[THEN_OUTER]]: ; GCN-NEXT: s_or_saveexec_b64 [[SAVEEXEC_OUTER3:s\[[0-9:]+\]]], [[SAVEEXEC_OUTER2]] ; GCN-NEXT: s_xor_b64 exec, exec, [[SAVEEXEC_OUTER3]] -; GCN-NEXT: ; mask branch [[ENDIF_OUTER:BB[0-9_]+]] -; GCN-NEXT: s_cbranch_execz [[ENDIF_OUTER]] -; GCN-NEXT: {{^BB[0-9_]+}}: +; GCN-NEXT: s_cbranch_execz [[ENDIF_OUTER:BB[0-9_]+]] +; GCN-NEXT: ; %bb.{{[0-9]+}}: ; GCN: store_dword ; GCN-NEXT: s_and_saveexec_b64 [[SAVEEXEC_INNER_IF_OUTER_THEN:s\[[0-9:]+\]]] -; GCN-NEXT: ; mask branch [[FLOW1:BB[0-9_]+]] -; GCN-NEXT: s_cbranch_execz [[FLOW1]] -; GCN-NEXT: {{^BB[0-9_]+}}: +; GCN-NEXT: s_cbranch_execz [[FLOW1:BB[0-9_]+]] +; GCN-NEXT: ; %bb.{{[0-9]+}}: ; GCN: store_dword ; GCN-NEXT: [[FLOW1]]: ; GCN-NEXT: s_or_b64 exec, exec, [[SAVEEXEC_INNER_IF_OUTER_THEN]] @@ -203,9 +193,8 @@ bb.outer.end: ; ALL-LABEL: {{^}}s_endpgm_unsafe_barrier: ; GCN: s_and_saveexec_b64 [[SAVEEXEC:s\[[0-9:]+\]]] -; GCN-NEXT: ; mask branch [[ENDIF:BB[0-9_]+]] -; GCN-NEXT: s_cbranch_execz [[ENDIF]] -; GCN-NEXT: {{^BB[0-9_]+}}: +; GCN-NEXT: s_cbranch_execz [[ENDIF:BB[0-9_]+]] +; GCN-NEXT: ; %bb.{{[0-9]+}}: ; GCN: store_dword ; GCN-NEXT: {{^}}[[ENDIF]]: ; GCN-NEXT: s_or_b64 exec, exec, [[SAVEEXEC]] diff --git a/llvm/test/CodeGen/AMDGPU/control-flow-fastregalloc.ll b/llvm/test/CodeGen/AMDGPU/control-flow-fastregalloc.ll index 15e807a3e02305..f144ed263ff392 100644 --- a/llvm/test/CodeGen/AMDGPU/control-flow-fastregalloc.ll +++ b/llvm/test/CodeGen/AMDGPU/control-flow-fastregalloc.ll @@ -35,9 +35,9 @@ ; GCN: s_mov_b64 exec, s{{\[}}[[ANDEXEC_LO]]:[[ANDEXEC_HI]]{{\]}} -; GCN: mask branch [[ENDIF:BB[0-9]+_[0-9]+]] +; GCN: s_cbranch_execz [[ENDIF:BB[0-9]+_[0-9]+]] -; GCN: {{^}}BB{{[0-9]+}}_1: ; %if +; GCN: ; %bb.{{[0-9]+}}: ; %if ; GCN: s_mov_b32 m0, -1 ; GCN: ds_read_b32 [[LOAD1:v[0-9]+]] ; GCN: buffer_load_dword [[RELOAD_LOAD0:v[0-9]+]], off, s[0:3], s7 offset:[[LOAD0_OFFSET]] ; 4-byte Folded Reload @@ -116,8 +116,7 @@ endif: ; GCN: s_mov_b64 exec, s{{\[}}[[ANDEXEC_LO]]:[[ANDEXEC_HI]]{{\]}} -; GCN-NEXT: ; mask branch [[END:BB[0-9]+_[0-9]+]] -; GCN-NEXT: s_cbranch_execz [[END]] +; GCN-NEXT: s_cbranch_execz [[END:BB[0-9]+_[0-9]+]] ; GCN: [[LOOP:BB[0-9]+_[0-9]+]]: @@ -194,8 +193,7 @@ end: ; GCN: s_mov_b64 exec, [[CMP0]] ; FIXME: It makes no sense to put this skip here -; GCN-NEXT: ; mask branch [[FLOW:BB[0-9]+_[0-9]+]] -; GCN: s_cbranch_execz [[FLOW]] +; GCN: s_cbranch_execz [[FLOW:BB[0-9]+_[0-9]+]] ; GCN-NEXT: s_branch [[ELSE:BB[0-9]+_[0-9]+]] ; GCN: [[FLOW]]: ; %Flow @@ -229,11 +227,10 @@ end: ; GCN: buffer_store_dword [[FLOW_VAL]], off, s[0:3], s7 offset:[[RESULT_OFFSET:[0-9]+]] ; 4-byte Folded Spill ; GCN: s_xor_b64 exec, exec, s{{\[}}[[FLOW_S_RELOAD_SAVEEXEC_LO]]:[[FLOW_S_RELOAD_SAVEEXEC_HI]]{{\]}} -; GCN-NEXT: ; mask branch [[ENDIF:BB[0-9]+_[0-9]+]] -; GCN-NEXT: s_cbranch_execz [[ENDIF]] +; GCN-NEXT: s_cbranch_execz [[ENDIF:BB[0-9]+_[0-9]+]] -; GCN: BB{{[0-9]+}}_2: ; %if +; GCN: ; %bb.{{[0-9]+}}: ; %if ; GCN: ds_read_b32 ; GCN: buffer_load_dword v[[LOAD0_RELOAD:[0-9]+]], off, s[0:3], s7 offset:[[LOAD0_OFFSET]] ; 4-byte Folded Reload ; GCN: v_add_i32_e32 [[ADD:v[0-9]+]], vcc, v{{[0-9]+}}, v[[LOAD0_RELOAD]] diff --git a/llvm/test/CodeGen/AMDGPU/convergent-inlineasm.ll b/llvm/test/CodeGen/AMDGPU/convergent-inlineasm.ll index 80907bf1c1beb9..2ba4d0cf1d992c 100644 --- a/llvm/test/CodeGen/AMDGPU/convergent-inlineasm.ll +++ b/llvm/test/CodeGen/AMDGPU/convergent-inlineasm.ll @@ -4,8 +4,8 @@ declare i32 @llvm.amdgcn.workitem.id.x() #0 ; GCN-LABEL: {{^}}convergent_inlineasm: ; GCN: %bb.0: ; GCN: v_cmp_ne_u32_e64 -; GCN: ; mask branch -; GCN: BB{{[0-9]+_[0-9]+}}: +; GCN: s_cbranch_execz +; GCN: ; %bb.{{[0-9]+}}: define amdgpu_kernel void @convergent_inlineasm(i64 addrspace(1)* nocapture %arg) { bb: %tmp = call i32 @llvm.amdgcn.workitem.id.x() @@ -23,9 +23,9 @@ bb5: ; preds = %bb3, %bb } ; GCN-LABEL: {{^}}nonconvergent_inlineasm: -; GCN: ; mask branch +; GCN: s_cbranch_execz -; GCN: BB{{[0-9]+_[0-9]+}}: +; GCN: ; %bb.{{[0-9]+}}: ; GCN: v_cmp_ne_u32_e64 ; GCN: BB{{[0-9]+_[0-9]+}}: diff --git a/llvm/test/CodeGen/AMDGPU/cse-phi-incoming-val.ll b/llvm/test/CodeGen/AMDGPU/cse-phi-incoming-val.ll index 6b3491b0c75dc9..5209b2bf7f3c79 100644 --- a/llvm/test/CodeGen/AMDGPU/cse-phi-incoming-val.ll +++ b/llvm/test/CodeGen/AMDGPU/cse-phi-incoming-val.ll @@ -8,7 +8,7 @@ ; CHECK: s_mov_b32 [[SREG:s[0-9]+]], 1.0 ; CHECK: %bb.1: ; CHECK-NOT: v_mov_b32_e32 {{v[0-9]+}}, 1.0 -; CHECK: BB0_4: +; CHECK: BB0_3: ; CHECK: v_mov_b32_e32 v{{[0-9]+}}, [[SREG]] define amdgpu_ps void @mov_opt(i32 %arg, i32 inreg %arg1, i32 inreg %arg2) local_unnamed_addr #0 { diff --git a/llvm/test/CodeGen/AMDGPU/divergent-branch-uniform-condition.ll b/llvm/test/CodeGen/AMDGPU/divergent-branch-uniform-condition.ll index 895539c00bce97..55841aa66f351a 100644 --- a/llvm/test/CodeGen/AMDGPU/divergent-branch-uniform-condition.ll +++ b/llvm/test/CodeGen/AMDGPU/divergent-branch-uniform-condition.ll @@ -44,9 +44,8 @@ define amdgpu_ps void @main(i32, float) { ; CHECK-NEXT: s_mov_b64 s[6:7], -1 ; CHECK-NEXT: s_and_saveexec_b64 s[8:9], vcc ; CHECK-NEXT: s_xor_b64 s[8:9], exec, s[8:9] -; CHECK-NEXT: ; mask branch BB0_1 ; CHECK-NEXT: s_cbranch_execz BB0_1 -; CHECK-NEXT: BB0_5: ; %endif2 +; CHECK-NEXT: ; %bb.5: ; %endif2 ; CHECK-NEXT: ; in Loop: Header=BB0_3 Depth=1 ; CHECK-NEXT: s_add_i32 s0, s0, 1 ; CHECK-NEXT: s_xor_b64 s[6:7], exec, -1 @@ -55,10 +54,9 @@ define amdgpu_ps void @main(i32, float) { ; CHECK-NEXT: s_or_b64 exec, exec, s[2:3] ; CHECK-NEXT: v_mov_b32_e32 v1, 0 ; CHECK-NEXT: s_and_saveexec_b64 s[0:1], s[4:5] -; CHECK-NEXT: ; mask branch BB0_8 -; CHECK-NEXT: BB0_7: ; %if1 +; CHECK-NEXT: ; %bb.7: ; %if1 ; CHECK-NEXT: v_sqrt_f32_e32 v1, v0 -; CHECK-NEXT: BB0_8: ; %endloop +; CHECK-NEXT: ; %bb.8: ; %endloop ; CHECK-NEXT: s_or_b64 exec, exec, s[0:1] ; CHECK-NEXT: exp mrt0 v1, v1, v1, v1 done vm ; CHECK-NEXT: s_endpgm diff --git a/llvm/test/CodeGen/AMDGPU/else.ll b/llvm/test/CodeGen/AMDGPU/else.ll index b21ccab70c1c4d..479d20586a5624 100644 --- a/llvm/test/CodeGen/AMDGPU/else.ll +++ b/llvm/test/CodeGen/AMDGPU/else.ll @@ -5,7 +5,6 @@ ; CHECK: ; %Flow ; CHECK-NEXT: s_or_saveexec_b64 [[DST:s\[[0-9]+:[0-9]+\]]], ; CHECK-NEXT: s_xor_b64 exec, exec, [[DST]] -; CHECK-NEXT: ; mask branch define amdgpu_ps float @else_no_execfix(i32 %z, float %v) #0 { main_body: %cc = icmp sgt i32 %z, 5 @@ -32,7 +31,7 @@ end: ; CHECK-NEXT: s_and_b64 exec, exec, [[INIT_EXEC]] ; CHECK-NEXT: s_and_b64 [[AND_INIT:s\[[0-9]+:[0-9]+\]]], exec, [[DST]] ; CHECK-NEXT: s_xor_b64 exec, exec, [[AND_INIT]] -; CHECK-NEXT: ; mask branch +; CHECK-NEXT: s_cbranch_execz define amdgpu_ps void @else_execfix_leave_wqm(i32 %z, float %v) #0 { main_body: %cc = icmp sgt i32 %z, 5 diff --git a/llvm/test/CodeGen/AMDGPU/hoist-cond.ll b/llvm/test/CodeGen/AMDGPU/hoist-cond.ll index 76a26882987baf..08936730fc398a 100644 --- a/llvm/test/CodeGen/AMDGPU/hoist-cond.ll +++ b/llvm/test/CodeGen/AMDGPU/hoist-cond.ll @@ -9,7 +9,7 @@ ; CHECK-NOT: v_cmp ; CHECK_NOT: v_cndmask ; CHECK: s_and_saveexec_b64 s[{{[[0-9]+:[0-9]+}}], [[COND]] -; CHECK: BB0_2: +; CHECK: ; %bb.2: define amdgpu_kernel void @hoist_cond(float addrspace(1)* nocapture %arg, float addrspace(1)* noalias nocapture readonly %arg1, i32 %arg3, i32 %arg4) { bb: diff --git a/llvm/test/CodeGen/AMDGPU/insert-skips-flat-vmem.mir b/llvm/test/CodeGen/AMDGPU/insert-skips-flat-vmem.mir index b305cfddb5a5d2..76bb74d3a63f09 100644 --- a/llvm/test/CodeGen/AMDGPU/insert-skips-flat-vmem.mir +++ b/llvm/test/CodeGen/AMDGPU/insert-skips-flat-vmem.mir @@ -1,5 +1,5 @@ # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py -# RUN: llc -march=amdgcn -mcpu=polaris10 -run-pass si-insert-skips -amdgpu-skip-threshold=1 -verify-machineinstrs %s -o - | FileCheck %s +# RUN: llc -march=amdgcn -mcpu=polaris10 -run-pass si-insert-skips -amdgpu-skip-threshold-legacy=1 -verify-machineinstrs %s -o - | FileCheck %s --- diff --git a/llvm/test/CodeGen/AMDGPU/insert-skips-gws.mir b/llvm/test/CodeGen/AMDGPU/insert-skips-gws.mir index c84372086fd3c1..11051198f235e4 100644 --- a/llvm/test/CodeGen/AMDGPU/insert-skips-gws.mir +++ b/llvm/test/CodeGen/AMDGPU/insert-skips-gws.mir @@ -1,5 +1,5 @@ # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py -# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass si-insert-skips -amdgpu-skip-threshold=1 -verify-machineinstrs %s -o - | FileCheck %s +# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass si-insert-skips -amdgpu-skip-threshold-legacy=1 -verify-machineinstrs %s -o - | FileCheck %s # Make sure mandatory skips are inserted to ensure GWS ops aren't run with exec = 0 --- diff --git a/llvm/test/CodeGen/AMDGPU/insert-skips-ignored-insts.mir b/llvm/test/CodeGen/AMDGPU/insert-skips-ignored-insts.mir index 7da59df5d80cc6..a0c0a6f2052266 100644 --- a/llvm/test/CodeGen/AMDGPU/insert-skips-ignored-insts.mir +++ b/llvm/test/CodeGen/AMDGPU/insert-skips-ignored-insts.mir @@ -1,4 +1,4 @@ -# RUN: llc -mtriple=amdgcn-amd-amdhsa -run-pass si-insert-skips -amdgpu-skip-threshold=2 %s -o - | FileCheck %s +# RUN: llc -mtriple=amdgcn-amd-amdhsa -run-pass si-insert-skips -amdgpu-skip-threshold-legacy=2 %s -o - | FileCheck %s --- diff --git a/llvm/test/CodeGen/AMDGPU/insert-skips-kill-uncond.mir b/llvm/test/CodeGen/AMDGPU/insert-skips-kill-uncond.mir index bcc6e12d4ee781..c8832caf616366 100644 --- a/llvm/test/CodeGen/AMDGPU/insert-skips-kill-uncond.mir +++ b/llvm/test/CodeGen/AMDGPU/insert-skips-kill-uncond.mir @@ -1,4 +1,4 @@ -# RUN: llc -march=amdgcn -mcpu=polaris10 -run-pass si-insert-skips -amdgpu-skip-threshold=1 %s -o - | FileCheck %s +# RUN: llc -march=amdgcn -mcpu=polaris10 -run-pass si-insert-skips -amdgpu-skip-threshold-legacy=1 %s -o - | FileCheck %s # https://bugs.freedesktop.org/show_bug.cgi?id=99019 --- | define amdgpu_ps void @kill_uncond_branch() { diff --git a/llvm/test/CodeGen/AMDGPU/mubuf-legalize-operands.ll b/llvm/test/CodeGen/AMDGPU/mubuf-legalize-operands.ll index 46ee8af292458a..64206d4522803d 100644 --- a/llvm/test/CodeGen/AMDGPU/mubuf-legalize-operands.ll +++ b/llvm/test/CodeGen/AMDGPU/mubuf-legalize-operands.ll @@ -158,7 +158,7 @@ entry: ; W64: s_mov_b64 exec, [[SAVEEXEC]] ; W64: s_cbranch_execz [[TERMBB:BB[0-9]+_[0-9]+]] -; W64: BB{{[0-9]+_[0-9]+}}: +; W64: ; %bb.{{[0-9]+}}: ; W64-DAG: v_mov_b32_e32 [[IDX:v[0-9]+]], s4 ; W64-DAG: s_mov_b64 [[SAVEEXEC:s\[[0-9]+:[0-9]+\]]], exec @@ -204,7 +204,7 @@ entry: ; W32: s_mov_b32 exec_lo, [[SAVEEXEC]] ; W32: s_cbranch_execz [[TERMBB:BB[0-9]+_[0-9]+]] -; W32: BB{{[0-9]+_[0-9]+}}: +; W32: ; %bb.{{[0-9]+}}: ; W32-DAG: v_mov_b32_e32 [[IDX:v[0-9]+]], s4 ; W32-DAG: s_mov_b32 [[SAVEEXEC:s[0-9]+]], exec_lo @@ -270,7 +270,7 @@ entry: ; W64-O0: buffer_store_dword [[RES]], off, s[0:3], s32 offset:[[RES_OFF:[0-9]+]] ; 4-byte Folded Spill ; W64-O0: s_cbranch_execz [[TERMBB:BB[0-9]+_[0-9]+]] -; W64-O0: BB{{[0-9]+_[0-9]+}}: +; W64-O0: ; %bb.{{[0-9]+}}: ; W64-O0-DAG: s_mov_b64 s{{\[}}[[SAVEEXEC0:[0-9]+]]:[[SAVEEXEC1:[0-9]+]]{{\]}}, exec ; W64-O0-DAG: buffer_store_dword {{v[0-9]+}}, off, s[0:3], s32 offset:[[IDX_OFF:[0-9]+]] ; 4-byte Folded Spill ; W64-O0: v_writelane_b32 [[VSAVEEXEC:v[0-9]+]], s[[SAVEEXEC0]], [[SAVEEXEC_IDX0:[0-9]+]] diff --git a/llvm/test/CodeGen/AMDGPU/mul24-pass-ordering.ll b/llvm/test/CodeGen/AMDGPU/mul24-pass-ordering.ll index af34b0f3987280..d6b717411de791 100644 --- a/llvm/test/CodeGen/AMDGPU/mul24-pass-ordering.ll +++ b/llvm/test/CodeGen/AMDGPU/mul24-pass-ordering.ll @@ -58,9 +58,8 @@ define void @lsr_order_mul24_1(i32 %arg, i32 %arg1, i32 %arg2, float addrspace(3 ; GFX9-NEXT: v_cmp_eq_u32_e32 vcc, 1, v5 ; GFX9-NEXT: v_cmp_lt_u32_e64 s[4:5], v0, v1 ; GFX9-NEXT: s_and_saveexec_b64 s[10:11], s[4:5] -; GFX9-NEXT: ; mask branch BB1_4 ; GFX9-NEXT: s_cbranch_execz BB1_4 -; GFX9-NEXT: BB1_1: ; %bb19 +; GFX9-NEXT: ; %bb.1: ; %bb19 ; GFX9-NEXT: v_cvt_f32_u32_e32 v7, v6 ; GFX9-NEXT: v_and_b32_e32 v5, 0xffffff, v6 ; GFX9-NEXT: v_add_u32_e32 v6, v4, v0 diff --git a/llvm/test/CodeGen/AMDGPU/ret_jump.ll b/llvm/test/CodeGen/AMDGPU/ret_jump.ll index ffa851919f7091..84749170dc6d2f 100644 --- a/llvm/test/CodeGen/AMDGPU/ret_jump.ll +++ b/llvm/test/CodeGen/AMDGPU/ret_jump.ll @@ -11,12 +11,11 @@ ; GCN-NEXT: ; %else ; GCN: s_and_saveexec_b64 [[SAVE_EXEC:s\[[0-9]+:[0-9]+\]]], vcc -; GCN-NEXT: ; mask branch [[FLOW:BB[0-9]+_[0-9]+]] -; GCN: BB{{[0-9]+_[0-9]+}}: ; %unreachable.bb +; GCN: ; %bb.{{[0-9]+}}: ; %unreachable.bb ; GCN-NEXT: ; divergent unreachable -; GCN-NEXT: {{^}}[[FLOW]]: ; %Flow +; GCN-NEXT: ; %bb.{{[0-9]+}}: ; %Flow ; GCN-NEXT: s_or_b64 exec, exec ; GCN-NEXT: [[RET_BB]]: @@ -55,11 +54,17 @@ ret.bb: ; preds = %else, %main_body } ; GCN-LABEL: {{^}}uniform_br_nontrivial_ret_divergent_br_nontrivial_unreachable: -; GCN: s_cbranch_vccnz [[RET_BB:BB[0-9]+_[0-9]+]] +; GCN: s_cbranch_vccz -; GCN: ; %bb.{{[0-9]+}}: ; %else +; GCN: ; %bb.{{[0-9]+}}: ; %Flow +; GCN: s_cbranch_execnz [[RETURN:BB[0-9]+_[0-9]+]] + +; GCN: ; %UnifiedReturnBlock +; GCN-NEXT: s_or_b64 exec, exec +; GCN-NEXT: s_waitcnt + +; GCN: BB{{[0-9]+_[0-9]+}}: ; %else ; GCN: s_and_saveexec_b64 [[SAVE_EXEC:s\[[0-9]+:[0-9]+\]]], vcc -; GCN-NEXT: ; mask branch [[FLOW1:BB[0-9]+_[0-9]+]] ; GCN-NEXT: ; %unreachable.bb ; GCN: ds_write_b32 @@ -67,12 +72,6 @@ ret.bb: ; preds = %else, %main_body ; GCN: ; %ret.bb ; GCN: store_dword - -; GCN: ; %UnifiedReturnBlock -; GCN-NEXT: s_or_b64 exec, exec -; GCN-NEXT: s_waitcnt -; GCN-NEXT: ; return -; GCN-NEXT: .Lfunc_end define amdgpu_ps <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float }> @uniform_br_nontrivial_ret_divergent_br_nontrivial_unreachable([9 x <4 x i32>] addrspace(4)* inreg %arg, [17 x <4 x i32>] addrspace(4)* inreg %arg1, [17 x <8 x i32>] addrspace(4)* inreg %arg2, i32 addrspace(4)* inreg %arg3, float inreg %arg4, i32 inreg %arg5, <2 x i32> %arg6, <2 x i32> %arg7, <2 x i32> %arg8, <3 x i32> %arg9, <2 x i32> %arg10, <2 x i32> %arg11, <2 x i32> %arg12, float %arg13, float %arg14, float %arg15, float %arg16, float %arg17, i32 inreg %arg18, i32 %arg19, float %arg20, i32 %arg21) #0 { main_body: %i.i = extractelement <2 x i32> %arg7, i32 0 diff --git a/llvm/test/CodeGen/AMDGPU/si-annotate-cf-noloop.ll b/llvm/test/CodeGen/AMDGPU/si-annotate-cf-noloop.ll index a99d18147ccf1f..e854c089268ff4 100644 --- a/llvm/test/CodeGen/AMDGPU/si-annotate-cf-noloop.ll +++ b/llvm/test/CodeGen/AMDGPU/si-annotate-cf-noloop.ll @@ -40,8 +40,6 @@ bb5: ; preds = %bb3, %bb1 ; GCN: load_dwordx4 ; GCN: v_cmp_nlt_f32 ; GCN: s_and_saveexec_b64 -; GCN: ; mask branch [[UNIFIED_RET:BB[0-9]+_[0-9]+]] -; GCN-NEXT: [[UNIFIED_RET]]: ; GCN-NEXT: s_endpgm ; GCN: .Lfunc_end define amdgpu_kernel void @annotate_ret_noloop(<4 x float> addrspace(1)* noalias nocapture readonly %arg) #0 { diff --git a/llvm/test/CodeGen/AMDGPU/si-lower-control-flow-unreachable-block.ll b/llvm/test/CodeGen/AMDGPU/si-lower-control-flow-unreachable-block.ll index ce85a66634044c..64f1824b890640 100644 --- a/llvm/test/CodeGen/AMDGPU/si-lower-control-flow-unreachable-block.ll +++ b/llvm/test/CodeGen/AMDGPU/si-lower-control-flow-unreachable-block.ll @@ -3,13 +3,12 @@ ; GCN-LABEL: {{^}}lower_control_flow_unreachable_terminator: ; GCN: v_cmp_eq_u32 ; GCN: s_and_saveexec_b64 -; GCN: ; mask branch [[RET:BB[0-9]+_[0-9]+]] -; GCN-NEXT: BB{{[0-9]+_[0-9]+}}: ; %unreachable +; GCN-NEXT: ; %bb.{{[0-9]+}}: ; %unreachable ; GCN: ds_write_b32 ; GCN: ; divergent unreachable -; GCN-NEXT: [[RET]]: ; %UnifiedReturnBlock +; GCN-NEXT: ; %bb.{{[0-9]+}}: ; %UnifiedReturnBlock ; GCN: s_endpgm define amdgpu_kernel void @lower_control_flow_unreachable_terminator() #0 { @@ -29,13 +28,12 @@ ret: ; GCN-LABEL: {{^}}lower_control_flow_unreachable_terminator_swap_block_order: ; GCN: v_cmp_ne_u32 ; GCN: s_and_saveexec_b64 -; GCN: ; mask branch [[RETURN:BB[0-9]+_[0-9]+]] -; GCN-NEXT: {{^BB[0-9]+_[0-9]+}}: ; %unreachable +; GCN-NEXT: ; %bb.{{[0-9]+}}: ; %unreachable ; GCN: ds_write_b32 ; GCN: ; divergent unreachable -; GCN: [[RETURN]]: +; GCN: ; %bb.{{[0-9]+}}: ; GCN-NEXT: s_endpgm define amdgpu_kernel void @lower_control_flow_unreachable_terminator_swap_block_order() #0 { bb: diff --git a/llvm/test/CodeGen/AMDGPU/si-lower-control-flow.mir b/llvm/test/CodeGen/AMDGPU/si-lower-control-flow.mir index fdb0c465c20be9..b360f3aa5ffb64 100644 --- a/llvm/test/CodeGen/AMDGPU/si-lower-control-flow.mir +++ b/llvm/test/CodeGen/AMDGPU/si-lower-control-flow.mir @@ -32,7 +32,7 @@ body: | ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY]], undef %1:sreg_64, implicit-def dead $scc ; GCN: [[S_XOR_B64_:%[0-9]+]]:sreg_64 = S_XOR_B64 [[S_AND_B64_]], [[COPY]], implicit-def dead $scc ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_]] - ; GCN: SI_MASK_BRANCH %bb.2, implicit $exec + ; GCN: S_CBRANCH_EXECZ %bb.2, implicit $exec ; GCN: S_BRANCH %bb.1 ; GCN: bb.1: ; GCN: successors: %bb.2(0x80000000) diff --git a/llvm/test/CodeGen/AMDGPU/skip-branch-taildup-ret.mir b/llvm/test/CodeGen/AMDGPU/skip-branch-taildup-ret.mir index 554094cf9c0204..9574edd0af98b8 100644 --- a/llvm/test/CodeGen/AMDGPU/skip-branch-taildup-ret.mir +++ b/llvm/test/CodeGen/AMDGPU/skip-branch-taildup-ret.mir @@ -1,5 +1,5 @@ # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py -# RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs -run-pass=si-insert-skips -amdgpu-skip-threshold=1000000 -o - %s | FileCheck %s +# RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs -run-pass=si-insert-skips -amdgpu-skip-threshold-legacy=1000000 -o - %s | FileCheck %s --- name: skip_branch_taildup_endpgm diff --git a/llvm/test/CodeGen/AMDGPU/skip-branch-trap.ll b/llvm/test/CodeGen/AMDGPU/skip-branch-trap.ll index bce4023316fad0..7b146e0317837d 100644 --- a/llvm/test/CodeGen/AMDGPU/skip-branch-trap.ll +++ b/llvm/test/CodeGen/AMDGPU/skip-branch-trap.ll @@ -5,9 +5,8 @@ ; An s_cbranch_execnz is required to avoid trapping if all lanes are 0 ; GCN-LABEL: {{^}}trap_divergent_branch: ; GCN: s_and_saveexec_b64 -; GCN: s_cbranch_execz [[ENDPGM:BB[0-9]+_[0-9]+]] -; GCN: s_branch [[TRAP:BB[0-9]+_[0-9]+]] -; GCN: [[ENDPGM]]: +; GCN: s_cbranch_execnz [[TRAP:BB[0-9]+_[0-9]+]] +; GCN: ; %bb.{{[0-9]+}}: ; GCN-NEXT: s_endpgm ; GCN: [[TRAP]]: ; GCN: s_trap 2 @@ -30,7 +29,7 @@ end: ; GCN-LABEL: {{^}}debugtrap_divergent_branch: ; GCN: s_and_saveexec_b64 ; GCN: s_cbranch_execz [[ENDPGM:BB[0-9]+_[0-9]+]] -; GCN: BB{{[0-9]+}}_{{[0-9]+}}: +; GCN: ; %bb.{{[0-9]+}}: ; GCN: s_trap 3 ; GCN-NEXT: [[ENDPGM]]: ; GCN-NEXT: s_endpgm diff --git a/llvm/test/CodeGen/AMDGPU/skip-if-dead.ll b/llvm/test/CodeGen/AMDGPU/skip-if-dead.ll index e848e75fc00596..115782863efca7 100644 --- a/llvm/test/CodeGen/AMDGPU/skip-if-dead.ll +++ b/llvm/test/CodeGen/AMDGPU/skip-if-dead.ll @@ -220,10 +220,9 @@ exit: ; CHECK: v_cmp_eq_u32_e32 vcc, 0, v0 ; CHECK-NEXT: s_and_saveexec_b64 [[SAVEEXEC:s\[[0-9]+:[0-9]+\]]], vcc ; CHECK-NEXT: s_xor_b64 [[SAVEEXEC]], exec, [[SAVEEXEC]] -; CHECK-NEXT: ; mask branch [[EXIT:BB[0-9]+_[0-9]+]] -; CHECK-NEXT: s_cbranch_execz [[EXIT]] +; CHECK-NEXT: s_cbranch_execz [[EXIT:BB[0-9]+_[0-9]+]] -; CHECK: {{BB[0-9]+_[0-9]+}}: ; %bb.preheader +; CHECK: ; %bb.{{[0-9]+}}: ; %bb.preheader ; CHECK: s_mov_b32 ; CHECK: [[LOOP_BB:BB[0-9]+_[0-9]+]]: @@ -357,20 +356,18 @@ bb7: ; preds = %bb4 ; CHECK: ; %bb.0: ; CHECK: s_and_saveexec_b64 ; CHECK: s_xor_b64 -; CHECK-NEXT: mask branch [[BB4:BB[0-9]+_[0-9]+]] ; CHECK: v_cmpx_gt_f32_e32 vcc, 0, -; CHECK: [[BB4]]: +; CHECK: BB{{[0-9]+_[0-9]+}}: ; CHECK: s_or_b64 exec, exec ; CHECK: image_sample_c ; CHECK: v_cmp_neq_f32_e32 vcc, 0, ; CHECK: s_and_saveexec_b64 s{{\[[0-9]+:[0-9]+\]}}, vcc -; CHECK: mask branch [[END:BB[0-9]+_[0-9]+]] -; CHECK-NEXT: s_cbranch_execz [[END]] +; CHECK-NEXT: s_cbranch_execz [[END:BB[0-9]+_[0-9]+]] ; CHECK-NOT: branch -; CHECK: BB{{[0-9]+_[0-9]+}}: ; %bb8 +; CHECK: ; %bb.{{[0-9]+}}: ; %bb8 ; CHECK: buffer_store_dword ; CHECK: [[END]]: diff --git a/llvm/test/CodeGen/AMDGPU/smrd_vmem_war.ll b/llvm/test/CodeGen/AMDGPU/smrd_vmem_war.ll index 4ba16b4eb30bea..c376886a3e80f7 100644 --- a/llvm/test/CodeGen/AMDGPU/smrd_vmem_war.ll +++ b/llvm/test/CodeGen/AMDGPU/smrd_vmem_war.ll @@ -1,6 +1,6 @@ ; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck %s -check-prefix=GCN -; GCN-LABEL: BB0_1 +; GCN-LABEL: ; %bb.0: ; GCN: s_load_dword s{{[0-9]+}}, s{{\[}}[[ADDR_LO:[0-9]+]]{{\:}}[[ADDR_HI:[0-9]+]]{{\]}}, 0x0 ; GCN: s_waitcnt lgkmcnt(0) ; GCN: global_store_dword v{{\[}}[[ADDR_LO]]{{\:}}[[ADDR_HI]]{{\]}}, v{{[0-9]+}}, off diff --git a/llvm/test/CodeGen/AMDGPU/stack-pointer-offset-relative-frameindex.ll b/llvm/test/CodeGen/AMDGPU/stack-pointer-offset-relative-frameindex.ll index 00ae166a6ce51a..be60a34b420891 100644 --- a/llvm/test/CodeGen/AMDGPU/stack-pointer-offset-relative-frameindex.ll +++ b/llvm/test/CodeGen/AMDGPU/stack-pointer-offset-relative-frameindex.ll @@ -28,9 +28,8 @@ define amdgpu_kernel void @kernel_background_evaluate(float addrspace(5)* %kg, < ; GCN-NEXT: s_swappc_b64 s[30:31], s[4:5] ; GCN-NEXT: v_cmp_ne_u32_e32 vcc_lo, 0, v0 ; GCN-NEXT: s_and_saveexec_b32 s0, vcc_lo -; GCN-NEXT: ; mask branch BB0_2 ; GCN-NEXT: s_cbranch_execz BB0_2 -; GCN-NEXT: BB0_1: ; %if.then4.i +; GCN-NEXT: ; %bb.1: ; %if.then4.i ; GCN-NEXT: buffer_load_dword v0, v32, s[36:39], s32 offen ; GCN-NEXT: buffer_load_dword v1, v32, s[36:39], s32 offen offset:4 ; GCN-NEXT: s_waitcnt vmcnt(0) diff --git a/llvm/test/CodeGen/AMDGPU/subreg-coalescer-undef-use.ll b/llvm/test/CodeGen/AMDGPU/subreg-coalescer-undef-use.ll index 3127201e9224ea..70b7d06e442308 100644 --- a/llvm/test/CodeGen/AMDGPU/subreg-coalescer-undef-use.ll +++ b/llvm/test/CodeGen/AMDGPU/subreg-coalescer-undef-use.ll @@ -18,14 +18,13 @@ define amdgpu_kernel void @foobar(float %a0, float %a1, float addrspace(1)* %out ; CHECK-NEXT: v_mov_b32_e32 v2, s6 ; CHECK-NEXT: v_mov_b32_e32 v3, s7 ; CHECK-NEXT: s_and_saveexec_b64 s[6:7], vcc -; CHECK-NEXT: ; mask branch BB0_2 -; CHECK-NEXT: BB0_1: ; %ift +; CHECK-NEXT: ; %bb.1: ; %ift ; CHECK-NEXT: s_mov_b32 s4, s5 ; CHECK-NEXT: v_mov_b32_e32 v0, s4 ; CHECK-NEXT: v_mov_b32_e32 v1, s5 ; CHECK-NEXT: v_mov_b32_e32 v2, s6 ; CHECK-NEXT: v_mov_b32_e32 v3, s7 -; CHECK-NEXT: BB0_2: ; %ife +; CHECK-NEXT: ; %bb.2: ; %ife ; CHECK-NEXT: s_or_b64 exec, exec, s[6:7] ; CHECK-NEXT: s_mov_b32 s3, 0xf000 ; CHECK-NEXT: buffer_store_dword v1, off, s[0:3], 0 diff --git a/llvm/test/CodeGen/AMDGPU/uniform-cfg.ll b/llvm/test/CodeGen/AMDGPU/uniform-cfg.ll index 9655263406553d..2c64b1bdb3d203 100644 --- a/llvm/test/CodeGen/AMDGPU/uniform-cfg.ll +++ b/llvm/test/CodeGen/AMDGPU/uniform-cfg.ll @@ -335,7 +335,7 @@ endif: ; GCN: [[IF_LABEL]]: ; GCN: v_cmp_gt_u32_e32 vcc, 16, v{{[0-9]+}} ; GCN: s_and_saveexec_b64 [[MASK:s\[[0-9]+:[0-9]+\]]], vcc -; GCN: ; mask branch [[ENDIF_LABEL]] +; GCN: s_cbranch_execz [[ENDIF_LABEL]] ; GCN: v_mov_b32_e32 [[ONE:v[0-9]+]], 1 ; GCN: buffer_store_dword [[ONE]] ; GCN: s_endpgm diff --git a/llvm/test/CodeGen/AMDGPU/uniform-loop-inside-nonuniform.ll b/llvm/test/CodeGen/AMDGPU/uniform-loop-inside-nonuniform.ll index a1cf6cf630048e..a23eb2b137db19 100644 --- a/llvm/test/CodeGen/AMDGPU/uniform-loop-inside-nonuniform.ll +++ b/llvm/test/CodeGen/AMDGPU/uniform-loop-inside-nonuniform.ll @@ -5,7 +5,6 @@ ; CHECK-LABEL: {{^}}test1: ; CHECK: v_cmp_ne_u32_e32 vcc, 0 ; CHECK: s_and_saveexec_b64 -; CHECK-NEXT: ; mask branch ; CHECK-NEXT: s_cbranch_execz BB{{[0-9]+_[0-9]+}} ; CHECK: [[LOOP_BODY_LABEL:BB[0-9]+_[0-9]+]]: ; %loop_body @@ -33,7 +32,6 @@ out: ; CHECK-LABEL: {{^}}test2: ; CHECK: s_and_saveexec_b64 -; CHECK-NEXT: ; mask branch ; CHECK-NEXT: s_cbranch_execz define amdgpu_kernel void @test2(i32 addrspace(1)* %out, i32 %a, i32 %b) { main_body: diff --git a/llvm/test/CodeGen/AMDGPU/valu-i1.ll b/llvm/test/CodeGen/AMDGPU/valu-i1.ll index ea74268dbe7c2a..8d522ffd115891 100644 --- a/llvm/test/CodeGen/AMDGPU/valu-i1.ll +++ b/llvm/test/CodeGen/AMDGPU/valu-i1.ll @@ -13,19 +13,17 @@ declare i32 @llvm.amdgcn.workitem.id.x() nounwind readnone ; SI-NEXT: s_mov_b64 {{s\[[0-9]+:[0-9]+\]}}, 0 ; SI-NEXT: s_and_saveexec_b64 [[SAVE1:s\[[0-9]+:[0-9]+\]]], vcc ; SI-NEXT: s_xor_b64 [[SAVE2:s\[[0-9]+:[0-9]+\]]], exec, [[SAVE1]] -; SI-NEXT: ; mask branch [[FLOW_BB:BB[0-9]+_[0-9]+]] -; SI-NEXT: s_cbranch_execz [[FLOW_BB]] +; SI-NEXT: s_cbranch_execz [[FLOW_BB:BB[0-9]+_[0-9]+]] -; SI-NEXT: BB{{[0-9]+}}_1: ; %LeafBlock3 +; SI-NEXT: ; %bb.{{[0-9]+}}: ; %LeafBlock3 ; SI: s_mov_b64 s[{{[0-9]:[0-9]}}], -1 ; SI: s_and_saveexec_b64 -; SI-NEXT: ; mask branch +; SI-NEXT: s_cbranch_execnz ; v_mov should be after exec modification ; SI: [[FLOW_BB]]: ; SI-NEXT: s_or_saveexec_b64 [[SAVE3:s\[[0-9]+:[0-9]+\]]], [[SAVE2]] ; SI-NEXT: s_xor_b64 exec, exec, [[SAVE3]] -; SI-NEXT: ; mask branch ; define amdgpu_kernel void @test_if(i32 %b, i32 addrspace(1)* %src, i32 addrspace(1)* %dst) #1 { entry: @@ -65,10 +63,9 @@ end: ; SI-LABEL: {{^}}simple_test_v_if: ; SI: v_cmp_ne_u32_e32 vcc, 0, v{{[0-9]+}} ; SI: s_and_saveexec_b64 [[BR_SREG:s\[[0-9]+:[0-9]+\]]], vcc -; SI-NEXT: ; mask branch [[EXIT:BB[0-9]+_[0-9]+]] -; SI-NEXT: s_cbranch_execz [[EXIT]] +; SI-NEXT: s_cbranch_execz [[EXIT:BB[0-9]+_[0-9]+]] -; SI-NEXT: BB{{[0-9]+_[0-9]+}}: +; SI-NEXT: ; %bb.{{[0-9]+}}: ; SI: buffer_store_dword ; SI-NEXT: {{^}}[[EXIT]]: @@ -92,10 +89,9 @@ exit: ; SI-LABEL: {{^}}simple_test_v_if_ret_else_ret: ; SI: v_cmp_ne_u32_e32 vcc, 0, v{{[0-9]+}} ; SI: s_and_saveexec_b64 [[BR_SREG:s\[[0-9]+:[0-9]+\]]], vcc -; SI-NEXT: ; mask branch [[EXIT:BB[0-9]+_[0-9]+]] -; SI-NEXT: s_cbranch_execz [[EXIT]] +; SI-NEXT: s_cbranch_execz [[EXIT:BB[0-9]+_[0-9]+]] -; SI-NEXT: BB{{[0-9]+_[0-9]+}}: +; SI-NEXT: ; %bb.{{[0-9]+}}: ; SI: buffer_store_dword ; SI-NEXT: {{^}}[[EXIT]]: @@ -122,23 +118,22 @@ exit: ; SI: v_cmp_eq_u32_e32 vcc, 0, v{{[0-9]+}} ; SI: s_and_saveexec_b64 [[BR_SREG:s\[[0-9]+:[0-9]+\]]], vcc ; SI: s_xor_b64 [[BR_SREG]], exec, [[BR_SREG]] -; SI: ; mask branch [[FLOW:BB[0-9]+_[0-9]+]] +; SI: s_cbranch_execnz [[EXIT:BB[0-9]+_[0-9]+]] -; SI-NEXT: {{^BB[0-9]+_[0-9]+}}: ; %exit -; SI: ds_write_b32 - -; SI-NEXT: {{^}}[[FLOW]]: +; SI-NEXT: {{^BB[0-9]+_[0-9]+}}: ; %Flow ; SI-NEXT: s_or_saveexec_b64 ; SI-NEXT: s_xor_b64 exec, exec -; SI-NEXT: ; mask branch [[UNIFIED_RETURN:BB[0-9]+_[0-9]+]] -; SI-NEXT: s_cbranch_execz [[UNIFIED_RETURN]] +; SI-NEXT: s_cbranch_execz [[UNIFIED_RETURN:BB[0-9]+_[0-9]+]] -; SI-NEXT: {{^BB[0-9]+_[0-9]+}}: ; %then +; SI-NEXT: ; %bb.{{[0-9]+}}: ; %then ; SI: s_waitcnt ; SI-NEXT: buffer_store_dword ; SI-NEXT: {{^}}[[UNIFIED_RETURN]]: ; %UnifiedReturnBlock ; SI: s_endpgm + +; SI-NEXT: {{^}}[[EXIT]]: +; SI: ds_write_b32 define amdgpu_kernel void @simple_test_v_if_ret_else_code_ret(i32 addrspace(1)* %dst, i32 addrspace(1)* %src) #1 { %tid = call i32 @llvm.amdgcn.workitem.id.x() %is.0 = icmp ne i32 %tid, 0 @@ -157,7 +152,6 @@ exit: ; SI-LABEL: {{^}}simple_test_v_loop: ; SI: v_cmp_ne_u32_e32 vcc, 0, v{{[0-9]+}} ; SI: s_and_saveexec_b64 [[BR_SREG:s\[[0-9]+:[0-9]+\]]], vcc -; SI-NEXT: ; mask branch ; SI-NEXT: s_cbranch_execz [[LABEL_EXIT:BB[0-9]+_[0-9]+]] ; SI: s_mov_b64 {{s\[[0-9]+:[0-9]+\]}}, 0{{$}} @@ -199,11 +193,10 @@ exit: ; SI: buffer_load_dword [[VBOUND:v[0-9]+]] ; SI: v_cmp_lt_i32_e32 vcc ; SI: s_and_saveexec_b64 [[OUTER_CMP_SREG:s\[[0-9]+:[0-9]+\]]], vcc -; SI-NEXT: ; mask branch ; SI-NEXT: s_cbranch_execz [[LABEL_EXIT:BB[0-9]+_[0-9]+]] ; Initialize inner condition to false -; SI: BB{{[0-9]+_[0-9]+}}: ; %bb10.preheader +; SI: ; %bb.{{[0-9]+}}: ; %bb10.preheader ; SI: s_mov_b64 [[COND_STATE:s\[[0-9]+:[0-9]+\]]], 0{{$}} ; Clear exec bits for workitems that load -1s @@ -214,9 +207,9 @@ exit: ; SI-DAG: v_cmp_ne_u32_e32 [[NEG1_CHECK_1:vcc]], -1, [[B]] ; SI: s_and_b64 [[ORNEG1:s\[[0-9]+:[0-9]+\]]], [[NEG1_CHECK_1]], [[NEG1_CHECK_0]] ; SI: s_and_saveexec_b64 [[ORNEG2:s\[[0-9]+:[0-9]+\]]], [[ORNEG1]] -; SI: ; mask branch [[LABEL_FLOW:BB[0-9]+_[0-9]+]] +; SI: s_cbranch_execz [[LABEL_FLOW:BB[0-9]+_[0-9]+]] -; SI: BB{{[0-9]+_[0-9]+}}: ; %bb20 +; SI: ; %bb.{{[0-9]+}}: ; %bb20 ; SI: buffer_store_dword ; SI: [[LABEL_FLOW]]: diff --git a/llvm/test/CodeGen/AMDGPU/wave32.ll b/llvm/test/CodeGen/AMDGPU/wave32.ll index f26b2868e1a899..903142803301af 100644 --- a/llvm/test/CodeGen/AMDGPU/wave32.ll +++ b/llvm/test/CodeGen/AMDGPU/wave32.ll @@ -151,7 +151,7 @@ define amdgpu_kernel void @test_vop3_cmp_u32_sop_or(i32 addrspace(1)* %arg) { ; GCN-LABEL: {{^}}test_mask_if: ; GFX1032: s_and_saveexec_b32 s{{[0-9]+}}, vcc_lo ; GFX1064: s_and_saveexec_b64 s[{{[0-9:]+}}], vcc{{$}} -; GCN: ; mask branch +; GCN: s_cbranch_execz define amdgpu_kernel void @test_mask_if(i32 addrspace(1)* %arg) #0 { %lid = tail call i32 @llvm.amdgcn.workitem.id.x() %cmp = icmp ugt i32 %lid, 10 @@ -175,19 +175,18 @@ endif: ; GFX1032: s_and_saveexec_b32 s{{[0-9]+}}, vcc_lo ; GFX1064: s_and_saveexec_b64 s[{{[0-9:]+}}], vcc{{$}} ; GCN: s_cbranch_execz -; GCN: BB{{.*}}: +; GCN: ; %bb.{{[0-9]+}}: ; GCN: BB{{.*}}: ; GFX1032: s_xor_b32 s{{[0-9]+}}, exec_lo, s{{[0-9]+}} ; GFX1064: s_xor_b64 s[{{[0-9:]+}}], exec, s[{{[0-9:]+}}] -; GCN: ; mask branch BB -; GCN: BB{{.*}}: -; GCN: BB{{.*}}: +; GCN: ; %bb.{{[0-9]+}}: +; GCN: ; %bb.{{[0-9]+}}: ; GFX1032: s_or_b32 exec_lo, exec_lo, s{{[0-9]+}} ; GFX1032: s_and_saveexec_b32 s{{[0-9]+}}, s{{[0-9]+}} ; GFX1064: s_or_b64 exec, exec, s[{{[0-9:]+}}] ; GFX1064: s_and_saveexec_b64 s[{{[0-9:]+}}], s[{{[0-9:]+}}]{{$}} -; GCN: ; mask branch BB -; GCN: BB{{.*}}: +; GCN: s_cbranch_execz BB +; GCN: ; %bb.{{[0-9]+}}: ; GCN: BB{{.*}}: ; GCN: s_endpgm define amdgpu_kernel void @test_loop_with_if(i32 addrspace(1)* %arg) #0 { @@ -228,9 +227,8 @@ bb13: ; GCN-LABEL: {{^}}test_loop_with_if_else_break: ; GFX1032: s_and_saveexec_b32 s{{[0-9]+}}, vcc_lo ; GFX1064: s_and_saveexec_b64 s[{{[0-9:]+}}], vcc{{$}} -; GCN: ; mask branch ; GCN: s_cbranch_execz -; GCN: BB{{.*}}: +; GCN: ; %bb.{{[0-9]+}}: ; %.preheader ; GCN: BB{{.*}}: ; GFX1032: s_or_b32 [[MASK0:s[0-9]+]], [[MASK0]], vcc_lo diff --git a/llvm/test/CodeGen/AMDGPU/wqm.ll b/llvm/test/CodeGen/AMDGPU/wqm.ll index 367652ac4a84ec..1026d63d70b7ae 100644 --- a/llvm/test/CodeGen/AMDGPU/wqm.ll +++ b/llvm/test/CodeGen/AMDGPU/wqm.ll @@ -425,9 +425,8 @@ END: ;CHECK-NEXT: s_and_b64 exec, exec, [[ORIG]] ;CHECK-NEXT: s_and_b64 [[SAVED]], exec, [[SAVED]] ;CHECK-NEXT: s_xor_b64 exec, exec, [[SAVED]] -;CHECK-NEXT: mask branch [[END_BB:BB[0-9]+_[0-9]+]] -;CHECK-NEXT: s_cbranch_execz [[END_BB]] -;CHECK-NEXT: BB{{[0-9]+_[0-9]+}}: ; %ELSE +;CHECK-NEXT: s_cbranch_execz [[END_BB:BB[0-9]+_[0-9]+]] +;CHECK-NEXT: ; %bb.{{[0-9]+}}: ; %ELSE ;CHECK: store_dword ;CHECK: [[END_BB]]: ; %END ;CHECK: s_or_b64 exec, exec, diff --git a/llvm/test/CodeGen/Hexagon/tiny_bkfir_artdeps.ll b/llvm/test/CodeGen/Hexagon/tiny_bkfir_artdeps.ll index 67dcf4688e4630..89f9daf08a884e 100644 --- a/llvm/test/CodeGen/Hexagon/tiny_bkfir_artdeps.ll +++ b/llvm/test/CodeGen/Hexagon/tiny_bkfir_artdeps.ll @@ -1,4 +1,5 @@ ; RUN: llc -march=hexagon -mv67t -debug-only=pipeliner < %s 2>&1 | FileCheck %s +; REQUIRES: asserts ; Test that the artificial dependencies have been created. diff --git a/llvm/test/CodeGen/WebAssembly/multivalue.ll b/llvm/test/CodeGen/WebAssembly/multivalue.ll index ee32852ef5791c..af601f7cbe9272 100644 --- a/llvm/test/CodeGen/WebAssembly/multivalue.ll +++ b/llvm/test/CodeGen/WebAssembly/multivalue.ll @@ -1,29 +1,116 @@ -; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+multivalue | FileCheck %s -; RUN: llc < %s --filetype=obj -mattr=+multivalue | obj2yaml | FileCheck %s --check-prefix OBJ +; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+multivalue,+tail-call | FileCheck %s +; RUN: llc < %s --filetype=obj -mattr=+multivalue,+tail-call | obj2yaml | FileCheck %s --check-prefix OBJ -; Test that the multivalue returns, function types, and block types -; work as expected. +; Test that the multivalue calls, returns, function types, and block +; types work as expected. target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" target triple = "wasm32-unknown-unknown" -%pair = type { i32, i32 } -%packed_pair = type <{ i32, i32 }> +%pair = type { i32, i64 } +%packed_pair = type <{ i32, i64 }> + + +; CHECK-LABEL: pair_const: +; CHECK-NEXT: .functype pair_const () -> (i32, i64) +; CHECK-NEXT: i32.const $push[[L0:[0-9]+]]=, 42{{$}} +; CHECK-NEXT: i64.const $push[[L1:[0-9]+]]=, 42{{$}} +; CHECK-NEXT: return $pop[[L0]], $pop[[L1]]{{$}} +define %pair @pair_const() { + ret %pair { i32 42, i64 42 } +} + +; CHECK-LABEL: packed_pair_const: +; CHECK-NEXT: .functype packed_pair_const () -> (i32, i64) +; CHECK-NEXT: i32.const $push[[L0:[0-9]+]]=, 42{{$}} +; CHECK-NEXT: i64.const $push[[L1:[0-9]+]]=, 42{{$}} +; CHECK-NEXT: return $pop[[L0]], $pop[[L1]]{{$}} +define %packed_pair @packed_pair_const() { + ret %packed_pair <{ i32 42, i64 42 }> +} ; CHECK-LABEL: pair_ident: -; CHECK-NEXT: .functype pair_ident (i32, i32) -> (i32, i32) +; CHECK-NEXT: .functype pair_ident (i32, i64) -> (i32, i64) ; CHECK-NEXT: return $0, $1{{$}} define %pair @pair_ident(%pair %p) { ret %pair %p } ; CHECK-LABEL: packed_pair_ident: -; CHECK-NEXT: .functype packed_pair_ident (i32, i32) -> (i32, i32) +; CHECK-NEXT: .functype packed_pair_ident (i32, i64) -> (i32, i64) ; CHECK-NEXT: return $0, $1{{$}} define %packed_pair @packed_pair_ident(%packed_pair %p) { ret %packed_pair %p } +;; TODO: Multivalue calls are a WIP and do not necessarily produce +;; correct output. For now, just check that they don't cause any +;; crashes. + +define void @pair_call() { + %p = call %pair @pair_const() + ret void +} + +define void @packed_pair_call() { + %p = call %packed_pair @packed_pair_const() + ret void +} + +define %pair @pair_call_return() { + %p = call %pair @pair_const() + ret %pair %p +} + +define %packed_pair @packed_pair_call_return() { + %p = call %packed_pair @packed_pair_const() + ret %packed_pair %p +} + +define %pair @pair_tail_call() { + %p = musttail call %pair @pair_const() + ret %pair %p +} + +define %packed_pair @packed_pair_tail_call() { + %p = musttail call %packed_pair @packed_pair_const() + ret %packed_pair %p +} + +define i32 @pair_call_return_first() { + %p = call %pair @pair_const() + %v = extractvalue %pair %p, 0 + ret i32 %v +} + +define i32 @packed_pair_call_return_first() { + %p = call %packed_pair @packed_pair_const() + %v = extractvalue %packed_pair %p, 0 + ret i32 %v +} + +define i64 @pair_call_return_second() { + %p = call %pair @pair_const() + %v = extractvalue %pair %p, 1 + ret i64 %v +} + +define i64 @packed_pair_call_return_second() { + %p = call %packed_pair @packed_pair_const() + %v = extractvalue %packed_pair %p, 1 + ret i64 %v +} + +define %pair @pair_pass_through(%pair %p) { + %r = call %pair @pair_ident(%pair %p) + ret %pair %r +} + +define %packed_pair @packed_pair_pass_through(%packed_pair %p) { + %r = call %packed_pair @packed_pair_ident(%packed_pair %p) + ret %packed_pair %r +} + ; CHECK-LABEL: minimal_loop: ; CHECK-NEXT: .functype minimal_loop (i32) -> (i32, i64) ; CHECK-NEXT: .LBB{{[0-9]+}}_1: @@ -31,7 +118,7 @@ define %packed_pair @packed_pair_ident(%packed_pair %p) { ; CHECK-NEXT: br 0{{$}} ; CHECK-NEXT: .LBB{{[0-9]+}}_2: ; CHECK-NEXT: end_loop{{$}} -define {i32, i64} @minimal_loop(i32* %p) { +define %pair @minimal_loop(i32* %p) { entry: br label %loop loop: @@ -39,21 +126,40 @@ loop: } ; CHECK-LABEL: .section .custom_section.target_features -; CHECK-NEXT: .int8 1 +; CHECK-NEXT: .int8 2 ; CHECK-NEXT: .int8 43 ; CHECK-NEXT: .int8 10 ; CHECK-NEXT: .ascii "multivalue" +; CHECK-NEXT: .int8 43 +; CHECK-NEXT: .int8 9 +; CHECK-NEXT: .ascii "tail-call" ; OBJ-LABEL: - Type: TYPE ; OBJ-NEXT: Signatures: ; OBJ-NEXT: - Index: 0 -; OBJ-NEXT: ParamTypes: +; OBJ-NEXT: ParamTypes: [] +; OBJ-NEXT: ReturnTypes: ; OBJ-NEXT: - I32 +; OBJ-NEXT: - I64 +; OBJ-NEXT: - Index: 1 +; OBJ-NEXT: ParamTypes: ; OBJ-NEXT: - I32 +; OBJ-NEXT: - I64 ; OBJ-NEXT: ReturnTypes: ; OBJ-NEXT: - I32 +; OBJ-NEXT: - I64 +; OBJ-NEXT: - Index: 2 +; OBJ-NEXT: ParamTypes: [] +; OBJ-NEXT: ReturnTypes: [] +; OBJ-NEXT: - Index: 3 +; OBJ-NEXT: ParamTypes: [] +; OBJ-NEXT: ReturnTypes: ; OBJ-NEXT: - I32 -; OBJ-NEXT: - Index: 1 +; OBJ-NEXT: - Index: 4 +; OBJ-NEXT: ParamTypes: [] +; OBJ-NEXT: ReturnTypes: +; OBJ-NEXT: - I64 +; OBJ-NEXT: - Index: 5 ; OBJ-NEXT: ParamTypes: ; OBJ-NEXT: - I32 ; OBJ-NEXT: ReturnTypes: diff --git a/llvm/test/DebugInfo/PDB/annotation.test b/llvm/test/DebugInfo/PDB/annotation.test index ba6bd14061e4d1..f1c9357c36ad2f 100644 --- a/llvm/test/DebugInfo/PDB/annotation.test +++ b/llvm/test/DebugInfo/PDB/annotation.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj < %s > %t.obj +# RUN: yaml2obj %s -o %t.obj # RUN: llvm-pdbutil dump --symbols %t.obj | FileCheck %s # RUN: llvm-readobj -codeview %t.obj | FileCheck %s --check-prefix=READOBJ diff --git a/llvm/test/DebugInfo/PDB/obj-globalhash.test b/llvm/test/DebugInfo/PDB/obj-globalhash.test index bf36b554abe9d3..06543ce1485e0b 100644 --- a/llvm/test/DebugInfo/PDB/obj-globalhash.test +++ b/llvm/test/DebugInfo/PDB/obj-globalhash.test @@ -1,5 +1,5 @@ -RUN: yaml2obj %p/Inputs/obj-hashes-1.yaml > %T/obj-hashes-1.obj -RUN: yaml2obj %p/Inputs/obj-hashes-2.yaml > %T/obj-hashes-2.obj +RUN: yaml2obj %p/Inputs/obj-hashes-1.yaml -o %T/obj-hashes-1.obj +RUN: yaml2obj %p/Inputs/obj-hashes-2.yaml -o %T/obj-hashes-2.obj RUN: echo obj-hashes-1 > %T/hashes-combined.out RUN: llvm-pdbutil dump -type-extras %T/obj-hashes-1.obj >> %T/hashes-combined.out RUN: echo obj-hashes-2 >> %T/hashes-combined.out diff --git a/llvm/test/DebugInfo/PDB/using-namespace.test b/llvm/test/DebugInfo/PDB/using-namespace.test index 92578e7eb1dea8..30681f47385c03 100644 --- a/llvm/test/DebugInfo/PDB/using-namespace.test +++ b/llvm/test/DebugInfo/PDB/using-namespace.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj < %s > %t.obj +# RUN: yaml2obj %s -o %t.obj # RUN: llvm-readobj --codeview %t.obj | FileCheck %s # CHECK: Kind: S_UNAMESPACE (0x1124) diff --git a/llvm/test/DebugInfo/invalid-relocations.test b/llvm/test/DebugInfo/invalid-relocations.test index 9ac4877c9dbba2..db5181f3793963 100644 --- a/llvm/test/DebugInfo/invalid-relocations.test +++ b/llvm/test/DebugInfo/invalid-relocations.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-dwarfdump %t.o 2>&1 | FileCheck %s # CHECK: failed to compute relocation: Unknown diff --git a/llvm/test/DebugInfo/precomp.test b/llvm/test/DebugInfo/precomp.test index eff184ef9d9208..0734f185a6f300 100644 --- a/llvm/test/DebugInfo/precomp.test +++ b/llvm/test/DebugInfo/precomp.test @@ -3,8 +3,8 @@ RUN: rm -rf %t1/ RUN: mkdir %t1 RUN: obj2yaml %S/Inputs/precomp-a.obj > %t1/precomp-a.yaml RUN: obj2yaml %S/Inputs/precomp.obj > %t1/precomp.yaml -RUN: yaml2obj %t1/precomp-a.yaml > %t1/a.obj -RUN: yaml2obj %t1/precomp.yaml > %t1/precomp.obj +RUN: yaml2obj %t1/precomp-a.yaml -o %t1/a.obj +RUN: yaml2obj %t1/precomp.yaml -o %t1/precomp.obj RUN: llvm-readobj --codeview %t1/a.obj | FileCheck %s -check-prefix PRECOMP RUN: llvm-readobj --codeview %t1/precomp.obj | FileCheck %s -check-prefix ENDPRECOMP RUN: llvm-pdbutil dump -types %t1/a.obj | FileCheck %s -check-prefix PDB-PRECOMP diff --git a/llvm/test/ExecutionEngine/OrcLazy/emulated-tls.ll b/llvm/test/ExecutionEngine/OrcLazy/emulated-tls.ll new file mode 100644 index 00000000000000..067052c0714ae0 --- /dev/null +++ b/llvm/test/ExecutionEngine/OrcLazy/emulated-tls.ll @@ -0,0 +1,23 @@ +; RUN: not lli -no-process-syms -emulated-tls -jit-kind=orc-lazy %s 2>&1 \ +; RUN: | FileCheck %s +; +; Test that emulated-tls does not generate any unexpected errors. +; +; Unfortunately we cannot test successful execution of JIT'd code with +; emulated-tls as this would require the JIT itself, in this case lli, to be +; built with emulated-tls, which is not a common configuration. Instead we test +; that the only error produced by the JIT for a thread-local with emulated-tls +; enabled is a missing symbol error for __emutls_get_address. An unresolved +; reference to this symbol (and only this symbol) implies (1) that the emulated +; tls lowering was applied, and (2) that thread locals defined in the JIT'd code +; were otherwise handled correctly. + +; CHECK: JIT session error: Symbols not found: [ {{[^,]*}}__emutls_get_address ] + +@x = thread_local global i32 42, align 4 + +define i32 @main(i32 %argc, i8** %argv) { +entry: + %0 = load i32, i32* @x, align 4 + ret i32 %0 +} diff --git a/llvm/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml b/llvm/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml index b8162bd3cd2a98..779c3708084479 100644 --- a/llvm/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml +++ b/llvm/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: obj2yaml %t | FileCheck %s # CHECK: - Name: .rela.text diff --git a/llvm/test/Object/AMDGPU/elf-header-flags-mach.yaml b/llvm/test/Object/AMDGPU/elf-header-flags-mach.yaml index 085241f6a8559e..7d2fd3b1fd0640 100644 --- a/llvm/test/Object/AMDGPU/elf-header-flags-mach.yaml +++ b/llvm/test/Object/AMDGPU/elf-header-flags-mach.yaml @@ -1,103 +1,103 @@ -# RUN: yaml2obj -docnum=1 %s > %t.o.1 +# RUN: yaml2obj --docnum=1 %s -o %t.o.1 # RUN: llvm-readobj -S --file-headers %t.o.1 | FileCheck --check-prefixes=ELF-ALL,ELF-R600 %s # RUN: obj2yaml %t.o.1 | FileCheck --check-prefixes=YAML-R600 %s -# RUN: yaml2obj -docnum=2 %s > %t.o.2 +# RUN: yaml2obj --docnum=2 %s -o %t.o.2 # RUN: llvm-readobj -S --file-headers %t.o.2 | FileCheck --check-prefixes=ELF-ALL,ELF-R630 %s # RUN: obj2yaml %t.o.2 | FileCheck --check-prefixes=YAML-R630 %s -# RUN: yaml2obj -docnum=3 %s > %t.o.3 +# RUN: yaml2obj --docnum=3 %s -o %t.o.3 # RUN: llvm-readobj -S --file-headers %t.o.3 | FileCheck --check-prefixes=ELF-ALL,ELF-RS880 %s # RUN: obj2yaml %t.o.3 | FileCheck --check-prefixes=YAML-RS880 %s -# RUN: yaml2obj -docnum=4 %s > %t.o.4 +# RUN: yaml2obj --docnum=4 %s -o %t.o.4 # RUN: llvm-readobj -S --file-headers %t.o.4 | FileCheck --check-prefixes=ELF-ALL,ELF-RV670 %s # RUN: obj2yaml %t.o.4 | FileCheck --check-prefixes=YAML-RV670 %s -# RUN: yaml2obj -docnum=5 %s > %t.o.5 +# RUN: yaml2obj --docnum=5 %s -o %t.o.5 # RUN: llvm-readobj -S --file-headers %t.o.5 | FileCheck --check-prefixes=ELF-ALL,ELF-RV710 %s # RUN: obj2yaml %t.o.5 | FileCheck --check-prefixes=YAML-RV710 %s -# RUN: yaml2obj -docnum=6 %s > %t.o.6 +# RUN: yaml2obj --docnum=6 %s -o %t.o.6 # RUN: llvm-readobj -S --file-headers %t.o.6 | FileCheck --check-prefixes=ELF-ALL,ELF-RV730 %s # RUN: obj2yaml %t.o.6 | FileCheck --check-prefixes=YAML-RV730 %s -# RUN: yaml2obj -docnum=7 %s > %t.o.7 +# RUN: yaml2obj --docnum=7 %s -o %t.o.7 # RUN: llvm-readobj -S --file-headers %t.o.7 | FileCheck --check-prefixes=ELF-ALL,ELF-RV770 %s # RUN: obj2yaml %t.o.7 | FileCheck --check-prefixes=YAML-RV770 %s -# RUN: yaml2obj -docnum=8 %s > %t.o.8 +# RUN: yaml2obj --docnum=8 %s -o %t.o.8 # RUN: llvm-readobj -S --file-headers %t.o.8 | FileCheck --check-prefixes=ELF-ALL,ELF-CEDAR %s # RUN: obj2yaml %t.o.8 | FileCheck --check-prefixes=YAML-CEDAR %s -# RUN: yaml2obj -docnum=9 %s > %t.o.9 +# RUN: yaml2obj --docnum=9 %s -o %t.o.9 # RUN: llvm-readobj -S --file-headers %t.o.9 | FileCheck --check-prefixes=ELF-ALL,ELF-CYPRESS %s # RUN: obj2yaml %t.o.9 | FileCheck --check-prefixes=YAML-CYPRESS %s -# RUN: yaml2obj -docnum=10 %s > %t.o.10 +# RUN: yaml2obj --docnum=10 %s -o %t.o.10 # RUN: llvm-readobj -S --file-headers %t.o.10 | FileCheck --check-prefixes=ELF-ALL,ELF-JUNIPER %s # RUN: obj2yaml %t.o.10 | FileCheck --check-prefixes=YAML-JUNIPER %s -# RUN: yaml2obj -docnum=11 %s > %t.o.11 +# RUN: yaml2obj --docnum=11 %s -o %t.o.11 # RUN: llvm-readobj -S --file-headers %t.o.11 | FileCheck --check-prefixes=ELF-ALL,ELF-REDWOOD %s # RUN: obj2yaml %t.o.11 | FileCheck --check-prefixes=YAML-REDWOOD %s -# RUN: yaml2obj -docnum=12 %s > %t.o.12 +# RUN: yaml2obj --docnum=12 %s -o %t.o.12 # RUN: llvm-readobj -S --file-headers %t.o.12 | FileCheck --check-prefixes=ELF-ALL,ELF-SUMO %s # RUN: obj2yaml %t.o.12 | FileCheck --check-prefixes=YAML-SUMO %s -# RUN: yaml2obj -docnum=13 %s > %t.o.13 +# RUN: yaml2obj --docnum=13 %s -o %t.o.13 # RUN: llvm-readobj -S --file-headers %t.o.13 | FileCheck --check-prefixes=ELF-ALL,ELF-BARTS %s # RUN: obj2yaml %t.o.13 | FileCheck --check-prefixes=YAML-BARTS %s -# RUN: yaml2obj -docnum=14 %s > %t.o.14 +# RUN: yaml2obj --docnum=14 %s -o %t.o.14 # RUN: llvm-readobj -S --file-headers %t.o.14 | FileCheck --check-prefixes=ELF-ALL,ELF-CAICOS %s # RUN: obj2yaml %t.o.14 | FileCheck --check-prefixes=YAML-CAICOS %s -# RUN: yaml2obj -docnum=15 %s > %t.o.15 +# RUN: yaml2obj --docnum=15 %s -o %t.o.15 # RUN: llvm-readobj -S --file-headers %t.o.15 | FileCheck --check-prefixes=ELF-ALL,ELF-CAYMAN %s # RUN: obj2yaml %t.o.15 | FileCheck --check-prefixes=YAML-CAYMAN %s -# RUN: yaml2obj -docnum=16 %s > %t.o.16 +# RUN: yaml2obj --docnum=16 %s -o %t.o.16 # RUN: llvm-readobj -S --file-headers %t.o.16 | FileCheck --check-prefixes=ELF-ALL,ELF-TURKS %s # RUN: obj2yaml %t.o.16 | FileCheck --check-prefixes=YAML-TURKS %s -# RUN: yaml2obj -docnum=17 %s > %t.o.17 +# RUN: yaml2obj --docnum=17 %s -o %t.o.17 # RUN: llvm-readobj -S --file-headers %t.o.17 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX600 %s # RUN: obj2yaml %t.o.17 | FileCheck --check-prefixes=YAML-GFX600 %s -# RUN: yaml2obj -docnum=18 %s > %t.o.18 +# RUN: yaml2obj --docnum=18 %s -o %t.o.18 # RUN: llvm-readobj -S --file-headers %t.o.18 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX601 %s # RUN: obj2yaml %t.o.18 | FileCheck --check-prefixes=YAML-GFX601 %s -# RUN: yaml2obj -docnum=19 %s > %t.o.19 +# RUN: yaml2obj --docnum=19 %s -o %t.o.19 # RUN: llvm-readobj -S --file-headers %t.o.19 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX700 %s # RUN: obj2yaml %t.o.19 | FileCheck --check-prefixes=YAML-GFX700 %s -# RUN: yaml2obj -docnum=20 %s > %t.o.20 +# RUN: yaml2obj --docnum=20 %s -o %t.o.20 # RUN: llvm-readobj -S --file-headers %t.o.20 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX701 %s # RUN: obj2yaml %t.o.20 | FileCheck --check-prefixes=YAML-GFX701 %s -# RUN: yaml2obj -docnum=21 %s > %t.o.21 +# RUN: yaml2obj --docnum=21 %s -o %t.o.21 # RUN: llvm-readobj -S --file-headers %t.o.21 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX702 %s # RUN: obj2yaml %t.o.21 | FileCheck --check-prefixes=YAML-GFX702 %s -# RUN: yaml2obj -docnum=22 %s > %t.o.22 +# RUN: yaml2obj --docnum=22 %s -o %t.o.22 # RUN: llvm-readobj -S --file-headers %t.o.22 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX703 %s # RUN: obj2yaml %t.o.22 | FileCheck --check-prefixes=YAML-GFX703 %s -# RUN: yaml2obj -docnum=23 %s > %t.o.23 +# RUN: yaml2obj --docnum=23 %s -o %t.o.23 # RUN: llvm-readobj -S --file-headers %t.o.23 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX704 %s # RUN: obj2yaml %t.o.23 | FileCheck --check-prefixes=YAML-GFX704 %s -# RUN: yaml2obj -docnum=24 %s > %t.o.24 +# RUN: yaml2obj --docnum=24 %s -o %t.o.24 # RUN: llvm-readobj -S --file-headers %t.o.24 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX801 %s # RUN: obj2yaml %t.o.24 | FileCheck --check-prefixes=YAML-GFX801 %s -# RUN: yaml2obj -docnum=25 %s > %t.o.25 +# RUN: yaml2obj --docnum=25 %s -o %t.o.25 # RUN: llvm-readobj -S --file-headers %t.o.25 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX802 %s # RUN: obj2yaml %t.o.25 | FileCheck --check-prefixes=YAML-GFX802 %s -# RUN: yaml2obj -docnum=26 %s > %t.o.26 +# RUN: yaml2obj --docnum=26 %s -o %t.o.26 # RUN: llvm-readobj -S --file-headers %t.o.26 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX803 %s # RUN: obj2yaml %t.o.26 | FileCheck --check-prefixes=YAML-GFX803 %s -# RUN: yaml2obj -docnum=27 %s > %t.o.27 +# RUN: yaml2obj --docnum=27 %s -o %t.o.27 # RUN: llvm-readobj -S --file-headers %t.o.27 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX810 %s # RUN: obj2yaml %t.o.27 | FileCheck --check-prefixes=YAML-GFX810 %s -# RUN: yaml2obj -docnum=28 %s > %t.o.28 +# RUN: yaml2obj --docnum=28 %s -o %t.o.28 # RUN: llvm-readobj -S --file-headers %t.o.28 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX900 %s # RUN: obj2yaml %t.o.28 | FileCheck --check-prefixes=YAML-GFX900 %s -# RUN: yaml2obj -docnum=29 %s > %t.o.29 +# RUN: yaml2obj --docnum=29 %s -o %t.o.29 # RUN: llvm-readobj -S --file-headers %t.o.29 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX902 %s # RUN: obj2yaml %t.o.29 | FileCheck --check-prefixes=YAML-GFX902 %s -# RUN: yaml2obj -docnum=30 %s > %t.o.30 +# RUN: yaml2obj --docnum=30 %s -o %t.o.30 # RUN: llvm-readobj -S --file-headers %t.o.30 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX904 %s # RUN: obj2yaml %t.o.30 | FileCheck --check-prefixes=YAML-GFX904 %s -# RUN: yaml2obj -docnum=31 %s > %t.o.31 +# RUN: yaml2obj --docnum=31 %s -o %t.o.31 # RUN: llvm-readobj -S --file-headers %t.o.31 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX906 %s # RUN: obj2yaml %t.o.31 | FileCheck --check-prefixes=YAML-GFX906 %s -# RUN: yaml2obj -docnum=32 %s > %t.o.32 +# RUN: yaml2obj --docnum=32 %s -o %t.o.32 # RUN: llvm-readobj -s -file-headers %t.o.32 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX908 %s # RUN: obj2yaml %t.o.32 | FileCheck --check-prefixes=YAML-GFX908 %s -# RUN: yaml2obj -docnum=33 %s > %t.o.33 +# RUN: yaml2obj --docnum=33 %s -o %t.o.33 # RUN: llvm-readobj -s -file-headers %t.o.33 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX909 %s # RUN: obj2yaml %t.o.33 | FileCheck --check-prefixes=YAML-GFX909 %s -# RUN: yaml2obj -docnum=34 %s > %t.o.34 +# RUN: yaml2obj --docnum=34 %s -o %t.o.34 # RUN: llvm-readobj -s -file-headers %t.o.34 | FileCheck --check-prefixes=ELF-ALL,ELF-GFX1010 %s # RUN: obj2yaml %t.o.34 | FileCheck --check-prefixes=YAML-GFX1010 %s diff --git a/llvm/test/Object/AMDGPU/elf-header-flags-sram-ecc.yaml b/llvm/test/Object/AMDGPU/elf-header-flags-sram-ecc.yaml index 6d105193f66a84..8d038b4932a3ae 100644 --- a/llvm/test/Object/AMDGPU/elf-header-flags-sram-ecc.yaml +++ b/llvm/test/Object/AMDGPU/elf-header-flags-sram-ecc.yaml @@ -1,10 +1,10 @@ -# RUN: yaml2obj -docnum=1 %s > %t.o.1 +# RUN: yaml2obj --docnum=1 %s -o %t.o.1 # RUN: llvm-readobj -S --file-headers %t.o.1 | FileCheck --check-prefixes=ELF-ALL,ELF-SRAM-ECC-NONE %s # RUN: obj2yaml %t.o.1 | FileCheck --check-prefixes=YAML-SRAM-ECC-NONE %s -# RUN: yaml2obj -docnum=2 %s > %t.o.2 +# RUN: yaml2obj --docnum=2 %s -o %t.o.2 # RUN: llvm-readobj -S --file-headers %t.o.2 | FileCheck --check-prefixes=ELF-ALL,ELF-SRAM-ECC-GFX900 %s # RUN: obj2yaml %t.o.2 | FileCheck --check-prefixes=YAML-SRAM-ECC-GFX900 %s -# RUN: yaml2obj -docnum=3 %s > %t.o.3 +# RUN: yaml2obj --docnum=3 %s -o %t.o.3 # RUN: llvm-readobj -S --file-headers %t.o.3 | FileCheck --check-prefixes=ELF-ALL,ELF-SRAM-ECC-XNACK-GFX900 %s # RUN: obj2yaml %t.o.3 | FileCheck --check-prefixes=YAML-SRAM-ECC-XNACK-GFX900 %s diff --git a/llvm/test/Object/AMDGPU/elf-header-flags-xnack.yaml b/llvm/test/Object/AMDGPU/elf-header-flags-xnack.yaml index c243164673711f..c0e32d84b7eb80 100644 --- a/llvm/test/Object/AMDGPU/elf-header-flags-xnack.yaml +++ b/llvm/test/Object/AMDGPU/elf-header-flags-xnack.yaml @@ -1,7 +1,7 @@ -# RUN: yaml2obj -docnum=1 %s > %t.o.1 +# RUN: yaml2obj --docnum=1 %s -o %t.o.1 # RUN: llvm-readobj -S --file-headers %t.o.1 | FileCheck --check-prefixes=ELF-ALL,ELF-XNACK-NONE %s # RUN: obj2yaml %t.o.1 | FileCheck --check-prefixes=YAML-XNACK-NONE %s -# RUN: yaml2obj -docnum=2 %s > %t.o.2 +# RUN: yaml2obj --docnum=2 %s -o %t.o.2 # RUN: llvm-readobj -S --file-headers %t.o.2 | FileCheck --check-prefixes=ELF-ALL,ELF-XNACK-GFX801 %s # RUN: obj2yaml %t.o.2 | FileCheck --check-prefixes=YAML-XNACK-GFX801 %s diff --git a/llvm/test/Object/AMDGPU/elf-header-osabi.yaml b/llvm/test/Object/AMDGPU/elf-header-osabi.yaml index b22c1976fc1110..9b22275e125362 100644 --- a/llvm/test/Object/AMDGPU/elf-header-osabi.yaml +++ b/llvm/test/Object/AMDGPU/elf-header-osabi.yaml @@ -1,10 +1,10 @@ -# RUN: yaml2obj -docnum=1 %s > %t.o.1 +# RUN: yaml2obj --docnum=1 %s -o %t.o.1 # RUN: llvm-readobj -S --file-headers %t.o.1 | FileCheck --check-prefixes=ELF-HSA %s # RUN: obj2yaml %t.o.1 | FileCheck --check-prefixes=YAML-HSA %s -# RUN: yaml2obj -docnum=2 %s > %t.o.2 +# RUN: yaml2obj --docnum=2 %s -o %t.o.2 # RUN: llvm-readobj -S --file-headers %t.o.2 | FileCheck --check-prefixes=ELF-PAL %s # RUN: obj2yaml %t.o.2 | FileCheck --check-prefixes=YAML-PAL %s -# RUN: yaml2obj -docnum=3 %s > %t.o.3 +# RUN: yaml2obj --docnum=3 %s -o %t.o.3 # RUN: llvm-readobj -S --file-headers %t.o.3 | FileCheck --check-prefixes=ELF-MESA3D %s # RUN: obj2yaml %t.o.3 | FileCheck --check-prefixes=YAML-MESA3D %s diff --git a/llvm/test/Object/AMDGPU/elf32-unknown.yaml b/llvm/test/Object/AMDGPU/elf32-unknown.yaml index 27283b895e76e0..4c43401499c479 100644 --- a/llvm/test/Object/AMDGPU/elf32-unknown.yaml +++ b/llvm/test/Object/AMDGPU/elf32-unknown.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-readobj -S --file-headers %t.o | FileCheck %s # CHECK: Format: ELF32-amdgpu diff --git a/llvm/test/Object/AMDGPU/elf64-relocs.yaml b/llvm/test/Object/AMDGPU/elf64-relocs.yaml index 0e6bc2fcfc4ce7..ad16e68a340251 100644 --- a/llvm/test/Object/AMDGPU/elf64-relocs.yaml +++ b/llvm/test/Object/AMDGPU/elf64-relocs.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-readobj -r %t | FileCheck %s # CHECK: Relocations [ diff --git a/llvm/test/Object/AMDGPU/elf64-unknown.yaml b/llvm/test/Object/AMDGPU/elf64-unknown.yaml index d54a50d1c85116..b991df62a555e6 100644 --- a/llvm/test/Object/AMDGPU/elf64-unknown.yaml +++ b/llvm/test/Object/AMDGPU/elf64-unknown.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-readobj -S --file-headers %t.o | FileCheck %s # CHECK: Format: ELF64-amdgpu diff --git a/llvm/test/Object/Lanai/yaml2obj-elf-lanai-rel.yaml b/llvm/test/Object/Lanai/yaml2obj-elf-lanai-rel.yaml index b5e6465a0e67aa..23f0b2f6ece9fd 100644 --- a/llvm/test/Object/Lanai/yaml2obj-elf-lanai-rel.yaml +++ b/llvm/test/Object/Lanai/yaml2obj-elf-lanai-rel.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-readobj -r %t | FileCheck %s # CHECK: Relocations [ diff --git a/llvm/test/Object/Mips/abi-flags.yaml b/llvm/test/Object/Mips/abi-flags.yaml index ce8234a9a0dbef..4fa09d179da04d 100644 --- a/llvm/test/Object/Mips/abi-flags.yaml +++ b/llvm/test/Object/Mips/abi-flags.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-readobj -A %t | FileCheck -check-prefix=OBJ %s # RUN: obj2yaml %t | FileCheck -check-prefix=YAML %s diff --git a/llvm/test/Object/Mips/elf-mips64-rel.yaml b/llvm/test/Object/Mips/elf-mips64-rel.yaml index 169978ac5b59ed..3ffdadafad5daf 100644 --- a/llvm/test/Object/Mips/elf-mips64-rel.yaml +++ b/llvm/test/Object/Mips/elf-mips64-rel.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-readobj -r %t | FileCheck -check-prefix=OBJ %s # RUN: obj2yaml %t | FileCheck -check-prefix=YAML %s diff --git a/llvm/test/Object/RISCV/elf-flags.yaml b/llvm/test/Object/RISCV/elf-flags.yaml index 24c8e6c26d6e52..2facec20f04188 100644 --- a/llvm/test/Object/RISCV/elf-flags.yaml +++ b/llvm/test/Object/RISCV/elf-flags.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-readobj --file-headers %t | FileCheck -check-prefix=OBJ %s # RUN: obj2yaml %t | FileCheck -check-prefix=YAML %s diff --git a/llvm/test/Object/X86/objdump-disassembly-inline-relocations.test b/llvm/test/Object/X86/objdump-disassembly-inline-relocations.test index b881aff9cfbb7c..e7ee2084b56d4b 100644 --- a/llvm/test/Object/X86/objdump-disassembly-inline-relocations.test +++ b/llvm/test/Object/X86/objdump-disassembly-inline-relocations.test @@ -69,7 +69,7 @@ # MACHO-x86-64: 23: 48 83 c4 08 addq $8, %rsp # MACHO-x86-64: 27: c3 ret -# RUN: yaml2obj -docnum=1 %s > %t.elf-i386 +# RUN: yaml2obj --docnum=1 %s -o %t.elf-i386 # RUN: llvm-objdump -d -r %t.elf-i386 | FileCheck %s -check-prefix ELF-i386 # ELF-i386: file format ELF32-i386 @@ -126,7 +126,7 @@ Symbols: - Name: puts Binding: STB_GLOBAL -# RUN: yaml2obj -docnum=2 %s > %t.elf-x86-64 +# RUN: yaml2obj --docnum=2 %s -o %t.elf-x86-64 # RUN: llvm-objdump -d -r %t.elf-x86-64 | FileCheck %s -check-prefix ELF-x86-64 --- !ELF diff --git a/llvm/test/Object/X86/objdump-trivial-object.test b/llvm/test/Object/X86/objdump-trivial-object.test index 3071db16e56105..b70b6a2de51697 100644 --- a/llvm/test/Object/X86/objdump-trivial-object.test +++ b/llvm/test/Object/X86/objdump-trivial-object.test @@ -26,7 +26,7 @@ # COFF-x86-64: 21: 48 83 c4 28 addq $40, %rsp # COFF-x86-64: 25: c3 ret -# RUN: yaml2obj -docnum=1 %s > %t.elf-i386 +# RUN: yaml2obj --docnum=1 %s -o %t.elf-i386 # RUN: llvm-objdump -d %t.elf-i386 | FileCheck %s -check-prefix ELF-i386 # ELF-i386: file format ELF32-i386 @@ -52,7 +52,7 @@ Sections: Flags: [ SHF_ALLOC, SHF_EXECINSTR ] Content: 83EC0CC744240800000000C7042400000000E8FCFFFFFFE8FCFFFFFF8B44240883C40CC3 -# RUN: yaml2obj -docnum=2 %s > %t.elf-x86-64 +# RUN: yaml2obj --docnum=2 %s -o %t.elf-x86-64 # RUN: llvm-objdump -d %t.elf-x86-64 | FileCheck %s -check-prefix ELF-x86-64 # ELF-x86-64: file format ELF64-x86-64 diff --git a/llvm/test/Object/X86/yaml-elf-x86-rel-broken.yaml b/llvm/test/Object/X86/yaml-elf-x86-rel-broken.yaml index 05572675d1c2e7..7121a2886394db 100644 --- a/llvm/test/Object/X86/yaml-elf-x86-rel-broken.yaml +++ b/llvm/test/Object/X86/yaml-elf-x86-rel-broken.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: obj2yaml %t | FileCheck %s # CHECK: Relocations: diff --git a/llvm/test/Object/X86/yaml2obj-elf-x86-rel.yaml b/llvm/test/Object/X86/yaml2obj-elf-x86-rel.yaml index d0e69305081fb2..fcc285b7c3cd60 100644 --- a/llvm/test/Object/X86/yaml2obj-elf-x86-rel.yaml +++ b/llvm/test/Object/X86/yaml2obj-elf-x86-rel.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-readobj -r %t | FileCheck %s # CHECK: Relocations [ diff --git a/llvm/test/Object/archive-format.test b/llvm/test/Object/archive-format.test index 77e7a5de009f8a..fd9f0ae967bd17 100644 --- a/llvm/test/Object/archive-format.test +++ b/llvm/test/Object/archive-format.test @@ -83,7 +83,7 @@ tools on some versions of Solaris will abort operations if there is no symbol table. Create such an object, put it into an archive, and check to see that there is an empty symbol table. RUN: mkdir -p %t -RUN: yaml2obj %S/Inputs/solaris-nosymbols.yaml > %t/foo.o +RUN: yaml2obj %S/Inputs/solaris-nosymbols.yaml -o %t/foo.o RUN: llvm-ar rs %t/foo.a %t/foo.o RUN: cat -v %t/foo.a | FileCheck -strict-whitespace --check-prefix=SOLARIS %s SOLARIS: ! diff --git a/llvm/test/Object/archive-symtab.test b/llvm/test/Object/archive-symtab.test index 813801decfd130..d77244a0e7a879 100644 --- a/llvm/test/Object/archive-symtab.test +++ b/llvm/test/Object/archive-symtab.test @@ -1,5 +1,5 @@ -# RUN: yaml2obj -docnum=1 %s > %t.elf-x86-64 -# RUN: yaml2obj -docnum=2 %s > %t2.elf-x86-64 +# RUN: yaml2obj --docnum=1 %s -o %t.elf-x86-64 +# RUN: yaml2obj --docnum=2 %s -o %t2.elf-x86-64 --- !ELF FileHeader: diff --git a/llvm/test/Object/nm-error.test b/llvm/test/Object/nm-error.test index 9b66e10ebeb1e6..dfcaae98ddea25 100644 --- a/llvm/test/Object/nm-error.test +++ b/llvm/test/Object/nm-error.test @@ -1,7 +1,7 @@ ## Test that llvm-nm returns an error because of the unknown file type, but ## keeps processing subsequent files. -# RUN: yaml2obj %s > %t-i386 +# RUN: yaml2obj %s -o %t-i386 # RUN: touch %t # RUN: not llvm-nm %t-i386 %t %t-i386 | FileCheck %s diff --git a/llvm/test/Object/nm-shared-object.test b/llvm/test/Object/nm-shared-object.test index 914c8dc2326406..a9eb379985e410 100644 --- a/llvm/test/Object/nm-shared-object.test +++ b/llvm/test/Object/nm-shared-object.test @@ -34,7 +34,7 @@ # ERROR: File format has no dynamic symbol table. -# RUN: yaml2obj %s > %t.elf-i386 +# RUN: yaml2obj %s -o %t.elf-i386 # RUN: llvm-nm -D %t.elf-i386 2>&1 | FileCheck %s -check-prefix=NO-SYMBOLS # NO-SYMBOLS: no symbols diff --git a/llvm/test/Object/nm-trivial-object.test b/llvm/test/Object/nm-trivial-object.test index 55ffd24aef6bc2..873e516cfbf04e 100644 --- a/llvm/test/Object/nm-trivial-object.test +++ b/llvm/test/Object/nm-trivial-object.test @@ -29,7 +29,7 @@ # WASM-NEXT: U puts # WASM-NEXT: 00000010 D var -# RUN: yaml2obj -docnum=1 %s > %t.elf-i386 +# RUN: yaml2obj --docnum=1 %s -o %t.elf-i386 --- !ELF FileHeader: @@ -79,7 +79,7 @@ Symbols: ## Test different ELF symbols for 64-bit platform. -# RUN: yaml2obj -docnum=2 %s > %t.elf-x86-64 +# RUN: yaml2obj --docnum=2 %s -o %t.elf-x86-64 # RUN: llvm-nm %t.elf-x86-64 | FileCheck %s -check-prefix ELF64 # ELF64: U SomeOtherFunction @@ -157,7 +157,7 @@ Symbols: ## Test llvm-nm shows all symbols with -a. -# RUN: yaml2obj -docnum=3 %s > %t-a.elf-x86-64 +# RUN: yaml2obj --docnum=3 %s -o %t-a.elf-x86-64 # RUN: llvm-nm -a %t-a.elf-x86-64 | FileCheck %s -check-prefix ELF64-a # ELF64-a: 00000000 b .bss @@ -221,7 +221,7 @@ Symbols: ## Test that we drop the thumb bit only from function addresses. -# RUN: yaml2obj -docnum=4 %s > %t.elf-arm32 +# RUN: yaml2obj --docnum=4 %s -o %t.elf-arm32 # RUN: llvm-nm %t.elf-arm32 | FileCheck %s -check-prefix ELF-THUMB # ELF-THUMB: 00000000 t func diff --git a/llvm/test/Object/obj2yaml.test b/llvm/test/Object/obj2yaml.test index badc604239a145..a2b26a24b988fb 100644 --- a/llvm/test/Object/obj2yaml.test +++ b/llvm/test/Object/obj2yaml.test @@ -524,7 +524,7 @@ # ELF-MIPS64EL-NEXT: - Name: zed # ELF-MIPS64EL-NEXT: Binding: STB_GLOBAL -# RUN: yaml2obj %s > %t-x86-64 +# RUN: yaml2obj %s -o %t-x86-64 # RUN: obj2yaml %t-x86-64 | FileCheck %s --check-prefix ELF-X86-64 # ELF-X86-64: FileHeader: diff --git a/llvm/test/Object/objdump-relocations.test b/llvm/test/Object/objdump-relocations.test index 5f8fbcc8fc0500..bd8cd65634a853 100644 --- a/llvm/test/Object/objdump-relocations.test +++ b/llvm/test/Object/objdump-relocations.test @@ -3,7 +3,7 @@ # RUN: llvm-objdump -r %p/Inputs/trivial-object-test.coff-x86-64 \ # RUN: | FileCheck %s -check-prefix COFF-x86-64 -# RUN: yaml2obj -docnum=1 %s > %t-i386 +# RUN: yaml2obj --docnum=1 %s -o %t-i386 # RUN: llvm-objdump -r %t-i386 | FileCheck %s -check-prefix ELF-i386 # ELF-i386: .text @@ -39,7 +39,7 @@ Symbols: - Name: symbol Binding: STB_GLOBAL -# RUN: yaml2obj -docnum=2 %s > %t-x86-64 +# RUN: yaml2obj --docnum=2 %s -o %t-x86-64 # RUN: llvm-objdump -r %t-x86-64 | FileCheck %s -check-prefix ELF-x86-64 # ELF-x86-64: .text diff --git a/llvm/test/Object/objdump-section-content.test b/llvm/test/Object/objdump-section-content.test index 877fd9651c7d7c..53ef60928b38ab 100644 --- a/llvm/test/Object/objdump-section-content.test +++ b/llvm/test/Object/objdump-section-content.test @@ -8,7 +8,7 @@ # COFF-i386: Contents of section .data: # COFF-i386: 0000 48656c6c 6f20576f 726c6421 00 Hello World!. -# RUN: yaml2obj %s > %t.elf-i386 +# RUN: yaml2obj %s -o %t.elf-i386 # RUN: llvm-objdump -s %t.elf-i386 | FileCheck %s -DFILE=%t.elf-i386 -check-prefix ELF-i386 # ELF-i386: [[FILE]]: file format diff --git a/llvm/test/Object/objdump-sectionheaders.test b/llvm/test/Object/objdump-sectionheaders.test index aab3f54d7dbf60..320db8710fcf8b 100644 --- a/llvm/test/Object/objdump-sectionheaders.test +++ b/llvm/test/Object/objdump-sectionheaders.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.elf-x86-64 +# RUN: yaml2obj %s -o %t.elf-x86-64 # RUN: llvm-objdump -h %t.elf-x86-64 | FileCheck %s # To verify this, use readelf -S, not objdump -h. Binutils objdump filters the diff --git a/llvm/test/Object/objdump-symbol-table.test b/llvm/test/Object/objdump-symbol-table.test index 9c8a6b7ec1dc21..bfd46cd63fbe39 100644 --- a/llvm/test/Object/objdump-symbol-table.test +++ b/llvm/test/Object/objdump-symbol-table.test @@ -12,7 +12,7 @@ # COFF-i386: [ 6](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _puts # COFF-i386: [ 7](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _SomeOtherFunction -# RUN: yaml2obj %s > %t.elf-i386 +# RUN: yaml2obj %s -o %t.elf-i386 # RUN: llvm-objdump -t %t.elf-i386 | FileCheck %s -check-prefix ELF-i386 # ELF-i386: {{.*}}elf-i386: file format diff --git a/llvm/test/Object/readobj-absent.test b/llvm/test/Object/readobj-absent.test index 40175e710a9947..119ef82b27f581 100644 --- a/llvm/test/Object/readobj-absent.test +++ b/llvm/test/Object/readobj-absent.test @@ -1,5 +1,5 @@ ## Don't crash if required information is absent -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-readobj --dyn-syms %t --- !ELF diff --git a/llvm/test/Object/wasm-invalid-file.yaml b/llvm/test/Object/wasm-invalid-file.yaml index e562dfaa815e82..5ea192d66177ec 100644 --- a/llvm/test/Object/wasm-invalid-file.yaml +++ b/llvm/test/Object/wasm-invalid-file.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.wasm +# RUN: yaml2obj %s -o %t.wasm # RUN: echo -e -n "\x01" >> %t.wasm # Append a new section but truncate the encoding of the section size # RUN: not llvm-objdump -h %t.wasm 2>&1 | FileCheck %s -check-prefix=CHECK-LEB-DECODE @@ -15,7 +15,7 @@ FileHeader: # CHECK-SECTION-SIZE: '{{.*}}.wasm': Section too large -# RUN: yaml2obj %s > %t.wasm +# RUN: yaml2obj %s -o %t.wasm # # Append an section with invalid type (type 0x20, size 0x1, content 0x0) # RUN: echo -e -n "\x20\x01\x00" >> %t.wasm # RUN: not llvm-objdump -h %t.wasm 2>&1 | FileCheck %s -check-prefix=CHECK-SECTION-TYPE diff --git a/llvm/test/ObjectYAML/CodeView/sections.yaml b/llvm/test/ObjectYAML/CodeView/sections.yaml index 5d0ced016651c9..9d13e62f9e4f4c 100644 --- a/llvm/test/ObjectYAML/CodeView/sections.yaml +++ b/llvm/test/ObjectYAML/CodeView/sections.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.obj +# RUN: yaml2obj %s -o %t.obj # RUN: obj2yaml %t.obj | FileCheck --check-prefix=CHECK %s # RUN: llvm-objdump -section-headers %t.obj | FileCheck --check-prefix=HEADERS %s diff --git a/llvm/test/ObjectYAML/MachO/section_data.yaml b/llvm/test/ObjectYAML/MachO/section_data.yaml index 25fd04ae855271..87c5bc803ee1a2 100644 --- a/llvm/test/ObjectYAML/MachO/section_data.yaml +++ b/llvm/test/ObjectYAML/MachO/section_data.yaml @@ -42,7 +42,7 @@ LoadCommands: content: CDAB3412 ## Case 2: The content size equals the section size. -# RUN: yaml2obj --docnum=2 %s > %t2 +# RUN: yaml2obj --docnum=2 %s -o %t2 # RUN: llvm-readobj --sections --section-data %t2 | FileCheck %s --check-prefix=CASE2 # CASE2: Index: 0 # CASE2-NEXT: Name: __data (5F 5F 64 61 74 61 00 00 00 00 00 00 00 00 00 00) @@ -102,7 +102,7 @@ LoadCommands: ## Case 3: The content size is less than the section size. In this case, the area ## after the custom content is filled with zeroes. -# RUN: yaml2obj --docnum=3 %s > %t3 +# RUN: yaml2obj --docnum=3 %s -o %t3 # RUN: llvm-readobj --sections --section-data %t3 | FileCheck %s --check-prefix=CASE3 # CASE3: Index: 0 # CASE3-NEXT: Name: __data (5F 5F 64 61 74 61 00 00 00 00 00 00 00 00 00 00) diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/2008-07-02-array-indexing.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/2008-07-02-array-indexing.ll index bde1ce855deee2..8742c4fa46a0b3 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/2008-07-02-array-indexing.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/2008-07-02-array-indexing.ll @@ -6,9 +6,9 @@ ; because there is a load of %A in the entry block define internal i32 @callee(i1 %C, i32* %A) { ; CHECK-LABEL: define {{[^@]+}}@callee -; CHECK-SAME: (i1 [[C:%.*]], i32* noalias nocapture nofree nonnull readonly dereferenceable(4) [[A:%.*]]) +; CHECK-SAME: (i1 [[C:%.*]], i32* noalias nocapture nofree nonnull readonly align 536870912 dereferenceable(4) [[A:%.*]]) ; CHECK-NEXT: entry: -; CHECK-NEXT: [[A_0:%.*]] = load i32, i32* null +; CHECK-NEXT: [[A_0:%.*]] = load i32, i32* null, align 536870912 ; CHECK-NEXT: br label [[F:%.*]] ; CHECK: T: ; CHECK-NEXT: unreachable @@ -34,7 +34,7 @@ F: define i32 @foo() { ; CHECK-LABEL: define {{[^@]+}}@foo() -; CHECK-NEXT: [[X:%.*]] = call i32 @callee(i1 false, i32* noalias nofree readonly null) +; CHECK-NEXT: [[X:%.*]] = call i32 @callee(i1 false, i32* noalias nofree readonly align 536870912 null) ; CHECK-NEXT: ret i32 [[X]] ; %X = call i32 @callee(i1 false, i32* null) ; [#uses=1] diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll b/llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll index b6b5e19680d7df..2aa6e61eea7890 100644 --- a/llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll +++ b/llvm/test/Transforms/Attributor/IPConstantProp/pthreads.ll @@ -33,10 +33,10 @@ define dso_local i32 @main() { ; CHECK-NEXT: [[ALLOC1:%.*]] = alloca i8, align 8 ; CHECK-NEXT: [[ALLOC2:%.*]] = alloca i8, align 8 ; CHECK-NEXT: [[THREAD:%.*]] = alloca i64, align 8 -; CHECK-NEXT: [[CALL:%.*]] = call i32 @pthread_create(i64* nonnull align 8 dereferenceable(8) [[THREAD]], %union.pthread_attr_t* noalias null, i8* (i8*)* nonnull @foo, i8* noalias nofree readnone null) -; CHECK-NEXT: [[CALL1:%.*]] = call i32 @pthread_create(i64* nonnull align 8 dereferenceable(8) [[THREAD]], %union.pthread_attr_t* noalias null, i8* (i8*)* nonnull @bar, i8* nofree nonnull readnone align 8 dereferenceable(8) bitcast (i8** @GlobalVPtr to i8*)) -; CHECK-NEXT: [[CALL2:%.*]] = call i32 @pthread_create(i64* nonnull align 8 dereferenceable(8) [[THREAD]], %union.pthread_attr_t* noalias null, i8* (i8*)* nonnull @baz, i8* noalias nocapture nofree nonnull readnone align 8 dereferenceable(1) [[ALLOC1]]) -; CHECK-NEXT: [[CALL3:%.*]] = call i32 @pthread_create(i64* nonnull align 8 dereferenceable(8) [[THREAD]], %union.pthread_attr_t* noalias null, i8* (i8*)* nonnull @buz, i8* nofree nonnull readnone align 8 dereferenceable(1) [[ALLOC2]]) +; CHECK-NEXT: [[CALL:%.*]] = call i32 @pthread_create(i64* nonnull align 8 dereferenceable(8) [[THREAD]], %union.pthread_attr_t* noalias align 536870912 null, i8* (i8*)* nonnull @foo, i8* noalias nofree readnone align 536870912 null) +; CHECK-NEXT: [[CALL1:%.*]] = call i32 @pthread_create(i64* nonnull align 8 dereferenceable(8) [[THREAD]], %union.pthread_attr_t* noalias align 536870912 null, i8* (i8*)* nonnull @bar, i8* nofree nonnull readnone align 8 dereferenceable(8) bitcast (i8** @GlobalVPtr to i8*)) +; CHECK-NEXT: [[CALL2:%.*]] = call i32 @pthread_create(i64* nonnull align 8 dereferenceable(8) [[THREAD]], %union.pthread_attr_t* noalias align 536870912 null, i8* (i8*)* nonnull @baz, i8* noalias nocapture nofree nonnull readnone align 8 dereferenceable(1) [[ALLOC1]]) +; CHECK-NEXT: [[CALL3:%.*]] = call i32 @pthread_create(i64* nonnull align 8 dereferenceable(8) [[THREAD]], %union.pthread_attr_t* noalias align 536870912 null, i8* (i8*)* nonnull @buz, i8* nofree nonnull readnone align 8 dereferenceable(1) [[ALLOC2]]) ; CHECK-NEXT: ret i32 0 ; entry: @@ -54,7 +54,7 @@ declare !callback !0 dso_local i32 @pthread_create(i64*, %union.pthread_attr_t*, define internal i8* @foo(i8* %arg) { ; CHECK-LABEL: define {{[^@]+}}@foo -; CHECK-SAME: (i8* noalias nofree readnone returned [[ARG:%.*]]) +; CHECK-SAME: (i8* noalias nofree readnone returned align 536870912 [[ARG:%.*]]) ; CHECK-NEXT: entry: ; CHECK-NEXT: ret i8* null ; diff --git a/llvm/test/Transforms/Attributor/align.ll b/llvm/test/Transforms/Attributor/align.ll index f01ae28431d6c5..e47141ca16a607 100644 --- a/llvm/test/Transforms/Attributor/align.ll +++ b/llvm/test/Transforms/Attributor/align.ll @@ -398,6 +398,99 @@ define void @test12-6(i32* align 4 %p) { ret void } +define void @test13(i1 %c, i32* align 32 %dst) #0 { +; ATTRIBUTOR-LABEL: define {{[^@]+}}@test13 +; ATTRIBUTOR-SAME: (i1 [[C:%.*]], i32* nocapture nofree writeonly align 32 [[DST:%.*]]) +; ATTRIBUTOR-NEXT: br i1 [[C]], label [[TRUEBB:%.*]], label [[FALSEBB:%.*]] +; ATTRIBUTOR: truebb: +; ATTRIBUTOR-NEXT: br label [[END:%.*]] +; ATTRIBUTOR: falsebb: +; ATTRIBUTOR-NEXT: br label [[END]] +; ATTRIBUTOR: end: +; ATTRIBUTOR-NEXT: [[PTR:%.*]] = phi i32* [ [[DST]], [[TRUEBB]] ], [ null, [[FALSEBB]] ] +; ATTRIBUTOR-NEXT: store i32 0, i32* [[PTR]], align 32 +; ATTRIBUTOR-NEXT: ret void +; + br i1 %c, label %truebb, label %falsebb +truebb: + br label %end +falsebb: + br label %end +end: + %ptr = phi i32* [ %dst, %truebb ], [ null, %falsebb ] + store i32 0, i32* %ptr + ret void +} + +define void @test13-1(i1 %c, i32* align 32 %dst) { +; ATTRIBUTOR-LABEL: @test13-1( +; ATTRIBUTOR-NEXT: br i1 [[C:%.*]], label [[TRUEBB:%.*]], label [[FALSEBB:%.*]] +; ATTRIBUTOR: truebb: +; ATTRIBUTOR-NEXT: br label [[END:%.*]] +; ATTRIBUTOR: falsebb: +; ATTRIBUTOR-NEXT: br label [[END]] +; ATTRIBUTOR: end: +; ATTRIBUTOR-NEXT: [[PTR:%.*]] = phi i32* [ [[DST:%.*]], [[TRUEBB]] ], [ inttoptr (i64 48 to i32*), [[FALSEBB]] ] +; ATTRIBUTOR-NEXT: store i32 0, i32* [[PTR]], align 16 +; ATTRIBUTOR-NEXT: ret void +; + br i1 %c, label %truebb, label %falsebb +truebb: + br label %end +falsebb: + br label %end +end: + %ptr = phi i32* [ %dst, %truebb ], [ inttoptr (i64 48 to i32*), %falsebb ] + store i32 0, i32* %ptr + ret void +} + +define void @test13-2(i1 %c, i32* align 32 %dst) { +; ATTRIBUTOR-LABEL: @test13-2( +; ATTRIBUTOR-NEXT: br i1 [[C:%.*]], label [[TRUEBB:%.*]], label [[FALSEBB:%.*]] +; ATTRIBUTOR: truebb: +; ATTRIBUTOR-NEXT: br label [[END:%.*]] +; ATTRIBUTOR: falsebb: +; ATTRIBUTOR-NEXT: br label [[END]] +; ATTRIBUTOR: end: +; ATTRIBUTOR-NEXT: [[PTR:%.*]] = phi i32* [ [[DST:%.*]], [[TRUEBB]] ], [ inttoptr (i64 160 to i32*), [[FALSEBB]] ] +; ATTRIBUTOR-NEXT: store i32 0, i32* [[PTR]], align 32 +; ATTRIBUTOR-NEXT: ret void +; + br i1 %c, label %truebb, label %falsebb +truebb: + br label %end +falsebb: + br label %end +end: + %ptr = phi i32* [ %dst, %truebb ], [ inttoptr (i64 160 to i32*), %falsebb ] + store i32 0, i32* %ptr + ret void +} + +define void @test13-3(i1 %c, i32* align 32 %dst) { +; ATTRIBUTOR-LABEL: @test13-3( +; ATTRIBUTOR-NEXT: br i1 [[C:%.*]], label [[TRUEBB:%.*]], label [[FALSEBB:%.*]] +; ATTRIBUTOR: truebb: +; ATTRIBUTOR-NEXT: br label [[END:%.*]] +; ATTRIBUTOR: falsebb: +; ATTRIBUTOR-NEXT: br label [[END]] +; ATTRIBUTOR: end: +; ATTRIBUTOR-NEXT: [[PTR:%.*]] = phi i32* [ [[DST:%.*]], [[TRUEBB]] ], [ inttoptr (i64 128 to i32*), [[FALSEBB]] ] +; ATTRIBUTOR-NEXT: store i32 0, i32* [[PTR]], align 32 +; ATTRIBUTOR-NEXT: ret void +; + br i1 %c, label %truebb, label %falsebb +truebb: + br label %end +falsebb: + br label %end +end: + %ptr = phi i32* [ %dst, %truebb ], [ inttoptr (i64 128 to i32*), %falsebb ] + store i32 0, i32* %ptr + ret void +} + ; Don't crash on ptr2int/int2ptr uses. define i64 @ptr2int(i32* %p) { %p2i = ptrtoint i32* %p to i64 @@ -410,3 +503,4 @@ define i64* @int2ptr(i64 %i) { attributes #0 = { nounwind uwtable noinline } attributes #1 = { uwtable noinline } +attributes #2 = { "null-pointer-is-valid"="true" } diff --git a/llvm/test/Transforms/Attributor/callbacks.ll b/llvm/test/Transforms/Attributor/callbacks.ll index 74c870c7e57941..d4487393ddb64d 100644 --- a/llvm/test/Transforms/Attributor/callbacks.ll +++ b/llvm/test/Transforms/Attributor/callbacks.ll @@ -1,4 +1,4 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes ; FIXME: Add -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations below. ; This flag was removed because max iterations is 2 in most cases, but in windows it is 1. ; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-annotate-decl-cs < %s | FileCheck %s @@ -15,7 +15,8 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16 ; transfer in both directions. define void @t0_caller(i32* %a) { -; CHECK-LABEL: @t0_caller( +; CHECK-LABEL: define {{[^@]+}}@t0_caller +; CHECK-SAME: (i32* align 256 [[A:%.*]]) ; CHECK-NEXT: entry: ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 32 ; CHECK-NEXT: [[C:%.*]] = alloca i32*, align 64 @@ -23,10 +24,10 @@ define void @t0_caller(i32* %a) { ; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[B]] to i8* ; CHECK-NEXT: store i32 42, i32* [[B]], align 32 ; CHECK-NEXT: store i32* [[B]], i32** [[C]], align 64 -; CHECK-NEXT: call void (i32*, i32*, void (i32*, i32*, ...)*, ...) @t0_callback_broker(i32* noalias null, i32* nonnull align 128 dereferenceable(4) [[PTR]], void (i32*, i32*, ...)* nonnull bitcast (void (i32*, i32*, i32*, i64, i32**)* @t0_callback_callee to void (i32*, i32*, ...)*), i32* align 256 [[A:%.*]], i64 99, i32** noalias nocapture nonnull readonly align 64 dereferenceable(8) [[C]]) - +; CHECK-NEXT: call void (i32*, i32*, void (i32*, i32*, ...)*, ...) @t0_callback_broker(i32* noalias align 536870912 null, i32* nonnull align 128 dereferenceable(4) [[PTR]], void (i32*, i32*, ...)* nonnull bitcast (void (i32*, i32*, i32*, i64, i32**)* @t0_callback_callee to void (i32*, i32*, ...)*), i32* align 256 [[A]], i64 99, i32** noalias nocapture nonnull readonly align 64 dereferenceable(8) [[C]]) ; CHECK-NEXT: ret void ; + entry: %b = alloca i32, align 32 %c = alloca i32*, align 64 @@ -44,10 +45,10 @@ define internal void @t0_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a, ; CHECK-LABEL: define {{[^@]+}}@t0_callback_callee ; CHECK-SAME: (i32* nocapture nonnull writeonly dereferenceable(4) [[IS_NOT_NULL:%.*]], i32* nocapture nonnull readonly align 8 dereferenceable(4) [[PTR:%.*]], i32* align 256 [[A:%.*]], i64 [[B:%.*]], i32** noalias nocapture nonnull readonly align 64 dereferenceable(8) [[C:%.*]]) ; CHECK-NEXT: entry: -; CHECK-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR:%.*]], align 8 -; CHECK-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL:%.*]] -; CHECK-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C:%.*]], align 64 -; CHECK-NEXT: tail call void @t0_check(i32* align 256 [[A:%.*]], i64 99, i32* [[TMP0]]) +; CHECK-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8 +; CHECK-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]] +; CHECK-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64 +; CHECK-NEXT: tail call void @t0_check(i32* align 256 [[A]], i64 99, i32* [[TMP0]]) ; CHECK-NEXT: ret void ; entry: diff --git a/llvm/test/Transforms/Attributor/nocapture-1.ll b/llvm/test/Transforms/Attributor/nocapture-1.ll index 34bdb1c83f5a00..135e916cf372b3 100644 --- a/llvm/test/Transforms/Attributor/nocapture-1.ll +++ b/llvm/test/Transforms/Attributor/nocapture-1.ll @@ -322,7 +322,7 @@ declare void @unknown(i8*) define void @test_callsite() { entry: ; We know that 'null' in AS 0 does not alias anything and cannot be captured. Though the latter is not qurried -> derived atm. -; ATTRIBUTOR: call void @unknown(i8* noalias null) +; ATTRIBUTOR: call void @unknown(i8* noalias align 536870912 null) call void @unknown(i8* null) ret void } diff --git a/llvm/test/Transforms/Attributor/nonnull.ll b/llvm/test/Transforms/Attributor/nonnull.ll index 519d48bd757982..bf366708c61a18 100644 --- a/llvm/test/Transforms/Attributor/nonnull.ll +++ b/llvm/test/Transforms/Attributor/nonnull.ll @@ -23,7 +23,7 @@ define i8* @test2(i8* nonnull %p) { ; Given an SCC where one of the functions can not be marked nonnull, ; can we still mark the other one which is trivially nonnull define i8* @scc_binder(i1 %c) { -; ATTRIBUTOR: define noalias i8* @scc_binder +; ATTRIBUTOR: define noalias align 536870912 i8* @scc_binder br i1 %c, label %rec, label %end rec: call i8* @test3(i1 %c) @@ -57,7 +57,7 @@ define i8* @test4() { ; Given a mutual recursive set of functions which *can* return null ; make sure we haven't marked them as nonnull. define i8* @test5_helper(i1 %c) { -; ATTRIBUTOR: define noalias i8* @test5_helper +; ATTRIBUTOR: define noalias align 536870912 i8* @test5_helper br i1 %c, label %rec, label %end rec: %ret = call i8* @test5(i1 %c) @@ -67,7 +67,7 @@ end: } define i8* @test5(i1 %c) { -; ATTRIBUTOR: define noalias i8* @test5 +; ATTRIBUTOR: define noalias align 536870912 i8* @test5 %ret = call i8* @test5_helper(i1 %c) ret i8* %ret } @@ -525,7 +525,7 @@ define i32 addrspace(3)* @as(i32 addrspace(3)* dereferenceable(4) %p) { ret i32 addrspace(3)* %p } -; ATTRIBUTOR: define internal nonnull i32* @g2() +; ATTRIBUTOR: define internal nonnull align 4 i32* @g2() define internal i32* @g2() { ret i32* inttoptr (i64 4 to i32*) } diff --git a/llvm/test/Transforms/Attributor/value-simplify.ll b/llvm/test/Transforms/Attributor/value-simplify.ll index 05d4a50af82e25..046521a7cd9b89 100644 --- a/llvm/test/Transforms/Attributor/value-simplify.ll +++ b/llvm/test/Transforms/Attributor/value-simplify.ll @@ -194,14 +194,14 @@ define i32 @ipccp3() { %struct.X = type { i8* } define internal i32* @test_inalloca(i32* inalloca %a) { ; CHECK-LABEL: define {{[^@]+}}@test_inalloca -; CHECK-SAME: (i32* inalloca noalias nofree returned writeonly [[A:%.*]]) +; CHECK-SAME: (i32* inalloca noalias nofree returned writeonly align 536870912 [[A:%.*]]) ; CHECK-NEXT: ret i32* [[A]] ; ret i32* %a } define i32* @complicated_args_inalloca() { ; CHECK-LABEL: define {{[^@]+}}@complicated_args_inalloca() -; CHECK-NEXT: [[CALL:%.*]] = call i32* @test_inalloca(i32* noalias nofree writeonly null) +; CHECK-NEXT: [[CALL:%.*]] = call i32* @test_inalloca(i32* noalias nofree writeonly align 536870912 null) ; CHECK-NEXT: ret i32* [[CALL]] ; %call = call i32* @test_inalloca(i32* null) @@ -210,7 +210,7 @@ define i32* @complicated_args_inalloca() { define internal void @test_sret(%struct.X* sret %a, %struct.X** %b) { ; CHECK-LABEL: define {{[^@]+}}@test_sret -; CHECK-SAME: (%struct.X* nofree sret writeonly [[A:%.*]], %struct.X** nocapture nofree nonnull writeonly dereferenceable(8) [[B:%.*]]) +; CHECK-SAME: (%struct.X* nofree sret writeonly align 536870912 [[A:%.*]], %struct.X** nocapture nofree nonnull writeonly dereferenceable(8) [[B:%.*]]) ; CHECK-NEXT: store %struct.X* [[A]], %struct.X** [[B]] ; CHECK-NEXT: ret void ; @@ -220,7 +220,7 @@ define internal void @test_sret(%struct.X* sret %a, %struct.X** %b) { define void @complicated_args_sret(%struct.X** %b) { ; CHECK-LABEL: define {{[^@]+}}@complicated_args_sret ; CHECK-SAME: (%struct.X** nocapture nofree writeonly [[B:%.*]]) -; CHECK-NEXT: call void @test_sret(%struct.X* nofree writeonly null, %struct.X** nocapture nofree writeonly [[B]]) +; CHECK-NEXT: call void @test_sret(%struct.X* nofree writeonly align 536870912 null, %struct.X** nocapture nofree writeonly [[B]]) ; CHECK-NEXT: ret void ; call void @test_sret(%struct.X* null, %struct.X** %b) @@ -229,14 +229,14 @@ define void @complicated_args_sret(%struct.X** %b) { define internal %struct.X* @test_nest(%struct.X* nest %a) { ; CHECK-LABEL: define {{[^@]+}}@test_nest -; CHECK-SAME: (%struct.X* nest noalias nofree readnone returned [[A:%.*]]) +; CHECK-SAME: (%struct.X* nest noalias nofree readnone returned align 536870912 [[A:%.*]]) ; CHECK-NEXT: ret %struct.X* [[A]] ; ret %struct.X* %a } define %struct.X* @complicated_args_nest() { ; CHECK-LABEL: define {{[^@]+}}@complicated_args_nest() -; CHECK-NEXT: [[CALL:%.*]] = call %struct.X* @test_nest(%struct.X* noalias nofree readnone null) +; CHECK-NEXT: [[CALL:%.*]] = call %struct.X* @test_nest(%struct.X* noalias nofree readnone align 536870912 null) ; CHECK-NEXT: ret %struct.X* [[CALL]] ; %call = call %struct.X* @test_nest(%struct.X* null) diff --git a/llvm/test/Transforms/ConstProp/fma.ll b/llvm/test/Transforms/ConstProp/fma.ll index 9119548a91a7c9..e1c46978f9a741 100644 --- a/llvm/test/Transforms/ConstProp/fma.ll +++ b/llvm/test/Transforms/ConstProp/fma.ll @@ -78,7 +78,7 @@ define double @test_NaN_2() { define double @test_NaN_3() { ; CHECK-LABEL: @test_NaN_3( -; CHECK-NEXT: ret double 0x7FF8000000000000 +; CHECK-NEXT: ret double 0xFFF8000000000000 ; %1 = call double @llvm.fma.f64(double 0xFFF8000000000000, double 8.0, double 0.0) ret double %1 @@ -86,7 +86,7 @@ define double @test_NaN_3() { define double @test_NaN_4() { ; CHECK-LABEL: @test_NaN_4( -; CHECK-NEXT: ret double 0x7FF8000000000000 +; CHECK-NEXT: ret double 0xFFF8000000000000 ; %1 = call double @llvm.fma.f64(double 7.0, double 0xFFF8000000000000, double 0.0) ret double %1 diff --git a/llvm/test/Transforms/InstSimplify/fp-nan.ll b/llvm/test/Transforms/InstSimplify/fp-nan.ll index 5d2588f545a7c4..4dd25237629ad0 100644 --- a/llvm/test/Transforms/InstSimplify/fp-nan.ll +++ b/llvm/test/Transforms/InstSimplify/fp-nan.ll @@ -103,7 +103,7 @@ define float @frem_nan_op1(float %x) { define double @fneg_nan_1(double %x) { ; CHECK-LABEL: @fneg_nan_1( -; CHECK-NEXT: ret double 0xFFFABCDEF0123456 +; CHECK-NEXT: ret double 0x7FFABCDEF0123456 ; %r = fsub double -0.0, 0x7FFABCDEF0123456 ret double %r @@ -119,7 +119,7 @@ define double @unary_fneg_nan_1(double %x) { define <2 x double> @fneg_nan_2(<2 x double> %x) { ; CHECK-LABEL: @fneg_nan_2( -; CHECK-NEXT: ret <2 x double> +; CHECK-NEXT: ret <2 x double> ; %r = fsub <2 x double> , ret <2 x double> %r diff --git a/llvm/test/Transforms/SLPVectorizer/X86/no_alternate_divrem.ll b/llvm/test/Transforms/SLPVectorizer/X86/no_alternate_divrem.ll new file mode 100644 index 00000000000000..468cabc598f1cc --- /dev/null +++ b/llvm/test/Transforms/SLPVectorizer/X86/no_alternate_divrem.ll @@ -0,0 +1,129 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -slp-vectorizer -slp-threshold=-200 -mtriple=x86_64-unknown-linux -mcpu=core-avx2 -S | FileCheck %s + +define void @test_add_sdiv(i32 *%arr1, i32 *%arr2, i32 %a0, i32 %a1, i32 %a2, i32 %a3) { +; CHECK-LABEL: @test_add_sdiv( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[GEP1_0:%.*]] = getelementptr i32, i32* [[ARR1:%.*]], i32 0 +; CHECK-NEXT: [[GEP1_1:%.*]] = getelementptr i32, i32* [[ARR1]], i32 1 +; CHECK-NEXT: [[GEP1_2:%.*]] = getelementptr i32, i32* [[ARR1]], i32 2 +; CHECK-NEXT: [[GEP1_3:%.*]] = getelementptr i32, i32* [[ARR1]], i32 3 +; CHECK-NEXT: [[GEP2_0:%.*]] = getelementptr i32, i32* [[ARR2:%.*]], i32 0 +; CHECK-NEXT: [[GEP2_1:%.*]] = getelementptr i32, i32* [[ARR2]], i32 1 +; CHECK-NEXT: [[GEP2_2:%.*]] = getelementptr i32, i32* [[ARR2]], i32 2 +; CHECK-NEXT: [[GEP2_3:%.*]] = getelementptr i32, i32* [[ARR2]], i32 3 +; CHECK-NEXT: [[V0:%.*]] = load i32, i32* [[GEP1_0]] +; CHECK-NEXT: [[V1:%.*]] = load i32, i32* [[GEP1_1]] +; CHECK-NEXT: [[V2:%.*]] = load i32, i32* [[GEP1_2]] +; CHECK-NEXT: [[V3:%.*]] = load i32, i32* [[GEP1_3]] +; CHECK-NEXT: [[Y0:%.*]] = add nsw i32 [[A0:%.*]], 1146 +; CHECK-NEXT: [[Y1:%.*]] = add nsw i32 [[A1:%.*]], 146 +; CHECK-NEXT: [[Y2:%.*]] = add nsw i32 [[A2:%.*]], 42 +; CHECK-NEXT: [[Y3:%.*]] = add nsw i32 [[A3:%.*]], 0 +; CHECK-NEXT: [[RES0:%.*]] = add nsw i32 [[V0]], [[Y0]] +; CHECK-NEXT: [[RES1:%.*]] = add nsw i32 [[V1]], [[Y1]] +; CHECK-NEXT: [[RES2:%.*]] = sdiv i32 [[V2]], [[Y2]] +; CHECK-NEXT: [[RES3:%.*]] = add nsw i32 [[V3]], [[Y3]] +; CHECK-NEXT: store i32 [[RES0]], i32* [[GEP2_0]] +; CHECK-NEXT: store i32 [[RES1]], i32* [[GEP2_1]] +; CHECK-NEXT: store i32 [[RES2]], i32* [[GEP2_2]] +; CHECK-NEXT: store i32 [[RES3]], i32* [[GEP2_3]] +; CHECK-NEXT: ret void +; +entry: + %gep1.0 = getelementptr i32, i32* %arr1, i32 0 + %gep1.1 = getelementptr i32, i32* %arr1, i32 1 + %gep1.2 = getelementptr i32, i32* %arr1, i32 2 + %gep1.3 = getelementptr i32, i32* %arr1, i32 3 + %gep2.0 = getelementptr i32, i32* %arr2, i32 0 + %gep2.1 = getelementptr i32, i32* %arr2, i32 1 + %gep2.2 = getelementptr i32, i32* %arr2, i32 2 + %gep2.3 = getelementptr i32, i32* %arr2, i32 3 + %v0 = load i32, i32* %gep1.0 + %v1 = load i32, i32* %gep1.1 + %v2 = load i32, i32* %gep1.2 + %v3 = load i32, i32* %gep1.3 + %y0 = add nsw i32 %a0, 1146 + %y1 = add nsw i32 %a1, 146 + %y2 = add nsw i32 %a2, 42 + ;; %y3 is zero if %a3 is zero + %y3 = add nsw i32 %a3, 0 + %res0 = add nsw i32 %v0, %y0 + %res1 = add nsw i32 %v1, %y1 + ;; As such, doing alternate shuffling would be incorrect: + ;; %vadd = add nsw %v[0-3], %y[0-3] + ;; %vsdiv = sdiv %v[0-3], %y[0-3] + ;; %result = shuffle %vadd, %vsdiv, + ;; would be illegal. + %res2 = sdiv i32 %v2, %y2 + %res3 = add nsw i32 %v3, %y3 + store i32 %res0, i32* %gep2.0 + store i32 %res1, i32* %gep2.1 + store i32 %res2, i32* %gep2.2 + store i32 %res3, i32* %gep2.3 + ret void +} + +;; Similar test, but now div/rem is main opcode and not the alternate one. Same issue. +define void @test_urem_add(i32 *%arr1, i32 *%arr2, i32 %a0, i32 %a1, i32 %a2, i32 %a3) { +; CHECK-LABEL: @test_urem_add( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[GEP1_0:%.*]] = getelementptr i32, i32* [[ARR1:%.*]], i32 0 +; CHECK-NEXT: [[GEP1_1:%.*]] = getelementptr i32, i32* [[ARR1]], i32 1 +; CHECK-NEXT: [[GEP1_2:%.*]] = getelementptr i32, i32* [[ARR1]], i32 2 +; CHECK-NEXT: [[GEP1_3:%.*]] = getelementptr i32, i32* [[ARR1]], i32 3 +; CHECK-NEXT: [[GEP2_0:%.*]] = getelementptr i32, i32* [[ARR2:%.*]], i32 0 +; CHECK-NEXT: [[GEP2_1:%.*]] = getelementptr i32, i32* [[ARR2]], i32 1 +; CHECK-NEXT: [[GEP2_2:%.*]] = getelementptr i32, i32* [[ARR2]], i32 2 +; CHECK-NEXT: [[GEP2_3:%.*]] = getelementptr i32, i32* [[ARR2]], i32 3 +; CHECK-NEXT: [[V0:%.*]] = load i32, i32* [[GEP1_0]] +; CHECK-NEXT: [[V1:%.*]] = load i32, i32* [[GEP1_1]] +; CHECK-NEXT: [[V2:%.*]] = load i32, i32* [[GEP1_2]] +; CHECK-NEXT: [[V3:%.*]] = load i32, i32* [[GEP1_3]] +; CHECK-NEXT: [[Y0:%.*]] = add nsw i32 [[A0:%.*]], 1146 +; CHECK-NEXT: [[Y1:%.*]] = add nsw i32 [[A1:%.*]], 146 +; CHECK-NEXT: [[Y2:%.*]] = add nsw i32 [[A2:%.*]], 42 +; CHECK-NEXT: [[Y3:%.*]] = add nsw i32 [[A3:%.*]], 0 +; CHECK-NEXT: [[RES0:%.*]] = urem i32 [[V0]], [[Y0]] +; CHECK-NEXT: [[RES1:%.*]] = urem i32 [[V1]], [[Y1]] +; CHECK-NEXT: [[RES2:%.*]] = urem i32 [[V2]], [[Y2]] +; CHECK-NEXT: [[RES3:%.*]] = add nsw i32 [[V3]], [[Y3]] +; CHECK-NEXT: store i32 [[RES0]], i32* [[GEP2_0]] +; CHECK-NEXT: store i32 [[RES1]], i32* [[GEP2_1]] +; CHECK-NEXT: store i32 [[RES2]], i32* [[GEP2_2]] +; CHECK-NEXT: store i32 [[RES3]], i32* [[GEP2_3]] +; CHECK-NEXT: ret void +; +entry: + %gep1.0 = getelementptr i32, i32* %arr1, i32 0 + %gep1.1 = getelementptr i32, i32* %arr1, i32 1 + %gep1.2 = getelementptr i32, i32* %arr1, i32 2 + %gep1.3 = getelementptr i32, i32* %arr1, i32 3 + %gep2.0 = getelementptr i32, i32* %arr2, i32 0 + %gep2.1 = getelementptr i32, i32* %arr2, i32 1 + %gep2.2 = getelementptr i32, i32* %arr2, i32 2 + %gep2.3 = getelementptr i32, i32* %arr2, i32 3 + %v0 = load i32, i32* %gep1.0 + %v1 = load i32, i32* %gep1.1 + %v2 = load i32, i32* %gep1.2 + %v3 = load i32, i32* %gep1.3 + %y0 = add nsw i32 %a0, 1146 + %y1 = add nsw i32 %a1, 146 + %y2 = add nsw i32 %a2, 42 + ;; %y3 is zero if %a3 is zero + %y3 = add nsw i32 %a3, 0 + %res0 = urem i32 %v0, %y0 + %res1 = urem i32 %v1, %y1 + %res2 = urem i32 %v2, %y2 + ;; As such, doing alternate shuffling would be incorrect: + ;; %vurem = urem %v[0-3], %y[0-3] + ;; %vadd = add nsw %v[0-3], %y[0-3] + ;; %result = shuffle %vurem, %vadd, + ;; would be illegal. + %res3 = add nsw i32 %v3, %y3 + store i32 %res0, i32* %gep2.0 + store i32 %res1, i32* %gep2.1 + store i32 %res2, i32* %gep2.2 + store i32 %res3, i32* %gep2.3 + ret void +} diff --git a/llvm/test/tools/llvm-elfabi/binary-read-add-soname.test b/llvm/test/tools/llvm-elfabi/binary-read-add-soname.test index 744fa51d0561a5..e5d0860199d7a8 100644 --- a/llvm/test/tools/llvm-elfabi/binary-read-add-soname.test +++ b/llvm/test/tools/llvm-elfabi/binary-read-add-soname.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-elfabi --elf %t --emit-tbe=- --soname=best.so | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-elfabi/binary-read-arch.test b/llvm/test/tools/llvm-elfabi/binary-read-arch.test index 918a0c667d9038..1fea6ebbeaf6fa 100644 --- a/llvm/test/tools/llvm-elfabi/binary-read-arch.test +++ b/llvm/test/tools/llvm-elfabi/binary-read-arch.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-elfabi --elf %t --emit-tbe=- | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-elfabi/binary-read-bad-soname.test b/llvm/test/tools/llvm-elfabi/binary-read-bad-soname.test index a92d61e607d0b3..0a1f9d931c17aa 100644 --- a/llvm/test/tools/llvm-elfabi/binary-read-bad-soname.test +++ b/llvm/test/tools/llvm-elfabi/binary-read-bad-soname.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-elfabi --elf %t --emit-tbe=%t.tbe 2>&1 | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-elfabi/binary-read-bad-vaddr.test b/llvm/test/tools/llvm-elfabi/binary-read-bad-vaddr.test index b9806e94fb9ccb..dfdc0e6ade6317 100644 --- a/llvm/test/tools/llvm-elfabi/binary-read-bad-vaddr.test +++ b/llvm/test/tools/llvm-elfabi/binary-read-bad-vaddr.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-elfabi --elf %t --emit-tbe=%t.tbe 2>&1 | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-elfabi/binary-read-neededlibs-bad-offset.test b/llvm/test/tools/llvm-elfabi/binary-read-neededlibs-bad-offset.test index 6b7ba8b2d1989b..bb832210df9317 100644 --- a/llvm/test/tools/llvm-elfabi/binary-read-neededlibs-bad-offset.test +++ b/llvm/test/tools/llvm-elfabi/binary-read-neededlibs-bad-offset.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-elfabi --elf %t --emit-tbe=%t.tbe 2>&1 | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-elfabi/binary-read-no-dt-strsz.test b/llvm/test/tools/llvm-elfabi/binary-read-no-dt-strsz.test index 99e06b2ca87b2a..cf4561e0e27053 100644 --- a/llvm/test/tools/llvm-elfabi/binary-read-no-dt-strsz.test +++ b/llvm/test/tools/llvm-elfabi/binary-read-no-dt-strsz.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-elfabi --elf %t --emit-tbe=%t.tbe 2>&1 | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-elfabi/binary-read-no-dt-strtab.test b/llvm/test/tools/llvm-elfabi/binary-read-no-dt-strtab.test index 79f4496cc9f6e5..315aae3bda8445 100644 --- a/llvm/test/tools/llvm-elfabi/binary-read-no-dt-strtab.test +++ b/llvm/test/tools/llvm-elfabi/binary-read-no-dt-strtab.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-elfabi --elf %t --emit-tbe=%t.tbe 2>&1 | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-elfabi/binary-read-no-dynamic.test b/llvm/test/tools/llvm-elfabi/binary-read-no-dynamic.test index 475d7bf7b84213..fc88d83340e23e 100644 --- a/llvm/test/tools/llvm-elfabi/binary-read-no-dynamic.test +++ b/llvm/test/tools/llvm-elfabi/binary-read-no-dynamic.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-elfabi --elf %t --emit-tbe=%t.tbe 2>&1 | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-elfabi/binary-read-replace-soname.test b/llvm/test/tools/llvm-elfabi/binary-read-replace-soname.test index 762dcbb913461e..4e6c1f7cb568eb 100644 --- a/llvm/test/tools/llvm-elfabi/binary-read-replace-soname.test +++ b/llvm/test/tools/llvm-elfabi/binary-read-replace-soname.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-elfabi --elf %t --emit-tbe=- | FileCheck %s --check-prefix=ORIGINAL # RUN: llvm-elfabi --elf %t --emit-tbe=- --soname=libbest.so | FileCheck %s --check-prefix=REPLACED diff --git a/llvm/test/tools/llvm-elfabi/binary-read-soname-no-null.test b/llvm/test/tools/llvm-elfabi/binary-read-soname-no-null.test index 30aa6794298d9a..099b5741f7691b 100644 --- a/llvm/test/tools/llvm-elfabi/binary-read-soname-no-null.test +++ b/llvm/test/tools/llvm-elfabi/binary-read-soname-no-null.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-elfabi --elf %t --emit-tbe=%t.tbe 2>&1 | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-elfabi/binary-read-soname.test b/llvm/test/tools/llvm-elfabi/binary-read-soname.test index ef35b893dc019a..960cc65b6dd1d9 100644 --- a/llvm/test/tools/llvm-elfabi/binary-read-soname.test +++ b/llvm/test/tools/llvm-elfabi/binary-read-soname.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-elfabi --elf %t --emit-tbe=- | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-lipo/archs-macho-binary-unknown.test b/llvm/test/tools/llvm-lipo/archs-macho-binary-unknown.test index ceda7d4b5e1831..cf92b825fec59f 100644 --- a/llvm/test/tools/llvm-lipo/archs-macho-binary-unknown.test +++ b/llvm/test/tools/llvm-lipo/archs-macho-binary-unknown.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # Tests that the output for an unknown architecture is the same as cctools lipo # RUN: llvm-lipo %t -archs | FileCheck %s # CHECK: unknown(151,3) diff --git a/llvm/test/tools/llvm-lipo/archs-macho-binary.test b/llvm/test/tools/llvm-lipo/archs-macho-binary.test index 56f913263dac57..d71fe5e024773f 100644 --- a/llvm/test/tools/llvm-lipo/archs-macho-binary.test +++ b/llvm/test/tools/llvm-lipo/archs-macho-binary.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-lipo %t -archs | FileCheck --check-prefix=ARCHS %s # RUN: llvm-lipo %t --archs | FileCheck --check-prefix=ARCHS %s diff --git a/llvm/test/tools/llvm-lipo/archs-universal-binary-arm.test b/llvm/test/tools/llvm-lipo/archs-universal-binary-arm.test index 81c112593a419c..4f8708d721e8e0 100644 --- a/llvm/test/tools/llvm-lipo/archs-universal-binary-arm.test +++ b/llvm/test/tools/llvm-lipo/archs-universal-binary-arm.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-lipo %t -archs | FileCheck %s # CHECK: armv7k arm64 diff --git a/llvm/test/tools/llvm-lipo/archs-universal-binary-unknown.test b/llvm/test/tools/llvm-lipo/archs-universal-binary-unknown.test index 353a95ddb02b8d..dbdf01b704fea7 100644 --- a/llvm/test/tools/llvm-lipo/archs-universal-binary-unknown.test +++ b/llvm/test/tools/llvm-lipo/archs-universal-binary-unknown.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # Tests that the output for an unknown architecture is the same as cctools lipo # RUN: llvm-lipo %t -archs 2>&1 | FileCheck %s # CHECK: i386 unknown(16777367,3) diff --git a/llvm/test/tools/llvm-lipo/archs-universal-binary-x86.test b/llvm/test/tools/llvm-lipo/archs-universal-binary-x86.test index e3b7af29a94008..bef267b957d24f 100644 --- a/llvm/test/tools/llvm-lipo/archs-universal-binary-x86.test +++ b/llvm/test/tools/llvm-lipo/archs-universal-binary-x86.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-lipo %t -archs | FileCheck %s # CHECK: i386 x86_64 diff --git a/llvm/test/tools/llvm-lipo/create-arch.test b/llvm/test/tools/llvm-lipo/create-arch.test index bae216566de65c..08e9e18ca5e393 100644 --- a/llvm/test/tools/llvm-lipo/create-arch.test +++ b/llvm/test/tools/llvm-lipo/create-arch.test @@ -1,5 +1,5 @@ -# RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-i386.o -# RUN: yaml2obj %p/Inputs/x86_64-slice.yaml > %t-x86_64.o +# RUN: yaml2obj %p/Inputs/i386-slice.yaml -o %t-i386.o +# RUN: yaml2obj %p/Inputs/x86_64-slice.yaml -o %t-x86_64.o # RUN: llvm-lipo %t-i386.o %t-x86_64.o -create -output %t-universal.o # RUN: llvm-lipo %t-i386.o -arch x86_64 %t-x86_64.o -create -output %t-universal-1.o diff --git a/llvm/test/tools/llvm-lipo/create-archive-input.test b/llvm/test/tools/llvm-lipo/create-archive-input.test index 8f4307e9c83031..b40312528e05ef 100644 --- a/llvm/test/tools/llvm-lipo/create-archive-input.test +++ b/llvm/test/tools/llvm-lipo/create-archive-input.test @@ -1,6 +1,6 @@ -# RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-i386.o -# RUN: yaml2obj %p/Inputs/x86_64-slice.yaml > %t-x86_64.o -# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml > %t-universal.o +# RUN: yaml2obj %p/Inputs/i386-slice.yaml -o %t-i386.o +# RUN: yaml2obj %p/Inputs/x86_64-slice.yaml -o %t-x86_64.o +# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml -o %t-universal.o # RUN: llvm-ar cr %t.empty.a # RUN: not llvm-lipo %t.empty.a -create -output /dev/null 2>&1 | FileCheck --check-prefix=EMPTY-ARCHIVE %s diff --git a/llvm/test/tools/llvm-lipo/create-compute-alignment.test b/llvm/test/tools/llvm-lipo/create-compute-alignment.test index b986012ea7c722..985b0cdf7e9085 100644 --- a/llvm/test/tools/llvm-lipo/create-compute-alignment.test +++ b/llvm/test/tools/llvm-lipo/create-compute-alignment.test @@ -1,6 +1,6 @@ -# RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-i386.o -# RUN: yaml2obj %p/Inputs/CPU14-slice.yaml > %t-CPU14.o -# RUN: yaml2obj %p/Inputs/CPU10-slice.yaml > %t-CPU10.o +# RUN: yaml2obj %p/Inputs/i386-slice.yaml -o %t-i386.o +# RUN: yaml2obj %p/Inputs/CPU14-slice.yaml -o %t-CPU14.o +# RUN: yaml2obj %p/Inputs/CPU10-slice.yaml -o %t-CPU10.o # RUN: llvm-lipo %t-i386.o %t-CPU14.o %t-CPU10.o -create -output %t-universal.o diff --git a/llvm/test/tools/llvm-lipo/create-default-alignment.test b/llvm/test/tools/llvm-lipo/create-default-alignment.test index 813230a7e3c4aa..c90b34f02966c0 100644 --- a/llvm/test/tools/llvm-lipo/create-default-alignment.test +++ b/llvm/test/tools/llvm-lipo/create-default-alignment.test @@ -1,13 +1,13 @@ -# RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-i386.o -# RUN: yaml2obj %p/Inputs/x86_64-slice.yaml > %t-x86_64.o +# RUN: yaml2obj %p/Inputs/i386-slice.yaml -o %t-i386.o +# RUN: yaml2obj %p/Inputs/x86_64-slice.yaml -o %t-x86_64.o # RUN: llvm-lipo %t-i386.o %t-x86_64.o -create -output %t-universal-llvm.o -# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml > %t-universal.o +# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml -o %t-universal.o # RUN: cmp %t-universal-llvm.o %t-universal.o -# RUN: yaml2obj %p/Inputs/armv7-slice.yaml > %t-armv7.o -# RUN: yaml2obj %p/Inputs/arm64-slice.yaml > %t-arm64.o +# RUN: yaml2obj %p/Inputs/armv7-slice.yaml -o %t-armv7.o +# RUN: yaml2obj %p/Inputs/arm64-slice.yaml -o %t-arm64.o # RUN: llvm-lipo %t-arm64.o %t-armv7.o %t-universal.o -create -output %t-universal-2.o # RUN: llvm-lipo %t-universal-2.o -thin x86_64 -output %t-x86_64_extracted.o diff --git a/llvm/test/tools/llvm-lipo/create-executable.test b/llvm/test/tools/llvm-lipo/create-executable.test index 43e29a71e846dd..db785a5e4de2ab 100644 --- a/llvm/test/tools/llvm-lipo/create-executable.test +++ b/llvm/test/tools/llvm-lipo/create-executable.test @@ -1,7 +1,7 @@ # Executable testing is not supported on Windows, since all files are considered executable # UNSUPPORTED: system-windows -# RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-i386.o -# RUN: yaml2obj %p/Inputs/x86_64-slice.yaml > %t-x86_64.o +# RUN: yaml2obj %p/Inputs/i386-slice.yaml -o %t-i386.o +# RUN: yaml2obj %p/Inputs/x86_64-slice.yaml -o %t-x86_64.o # RUN: chmod a-x %t-i386.o # RUN: chmod a-x %t-x86_64.o diff --git a/llvm/test/tools/llvm-lipo/create-invalid-input.test b/llvm/test/tools/llvm-lipo/create-invalid-input.test index 4bb2e1a5666799..5a07a7636e569f 100644 --- a/llvm/test/tools/llvm-lipo/create-invalid-input.test +++ b/llvm/test/tools/llvm-lipo/create-invalid-input.test @@ -1,5 +1,5 @@ -# RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-32.o -# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml > %t-universal.o +# RUN: yaml2obj %p/Inputs/i386-slice.yaml -o %t-32.o +# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml -o %t-universal.o # RUN: not llvm-lipo %t-32.o -create 2>&1 | FileCheck --check-prefix=NO_OUTPUT %s # NO_OUTPUT: error: create expects a single output file to be specified diff --git a/llvm/test/tools/llvm-lipo/extract.test b/llvm/test/tools/llvm-lipo/extract.test index 49f22f46f63204..07297cc77d5912 100644 --- a/llvm/test/tools/llvm-lipo/extract.test +++ b/llvm/test/tools/llvm-lipo/extract.test @@ -1,9 +1,9 @@ -# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml > %t-universal.o +# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml -o %t-universal.o # RUN: not llvm-lipo %t-universal.o -extract arm64_32 -output /dev/null 2>&1 | FileCheck --check-prefix=ARCH_NOT_IN_FILE %s # ARCH_NOT_IN_FILE: does not contain the specified architecture arm64_32 -# RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-i386.o +# RUN: yaml2obj %p/Inputs/i386-slice.yaml -o %t-i386.o # RUN: not llvm-lipo %t-i386.o -extract arm64_32 -output /dev/null 2>&1 | FileCheck --check-prefix=INPUT_NOT_A_FAT_FILE %s # INPUT_NOT_A_FAT_FILE: must be a fat file when the -extract option is specified diff --git a/llvm/test/tools/llvm-lipo/info-invalid.test b/llvm/test/tools/llvm-lipo/info-invalid.test index fd9f604f5e220f..e654fb0b3ff078 100644 --- a/llvm/test/tools/llvm-lipo/info-invalid.test +++ b/llvm/test/tools/llvm-lipo/info-invalid.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-lipo %t -info 2>&1 | FileCheck %s # CHECK: has unsupported binary format diff --git a/llvm/test/tools/llvm-lipo/info.test b/llvm/test/tools/llvm-lipo/info.test index 1b0004667a2ce5..d5fd07344f0fd8 100644 --- a/llvm/test/tools/llvm-lipo/info.test +++ b/llvm/test/tools/llvm-lipo/info.test @@ -1,6 +1,6 @@ -# RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-i386.o -# RUN: yaml2obj %p/Inputs/x86_64-slice.yaml > %t-x86_64.o -# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml > %t-universal.o +# RUN: yaml2obj %p/Inputs/i386-slice.yaml -o %t-i386.o +# RUN: yaml2obj %p/Inputs/x86_64-slice.yaml -o %t-x86_64.o +# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml -o %t-universal.o # RUN: llvm-lipo %t-universal.o %t-i386.o %t-universal.o %t-x86_64.o -info | FileCheck %s # CHECK: Architectures in the fat file: diff --git a/llvm/test/tools/llvm-lipo/replace-invalid-input.test b/llvm/test/tools/llvm-lipo/replace-invalid-input.test index 38e9805bcba7de..594594bc2ee633 100644 --- a/llvm/test/tools/llvm-lipo/replace-invalid-input.test +++ b/llvm/test/tools/llvm-lipo/replace-invalid-input.test @@ -1,6 +1,6 @@ -# RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-32.o -# RUN: yaml2obj %p/Inputs/arm64-slice.yaml > %t-arm64.o -# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml > %t-universal.o +# RUN: yaml2obj %p/Inputs/i386-slice.yaml -o %t-32.o +# RUN: yaml2obj %p/Inputs/arm64-slice.yaml -o %t-arm64.o +# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml -o %t-universal.o # RUN: not llvm-lipo %t-universal.o -replace %t-32.o 2>&1 | FileCheck --check-prefix=MISSING_ARG %s # MISSING_ARG: error: replace is missing an argument: expects -replace arch_type file_name diff --git a/llvm/test/tools/llvm-lipo/replace-universal-binary.test b/llvm/test/tools/llvm-lipo/replace-universal-binary.test index f9419ef18f341d..a3ce6a9fcb148d 100644 --- a/llvm/test/tools/llvm-lipo/replace-universal-binary.test +++ b/llvm/test/tools/llvm-lipo/replace-universal-binary.test @@ -1,5 +1,5 @@ -# RUN: yaml2obj %p/Inputs/armv7-slice-big.yaml > %t-armv7big.o -# RUN: yaml2obj %p/Inputs/i386-x86_64-armv7-arm64-universal.yaml > %t-universal.o +# RUN: yaml2obj %p/Inputs/armv7-slice-big.yaml -o %t-armv7big.o +# RUN: yaml2obj %p/Inputs/i386-x86_64-armv7-arm64-universal.yaml -o %t-universal.o # RUN: llvm-lipo %t-universal.o -replace armv7 %t-armv7big.o -o %t.o # RUN: llvm-objdump %t.o -m --universal-headers | FileCheck --check-prefix=ARMV7_BIG %s @@ -20,8 +20,8 @@ # ARMV7_BIG: size 516 # ARMV7_BIG: align 2^14 (16384) -# RUN: yaml2obj %p/Inputs/armv7-slice.yaml > %t-armv7.o -# RUN: yaml2obj %p/Inputs/armv7_i386_non_default_alignment.yaml > %t-universal-align.o +# RUN: yaml2obj %p/Inputs/armv7-slice.yaml -o %t-armv7.o +# RUN: yaml2obj %p/Inputs/armv7_i386_non_default_alignment.yaml -o %t-universal-align.o # RUN: llvm-lipo %t-universal-align.o -replace armv7 %t-armv7.o -o %t2.o # RUN: llvm-objdump %t2.o -m --universal-headers | FileCheck --check-prefix=ARMV7_ALIGN_SWAP %s diff --git a/llvm/test/tools/llvm-lipo/segalign-invalid-input.test b/llvm/test/tools/llvm-lipo/segalign-invalid-input.test index 3556ddfc856269..aa6aceb77cc73a 100644 --- a/llvm/test/tools/llvm-lipo/segalign-invalid-input.test +++ b/llvm/test/tools/llvm-lipo/segalign-invalid-input.test @@ -1,5 +1,5 @@ -# RUN: yaml2obj %p/Inputs/arm64-slice.yaml > %t-arm64.o -# RUN: yaml2obj %p/Inputs/armv7-slice.yaml > %t-armv7.o +# RUN: yaml2obj %p/Inputs/arm64-slice.yaml -o %t-arm64.o +# RUN: yaml2obj %p/Inputs/armv7-slice.yaml -o %t-armv7.o # RUN: not llvm-lipo %t-armv7.o %t-arm64.o -create -o %t.o -segalign a 2>&1 | FileCheck --check-prefix=MISSING_ARG %s # MISSING_ARG: error: segalign is missing an argument: expects -segalign arch_type alignment_value diff --git a/llvm/test/tools/llvm-lipo/segalign.test b/llvm/test/tools/llvm-lipo/segalign.test index 30fc43ad01f6e9..0cb52669a9185b 100644 --- a/llvm/test/tools/llvm-lipo/segalign.test +++ b/llvm/test/tools/llvm-lipo/segalign.test @@ -1,6 +1,6 @@ -# RUN: yaml2obj %p/Inputs/arm64-slice.yaml > %t-arm64.o -# RUN: yaml2obj %p/Inputs/armv7-slice.yaml > %t-armv7.o -# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml > %t-universal.o +# RUN: yaml2obj %p/Inputs/arm64-slice.yaml -o %t-arm64.o +# RUN: yaml2obj %p/Inputs/armv7-slice.yaml -o %t-armv7.o +# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml -o %t-universal.o # segalign expects an architecture type followed by a hexadecimal value for alignment @@ -65,8 +65,8 @@ # RUN: llvm-lipo %t2.o -thin armv7 -o %thin-armv7.o # RUN: cmp %thin-armv7.o %t-armv7.o -# RUN: yaml2obj %p/Inputs/armv7-slice-big.yaml > %t-armv7-big.o -# RUN: yaml2obj %p/Inputs/i386-x86_64-armv7-arm64-universal.yaml > %t-universal-big.o +# RUN: yaml2obj %p/Inputs/armv7-slice-big.yaml -o %t-armv7-big.o +# RUN: yaml2obj %p/Inputs/i386-x86_64-armv7-arm64-universal.yaml -o %t-universal-big.o # RUN: llvm-lipo %t-universal-big.o -replace armv7 %t-armv7-big.o -o %t3.o -segalign armv7 4 # RUN: llvm-objdump %t3.o -m --universal-headers | FileCheck --check-prefix=CHECK_REPLACE_ARMV7 %s diff --git a/llvm/test/tools/llvm-lipo/thin-executable-universal-binary.test b/llvm/test/tools/llvm-lipo/thin-executable-universal-binary.test index 20dd1dbc2beff2..40cf9cc7eab968 100644 --- a/llvm/test/tools/llvm-lipo/thin-executable-universal-binary.test +++ b/llvm/test/tools/llvm-lipo/thin-executable-universal-binary.test @@ -1,6 +1,6 @@ # Executable testing is not supported on Windows, since all files are considered executable # UNSUPPORTED: system-windows -# RUN: yaml2obj %s > %t-universal.o +# RUN: yaml2obj %s -o %t-universal.o # RUN: chmod a-x %t-universal.o # RUN: llvm-lipo %t-universal.o -thin i386 -output %t32.o diff --git a/llvm/test/tools/llvm-lipo/thin-macho-binary.test b/llvm/test/tools/llvm-lipo/thin-macho-binary.test index e4fa08cb329d6c..b7e7918a062a17 100644 --- a/llvm/test/tools/llvm-lipo/thin-macho-binary.test +++ b/llvm/test/tools/llvm-lipo/thin-macho-binary.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-lipo %t -thin i386 2>&1 | FileCheck --check-prefix=NO_OUTPUT %s # NO_OUTPUT: error: thin expects a single output file diff --git a/llvm/test/tools/llvm-lipo/thin-universal-binary.test b/llvm/test/tools/llvm-lipo/thin-universal-binary.test index 8edb68682f0419..32825831a51f6e 100644 --- a/llvm/test/tools/llvm-lipo/thin-universal-binary.test +++ b/llvm/test/tools/llvm-lipo/thin-universal-binary.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-lipo %t -thin arm64_32 -output %t.out 2>&1 | FileCheck --check-prefix=ARCH_NOT_IN_FILE %s # ARCH_NOT_IN_FILE: does not contain the specified architecture arm64_32 to thin it to @@ -6,9 +6,9 @@ # RUN: not llvm-lipo %t -thin aarch101 -output %t.out 2>&1 | FileCheck --check-prefix=INVALID_ARCH %s # INVALID_ARCH: Invalid architecture: aarch101 -# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml > %t-universal.o +# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml -o %t-universal.o # RUN: llvm-lipo %t-universal.o -thin i386 -output %t32.o -# RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-basic32.o +# RUN: yaml2obj %p/Inputs/i386-slice.yaml -o %t-basic32.o # RUN: cmp %t32.o %t-basic32.o --- !fat-mach-o diff --git a/llvm/test/tools/llvm-lipo/verify-arch-macho-binary.test b/llvm/test/tools/llvm-lipo/verify-arch-macho-binary.test index 4ab3e59d0d90ae..9f7c0c279f6598 100644 --- a/llvm/test/tools/llvm-lipo/verify-arch-macho-binary.test +++ b/llvm/test/tools/llvm-lipo/verify-arch-macho-binary.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-lipo %t -verify_arch i386 # RUN: llvm-lipo %t --verify_arch i386 diff --git a/llvm/test/tools/llvm-lipo/verify-arch-universal-binary.test b/llvm/test/tools/llvm-lipo/verify-arch-universal-binary.test index 1f0381ebf122f2..6b87a943fdc67c 100644 --- a/llvm/test/tools/llvm-lipo/verify-arch-universal-binary.test +++ b/llvm/test/tools/llvm-lipo/verify-arch-universal-binary.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-lipo %t -verify_arch i386 # RUN: llvm-lipo %t -verify_arch i386 x86_64 diff --git a/llvm/test/tools/llvm-nm/AArch64/special-syms.test b/llvm/test/tools/llvm-nm/AArch64/special-syms.test index afc706bf8fb289..8322cc4df86f1b 100644 --- a/llvm/test/tools/llvm-nm/AArch64/special-syms.test +++ b/llvm/test/tools/llvm-nm/AArch64/special-syms.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # Test --special-syms flag. Currently this flag is a no-op, so outputs with and without # this flag should be identical. GNU nm doesn't show ARM and AArch64 special symbols # without --special-syms, so this test is to be changed when/if we decide to implement diff --git a/llvm/test/tools/llvm-nm/X86/nm-no-symbols-local-only.yaml b/llvm/test/tools/llvm-nm/X86/nm-no-symbols-local-only.yaml index 10441661cd2584..0a0887b13afcc0 100644 --- a/llvm/test/tools/llvm-nm/X86/nm-no-symbols-local-only.yaml +++ b/llvm/test/tools/llvm-nm/X86/nm-no-symbols-local-only.yaml @@ -1,6 +1,6 @@ ## When a file contains only local symbols the "no symbols" error should not ## be shown, so we expect the output to be completely empty. -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-nm %t.o 2>&1 | count 0 !ELF diff --git a/llvm/test/tools/llvm-nm/X86/nm-no-symbols.test b/llvm/test/tools/llvm-nm/X86/nm-no-symbols.test index bb4f0b03a47edb..83bc0a00699bb2 100644 --- a/llvm/test/tools/llvm-nm/X86/nm-no-symbols.test +++ b/llvm/test/tools/llvm-nm/X86/nm-no-symbols.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-nm %t.o 2>&1 | FileCheck %s -DFILE=%t.o !ELF diff --git a/llvm/test/tools/llvm-nm/X86/portability.test b/llvm/test/tools/llvm-nm/X86/portability.test index ca8c4781f0b8e0..a3fe13a6a69e5b 100644 --- a/llvm/test/tools/llvm-nm/X86/portability.test +++ b/llvm/test/tools/llvm-nm/X86/portability.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-nm %t.o --portability | FileCheck %s --strict-whitespace --match-full-lines # RUN: llvm-nm %t.o -P | FileCheck %s --strict-whitespace --match-full-lines diff --git a/llvm/test/tools/llvm-nm/debug-syms.test b/llvm/test/tools/llvm-nm/debug-syms.test index d10308002a1d6c..6a71aed41338e2 100644 --- a/llvm/test/tools/llvm-nm/debug-syms.test +++ b/llvm/test/tools/llvm-nm/debug-syms.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-nm --debug-syms %t.o | FileCheck %s --implicit-check-not U # RUN: llvm-nm -a %t.o | FileCheck %s --implicit-check-not U diff --git a/llvm/test/tools/llvm-nm/format-sysv-layout.test b/llvm/test/tools/llvm-nm/format-sysv-layout.test index 085e8380da68c7..33d1b396e8bb7f 100644 --- a/llvm/test/tools/llvm-nm/format-sysv-layout.test +++ b/llvm/test/tools/llvm-nm/format-sysv-layout.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-nm %t.o --debug-syms --format=sysv | FileCheck %s -DFILE=%t.o --strict-whitespace # RUN: llvm-nm %t.o --debug-syms -f=sysv | FileCheck %s -DFILE=%t.o --strict-whitespace diff --git a/llvm/test/tools/llvm-nm/format-sysv-section.test b/llvm/test/tools/llvm-nm/format-sysv-section.test index 67ed1a8f7db90c..6303f6008ac986 100644 --- a/llvm/test/tools/llvm-nm/format-sysv-section.test +++ b/llvm/test/tools/llvm-nm/format-sysv-section.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj --docnum=1 %s > %t1.o +# RUN: yaml2obj --docnum=1 %s -o %t1.o # RUN: llvm-nm %t1.o --format=sysv | FileCheck %s --- !ELF @@ -38,7 +38,7 @@ Symbols: ## (sh_name offset goes past the end of the sections name string table). ## We test that we can still print a reasonable output and don't crash/assert. -# RUN: yaml2obj --docnum=2 %s > %t2.o +# RUN: yaml2obj --docnum=2 %s -o %t2.o # RUN: llvm-nm %t2.o --format=sysv | FileCheck %s --check-prefix=ERR # ERR: foo |0000000000000000| ? | NOTYPE|0000000000000000| | diff --git a/llvm/test/tools/llvm-nm/format-sysv-type.test b/llvm/test/tools/llvm-nm/format-sysv-type.test index 68b376aecab19b..36b85a09915255 100644 --- a/llvm/test/tools/llvm-nm/format-sysv-type.test +++ b/llvm/test/tools/llvm-nm/format-sysv-type.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-nm %t.o --debug-syms --format=sysv | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-nm/no-sort.test b/llvm/test/tools/llvm-nm/no-sort.test index d74055875833a2..0b42de784b2d49 100644 --- a/llvm/test/tools/llvm-nm/no-sort.test +++ b/llvm/test/tools/llvm-nm/no-sort.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-nm %t.o | FileCheck %s --check-prefix=DEFAULT # RUN: llvm-nm --no-sort %t.o | FileCheck %s --check-prefix=NOSORT # RUN: llvm-nm -p %t.o | FileCheck %s --check-prefix=NOSORT diff --git a/llvm/test/tools/llvm-nm/numeric-sort.test b/llvm/test/tools/llvm-nm/numeric-sort.test index 26a6bcbcbda2c3..a3b32ecccc1311 100644 --- a/llvm/test/tools/llvm-nm/numeric-sort.test +++ b/llvm/test/tools/llvm-nm/numeric-sort.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-nm %t.o | FileCheck %s --check-prefix=DEFAULT # RUN: llvm-nm --numeric-sort %t.o | FileCheck %s --check-prefix=NUMERIC # RUN: llvm-nm -n %t.o | FileCheck %s --check-prefix=NUMERIC diff --git a/llvm/test/tools/llvm-nm/undefined-only.test b/llvm/test/tools/llvm-nm/undefined-only.test index 99fa519e70a622..720ded7f15f593 100644 --- a/llvm/test/tools/llvm-nm/undefined-only.test +++ b/llvm/test/tools/llvm-nm/undefined-only.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-nm --undefined-only %t.o | FileCheck %s --implicit-check-not=symbol_defined !ELF diff --git a/llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test b/llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test index 7afe4cddd6111e..b8d80d95b2f7e5 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test +++ b/llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test @@ -1,4 +1,4 @@ -RUN: yaml2obj %p/Inputs/x86_64-exe.yaml > %t.in123.exe +RUN: yaml2obj %p/Inputs/x86_64-exe.yaml -o %t.in123.exe # Using a debuglink filename with a length that is a multiple of 4, to # showcase padding in CONTENTS below. diff --git a/llvm/test/tools/llvm-objcopy/COFF/add-section.test b/llvm/test/tools/llvm-objcopy/COFF/add-section.test index a82756ef88508f..e4938db9135ffb 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/add-section.test +++ b/llvm/test/tools/llvm-objcopy/COFF/add-section.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t ## Test that llvm-objcopy adds a section to the given object with expected ## contents. @@ -35,7 +35,7 @@ ## Test that llvm-objcopy can add a section to an object with extended ## relocations. # RUN: %python %p/../Inputs/ungzip.py %p/Inputs/x86_64-obj-xrelocs.yaml.gz > %t.xrelocs.yaml -# RUN: yaml2obj %t.xrelocs.yaml > %t.xrelocs.obj +# RUN: yaml2obj %t.xrelocs.yaml -o %t.xrelocs.obj # RUN: llvm-objcopy --add-section=.test.section=%t.sec %t.xrelocs.obj %t1.xrelocs.obj # RUN: llvm-readobj --file-headers --sections --section-data %t1.xrelocs.obj | FileCheck %s --check-prefixes=CHECK-EXTENDED-RELOCS diff --git a/llvm/test/tools/llvm-objcopy/COFF/basic-copy.test b/llvm/test/tools/llvm-objcopy/COFF/basic-copy.test index ecdf430faf19ac..351cd00b651275 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/basic-copy.test +++ b/llvm/test/tools/llvm-objcopy/COFF/basic-copy.test @@ -17,31 +17,31 @@ following aspects: - Alignment of section data - Checksums -RUN: yaml2obj %p/Inputs/i386-obj.yaml > %t.i386.o +RUN: yaml2obj %p/Inputs/i386-obj.yaml -o %t.i386.o RUN: llvm-objcopy %t.i386.o %t.i386-copy.o RUN: obj2yaml %t.i386.o > %t.i386.o.yaml RUN: obj2yaml %t.i386-copy.o > %t.i386-copy.o.yaml RUN: cmp %t.i386.o.yaml %t.i386-copy.o.yaml -RUN: yaml2obj %p/Inputs/x86_64-obj.yaml > %t.x86_64.o +RUN: yaml2obj %p/Inputs/x86_64-obj.yaml -o %t.x86_64.o RUN: llvm-objcopy %t.x86_64.o %t.x86_64-copy.o RUN: obj2yaml %t.x86_64.o > %t.x86_64.o.yaml RUN: obj2yaml %t.x86_64-copy.o > %t.x86_64-copy.o.yaml RUN: cmp %t.x86_64.o.yaml %t.x86_64-copy.o.yaml -RUN: yaml2obj %p/Inputs/i386-exe.yaml > %t.i386.exe +RUN: yaml2obj %p/Inputs/i386-exe.yaml -o %t.i386.exe RUN: llvm-objcopy %t.i386.exe %t.i386-copy.exe RUN: obj2yaml %t.i386.exe > %t.i386.exe.yaml RUN: obj2yaml %t.i386-copy.exe > %t.i386-copy.exe.yaml RUN: cmp %t.i386.exe.yaml %t.i386-copy.exe.yaml -RUN: yaml2obj %p/Inputs/x86_64-exe.yaml > %t.x86_64.exe +RUN: yaml2obj %p/Inputs/x86_64-exe.yaml -o %t.x86_64.exe RUN: llvm-objcopy %t.x86_64.exe %t.x86_64-copy.exe RUN: obj2yaml %t.x86_64.exe > %t.x86_64.exe.yaml RUN: obj2yaml %t.x86_64-copy.exe > %t.x86_64-copy.exe.yaml RUN: cmp %t.x86_64.exe.yaml %t.x86_64-copy.exe.yaml -RUN: yaml2obj %p/Inputs/no-symbols.yaml > %t.no-symbols.o +RUN: yaml2obj %p/Inputs/no-symbols.yaml -o %t.no-symbols.o RUN: llvm-objcopy %t.no-symbols.o %t.no-symbols-copy.o RUN: obj2yaml %t.no-symbols.o > %t.no-symbols.o.yaml RUN: obj2yaml %t.no-symbols-copy.o > %t.no-symbols-copy.o.yaml diff --git a/llvm/test/tools/llvm-objcopy/COFF/discard-all.test b/llvm/test/tools/llvm-objcopy/COFF/discard-all.test index 5d7d5cef2f3609..1576fa944eee95 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/discard-all.test +++ b/llvm/test/tools/llvm-objcopy/COFF/discard-all.test @@ -1,4 +1,4 @@ -RUN: yaml2obj %p/Inputs/discard-locals.yaml > %t.in.o +RUN: yaml2obj %p/Inputs/discard-locals.yaml -o %t.in.o RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-PRE diff --git a/llvm/test/tools/llvm-objcopy/COFF/only-keep-debug.test b/llvm/test/tools/llvm-objcopy/COFF/only-keep-debug.test index c2a6afef7ce99f..66cdeea3006b63 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/only-keep-debug.test +++ b/llvm/test/tools/llvm-objcopy/COFF/only-keep-debug.test @@ -1,4 +1,4 @@ -RUN: yaml2obj %p/Inputs/only-keep-sections.yaml > %t.in.exe +RUN: yaml2obj %p/Inputs/only-keep-sections.yaml -o %t.in.exe RUN: llvm-objcopy --only-keep-debug %t.in.exe %t.out.exe RUN: llvm-readobj --sections %t.out.exe | FileCheck %s --check-prefix=SECTIONS diff --git a/llvm/test/tools/llvm-objcopy/COFF/only-section.test b/llvm/test/tools/llvm-objcopy/COFF/only-section.test index 42492ed80ff957..8610828d05fbe8 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/only-section.test +++ b/llvm/test/tools/llvm-objcopy/COFF/only-section.test @@ -1,4 +1,4 @@ -RUN: yaml2obj %p/Inputs/only-keep-sections.yaml > %t.in.exe +RUN: yaml2obj %p/Inputs/only-keep-sections.yaml -o %t.in.exe RUN: llvm-objcopy --only-section .debug_discardable %t.in.exe %t.out.exe RUN: llvm-objdump --section-headers -t %t.out.exe | FileCheck %s --check-prefixes=SECTIONS,SECTIONS-DEBUG,SYMBOLS,SYMBOLS-DEBUG diff --git a/llvm/test/tools/llvm-objcopy/COFF/patch-debug-dir.test b/llvm/test/tools/llvm-objcopy/COFF/patch-debug-dir.test index 82af18311c8ae9..19685be40a4611 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/patch-debug-dir.test +++ b/llvm/test/tools/llvm-objcopy/COFF/patch-debug-dir.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.in.exe +# RUN: yaml2obj %s -o %t.in.exe # RUN: llvm-objdump -s %t.in.exe | FileCheck %s --check-prefixes=CONTENTS,CONTENTS-PRE # RUN: llvm-readobj --sections %t.in.exe | FileCheck %s --check-prefixes=SECTIONS,SECTIONS-PRE diff --git a/llvm/test/tools/llvm-objcopy/COFF/remove-section.test b/llvm/test/tools/llvm-objcopy/COFF/remove-section.test index 58ff574181acd0..064929191436fc 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/remove-section.test +++ b/llvm/test/tools/llvm-objcopy/COFF/remove-section.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.in.o +# RUN: yaml2obj %s -o %t.in.o # # RUN: llvm-objdump -section-headers %t.in.o | FileCheck %s --check-prefixes=SECTIONS-PRE # RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS-PRE diff --git a/llvm/test/tools/llvm-objcopy/COFF/strip-all.test b/llvm/test/tools/llvm-objcopy/COFF/strip-all.test index 5e3ed9c409180f..e85aee8884acad 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/strip-all.test +++ b/llvm/test/tools/llvm-objcopy/COFF/strip-all.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.in.o +# RUN: yaml2obj %s -o %t.in.o # RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-PRE diff --git a/llvm/test/tools/llvm-objcopy/COFF/strip-debug.test b/llvm/test/tools/llvm-objcopy/COFF/strip-debug.test index 97fa96aac70d2d..924a4d314e2e4a 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/strip-debug.test +++ b/llvm/test/tools/llvm-objcopy/COFF/strip-debug.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.in.o +# RUN: yaml2obj %s -o %t.in.o # # RUN: llvm-objdump --section-headers %t.in.o | FileCheck %s --check-prefixes=SECTIONS,SECTIONS-PRE # RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-PRE diff --git a/llvm/test/tools/llvm-objcopy/COFF/strip-reloc-symbol.test b/llvm/test/tools/llvm-objcopy/COFF/strip-reloc-symbol.test index 9be4ab83521e0d..d197e647c8af0d 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/strip-reloc-symbol.test +++ b/llvm/test/tools/llvm-objcopy/COFF/strip-reloc-symbol.test @@ -1,4 +1,4 @@ -RUN: yaml2obj %p/Inputs/strip-symbols.yaml > %t.o +RUN: yaml2obj %p/Inputs/strip-symbols.yaml -o %t.o RUN: not llvm-objcopy -N foo %t.o 2>&1 | FileCheck %s --check-prefix=ERROR RUN: not llvm-objcopy --strip-symbol foo %t.o 2>&1 | FileCheck %s --check-prefix=ERROR diff --git a/llvm/test/tools/llvm-objcopy/COFF/strip-symbol.test b/llvm/test/tools/llvm-objcopy/COFF/strip-symbol.test index 5eb644261798a3..ab1251cfa7c3f6 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/strip-symbol.test +++ b/llvm/test/tools/llvm-objcopy/COFF/strip-symbol.test @@ -1,4 +1,4 @@ -RUN: yaml2obj %p/Inputs/strip-symbols.yaml > %t.in.o +RUN: yaml2obj %p/Inputs/strip-symbols.yaml -o %t.in.o RUN: llvm-readobj -r %t.in.o | FileCheck %s --check-prefixes=RELOCS,RELOCS-PRE RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-PRE diff --git a/llvm/test/tools/llvm-objcopy/COFF/strip-unneeded.test b/llvm/test/tools/llvm-objcopy/COFF/strip-unneeded.test index ca3efe4a3138a7..d6cfeaa0782a3a 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/strip-unneeded.test +++ b/llvm/test/tools/llvm-objcopy/COFF/strip-unneeded.test @@ -1,4 +1,4 @@ -RUN: yaml2obj %p/Inputs/discard-locals.yaml > %t.in.o +RUN: yaml2obj %p/Inputs/discard-locals.yaml -o %t.in.o RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-PRE diff --git a/llvm/test/tools/llvm-objcopy/COFF/weak-external.test b/llvm/test/tools/llvm-objcopy/COFF/weak-external.test index b5a311fbfb6c19..07e02111af94a8 100644 --- a/llvm/test/tools/llvm-objcopy/COFF/weak-external.test +++ b/llvm/test/tools/llvm-objcopy/COFF/weak-external.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.in.o +# RUN: yaml2obj %s -o %t.in.o # RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-PRE diff --git a/llvm/test/tools/llvm-objcopy/ELF/abs-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/abs-symbol.test index 62c5873ba55042..8d86143404b590 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/abs-symbol.test +++ b/llvm/test/tools/llvm-objcopy/ELF/abs-symbol.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/add-gnu-debuglink.test b/llvm/test/tools/llvm-objcopy/ELF/add-gnu-debuglink.test index 330571c337776f..b4ac99d1c71a4e 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/add-gnu-debuglink.test +++ b/llvm/test/tools/llvm-objcopy/ELF/add-gnu-debuglink.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: printf 0000 > %t.blob # RUN: llvm-objcopy --add-gnu-debuglink=%t.blob %t %t2 # RUN: llvm-readobj --sections --section-data %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/add-note.test b/llvm/test/tools/llvm-objcopy/ELF/add-note.test index b45623078463da..84cb7db1788ffd 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/add-note.test +++ b/llvm/test/tools/llvm-objcopy/ELF/add-note.test @@ -11,7 +11,7 @@ # RUN: echo -e -n "\x08\x09\x0a\x0b" >> %t-note.bin # RUN: echo -e -n "\x0c\x0d\x0e\x0f" >> %t-note.bin -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-objcopy --add-section=.note.gnu.build-id=%t-note.bin %t.o %t-with-note.o # RUN: llvm-readobj --notes %t-with-note.o | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/add-section-remove.test b/llvm/test/tools/llvm-objcopy/ELF/add-section-remove.test index ad41d74947d4c7..3aaf981cc71d50 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/add-section-remove.test +++ b/llvm/test/tools/llvm-objcopy/ELF/add-section-remove.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: echo 0000 > %t.sec # RUN: llvm-objcopy -R .test2 --add-section=.test2=%t.sec %t %t2 # RUN: llvm-readobj --file-headers --sections --section-data %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/add-section-special.test b/llvm/test/tools/llvm-objcopy/ELF/add-section-special.test index e83cd51810f8e2..3c3cb9fc0e9dad 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/add-section-special.test +++ b/llvm/test/tools/llvm-objcopy/ELF/add-section-special.test @@ -2,7 +2,7 @@ # By default, sections are SHT_PROGBITS, but .note sections (excluding # .note.GNU-stack) are SHT_NOTE sections. -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-objcopy --add-section=.foo=/dev/null %t.o %t-foo.o # RUN: llvm-objcopy --add-section=.note.foo=/dev/null %t.o %t-regular-note.o # RUN: llvm-objcopy --add-section=.note.GNU-stack=/dev/null %t.o %t-gnu-stack.o diff --git a/llvm/test/tools/llvm-objcopy/ELF/add-section.test b/llvm/test/tools/llvm-objcopy/ELF/add-section.test index e930d2754b8608..290761f82bc18c 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/add-section.test +++ b/llvm/test/tools/llvm-objcopy/ELF/add-section.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy -O binary -j .test2 %t %t.sec # RUN: llvm-objcopy -R .test2 %t %t2 # RUN: llvm-objcopy --add-section=.test2=%t.sec %t2 %t3 diff --git a/llvm/test/tools/llvm-objcopy/ELF/armexidx-link.test b/llvm/test/tools/llvm-objcopy/ELF/armexidx-link.test index 734f43632f850c..be4428aa93fba9 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/armexidx-link.test +++ b/llvm/test/tools/llvm-objcopy/ELF/armexidx-link.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --remove-section=.text.bar %t %t2 # RUN: llvm-readobj --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/bad-build-id.test b/llvm/test/tools/llvm-objcopy/ELF/bad-build-id.test index 13c4b1685e015c..7adbd2fbfa9cad 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/bad-build-id.test +++ b/llvm/test/tools/llvm-objcopy/ELF/bad-build-id.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy --build-id-link-dir=%t-dir --build-id-link-input=.debug %t 2>&1 >/dev/null | FileCheck %s # CHECK: build ID is smaller than two bytes diff --git a/llvm/test/tools/llvm-objcopy/ELF/bad-output-format.test b/llvm/test/tools/llvm-objcopy/ELF/bad-output-format.test index 932584cc8cc081..df1a446ae5fc3b 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/bad-output-format.test +++ b/llvm/test/tools/llvm-objcopy/ELF/bad-output-format.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: not llvm-objcopy -O xyz %t.o %t.2.o 2>&1 \ # RUN: | FileCheck %s --check-prefix=BAD-OUTPUT-FORMAT diff --git a/llvm/test/tools/llvm-objcopy/ELF/basic-archive-copy.test b/llvm/test/tools/llvm-objcopy/ELF/basic-archive-copy.test index ada141471fbd22..89994ad3da9db7 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/basic-archive-copy.test +++ b/llvm/test/tools/llvm-objcopy/ELF/basic-archive-copy.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: rm -f %t.a # RUN: llvm-ar crs %t.a %t diff --git a/llvm/test/tools/llvm-objcopy/ELF/basic-copy.test b/llvm/test/tools/llvm-objcopy/ELF/basic-copy.test index b6b0bcc612be45..0eacb62a94ca96 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/basic-copy.test +++ b/llvm/test/tools/llvm-objcopy/ELF/basic-copy.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/basic-keep.test b/llvm/test/tools/llvm-objcopy/ELF/basic-keep.test index 8488a2679b38d8..2790773b4b3dd3 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/basic-keep.test +++ b/llvm/test/tools/llvm-objcopy/ELF/basic-keep.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --strip-non-alloc --keep-section=.test %t %t2 # RUN: llvm-strip --strip-all --keep-section=.test %t -o %t3 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/basic-only-section.test b/llvm/test/tools/llvm-objcopy/ELF/basic-only-section.test index f95ea38911675b..fa959c4e9d0f5d 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/basic-only-section.test +++ b/llvm/test/tools/llvm-objcopy/ELF/basic-only-section.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --only-section=.test %t %t2 # RUN: llvm-objcopy -j .test %t %t3 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/basic-relocations.test b/llvm/test/tools/llvm-objcopy/ELF/basic-relocations.test index ac1831a23e1131..9ffe13d67375d2 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/basic-relocations.test +++ b/llvm/test/tools/llvm-objcopy/ELF/basic-relocations.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --relocations %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/build-id-link-dir.test b/llvm/test/tools/llvm-objcopy/ELF/build-id-link-dir.test index 9fe9a68cfdb446..c99d0efdf31b5c 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/build-id-link-dir.test +++ b/llvm/test/tools/llvm-objcopy/ELF/build-id-link-dir.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: mkdir -p %t-dir # RUN: llvm-objcopy --build-id-link-dir=%t-dir %t %t2 diff --git a/llvm/test/tools/llvm-objcopy/ELF/cannot-delete-dest.test b/llvm/test/tools/llvm-objcopy/ELF/cannot-delete-dest.test index 1853049c8acea7..68e547fbb98410 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/cannot-delete-dest.test +++ b/llvm/test/tools/llvm-objcopy/ELF/cannot-delete-dest.test @@ -1,5 +1,5 @@ # REQUIRES: system-windows -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: rm -f %t2.o # RUN: cp %t.o %t2.o # RUN: attrib +r %t2.o diff --git a/llvm/test/tools/llvm-objcopy/ELF/common-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/common-symbol.test index 42d563975d1aa3..98e73d2c0e5686 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/common-symbol.test +++ b/llvm/test/tools/llvm-objcopy/ELF/common-symbol.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/copy-osabi.test b/llvm/test/tools/llvm-objcopy/ELF/copy-osabi.test index 75a22bc9bdfaf2..f53ec7216d0633 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/copy-osabi.test +++ b/llvm/test/tools/llvm-objcopy/ELF/copy-osabi.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --file-headers %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test b/llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test index 9ebbe12ce8d94b..720dcbfa99b8f7 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test +++ b/llvm/test/tools/llvm-objcopy/ELF/cross-arch-headers.test @@ -2,7 +2,7 @@ # and DWO output. # Note that we don't actually need any DWARF to produce the DWO file. -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # Without --output-format, the format should match the input. # RUN: llvm-objcopy %t.o %t.default.o --split-dwo=%t.default.dwo diff --git a/llvm/test/tools/llvm-objcopy/ELF/cross-arch-sections-symbols.test b/llvm/test/tools/llvm-objcopy/ELF/cross-arch-sections-symbols.test index d2da14e60a450d..937a3e6aa2686e 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/cross-arch-sections-symbols.test +++ b/llvm/test/tools/llvm-objcopy/ELF/cross-arch-sections-symbols.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # Preserve input to verify it is not modified. # RUN: cp %t.o %t-copy.o # RUN: llvm-objcopy %t.o -O elf64-x86-64 %t.2.o diff --git a/llvm/test/tools/llvm-objcopy/ELF/deterministic-archive.test b/llvm/test/tools/llvm-objcopy/ELF/deterministic-archive.test index fd520fb9ed7f21..b102a416265068 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/deterministic-archive.test +++ b/llvm/test/tools/llvm-objcopy/ELF/deterministic-archive.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # Create an archive, specifying U so that timestamps/etc. are preserved. # We only test timestamps as a proxy for full deterministic writing; i.e. we diff --git a/llvm/test/tools/llvm-objcopy/ELF/discard-all.test b/llvm/test/tools/llvm-objcopy/ELF/discard-all.test index f27c16179965cf..50cad3ae9f5334 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/discard-all.test +++ b/llvm/test/tools/llvm-objcopy/ELF/discard-all.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: cp %t %t1 # RUN: llvm-objcopy --discard-all %t %t2 # Verify that llvm-objcopy has not modified the input. diff --git a/llvm/test/tools/llvm-objcopy/ELF/discard-locals-rel.test b/llvm/test/tools/llvm-objcopy/ELF/discard-locals-rel.test index 5fce41d2fd7c27..3658eb376010a6 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/discard-locals-rel.test +++ b/llvm/test/tools/llvm-objcopy/ELF/discard-locals-rel.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy --discard-locals %t %t2 2>&1 | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-objcopy/ELF/discard-locals.test b/llvm/test/tools/llvm-objcopy/ELF/discard-locals.test index ef8a293f0df73e..4aba1cd1c782ae 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/discard-locals.test +++ b/llvm/test/tools/llvm-objcopy/ELF/discard-locals.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: cp %t %t1 # RUN: llvm-objcopy --discard-locals %t %t2 # Verify that llvm-objcopy has not modified the input. diff --git a/llvm/test/tools/llvm-objcopy/ELF/discard-mix-local-and-all.test b/llvm/test/tools/llvm-objcopy/ELF/discard-mix-local-and-all.test index 8bb39f6a6153ae..986eb9c8239acc 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/discard-mix-local-and-all.test +++ b/llvm/test/tools/llvm-objcopy/ELF/discard-mix-local-and-all.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # Establish baseline objects for further checks. --discard-locals only discards # compiler-generated local symbols (starting with .L), --discard-all discards # all regular local symbols. diff --git a/llvm/test/tools/llvm-objcopy/ELF/dump-section.test b/llvm/test/tools/llvm-objcopy/ELF/dump-section.test index 1e56c72622d6f2..176cc791801aab 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/dump-section.test +++ b/llvm/test/tools/llvm-objcopy/ELF/dump-section.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy -O binary -j .text %t %t2 # RUN: llvm-objcopy -O binary --only-section .text %t %t3 # RUN: llvm-objcopy --dump-section .text=%t4 %t %t5 diff --git a/llvm/test/tools/llvm-objcopy/ELF/dynamic-relocations.test b/llvm/test/tools/llvm-objcopy/ELF/dynamic-relocations.test index 9c4d5b70cead6a..000cf5675bad9c 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/dynamic-relocations.test +++ b/llvm/test/tools/llvm-objcopy/ELF/dynamic-relocations.test @@ -1,7 +1,7 @@ ## Check that llvm-objcopy can handle an object ## containing dynamic relocations properly. -# RUN: yaml2obj %s > %t1 +# RUN: yaml2obj %s -o %t1 # RUN: llvm-objcopy %t1 %t2 # RUN: llvm-readobj --sections --section-data %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shinfo-reference.test b/llvm/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shinfo-reference.test index a66b38d59f7e1d..b5fd2ee3bc69b6 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shinfo-reference.test +++ b/llvm/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shinfo-reference.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy -R .got.plt %t %t2 ## .rela.plt is a dynamic relocation section that has a connection diff --git a/llvm/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shlink-reference.test b/llvm/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shlink-reference.test index 2ff68de381bff0..3cef37d85c94a5 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shlink-reference.test +++ b/llvm/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shlink-reference.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t ## Check we cannot remove the .dynsym symbol table because dynamic ## relocation section .rela.dyn still references it via sh_link field. diff --git a/llvm/test/tools/llvm-objcopy/ELF/dynstr.test b/llvm/test/tools/llvm-objcopy/ELF/dynstr.test index 68ec586649eb34..dab78df85d613a 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/dynstr.test +++ b/llvm/test/tools/llvm-objcopy/ELF/dynstr.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --sections --section-data %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/elf32be.test b/llvm/test/tools/llvm-objcopy/ELF/elf32be.test index 374b7994ae33db..a5f97389d94dfa 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/elf32be.test +++ b/llvm/test/tools/llvm-objcopy/ELF/elf32be.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/elf32le.test b/llvm/test/tools/llvm-objcopy/ELF/elf32le.test index b2cb40ce14119e..0c520e9975a7c1 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/elf32le.test +++ b/llvm/test/tools/llvm-objcopy/ELF/elf32le.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/elf64be.test b/llvm/test/tools/llvm-objcopy/ELF/elf64be.test index 97977b0c195e8b..fabee534790f71 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/elf64be.test +++ b/llvm/test/tools/llvm-objcopy/ELF/elf64be.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/empty-section.test b/llvm/test/tools/llvm-objcopy/ELF/empty-section.test index 5c55383ac09f81..4216c5d9b57cf8 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/empty-section.test +++ b/llvm/test/tools/llvm-objcopy/ELF/empty-section.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/explicit-keep-remove.test b/llvm/test/tools/llvm-objcopy/ELF/explicit-keep-remove.test index 6512afac0cf10e..60a88559bbe257 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/explicit-keep-remove.test +++ b/llvm/test/tools/llvm-objcopy/ELF/explicit-keep-remove.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy -R=.test --keep-section=.test %t %t2 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/explicit-only-section-remove.test b/llvm/test/tools/llvm-objcopy/ELF/explicit-only-section-remove.test index 5baf845abe7de2..d52e3440325e43 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/explicit-only-section-remove.test +++ b/llvm/test/tools/llvm-objcopy/ELF/explicit-only-section-remove.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy -R=.test --only-section=.test %t %t2 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/fail-no-output-directory.test b/llvm/test/tools/llvm-objcopy/ELF/fail-no-output-directory.test index 0eb39b9022b473..0a1784b860d68b 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/fail-no-output-directory.test +++ b/llvm/test/tools/llvm-objcopy/ELF/fail-no-output-directory.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy %t no/such/dir 2>&1 | FileCheck %s # Don't check "No such file" which is OS dependent. # CHECK: 'no/such/dir': diff --git a/llvm/test/tools/llvm-objcopy/ELF/globalize.test b/llvm/test/tools/llvm-objcopy/ELF/globalize.test index e1dcc04186f0a7..8869e2d7bc02cd 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/globalize.test +++ b/llvm/test/tools/llvm-objcopy/ELF/globalize.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --globalize-symbol Global \ # RUN: --globalize-symbol Local \ # RUN: --globalize-symbol Weak \ diff --git a/llvm/test/tools/llvm-objcopy/ELF/group-addr-misaligned.test b/llvm/test/tools/llvm-objcopy/ELF/group-addr-misaligned.test index bedef1ca7a5dd5..98e8110efed33c 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/group-addr-misaligned.test +++ b/llvm/test/tools/llvm-objcopy/ELF/group-addr-misaligned.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy %t %t2 2>&1 | FileCheck %s # CHECK: error: invalid alignment 1 of group section '.group' diff --git a/llvm/test/tools/llvm-objcopy/ELF/group-big-endian.test b/llvm/test/tools/llvm-objcopy/ELF/group-big-endian.test index e76e6e5d207c97..b8932736acc521 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/group-big-endian.test +++ b/llvm/test/tools/llvm-objcopy/ELF/group-big-endian.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --remove-section=.text.bar %t %t2 # RUN: llvm-readobj --elf-section-groups %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/group-reorder.test b/llvm/test/tools/llvm-objcopy/ELF/group-reorder.test index 25c57bea220f12..6e0d4b9518cc8d 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/group-reorder.test +++ b/llvm/test/tools/llvm-objcopy/ELF/group-reorder.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-objcopy %t.o %t.2.o # RUN: llvm-readelf --elf-section-groups --sections %t.o | FileCheck %s --check-prefix=IN # RUN: llvm-readelf --elf-section-groups --sections %t.2.o | FileCheck %s --check-prefix=OUT diff --git a/llvm/test/tools/llvm-objcopy/ELF/group-unchanged.test b/llvm/test/tools/llvm-objcopy/ELF/group-unchanged.test index f5f74b414bb1a9..e7d9664fe2f39d 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/group-unchanged.test +++ b/llvm/test/tools/llvm-objcopy/ELF/group-unchanged.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --remove-section=.text.bar %t %t2 # RUN: llvm-readobj --elf-section-groups %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/group.test b/llvm/test/tools/llvm-objcopy/ELF/group.test index ea84f25eb0f20c..f82834edbd9222 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/group.test +++ b/llvm/test/tools/llvm-objcopy/ELF/group.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --remove-section=.text.bar %t %t2 # RUN: llvm-readobj --elf-section-groups %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/hexagon-unsupported-on-x86.test b/llvm/test/tools/llvm-objcopy/ELF/hexagon-unsupported-on-x86.test index 70a477c6e36aad..749f6b10b825dd 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/hexagon-unsupported-on-x86.test +++ b/llvm/test/tools/llvm-objcopy/ELF/hexagon-unsupported-on-x86.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy %t %t2 2>&1 >/dev/null | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-objcopy/ELF/keep-file-symbols.test b/llvm/test/tools/llvm-objcopy/ELF/keep-file-symbols.test index 86674f1eb2d261..30e4aae225c4d8 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/keep-file-symbols.test +++ b/llvm/test/tools/llvm-objcopy/ELF/keep-file-symbols.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --strip-all --keep-file-symbols %t %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s --check-prefix=STRIPALL # RUN: llvm-objcopy --keep-file-symbols --strip-symbol foo %t %t2 diff --git a/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols-mix-globalize.test b/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols-mix-globalize.test index 8fecc7a146aa36..120b76876854fc 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols-mix-globalize.test +++ b/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols-mix-globalize.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # Tests --keep-global-symbol when used in combination with --globalize-symbol on # a different symbol. diff --git a/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols.test b/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols.test index cb4d9110578b04..a6ba1bee7c36d8 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols.test +++ b/llvm/test/tools/llvm-objcopy/ELF/keep-global-symbols.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # Tests that only global symbols (via -G/--keep-global-symbols) are kept via # the several different variants of -G/--keep-global-symbol(s). diff --git a/llvm/test/tools/llvm-objcopy/ELF/keep-many.test b/llvm/test/tools/llvm-objcopy/ELF/keep-many.test index 1abcb16dfca64f..04649d675d4148 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/keep-many.test +++ b/llvm/test/tools/llvm-objcopy/ELF/keep-many.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --strip-non-alloc --keep-section=.test --keep-section=.test3 %t %t2 # RUN: llvm-objcopy --strip-non-alloc --regex --keep-section='^.test[0-9]+$' %t %t3 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/keep-only-section.test b/llvm/test/tools/llvm-objcopy/ELF/keep-only-section.test index 75b5bbd77d4312..c4c32c6c5e562f 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/keep-only-section.test +++ b/llvm/test/tools/llvm-objcopy/ELF/keep-only-section.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --keep-section=.test2 --only-section=.test %t %t2 # RUN: llvm-objcopy -j .test --keep-section=.test2 %t %t3 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/keep-symbol-remove-section.test b/llvm/test/tools/llvm-objcopy/ELF/keep-symbol-remove-section.test index 8b5fc97085858d..ba2f70fb76e423 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/keep-symbol-remove-section.test +++ b/llvm/test/tools/llvm-objcopy/ELF/keep-symbol-remove-section.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --remove-section .text --keep-symbol foo %t %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/keep-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/keep-symbol.test index 70a59fe1e4b491..b91510dff27d73 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/keep-symbol.test +++ b/llvm/test/tools/llvm-objcopy/ELF/keep-symbol.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --discard-all -K foo --keep-symbol bar %t %t2 # RUN: llvm-objcopy -K foo -N foo -N bar --keep-symbol bar -N baz %t %t3 # RUN: llvm-objcopy --discard-all --regex -K '^ba.*' %t %t4 diff --git a/llvm/test/tools/llvm-objcopy/ELF/localize-hidden.test b/llvm/test/tools/llvm-objcopy/ELF/localize-hidden.test index fe8639f74efdfb..ec44063ae7ed9a 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/localize-hidden.test +++ b/llvm/test/tools/llvm-objcopy/ELF/localize-hidden.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --localize-hidden %t %t2 # RUN: llvm-readobj --relocations --symbols %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/localize.test b/llvm/test/tools/llvm-objcopy/ELF/localize.test index 820ce1d5b60c49..8f8106eae73785 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/localize.test +++ b/llvm/test/tools/llvm-objcopy/ELF/localize.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy \ # RUN: --localize-symbol Global \ # RUN: -L GlobalUndef \ diff --git a/llvm/test/tools/llvm-objcopy/ELF/no-build-id-no-notes.test b/llvm/test/tools/llvm-objcopy/ELF/no-build-id-no-notes.test index be266fe71c52cd..6c3936d06c8b65 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/no-build-id-no-notes.test +++ b/llvm/test/tools/llvm-objcopy/ELF/no-build-id-no-notes.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy --build-id-link-dir=%t-dir --build-id-link-input=.debug %t 2>&1 >/dev/null | FileCheck %s # CHECK: could not find build ID diff --git a/llvm/test/tools/llvm-objcopy/ELF/no-build-id.test b/llvm/test/tools/llvm-objcopy/ELF/no-build-id.test index a66af944d2a55d..93e4a82641edf7 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/no-build-id.test +++ b/llvm/test/tools/llvm-objcopy/ELF/no-build-id.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy --build-id-link-dir=%t-dir --build-id-link-input=.debug %t 2>&1 >/dev/null | FileCheck %s -DINPUT=%t # CHECK: error: '[[INPUT]]': could not find build ID diff --git a/llvm/test/tools/llvm-objcopy/ELF/no-symbol-relocation.test b/llvm/test/tools/llvm-objcopy/ELF/no-symbol-relocation.test index eccc48b2134f2a..2c6a4b7d2e059b 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/no-symbol-relocation.test +++ b/llvm/test/tools/llvm-objcopy/ELF/no-symbol-relocation.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj --docnum=1 %s > %t1 +# RUN: yaml2obj --docnum=1 %s -o %t1 # RUN: llvm-objcopy %t1 %t2 # RUN: llvm-readobj --relocations %t2 | FileCheck %s @@ -31,7 +31,7 @@ Sections: ## Check we produce a valid output when stripping unneeded symbols from an object that ## has a symbol table and a relocation with a symbol index of 0. -# RUN: yaml2obj --docnum=2 %s > %t3 +# RUN: yaml2obj --docnum=2 %s -o %t3 # RUN: llvm-objcopy --strip-unneeded %t3 %t4 # RUN: llvm-readobj --relocations --sections --symbols %t4 | FileCheck %s --check-prefix=STRIP diff --git a/llvm/test/tools/llvm-objcopy/ELF/null-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/null-symbol.test index b7ac3e8cf1eb30..e9e73c97aa040c 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/null-symbol.test +++ b/llvm/test/tools/llvm-objcopy/ELF/null-symbol.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/only-section-many.test b/llvm/test/tools/llvm-objcopy/ELF/only-section-many.test index 9f1f77d04d0598..0735b693320a1a 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/only-section-many.test +++ b/llvm/test/tools/llvm-objcopy/ELF/only-section-many.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy -j .test1 -j .test2 %t %t2 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/only-section-remove-strtab.test b/llvm/test/tools/llvm-objcopy/ELF/only-section-remove-strtab.test index c88fef2fd0cdd7..71aae8af088f51 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/only-section-remove-strtab.test +++ b/llvm/test/tools/llvm-objcopy/ELF/only-section-remove-strtab.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy -R .symtab -R .strtab --only-section=.test %t %t2 # RUN: llvm-objcopy -j .test -R .strtab -R .symtab %t %t3 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/only-section-strip-non-alloc.test b/llvm/test/tools/llvm-objcopy/ELF/only-section-strip-non-alloc.test index ae39b51226b790..04fac204f3475a 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/only-section-strip-non-alloc.test +++ b/llvm/test/tools/llvm-objcopy/ELF/only-section-strip-non-alloc.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --strip-non-alloc --only-section=.test %t %t2 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/prefix-alloc-sections-dynrelocsec.test b/llvm/test/tools/llvm-objcopy/ELF/prefix-alloc-sections-dynrelocsec.test index 217fe55c446318..fbdd20dd529029 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/prefix-alloc-sections-dynrelocsec.test +++ b/llvm/test/tools/llvm-objcopy/ELF/prefix-alloc-sections-dynrelocsec.test @@ -1,7 +1,7 @@ ## Check that llvm-objcopy can correctly add a prefix to ## a dynamic relocation section and its target section. -# RUN: yaml2obj %s > %t1 +# RUN: yaml2obj %s -o %t1 # RUN: llvm-objcopy --prefix-alloc-sections=.prefix %t1 %t2 # RUN: llvm-readobj --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/prefix-alloc-sections.test b/llvm/test/tools/llvm-objcopy/ELF/prefix-alloc-sections.test index 4cb9df5330f7cb..731c332cb268df 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/prefix-alloc-sections.test +++ b/llvm/test/tools/llvm-objcopy/ELF/prefix-alloc-sections.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --prefix-alloc-sections=.prefix %t %t2 # RUN: llvm-readobj --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test index b359e5ea754965..7538a1c5d227e7 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test +++ b/llvm/test/tools/llvm-objcopy/ELF/prefix-symbols.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --prefix-symbols prefix %t %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s --check-prefix=COMMON --check-prefix=BASIC # RUN: llvm-objcopy --redefine-sym bar=baz --prefix-symbols prefix %t %t3 diff --git a/llvm/test/tools/llvm-objcopy/ELF/redefine-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/redefine-symbol.test index f5927bd4bd93a5..83506980e93373 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/redefine-symbol.test +++ b/llvm/test/tools/llvm-objcopy/ELF/redefine-symbol.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --redefine-sym foo=oof --redefine-sym empty= %t %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s # RUN: echo " bar rab #rename bar " > %t.rename1.txt diff --git a/llvm/test/tools/llvm-objcopy/ELF/regex.test b/llvm/test/tools/llvm-objcopy/ELF/regex.test index 9fe751fc8627c7..7f5683ffa92c6d 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/regex.test +++ b/llvm/test/tools/llvm-objcopy/ELF/regex.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # No symbol matches, because pattern is implicitly enveloped in '^$' # RUN: llvm-objcopy --discard-all --regex -K 'ba' %t %t2 diff --git a/llvm/test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test b/llvm/test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test index 4c161de1cc6574..54820180258627 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test +++ b/llvm/test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy -R .symtab %t %t2 2>&1 >/dev/null | FileCheck %s --check-prefix=ERR1 -DINPUT=%t # RUN: cp %t %t3 # RUN: not llvm-strip --no-strip-all -R .symtab %t3 2>&1 >/dev/null | FileCheck %s --check-prefix=ERR2 -DINPUT=%t3 diff --git a/llvm/test/tools/llvm-objcopy/ELF/reloc-no-symtab.test b/llvm/test/tools/llvm-objcopy/ELF/reloc-no-symtab.test index 96bf4d3f77dc57..90f47c6d227fd3 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/reloc-no-symtab.test +++ b/llvm/test/tools/llvm-objcopy/ELF/reloc-no-symtab.test @@ -5,7 +5,7 @@ # $ llvm-strip /tmp/a -o /tmp/b # llvm-strip: error: Link field value 0 in section .rela.plt is invalid. -# RUN: yaml2obj %s > %t.original +# RUN: yaml2obj %s -o %t.original # RUN: llvm-strip %t.original -o %t.stripped # RUN: llvm-readobj --sections %t.original | FileCheck %s # RUN: llvm-readobj --sections %t.stripped | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/relocatable-phdr.test b/llvm/test/tools/llvm-objcopy/ELF/relocatable-phdr.test index 40216467a2439a..036d5a6be9abb4 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/relocatable-phdr.test +++ b/llvm/test/tools/llvm-objcopy/ELF/relocatable-phdr.test @@ -1,6 +1,6 @@ # This test ensures an object without a program header will retain zero values # for offset and header size when copied with llvm-objcopy. -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --file-headers %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/remove-multiple-sections.test b/llvm/test/tools/llvm-objcopy/ELF/remove-multiple-sections.test index a162303ccacfbe..ddc4cefd22194c 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/remove-multiple-sections.test +++ b/llvm/test/tools/llvm-objcopy/ELF/remove-multiple-sections.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy -R .test2 -R .test3 -R .test5 %t %t2 # RUN: llvm-readobj --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/remove-section-with-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/remove-section-with-symbol.test index 598da16842600e..f1f1996ad0a96b 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/remove-section-with-symbol.test +++ b/llvm/test/tools/llvm-objcopy/ELF/remove-section-with-symbol.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy -R .test %t %t2 # RUN: llvm-readobj --file-headers --symbols %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/remove-section.test b/llvm/test/tools/llvm-objcopy/ELF/remove-section.test index 927485a60020f8..c06b9eb44af04c 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/remove-section.test +++ b/llvm/test/tools/llvm-objcopy/ELF/remove-section.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: cp %t %t1 # RUN: llvm-objcopy -R .test2 %t %t2 diff --git a/llvm/test/tools/llvm-objcopy/ELF/remove-shstrtab-error.test b/llvm/test/tools/llvm-objcopy/ELF/remove-shstrtab-error.test index 797681fa036b31..d2852ffb013632 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/remove-shstrtab-error.test +++ b/llvm/test/tools/llvm-objcopy/ELF/remove-shstrtab-error.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy -R .shstrtab %t %t2 2>&1 >/dev/null | FileCheck %s -DINPUT=%t !ELF diff --git a/llvm/test/tools/llvm-objcopy/ELF/remove-symtab.test b/llvm/test/tools/llvm-objcopy/ELF/remove-symtab.test index 5c53962b14b38f..54f69e5ba010e6 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/remove-symtab.test +++ b/llvm/test/tools/llvm-objcopy/ELF/remove-symtab.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy -R .symtab %t %t2 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/rename-section-and-prefix-alloc-sections.test b/llvm/test/tools/llvm-objcopy/ELF/rename-section-and-prefix-alloc-sections.test index fd642b6e3a46b4..112eb2684148d5 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/rename-section-and-prefix-alloc-sections.test +++ b/llvm/test/tools/llvm-objcopy/ELF/rename-section-and-prefix-alloc-sections.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --rename-section=.text=.text2 --rename-section=.data=.data2 --prefix-alloc-sections=.prefix %t %t2 # RUN: llvm-readobj --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag-osproc-mask.test b/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag-osproc-mask.test index ae572a6023f74b..f0f3c2d86a306f 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag-osproc-mask.test +++ b/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag-osproc-mask.test @@ -2,7 +2,7 @@ # ===== x86_64 ===== -# RUN: yaml2obj --docnum 1 %s > %t-x86_64.o +# RUN: yaml2obj --docnum=1 %s -o %t-x86_64.o # RUN: llvm-objcopy --rename-section=.foo=.bar,alloc %t-x86_64.o # RUN: llvm-readobj --sections %t-x86_64.o | FileCheck %s --check-prefix=X86_64 @@ -27,7 +27,7 @@ Sections: # ===== hex ===== -# RUN: yaml2obj --docnum 2 %s > %t-hex.o +# RUN: yaml2obj --docnum=2 %s -o %t-hex.o # RUN: llvm-objcopy --rename-section=.foo=.bar,alloc %t-hex.o # RUN: llvm-readobj --sections %t-hex.o | FileCheck %s --check-prefix=HEX @@ -52,7 +52,7 @@ Sections: # ===== mips ===== -# RUN: yaml2obj --docnum 3 %s > %t-mips.o +# RUN: yaml2obj --docnum=3 %s -o %t-mips.o # RUN: llvm-objcopy --rename-section=.foo=.bar,alloc %t-mips.o # RUN: llvm-readobj --sections %t-mips.o | FileCheck %s --check-prefix=MIPS @@ -88,7 +88,7 @@ Sections: # ===== arm ===== -# RUN: yaml2obj --docnum 4 %s > %t-arm.o +# RUN: yaml2obj --docnum=4 %s -o %t-arm.o # RUN: llvm-objcopy --rename-section=.foo=.bar,alloc %t-arm.o # RUN: llvm-readobj --sections %t-arm.o | FileCheck %s --check-prefix=ARM diff --git a/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag-preserved.test b/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag-preserved.test index e22920fe4e2796..e3e0a3dac04c1f 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag-preserved.test +++ b/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag-preserved.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # Single flags on a section with all flags: # RUN: llvm-objcopy --rename-section=.foo=.bar,alloc %t %t.alloc diff --git a/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag.test b/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag.test index 2638a7c1fdf40e..129f4c16e44b91 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag.test +++ b/llvm/test/tools/llvm-objcopy/ELF/rename-section-flag.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # Single flags on a section with no flags: # RUN: llvm-objcopy --rename-section=.foo=.bar,alloc \ diff --git a/llvm/test/tools/llvm-objcopy/ELF/rename-section-multiple.test b/llvm/test/tools/llvm-objcopy/ELF/rename-section-multiple.test index c508ac80c3068d..eac0ce013b9732 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/rename-section-multiple.test +++ b/llvm/test/tools/llvm-objcopy/ELF/rename-section-multiple.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --rename-section=.test1=.test2 --rename-section=.test3=.test4 --rename-section=.test5=.test6 %t %t2 # RUN: llvm-readobj --file-headers --sections --section-data %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/rename-section.test b/llvm/test/tools/llvm-objcopy/ELF/rename-section.test index c8a1eafaa30294..b2927c28b2eef1 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/rename-section.test +++ b/llvm/test/tools/llvm-objcopy/ELF/rename-section.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --rename-section=.foo=.bar %t %t2 # RUN: llvm-readobj --file-headers --sections --section-data %t2 | FileCheck %s # RUN: not llvm-objcopy --rename-section=.foo.bar --rename-section=.foo=.other %t %t2 2>&1 | FileCheck %s --check-prefix=BAD-FORMAT diff --git a/llvm/test/tools/llvm-objcopy/ELF/section-index-unsupported.test b/llvm/test/tools/llvm-objcopy/ELF/section-index-unsupported.test index 6c60bf5547e3a1..8479d00c24852e 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/section-index-unsupported.test +++ b/llvm/test/tools/llvm-objcopy/ELF/section-index-unsupported.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy %t %t2 2>&1 >/dev/null | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-objcopy/ELF/set-section-flags-and-rename.test b/llvm/test/tools/llvm-objcopy/ELF/set-section-flags-and-rename.test index 15ea3aeec1618a..4b553b3304e450 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/set-section-flags-and-rename.test +++ b/llvm/test/tools/llvm-objcopy/ELF/set-section-flags-and-rename.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy --rename-section=.foo=.bar --set-section-flags=.foo=alloc %t %t.2 2>&1 | FileCheck %s --check-prefix=SET-FOO # RUN: not llvm-objcopy --rename-section=.foo=.bar --set-section-flags=.bar=alloc %t %t.2 2>&1 | FileCheck %s --check-prefix=SET-BAR diff --git a/llvm/test/tools/llvm-objcopy/ELF/set-section-flags-multiple.test b/llvm/test/tools/llvm-objcopy/ELF/set-section-flags-multiple.test index 41732f3807da35..dd469ab512f27b 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/set-section-flags-multiple.test +++ b/llvm/test/tools/llvm-objcopy/ELF/set-section-flags-multiple.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --set-section-flags=.foo=alloc --set-section-flags=.bar=code %t %t.2 # RUN: llvm-readobj --sections %t.2 | FileCheck %s --check-prefixes=CHECK,ALLOC,WRITE diff --git a/llvm/test/tools/llvm-objcopy/ELF/set-section-flags.test b/llvm/test/tools/llvm-objcopy/ELF/set-section-flags.test index 54e3736e49be11..db063fd96e5963 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/set-section-flags.test +++ b/llvm/test/tools/llvm-objcopy/ELF/set-section-flags.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # Single flags on a section with no flags: # RUN: llvm-objcopy --set-section-flags=.foo=alloc \ diff --git a/llvm/test/tools/llvm-objcopy/ELF/shstrtab-optimize.test b/llvm/test/tools/llvm-objcopy/ELF/shstrtab-optimize.test index 8b1da2141aa50e..19c1b674a36b35 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/shstrtab-optimize.test +++ b/llvm/test/tools/llvm-objcopy/ELF/shstrtab-optimize.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-keep-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-keep-symbol.test index 8ff1aa4a5e32bc..10228e6219b7f2 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-keep-symbol.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-keep-symbol.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: cp %t %t1 # RUN: llvm-objcopy --strip-all --keep-symbol foo %t %t2 # RUN: llvm-readobj --sections --symbols %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-remove.test b/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-remove.test index 15a6f4f7ccaf7f..e190a7eab2a3e9 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-remove.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-all-and-remove.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: cp %t %t1 # RUN: llvm-strip --remove-section=.text.bar %t diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-all-gnu.test b/llvm/test/tools/llvm-objcopy/ELF/strip-all-gnu.test index 727a91b612dbe2..7df3d3b3c91acc 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-all-gnu.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-all-gnu.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --strip-all-gnu %t %t2 # RUN: llvm-strip --strip-all-gnu %t -o %t3 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-all.test b/llvm/test/tools/llvm-objcopy/ELF/strip-all.test index dabb9ef6a91a9a..cba3f1490184e5 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-all.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-all.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: cp %t %t3 # RUN: llvm-objcopy --strip-all %t %t2 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-debug-and-remove.test b/llvm/test/tools/llvm-objcopy/ELF/strip-debug-and-remove.test index da7659294b790e..ed782a1fad5cce 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-debug-and-remove.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-debug-and-remove.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: cp %t %t1 # RUN: llvm-strip --strip-debug --remove-section=.text.bar %t diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-debug.test b/llvm/test/tools/llvm-objcopy/ELF/strip-debug.test index c4440bf7eca698..711f9d3b6d89e0 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-debug.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-debug.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: cp %t %t3 # RUN: llvm-objcopy --strip-debug %t %t2 # RUN: llvm-readobj --file-headers --sections --symbols %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-group-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/strip-group-symbol.test index acca56c7cef3d0..65658999f7ac03 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-group-symbol.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-group-symbol.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy -N foo %t %t2 2>&1 | FileCheck %s --- !ELF diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-multiple-files.test b/llvm/test/tools/llvm-objcopy/ELF/strip-multiple-files.test index b22974afd4d5d2..a6af9496ebac55 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-multiple-files.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-multiple-files.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # Run llvm-strip normally. This will create a stripped object file for later # tests so we only have to run FileCheck on it once. diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-non-alloc.test b/llvm/test/tools/llvm-objcopy/ELF/strip-non-alloc.test index 1f082bf47344df..cf6561d0891a15 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-non-alloc.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-non-alloc.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --strip-non-alloc %t %t2 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-preserve-arm-attributes.test b/llvm/test/tools/llvm-objcopy/ELF/strip-preserve-arm-attributes.test index 2dcca66df1a629..0434ff137cdff5 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-preserve-arm-attributes.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-preserve-arm-attributes.test @@ -2,7 +2,7 @@ ## .ARM.attributes sections in ELF files. This is needed to maintain ## compatibility for Ubuntu/Debian distributions on ARM. -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --strip-all %t %t2 # RUN: llvm-readobj --sections %t2 | FileCheck %s # RUN: llvm-objcopy --strip-all-gnu %t %t3 diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-preserve-atime.test b/llvm/test/tools/llvm-objcopy/ELF/strip-preserve-atime.test index aad537cf48eb46..f23ece4d4455e5 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-preserve-atime.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-preserve-atime.test @@ -3,7 +3,7 @@ # UNSUPPORTED: system-netbsd # Preserve dates when stripping to an output file. -# RUN: yaml2obj %s > %t.1.o +# RUN: yaml2obj %s -o %t.1.o # RUN: touch -a -t 199505050555.55 %t.1.o # RUN: llvm-strip -p %t.1.o -o %t-preserved.1.o # RUN: ls -lu %t-preserved.1.o | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME @@ -11,28 +11,28 @@ # RUN: llvm-readobj %t-preserved.1.o # Preserve dates available via objcopy interface as well. -# RUN: yaml2obj %s > %t.2.o +# RUN: yaml2obj %s -o %t.2.o # RUN: touch -a -t 199505050555.55 %t.2.o # RUN: llvm-objcopy -p %t.2.o %t-preserved.2.o # RUN: ls -lu %t-preserved.2.o | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME # RUN: llvm-readobj %t-preserved.2.o # Preserve dates when stripping in place. -# RUN: yaml2obj %s > %t.3.o +# RUN: yaml2obj %s -o %t.3.o # RUN: touch -a -t 199505050555.55 %t.3.o # RUN: llvm-strip -p %t.3.o # RUN: ls -lu %t.3.o | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME # RUN: llvm-readobj %t.3.o # Without -p set, don't preserve dates. -# RUN: yaml2obj %s > %t.4.o +# RUN: yaml2obj %s -o %t.4.o # RUN: touch -a -t 199505050555.55 %t.4.o # RUN: llvm-strip %t.4.o # RUN: ls -lu %t.4.o | FileCheck %s --check-prefix=CHECK-NO-PRESERVE-ATIME # RUN: llvm-readobj %t.4.o # Preserve dates in archives. -# RUN: yaml2obj %s > %t.5.o +# RUN: yaml2obj %s -o %t.5.o # RUN: rm -f %t.a # RUN: llvm-ar cr %t.a %t.5.o # RUN: touch -a -t 199505050555.55 %t.a diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-preserve-mtime.test b/llvm/test/tools/llvm-objcopy/ELF/strip-preserve-mtime.test index 5f247aefdbf8f1..aa1c37a1428fcb 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-preserve-mtime.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-preserve-mtime.test @@ -1,7 +1,7 @@ # Note: ls -l prints the modified timestamp # Preserve dates when stripping to an output file. -# RUN: yaml2obj %s > %t.1.o +# RUN: yaml2obj %s -o %t.1.o # RUN: touch -m -t 199705050555.55 %t.1.o # RUN: llvm-strip -p %t.1.o -o %t-preserved.1.o # RUN: ls -l %t-preserved.1.o | FileCheck %s --check-prefix=CHECK-PRESERVE-MTIME @@ -9,28 +9,28 @@ # RUN: llvm-readobj %t-preserved.1.o # Preserve dates available via objcopy interface as well. -# RUN: yaml2obj %s > %t.2.o +# RUN: yaml2obj %s -o %t.2.o # RUN: touch -m -t 199705050555.55 %t.2.o # RUN: llvm-objcopy -p %t.2.o %t-preserved.2.o # RUN: ls -l %t-preserved.2.o | FileCheck %s --check-prefix=CHECK-PRESERVE-MTIME # RUN: llvm-readobj %t-preserved.2.o # Preserve dates when stripping in place. -# RUN: yaml2obj %s > %t.3.o +# RUN: yaml2obj %s -o %t.3.o # RUN: touch -m -t 199705050555.55 %t.3.o # RUN: llvm-strip -p %t.3.o # RUN: ls -l %t.3.o | FileCheck %s --check-prefix=CHECK-PRESERVE-MTIME # RUN: llvm-readobj %t.3.o # Without -p set, don't preserve dates. -# RUN: yaml2obj %s > %t.4.o +# RUN: yaml2obj %s -o %t.4.o # RUN: touch -m -t 199705050555.55 %t.4.o # RUN: llvm-strip %t.4.o # RUN: ls -l %t.4.o | FileCheck %s --check-prefix=CHECK-NO-PRESERVE-MTIME # RUN: llvm-readobj %t.4.o # Preserve dates in archives. -# RUN: yaml2obj %s > %t.5.o +# RUN: yaml2obj %s -o %t.5.o # RUN: rm -f %t.a # RUN: llvm-ar cr %t.a %t.5.o # RUN: touch -m -t 199705050555.55 %t.a diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-reloc-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/strip-reloc-symbol.test index 99b5d51c0e8835..63c9e122d9a216 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-reloc-symbol.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-reloc-symbol.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy -N foo %t %t2 2>&1 | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-section-err.test b/llvm/test/tools/llvm-objcopy/ELF/strip-section-err.test index 8f0a809b7f87d6..7f53cf65bdf92d 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-section-err.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-section-err.test @@ -1,14 +1,14 @@ ## Check we cannot remove a section containing symbols ## referenced by relocations contained in the object. -# RUN: yaml2obj %s > %t1 +# RUN: yaml2obj %s -o %t1 # RUN: not llvm-objcopy -R .data %t1 2>&1 | FileCheck %s -DINPUT=%t1 # CHECK: error: '[[INPUT]]': section '.data' cannot be removed: (.text+0x1) has relocation against symbol 'foo' ## Check the behavior when we also remove the relocation section. ## We have no reference in this case and hence no error should be emitted. -# RUN: yaml2obj %s > %t2 +# RUN: yaml2obj %s -o %t2 # RUN: llvm-objcopy -R .data -R .rela.text %t2 %t3 # RUN: llvm-objdump --section-headers %t3 | FileCheck %s --check-prefix=NOSEC # NOSEC-NOT: .data diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-sections-keep.test b/llvm/test/tools/llvm-objcopy/ELF/strip-sections-keep.test index 711687f9253bef..ebf32006b4a2a1 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-sections-keep.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-sections-keep.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --strip-sections --keep-section=.shstrtab %t %t2 # RUN: od -Ax -t c %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-sections-only-section.test b/llvm/test/tools/llvm-objcopy/ELF/strip-sections-only-section.test index e2236a9fdd9616..054a3969fd28f2 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-sections-only-section.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-sections-only-section.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --strip-sections --only-section=.test %t %t2 # RUN: od -Ax -t x1 %t2 | FileCheck %s # RUN: od -Ax -t c %t2 | FileCheck %s --check-prefix=TEXT diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-sections.test b/llvm/test/tools/llvm-objcopy/ELF/strip-sections.test index d17dc33c5bc1bc..68bc07fcde062d 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-sections.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-sections.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --strip-sections %t %t2 # RUN: llvm-readobj --file-headers --program-headers %t2 | FileCheck %s # RUN: od -t x1 -j 4096 -N 12 %t2 | FileCheck %s --ignore-case --check-prefix=DATA diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-symbol-and-relocation.test b/llvm/test/tools/llvm-objcopy/ELF/strip-symbol-and-relocation.test index 76833c04713ad8..d1147feb9c2902 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-symbol-and-relocation.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-symbol-and-relocation.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t ## Check we are able to strip all symbols and relocatable information at the same time. diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-symbol.test b/llvm/test/tools/llvm-objcopy/ELF/strip-symbol.test index e63aaae40285ed..78de46cc47b5d4 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-symbol.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-symbol.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --strip-symbol baz -N bar %t %t2 # RUN: llvm-readobj --symbols --sections %t2 | FileCheck %s # RUN: llvm-strip --strip-symbol baz -N bar %t -o %t3 diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded-all-symbols.test b/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded-all-symbols.test index e2fd420211582b..c66a5235315801 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded-all-symbols.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded-all-symbols.test @@ -2,7 +2,7 @@ ## eliminate the static symbol table, because it's not used ## by the dynamic loader. -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: cp %t %t1 # RUN: llvm-objcopy --strip-unneeded %t %t2 # RUN: llvm-readobj --section-headers %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded-remove-debug-keep-link.test b/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded-remove-debug-keep-link.test index 948bfea2d9c533..6bc5300d2081c9 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded-remove-debug-keep-link.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded-remove-debug-keep-link.test @@ -1,7 +1,7 @@ ## Verifies that running with --strip-unneeded removes debugging sections but ## retains the .gnu_debuglink section. -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: touch %t.debug # RUN: llvm-objcopy --add-gnu-debuglink=%t.debug %t.o %t.2.o # RUN: llvm-strip --strip-unneeded %t.2.o -o %t.3.o diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded.test b/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded.test index 98d031cd2c7735..0556a4f127e0a6 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: cp %t %t1 # RUN: llvm-objcopy --strip-unneeded %t %t2 # Verify that llvm-objcopy has not modified the input. diff --git a/llvm/test/tools/llvm-objcopy/ELF/strtab-optimize.test b/llvm/test/tools/llvm-objcopy/ELF/strtab-optimize.test index 41f86814a8030d..10b17a622a0542 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strtab-optimize.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strtab-optimize.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 --add-symbol='foo=1' --add-symbol='foofoo=2' # RUN: llvm-readobj --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/symbol-copy.test b/llvm/test/tools/llvm-objcopy/ELF/symbol-copy.test index 9e70a81ed8582e..a71ccfd7e858cb 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/symbol-copy.test +++ b/llvm/test/tools/llvm-objcopy/ELF/symbol-copy.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/symbol-empty-name.test b/llvm/test/tools/llvm-objcopy/ELF/symbol-empty-name.test index f2a5b1ac2ce6ac..84f6ff75a9220b 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/symbol-empty-name.test +++ b/llvm/test/tools/llvm-objcopy/ELF/symbol-empty-name.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test b/llvm/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test index 4aac930e46986a..d74a755d257e28 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test +++ b/llvm/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy -R .strtab %t %t2 2>&1 >/dev/null | FileCheck %s --check-prefix=ERR1 -DINPUT=%t # RUN: cp %t %t3 # RUN: not llvm-strip --no-strip-all -R .strtab %t3 2>&1 >/dev/null | FileCheck %s --check-prefix=ERR2 -DINPUT=%t3 diff --git a/llvm/test/tools/llvm-objcopy/ELF/symtab-link.test b/llvm/test/tools/llvm-objcopy/ELF/symtab-link.test index 8297529cb65299..701e4a397456a2 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/symtab-link.test +++ b/llvm/test/tools/llvm-objcopy/ELF/symtab-link.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --sections %t2 | FileCheck %s # RUN: cp %t %t3 diff --git a/llvm/test/tools/llvm-objcopy/ELF/weaken-all.test b/llvm/test/tools/llvm-objcopy/ELF/weaken-all.test index ab83c6565627e9..6fd8b64715f915 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/weaken-all.test +++ b/llvm/test/tools/llvm-objcopy/ELF/weaken-all.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --weaken %t %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/ELF/weaken.test b/llvm/test/tools/llvm-objcopy/ELF/weaken.test index 09f2476e0b2658..3c4a711360695e 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/weaken.test +++ b/llvm/test/tools/llvm-objcopy/ELF/weaken.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy --weaken-symbol Global -W Local -W Weak %t %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s # RUN: llvm-objcopy --regex --weaken-symbol='.*' %t %t3 diff --git a/llvm/test/tools/llvm-objcopy/ELF/wildcard-flags.test b/llvm/test/tools/llvm-objcopy/ELF/wildcard-flags.test index 29a91cd1dc6380..49f183858822cd 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/wildcard-flags.test +++ b/llvm/test/tools/llvm-objcopy/ELF/wildcard-flags.test @@ -3,7 +3,7 @@ ## are configured correctly. ## For more detailed syntax tests, see wildcard-syntax.test. -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o ## Check that --regex and --wildcard cannot be used together. # RUN: not llvm-objcopy --regex --wildcard %t.o %t.err.o 2>&1 \ diff --git a/llvm/test/tools/llvm-objcopy/ELF/wildcard-syntax.test b/llvm/test/tools/llvm-objcopy/ELF/wildcard-syntax.test index 685ba16070484c..67f7f0b273c989 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/wildcard-syntax.test +++ b/llvm/test/tools/llvm-objcopy/ELF/wildcard-syntax.test @@ -1,7 +1,7 @@ ## This test checks that llvm-objcopy accepts glob (or "shell wildcard") syntax ## for the --wildcard (-w) flag correctly. -# RUN: yaml2obj --docnum=1 %s > %t.o +# RUN: yaml2obj --docnum=1 %s -o %t.o ## * matches all characters. # RUN: llvm-objcopy --remove-section='.f*' %t.o %t.glob.o @@ -61,7 +61,7 @@ Symbols: [] ## Use a separate test file with special characters for the following tests. -# RUN: yaml2obj --docnum=2 %s > %t.special.o +# RUN: yaml2obj --docnum=2 %s -o %t.special.o ## \ escapes wildcard characters. # RUN: llvm-objcopy --remove-section='\*' %t.special.o %t.escape.1.o diff --git a/llvm/test/tools/llvm-objcopy/MachO/basic-big-endian-32-copy.test b/llvm/test/tools/llvm-objcopy/MachO/basic-big-endian-32-copy.test index 692fb50f058169..083011badc3bad 100644 --- a/llvm/test/tools/llvm-objcopy/MachO/basic-big-endian-32-copy.test +++ b/llvm/test/tools/llvm-objcopy/MachO/basic-big-endian-32-copy.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: cmp %t %t2 diff --git a/llvm/test/tools/llvm-objcopy/MachO/basic-big-endian-64-copy.test b/llvm/test/tools/llvm-objcopy/MachO/basic-big-endian-64-copy.test index 5294f4e5be134c..ff8e4a0096bb89 100644 --- a/llvm/test/tools/llvm-objcopy/MachO/basic-big-endian-64-copy.test +++ b/llvm/test/tools/llvm-objcopy/MachO/basic-big-endian-64-copy.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: cmp %t %t2 diff --git a/llvm/test/tools/llvm-objcopy/MachO/basic-executable-copy.test b/llvm/test/tools/llvm-objcopy/MachO/basic-executable-copy.test index 85eebad2870928..ce176b683024c1 100644 --- a/llvm/test/tools/llvm-objcopy/MachO/basic-executable-copy.test +++ b/llvm/test/tools/llvm-objcopy/MachO/basic-executable-copy.test @@ -2,7 +2,7 @@ ## uses llvm-readobj instead of cmp because some parts of the object ## (e.g., the string table) are not identical; the output file is correct but ## some offsets differ from the input file. -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objcopy/MachO/basic-little-endian-32-copy.test b/llvm/test/tools/llvm-objcopy/MachO/basic-little-endian-32-copy.test index c43aed7004bab4..7e6663945179aa 100644 --- a/llvm/test/tools/llvm-objcopy/MachO/basic-little-endian-32-copy.test +++ b/llvm/test/tools/llvm-objcopy/MachO/basic-little-endian-32-copy.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: cmp %t %t2 diff --git a/llvm/test/tools/llvm-objcopy/MachO/basic-little-endian-64-copy.test b/llvm/test/tools/llvm-objcopy/MachO/basic-little-endian-64-copy.test index b395020b4bc414..18e3bbb997ea54 100644 --- a/llvm/test/tools/llvm-objcopy/MachO/basic-little-endian-64-copy.test +++ b/llvm/test/tools/llvm-objcopy/MachO/basic-little-endian-64-copy.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objcopy %t %t2 # RUN: cmp %t %t2 diff --git a/llvm/test/tools/llvm-objcopy/MachO/install-name-tool-add-rpath.test b/llvm/test/tools/llvm-objcopy/MachO/install-name-tool-add-rpath.test index 6d262019429a13..61aca209315a48 100644 --- a/llvm/test/tools/llvm-objcopy/MachO/install-name-tool-add-rpath.test +++ b/llvm/test/tools/llvm-objcopy/MachO/install-name-tool-add-rpath.test @@ -1,10 +1,10 @@ ## This test checks adding a new LC_RPATH load command to a MachO binary. -# RUN: yaml2obj %p/Inputs/i386.yaml > %t.i386 +# RUN: yaml2obj %p/Inputs/i386.yaml -o %t.i386 # RUN: llvm-install-name-tool -add_rpath @executable_path/. %t.i386 # RUN: llvm-objdump -p %t.i386 | FileCheck --check-prefix=NEW-RPATH %s -# RUN: yaml2obj %p/Inputs/x86_64.yaml > %t.x86_64 +# RUN: yaml2obj %p/Inputs/x86_64.yaml -o %t.x86_64 # RUN: llvm-install-name-tool -add_rpath @executable_path/. %t.x86_64 # RUN: llvm-objdump -p %t.x86_64 | FileCheck --check-prefix=NEW-RPATH %s diff --git a/llvm/test/tools/llvm-objcopy/MachO/min-version-load-commands.test b/llvm/test/tools/llvm-objcopy/MachO/min-version-load-commands.test index 42dce2e192c1af..504ea1e0d1552e 100644 --- a/llvm/test/tools/llvm-objcopy/MachO/min-version-load-commands.test +++ b/llvm/test/tools/llvm-objcopy/MachO/min-version-load-commands.test @@ -3,18 +3,18 @@ ## load command of this type (LC_VERSION_MIN_IPHONEOS, LC_VERSION_MIN_MACOSX, ## LC_VERSION_MIN_TVOS, LC_VERSION_MIN_WATCHOS). -# RUN: yaml2obj %p/Inputs/min_iphoneos_version_lc.yaml > %t.iphoneos +# RUN: yaml2obj %p/Inputs/min_iphoneos_version_lc.yaml -o %t.iphoneos # RUN: llvm-objcopy %t.iphoneos %t.iphoneos.copy # RUN: cmp %t.iphoneos %t.iphoneos.copy -# RUN: yaml2obj %p/Inputs/min_macos_version_lc.yaml > %t.macos +# RUN: yaml2obj %p/Inputs/min_macos_version_lc.yaml -o %t.macos # RUN: llvm-objcopy %t.macos %t.macos.copy # RUN: cmp %t.macos %t.macos.copy -# RUN: yaml2obj %p/Inputs/min_tvos_version_lc.yaml > %t.tvos +# RUN: yaml2obj %p/Inputs/min_tvos_version_lc.yaml -o %t.tvos # RUN: llvm-objcopy %t.tvos %t.tvos.copy # RUN: cmp %t.tvos %t.tvos.copy -# RUN: yaml2obj %p/Inputs/min_watchos_version_lc.yaml > %t.watchos +# RUN: yaml2obj %p/Inputs/min_watchos_version_lc.yaml -o %t.watchos # RUN: llvm-objcopy %t.watchos %t.watchos.copy # RUN: cmp %t.watchos %t.watchos.copy diff --git a/llvm/test/tools/llvm-objcopy/MachO/only-section.test b/llvm/test/tools/llvm-objcopy/MachO/only-section.test index 4e26031d2e5361..2caab80d0492a3 100644 --- a/llvm/test/tools/llvm-objcopy/MachO/only-section.test +++ b/llvm/test/tools/llvm-objcopy/MachO/only-section.test @@ -1,7 +1,7 @@ ## Show that if --only-section is given, llvm-objcopy removes all sections ## except ones specified in the option. -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t ## Specify all sections. The output file should be the same as the input. # RUN: llvm-objcopy -j __TEXT,__text -j __DATA,__data -j __TEXT,__const %t %t2 diff --git a/llvm/test/tools/llvm-objcopy/MachO/remove-section.test b/llvm/test/tools/llvm-objcopy/MachO/remove-section.test index beb4dd8ba5a332..a9f279c9490f55 100644 --- a/llvm/test/tools/llvm-objcopy/MachO/remove-section.test +++ b/llvm/test/tools/llvm-objcopy/MachO/remove-section.test @@ -1,7 +1,7 @@ ## Show that if --remove-section is given, llvm-objcopy removes sections ## specified by the option. -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t ## Remove only __TEXT,__text section. # RUN: llvm-objcopy --remove-section __TEXT,__text %t %t2 diff --git a/llvm/test/tools/llvm-objcopy/MachO/strip-all.test b/llvm/test/tools/llvm-objcopy/MachO/strip-all.test index 1a69234ac1bb8a..fe2bc979425a14 100644 --- a/llvm/test/tools/llvm-objcopy/MachO/strip-all.test +++ b/llvm/test/tools/llvm-objcopy/MachO/strip-all.test @@ -1,7 +1,7 @@ ## Show that llvm-objcopy/llvm-strip removes all symbols and debug sections. -# RUN: yaml2obj %p/Inputs/strip-all.yaml > %t.exec -# RUN: yaml2obj %p/Inputs/strip-all-with-dwarf.yaml > %t.dwarf +# RUN: yaml2obj %p/Inputs/strip-all.yaml -o %t.exec +# RUN: yaml2obj %p/Inputs/strip-all-with-dwarf.yaml -o %t.dwarf ## Check that the symbol list satisfies the order: local / defined external / ## undefined external, otherwise llvm-objcopy will fail. diff --git a/llvm/test/tools/llvm-objcopy/redefine-symbols.test b/llvm/test/tools/llvm-objcopy/redefine-symbols.test index 837294d3efe0ae..8f6cba0c824315 100644 --- a/llvm/test/tools/llvm-objcopy/redefine-symbols.test +++ b/llvm/test/tools/llvm-objcopy/redefine-symbols.test @@ -1,6 +1,6 @@ ## Test common parsing errors general to all supported binary formats. -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: not llvm-objcopy --redefine-sym bar %t /dev/null 2>&1 | FileCheck %s --check-prefix=BAD-FORMAT # BAD-FORMAT: bad format for --redefine-sym diff --git a/llvm/test/tools/llvm-objdump/X86/adjust-vma.test b/llvm/test/tools/llvm-objdump/X86/adjust-vma.test index 61eadaffa7e0c0..00eaffa50af451 100644 --- a/llvm/test/tools/llvm-objdump/X86/adjust-vma.test +++ b/llvm/test/tools/llvm-objdump/X86/adjust-vma.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objdump --all-headers -D -z %t | FileCheck %s --check-prefixes=COMMON,NOADJUST # RUN: llvm-objdump --all-headers -D -z --adjust-vma=0x0 %t | FileCheck %s --check-prefixes=COMMON,NOADJUST # RUN: llvm-objdump --all-headers -D -z --adjust-vma=0x123000 %t | FileCheck %s --check-prefixes=COMMON,ADJUST diff --git a/llvm/test/tools/llvm-objdump/X86/disassemble-demangle.test b/llvm/test/tools/llvm-objdump/X86/disassemble-demangle.test index 74f2b94075ed69..913e0e64203c6a 100644 --- a/llvm/test/tools/llvm-objdump/X86/disassemble-demangle.test +++ b/llvm/test/tools/llvm-objdump/X86/disassemble-demangle.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objdump -d -C %t | FileCheck --check-prefix=DEMANGLE %s # RUN: llvm-objdump -d --demangle %t | FileCheck --check-prefix=DEMANGLE %s # RUN: llvm-objdump -d %t | FileCheck --check-prefix=NO-DEMANGLE %s diff --git a/llvm/test/tools/llvm-objdump/X86/disassemble-zeroes-relocations.test b/llvm/test/tools/llvm-objdump/X86/disassemble-zeroes-relocations.test index ee8acb9edd4f97..b1504f054834e3 100644 --- a/llvm/test/tools/llvm-objdump/X86/disassemble-zeroes-relocations.test +++ b/llvm/test/tools/llvm-objdump/X86/disassemble-zeroes-relocations.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t ## Check we do not skip zeroes blocks if have relocations pointed to these places. # RUN: llvm-objdump -D --reloc %t diff --git a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-bss.test b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-bss.test index 01d3a49c9b510d..b5ff9e232c917c 100644 --- a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-bss.test +++ b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-bss.test @@ -1,7 +1,7 @@ ## Check that when BSS is larger than the file llvm-objdump doesn't ## assert with an unexpected end of file error. -# RUN: yaml2obj --docnum=1 %s > %t -# RUN: yaml2obj --docnum=2 %s > %t.2 +# RUN: yaml2obj --docnum=1 %s -o %t +# RUN: yaml2obj --docnum=2 %s -o %t.2 # RUN: llvm-objdump -D %t | FileCheck %s # RUN: llvm-objdump -D %t.2 | FileCheck %s diff --git a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs.test b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs.test index 74d374f0884d4d..a690328085e40c 100644 --- a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs.test +++ b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs.test @@ -63,7 +63,7 @@ Sections: Relocations: [] ## Check ranges of addends being displayed in a dump of relocations mixed with disassembly. -# RUN: yaml2obj --docnum=3 %s > %t3 +# RUN: yaml2obj --docnum=3 %s -o %t3 # RUN: llvm-objdump -d -r %t3 | FileCheck %s --check-prefix=ADDENDS # ADDENDS: Disassembly of section .text: diff --git a/llvm/test/tools/llvm-objdump/X86/output-ordering.test b/llvm/test/tools/llvm-objdump/X86/output-ordering.test index 0d629af91e007d..6fe1a00512ed88 100644 --- a/llvm/test/tools/llvm-objdump/X86/output-ordering.test +++ b/llvm/test/tools/llvm-objdump/X86/output-ordering.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-objdump --file-headers --private-headers --section-headers --syms \ # RUN: --full-contents --dwarf=frames \ # RUN: --reloc %t.o | FileCheck %s --check-prefixes=CHECK,RELOC diff --git a/llvm/test/tools/llvm-objdump/X86/phdrs-lma.test b/llvm/test/tools/llvm-objdump/X86/phdrs-lma.test index de1b982c0de781..c83373a3014a68 100644 --- a/llvm/test/tools/llvm-objdump/X86/phdrs-lma.test +++ b/llvm/test/tools/llvm-objdump/X86/phdrs-lma.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t ## Check we print both VMA and LMA correctly when dumping section headers. # RUN: llvm-objdump --section-headers %t | FileCheck %s diff --git a/llvm/test/tools/llvm-objdump/X86/phdrs-lma2.test b/llvm/test/tools/llvm-objdump/X86/phdrs-lma2.test index 2dd155f246ca4c..ead250e8cf39fd 100644 --- a/llvm/test/tools/llvm-objdump/X86/phdrs-lma2.test +++ b/llvm/test/tools/llvm-objdump/X86/phdrs-lma2.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t ## If there are no sections with different LMA to VMA, ## we do not display LMA column. diff --git a/llvm/test/tools/llvm-objdump/elf-dynamic-section.test b/llvm/test/tools/llvm-objdump/elf-dynamic-section.test index 8688f0db1e3143..0a99145d977acb 100644 --- a/llvm/test/tools/llvm-objdump/elf-dynamic-section.test +++ b/llvm/test/tools/llvm-objdump/elf-dynamic-section.test @@ -215,7 +215,7 @@ ProgramHeaders: Sections: - Section: .dynamic -# RUN: yaml2obj --docnum=2 %s > %t2 +# RUN: yaml2obj --docnum=2 %s -o %t2 # RUN: llvm-objdump -p %t2 | FileCheck %s --strict-whitespace --match-full-lines --check-prefix=ELF32 # ELF32:Dynamic Section: diff --git a/llvm/test/tools/llvm-objdump/file-headers-coff.test b/llvm/test/tools/llvm-objdump/file-headers-coff.test index 64ddda68ba4693..26c25f95a9cf40 100644 --- a/llvm/test/tools/llvm-objdump/file-headers-coff.test +++ b/llvm/test/tools/llvm-objdump/file-headers-coff.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objdump -f %t | FileCheck %s -DFILE=%t # RUN: llvm-objdump -file-headers %t | FileCheck %s -DFILE=%t diff --git a/llvm/test/tools/llvm-objdump/file-headers-elf.test b/llvm/test/tools/llvm-objdump/file-headers-elf.test index 4b4549893b4528..da90468e9a28ec 100644 --- a/llvm/test/tools/llvm-objdump/file-headers-elf.test +++ b/llvm/test/tools/llvm-objdump/file-headers-elf.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj --docnum=1 %s > %t +# RUN: yaml2obj --docnum=1 %s -o %t # RUN: llvm-objdump -f %t | FileCheck %s -DFILE=%t -check-prefix ELF64 # RUN: llvm-objdump -file-headers %t | FileCheck %s -DFILE=%t -check-prefix ELF64 @@ -14,7 +14,7 @@ FileHeader: # ELF64: architecture: x86_64 # ELF64: start address: 0x00123456789abcde -# RUN: yaml2obj --docnum=2 %s > %t-i386 +# RUN: yaml2obj --docnum=2 %s -o %t-i386 # RUN: llvm-objdump -f %t-i386 | FileCheck -DFILE=%t-i386 %s -check-prefix ELF32 # RUN: llvm-objdump -file-headers %t-i386 | FileCheck %s -DFILE=%t-i386 -check-prefix ELF32 diff --git a/llvm/test/tools/llvm-objdump/file-headers-pe.test b/llvm/test/tools/llvm-objdump/file-headers-pe.test index 68c086163bb04f..b0146226d68ad8 100644 --- a/llvm/test/tools/llvm-objdump/file-headers-pe.test +++ b/llvm/test/tools/llvm-objdump/file-headers-pe.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objdump -f %t | FileCheck %s # RUN: llvm-objdump -file-headers %t | FileCheck %s diff --git a/llvm/test/tools/llvm-objdump/full-contents.test b/llvm/test/tools/llvm-objdump/full-contents.test index 29cc9fdb800c44..1ebe4000f8c0a8 100644 --- a/llvm/test/tools/llvm-objdump/full-contents.test +++ b/llvm/test/tools/llvm-objdump/full-contents.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objdump --full-contents %t > %t.out1 # RUN: llvm-objdump -s %t > %t.out2 # RUN: cmp %t.out1 %t.out2 diff --git a/llvm/test/tools/llvm-objdump/macho-bad-dysymtab.test b/llvm/test/tools/llvm-objdump/macho-bad-dysymtab.test index 6f8cee766cf602..f5fe4e34096f91 100644 --- a/llvm/test/tools/llvm-objdump/macho-bad-dysymtab.test +++ b/llvm/test/tools/llvm-objdump/macho-bad-dysymtab.test @@ -1,4 +1,4 @@ -#RUN: yaml2obj %s > %t1.dylib +#RUN: yaml2obj %s -o %t1.dylib #RUN: not llvm-objdump -d %t1.dylib 2>&1 | FileCheck %s --- !mach-o diff --git a/llvm/test/tools/llvm-objdump/non-archive-object.test b/llvm/test/tools/llvm-objdump/non-archive-object.test index b1884102c02e6f..0064f7de9f9fe3 100644 --- a/llvm/test/tools/llvm-objdump/non-archive-object.test +++ b/llvm/test/tools/llvm-objdump/non-archive-object.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objdump -a %t | FileCheck %s # If this test has not crashed, then this test passed. diff --git a/llvm/test/tools/llvm-objdump/private-headers-no-dynamic-segment.test b/llvm/test/tools/llvm-objdump/private-headers-no-dynamic-segment.test index c3f592532b7e87..703db6551db2f4 100644 --- a/llvm/test/tools/llvm-objdump/private-headers-no-dynamic-segment.test +++ b/llvm/test/tools/llvm-objdump/private-headers-no-dynamic-segment.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objdump -p %t | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-objdump/private-headers-no-dynamic.test b/llvm/test/tools/llvm-objdump/private-headers-no-dynamic.test index 80c68418338441..d7ae6c290cadf2 100644 --- a/llvm/test/tools/llvm-objdump/private-headers-no-dynamic.test +++ b/llvm/test/tools/llvm-objdump/private-headers-no-dynamic.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objdump -p %t | FileCheck %s !ELF diff --git a/llvm/test/tools/llvm-objdump/relocations-elf.test b/llvm/test/tools/llvm-objdump/relocations-elf.test index becbc35d81a861..51e539c76f0a74 100644 --- a/llvm/test/tools/llvm-objdump/relocations-elf.test +++ b/llvm/test/tools/llvm-objdump/relocations-elf.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj --docnum=1 %s > %t +# RUN: yaml2obj --docnum=1 %s -o %t # RUN: llvm-objdump --reloc %t > %t1 # RUN: llvm-objdump -r %t > %t2 # RUN: cmp %t1 %t2 @@ -73,7 +73,7 @@ Symbols: ## Check we report an error if the relocated section identified by the ## sh_info field of a relocation section is invalid. -# RUN: yaml2obj --docnum=2 %s > %t2 +# RUN: yaml2obj --docnum=2 %s -o %t2 # RUN: not llvm-objdump --reloc %t2 2>&1 | FileCheck %s -DFILE=%t2 --check-prefix=ERR # ERR: error: '[[FILE]]': section (1): unable to get a relocation target: invalid section index: 255 @@ -92,7 +92,7 @@ Sections: Type: R_X86_64_NONE ## Check ranges of addends being displayed in a dump of relocations. -# RUN: yaml2obj --docnum=3 %s > %t3 +# RUN: yaml2obj --docnum=3 %s -o %t3 # RUN: llvm-objdump -r %t3 | FileCheck %s --check-prefix=ADDENDS # ADDENDS: RELOCATION RECORDS FOR [.text]: diff --git a/llvm/test/tools/llvm-objdump/symbol-table-elf.test b/llvm/test/tools/llvm-objdump/symbol-table-elf.test index a2a7f018618c79..ab35a7d8a26797 100644 --- a/llvm/test/tools/llvm-objdump/symbol-table-elf.test +++ b/llvm/test/tools/llvm-objdump/symbol-table-elf.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objdump --syms %t > %t1 # RUN: llvm-objdump -t %t > %t2 # RUN: cmp %t1 %t2 diff --git a/llvm/test/tools/llvm-objdump/verdef-elf.test b/llvm/test/tools/llvm-objdump/verdef-elf.test index 3103bd527dd20c..254328f877c560 100644 --- a/llvm/test/tools/llvm-objdump/verdef-elf.test +++ b/llvm/test/tools/llvm-objdump/verdef-elf.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objdump -p %t | FileCheck --strict-whitespace %s # CHECK: Version definitions: diff --git a/llvm/test/tools/llvm-objdump/verneed-elf.test b/llvm/test/tools/llvm-objdump/verneed-elf.test index 799d2b2ed7468c..b9130dcbb11ce0 100644 --- a/llvm/test/tools/llvm-objdump/verneed-elf.test +++ b/llvm/test/tools/llvm-objdump/verneed-elf.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objdump -p %t | FileCheck %s # CHECK: Version References: diff --git a/llvm/test/tools/llvm-objdump/verneed-wrong-info.test b/llvm/test/tools/llvm-objdump/verneed-wrong-info.test index 9811564a16dccf..cf1c18e8159659 100644 --- a/llvm/test/tools/llvm-objdump/verneed-wrong-info.test +++ b/llvm/test/tools/llvm-objdump/verneed-wrong-info.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-objdump -p %t 2>&1 | FileCheck %s # We have a SHT_GNU_verneed section with a broken sh_info field diff --git a/llvm/test/tools/llvm-objdump/warn-on-out-of-range-start-stop-address.test b/llvm/test/tools/llvm-objdump/warn-on-out-of-range-start-stop-address.test index 29912aee095ed7..797a48b20ca304 100644 --- a/llvm/test/tools/llvm-objdump/warn-on-out-of-range-start-stop-address.test +++ b/llvm/test/tools/llvm-objdump/warn-on-out-of-range-start-stop-address.test @@ -2,10 +2,10 @@ ## do not intersect with address ranges of sections that have the SHF_ALLOC ## flag. -# RUN: yaml2obj --docnum=1 %s > %t -# RUN: yaml2obj --docnum=2 %s > %t.2 -# RUN: yaml2obj --docnum=3 %s > %t.o -# RUN: yaml2obj --docnum=4 %s > %t.3 +# RUN: yaml2obj --docnum=1 %s -o %t +# RUN: yaml2obj --docnum=2 %s -o %t.2 +# RUN: yaml2obj --docnum=3 %s -o %t.o +# RUN: yaml2obj --docnum=4 %s -o %t.3 ## Warn if no section covers any part of the specified range. diff --git a/llvm/test/tools/llvm-readobj/COFF/unwind-arm64-image.yaml b/llvm/test/tools/llvm-readobj/COFF/unwind-arm64-image.yaml index 67305ee6677fbf..fa8471f63a5351 100644 --- a/llvm/test/tools/llvm-readobj/COFF/unwind-arm64-image.yaml +++ b/llvm/test/tools/llvm-readobj/COFF/unwind-arm64-image.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.exe +# RUN: yaml2obj %s -o %t.exe # RUN: llvm-readobj --unwind %t.exe | FileCheck %s # CHECK: RuntimeFunction { diff --git a/llvm/test/tools/llvm-readobj/COFF/unwind-x86_64-image.yaml b/llvm/test/tools/llvm-readobj/COFF/unwind-x86_64-image.yaml index c62ef240d10767..5780cf7a0467b7 100644 --- a/llvm/test/tools/llvm-readobj/COFF/unwind-x86_64-image.yaml +++ b/llvm/test/tools/llvm-readobj/COFF/unwind-x86_64-image.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.exe +# RUN: yaml2obj %s -o %t.exe # RUN: llvm-readobj --unwind %t.exe | FileCheck %s # CHECK: RuntimeFunction { diff --git a/llvm/test/tools/llvm-readobj/ELF/demangle.test b/llvm/test/tools/llvm-readobj/ELF/demangle.test index 29181cf1b4cd52..230ba9209333d5 100644 --- a/llvm/test/tools/llvm-readobj/ELF/demangle.test +++ b/llvm/test/tools/llvm-readobj/ELF/demangle.test @@ -1,7 +1,7 @@ ## Show that llvm-readelf + llvm-readobj demangle symbol names in symbol tables ## (including dynamic symbols), relocations (including dynamic relocations), and groups. -# RUN: yaml2obj %s > %t.so +# RUN: yaml2obj %s -o %t.so ## Check LLVM output style. # RUN: llvm-readobj --symbols --relocations --dyn-symbols --dyn-relocations \ diff --git a/llvm/test/tools/llvm-readobj/ELF/gnu-note-size.test b/llvm/test/tools/llvm-readobj/ELF/gnu-note-size.test index ea01d5b78146b3..d7421da5e0eede 100644 --- a/llvm/test/tools/llvm-readobj/ELF/gnu-note-size.test +++ b/llvm/test/tools/llvm-readobj/ELF/gnu-note-size.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-readelf --notes %t | FileCheck %s --check-prefix=GNU # RUN: llvm-readobj --elf-output-style LLVM --notes %t | FileCheck %s --check-prefix=LLVM diff --git a/llvm/test/tools/llvm-readobj/ELF/gnu-notes.test b/llvm/test/tools/llvm-readobj/ELF/gnu-notes.test index a625c024b00ba7..211f79a0cab81b 100644 --- a/llvm/test/tools/llvm-readobj/ELF/gnu-notes.test +++ b/llvm/test/tools/llvm-readobj/ELF/gnu-notes.test @@ -1,6 +1,6 @@ ## Test tools are able to dump different types of notes. -# RUN: yaml2obj --docnum=1 %s > %t1.so +# RUN: yaml2obj --docnum=1 %s -o %t1.so # RUN: llvm-readelf --notes %t1.so | FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines # RUN: llvm-readobj --notes %t1.so | FileCheck %s --check-prefix=LLVM # RUN: llvm-objcopy --strip-sections %t1.so %t1.stripped.so @@ -104,7 +104,7 @@ ProgramHeaders: ## Test tools report an error if a note section has an invalid offset ## that goes past the end of file. -# RUN: yaml2obj --docnum=2 %s > %t2.so +# RUN: yaml2obj --docnum=2 %s -o %t2.so # RUN: not llvm-readelf --notes %t2.so 2>&1 | FileCheck -DFILE=%t2.so %s --check-prefix=ERR1 # RUN: not llvm-readobj --notes %t2.so 2>&1 | FileCheck -DFILE=%t2.so %s --check-prefix=ERR1 @@ -125,7 +125,7 @@ Sections: ## Test tools report an error if a note section has invalid size ## that goes past the end of file. -# RUN: yaml2obj --docnum=3 %s > %t3.so +# RUN: yaml2obj --docnum=3 %s -o %t3.so # RUN: not llvm-readelf --notes %t3.so 2>&1 | FileCheck -DFILE=%t3.so %s --check-prefix=ERR2 # RUN: not llvm-readobj --notes %t3.so 2>&1 | FileCheck -DFILE=%t3.so %s --check-prefix=ERR2 @@ -146,7 +146,7 @@ Sections: ## Test tools report an error if a note program header has an invalid offset that ## goes past the end of file. -# RUN: yaml2obj --docnum=4 %s > %t4.so +# RUN: yaml2obj --docnum=4 %s -o %t4.so # RUN: not llvm-readelf --notes %t4.so 2>&1 | FileCheck -DFILE=%t4.so %s --check-prefix=ERR3 # RUN: not llvm-readobj --notes %t4.so 2>&1 | FileCheck -DFILE=%t4.so %s --check-prefix=ERR3 @@ -171,7 +171,7 @@ ProgramHeaders: ## Test tools report an error if a note program header has an invalid size that ## goes past the end of file. -# RUN: yaml2obj --docnum=5 %s > %t5.so +# RUN: yaml2obj --docnum=5 %s -o %t5.so # RUN: not llvm-readelf --notes %t5.so 2>&1 | FileCheck -DFILE=%t5.so %s --check-prefix=ERR4 # RUN: not llvm-readobj --notes %t5.so 2>&1 | FileCheck -DFILE=%t5.so %s --check-prefix=ERR4 diff --git a/llvm/test/tools/llvm-readobj/ELF/note-amdgpu.test b/llvm/test/tools/llvm-readobj/ELF/note-amdgpu.test index 51440dd4a5b68f..097dbfbbe08b66 100644 --- a/llvm/test/tools/llvm-readobj/ELF/note-amdgpu.test +++ b/llvm/test/tools/llvm-readobj/ELF/note-amdgpu.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-readobj --notes %t.o | FileCheck %s --check-prefix=LLVM # RUN: llvm-readelf --notes %t.o | FileCheck %s --check-prefix=GNU diff --git a/llvm/test/tools/llvm-readobj/ELF/note-core-ntfile.test b/llvm/test/tools/llvm-readobj/ELF/note-core-ntfile.test index b5dc684dc42f06..a1a5725af52d21 100644 --- a/llvm/test/tools/llvm-readobj/ELF/note-core-ntfile.test +++ b/llvm/test/tools/llvm-readobj/ELF/note-core-ntfile.test @@ -1,6 +1,6 @@ ## Test that NT_FILE sections in core files are interpreted correctly. -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-readelf --notes %t.o | FileCheck %s --check-prefix=GNU # RUN: llvm-readobj --notes %t.o | FileCheck %s --check-prefix=LLVM diff --git a/llvm/test/tools/llvm-readobj/ELF/note-core.test b/llvm/test/tools/llvm-readobj/ELF/note-core.test index 314be84d7d79f0..0aa163dbaf8a76 100644 --- a/llvm/test/tools/llvm-readobj/ELF/note-core.test +++ b/llvm/test/tools/llvm-readobj/ELF/note-core.test @@ -1,6 +1,6 @@ ## Test that note values are interpreted correctly for core files. -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-readelf --notes %t.o | FileCheck %s --check-prefix=GNU # RUN: llvm-readobj --notes %t.o | FileCheck %s --check-prefix=LLVM diff --git a/llvm/test/tools/llvm-readobj/ELF/reloc-symbol-with-versioning.test b/llvm/test/tools/llvm-readobj/ELF/reloc-symbol-with-versioning.test index 8fa191984d5383..5bf06566a449f5 100644 --- a/llvm/test/tools/llvm-readobj/ELF/reloc-symbol-with-versioning.test +++ b/llvm/test/tools/llvm-readobj/ELF/reloc-symbol-with-versioning.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-readobj --demangle -r %t.o | FileCheck %s --check-prefix LLVM # RUN: llvm-readelf --demangle -r %t.o | FileCheck %s --check-prefix GNU diff --git a/llvm/test/tools/llvm-readobj/ELF/stack-sizes.test b/llvm/test/tools/llvm-readobj/ELF/stack-sizes.test index 3d001b104954e5..d1f6dabdbf08c6 100644 --- a/llvm/test/tools/llvm-readobj/ELF/stack-sizes.test +++ b/llvm/test/tools/llvm-readobj/ELF/stack-sizes.test @@ -1,7 +1,7 @@ ## Check that we correctly display the contents of the .stack_sizes section ## in a relocatable object file. -# RUN: yaml2obj --docnum=1 %s > %t01 +# RUN: yaml2obj --docnum=1 %s -o %t01 # RUN: llvm-readelf --stack-sizes %t01 \ # RUN: | FileCheck %s --check-prefix=RELOC-GNU --strict-whitespace --match-full-lines # RUN: llvm-readobj --stack-sizes %t01 | FileCheck %s --check-prefix=RELOC-LLVM @@ -94,7 +94,7 @@ Symbols: ## Check that we correctly report the stack sizes in an executable (non-relocatable) ## object file. -# RUN: yaml2obj --docnum=2 %s > %t02 +# RUN: yaml2obj --docnum=2 %s -o %t02 # RUN: llvm-readelf --stack-sizes %t02 \ # RUN: | FileCheck %s --check-prefix=EXEC-GNU --strict-whitespace --match-full-lines # RUN: llvm-readobj --stack-sizes %t02 | FileCheck %s --check-prefix=EXEC-LLVM @@ -149,7 +149,7 @@ Symbols: ## Check that we report an error when we find relocations whose offsets point outside ## of the .stack_sizes section. -# RUN: yaml2obj --docnum=3 %s > %t03 +# RUN: yaml2obj --docnum=3 %s -o %t03 # RUN: not llvm-readelf --stack-sizes %t03 2>&1 | FileCheck %s --check-prefix=SHORT -DFILE=%t03 # RUN: not llvm-readobj --stack-sizes %t03 2>&1 | FileCheck %s --check-prefix=SHORT -DFILE=%t03 @@ -186,7 +186,7 @@ Symbols: ## Check that we warn about a function symbol that is not in the section ## that is referenced by the stack sizes section's sh_link. -# RUN: yaml2obj --docnum=4 %s > %t04 +# RUN: yaml2obj --docnum=4 %s -o %t04 # RUN: llvm-readelf --stack-sizes %t04 2> %t04-gnu.err | FileCheck %s --check-prefix=WRONGSECTION-GNU # RUN: FileCheck %s < %t04-gnu.err --check-prefix=WRONGSECTION-ERR -DFILE=%t04 # RUN: llvm-readobj --stack-sizes %t04 2> %t04-llvm.err | FileCheck %s --check-prefix=WRONGSECTION-LLVM @@ -242,7 +242,7 @@ Symbols: ## Check that we report an error when a stack sizes section ends with an incomplete stack size entry. -# RUN: yaml2obj --docnum=5 %s > %t05 +# RUN: yaml2obj --docnum=5 %s -o %t05 # RUN: not llvm-readelf --stack-sizes %t05 2>&1 | \ # RUN: FileCheck %s --check-prefix=SUDDENEND -DFILE=%t05 # RUN: not llvm-readobj --stack-sizes %t05 2>&1 | \ @@ -275,7 +275,7 @@ Symbols: ## Check that we report an invalid stack size, which is represented by a ULEB that ## ends in a byte with the high bit set. -# RUN: yaml2obj --docnum=6 %s > %t06 +# RUN: yaml2obj --docnum=6 %s -o %t06 # RUN: not llvm-readelf --stack-sizes %t06 2>&1 | FileCheck %s --check-prefix=BADSIZE -DFILE=%t06 # RUN: not llvm-readobj --stack-sizes %t06 2>&1 | FileCheck %s --check-prefix=BADSIZE -DFILE=%t06 @@ -307,7 +307,7 @@ Symbols: ## valid section. We expect a stack size entry with an unknown symbol in the ## output. -# RUN: yaml2obj --docnum=7 %s > %t07 +# RUN: yaml2obj --docnum=7 %s -o %t07 # RUN: llvm-readelf --stack-sizes %t07 2> %t07-gnu.err | FileCheck %s --check-prefix=BADSECTION-OUT-GNU # RUN: FileCheck %s < %t07-gnu.err --check-prefix=BADSECTION-ERR -DFILE=%t07 # RUN: llvm-readobj --stack-sizes %t07 2> %t07-llvm.err | FileCheck %s --check-prefix=BADSECTION-OUT-LLVM @@ -361,7 +361,7 @@ Symbols: ## Check that we report a warning when a stack sizes section does not come with ## a corresponding relocation section. -# RUN: yaml2obj --docnum=8 %s > %t08 +# RUN: yaml2obj --docnum=8 %s -o %t08 # RUN: llvm-readelf --stack-sizes %t08 2> %t08-gnu.err | FileCheck %s --check-prefix=NORELOCSECTION-OUT-GNU # RUN: FileCheck %s < %t08-gnu.err --check-prefix=NORELOCSECTION-ERR -DFILE=%t08 # RUN: llvm-readobj --stack-sizes %t08 2> %t08-llvm.err | FileCheck %s --check-prefix=NORELOCSECTION-OUT-LLVM @@ -454,7 +454,7 @@ Sections: ## Check that we do not consider symbols that are not function symbols, even though ## a relocation references them. -# RUN: yaml2obj --docnum=9 %s > %t14 +# RUN: yaml2obj --docnum=9 %s -o %t14 # RUN: llvm-readelf --stack-sizes %t14 2> %t14-gnu.err | FileCheck %s --check-prefix=NONFUNCTIONSYM-GNU # RUN: FileCheck %s < %t14-gnu.err --check-prefix=NONFUNCTIONSYM-ERR -DFILE=%t14 # RUN: llvm-readobj --stack-sizes %t14 2> %t14-llvm.err | FileCheck %s --check-prefix=NONFUNCTIONSYM-LLVM @@ -503,7 +503,7 @@ Symbols: ## Check that we report an error when we find an unsupported relocation ## in the section that contains the stack size entries' relocations. -# RUN: yaml2obj --docnum=10 %s > %t15 +# RUN: yaml2obj --docnum=10 %s -o %t15 # RUN: not llvm-readelf --stack-sizes %t15 2>&1 | FileCheck %s --check-prefix=UNSUPPRELOC -DFILE=%t15 # RUN: not llvm-readobj --stack-sizes %t15 2>&1 | FileCheck %s --check-prefix=UNSUPPRELOC -DFILE=%t15 @@ -585,7 +585,7 @@ Symbols: ## Check that we demangle function names when requested. -# RUN: yaml2obj --docnum=11 %s > %t16 +# RUN: yaml2obj --docnum=11 %s -o %t16 # RUN: llvm-readelf --stack-sizes --demangle %t16 | FileCheck %s --check-prefix=DEMANGLE-GNU # RUN: llvm-readobj --stack-sizes --demangle %t16 | FileCheck %s --check-prefix=DEMANGLE-LLVM @@ -619,7 +619,7 @@ Symbols: ## Check that we report an error when we are unable to resolve a relocation for a given ELF architecture. ## Here we have a 64-bit relocation used in a 32-bit object. -# RUN: yaml2obj --docnum=12 %s > %t17 +# RUN: yaml2obj --docnum=12 %s -o %t17 # RUN: not llvm-readelf --stack-sizes %t17 2>&1 | FileCheck %s -DFILE=%t17 --check-prefix=UNSUPPRELOC2 # RUN: not llvm-readobj --stack-sizes %t17 2>&1 | FileCheck %s -DFILE=%t17 --check-prefix=UNSUPPRELOC2 @@ -646,7 +646,7 @@ Sections: ## identified by the sh_info field is invalid. Here the sh_info value is larger than ## the number of sections. -# RUN: yaml2obj --docnum=13 %s > %t18 +# RUN: yaml2obj --docnum=13 %s -o %t18 # RUN: not llvm-readelf --stack-sizes %t18 2>&1 | FileCheck %s -DFILE=%t18 --check-prefix=INVALID-TARGET # RUN: not llvm-readobj --stack-sizes %t18 2>&1 | FileCheck %s -DFILE=%t18 --check-prefix=INVALID-TARGET diff --git a/llvm/test/tools/llvm-readobj/ELF/string-dump.test b/llvm/test/tools/llvm-readobj/ELF/string-dump.test index cfd9a03ed6c541..ba20b17878818a 100644 --- a/llvm/test/tools/llvm-readobj/ELF/string-dump.test +++ b/llvm/test/tools/llvm-readobj/ELF/string-dump.test @@ -1,5 +1,5 @@ # Check the dumping of a section as strings. -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-readobj --string-dump=.strings \ # RUN: --string-dump=.not_null_terminated %t > %t.readobj.out diff --git a/llvm/test/tools/llvm-readobj/ELF/symbol-64bit.test b/llvm/test/tools/llvm-readobj/ELF/symbol-64bit.test index dbd8f0e54b690c..dae621ffd1b2dd 100644 --- a/llvm/test/tools/llvm-readobj/ELF/symbol-64bit.test +++ b/llvm/test/tools/llvm-readobj/ELF/symbol-64bit.test @@ -1,7 +1,7 @@ # Show that both GNU and LLVM styles can properly print symbol values and sizes # that do not fit in 32-bit integers. -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-readobj --symbols %t | FileCheck %s --check-prefix=LLVM # RUN: llvm-readelf --symbols %t | FileCheck %s --check-prefix=GNU diff --git a/llvm/test/tools/llvm-readobj/ELF/symbol-binding.test b/llvm/test/tools/llvm-readobj/ELF/symbol-binding.test index 9ca5142abae467..bfd269882f6246 100644 --- a/llvm/test/tools/llvm-readobj/ELF/symbol-binding.test +++ b/llvm/test/tools/llvm-readobj/ELF/symbol-binding.test @@ -1,7 +1,7 @@ # Show that llvm-readobj can print symbol bindings correctly for both LLVM and # GNU styles, including for symbol bindings that are not recognised. -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-readobj --symbols --dyn-symbols %t | FileCheck %s --check-prefix=LLVM # RUN: llvm-readelf --symbols --dyn-symbols %t | FileCheck %s --check-prefix=GNU diff --git a/llvm/test/tools/llvm-readobj/ELF/symbol-shndx.test b/llvm/test/tools/llvm-readobj/ELF/symbol-shndx.test index ab01da9c842f86..5639e43155d971 100644 --- a/llvm/test/tools/llvm-readobj/ELF/symbol-shndx.test +++ b/llvm/test/tools/llvm-readobj/ELF/symbol-shndx.test @@ -3,7 +3,7 @@ ## section), reserved values and processor/os-specific index values, for both GNU ## and LLVM styles. -# RUN: yaml2obj --docnum=1 %s > %t1 +# RUN: yaml2obj --docnum=1 %s -o %t1 # RUN: llvm-readobj --symbols %t1 | FileCheck %s --check-prefix=LLVM1 # RUN: llvm-readelf --symbols %t1 | FileCheck %s --check-prefix=GNU1 @@ -85,7 +85,7 @@ Symbols: ## In this case, the index does not correspond to a real section. Check that GNU ## style just prints the section index as normal and LLVM style prints a warning ## (but only once for each warning). -# RUN: yaml2obj --docnum=2 %s > %t2 +# RUN: yaml2obj --docnum=2 %s -o %t2 # RUN: llvm-readobj --symbols %t2 2> %t2.llvm.err | FileCheck %s --check-prefix=LLVM2 # RUN: FileCheck %s --input-file=%t2.llvm.err --check-prefix=BAD-SHNDX --implicit-check-not=warning # RUN: llvm-readelf --symbols %t2 2> %t2.gnu.err | FileCheck %s --check-prefix=GNU2 @@ -152,7 +152,7 @@ Symbols: ## In this case, the symtab shndx section is missing, so symbols with section ## indexes of SHN_XINDEX print as Reserved symbols. -# RUN: yaml2obj --docnum=3 %s > %t3 +# RUN: yaml2obj --docnum=3 %s -o %t3 # RUN: llvm-readobj --symbols %t3 2> %t3.llvm.err | FileCheck %s --check-prefix=LLVM3 # RUN: FileCheck %s --input-file=%t3.llvm.err --check-prefix=NO-SYMTAB-SHNDX --implicit-check-not=warning # RUN: llvm-readelf --symbols %t3 2> %t3.gnu.err | FileCheck %s --check-prefix=GNU3 diff --git a/llvm/test/tools/llvm-readobj/ELF/symbol-types.test b/llvm/test/tools/llvm-readobj/ELF/symbol-types.test index 3d0ba4a4808220..c6f65ea1adf374 100644 --- a/llvm/test/tools/llvm-readobj/ELF/symbol-types.test +++ b/llvm/test/tools/llvm-readobj/ELF/symbol-types.test @@ -2,7 +2,7 @@ # and also for unknown types, both in the os/processor specific ranges and not, # for both GNU and LLVM styles. -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: llvm-readobj --symbols %t | FileCheck %s --check-prefix=LLVM # RUN: llvm-readelf --symbols %t | FileCheck %s --check-prefix=GNU diff --git a/llvm/test/tools/llvm-readobj/ELF/symbol-visibility.test b/llvm/test/tools/llvm-readobj/ELF/symbol-visibility.test index bdc66d77472e85..752410bb5e81a2 100644 --- a/llvm/test/tools/llvm-readobj/ELF/symbol-visibility.test +++ b/llvm/test/tools/llvm-readobj/ELF/symbol-visibility.test @@ -4,7 +4,7 @@ ## Check how we dump symbols when they have only STV_* bits set for st_other. ## (This is the most common case). -# RUN: yaml2obj --docnum=1 %s > %t1.o +# RUN: yaml2obj --docnum=1 %s -o %t1.o # RUN: llvm-readobj --symbols %t1.o | FileCheck %s --check-prefix=LLVM # RUN: llvm-readelf --symbols %t1.o | FileCheck %s --strict-whitespace --check-prefix=GNU @@ -52,7 +52,7 @@ Symbols: ## Check the output when we have non-visibility bits set for at least one of the symbols. -# RUN: yaml2obj --docnum=2 %s > %t2.o +# RUN: yaml2obj --docnum=2 %s -o %t2.o # RUN: llvm-readobj --symbols %t2.o | FileCheck %s --check-prefixes=LLVM,LLVM-OTHER # RUN: llvm-readelf --symbols %t2.o | FileCheck %s --strict-whitespace --check-prefix=GNU-OTHER diff --git a/llvm/test/tools/llvm-readobj/ELF/unwind.test b/llvm/test/tools/llvm-readobj/ELF/unwind.test index a9e34f7a294b34..17cd2f572e5366 100644 --- a/llvm/test/tools/llvm-readobj/ELF/unwind.test +++ b/llvm/test/tools/llvm-readobj/ELF/unwind.test @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t.exe +# RUN: yaml2obj %s -o %t.exe # RUN: llvm-readobj --unwind %t.exe | FileCheck %s # CHECK: EHFrameHeader { diff --git a/llvm/test/tools/llvm-readobj/MachO/sections.test b/llvm/test/tools/llvm-readobj/MachO/sections.test index 1d2ab068f50b69..b181575f7b3a84 100644 --- a/llvm/test/tools/llvm-readobj/MachO/sections.test +++ b/llvm/test/tools/llvm-readobj/MachO/sections.test @@ -1,7 +1,7 @@ ## Check how we print sections. ## Show that llvm-readobj prints MachO all section types properly. -# RUN: yaml2obj --docnum=1 %s > %t1 +# RUN: yaml2obj --docnum=1 %s -o %t1 # RUN: llvm-readobj --sections %t1 | FileCheck %s # CHECK: Type: Regular (0x0) diff --git a/llvm/test/tools/llvm-size/elf-berkeley.test b/llvm/test/tools/llvm-size/elf-berkeley.test index 96eaca73dbce1b..88557ace90e3c8 100644 --- a/llvm/test/tools/llvm-size/elf-berkeley.test +++ b/llvm/test/tools/llvm-size/elf-berkeley.test @@ -2,7 +2,7 @@ ## format. It also shows that the formatting is correct (including using tabs as ## field separators). -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-size -B %t.o \ # RUN: | FileCheck %s --match-full-lines --strict-whitespace -DFILE=%t.o --implicit-check-not={{.}} diff --git a/llvm/test/tools/llvm-size/elf-sysv.test b/llvm/test/tools/llvm-size/elf-sysv.test index 434cd5b73014ed..2ecf4418a8e470 100644 --- a/llvm/test/tools/llvm-size/elf-sysv.test +++ b/llvm/test/tools/llvm-size/elf-sysv.test @@ -4,7 +4,7 @@ ## FIXME: The rules demonstrated by this test are not quite what GNU size ## follows. See https://bugs.llvm.org/show_bug.cgi?id=42934. -# RUN: yaml2obj %s > %t.o +# RUN: yaml2obj %s -o %t.o # RUN: llvm-size --format=sysv %t.o \ # RUN: | FileCheck %s --match-full-lines --strict-whitespace -DFILE=%t.o --implicit-check-not={{.}} # RUN: llvm-size -A %t.o \ diff --git a/llvm/test/tools/obj2yaml/section-group.test b/llvm/test/tools/obj2yaml/section-group.test index 111bffda8e5825..cab6fd5923311b 100644 --- a/llvm/test/tools/obj2yaml/section-group.test +++ b/llvm/test/tools/obj2yaml/section-group.test @@ -1,6 +1,6 @@ ## Checks that the tool is able to read section groups from ELF. -# RUN: yaml2obj --docnum=1 %s > %t1.o +# RUN: yaml2obj --docnum=1 %s -o %t1.o # RUN: llvm-readobj --elf-section-groups %t1.o | FileCheck %s -check-prefix=OBJ # RUN: obj2yaml %t1.o | FileCheck %s --check-prefix YAML @@ -50,7 +50,7 @@ Symbols: ## Check obj2yaml report an error when sh_info field of ## group section contains invalid (too large) signature symbol index. -# RUN: yaml2obj --docnum=2 %s > %t2.o +# RUN: yaml2obj --docnum=2 %s -o %t2.o # RUN: not obj2yaml %t2.o 2>&1 | FileCheck %s --check-prefix ERR --- !ELF diff --git a/llvm/test/tools/obj2yaml/special-symbol-indices.yaml b/llvm/test/tools/obj2yaml/special-symbol-indices.yaml index 9ba424101ed26d..27ccb77a82ae6d 100644 --- a/llvm/test/tools/obj2yaml/special-symbol-indices.yaml +++ b/llvm/test/tools/obj2yaml/special-symbol-indices.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: obj2yaml %t | FileCheck %s ## Test checks that we are able to handle symbols with special/reserved indices. diff --git a/llvm/test/tools/obj2yaml/symbol-type.yaml b/llvm/test/tools/obj2yaml/symbol-type.yaml index 8183143623f1e3..fe541b575364c5 100644 --- a/llvm/test/tools/obj2yaml/symbol-type.yaml +++ b/llvm/test/tools/obj2yaml/symbol-type.yaml @@ -1,4 +1,4 @@ -# RUN: yaml2obj %s > %t +# RUN: yaml2obj %s -o %t # RUN: obj2yaml %t | FileCheck %s # CHECK: Symbols: diff --git a/llvm/test/tools/sanstats/elf.test b/llvm/test/tools/sanstats/elf.test index 344384721e1776..b8f2d5d5b4f99d 100644 --- a/llvm/test/tools/sanstats/elf.test +++ b/llvm/test/tools/sanstats/elf.test @@ -1,5 +1,5 @@ -# RUN: yaml2obj %s > %t1.o -# RUN: yaml2obj %s > %t2.o +# RUN: yaml2obj %s -o %t1.o +# RUN: yaml2obj %s -o %t2.o # RUN: printf "\x04" > %t.stats diff --git a/llvm/test/tools/yaml2obj/ELF/symbol-name.yaml b/llvm/test/tools/yaml2obj/ELF/symbol-name.yaml index 06815b4634d755..eb07eaeaced73e 100644 --- a/llvm/test/tools/yaml2obj/ELF/symbol-name.yaml +++ b/llvm/test/tools/yaml2obj/ELF/symbol-name.yaml @@ -1,6 +1,6 @@ ## Check we are able to use integers as both ## symbol name indices (st_name values) and symbol names. -# RUN: yaml2obj --docnum=1 %s > %t +# RUN: yaml2obj --docnum=1 %s -o %t # RUN: llvm-readobj --symbols %t | FileCheck %s # CHECK: Name: test (1) diff --git a/llvm/test/tools/yaml2obj/ELF/symbol-stother.yaml b/llvm/test/tools/yaml2obj/ELF/symbol-stother.yaml index 997a4b0be55fd5..27a0e93e839180 100644 --- a/llvm/test/tools/yaml2obj/ELF/symbol-stother.yaml +++ b/llvm/test/tools/yaml2obj/ELF/symbol-stother.yaml @@ -19,7 +19,7 @@ Symbols: ## Test that STO_* can be used with their correct machine type. ## We use the same YAML as above, but with a change of machine type. -# RUN: yaml2obj --docnum=2 %s > %t2 +# RUN: yaml2obj --docnum=2 %s -o %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s --check-prefix=USE-OTHER # USE-OTHER: Name: foo @@ -40,7 +40,7 @@ Symbols: ## Test that we can mix named and unnamed constants and set ## st_other to any arbitrary value. -# RUN: yaml2obj --docnum=3 %s > %t3 +# RUN: yaml2obj --docnum=3 %s -o %t3 # RUN: llvm-readobj --symbols %t3 | FileCheck %s --check-prefix=VALUE # VALUE: Name: foo diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index 89342a54eefeb3..3bf694aba17cd7 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -197,6 +197,11 @@ namespace { cl::desc("Generate software floating point library calls"), cl::init(false)); + cl::opt NoProcessSymbols( + "no-process-syms", + cl::desc("Do not resolve lli process symbols in JIT'd code"), + cl::init(false)); + enum class DumpKind { NoDump, DumpFuncsToStdOut, @@ -795,12 +800,16 @@ int runOrcLazyJIT(const char *ProgName) { }); orc::MangleAndInterner Mangle(J->getExecutionSession(), J->getDataLayout()); - J->getMainJITDylib().addGenerator( - ExitOnErr(orc::DynamicLibrarySearchGenerator::GetForCurrentProcess( - J->getDataLayout().getGlobalPrefix(), - [MainName = Mangle("main")](const orc::SymbolStringPtr &Name) { - return Name != MainName; - }))); + + // Unless they've been explicitly disabled, make process symbols available to + // JIT'd code. + if (!NoProcessSymbols) + J->getMainJITDylib().addGenerator( + ExitOnErr(orc::DynamicLibrarySearchGenerator::GetForCurrentProcess( + J->getDataLayout().getGlobalPrefix(), + [MainName = Mangle("main")](const orc::SymbolStringPtr &Name) { + return Name != MainName; + }))); orc::LocalCXXRuntimeOverrides CXXRuntimeOverrides; ExitOnErr(CXXRuntimeOverrides.enable(J->getMainJITDylib(), Mangle)); diff --git a/llvm/unittests/ADT/APFloatTest.cpp b/llvm/unittests/ADT/APFloatTest.cpp index 65b831c96e8f6f..e571e04614ae63 100644 --- a/llvm/unittests/ADT/APFloatTest.cpp +++ b/llvm/unittests/ADT/APFloatTest.cpp @@ -919,6 +919,119 @@ TEST(APFloatTest, fromDecimalString) { EXPECT_EQ(2.71828, convertToDoubleFromString("2.71828")); } +TEST(APFloatTest, fromStringSpecials) { + const fltSemantics &Sem = APFloat::IEEEdouble(); + const unsigned Precision = 53; + const unsigned PayloadBits = Precision - 2; + uint64_t PayloadMask = (uint64_t(1) << PayloadBits) - uint64_t(1); + + uint64_t NaNPayloads[] = { + 0, + 1, + 123, + 0xDEADBEEF, + uint64_t(-2), + uint64_t(1) << PayloadBits, // overflow bit + uint64_t(1) << (PayloadBits - 1), // signaling bit + uint64_t(1) << (PayloadBits - 2) // highest possible bit + }; + + // Convert payload integer to decimal string representation. + std::string NaNPayloadDecStrings[array_lengthof(NaNPayloads)]; + for (size_t I = 0; I < array_lengthof(NaNPayloads); ++I) + NaNPayloadDecStrings[I] = utostr(NaNPayloads[I]); + + // Convert payload integer to hexadecimal string representation. + std::string NaNPayloadHexStrings[array_lengthof(NaNPayloads)]; + for (size_t I = 0; I < array_lengthof(NaNPayloads); ++I) + NaNPayloadHexStrings[I] = "0x" + utohexstr(NaNPayloads[I]); + + // Fix payloads to expected result. + for (uint64_t &Payload : NaNPayloads) + Payload &= PayloadMask; + + // Signaling NaN must have a non-zero payload. In case a zero payload is + // requested, a default arbitrary payload is set instead. Save this payload + // for testing. + const uint64_t SNaNDefaultPayload = + APFloat::getSNaN(Sem).bitcastToAPInt().getZExtValue() & PayloadMask; + + // Negative sign prefix (or none - for positive). + const char Signs[] = {0, '-'}; + + // "Signaling" prefix (or none - for "Quiet"). + const char NaNTypes[] = {0, 's', 'S'}; + + const StringRef NaNStrings[] = {"nan", "NaN"}; + for (StringRef NaNStr : NaNStrings) + for (char TypeChar : NaNTypes) { + bool Signaling = (TypeChar == 's' || TypeChar == 'S'); + + for (size_t J = 0; J < array_lengthof(NaNPayloads); ++J) { + uint64_t Payload = (Signaling && !NaNPayloads[J]) ? SNaNDefaultPayload + : NaNPayloads[J]; + std::string &PayloadDec = NaNPayloadDecStrings[J]; + std::string &PayloadHex = NaNPayloadHexStrings[J]; + + for (char SignChar : Signs) { + bool Negative = (SignChar == '-'); + + std::string TestStrings[5]; + size_t NumTestStrings = 0; + + std::string Prefix; + if (SignChar) + Prefix += SignChar; + if (TypeChar) + Prefix += TypeChar; + Prefix += NaNStr; + + // Test without any paylod. + if (!Payload) + TestStrings[NumTestStrings++] = Prefix; + + // Test with the payload as a suffix. + TestStrings[NumTestStrings++] = Prefix + PayloadDec; + TestStrings[NumTestStrings++] = Prefix + PayloadHex; + + // Test with the payload inside parentheses. + TestStrings[NumTestStrings++] = Prefix + '(' + PayloadDec + ')'; + TestStrings[NumTestStrings++] = Prefix + '(' + PayloadHex + ')'; + + for (size_t K = 0; K < NumTestStrings; ++K) { + StringRef TestStr = TestStrings[K]; + + APFloat F(Sem); + bool HasError = !F.convertFromString( + TestStr, llvm::APFloat::rmNearestTiesToEven); + EXPECT_FALSE(HasError); + EXPECT_TRUE(F.isNaN()); + EXPECT_EQ(Signaling, F.isSignaling()); + EXPECT_EQ(Negative, F.isNegative()); + uint64_t PayloadResult = + F.bitcastToAPInt().getZExtValue() & PayloadMask; + EXPECT_EQ(Payload, PayloadResult); + } + } + } + } + + const StringRef InfStrings[] = {"inf", "INFINITY", "+Inf", + "-inf", "-INFINITY", "-Inf"}; + for (StringRef InfStr : InfStrings) { + bool Negative = InfStr.front() == '-'; + + APFloat F(Sem); + bool HasError = + !F.convertFromString(InfStr, llvm::APFloat::rmNearestTiesToEven); + EXPECT_FALSE(HasError); + EXPECT_TRUE(F.isInfinity()); + EXPECT_EQ(Negative, F.isNegative()); + uint64_t PayloadResult = F.bitcastToAPInt().getZExtValue() & PayloadMask; + EXPECT_EQ(UINT64_C(0), PayloadResult); + } +} + TEST(APFloatTest, fromToStringSpecials) { auto expects = [] (const char *first, const char *second) { std::string roundtrip = convertToString(convertToDoubleFromString(second), 0, 3); @@ -1746,17 +1859,12 @@ TEST(APFloatTest, isFiniteNonZero) { TEST(APFloatTest, add) { // Test Special Cases against each other and normal values. - // TODOS/NOTES: - // 1. Since we perform only default exception handling all operations with - // signaling NaNs should have a result that is a quiet NaN. Currently they - // return sNaN. - APFloat PInf = APFloat::getInf(APFloat::IEEEsingle(), false); APFloat MInf = APFloat::getInf(APFloat::IEEEsingle(), true); APFloat PZero = APFloat::getZero(APFloat::IEEEsingle(), false); APFloat MZero = APFloat::getZero(APFloat::IEEEsingle(), true); APFloat QNaN = APFloat::getNaN(APFloat::IEEEsingle(), false); - APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle(), false); + APFloat SNaN = APFloat(APFloat::IEEEsingle(), "snan123"); APFloat PNormalValue = APFloat(APFloat::IEEEsingle(), "0x1p+0"); APFloat MNormalValue = APFloat(APFloat::IEEEsingle(), "-0x1p+0"); APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), false); @@ -1770,23 +1878,19 @@ TEST(APFloatTest, add) { const int OverflowStatus = APFloat::opOverflow | APFloat::opInexact; - const unsigned NumTests = 169; struct { APFloat x; APFloat y; const char *result; int status; int category; - } SpecialCaseTests[NumTests] = { + } SpecialCaseTests[] = { { PInf, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, { PInf, PZero, "inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, MZero, "inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 - // See Note 1. - { PInf, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PInf, PNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, MNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, PLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, @@ -1800,10 +1904,7 @@ TEST(APFloatTest, add) { { MInf, PZero, "-inf", APFloat::opOK, APFloat::fcInfinity }, { MInf, MZero, "-inf", APFloat::opOK, APFloat::fcInfinity }, { MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 - // See Note 1. - { MInf, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MInf, PNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, { MInf, MNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, { MInf, PLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, @@ -1817,10 +1918,7 @@ TEST(APFloatTest, add) { { PZero, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { PZero, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 - // See Note 1. - { PZero, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PZero, PNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, { PZero, MNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, { PZero, PLargestValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, @@ -1834,10 +1932,7 @@ TEST(APFloatTest, add) { { MZero, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { MZero, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 - // See Note 1. - { MZero, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MZero, PNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, { MZero, MNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, { MZero, PLargestValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, @@ -1851,10 +1946,7 @@ TEST(APFloatTest, add) { { QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 - // See Note 1. { QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif { QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, @@ -1863,32 +1955,26 @@ TEST(APFloatTest, add) { { QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 - // See Note 1. - { SNaN, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, QNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PNormalValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { PNormalValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, { PNormalValue, PZero, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, { PNormalValue, MZero, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, { PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 - // See Note 1. - { PNormalValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PNormalValue, PNormalValue, "0x1p+1", APFloat::opOK, APFloat::fcNormal }, { PNormalValue, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { PNormalValue, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, @@ -1902,10 +1988,7 @@ TEST(APFloatTest, add) { { MNormalValue, PZero, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, { MNormalValue, MZero, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, { MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 - // See Note 1. - { MNormalValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MNormalValue, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { MNormalValue, MNormalValue, "-0x1p+1", APFloat::opOK, APFloat::fcNormal }, { MNormalValue, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, @@ -1919,10 +2002,7 @@ TEST(APFloatTest, add) { { PLargestValue, PZero, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { PLargestValue, MZero, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 - // See Note 1. - { PLargestValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PLargestValue, PNormalValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, { PLargestValue, MNormalValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, { PLargestValue, PLargestValue, "inf", OverflowStatus, APFloat::fcInfinity }, @@ -1936,10 +2016,7 @@ TEST(APFloatTest, add) { { MLargestValue, PZero, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { MLargestValue, MZero, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 - // See Note 1. - { MLargestValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MLargestValue, PNormalValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, { MLargestValue, MNormalValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, { MLargestValue, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, @@ -1953,10 +2030,7 @@ TEST(APFloatTest, add) { { PSmallestValue, PZero, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, { PSmallestValue, MZero, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, { PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 - // See Note 1. - { PSmallestValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PSmallestValue, PNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { PSmallestValue, MNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { PSmallestValue, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, @@ -1970,10 +2044,7 @@ TEST(APFloatTest, add) { { MSmallestValue, PZero, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, { MSmallestValue, MZero, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, { MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 - // See Note 1. - { MSmallestValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MSmallestValue, PNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { MSmallestValue, MNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { MSmallestValue, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, @@ -1987,10 +2058,7 @@ TEST(APFloatTest, add) { { PSmallestNormalized, PZero, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, { PSmallestNormalized, MZero, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, { PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PSmallestNormalized, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PSmallestNormalized, PNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { PSmallestNormalized, MNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { PSmallestNormalized, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, @@ -2004,10 +2072,7 @@ TEST(APFloatTest, add) { { MSmallestNormalized, PZero, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, { MSmallestNormalized, MZero, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, { MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 - // See Note 1. - { MSmallestNormalized, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MSmallestNormalized, PNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { MSmallestNormalized, MNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { MSmallestNormalized, PLargestValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, @@ -2018,7 +2083,7 @@ TEST(APFloatTest, add) { { MSmallestNormalized, MSmallestNormalized, "-0x1p-125", APFloat::opOK, APFloat::fcNormal } }; - for (size_t i = 0; i < NumTests; ++i) { + for (size_t i = 0; i < array_lengthof(SpecialCaseTests); ++i) { APFloat x(SpecialCaseTests[i].x); APFloat y(SpecialCaseTests[i].y); APFloat::opStatus status = x.add(y, APFloat::rmNearestTiesToEven); @@ -2026,25 +2091,20 @@ TEST(APFloatTest, add) { APFloat result(APFloat::IEEEsingle(), SpecialCaseTests[i].result); EXPECT_TRUE(result.bitwiseIsEqual(x)); - EXPECT_TRUE((int)status == SpecialCaseTests[i].status); - EXPECT_TRUE((int)x.getCategory() == SpecialCaseTests[i].category); + EXPECT_EQ(SpecialCaseTests[i].status, (int)status); + EXPECT_EQ(SpecialCaseTests[i].category, (int)x.getCategory()); } } TEST(APFloatTest, subtract) { // Test Special Cases against each other and normal values. - // TODOS/NOTES: - // 1. Since we perform only default exception handling all operations with - // signaling NaNs should have a result that is a quiet NaN. Currently they - // return sNaN. - APFloat PInf = APFloat::getInf(APFloat::IEEEsingle(), false); APFloat MInf = APFloat::getInf(APFloat::IEEEsingle(), true); APFloat PZero = APFloat::getZero(APFloat::IEEEsingle(), false); APFloat MZero = APFloat::getZero(APFloat::IEEEsingle(), true); APFloat QNaN = APFloat::getNaN(APFloat::IEEEsingle(), false); - APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle(), false); + APFloat SNaN = APFloat(APFloat::IEEEsingle(), "snan123"); APFloat PNormalValue = APFloat(APFloat::IEEEsingle(), "0x1p+0"); APFloat MNormalValue = APFloat(APFloat::IEEEsingle(), "-0x1p+0"); APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), false); @@ -2058,23 +2118,19 @@ TEST(APFloatTest, subtract) { const int OverflowStatus = APFloat::opOverflow | APFloat::opInexact; - const unsigned NumTests = 169; struct { APFloat x; APFloat y; const char *result; int status; int category; - } SpecialCaseTests[NumTests] = { + } SpecialCaseTests[] = { { PInf, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, { PInf, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, PZero, "inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, MZero, "inf", APFloat::opOK, APFloat::fcInfinity }, - { PInf, QNaN, "-nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PInf, SNaN, "-nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, + { PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PInf, PNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, MNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, PLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, @@ -2087,11 +2143,8 @@ TEST(APFloatTest, subtract) { { MInf, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, { MInf, PZero, "-inf", APFloat::opOK, APFloat::fcInfinity }, { MInf, MZero, "-inf", APFloat::opOK, APFloat::fcInfinity }, - { MInf, QNaN, "-nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MInf, SNaN, "-nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, + { MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MInf, PNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, { MInf, MNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, { MInf, PLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, @@ -2104,11 +2157,8 @@ TEST(APFloatTest, subtract) { { PZero, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { PZero, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { PZero, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { PZero, QNaN, "-nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PZero, SNaN, "-nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, + { PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PZero, PNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, { PZero, MNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, { PZero, PLargestValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, @@ -2121,11 +2171,8 @@ TEST(APFloatTest, subtract) { { MZero, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { MZero, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { MZero, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, - { MZero, QNaN, "-nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MZero, SNaN, "-nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, + { MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MZero, PNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, { MZero, MNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, { MZero, PLargestValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, @@ -2139,10 +2186,7 @@ TEST(APFloatTest, subtract) { { QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. { QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif { QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, @@ -2151,32 +2195,26 @@ TEST(APFloatTest, subtract) { { QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { SNaN, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, QNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PNormalValue, PInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, { PNormalValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { PNormalValue, PZero, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, { PNormalValue, MZero, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { PNormalValue, QNaN, "-nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PNormalValue, SNaN, "-nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, + { PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PNormalValue, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { PNormalValue, MNormalValue, "0x1p+1", APFloat::opOK, APFloat::fcNormal }, { PNormalValue, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, @@ -2189,11 +2227,8 @@ TEST(APFloatTest, subtract) { { MNormalValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { MNormalValue, PZero, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, { MNormalValue, MZero, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, - { MNormalValue, QNaN, "-nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MNormalValue, SNaN, "-nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, + { MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MNormalValue, PNormalValue, "-0x1p+1", APFloat::opOK, APFloat::fcNormal }, { MNormalValue, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { MNormalValue, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, @@ -2206,11 +2241,8 @@ TEST(APFloatTest, subtract) { { PLargestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { PLargestValue, PZero, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { PLargestValue, MZero, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { PLargestValue, QNaN, "-nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PLargestValue, SNaN, "-nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, + { PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PLargestValue, PNormalValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, { PLargestValue, MNormalValue, "0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, { PLargestValue, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, @@ -2223,11 +2255,8 @@ TEST(APFloatTest, subtract) { { MLargestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { MLargestValue, PZero, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { MLargestValue, MZero, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, - { MLargestValue, QNaN, "-nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MLargestValue, SNaN, "-nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, + { MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MLargestValue, PNormalValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, { MLargestValue, MNormalValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, { MLargestValue, PLargestValue, "-inf", OverflowStatus, APFloat::fcInfinity }, @@ -2240,11 +2269,8 @@ TEST(APFloatTest, subtract) { { PSmallestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { PSmallestValue, PZero, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, { PSmallestValue, MZero, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { PSmallestValue, QNaN, "-nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PSmallestValue, SNaN, "-nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, + { PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PSmallestValue, PNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { PSmallestValue, MNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { PSmallestValue, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, @@ -2257,11 +2283,8 @@ TEST(APFloatTest, subtract) { { MSmallestValue, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { MSmallestValue, PZero, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, { MSmallestValue, MZero, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, - { MSmallestValue, QNaN, "-nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MSmallestValue, SNaN, "-nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, + { MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MSmallestValue, PNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { MSmallestValue, MNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { MSmallestValue, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, @@ -2274,11 +2297,8 @@ TEST(APFloatTest, subtract) { { PSmallestNormalized, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { PSmallestNormalized, PZero, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, { PSmallestNormalized, MZero, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { PSmallestNormalized, QNaN, "-nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PSmallestNormalized, SNaN, "-nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, + { PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PSmallestNormalized, PNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { PSmallestNormalized, MNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { PSmallestNormalized, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, @@ -2291,11 +2311,8 @@ TEST(APFloatTest, subtract) { { MSmallestNormalized, MInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { MSmallestNormalized, PZero, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, { MSmallestNormalized, MZero, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, - { MSmallestNormalized, QNaN, "-nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MSmallestNormalized, SNaN, "-nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, + { MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MSmallestNormalized, PNormalValue, "-0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { MSmallestNormalized, MNormalValue, "0x1p+0", APFloat::opInexact, APFloat::fcNormal }, { MSmallestNormalized, PLargestValue, "-0x1.fffffep+127", APFloat::opInexact, APFloat::fcNormal }, @@ -2306,7 +2323,7 @@ TEST(APFloatTest, subtract) { { MSmallestNormalized, MSmallestNormalized, "0x0p+0", APFloat::opOK, APFloat::fcZero } }; - for (size_t i = 0; i < NumTests; ++i) { + for (size_t i = 0; i < array_lengthof(SpecialCaseTests); ++i) { APFloat x(SpecialCaseTests[i].x); APFloat y(SpecialCaseTests[i].y); APFloat::opStatus status = x.subtract(y, APFloat::rmNearestTiesToEven); @@ -2314,25 +2331,20 @@ TEST(APFloatTest, subtract) { APFloat result(APFloat::IEEEsingle(), SpecialCaseTests[i].result); EXPECT_TRUE(result.bitwiseIsEqual(x)); - EXPECT_TRUE((int)status == SpecialCaseTests[i].status); - EXPECT_TRUE((int)x.getCategory() == SpecialCaseTests[i].category); + EXPECT_EQ(SpecialCaseTests[i].status, (int)status); + EXPECT_EQ(SpecialCaseTests[i].category, (int)x.getCategory()); } } TEST(APFloatTest, multiply) { // Test Special Cases against each other and normal values. - // TODOS/NOTES: - // 1. Since we perform only default exception handling all operations with - // signaling NaNs should have a result that is a quiet NaN. Currently they - // return sNaN. - APFloat PInf = APFloat::getInf(APFloat::IEEEsingle(), false); APFloat MInf = APFloat::getInf(APFloat::IEEEsingle(), true); APFloat PZero = APFloat::getZero(APFloat::IEEEsingle(), false); APFloat MZero = APFloat::getZero(APFloat::IEEEsingle(), true); APFloat QNaN = APFloat::getNaN(APFloat::IEEEsingle(), false); - APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle(), false); + APFloat SNaN = APFloat(APFloat::IEEEsingle(), "snan123"); APFloat PNormalValue = APFloat(APFloat::IEEEsingle(), "0x1p+0"); APFloat MNormalValue = APFloat(APFloat::IEEEsingle(), "-0x1p+0"); APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), false); @@ -2367,10 +2379,7 @@ TEST(APFloatTest, multiply) { { PInf, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, { PInf, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, { PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PInf, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PInf, PNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, MNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, PLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, @@ -2384,10 +2393,7 @@ TEST(APFloatTest, multiply) { { MInf, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, { MInf, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, { MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MInf, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MInf, PNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, { MInf, MNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, { MInf, PLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, @@ -2401,10 +2407,7 @@ TEST(APFloatTest, multiply) { { PZero, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { PZero, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PZero, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PZero, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { PZero, MNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { PZero, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, @@ -2418,10 +2421,7 @@ TEST(APFloatTest, multiply) { { MZero, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { MZero, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MZero, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MZero, PNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { MZero, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { MZero, PLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, @@ -2435,10 +2435,7 @@ TEST(APFloatTest, multiply) { { QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. { QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif { QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, @@ -2447,32 +2444,26 @@ TEST(APFloatTest, multiply) { { QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { SNaN, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, QNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PNormalValue, PInf, "inf", APFloat::opOK, APFloat::fcInfinity }, { PNormalValue, MInf, "-inf", APFloat::opOK, APFloat::fcInfinity }, { PNormalValue, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { PNormalValue, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PNormalValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PNormalValue, PNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, { PNormalValue, MNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, { PNormalValue, PLargestValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, @@ -2486,10 +2477,7 @@ TEST(APFloatTest, multiply) { { MNormalValue, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { MNormalValue, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MNormalValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MNormalValue, PNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, { MNormalValue, MNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, { MNormalValue, PLargestValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, @@ -2503,10 +2491,7 @@ TEST(APFloatTest, multiply) { { PLargestValue, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { PLargestValue, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PLargestValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PLargestValue, PNormalValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { PLargestValue, MNormalValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { PLargestValue, PLargestValue, "inf", OverflowStatus, APFloat::fcInfinity }, @@ -2520,10 +2505,7 @@ TEST(APFloatTest, multiply) { { MLargestValue, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { MLargestValue, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MLargestValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MLargestValue, PNormalValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { MLargestValue, MNormalValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { MLargestValue, PLargestValue, "-inf", OverflowStatus, APFloat::fcInfinity }, @@ -2537,10 +2519,7 @@ TEST(APFloatTest, multiply) { { PSmallestValue, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { PSmallestValue, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PSmallestValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PSmallestValue, PNormalValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, { PSmallestValue, MNormalValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, { PSmallestValue, PLargestValue, "0x1.fffffep-22", APFloat::opOK, APFloat::fcNormal }, @@ -2554,10 +2533,7 @@ TEST(APFloatTest, multiply) { { MSmallestValue, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { MSmallestValue, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MSmallestValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MSmallestValue, PNormalValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, { MSmallestValue, MNormalValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, { MSmallestValue, PLargestValue, "-0x1.fffffep-22", APFloat::opOK, APFloat::fcNormal }, @@ -2571,10 +2547,7 @@ TEST(APFloatTest, multiply) { { PSmallestNormalized, PZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { PSmallestNormalized, MZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PSmallestNormalized, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PSmallestNormalized, PNormalValue, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, { PSmallestNormalized, MNormalValue, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, { PSmallestNormalized, PLargestValue, "0x1.fffffep+1", APFloat::opOK, APFloat::fcNormal }, @@ -2588,10 +2561,7 @@ TEST(APFloatTest, multiply) { { MSmallestNormalized, PZero, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { MSmallestNormalized, MZero, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MSmallestNormalized, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MSmallestNormalized, PNormalValue, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, { MSmallestNormalized, MNormalValue, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, { MSmallestNormalized, PLargestValue, "-0x1.fffffep+1", APFloat::opOK, APFloat::fcNormal }, @@ -2665,25 +2635,20 @@ TEST(APFloatTest, multiply) { APFloat result(x.getSemantics(), SpecialCaseTests[i].result); EXPECT_TRUE(result.bitwiseIsEqual(x)); - EXPECT_TRUE((int)status == SpecialCaseTests[i].status); - EXPECT_TRUE((int)x.getCategory() == SpecialCaseTests[i].category); + EXPECT_EQ(SpecialCaseTests[i].status, (int)status); + EXPECT_EQ(SpecialCaseTests[i].category, (int)x.getCategory()); } } TEST(APFloatTest, divide) { // Test Special Cases against each other and normal values. - // TODOS/NOTES: - // 1. Since we perform only default exception handling all operations with - // signaling NaNs should have a result that is a quiet NaN. Currently they - // return sNaN. - APFloat PInf = APFloat::getInf(APFloat::IEEEsingle(), false); APFloat MInf = APFloat::getInf(APFloat::IEEEsingle(), true); APFloat PZero = APFloat::getZero(APFloat::IEEEsingle(), false); APFloat MZero = APFloat::getZero(APFloat::IEEEsingle(), true); APFloat QNaN = APFloat::getNaN(APFloat::IEEEsingle(), false); - APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle(), false); + APFloat SNaN = APFloat(APFloat::IEEEsingle(), "snan123"); APFloat PNormalValue = APFloat(APFloat::IEEEsingle(), "0x1p+0"); APFloat MNormalValue = APFloat(APFloat::IEEEsingle(), "-0x1p+0"); APFloat PLargestValue = APFloat::getLargest(APFloat::IEEEsingle(), false); @@ -2718,10 +2683,7 @@ TEST(APFloatTest, divide) { { PInf, PZero, "inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, MZero, "-inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PInf, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PInf, PNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, MNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, { PInf, PLargestValue, "inf", APFloat::opOK, APFloat::fcInfinity }, @@ -2735,10 +2697,7 @@ TEST(APFloatTest, divide) { { MInf, PZero, "-inf", APFloat::opOK, APFloat::fcInfinity }, { MInf, MZero, "inf", APFloat::opOK, APFloat::fcInfinity }, { MInf, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MInf, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MInf, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MInf, PNormalValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, { MInf, MNormalValue, "inf", APFloat::opOK, APFloat::fcInfinity }, { MInf, PLargestValue, "-inf", APFloat::opOK, APFloat::fcInfinity }, @@ -2752,10 +2711,7 @@ TEST(APFloatTest, divide) { { PZero, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, { PZero, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, { PZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PZero, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PZero, PNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { PZero, MNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { PZero, PLargestValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, @@ -2769,10 +2725,7 @@ TEST(APFloatTest, divide) { { MZero, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, { MZero, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, { MZero, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MZero, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MZero, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MZero, PNormalValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { MZero, MNormalValue, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { MZero, PLargestValue, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, @@ -2786,10 +2739,7 @@ TEST(APFloatTest, divide) { { QNaN, PZero, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, MZero, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. { QNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif { QNaN, PNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, MNormalValue, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, PLargestValue, "nan", APFloat::opOK, APFloat::fcNaN }, @@ -2798,32 +2748,26 @@ TEST(APFloatTest, divide) { { QNaN, MSmallestValue, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, PSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, { QNaN, MSmallestNormalized, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { SNaN, PInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MInf, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MZero, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, QNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MNormalValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MLargestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestValue, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, PSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, - { SNaN, MSmallestNormalized, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { SNaN, PInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MInf, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MZero, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, QNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MNormalValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MLargestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MSmallestValue, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, PSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, + { SNaN, MSmallestNormalized, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PNormalValue, PInf, "0x0p+0", APFloat::opOK, APFloat::fcZero }, { PNormalValue, MInf, "-0x0p+0", APFloat::opOK, APFloat::fcZero }, { PNormalValue, PZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, { PNormalValue, MZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, { PNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PNormalValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PNormalValue, PNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, { PNormalValue, MNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, { PNormalValue, PLargestValue, "0x1p-128", UnderflowStatus, APFloat::fcNormal }, @@ -2837,10 +2781,7 @@ TEST(APFloatTest, divide) { { MNormalValue, PZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, { MNormalValue, MZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, { MNormalValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MNormalValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MNormalValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MNormalValue, PNormalValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, { MNormalValue, MNormalValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, { MNormalValue, PLargestValue, "-0x1p-128", UnderflowStatus, APFloat::fcNormal }, @@ -2854,10 +2795,7 @@ TEST(APFloatTest, divide) { { PLargestValue, PZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, { PLargestValue, MZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, { PLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PLargestValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PLargestValue, PNormalValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { PLargestValue, MNormalValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { PLargestValue, PLargestValue, "0x1p+0", APFloat::opOK, APFloat::fcNormal }, @@ -2871,10 +2809,7 @@ TEST(APFloatTest, divide) { { MLargestValue, PZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, { MLargestValue, MZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, { MLargestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MLargestValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MLargestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MLargestValue, PNormalValue, "-0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { MLargestValue, MNormalValue, "0x1.fffffep+127", APFloat::opOK, APFloat::fcNormal }, { MLargestValue, PLargestValue, "-0x1p+0", APFloat::opOK, APFloat::fcNormal }, @@ -2888,10 +2823,7 @@ TEST(APFloatTest, divide) { { PSmallestValue, PZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, { PSmallestValue, MZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, { PSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PSmallestValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PSmallestValue, PNormalValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, { PSmallestValue, MNormalValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, { PSmallestValue, PLargestValue, "0x0p+0", UnderflowStatus, APFloat::fcZero }, @@ -2905,10 +2837,7 @@ TEST(APFloatTest, divide) { { MSmallestValue, PZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, { MSmallestValue, MZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, { MSmallestValue, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MSmallestValue, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MSmallestValue, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MSmallestValue, PNormalValue, "-0x1p-149", APFloat::opOK, APFloat::fcNormal }, { MSmallestValue, MNormalValue, "0x1p-149", APFloat::opOK, APFloat::fcNormal }, { MSmallestValue, PLargestValue, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, @@ -2922,10 +2851,7 @@ TEST(APFloatTest, divide) { { PSmallestNormalized, PZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, { PSmallestNormalized, MZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, { PSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { PSmallestNormalized, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { PSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { PSmallestNormalized, PNormalValue, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, { PSmallestNormalized, MNormalValue, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, { PSmallestNormalized, PLargestValue, "0x0p+0", UnderflowStatus, APFloat::fcZero }, @@ -2939,10 +2865,7 @@ TEST(APFloatTest, divide) { { MSmallestNormalized, PZero, "-inf", APFloat::opDivByZero, APFloat::fcInfinity }, { MSmallestNormalized, MZero, "inf", APFloat::opDivByZero, APFloat::fcInfinity }, { MSmallestNormalized, QNaN, "nan", APFloat::opOK, APFloat::fcNaN }, -#if 0 -// See Note 1. - { MSmallestNormalized, SNaN, "nan", APFloat::opInvalidOp, APFloat::fcNaN }, -#endif + { MSmallestNormalized, SNaN, "nan123", APFloat::opInvalidOp, APFloat::fcNaN }, { MSmallestNormalized, PNormalValue, "-0x1p-126", APFloat::opOK, APFloat::fcNormal }, { MSmallestNormalized, MNormalValue, "0x1p-126", APFloat::opOK, APFloat::fcNormal }, { MSmallestNormalized, PLargestValue, "-0x0p+0", UnderflowStatus, APFloat::fcZero }, @@ -2994,8 +2917,8 @@ TEST(APFloatTest, divide) { APFloat result(x.getSemantics(), SpecialCaseTests[i].result); EXPECT_TRUE(result.bitwiseIsEqual(x)); - EXPECT_TRUE((int)status == SpecialCaseTests[i].status); - EXPECT_TRUE((int)x.getCategory() == SpecialCaseTests[i].category); + EXPECT_EQ(SpecialCaseTests[i].status, (int)status); + EXPECT_EQ(SpecialCaseTests[i].category, (int)x.getCategory()); } } diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp index b6fee5b7ff1aab..6e87c70d56321f 100644 --- a/llvm/unittests/ADT/APIntTest.cpp +++ b/llvm/unittests/ADT/APIntTest.cpp @@ -2604,31 +2604,36 @@ TEST(APIntTest, RoundingSDiv) { EXPECT_EQ(0, APIntOps::RoundingSDiv(Zero, A, APInt::Rounding::TOWARD_ZERO)); } - for (uint64_t Bi = -128; Bi <= 127; Bi++) { + for (int64_t Bi = -128; Bi <= 127; Bi++) { if (Bi == 0) continue; APInt B(8, Bi); + APInt QuoTowardZero = A.sdiv(B); { APInt Quo = APIntOps::RoundingSDiv(A, B, APInt::Rounding::UP); - auto Prod = Quo.sext(16) * B.sext(16); - EXPECT_TRUE(Prod.uge(A)); - if (Prod.ugt(A)) { - EXPECT_TRUE(((Quo - 1).sext(16) * B.sext(16)).ult(A)); + if (A.srem(B).isNullValue()) { + EXPECT_EQ(QuoTowardZero, Quo); + } else if (A.isNegative() != + B.isNegative()) { // if the math quotient is negative. + EXPECT_EQ(QuoTowardZero, Quo); + } else { + EXPECT_EQ(QuoTowardZero + 1, Quo); } } { APInt Quo = APIntOps::RoundingSDiv(A, B, APInt::Rounding::DOWN); - auto Prod = Quo.sext(16) * B.sext(16); - EXPECT_TRUE(Prod.ule(A)); - if (Prod.ult(A)) { - EXPECT_TRUE(((Quo + 1).sext(16) * B.sext(16)).ugt(A)); + if (A.srem(B).isNullValue()) { + EXPECT_EQ(QuoTowardZero, Quo); + } else if (A.isNegative() != + B.isNegative()) { // if the math quotient is negative. + EXPECT_EQ(QuoTowardZero - 1, Quo); + } else { + EXPECT_EQ(QuoTowardZero, Quo); } } - { - APInt Quo = A.sdiv(B); - EXPECT_EQ(Quo, APIntOps::RoundingSDiv(A, B, APInt::Rounding::TOWARD_ZERO)); - } + EXPECT_EQ(QuoTowardZero, + APIntOps::RoundingSDiv(A, B, APInt::Rounding::TOWARD_ZERO)); } } } diff --git a/llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp index 3f0f85b69a71d1..896914da624cb6 100644 --- a/llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp @@ -94,7 +94,7 @@ TEST(LegacyRTDyldObjectLinkingLayerTest, TestSetProcessAllSections) { if (!TM) return; - auto Obj = SimpleCompiler(*TM)(*M); + auto Obj = cantFail(SimpleCompiler(*TM)(*M)); { // Test with ProcessAllSections = false (the default). @@ -165,7 +165,7 @@ TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) { Builder.CreateRet(FourtyTwo); } - auto Obj1 = Compile(*MB1.getModule()); + auto Obj1 = cantFail(Compile(*MB1.getModule())); ModuleBuilder MB2(Context, "", "dummy"); { @@ -178,7 +178,7 @@ TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) { IRBuilder<> Builder(FooEntry); Builder.CreateRet(Builder.CreateCall(BarDecl)); } - auto Obj2 = Compile(*MB2.getModule()); + auto Obj2 = cantFail(Compile(*MB2.getModule())); auto K1 = ES.allocateVModule(); Resolvers[K1] = std::make_shared(); @@ -251,7 +251,7 @@ TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) { Builder.CreateRet(FourtyTwo); } - auto Obj1 = Compile(*MB1.getModule()); + auto Obj1 = cantFail(Compile(*MB1.getModule())); ModuleBuilder MB2(Context, "", "dummy"); { @@ -264,7 +264,7 @@ TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) { Value *Seven = ConstantInt::getSigned(Int32Ty, 7); Builder.CreateRet(Seven); } - auto Obj2 = Compile(*MB2.getModule()); + auto Obj2 = cantFail(Compile(*MB2.getModule())); auto K = ES.allocateVModule(); cantFail(ObjLayer.addObject(K, std::move(Obj1))); diff --git a/llvm/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp index 2ff7e91a732342..0d8ead53e6dae9 100644 --- a/llvm/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp @@ -296,7 +296,8 @@ TEST(LegacyObjectTransformLayerTest, Main) { LegacyObjectTransformLayer TransformLayer(llvm::AcknowledgeORCv1Deprecation, BaseLayer, IdentityTransform); - auto NullCompiler = [](llvm::Module &) { + auto NullCompiler = [](llvm::Module &) + -> llvm::Expected> { return std::unique_ptr(nullptr); }; LegacyIRCompileLayer diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp index 39fdc2e9ce9b6f..22d928cec4f2c4 100644 --- a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp @@ -44,7 +44,7 @@ class OrcCAPIExecutionTest : public testing::Test, public OrcExecutionTest { return MB.takeModule(); } - std::unique_ptr createTestObject() { + Expected> createTestObject() { orc::SimpleCompiler IRCompiler(*TM); auto M = createTestModule(TM->getTargetTriple()); M->setDataLayout(TM->createDataLayout()); @@ -161,7 +161,7 @@ TEST_F(OrcCAPIExecutionTest, TestAddObjectFile) { if (!SupportsJIT) return; - auto ObjBuffer = createTestObject(); + auto ObjBuffer = cantFail(createTestObject()); LLVMOrcJITStackRef JIT = LLVMOrcCreateInstance(wrap(TM.get())); diff --git a/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp index f1c0da6a9abb6c..0c66841e9af068 100644 --- a/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp @@ -89,7 +89,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) { if (!TM) return; - auto Obj = SimpleCompiler(*TM)(*M); + auto Obj = cantFail(SimpleCompiler(*TM)(*M)); EXPECT_FALSE(testSetProcessAllSections( MemoryBuffer::getMemBufferCopy(Obj->getBuffer()), false)) @@ -115,7 +115,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestOverrideObjectFlags) { public: FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {} - CompileResult operator()(Module &M) { + Expected operator()(Module &M) { auto *Foo = M.getFunction("foo"); assert(Foo && "Expected function Foo not found"); Foo->setVisibility(GlobalValue::HiddenVisibility); @@ -155,7 +155,8 @@ TEST(RTDyldObjectLinkingLayerTest, TestOverrideObjectFlags) { auto Foo = ES.intern("foo"); RTDyldObjectLinkingLayer ObjLayer( ES, []() { return std::make_unique(); }); - IRCompileLayer CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM)); + IRCompileLayer CompileLayer(ES, ObjLayer, + std::make_unique(*TM)); ObjLayer.setOverrideObjectFlagsWithResponsibilityFlags(true); @@ -184,7 +185,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) { public: FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {} - CompileResult operator()(Module &M) { + Expected operator()(Module &M) { Function *BarImpl = Function::Create( FunctionType::get(Type::getVoidTy(M.getContext()), {}, false), GlobalValue::ExternalLinkage, "bar", &M); @@ -221,7 +222,8 @@ TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) { auto Foo = ES.intern("foo"); RTDyldObjectLinkingLayer ObjLayer( ES, []() { return std::make_unique(); }); - IRCompileLayer CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM)); + IRCompileLayer CompileLayer(ES, ObjLayer, + std::make_unique(*TM)); ObjLayer.setAutoClaimResponsibilityForObjectSymbols(true); diff --git a/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp index 4377d5267796ee..429d917237d059 100644 --- a/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp @@ -105,7 +105,7 @@ MockObjectLayer::ObjectPtr createTestObject() { B.CreateRet(ConstantInt::getSigned(Type::getInt32Ty(Ctx), 42)); SimpleCompiler IRCompiler(*TM); - return IRCompiler(*MB.getModule()); + return cantFail(IRCompiler(*MB.getModule())); } TEST(RemoteObjectLayer, AddObject) { diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn index 045751141ad149..621458df86c400 100644 --- a/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn @@ -176,6 +176,7 @@ static_library("LLVMAMDGPUCodeGen") { "SIPeepholeSDWA.cpp", "SIPreAllocateWWMRegs.cpp", "SIRegisterInfo.cpp", + "SIRemoveShortExecBranches.cpp", "SIShrinkInstructions.cpp", "SIWholeQuadMode.cpp", ] diff --git a/mlir/include/mlir/TableGen/Attribute.h b/mlir/include/mlir/TableGen/Attribute.h index 7d7d9fe039c1a5..2cea715a24f74b 100644 --- a/mlir/include/mlir/TableGen/Attribute.h +++ b/mlir/include/mlir/TableGen/Attribute.h @@ -64,8 +64,8 @@ class Attribute : public AttrConstraint { // Returns the template that can be used to produce an instance of the // attribute. - // Syntax: {0} should be replaced with a builder, {1} should be replaced with - // the constant value. + // Syntax: `$builder` should be replaced with a builder, `$0` should be + // replaced with the constant value. StringRef getConstBuilderTemplate() const; // Returns the base-level attribute that this attribute constraint is diff --git a/mlir/test/mlir-tblgen/llvm-intrinsics.td b/mlir/test/mlir-tblgen/llvm-intrinsics.td index 27b76cca2b33fd..a8d2e8aacac6ca 100644 --- a/mlir/test/mlir-tblgen/llvm-intrinsics.td +++ b/mlir/test/mlir-tblgen/llvm-intrinsics.td @@ -6,16 +6,21 @@ // includes from the main file to avoid unnecessary dependencies and decrease // the test cost. The command-line flags further ensure a specific intrinsic is // processed and we only check the ouptut below. +// We also verify emission of type specialization for overloadable intrinsics. // // RUN: cat %S/../../../llvm/include/llvm/IR/Intrinsics.td \ // RUN: | grep -v "llvm/IR/Intrinsics" \ -// RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=vastart \ +// RUN: | mlir-tblgen -gen-llvmir-intrinsics -I %S/../../../llvm/include/ --llvmir-intrinsics-filter=is_constant \ // RUN: | FileCheck %s -// CHECK-LABEL: def LLVM_vastart +// CHECK-LABEL: def LLVM_is_constant // CHECK: LLVM_Op<"intr // CHECK: Arguments<(ins // CHECK: Results<(outs +// CHECK: llvm::Function *fn = llvm::Intrinsic::getDeclaration( +// CHECK: module, llvm::Intrinsic::is_constant, { +// CHECK: opInst.getOperand(0).getType().cast().getUnderlyingType(), +// CHECK: }); //---------------------------------------------------------------------------// diff --git a/mlir/test/mlir-tblgen/op-attribute.td b/mlir/test/mlir-tblgen/op-attribute.td index 11d5794105a414..61c887b2d59cf5 100644 --- a/mlir/test/mlir-tblgen/op-attribute.td +++ b/mlir/test/mlir-tblgen/op-attribute.td @@ -186,6 +186,11 @@ def DOp : NS_Op<"d_op", []> { // DECL-LABEL: DOp declarations // DECL: static void build({{.*}}, APInt i32_attr, APFloat f64_attr, StringRef str_attr, bool bool_attr, ::SomeI32Enum enum_attr, APInt dv_i32_attr, APFloat dv_f64_attr, StringRef dv_str_attr = "abc", bool dv_bool_attr = true, ::SomeI32Enum dv_enum_attr = ::SomeI32Enum::case5) +// DEF-LABEL: DOp definitions +// DEF: odsState.addAttribute("str_attr", (*odsBuilder).getStringAttr(str_attr)); +// DEF: odsState.addAttribute("dv_str_attr", (*odsBuilder).getStringAttr(dv_str_attr)); + + // Test that only default valued attributes at the end of the arguments // list get default values in the builder signature // --- diff --git a/mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp b/mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp index 5ab85252261064..8e336bb82faf6b 100644 --- a/mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp +++ b/mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp @@ -14,7 +14,9 @@ #include "mlir/Support/STLExtras.h" #include "mlir/TableGen/GenInfo.h" +#include "llvm/ADT/SmallBitVector.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/MachineValueType.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Signals.h" #include "llvm/TableGen/Error.h" @@ -30,6 +32,38 @@ static llvm::cl::opt "substring in their record name"), llvm::cl::cat(IntrinsicGenCat)); +// Used to represent the indices of overloadable operands/results. +using IndicesTy = llvm::SmallBitVector; + +/// Return a CodeGen value type entry from a type record. +static llvm::MVT::SimpleValueType getValueType(const llvm::Record *rec) { + return (llvm::MVT::SimpleValueType)rec->getValueAsDef("VT")->getValueAsInt( + "Value"); +} + +/// Return the indices of the definitions in a list of definitions that +/// represent overloadable types +static IndicesTy getOverloadableTypeIdxs(const llvm::Record &record, + const char *listName) { + auto results = record.getValueAsListOfDefs(listName); + IndicesTy overloadedOps(results.size()); + for (auto r : llvm::enumerate(results)) { + llvm::MVT::SimpleValueType vt = getValueType(r.value()); + switch (vt) { + case llvm::MVT::iAny: + case llvm::MVT::fAny: + case llvm::MVT::Any: + case llvm::MVT::iPTRAny: + case llvm::MVT::vAny: + overloadedOps.set(r.index()); + break; + default: + continue; + } + } + return overloadedOps; +} + namespace { /// A wrapper for LLVM's Tablegen class `Intrinsic` that provides accessors to /// the fields of the record. @@ -108,6 +142,14 @@ class LLVMIntrinsic { return false; } + IndicesTy getOverloadableOperandsIdxs() const { + return getOverloadableTypeIdxs(record, fieldOperands); + } + + IndicesTy getOverloadableResultsIdxs() const { + return getOverloadableTypeIdxs(record, fieldResults); + } + private: /// Names of the fields in the Intrinsic LLVM Tablegen class. const char *fieldName = "LLVMName"; @@ -122,10 +164,23 @@ class LLVMIntrinsic { /// Emits C++ code constructing an LLVM IR intrinsic given the generated MLIR /// operation. In LLVM IR, intrinsics are constructed as function calls. static void emitBuilder(const LLVMIntrinsic &intr, llvm::raw_ostream &os) { + auto overloadedRes = intr.getOverloadableResultsIdxs(); + auto overloadedOps = intr.getOverloadableOperandsIdxs(); os << " llvm::Module *module = builder.GetInsertBlock()->getModule();\n"; os << " llvm::Function *fn = llvm::Intrinsic::getDeclaration(\n"; os << " module, llvm::Intrinsic::" << intr.getProperRecordName() - << ");\n"; + << ", {"; + for (unsigned idx : overloadedRes.set_bits()) { + os << "\n opInst.getResult(" << idx << ").getType()" + << ".cast().getUnderlyingType(),"; + } + for (unsigned idx : overloadedOps.set_bits()) { + os << "\n opInst.getOperand(" << idx << ").getType()" + << ".cast().getUnderlyingType(),"; + } + if (overloadedRes.any() || overloadedOps.any()) + os << "\n "; + os << "});\n"; os << " auto operands = llvm::to_vector<8, Value *>(\n"; os << " opInst.operand_begin(), opInst.operand_end());\n"; os << " " << (intr.getNumResults() > 0 ? "$res = " : "") diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp index ad0b9ef737f77c..52bc9cc697e266 100644 --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "mlir/Support/STLExtras.h" +#include "mlir/Support/StringExtras.h" #include "mlir/TableGen/Format.h" #include "mlir/TableGen/GenInfo.h" #include "mlir/TableGen/OpClass.h" @@ -91,6 +92,17 @@ static const char *const opCommentHeader = R"( // Utility structs and functions //===----------------------------------------------------------------------===// +// Replaces all occurrences of `match` in `str` with `substitute`. +static std::string replaceAllSubstrs(std::string str, const std::string &match, + const std::string &substitute) { + std::string::size_type scanLoc = 0, matchLoc = std::string::npos; + while ((matchLoc = str.find(match, scanLoc)) != std::string::npos) { + str = str.replace(matchLoc, match.size(), substitute); + scanLoc = matchLoc + substitute.size(); + } + return str; +} + // Returns whether the record has a value of the given name that can be returned // via getValueAsString. static inline bool hasStringAttribute(const Record &record, @@ -968,8 +980,17 @@ void OpEmitter::genCodeForAddingArgAndRegionForBuilder(OpMethodBody &body, // instance. FmtContext fctx; fctx.withBuilder("(*odsBuilder)"); - std::string value = - tgfmt(attr.getConstBuilderTemplate(), &fctx, namedAttr.name); + + std::string builderTemplate = attr.getConstBuilderTemplate(); + + // For StringAttr, its constant builder call will wrap the input in + // quotes, which is correct for normal string literals, but incorrect + // here given we use function arguments. So we need to strip the + // wrapping quotes. + if (StringRef(builderTemplate).contains("\"$0\"")) + builderTemplate = replaceAllSubstrs(builderTemplate, "\"$0\"", "$0"); + + std::string value = tgfmt(builderTemplate, &fctx, namedAttr.name); body << formatv(" {0}.addAttribute(\"{1}\", {2});\n", builderOpState, namedAttr.name, value); } else { diff --git a/openmp/libomptarget/src/omptarget.cpp b/openmp/libomptarget/src/omptarget.cpp index fed7dcc189f0f1..54ed2f8913da10 100644 --- a/openmp/libomptarget/src/omptarget.cpp +++ b/openmp/libomptarget/src/omptarget.cpp @@ -72,6 +72,11 @@ static int InitLibrary(DeviceTy& Device) { ii = HostEntriesBeginToTransTable.begin(); ii != HostEntriesBeginToTransTable.end(); ++ii) { TranslationTable *TransTable = &ii->second; + if (TransTable->HostTable.EntriesBegin == + TransTable->HostTable.EntriesEnd) { + // No host entry so no need to proceed + continue; + } if (TransTable->TargetsTable[device_id] != 0) { // Library entries have already been processed continue; diff --git a/openmp/libomptarget/src/rtl.cpp b/openmp/libomptarget/src/rtl.cpp index 749f12c0773b80..35470f587b966d 100644 --- a/openmp/libomptarget/src/rtl.cpp +++ b/openmp/libomptarget/src/rtl.cpp @@ -234,8 +234,6 @@ void RTLsTy::RegisterLib(__tgt_bin_desc *desc) { // Attempt to load all plugins available in the system. std::call_once(initFlag, &RTLsTy::LoadRTLs, this); - if (desc->HostEntriesBegin == desc->HostEntriesEnd) - return; RTLsMtx.lock(); // Register the images with the RTLs that understand them, if any. for (int32_t i = 0; i < desc->NumDeviceImages; ++i) { @@ -322,8 +320,6 @@ void RTLsTy::RegisterLib(__tgt_bin_desc *desc) { void RTLsTy::UnregisterLib(__tgt_bin_desc *desc) { DP("Unloading target library!\n"); - if (desc->HostEntriesBegin == desc->HostEntriesEnd) - return; RTLsMtx.lock(); // Find which RTL understands each image, if any. for (int32_t i = 0; i < desc->NumDeviceImages; ++i) { diff --git a/openmp/libomptarget/test/api/omp_get_num_devices_with_empty_target.c b/openmp/libomptarget/test/api/omp_get_num_devices_with_empty_target.c new file mode 100644 index 00000000000000..85dcb73f114904 --- /dev/null +++ b/openmp/libomptarget/test/api/omp_get_num_devices_with_empty_target.c @@ -0,0 +1,30 @@ +// RUN: %libomptarget-compile-run-and-check-aarch64-unknown-linux-gnu +// RUN: %libomptarget-compile-run-and-check-powerpc64-ibm-linux-gnu +// RUN: %libomptarget-compile-run-and-check-powerpc64le-ibm-linux-gnu +// RUN: %libomptarget-compile-run-and-check-x86_64-pc-linux-gnu + +#include +#include + +static int test_omp_get_num_devices_with_empty_target() { + /* checks that omp_get_num_devices() > 0 */ + return omp_get_num_devices() > 0; +} + +int main() { + int failed = 0; + + if (!test_omp_get_num_devices_with_empty_target()) { + ++failed; + } + + if (failed) { + printf("FAIL\n"); + } else { + printf("PASS\n"); + } + + return failed; +} + +// CHECK: PASS diff --git a/polly/test/ScopInfo/memset_null.ll b/polly/test/ScopInfo/memset_null.ll index b0d0be0d3b8940..1a40091e3c89ca 100644 --- a/polly/test/ScopInfo/memset_null.ll +++ b/polly/test/ScopInfo/memset_null.ll @@ -1,5 +1,7 @@ ; RUN: opt %loadPolly -polly-allow-modref-calls -polly-scops -analyze < %s | FileCheck %s ; RUN: opt %loadPolly -polly-allow-modref-calls -S -polly-codegen < %s +; XFAIL'ed due to change to memset attributes. +; XFAIL: * ; ; Verify we can handle a memset to "null" and that we do not model it. ; TODO: FIXME: We could use the undefined memset to optimize the code further,