From 6ff3811f482d504e121e7cc212e4a07f6c94735a Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Tue, 21 Jun 2022 10:30:10 -0500 Subject: [PATCH] [Attributor] Replace AAValueSimplify with AAPotentialValues For the longest time we used `AAValueSimplify` and `genericValueTraversal` to determine "potential values". This was problematic for many reasons: - We recomputed the result a lot as there was no caching for the 9 locations calling `genericValueTraversal`. - We added the idea of "intra" vs. "inter" procedural simplification only as an afterthought. `genericValueTraversal` did offer an option but `AAValueSimplify` did not. Thus, we might end up with "too much" simplification in certain situations and then gave up on it. - Because `genericValueTraversal` was not a real `AA` we ended up with problems like the infinite recursion bug (#54981) as well as code duplication. This patch introduces `AAPotentialValues` and replaces the `AAValueSimplify` uses with it. `genericValueTraversal` is folded into `AAPotentialValues` as are the instruction simplifications performed in `AAValueSimplify` before. We further distinguish "intra" and "inter" procedural simplification now. `AAValueSimplify` was not deleted as we haven't ported the re-materialization of instructions yet. There are other differences over the former handling, e.g., we may not fold trivially foldable instructions right now, e.g., `add i32 1, 1` is not folded to `i32 2` but if an operand would be simplified to `i32 1` we would fold it still. We are also even more aware of function/SCC boundaries in CGSCC passes, which is good even if some tests look like they regress. Fixes: https://github.com/llvm/llvm-project/issues/54981 Note: A previous version was flawed and consequently reverted in 6555558a80589d1c5a1154b92cc3af9495f8f86c. --- llvm/include/llvm/Transforms/IPO/Attributor.h | 107 +- llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp | 3 +- llvm/lib/Transforms/IPO/Attributor.cpp | 172 +- .../Transforms/IPO/AttributorAttributes.cpp | 1804 ++++++++++------- llvm/lib/Transforms/IPO/OpenMPOpt.cpp | 2 +- .../2008-02-01-ReturnAttrs.ll | 57 +- .../X86/min-legal-vector-width.ll | 32 +- .../ArgumentPromotion/X86/thiscall.ll | 2 +- .../ArgumentPromotion/aggregate-promote.ll | 21 +- .../Attributor/ArgumentPromotion/alignment.ll | 52 +- .../Attributor/ArgumentPromotion/alloca-as.ll | 4 +- .../Attributor/ArgumentPromotion/array.ll | 4 +- .../Attributor/ArgumentPromotion/attrs.ll | 10 +- .../Attributor/ArgumentPromotion/basictest.ll | 4 +- .../Attributor/ArgumentPromotion/byval-2.ll | 10 +- .../Attributor/ArgumentPromotion/byval.ll | 28 +- .../Attributor/ArgumentPromotion/chained.ll | 23 +- .../ArgumentPromotion/control-flow2.ll | 2 +- .../Attributor/ArgumentPromotion/crash.ll | 4 +- .../Attributor/ArgumentPromotion/musttail.ll | 10 +- .../Attributor/ArgumentPromotion/profile.ll | 50 +- .../Attributor/ArgumentPromotion/sret.ll | 5 +- .../IPConstantProp/2009-09-24-byval-ptr.ll | 16 +- .../Attributor/IPConstantProp/PR16052.ll | 20 +- .../Attributor/IPConstantProp/PR26044.ll | 18 +- .../IPConstantProp/multiple_callbacks.ll | 10 +- .../IPConstantProp/musttail-call.ll | 144 +- .../IPConstantProp/openmp_parallel_for.ll | 4 +- .../IPConstantProp/return-argument.ll | 122 +- .../IPConstantProp/thread_local_acs.ll | 6 +- llvm/test/Transforms/Attributor/align.ll | 129 +- llvm/test/Transforms/Attributor/allow_list.ll | 20 +- llvm/test/Transforms/Attributor/callbacks.ll | 16 +- .../Attributor/cb_liveness_disabled.ll | 18 +- .../Attributor/cb_liveness_enabled.ll | 18 +- .../Attributor/cb_range_disabled.ll | 8 +- .../Transforms/Attributor/cb_range_enabled.ll | 24 +- llvm/test/Transforms/Attributor/depgraph.ll | 242 ++- .../Attributor/dereferenceable-1.ll | 7 +- .../dereferenceable-2-inseltpoison.ll | 5 +- .../Attributor/dereferenceable-2.ll | 5 +- .../Transforms/Attributor/heap_to_stack.ll | 17 +- .../Attributor/heap_to_stack_gpu.ll | 8 +- .../Transforms/Attributor/internal-noalias.ll | 8 +- llvm/test/Transforms/Attributor/liveness.ll | 64 +- .../Attributor/lvi-after-jumpthreading.ll | 73 +- .../Transforms/Attributor/lvi-for-ashr.ll | 61 +- .../Transforms/Attributor/memory_locations.ll | 22 +- llvm/test/Transforms/Attributor/noalias.ll | 40 +- .../test/Transforms/Attributor/nocapture-1.ll | 116 +- .../test/Transforms/Attributor/nocapture-2.ll | 166 +- llvm/test/Transforms/Attributor/nonnull.ll | 4 +- llvm/test/Transforms/Attributor/norecurse.ll | 37 +- .../Transforms/Attributor/openmp_parallel.ll | 4 +- llvm/test/Transforms/Attributor/potential.ll | 255 ++- llvm/test/Transforms/Attributor/range.ll | 1030 +++++++--- .../read_write_returned_arguments_scc.ll | 32 +- llvm/test/Transforms/Attributor/readattrs.ll | 24 +- llvm/test/Transforms/Attributor/returned.ll | 12 +- .../Attributor/undefined_behavior.ll | 11 +- .../Attributor/value-simplify-dbg.ll | 125 +- .../Attributor/value-simplify-gpu.ll | 8 +- .../Attributor/value-simplify-instances.ll | 68 +- .../Attributor/value-simplify-local-remote.ll | 802 ++++++++ .../Attributor/value-simplify-pointer-info.ll | 1030 +++++----- .../Transforms/Attributor/value-simplify.ll | 109 +- llvm/test/Transforms/Attributor/willreturn.ll | 4 +- llvm/test/Transforms/Attributor/wrapper.ll | 2 +- .../OpenMP/is_spmd_exec_mode_fold.ll | 3 +- .../Transforms/OpenMP/parallel_deletion.ll | 2 +- .../Transforms/OpenMP/remove_globalization.ll | 4 +- .../OpenMP/replace_globalization.ll | 23 +- llvm/test/Transforms/OpenMP/spmdization.ll | 11 +- 73 files changed, 4557 insertions(+), 2856 deletions(-) create mode 100644 llvm/test/Transforms/Attributor/value-simplify-local-remote.ll diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h index 17e29695ab73..1eac4932d48d 100644 --- a/llvm/include/llvm/Transforms/IPO/Attributor.h +++ b/llvm/include/llvm/Transforms/IPO/Attributor.h @@ -118,7 +118,9 @@ #include "llvm/IR/ConstantRange.h" #include "llvm/IR/Constants.h" #include "llvm/IR/InstIterator.h" +#include "llvm/IR/Instruction.h" #include "llvm/IR/PassManager.h" +#include "llvm/IR/Value.h" #include "llvm/Support/Alignment.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/Casting.h" @@ -155,6 +157,7 @@ namespace AA { enum ValueScope : uint8_t { Intraprocedural = 1, Interprocedural = 2, + AnyScope = Intraprocedural | Interprocedural, }; struct ValueAndContext : public std::pair { @@ -217,12 +220,11 @@ Constant *getInitialValueForObj(Value &Obj, Type &Ty, /// \returns True if \p Objects contains all assumed underlying objects, and /// false if something went wrong and the objects could not be /// determined. -bool getAssumedUnderlyingObjects(Attributor &A, const Value &Ptr, - SmallVectorImpl &Objects, - const AbstractAttribute &QueryingAA, - const Instruction *CtxI, - bool &UsedAssumedInformation, - AA::ValueScope VS = Interprocedural); +bool getAssumedUnderlyingObjects( + Attributor &A, const Value &Ptr, SmallSetVector &Objects, + const AbstractAttribute &QueryingAA, const Instruction *CtxI, + bool &UsedAssumedInformation, AA::ValueScope VS = AA::Interprocedural, + SmallPtrSetImpl *SeenObjects = nullptr); /// Collect all potential values \p LI could read into \p PotentialValues. That /// is, the only values read by \p LI are assumed to be known and all are in @@ -305,6 +307,24 @@ struct DenseMapInfo } }; +template <> +struct DenseMapInfo : public DenseMapInfo { + using Base = DenseMapInfo; + static inline AA::ValueScope getEmptyKey() { + return AA::ValueScope(Base::getEmptyKey()); + } + static inline AA::ValueScope getTombstoneKey() { + return AA::ValueScope(Base::getTombstoneKey()); + } + static unsigned getHashValue(const AA::ValueScope &S) { + return Base::getHashValue(S); + } + + static bool isEqual(const AA::ValueScope &LHS, const AA::ValueScope &RHS) { + return Base::isEqual(LHS, RHS); + } +}; + /// The value passed to the line option that defines the maximal initialization /// chain length. extern unsigned MaxInitializationChainLength; @@ -1643,8 +1663,6 @@ struct Attributor { /// Record that \p F is deleted after information was manifested. void deleteAfterManifest(Function &F) { - errs() << "Delete " << F.getName() << " : " << (Configuration.DeleteFns) - << "\n"; if (Configuration.DeleteFns) ToBeDeletedFunctions.insert(&F); } @@ -1664,14 +1682,16 @@ struct Attributor { /// return None, otherwise return `nullptr`. Optional getAssumedSimplified(const IRPosition &IRP, const AbstractAttribute &AA, - bool &UsedAssumedInformation) { - return getAssumedSimplified(IRP, &AA, UsedAssumedInformation); + bool &UsedAssumedInformation, + AA::ValueScope S) { + return getAssumedSimplified(IRP, &AA, UsedAssumedInformation, S); } Optional getAssumedSimplified(const Value &V, const AbstractAttribute &AA, - bool &UsedAssumedInformation) { + bool &UsedAssumedInformation, + AA::ValueScope S) { return getAssumedSimplified(IRPosition::value(V), AA, - UsedAssumedInformation); + UsedAssumedInformation, S); } /// If \p V is assumed simplified, return it, if it is unclear yet, @@ -1679,7 +1699,17 @@ struct Attributor { /// except that it can be used without recording dependences on any \p AA. Optional getAssumedSimplified(const IRPosition &V, const AbstractAttribute *AA, - bool &UsedAssumedInformation); + bool &UsedAssumedInformation, + AA::ValueScope S); + + /// Try to simplify \p IRP and in the scope \p S. If successful, true is + /// returned and all potential values \p IRP can take are put into \p Values. + /// If false is returned no other information is valid. + bool getAssumedSimplifiedValues(const IRPosition &IRP, + const AbstractAttribute *AA, + SmallVectorImpl &Values, + AA::ValueScope S, + bool &UsedAssumedInformation); /// Register \p CB as a simplification callback. /// `Attributor::getAssumedSimplified` will use these callbacks before @@ -4409,6 +4439,10 @@ template struct PotentialValuesState : AbstractState { return *this; } + bool contains(const MemberTy &V) const { + return !isValidState() ? true : Set.contains(V); + } + protected: SetTy &getAssumedSet() { assert(isValidState() && "This set shoud not be used when it is invalid!"); @@ -4490,9 +4524,12 @@ template struct PotentialValuesState : AbstractState { }; using PotentialConstantIntValuesState = PotentialValuesState; +using PotentialLLVMValuesState = + PotentialValuesState>; raw_ostream &operator<<(raw_ostream &OS, const PotentialConstantIntValuesState &R); +raw_ostream &operator<<(raw_ostream &OS, const PotentialLLVMValuesState &R); /// An abstract interface for potential values analysis. /// @@ -4508,7 +4545,7 @@ raw_ostream &operator<<(raw_ostream &OS, /// 2. We tried to initialize on a Value that we cannot handle (e.g. an /// operator we do not currently handle). /// -/// TODO: Support values other than constant integers. +/// For non constant integers see AAPotentialValues. struct AAPotentialConstantValues : public StateWrapper { using Base = StateWrapper; @@ -4562,6 +4599,48 @@ struct AAPotentialConstantValues static const char ID; }; +struct AAPotentialValues + : public StateWrapper { + using Base = StateWrapper; + AAPotentialValues(const IRPosition &IRP, Attributor &A) : Base(IRP) {} + + /// See AbstractAttribute::getState(...). + PotentialLLVMValuesState &getState() override { return *this; } + const PotentialLLVMValuesState &getState() const override { return *this; } + + /// Create an abstract attribute view for the position \p IRP. + static AAPotentialValues &createForPosition(const IRPosition &IRP, + Attributor &A); + + /// Extract the single value in \p Values if any. + static Value *getSingleValue(Attributor &A, const AbstractAttribute &AA, + const IRPosition &IRP, + SmallVectorImpl &Values); + + /// See AbstractAttribute::getName() + const std::string getName() const override { return "AAPotentialValues"; } + + /// See AbstractAttribute::getIdAddr() + const char *getIdAddr() const override { return &ID; } + + /// This function should return true if the type of the \p AA is + /// AAPotentialValues + static bool classof(const AbstractAttribute *AA) { + return (AA->getIdAddr() == &ID); + } + + /// Unique ID (due to the unique address) + static const char ID; + +private: + virtual bool + getAssumedSimplifiedValues(Attributor &A, + SmallVectorImpl &Values, + AA::ValueScope) const = 0; + + friend struct Attributor; +}; + /// An abstract interface for all noundef attributes. struct AANoUndef : public IRAttribute Allowed( {&AAAMDAttributes::ID, &AAUniformWorkGroupSize::ID, - &AAAMDFlatWorkGroupSize::ID, &AACallEdges::ID, &AAPointerInfo::ID}); + &AAPotentialValues::ID, &AAAMDFlatWorkGroupSize::ID, &AACallEdges::ID, + &AAPointerInfo::ID}); AttributorConfig AC(CGUpdater); AC.Allowed = &Allowed; diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index e5ff98e4f73f..d97438ba9926 100644 --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -326,7 +326,7 @@ static bool getPotentialCopiesOfMemoryValue( << " (only exact: " << OnlyExact << ")\n";); Value &Ptr = *I.getPointerOperand(); - SmallVector Objects; + SmallSetVector Objects; if (!AA::getAssumedUnderlyingObjects(A, Ptr, Objects, QueryingAA, &I, UsedAssumedInformation)) { LLVM_DEBUG( @@ -352,8 +352,8 @@ static bool getPotentialCopiesOfMemoryValue( // be OK. We do not try to optimize the latter. if (!NullPointerIsDefined(I.getFunction(), Ptr.getType()->getPointerAddressSpace()) && - A.getAssumedSimplified(Ptr, QueryingAA, UsedAssumedInformation) == - Obj) + A.getAssumedSimplified(Ptr, QueryingAA, UsedAssumedInformation, + AA::Interprocedural) == Obj) continue; LLVM_DEBUG( dbgs() << "Underlying object is a valid nullptr, giving up.\n";); @@ -375,10 +375,24 @@ static bool getPotentialCopiesOfMemoryValue( return false; } + bool NullOnly = true; + bool NullRequired = false; + auto CheckForNullOnlyAndUndef = [&](Optional V) { + if (!V || *V == nullptr) + NullOnly = false; + else if (isa(*V)) + /* No op */; + else if (isa(*V) && cast(*V)->isNullValue()) + NullRequired = true; + else + NullOnly = false; + }; + if (IsLoad) { Value *InitialValue = AA::getInitialValueForObj(*Obj, *I.getType(), TLI); if (!InitialValue) return false; + CheckForNullOnlyAndUndef(InitialValue); NewCopies.push_back(InitialValue); NewCopyOrigins.push_back(nullptr); } @@ -388,12 +402,19 @@ static bool getPotentialCopiesOfMemoryValue( return true; if (IsLoad && Acc.isWrittenValueYetUndetermined()) return true; - if (OnlyExact && !IsExact && + CheckForNullOnlyAndUndef(Acc.getContent()); + if (OnlyExact && !IsExact && !NullOnly && !isa_and_nonnull(Acc.getWrittenValue())) { LLVM_DEBUG(dbgs() << "Non exact access " << *Acc.getRemoteInst() << ", abort!\n"); return false; } + if (NullRequired && !NullOnly) { + LLVM_DEBUG(dbgs() << "Required all `null` accesses due to non exact " + "one, however found non-null one: " + << *Acc.getRemoteInst() << ", abort!\n"); + return false; + } if (IsLoad) { assert(isa(I) && "Expected load or store instruction only!"); if (!Acc.isWrittenValueUnknown()) { @@ -1038,60 +1059,74 @@ Attributor::getAssumedConstant(const IRPosition &IRP, } if (auto *C = dyn_cast(&IRP.getAssociatedValue())) return C; - const auto &ValueSimplifyAA = - getAAFor(AA, IRP, DepClassTy::NONE); - Optional SimplifiedV = - ValueSimplifyAA.getAssumedSimplifiedValue(*this); - bool IsKnown = ValueSimplifyAA.isAtFixpoint(); - UsedAssumedInformation |= !IsKnown; - if (!SimplifiedV) { - recordDependence(ValueSimplifyAA, AA, DepClassTy::OPTIONAL); - return llvm::None; - } - if (isa_and_nonnull(SimplifiedV.value())) { - recordDependence(ValueSimplifyAA, AA, DepClassTy::OPTIONAL); - return UndefValue::get(IRP.getAssociatedType()); + SmallVector Values; + if (getAssumedSimplifiedValues(IRP, &AA, Values, + AA::ValueScope::Interprocedural, + UsedAssumedInformation)) { + if (Values.empty()) + return llvm::None; + if (auto *C = dyn_cast_or_null( + AAPotentialValues::getSingleValue(*this, AA, IRP, Values))) + return C; } - Constant *CI = dyn_cast_or_null(SimplifiedV.value()); - if (CI) - CI = dyn_cast_or_null( - AA::getWithType(*CI, *IRP.getAssociatedType())); - if (CI) - recordDependence(ValueSimplifyAA, AA, DepClassTy::OPTIONAL); - return CI; + return nullptr; } -Optional -Attributor::getAssumedSimplified(const IRPosition &IRP, - const AbstractAttribute *AA, - bool &UsedAssumedInformation) { +Optional Attributor::getAssumedSimplified(const IRPosition &IRP, + const AbstractAttribute *AA, + bool &UsedAssumedInformation, + AA::ValueScope S) { // First check all callbacks provided by outside AAs. If any of them returns // a non-null value that is different from the associated value, or None, we // assume it's simplified. for (auto &CB : SimplificationCallbacks.lookup(IRP)) return CB(IRP, AA, UsedAssumedInformation); - // If no high-level/outside simplification occurred, use AAValueSimplify. - const auto &ValueSimplifyAA = - getOrCreateAAFor(IRP, AA, DepClassTy::NONE); - Optional SimplifiedV = - ValueSimplifyAA.getAssumedSimplifiedValue(*this); - bool IsKnown = ValueSimplifyAA.isAtFixpoint(); - UsedAssumedInformation |= !IsKnown; - if (!SimplifiedV) { - if (AA) - recordDependence(ValueSimplifyAA, *AA, DepClassTy::OPTIONAL); + SmallVector Values; + if (!getAssumedSimplifiedValues(IRP, AA, Values, S, UsedAssumedInformation)) + return &IRP.getAssociatedValue(); + if (Values.empty()) return llvm::None; + if (AA) + if (Value *V = AAPotentialValues::getSingleValue(*this, *AA, IRP, Values)) + return V; + if (IRP.getPositionKind() == IRPosition::IRP_RETURNED || + IRP.getPositionKind() == IRPosition::IRP_CALL_SITE_RETURNED) + return nullptr; + return &IRP.getAssociatedValue(); +} + +bool Attributor::getAssumedSimplifiedValues( + const IRPosition &IRP, const AbstractAttribute *AA, + SmallVectorImpl &Values, AA::ValueScope S, + bool &UsedAssumedInformation) { + // First check all callbacks provided by outside AAs. If any of them returns + // a non-null value that is different from the associated value, or None, we + // assume it's simplified. + const auto &SimplificationCBs = SimplificationCallbacks.lookup(IRP); + for (auto &CB : SimplificationCBs) { + Optional CBResult = CB(IRP, AA, UsedAssumedInformation); + if (!CBResult.hasValue()) + continue; + Value *V = CBResult.getValue(); + if (!V) + return false; + if ((S & AA::ValueScope::Interprocedural) || + AA::isValidInScope(*V, IRP.getAnchorScope())) + Values.push_back(AA::ValueAndContext{*V, nullptr}); + else + return false; } - if (*SimplifiedV == nullptr) - return const_cast(&IRP.getAssociatedValue()); - if (Value *SimpleV = - AA::getWithType(**SimplifiedV, *IRP.getAssociatedType())) { - if (AA) - recordDependence(ValueSimplifyAA, *AA, DepClassTy::OPTIONAL); - return SimpleV; - } - return const_cast(&IRP.getAssociatedValue()); + if (!SimplificationCBs.empty()) + return true; + + // If no high-level/outside simplification occurred, use AAPotentialValues. + const auto &PotentialValuesAA = + getOrCreateAAFor(IRP, AA, DepClassTy::OPTIONAL); + if (!PotentialValuesAA.getAssumedSimplifiedValues(*this, Values, S)) + return false; + UsedAssumedInformation |= !PotentialValuesAA.isAtFixpoint(); + return true; } Optional Attributor::translateArgumentToCallSiteContent( @@ -1106,7 +1141,7 @@ Optional Attributor::translateArgumentToCallSiteContent( if (!Arg->hasPointeeInMemoryValueAttr()) return getAssumedSimplified( IRPosition::callsite_argument(CB, Arg->getArgNo()), AA, - UsedAssumedInformation); + UsedAssumedInformation, AA::Intraprocedural); return nullptr; } @@ -1918,7 +1953,8 @@ ChangeStatus Attributor::cleanupIR() { << ToBeDeletedInsts.size() << " instructions and " << ToBeChangedValues.size() << " values and " << ToBeChangedUses.size() << " uses. To insert " - << ToBeChangedToUnreachableInsts.size() << " unreachables." + << ToBeChangedToUnreachableInsts.size() + << " unreachables.\n" << "Preserve manifest added " << ManifestAddedBlocks.size() << " blocks\n"); @@ -2046,6 +2082,8 @@ ChangeStatus Attributor::cleanupIR() { } for (auto &V : ToBeChangedToUnreachableInsts) if (Instruction *I = dyn_cast_or_null(V)) { + LLVM_DEBUG(dbgs() << "[Attributor] Change to unreachable: " << *I + << "\n"); assert(isRunOn(*I->getFunction()) && "Cannot replace an instruction outside the current SCC!"); CGModifiedFunctions.insert(I->getFunction()); @@ -2877,7 +2915,8 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) { // Every function might be simplified. bool UsedAssumedInformation = false; - getAssumedSimplified(RetPos, nullptr, UsedAssumedInformation); + getAssumedSimplified(RetPos, nullptr, UsedAssumedInformation, + AA::Intraprocedural); // Every returned value might be marked noundef. getOrCreateAAFor(RetPos); @@ -2906,7 +2945,8 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) { // interface though as outside AAs can register custom simplification // callbacks. bool UsedAssumedInformation = false; - getAssumedSimplified(ArgPos, /* AA */ nullptr, UsedAssumedInformation); + getAssumedSimplified(ArgPos, /* AA */ nullptr, UsedAssumedInformation, + AA::Intraprocedural); // Every argument might be dead. getOrCreateAAFor(ArgPos); @@ -2970,7 +3010,8 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) { IRPosition CBRetPos = IRPosition::callsite_returned(CB); bool UsedAssumedInformation = false; - getAssumedSimplified(CBRetPos, nullptr, UsedAssumedInformation); + getAssumedSimplified(CBRetPos, nullptr, UsedAssumedInformation, + AA::Intraprocedural); } for (int I = 0, E = CB.arg_size(); I < E; ++I) { @@ -2984,7 +3025,8 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) { // Attributor interface though as outside AAs can register custom // simplification callbacks. bool UsedAssumedInformation = false; - getAssumedSimplified(CBArgPos, /* AA */ nullptr, UsedAssumedInformation); + getAssumedSimplified(CBArgPos, /* AA */ nullptr, UsedAssumedInformation, + AA::Intraprocedural); // Every call site argument might be marked "noundef". getOrCreateAAFor(CBArgPos); @@ -3034,12 +3076,12 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) { IRPosition::value(*cast(I).getPointerOperand())); if (SimplifyAllLoads) getAssumedSimplified(IRPosition::value(I), nullptr, - UsedAssumedInformation); + UsedAssumedInformation, AA::Intraprocedural); } else { auto &SI = cast(I); getOrCreateAAFor(IRPosition::inst(I)); getAssumedSimplified(IRPosition::value(*SI.getValueOperand()), nullptr, - UsedAssumedInformation); + UsedAssumedInformation, AA::Intraprocedural); getOrCreateAAFor(IRPosition::value(*SI.getPointerOperand())); } return true; @@ -3126,6 +3168,26 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, return OS; } +raw_ostream &llvm::operator<<(raw_ostream &OS, + const PotentialLLVMValuesState &S) { + OS << "set-state(< {"; + if (!S.isValidState()) + OS << "full-set"; + else { + for (auto &It : S.getAssumedSet()) { + if (auto *F = dyn_cast(It.first.getValue())) + OS << "@" << F->getName() << "[" << int(It.second) << "], "; + else + OS << *It.first.getValue() << "[" << int(It.second) << "], "; + } + if (S.undefIsContained()) + OS << "undef "; + } + OS << "} >)"; + + return OS; +} + void AbstractAttribute::print(raw_ostream &OS) const { OS << "["; OS << getName(); diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index 1ff54b78e27e..c93b2ef88a94 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -14,12 +14,14 @@ #include "llvm/Transforms/IPO/Attributor.h" #include "llvm/ADT/APInt.h" +#include "llvm/ADT/DenseMapInfo.h" #include "llvm/ADT/MapVector.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SetOperations.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AssumeBundleQueries.h" @@ -35,11 +37,13 @@ #include "llvm/IR/Argument.h" #include "llvm/IR/Assumptions.h" #include "llvm/IR/BasicBlock.h" +#include "llvm/IR/Constant.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/GlobalValue.h" #include "llvm/IR/IRBuilder.h" +#include "llvm/IR/InstrTypes.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" @@ -72,6 +76,8 @@ static cl::opt MaxHeapToStackSize("max-heap-to-stack-size", cl::init(128), template <> unsigned llvm::PotentialConstantIntValuesState::MaxPotentialValues = 0; +template <> unsigned llvm::PotentialLLVMValuesState::MaxPotentialValues = -1; + static cl::opt MaxPotentialValues( "attributor-max-potential-values", cl::Hidden, cl::desc("Maximum number of potential values to be " @@ -79,6 +85,12 @@ static cl::opt MaxPotentialValues( cl::location(llvm::PotentialConstantIntValuesState::MaxPotentialValues), cl::init(7)); +static cl::opt MaxPotentialValuesIterations( + "attributor-max-potential-values-iterations", cl::Hidden, + cl::desc( + "Maximum number of iterations we keep dismantling potential values."), + cl::init(64)); + static cl::opt MaxInterferingAccesses( "attributor-max-interfering-accesses", cl::Hidden, cl::desc("Maximum number of interfering accesses to " @@ -162,6 +174,7 @@ PIPE_OPERATOR(AAValueConstantRange) PIPE_OPERATOR(AAPrivatizablePtr) PIPE_OPERATOR(AAUndefinedBehavior) PIPE_OPERATOR(AAPotentialConstantValues) +PIPE_OPERATOR(AAPotentialValues) PIPE_OPERATOR(AANoUndef) PIPE_OPERATOR(AACallEdges) PIPE_OPERATOR(AAFunctionReachability) @@ -293,228 +306,35 @@ static Value *constructPointer(Type *ResTy, Type *PtrElemTy, Value *Ptr, return Ptr; } -/// Recursively visit all values that might become \p IRP at some point. This -/// will be done by looking through cast instructions, selects, phis, and calls -/// with the "returned" attribute. Once we cannot look through the value any -/// further, the callback \p VisitValueCB is invoked and passed the current -/// value, the \p State, and a flag to indicate if we stripped anything. -/// Stripped means that we unpacked the value associated with \p IRP at least -/// once. Note that the value used for the callback may still be the value -/// associated with \p IRP (due to PHIs). To limit how much effort is invested, -/// we will never visit more values than specified by \p MaxValues. -/// If \p VS does not contain the Interprocedural bit, only values valid in the -/// scope of \p CtxI will be visited and simplification into other scopes is -/// prevented. -template -static bool genericValueTraversal( - Attributor &A, IRPosition IRP, const AbstractAttribute &QueryingAA, - StateTy &State, - function_ref - VisitValueCB, - const Instruction *CtxI, bool &UsedAssumedInformation, - bool UseValueSimplify = true, int MaxValues = 16, - function_ref StripCB = nullptr, - AA::ValueScope VS = AA::Interprocedural) { - - struct LivenessInfo { - const AAIsDead *LivenessAA = nullptr; - bool AnyDead = false; - }; - SmallMapVector LivenessAAs; - auto GetLivenessInfo = [&](const Function &F) -> LivenessInfo & { - LivenessInfo &LI = LivenessAAs[&F]; - if (!LI.LivenessAA) - LI.LivenessAA = &A.getAAFor(QueryingAA, IRPosition::function(F), - DepClassTy::NONE); - return LI; - }; - - Value *InitialV = &IRP.getAssociatedValue(); - using Item = std::pair; - SmallSet Visited; - SmallVector Worklist; - Worklist.push_back({InitialV, CtxI}); - - int Iteration = 0; - do { - Item I = Worklist.pop_back_val(); - Value *V = I.first; - CtxI = I.second; - if (StripCB) - V = StripCB(V); - - // Check if we should process the current value. To prevent endless - // recursion keep a record of the values we followed! - if (!Visited.insert(I).second) - continue; - - // Make sure we limit the compile time for complex expressions. - if (Iteration++ >= MaxValues) { - LLVM_DEBUG(dbgs() << "Generic value traversal reached iteration limit: " - << Iteration << "!\n"); - return false; - } - - // Explicitly look through calls with a "returned" attribute if we do - // not have a pointer as stripPointerCasts only works on them. - Value *NewV = nullptr; - if (V->getType()->isPointerTy()) { - NewV = V->stripPointerCasts(); - } else { - auto *CB = dyn_cast(V); - if (CB && CB->getCalledFunction()) { - for (Argument &Arg : CB->getCalledFunction()->args()) - if (Arg.hasReturnedAttr()) { - NewV = CB->getArgOperand(Arg.getArgNo()); - break; - } - } - } - if (NewV && NewV != V) { - Worklist.push_back({NewV, CtxI}); - continue; - } - - // Look through select instructions, visit assumed potential values. - if (auto *SI = dyn_cast(V)) { - Optional C = A.getAssumedConstant( - *SI->getCondition(), QueryingAA, UsedAssumedInformation); - bool NoValueYet = !C; - if (NoValueYet || isa_and_nonnull(*C)) - continue; - if (auto *CI = dyn_cast_or_null(*C)) { - if (CI->isZero()) - Worklist.push_back({SI->getFalseValue(), CtxI}); - else - Worklist.push_back({SI->getTrueValue(), CtxI}); - continue; - } - // We could not simplify the condition, assume both values.( - Worklist.push_back({SI->getTrueValue(), CtxI}); - Worklist.push_back({SI->getFalseValue(), CtxI}); - continue; - } - - // Look through phi nodes, visit all live operands. - if (auto *PHI = dyn_cast(V)) { - LivenessInfo &LI = GetLivenessInfo(*PHI->getFunction()); - for (unsigned u = 0, e = PHI->getNumIncomingValues(); u < e; u++) { - BasicBlock *IncomingBB = PHI->getIncomingBlock(u); - if (LI.LivenessAA->isEdgeDead(IncomingBB, PHI->getParent())) { - LI.AnyDead = true; - UsedAssumedInformation |= !LI.LivenessAA->isAtFixpoint(); - continue; - } - Worklist.push_back( - {PHI->getIncomingValue(u), IncomingBB->getTerminator()}); - } - continue; - } - - if (auto *Arg = dyn_cast(V)) { - if ((VS & AA::Interprocedural) && !Arg->hasPassPointeeByValueCopyAttr()) { - SmallVector CallSiteValues; - bool UsedAssumedInformation = false; - if (A.checkForAllCallSites( - [&](AbstractCallSite ACS) { - // Callbacks might not have a corresponding call site operand, - // stick with the argument in that case. - Value *CSOp = ACS.getCallArgOperand(*Arg); - if (!CSOp) - return false; - CallSiteValues.push_back({CSOp, ACS.getInstruction()}); - return true; - }, - *Arg->getParent(), true, &QueryingAA, UsedAssumedInformation)) { - Worklist.append(CallSiteValues); - continue; - } - } - } - - if (UseValueSimplify && !isa(V)) { - Optional SimpleV = - A.getAssumedSimplified(*V, QueryingAA, UsedAssumedInformation); - if (!SimpleV) - continue; - Value *NewV = SimpleV.value(); - if (NewV && NewV != V) { - if ((VS & AA::Interprocedural) || !CtxI || - AA::isValidInScope(*NewV, CtxI->getFunction())) { - Worklist.push_back({NewV, CtxI}); - continue; - } - } - } - - if (auto *LI = dyn_cast(V)) { - bool UsedAssumedInformation = false; - // If we ask for the potentially loaded values from the initial pointer we - // will simply end up here again. The load is as far as we can make it. - if (LI->getPointerOperand() != InitialV) { - SmallSetVector PotentialCopies; - SmallSetVector PotentialValueOrigins; - if (AA::getPotentiallyLoadedValues(A, *LI, PotentialCopies, - PotentialValueOrigins, QueryingAA, - UsedAssumedInformation, - /* OnlyExact */ true)) { - // Values have to be dynamically unique or we loose the fact that a - // single llvm::Value might represent two runtime values (e.g., stack - // locations in different recursive calls). - bool DynamicallyUnique = - llvm::all_of(PotentialCopies, [&A, &QueryingAA](Value *PC) { - return AA::isDynamicallyUnique(A, QueryingAA, *PC); - }); - if (DynamicallyUnique && - ((VS & AA::Interprocedural) || !CtxI || - llvm::all_of(PotentialCopies, [CtxI](Value *PC) { - return AA::isValidInScope(*PC, CtxI->getFunction()); - }))) { - for (auto *PotentialCopy : PotentialCopies) - Worklist.push_back({PotentialCopy, CtxI}); - continue; - } - } - } - } - - // Once a leaf is reached we inform the user through the callback. - if (!VisitValueCB(*V, CtxI, State, Iteration > 1)) { - LLVM_DEBUG(dbgs() << "Generic value traversal visit callback failed for: " - << *V << "!\n"); - return false; - } - } while (!Worklist.empty()); - - // If we actually used liveness information so we have to record a dependence. - for (auto &It : LivenessAAs) - if (It.second.AnyDead) - A.recordDependence(*It.second.LivenessAA, QueryingAA, - DepClassTy::OPTIONAL); - - // All values have been visited. - return true; -} - bool AA::getAssumedUnderlyingObjects(Attributor &A, const Value &Ptr, - SmallVectorImpl &Objects, + SmallSetVector &Objects, const AbstractAttribute &QueryingAA, const Instruction *CtxI, bool &UsedAssumedInformation, - AA::ValueScope VS) { - auto StripCB = [&](Value *V) { return getUnderlyingObject(V); }; - SmallPtrSet SeenObjects; - auto VisitValueCB = [&SeenObjects](Value &Val, const Instruction *, - SmallVectorImpl &Objects, - bool) -> bool { - if (SeenObjects.insert(&Val).second) - Objects.push_back(&Val); + AA::ValueScope S, + SmallPtrSetImpl *SeenObjects) { + SmallPtrSet LocalSeenObjects; + if (!SeenObjects) + SeenObjects = &LocalSeenObjects; + + SmallVector Values; + if (!A.getAssumedSimplifiedValues(IRPosition::value(Ptr), &QueryingAA, Values, + S, UsedAssumedInformation)) { + Objects.insert(const_cast(&Ptr)); return true; - }; - if (!genericValueTraversal( - A, IRPosition::value(Ptr), QueryingAA, Objects, VisitValueCB, CtxI, - UsedAssumedInformation, true, 32, StripCB, VS)) - return false; + } + + for (auto &VAC : Values) { + Value *UO = getUnderlyingObject(VAC.getValue()); + if (UO && UO != VAC.getValue() && SeenObjects->insert(UO).second) { + if (!getAssumedUnderlyingObjects(A, *UO, Objects, QueryingAA, + VAC.getCtxI(), UsedAssumedInformation, S, + SeenObjects)) + return false; + continue; + } + Objects.insert(VAC.getValue()); + } return true; } @@ -1520,8 +1340,9 @@ struct AAPointerInfoFloating : public AAPointerInfoImpl { return false; } bool UsedAssumedInformation = false; - Optional Content = A.getAssumedSimplified( - *StoreI->getValueOperand(), *this, UsedAssumedInformation); + Optional Content = + A.getAssumedSimplified(*StoreI->getValueOperand(), *this, + UsedAssumedInformation, AA::Interprocedural); return handleAccess(A, *StoreI, *CurPtr, Content, AccessKind::AK_WRITE, OffsetInfoMap[CurPtr].Offset, Changed, StoreI->getValueOperand()->getType()); @@ -1954,23 +1775,23 @@ bool AAReturnedValuesImpl::checkForAllReturnedValuesAndReturnInsts( ChangeStatus AAReturnedValuesImpl::updateImpl(Attributor &A) { ChangeStatus Changed = ChangeStatus::UNCHANGED; - auto ReturnValueCB = [&](Value &V, const Instruction *CtxI, ReturnInst &Ret, - bool) -> bool { - assert(AA::isValidInScope(V, Ret.getFunction()) && - "Assumed returned value should be valid in function scope!"); - if (ReturnedValues[&V].insert(&Ret)) - Changed = ChangeStatus::CHANGED; - return true; - }; - + SmallVector Values; bool UsedAssumedInformation = false; auto ReturnInstCB = [&](Instruction &I) { ReturnInst &Ret = cast(I); - return genericValueTraversal( - A, IRPosition::value(*Ret.getReturnValue()), *this, Ret, ReturnValueCB, - &I, UsedAssumedInformation, /* UseValueSimplify */ true, - /* MaxValues */ 16, - /* StripCB */ nullptr, AA::Intraprocedural); + Values.clear(); + if (!A.getAssumedSimplifiedValues(IRPosition::value(*Ret.getReturnValue()), + *this, Values, AA::Intraprocedural, + UsedAssumedInformation)) + Values.push_back({*Ret.getReturnValue(), Ret}); + + for (auto &VAC : Values) { + assert(AA::isValidInScope(*VAC.getValue(), Ret.getFunction()) && + "Assumed returned value should be valid in function scope!"); + if (ReturnedValues[VAC.getValue()].insert(&Ret)) + Changed = ChangeStatus::CHANGED; + } + return true; }; // Discover returned values from all live returned instructions in the @@ -2472,6 +2293,18 @@ struct AANonNullFloating : public AANonNullImpl { ChangeStatus updateImpl(Attributor &A) override { const DataLayout &DL = A.getDataLayout(); + bool Stripped; + bool UsedAssumedInformation = false; + SmallVector Values; + if (!A.getAssumedSimplifiedValues(getIRPosition(), *this, Values, + AA::AnyScope, UsedAssumedInformation)) { + Values.push_back({getAssociatedValue(), getCtxI()}); + Stripped = false; + } else { + Stripped = Values.size() != 1 || + Values.front().getValue() != &getAssociatedValue(); + } + DominatorTree *DT = nullptr; AssumptionCache *AC = nullptr; InformationCache &InfoCache = A.getInfoCache(); @@ -2480,8 +2313,8 @@ struct AANonNullFloating : public AANonNullImpl { AC = InfoCache.getAnalysisResultForFunction(*Fn); } - auto VisitValueCB = [&](Value &V, const Instruction *CtxI, - AANonNull::StateType &T, bool Stripped) -> bool { + AANonNull::StateType T; + auto VisitValueCB = [&](Value &V, const Instruction *CtxI) -> bool { const auto &AA = A.getAAFor(*this, IRPosition::value(V), DepClassTy::REQUIRED); if (!Stripped && this == &AA) { @@ -2495,12 +2328,9 @@ struct AANonNullFloating : public AANonNullImpl { return T.isValidState(); }; - StateType T; - bool UsedAssumedInformation = false; - if (!genericValueTraversal(A, getIRPosition(), *this, T, - VisitValueCB, getCtxI(), - UsedAssumedInformation)) - return indicatePessimisticFixpoint(); + for (const auto &VAC : Values) + if (!VisitValueCB(*VAC.getValue(), VAC.getCtxI())) + return indicatePessimisticFixpoint(); return clampStateAndIndicateChange(getState(), T); } @@ -2753,8 +2583,9 @@ struct AAUndefinedBehaviorImpl : public AAUndefinedBehavior { if (!NoUndefAA.isKnownNoUndef()) continue; bool UsedAssumedInformation = false; - Optional SimplifiedVal = A.getAssumedSimplified( - IRPosition::value(*ArgVal), *this, UsedAssumedInformation); + Optional SimplifiedVal = + A.getAssumedSimplified(IRPosition::value(*ArgVal), *this, + UsedAssumedInformation, AA::Interprocedural); if (UsedAssumedInformation) continue; if (SimplifiedVal && !SimplifiedVal.value()) @@ -2925,8 +2756,9 @@ struct AAUndefinedBehaviorImpl : public AAUndefinedBehavior { Optional stopOnUndefOrAssumed(Attributor &A, Value *V, Instruction *I) { bool UsedAssumedInformation = false; - Optional SimplifiedV = A.getAssumedSimplified( - IRPosition::value(*V), *this, UsedAssumedInformation); + Optional SimplifiedV = + A.getAssumedSimplified(IRPosition::value(*V), *this, + UsedAssumedInformation, AA::Interprocedural); if (!UsedAssumedInformation) { // Don't depend on assumed values. if (!SimplifiedV) { @@ -4364,10 +4196,23 @@ struct AADereferenceableFloating : AADereferenceableImpl { /// See AbstractAttribute::updateImpl(...). ChangeStatus updateImpl(Attributor &A) override { + + bool Stripped; + bool UsedAssumedInformation = false; + SmallVector Values; + if (!A.getAssumedSimplifiedValues(getIRPosition(), *this, Values, + AA::AnyScope, UsedAssumedInformation)) { + Values.push_back({getAssociatedValue(), getCtxI()}); + Stripped = false; + } else { + Stripped = Values.size() != 1 || + Values.front().getValue() != &getAssociatedValue(); + } + const DataLayout &DL = A.getDataLayout(); + DerefState T; - auto VisitValueCB = [&](const Value &V, const Instruction *, DerefState &T, - bool Stripped) -> bool { + auto VisitValueCB = [&](const Value &V) -> bool { unsigned IdxWidth = DL.getIndexSizeInBits(V.getType()->getPointerAddressSpace()); APInt Offset(IdxWidth, 0); @@ -4420,12 +4265,9 @@ struct AADereferenceableFloating : AADereferenceableImpl { return T.isValidState(); }; - DerefState T; - bool UsedAssumedInformation = false; - if (!genericValueTraversal(A, getIRPosition(), *this, T, - VisitValueCB, getCtxI(), - UsedAssumedInformation)) - return indicatePessimisticFixpoint(); + for (const auto &VAC : Values) + if (!VisitValueCB(*VAC.getValue())) + return indicatePessimisticFixpoint(); return clampStateAndIndicateChange(getState(), T); } @@ -4652,8 +4494,20 @@ struct AAAlignFloating : AAAlignImpl { ChangeStatus updateImpl(Attributor &A) override { const DataLayout &DL = A.getDataLayout(); - auto VisitValueCB = [&](Value &V, const Instruction *, - AAAlign::StateType &T, bool Stripped) -> bool { + bool Stripped; + bool UsedAssumedInformation = false; + SmallVector Values; + if (!A.getAssumedSimplifiedValues(getIRPosition(), *this, Values, + AA::AnyScope, UsedAssumedInformation)) { + Values.push_back({getAssociatedValue(), getCtxI()}); + Stripped = false; + } else { + Stripped = Values.size() != 1 || + Values.front().getValue() != &getAssociatedValue(); + } + + StateType T; + auto VisitValueCB = [&](Value &V) -> bool { if (isa(V) || isa(V)) return true; const auto &AA = A.getAAFor(*this, IRPosition::value(V), @@ -4686,15 +4540,13 @@ struct AAAlignFloating : AAAlignImpl { return T.isValidState(); }; - StateType T; - bool UsedAssumedInformation = false; - if (!genericValueTraversal(A, getIRPosition(), *this, T, - VisitValueCB, getCtxI(), - UsedAssumedInformation)) - return indicatePessimisticFixpoint(); + for (const auto &VAC : Values) { + if (!VisitValueCB(*VAC.getValue())) + return indicatePessimisticFixpoint(); + } - // TODO: If we know we visited all incoming values, thus no are assumed - // dead, we can take the known information from the state T. + // TODO: If we know we visited all incoming values, thus no are assumed + // dead, we can take the known information from the state T. return clampStateAndIndicateChange(getState(), T); } @@ -5518,9 +5370,9 @@ struct AAValueSimplifyImpl : AAValueSimplify { if (const auto &NewV = VMap.lookup(&V)) return NewV; bool UsedAssumedInformation = false; - Optional SimpleV = - A.getAssumedSimplified(V, QueryingAA, UsedAssumedInformation); - if (!SimpleV) + Optional SimpleV = A.getAssumedSimplified( + V, QueryingAA, UsedAssumedInformation, AA::Interprocedural); + if (!SimpleV.hasValue()) return PoisonValue::get(&Ty); Value *EffectiveV = &V; if (SimpleV.value()) @@ -5561,8 +5413,8 @@ struct AAValueSimplifyImpl : AAValueSimplify { bool UsedAssumedInformation = false; Optional QueryingValueSimplified = &IRP.getAssociatedValue(); if (Simplify) - QueryingValueSimplified = - A.getAssumedSimplified(IRP, QueryingAA, UsedAssumedInformation); + QueryingValueSimplified = A.getAssumedSimplified( + IRP, QueryingAA, UsedAssumedInformation, AA::Interprocedural); return unionAssumed(QueryingValueSimplified); } @@ -5763,209 +5615,11 @@ struct AAValueSimplifyFloating : AAValueSimplifyImpl { indicatePessimisticFixpoint(); } - /// Check if \p Cmp is a comparison we can simplify. - /// - /// We handle multiple cases, one in which at least one operand is an - /// (assumed) nullptr. If so, try to simplify it using AANonNull on the other - /// operand. Return true if successful, in that case SimplifiedAssociatedValue - /// will be updated. - bool handleCmp(Attributor &A, CmpInst &Cmp) { - auto Union = [&](Value &V) { - SimplifiedAssociatedValue = AA::combineOptionalValuesInAAValueLatice( - SimplifiedAssociatedValue, &V, V.getType()); - return SimplifiedAssociatedValue != Optional(nullptr); - }; - - Value *LHS = Cmp.getOperand(0); - Value *RHS = Cmp.getOperand(1); - - // Simplify the operands first. - bool UsedAssumedInformation = false; - const auto &SimplifiedLHS = - A.getAssumedSimplified(IRPosition::value(*LHS, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedLHS) - return true; - if (!SimplifiedLHS.value()) - return false; - LHS = *SimplifiedLHS; - - const auto &SimplifiedRHS = - A.getAssumedSimplified(IRPosition::value(*RHS, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedRHS) - return true; - if (!SimplifiedRHS.value()) - return false; - RHS = *SimplifiedRHS; - - LLVMContext &Ctx = Cmp.getContext(); - // Handle the trivial case first in which we don't even need to think about - // null or non-null. - if (LHS == RHS && (Cmp.isTrueWhenEqual() || Cmp.isFalseWhenEqual())) { - Constant *NewVal = - ConstantInt::get(Type::getInt1Ty(Ctx), Cmp.isTrueWhenEqual()); - if (!Union(*NewVal)) - return false; - if (!UsedAssumedInformation) - indicateOptimisticFixpoint(); - return true; - } - - // From now on we only handle equalities (==, !=). - ICmpInst *ICmp = dyn_cast(&Cmp); - if (!ICmp || !ICmp->isEquality()) - return false; - - bool LHSIsNull = isa(LHS); - bool RHSIsNull = isa(RHS); - if (!LHSIsNull && !RHSIsNull) - return false; - - // Left is the nullptr ==/!= non-nullptr case. We'll use AANonNull on the - // non-nullptr operand and if we assume it's non-null we can conclude the - // result of the comparison. - assert((LHSIsNull || RHSIsNull) && - "Expected nullptr versus non-nullptr comparison at this point"); - - // The index is the operand that we assume is not null. - unsigned PtrIdx = LHSIsNull; - auto &PtrNonNullAA = A.getAAFor( - *this, IRPosition::value(*ICmp->getOperand(PtrIdx)), - DepClassTy::REQUIRED); - if (!PtrNonNullAA.isAssumedNonNull()) - return false; - UsedAssumedInformation |= !PtrNonNullAA.isKnownNonNull(); - - // The new value depends on the predicate, true for != and false for ==. - Constant *NewVal = ConstantInt::get( - Type::getInt1Ty(Ctx), ICmp->getPredicate() == CmpInst::ICMP_NE); - if (!Union(*NewVal)) - return false; - - if (!UsedAssumedInformation) - indicateOptimisticFixpoint(); - - return true; - } - - /// Use the generic, non-optimistic InstSimplfy functionality if we managed to - /// simplify any operand of the instruction \p I. Return true if successful, - /// in that case SimplifiedAssociatedValue will be updated. - bool handleGenericInst(Attributor &A, Instruction &I) { - bool SomeSimplified = false; - bool UsedAssumedInformation = false; - - SmallVector NewOps(I.getNumOperands()); - int Idx = 0; - for (Value *Op : I.operands()) { - const auto &SimplifiedOp = - A.getAssumedSimplified(IRPosition::value(*Op, getCallBaseContext()), - *this, UsedAssumedInformation); - // If we are not sure about any operand we are not sure about the entire - // instruction, we'll wait. - if (!SimplifiedOp) - return true; - - if (SimplifiedOp.value()) - NewOps[Idx] = SimplifiedOp.value(); - else - NewOps[Idx] = Op; - - SomeSimplified |= (NewOps[Idx] != Op); - ++Idx; - } - - // We won't bother with the InstSimplify interface if we didn't simplify any - // operand ourselves. - if (!SomeSimplified) - return false; - - InformationCache &InfoCache = A.getInfoCache(); - Function *F = I.getFunction(); - const auto *DT = - InfoCache.getAnalysisResultForFunction(*F); - const auto *TLI = A.getInfoCache().getTargetLibraryInfoForFunction(*F); - auto *AC = InfoCache.getAnalysisResultForFunction(*F); - OptimizationRemarkEmitter *ORE = nullptr; - - const DataLayout &DL = I.getModule()->getDataLayout(); - SimplifyQuery Q(DL, TLI, DT, AC, &I); - if (Value *SimplifiedI = - simplifyInstructionWithOperands(&I, NewOps, Q, ORE)) { - SimplifiedAssociatedValue = AA::combineOptionalValuesInAAValueLatice( - SimplifiedAssociatedValue, SimplifiedI, I.getType()); - return SimplifiedAssociatedValue != Optional(nullptr); - } - return false; - } - /// See AbstractAttribute::updateImpl(...). ChangeStatus updateImpl(Attributor &A) override { auto Before = SimplifiedAssociatedValue; - - // Do not simplify loads that are only used in llvm.assume if we cannot also - // remove all stores that may feed into the load. The reason is that the - // assume is probably worth something as long as the stores are around. - if (auto *LI = dyn_cast(&getAssociatedValue())) { - InformationCache &InfoCache = A.getInfoCache(); - if (InfoCache.isOnlyUsedByAssume(*LI)) { - SmallSetVector PotentialCopies; - SmallSetVector PotentialValueOrigins; - bool UsedAssumedInformation = false; - if (AA::getPotentiallyLoadedValues(A, *LI, PotentialCopies, - PotentialValueOrigins, *this, - UsedAssumedInformation, - /* OnlyExact */ true)) { - if (!llvm::all_of(PotentialValueOrigins, [&](Instruction *I) { - if (!I) - return true; - if (auto *SI = dyn_cast(I)) - return A.isAssumedDead(SI->getOperandUse(0), this, - /* LivenessAA */ nullptr, - UsedAssumedInformation, - /* CheckBBLivenessOnly */ false); - return A.isAssumedDead(*I, this, /* LivenessAA */ nullptr, - UsedAssumedInformation, - /* CheckBBLivenessOnly */ false); - })) - return indicatePessimisticFixpoint(); - } - } - } - - auto VisitValueCB = [&](Value &V, const Instruction *CtxI, bool &, - bool Stripped) -> bool { - auto &AA = A.getAAFor( - *this, IRPosition::value(V, getCallBaseContext()), - DepClassTy::REQUIRED); - if (!Stripped && this == &AA) { - - if (auto *I = dyn_cast(&V)) { - if (auto *Cmp = dyn_cast(&V)) - if (handleCmp(A, *Cmp)) - return true; - if (handleGenericInst(A, *I)) - return true; - } - // TODO: Look the instruction and check recursively. - - LLVM_DEBUG(dbgs() << "[ValueSimplify] Can't be stripped more : " << V - << "\n"); - return false; - } - return checkAndUpdate(A, *this, - IRPosition::value(V, getCallBaseContext())); - }; - - bool Dummy = false; - bool UsedAssumedInformation = false; - if (!genericValueTraversal(A, getIRPosition(), *this, Dummy, - VisitValueCB, getCtxI(), - UsedAssumedInformation, - /* UseValueSimplify */ false)) - if (!askSimplifiedValueForOtherAAs(A)) - return indicatePessimisticFixpoint(); + if (!askSimplifiedValueForOtherAAs(A)) + return indicatePessimisticFixpoint(); // If a candicate was found in this update, return CHANGED. return Before == SimplifiedAssociatedValue ? ChangeStatus::UNCHANGED @@ -6427,44 +6081,36 @@ ChangeStatus AAHeapToStackFunction::updateImpl(Attributor &A) { /* CheckBBLivenessOnly */ true)) continue; - // Use the optimistic version to get the freed objects, ignoring dead - // branches etc. - SmallVector Objects; - if (!AA::getAssumedUnderlyingObjects(A, *DI.CB->getArgOperand(0), Objects, - *this, DI.CB, - UsedAssumedInformation)) { - LLVM_DEBUG( - dbgs() - << "[H2S] Unexpected failure in getAssumedUnderlyingObjects!\n"); + // Use the non-optimistic version to get the freed object. + Value *Obj = getUnderlyingObject(DI.CB->getArgOperand(0)); + if (!Obj) { + LLVM_DEBUG(dbgs() << "[H2S] Unknown underlying object for free!\n"); DI.MightFreeUnknownObjects = true; continue; } - // Check each object explicitly. - for (auto *Obj : Objects) { - // Free of null and undef can be ignored as no-ops (or UB in the latter - // case). - if (isa(Obj) || isa(Obj)) - continue; + // Free of null and undef can be ignored as no-ops (or UB in the latter + // case). + if (isa(Obj) || isa(Obj)) + continue; - CallBase *ObjCB = dyn_cast(Obj); - if (!ObjCB) { - LLVM_DEBUG(dbgs() - << "[H2S] Free of a non-call object: " << *Obj << "\n"); - DI.MightFreeUnknownObjects = true; - continue; - } + CallBase *ObjCB = dyn_cast(Obj); + if (!ObjCB) { + LLVM_DEBUG(dbgs() << "[H2S] Free of a non-call object: " << *Obj + << "\n"); + DI.MightFreeUnknownObjects = true; + continue; + } - AllocationInfo *AI = AllocationInfos.lookup(ObjCB); - if (!AI) { - LLVM_DEBUG(dbgs() << "[H2S] Free of a non-allocation object: " << *Obj - << "\n"); - DI.MightFreeUnknownObjects = true; - continue; - } - - DI.PotentialAllocationCalls.insert(ObjCB); + AllocationInfo *AI = AllocationInfos.lookup(ObjCB); + if (!AI) { + LLVM_DEBUG(dbgs() << "[H2S] Free of a non-allocation object: " << *Obj + << "\n"); + DI.MightFreeUnknownObjects = true; + continue; } + + DI.PotentialAllocationCalls.insert(ObjCB); } }; @@ -8061,7 +7707,7 @@ void AAMemoryLocationImpl::categorizePtrValue( << Ptr << " [" << getMemoryLocationsAsStr(State.getAssumed()) << "]\n"); - SmallVector Objects; + SmallSetVector Objects; bool UsedAssumedInformation = false; if (!AA::getAssumedUnderlyingObjects(A, Ptr, Objects, *this, &I, UsedAssumedInformation, @@ -8670,19 +8316,19 @@ struct AAValueConstantRangeFloating : AAValueConstantRangeImpl { // Simplify the operands first. bool UsedAssumedInformation = false; - const auto &SimplifiedLHS = - A.getAssumedSimplified(IRPosition::value(*LHS, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedLHS) + const auto &SimplifiedLHS = A.getAssumedSimplified( + IRPosition::value(*LHS, getCallBaseContext()), *this, + UsedAssumedInformation, AA::Interprocedural); + if (!SimplifiedLHS.hasValue()) return true; if (!SimplifiedLHS.value()) return false; LHS = *SimplifiedLHS; - const auto &SimplifiedRHS = - A.getAssumedSimplified(IRPosition::value(*RHS, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedRHS) + const auto &SimplifiedRHS = A.getAssumedSimplified( + IRPosition::value(*RHS, getCallBaseContext()), *this, + UsedAssumedInformation, AA::Interprocedural); + if (!SimplifiedRHS.hasValue()) return true; if (!SimplifiedRHS.value()) return false; @@ -8723,10 +8369,10 @@ struct AAValueConstantRangeFloating : AAValueConstantRangeImpl { // Simplify the operand first. bool UsedAssumedInformation = false; - const auto &SimplifiedOpV = - A.getAssumedSimplified(IRPosition::value(*OpV, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedOpV) + const auto &SimplifiedOpV = A.getAssumedSimplified( + IRPosition::value(*OpV, getCallBaseContext()), *this, + UsedAssumedInformation, AA::Interprocedural); + if (!SimplifiedOpV.hasValue()) return true; if (!SimplifiedOpV.value()) return false; @@ -8753,19 +8399,19 @@ struct AAValueConstantRangeFloating : AAValueConstantRangeImpl { // Simplify the operands first. bool UsedAssumedInformation = false; - const auto &SimplifiedLHS = - A.getAssumedSimplified(IRPosition::value(*LHS, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedLHS) + const auto &SimplifiedLHS = A.getAssumedSimplified( + IRPosition::value(*LHS, getCallBaseContext()), *this, + UsedAssumedInformation, AA::Interprocedural); + if (!SimplifiedLHS.hasValue()) return true; if (!SimplifiedLHS.value()) return false; LHS = *SimplifiedLHS; - const auto &SimplifiedRHS = - A.getAssumedSimplified(IRPosition::value(*RHS, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedRHS) + const auto &SimplifiedRHS = A.getAssumedSimplified( + IRPosition::value(*RHS, getCallBaseContext()), *this, + UsedAssumedInformation, AA::Interprocedural); + if (!SimplifiedRHS.hasValue()) return true; if (!SimplifiedRHS.value()) return false; @@ -8820,17 +8466,18 @@ struct AAValueConstantRangeFloating : AAValueConstantRangeImpl { /// See AbstractAttribute::updateImpl(...). ChangeStatus updateImpl(Attributor &A) override { - auto VisitValueCB = [&](Value &V, const Instruction *CtxI, - IntegerRangeState &T, bool Stripped) -> bool { + + IntegerRangeState T(getBitWidth()); + auto VisitValueCB = [&](Value &V, const Instruction *CtxI) -> bool { Instruction *I = dyn_cast(&V); if (!I || isa(I)) { // Simplify the operand first. bool UsedAssumedInformation = false; - const auto &SimplifiedOpV = - A.getAssumedSimplified(IRPosition::value(V, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedOpV) + const auto &SimplifiedOpV = A.getAssumedSimplified( + IRPosition::value(V, getCallBaseContext()), *this, + UsedAssumedInformation, AA::Interprocedural); + if (!SimplifiedOpV.hasValue()) return true; if (!SimplifiedOpV.value()) return false; @@ -8880,13 +8527,7 @@ struct AAValueConstantRangeFloating : AAValueConstantRangeImpl { return T.isValidState(); }; - IntegerRangeState T(getBitWidth()); - - bool UsedAssumedInformation = false; - if (!genericValueTraversal(A, getIRPosition(), *this, T, - VisitValueCB, getCtxI(), - UsedAssumedInformation, - /* UseValueSimplify */ false)) + if (!VisitValueCB(getAssociatedValue(), getCtxI())) return indicatePessimisticFixpoint(); // Ensure that long def-use chains can't cause circular reasoning either by @@ -8998,6 +8639,36 @@ struct AAPotentialConstantValuesImpl : AAPotentialConstantValues { AAPotentialConstantValues::initialize(A); } + bool fillSetWithConstantValues(Attributor &A, const IRPosition &IRP, SetTy &S, + bool &ContainsUndef) { + SmallVector Values; + bool UsedAssumedInformation = false; + if (!A.getAssumedSimplifiedValues(IRP, *this, Values, AA::Interprocedural, + UsedAssumedInformation)) { + if (!IRP.getAssociatedType()->isIntegerTy()) + return false; + auto &PotentialValuesAA = A.getAAFor( + *this, IRP, DepClassTy::REQUIRED); + if (!PotentialValuesAA.getState().isValidState()) + return false; + ContainsUndef = PotentialValuesAA.getState().undefIsContained(); + S = PotentialValuesAA.getState().getAssumedSet(); + return true; + } + + for (auto &It : Values) { + if (isa(It.getValue())) + continue; + auto *CI = dyn_cast(It.getValue()); + if (!CI) + return false; + S.insert(CI->getValue()); + } + ContainsUndef = S.empty(); + + return true; + } + /// See AbstractAttribute::getAsStr(). const std::string getAsStr() const override { std::string Str; @@ -9186,50 +8857,22 @@ struct AAPotentialConstantValuesFloating : AAPotentialConstantValuesImpl { Value *LHS = ICI->getOperand(0); Value *RHS = ICI->getOperand(1); - // Simplify the operands first. - bool UsedAssumedInformation = false; - const auto &SimplifiedLHS = - A.getAssumedSimplified(IRPosition::value(*LHS, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedLHS) - return ChangeStatus::UNCHANGED; - if (!SimplifiedLHS.value()) - return indicatePessimisticFixpoint(); - LHS = *SimplifiedLHS; - - const auto &SimplifiedRHS = - A.getAssumedSimplified(IRPosition::value(*RHS, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedRHS) - return ChangeStatus::UNCHANGED; - if (!SimplifiedRHS.value()) - return indicatePessimisticFixpoint(); - RHS = *SimplifiedRHS; - - if (!LHS->getType()->isIntegerTy() || !RHS->getType()->isIntegerTy()) - return indicatePessimisticFixpoint(); - - auto &LHSAA = A.getAAFor( - *this, IRPosition::value(*LHS), DepClassTy::REQUIRED); - if (!LHSAA.isValidState()) - return indicatePessimisticFixpoint(); - - auto &RHSAA = A.getAAFor( - *this, IRPosition::value(*RHS), DepClassTy::REQUIRED); - if (!RHSAA.isValidState()) + bool LHSContainsUndef = false, RHSContainsUndef = false; + SetTy LHSAAPVS, RHSAAPVS; + if (!fillSetWithConstantValues(A, IRPosition::value(*LHS), LHSAAPVS, + LHSContainsUndef) || + !fillSetWithConstantValues(A, IRPosition::value(*RHS), RHSAAPVS, + RHSContainsUndef)) return indicatePessimisticFixpoint(); - const SetTy &LHSAAPVS = LHSAA.getAssumedSet(); - const SetTy &RHSAAPVS = RHSAA.getAssumedSet(); - // TODO: make use of undef flag to limit potential values aggressively. bool MaybeTrue = false, MaybeFalse = false; const APInt Zero(RHS->getType()->getIntegerBitWidth(), 0); - if (LHSAA.undefIsContained() && RHSAA.undefIsContained()) { + if (LHSContainsUndef && RHSContainsUndef) { // The result of any comparison between undefs can be soundly replaced // with undef. unionAssumedWithUndef(); - } else if (LHSAA.undefIsContained()) { + } else if (LHSContainsUndef) { for (const APInt &R : RHSAAPVS) { bool CmpResult = calculateICmpInst(ICI, Zero, R); MaybeTrue |= CmpResult; @@ -9237,7 +8880,7 @@ struct AAPotentialConstantValuesFloating : AAPotentialConstantValuesImpl { if (MaybeTrue & MaybeFalse) return indicatePessimisticFixpoint(); } - } else if (RHSAA.undefIsContained()) { + } else if (RHSContainsUndef) { for (const APInt &L : LHSAAPVS) { bool CmpResult = calculateICmpInst(ICI, L, Zero); MaybeTrue |= CmpResult; @@ -9269,29 +8912,7 @@ struct AAPotentialConstantValuesFloating : AAPotentialConstantValuesImpl { Value *LHS = SI->getTrueValue(); Value *RHS = SI->getFalseValue(); - // Simplify the operands first. bool UsedAssumedInformation = false; - const auto &SimplifiedLHS = - A.getAssumedSimplified(IRPosition::value(*LHS, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedLHS) - return ChangeStatus::UNCHANGED; - if (!SimplifiedLHS.value()) - return indicatePessimisticFixpoint(); - LHS = *SimplifiedLHS; - - const auto &SimplifiedRHS = - A.getAssumedSimplified(IRPosition::value(*RHS, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedRHS) - return ChangeStatus::UNCHANGED; - if (!SimplifiedRHS.value()) - return indicatePessimisticFixpoint(); - RHS = *SimplifiedRHS; - - if (!LHS->getType()->isIntegerTy() || !RHS->getType()->isIntegerTy()) - return indicatePessimisticFixpoint(); - Optional C = A.getAssumedConstant(*SI->getCondition(), *this, UsedAssumedInformation); @@ -9302,35 +8923,36 @@ struct AAPotentialConstantValuesFloating : AAPotentialConstantValuesImpl { else if (C && *C && (*C)->isZeroValue()) OnlyRight = true; - const AAPotentialConstantValues *LHSAA = nullptr, *RHSAA = nullptr; - if (!OnlyRight) { - LHSAA = &A.getAAFor( - *this, IRPosition::value(*LHS), DepClassTy::REQUIRED); - if (!LHSAA->isValidState()) - return indicatePessimisticFixpoint(); - } - if (!OnlyLeft) { - RHSAA = &A.getAAFor( - *this, IRPosition::value(*RHS), DepClassTy::REQUIRED); - if (!RHSAA->isValidState()) - return indicatePessimisticFixpoint(); - } + bool LHSContainsUndef = false, RHSContainsUndef = false; + SetTy LHSAAPVS, RHSAAPVS; + if (!OnlyRight && !fillSetWithConstantValues(A, IRPosition::value(*LHS), + LHSAAPVS, LHSContainsUndef)) + return indicatePessimisticFixpoint(); - if (!LHSAA || !RHSAA) { + if (!OnlyLeft && !fillSetWithConstantValues(A, IRPosition::value(*RHS), + RHSAAPVS, RHSContainsUndef)) + return indicatePessimisticFixpoint(); + + if (OnlyLeft || OnlyRight) { // select (true/false), lhs, rhs - auto *OpAA = LHSAA ? LHSAA : RHSAA; + auto *OpAA = OnlyLeft ? &LHSAAPVS : &RHSAAPVS; + auto Undef = OnlyLeft ? LHSContainsUndef : RHSContainsUndef; - if (OpAA->undefIsContained()) + if (Undef) unionAssumedWithUndef(); - else - unionAssumed(*OpAA); + else { + for (auto &It : *OpAA) + unionAssumed(It); + } - } else if (LHSAA->undefIsContained() && RHSAA->undefIsContained()) { + } else if (LHSContainsUndef && RHSContainsUndef) { // select i1 *, undef , undef => undef unionAssumedWithUndef(); } else { - unionAssumed(*LHSAA); - unionAssumed(*RHSAA); + for (auto &It : LHSAAPVS) + unionAssumed(It); + for (auto &It : RHSAAPVS) + unionAssumed(It); } return AssumedBefore == getAssumed() ? ChangeStatus::UNCHANGED : ChangeStatus::CHANGED; @@ -9344,26 +8966,16 @@ struct AAPotentialConstantValuesFloating : AAPotentialConstantValuesImpl { uint32_t ResultBitWidth = CI->getDestTy()->getIntegerBitWidth(); Value *Src = CI->getOperand(0); - // Simplify the operand first. - bool UsedAssumedInformation = false; - const auto &SimplifiedSrc = - A.getAssumedSimplified(IRPosition::value(*Src, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedSrc) - return ChangeStatus::UNCHANGED; - if (!SimplifiedSrc.value()) + bool SrcContainsUndef = false; + SetTy SrcPVS; + if (!fillSetWithConstantValues(A, IRPosition::value(*Src), SrcPVS, + SrcContainsUndef)) return indicatePessimisticFixpoint(); - Src = *SimplifiedSrc; - auto &SrcAA = A.getAAFor( - *this, IRPosition::value(*Src), DepClassTy::REQUIRED); - if (!SrcAA.isValidState()) - return indicatePessimisticFixpoint(); - const SetTy &SrcAAPVS = SrcAA.getAssumedSet(); - if (SrcAA.undefIsContained()) + if (SrcContainsUndef) unionAssumedWithUndef(); else { - for (const APInt &S : SrcAAPVS) { + for (const APInt &S : SrcPVS) { APInt T = calculateCastInst(CI, S, ResultBitWidth); unionAssumed(T); } @@ -9377,53 +8989,26 @@ struct AAPotentialConstantValuesFloating : AAPotentialConstantValuesImpl { Value *LHS = BinOp->getOperand(0); Value *RHS = BinOp->getOperand(1); - // Simplify the operands first. - bool UsedAssumedInformation = false; - const auto &SimplifiedLHS = - A.getAssumedSimplified(IRPosition::value(*LHS, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedLHS) - return ChangeStatus::UNCHANGED; - if (!SimplifiedLHS.value()) - return indicatePessimisticFixpoint(); - LHS = *SimplifiedLHS; - - const auto &SimplifiedRHS = - A.getAssumedSimplified(IRPosition::value(*RHS, getCallBaseContext()), - *this, UsedAssumedInformation); - if (!SimplifiedRHS) - return ChangeStatus::UNCHANGED; - if (!SimplifiedRHS.value()) - return indicatePessimisticFixpoint(); - RHS = *SimplifiedRHS; - - if (!LHS->getType()->isIntegerTy() || !RHS->getType()->isIntegerTy()) - return indicatePessimisticFixpoint(); - - auto &LHSAA = A.getAAFor( - *this, IRPosition::value(*LHS), DepClassTy::REQUIRED); - if (!LHSAA.isValidState()) - return indicatePessimisticFixpoint(); - - auto &RHSAA = A.getAAFor( - *this, IRPosition::value(*RHS), DepClassTy::REQUIRED); - if (!RHSAA.isValidState()) + bool LHSContainsUndef = false, RHSContainsUndef = false; + SetTy LHSAAPVS, RHSAAPVS; + if (!fillSetWithConstantValues(A, IRPosition::value(*LHS), LHSAAPVS, + LHSContainsUndef) || + !fillSetWithConstantValues(A, IRPosition::value(*RHS), RHSAAPVS, + RHSContainsUndef)) return indicatePessimisticFixpoint(); - const SetTy &LHSAAPVS = LHSAA.getAssumedSet(); - const SetTy &RHSAAPVS = RHSAA.getAssumedSet(); const APInt Zero = APInt(LHS->getType()->getIntegerBitWidth(), 0); // TODO: make use of undef flag to limit potential values aggressively. - if (LHSAA.undefIsContained() && RHSAA.undefIsContained()) { + if (LHSContainsUndef && RHSContainsUndef) { if (!calculateBinaryOperatorAndTakeUnion(BinOp, Zero, Zero)) return indicatePessimisticFixpoint(); - } else if (LHSAA.undefIsContained()) { + } else if (LHSContainsUndef) { for (const APInt &R : RHSAAPVS) { if (!calculateBinaryOperatorAndTakeUnion(BinOp, Zero, R)) return indicatePessimisticFixpoint(); } - } else if (RHSAA.undefIsContained()) { + } else if (RHSContainsUndef) { for (const APInt &L : LHSAAPVS) { if (!calculateBinaryOperatorAndTakeUnion(BinOp, L, Zero)) return indicatePessimisticFixpoint(); @@ -9440,35 +9025,6 @@ struct AAPotentialConstantValuesFloating : AAPotentialConstantValuesImpl { : ChangeStatus::CHANGED; } - ChangeStatus updateWithPHINode(Attributor &A, PHINode *PHI) { - auto AssumedBefore = getAssumed(); - for (unsigned u = 0, e = PHI->getNumIncomingValues(); u < e; u++) { - Value *IncomingValue = PHI->getIncomingValue(u); - - // Simplify the operand first. - bool UsedAssumedInformation = false; - const auto &SimplifiedIncomingValue = A.getAssumedSimplified( - IRPosition::value(*IncomingValue, getCallBaseContext()), *this, - UsedAssumedInformation); - if (!SimplifiedIncomingValue) - continue; - if (!SimplifiedIncomingValue.value()) - return indicatePessimisticFixpoint(); - IncomingValue = *SimplifiedIncomingValue; - - auto &PotentialValuesAA = A.getAAFor( - *this, IRPosition::value(*IncomingValue), DepClassTy::REQUIRED); - if (!PotentialValuesAA.isValidState()) - return indicatePessimisticFixpoint(); - if (PotentialValuesAA.undefIsContained()) - unionAssumedWithUndef(); - else - unionAssumed(PotentialValuesAA.getAssumed()); - } - return AssumedBefore == getAssumed() ? ChangeStatus::UNCHANGED - : ChangeStatus::CHANGED; - } - /// See AbstractAttribute::updateImpl(...). ChangeStatus updateImpl(Attributor &A) override { Value &V = getAssociatedValue(); @@ -9486,9 +9042,6 @@ struct AAPotentialConstantValuesFloating : AAPotentialConstantValuesImpl { if (auto *BinOp = dyn_cast(I)) return updateWithBinaryOperator(A, BinOp); - if (auto *PHI = dyn_cast(I)) - return updateWithPHINode(A, PHI); - return indicatePessimisticFixpoint(); } @@ -9642,8 +9195,9 @@ struct AANoUndefImpl : AANoUndef { // A position whose simplified value does not have any value is // considered to be dead. We don't manifest noundef in such positions for // the same reason above. - if (!A.getAssumedSimplified(getIRPosition(), *this, UsedAssumedInformation) - .has_value()) + if (!A.getAssumedSimplified(getIRPosition(), *this, UsedAssumedInformation, + AA::Interprocedural) + .hasValue()) return ChangeStatus::UNCHANGED; return AANoUndef::manifest(A); } @@ -9663,11 +9217,19 @@ struct AANoUndefFloating : public AANoUndefImpl { /// See AbstractAttribute::updateImpl(...). ChangeStatus updateImpl(Attributor &A) override { - auto VisitValueCB = [&](Value &V, const Instruction *CtxI, - AANoUndef::StateType &T, bool Stripped) -> bool { + + SmallVector Values; + bool UsedAssumedInformation = false; + if (!A.getAssumedSimplifiedValues(getIRPosition(), *this, Values, + AA::AnyScope, UsedAssumedInformation)) { + Values.push_back({getAssociatedValue(), getCtxI()}); + } + + StateType T; + auto VisitValueCB = [&](Value &V, const Instruction *CtxI) -> bool { const auto &AA = A.getAAFor(*this, IRPosition::value(V), DepClassTy::REQUIRED); - if (!Stripped && this == &AA) { + if (this == &AA) { T.indicatePessimisticFixpoint(); } else { const AANoUndef::StateType &S = @@ -9677,12 +9239,9 @@ struct AANoUndefFloating : public AANoUndefImpl { return T.isValidState(); }; - StateType T; - bool UsedAssumedInformation = false; - if (!genericValueTraversal(A, getIRPosition(), *this, T, - VisitValueCB, getCtxI(), - UsedAssumedInformation)) - return indicatePessimisticFixpoint(); + for (const auto &VAC : Values) + if (!VisitValueCB(*VAC.getValue(), VAC.getCtxI())) + return indicatePessimisticFixpoint(); return clampStateAndIndicateChange(getState(), T); } @@ -9782,8 +9341,7 @@ struct AACallEdgesCallSite : public AACallEdgesImpl { ChangeStatus updateImpl(Attributor &A) override { ChangeStatus Change = ChangeStatus::UNCHANGED; - auto VisitValue = [&](Value &V, const Instruction *CtxI, bool &HasUnknown, - bool Stripped) -> bool { + auto VisitValue = [&](Value &V, const Instruction *CtxI) -> bool { if (Function *Fn = dyn_cast(&V)) { addCalledFunction(Fn, Change); } else { @@ -9795,17 +9353,17 @@ struct AACallEdgesCallSite : public AACallEdgesImpl { return true; }; + SmallVector Values; // Process any value that we might call. - auto ProcessCalledOperand = [&](Value *V) { - bool DummyValue = false; + auto ProcessCalledOperand = [&](Value *V, Instruction *CtxI) { bool UsedAssumedInformation = false; - if (!genericValueTraversal(A, IRPosition::value(*V), *this, - DummyValue, VisitValue, nullptr, - UsedAssumedInformation, false)) { - // If we haven't gone through all values, assume that there are unknown - // callees. - setHasUnknownCallee(true, Change); + Values.clear(); + if (!A.getAssumedSimplifiedValues(IRPosition::value(*V), *this, Values, + AA::AnyScope, UsedAssumedInformation)) { + Values.push_back({*V, CtxI}); } + for (auto &VAC : Values) + VisitValue(*VAC.getValue(), VAC.getCtxI()); }; CallBase *CB = cast(getCtxI()); @@ -9828,13 +9386,13 @@ struct AACallEdgesCallSite : public AACallEdgesImpl { } // The most simple case. - ProcessCalledOperand(CB->getCalledOperand()); + ProcessCalledOperand(CB->getCalledOperand(), CB); // Process callback functions. SmallVector CallbackUses; AbstractCallSite::getCallbackUses(*CB, CallbackUses); for (const Use *U : CallbackUses) - ProcessCalledOperand(U->get()); + ProcessCalledOperand(U->get(), CB); return Change; } @@ -10156,6 +9714,810 @@ struct AAFunctionReachabilityFunction : public AAFunctionReachability { }; } // namespace +template +static Optional +askForAssumedConstant(Attributor &A, const AbstractAttribute &QueryingAA, + const IRPosition &IRP, Type &Ty) { + if (!Ty.isIntegerTy()) + return nullptr; + + // This will also pass the call base context. + const auto &AA = A.getAAFor(QueryingAA, IRP, DepClassTy::NONE); + + Optional COpt = AA.getAssumedConstant(A); + + if (!COpt.hasValue()) { + A.recordDependence(AA, QueryingAA, DepClassTy::OPTIONAL); + return llvm::None; + } + if (auto *C = COpt.getValue()) { + A.recordDependence(AA, QueryingAA, DepClassTy::OPTIONAL); + return C; + } + return nullptr; +} + +Value *AAPotentialValues::getSingleValue( + Attributor &A, const AbstractAttribute &AA, const IRPosition &IRP, + SmallVectorImpl &Values) { + Type &Ty = *IRP.getAssociatedType(); + Optional V; + for (auto &It : Values) { + V = AA::combineOptionalValuesInAAValueLatice(V, It.getValue(), &Ty); + if (V.hasValue() && !V.getValue()) + break; + } + if (!V.hasValue()) + return UndefValue::get(&Ty); + return V.getValue(); +} + +namespace { +struct AAPotentialValuesImpl : AAPotentialValues { + using StateType = PotentialLLVMValuesState; + + AAPotentialValuesImpl(const IRPosition &IRP, Attributor &A) + : AAPotentialValues(IRP, A) {} + + /// See AbstractAttribute::initialize(..). + void initialize(Attributor &A) override { + if (A.hasSimplificationCallback(getIRPosition())) { + indicatePessimisticFixpoint(); + return; + } + Value *Stripped = getAssociatedValue().stripPointerCasts(); + if (isa(Stripped)) { + addValue(A, getState(), *Stripped, getCtxI(), AA::AnyScope, + getAnchorScope()); + indicateOptimisticFixpoint(); + return; + } + AAPotentialValues::initialize(A); + } + + /// See AbstractAttribute::getAsStr(). + const std::string getAsStr() const override { + std::string Str; + llvm::raw_string_ostream OS(Str); + OS << getState(); + return OS.str(); + } + + template + static Optional askOtherAA(Attributor &A, + const AbstractAttribute &AA, + const IRPosition &IRP, Type &Ty) { + if (isa(IRP.getAssociatedValue())) + return &IRP.getAssociatedValue(); + Optional C = askForAssumedConstant(A, AA, IRP, Ty); + if (!C) + return llvm::None; + if (C.getValue()) + if (auto *CC = AA::getWithType(**C, Ty)) + return CC; + return nullptr; + } + + void addValue(Attributor &A, StateType &State, Value &V, + const Instruction *CtxI, AA::ValueScope S, + Function *AnchorScope) const { + + IRPosition ValIRP = IRPosition::value(V); + if (auto *CB = dyn_cast_or_null(CtxI)) { + for (auto &U : CB->args()) { + if (U.get() != &V) + continue; + ValIRP = IRPosition::callsite_argument(*CB, CB->getArgOperandNo(&U)); + break; + } + } + + Value *VPtr = &V; + if (ValIRP.getAssociatedType()->isIntegerTy()) { + Type &Ty = *getAssociatedType(); + Optional SimpleV = + askOtherAA(A, *this, ValIRP, Ty); + if (SimpleV.hasValue() && !SimpleV.getValue()) { + auto &PotentialConstantsAA = A.getAAFor( + *this, ValIRP, DepClassTy::OPTIONAL); + if (PotentialConstantsAA.isValidState()) { + for (auto &It : PotentialConstantsAA.getAssumedSet()) { + State.unionAssumed({{*ConstantInt::get(&Ty, It), nullptr}, S}); + } + assert(!PotentialConstantsAA.undefIsContained() && + "Undef should be an explicit value!"); + return; + } + } + if (!SimpleV.hasValue()) + return; + + if (SimpleV.getValue()) + VPtr = SimpleV.getValue(); + } + + if (isa(VPtr)) + CtxI = nullptr; + if (!AA::isValidInScope(*VPtr, AnchorScope)) + S = AA::ValueScope(S | AA::Interprocedural); + + State.unionAssumed({{*VPtr, CtxI}, S}); + } + + /// Helper struct to tie a value+context pair together with the scope for + /// which this is the simplified version. + struct ItemInfo { + AA::ValueAndContext I; + AA::ValueScope S; + }; + + bool recurseForValue(Attributor &A, const IRPosition &IRP, AA::ValueScope S) { + SmallMapVector ValueScopeMap; + for (auto CS : {AA::Intraprocedural, AA::Interprocedural}) { + if (!(CS & S)) + continue; + + bool UsedAssumedInformation = false; + SmallVector Values; + if (!A.getAssumedSimplifiedValues(IRP, this, Values, CS, + UsedAssumedInformation)) + return false; + + for (auto &It : Values) + ValueScopeMap[It] += CS; + } + for (auto &It : ValueScopeMap) + addValue(A, getState(), *It.first.getValue(), It.first.getCtxI(), + AA::ValueScope(It.second), getAnchorScope()); + + return true; + } + + void giveUpOnIntraprocedural(Attributor &A) { + auto NewS = StateType::getBestState(getState()); + for (auto &It : getAssumedSet()) { + if (It.second == AA::Intraprocedural) + continue; + addValue(A, NewS, *It.first.getValue(), It.first.getCtxI(), + AA::Interprocedural, getAnchorScope()); + } + assert(!undefIsContained() && "Undef should be an explicit value!"); + addValue(A, NewS, getAssociatedValue(), getCtxI(), AA::Intraprocedural, + getAnchorScope()); + getState() = NewS; + } + + /// See AbstractState::indicatePessimisticFixpoint(...). + ChangeStatus indicatePessimisticFixpoint() override { + getState() = StateType::getBestState(getState()); + getState().unionAssumed({{getAssociatedValue(), getCtxI()}, AA::AnyScope}); + AAPotentialValues::indicateOptimisticFixpoint(); + return ChangeStatus::CHANGED; + } + + /// See AbstractAttribute::updateImpl(...). + ChangeStatus updateImpl(Attributor &A) override { + return indicatePessimisticFixpoint(); + } + + /// See AbstractAttribute::manifest(...). + ChangeStatus manifest(Attributor &A) override { + SmallVector Values; + for (AA::ValueScope S : {AA::Interprocedural, AA::Intraprocedural}) { + Values.clear(); + if (!getAssumedSimplifiedValues(A, Values, S)) + continue; + Value &OldV = getAssociatedValue(); + if (isa(OldV)) + continue; + Value *NewV = getSingleValue(A, *this, getIRPosition(), Values); + if (!NewV || NewV == &OldV) + continue; + if (getCtxI() && + !AA::isValidAtPosition({*NewV, *getCtxI()}, A.getInfoCache())) + continue; + if (A.changeAfterManifest(getIRPosition(), *NewV)) + return ChangeStatus::CHANGED; + } + return ChangeStatus::UNCHANGED; + } + + bool getAssumedSimplifiedValues(Attributor &A, + SmallVectorImpl &Values, + AA::ValueScope S) const override { + if (!isValidState()) + return false; + for (auto &It : getAssumedSet()) + if (It.second & S) + Values.push_back(It.first); + assert(!undefIsContained() && "Undef should be an explicit value!"); + return true; + } +}; + +struct AAPotentialValuesFloating : AAPotentialValuesImpl { + AAPotentialValuesFloating(const IRPosition &IRP, Attributor &A) + : AAPotentialValuesImpl(IRP, A) {} + + /// See AbstractAttribute::updateImpl(...). + ChangeStatus updateImpl(Attributor &A) override { + auto AssumedBefore = getAssumed(); + + genericValueTraversal(A); + + return (AssumedBefore == getAssumed()) ? ChangeStatus::UNCHANGED + : ChangeStatus::CHANGED; + } + + /// Helper struct to remember which AAIsDead instances we actually used. + struct LivenessInfo { + const AAIsDead *LivenessAA = nullptr; + bool AnyDead = false; + }; + + /// Check if \p Cmp is a comparison we can simplify. + /// + /// We handle multiple cases, one in which at least one operand is an + /// (assumed) nullptr. If so, try to simplify it using AANonNull on the other + /// operand. Return true if successful, in that case Worklist will be updated. + bool handleCmp(Attributor &A, CmpInst &Cmp, ItemInfo II, + SmallVectorImpl &Worklist) { + Value *LHS = Cmp.getOperand(0); + Value *RHS = Cmp.getOperand(1); + + // Simplify the operands first. + bool UsedAssumedInformation = false; + const auto &SimplifiedLHS = A.getAssumedSimplified( + IRPosition::value(*LHS, getCallBaseContext()), *this, + UsedAssumedInformation, AA::Intraprocedural); + if (!SimplifiedLHS.hasValue()) + return true; + if (!SimplifiedLHS.getValue()) + return false; + LHS = *SimplifiedLHS; + + const auto &SimplifiedRHS = A.getAssumedSimplified( + IRPosition::value(*RHS, getCallBaseContext()), *this, + UsedAssumedInformation, AA::Intraprocedural); + if (!SimplifiedRHS.hasValue()) + return true; + if (!SimplifiedRHS.getValue()) + return false; + RHS = *SimplifiedRHS; + + LLVMContext &Ctx = Cmp.getContext(); + // Handle the trivial case first in which we don't even need to think about + // null or non-null. + if (LHS == RHS && (Cmp.isTrueWhenEqual() || Cmp.isFalseWhenEqual())) { + Constant *NewV = + ConstantInt::get(Type::getInt1Ty(Ctx), Cmp.isTrueWhenEqual()); + addValue(A, getState(), *NewV, /* CtxI */ nullptr, II.S, + getAnchorScope()); + return true; + } + + // From now on we only handle equalities (==, !=). + ICmpInst *ICmp = dyn_cast(&Cmp); + if (!ICmp || !ICmp->isEquality()) + return false; + + bool LHSIsNull = isa(LHS); + bool RHSIsNull = isa(RHS); + if (!LHSIsNull && !RHSIsNull) + return false; + + // Left is the nullptr ==/!= non-nullptr case. We'll use AANonNull on the + // non-nullptr operand and if we assume it's non-null we can conclude the + // result of the comparison. + assert((LHSIsNull || RHSIsNull) && + "Expected nullptr versus non-nullptr comparison at this point"); + + // The index is the operand that we assume is not null. + unsigned PtrIdx = LHSIsNull; + auto &PtrNonNullAA = A.getAAFor( + *this, IRPosition::value(*ICmp->getOperand(PtrIdx)), + DepClassTy::REQUIRED); + if (!PtrNonNullAA.isAssumedNonNull()) + return false; + + // The new value depends on the predicate, true for != and false for ==. + Constant *NewV = ConstantInt::get(Type::getInt1Ty(Ctx), + ICmp->getPredicate() == CmpInst::ICMP_NE); + addValue(A, getState(), *NewV, /* CtxI */ nullptr, II.S, getAnchorScope()); + return true; + } + + bool handleSelectInst(Attributor &A, SelectInst &SI, ItemInfo II, + SmallVectorImpl &Worklist) { + const Instruction *CtxI = II.I.getCtxI(); + bool UsedAssumedInformation = false; + + Optional C = + A.getAssumedConstant(*SI.getCondition(), *this, UsedAssumedInformation); + bool NoValueYet = !C.hasValue(); + if (NoValueYet || isa_and_nonnull(*C)) + return true; + if (auto *CI = dyn_cast_or_null(*C)) { + if (CI->isZero()) + Worklist.push_back({{*SI.getFalseValue(), CtxI}, II.S}); + else + Worklist.push_back({{*SI.getTrueValue(), CtxI}, II.S}); + } else { + // We could not simplify the condition, assume both values. + Worklist.push_back({{*SI.getTrueValue(), CtxI}, II.S}); + Worklist.push_back({{*SI.getFalseValue(), CtxI}, II.S}); + } + return true; + } + + bool handleLoadInst(Attributor &A, LoadInst &LI, ItemInfo II, + SmallVectorImpl &Worklist) { + SmallSetVector PotentialCopies; + SmallSetVector PotentialValueOrigins; + bool UsedAssumedInformation = false; + if (!AA::getPotentiallyLoadedValues(A, LI, PotentialCopies, + PotentialValueOrigins, *this, + UsedAssumedInformation, + /* OnlyExact */ true)) + return false; + + // Do not simplify loads that are only used in llvm.assume if we cannot also + // remove all stores that may feed into the load. The reason is that the + // assume is probably worth something as long as the stores are around. + InformationCache &InfoCache = A.getInfoCache(); + if (InfoCache.isOnlyUsedByAssume(LI)) { + if (!llvm::all_of(PotentialValueOrigins, [&](Instruction *I) { + if (!I) + return true; + if (auto *SI = dyn_cast(I)) + return A.isAssumedDead(SI->getOperandUse(0), this, + /* LivenessAA */ nullptr, + UsedAssumedInformation, + /* CheckBBLivenessOnly */ false); + return A.isAssumedDead(*I, this, /* LivenessAA */ nullptr, + UsedAssumedInformation, + /* CheckBBLivenessOnly */ false); + })) + return false; + } + + // Values have to be dynamically unique or we loose the fact that a + // single llvm::Value might represent two runtime values (e.g., + // stack locations in different recursive calls). + const Instruction *CtxI = II.I.getCtxI(); + bool ScopeIsLocal = (II.S & AA::Intraprocedural); + bool AllLocal = ScopeIsLocal; + bool DynamicallyUnique = llvm::all_of(PotentialCopies, [&](Value *PC) { + AllLocal &= AA::isValidInScope(*PC, getAnchorScope()); + return AA::isDynamicallyUnique(A, *this, *PC); + }); + if (!DynamicallyUnique) + return false; + + for (auto *PotentialCopy : PotentialCopies) { + if (AllLocal) { + Worklist.push_back({{*PotentialCopy, CtxI}, II.S}); + } else { + Worklist.push_back({{*PotentialCopy, CtxI}, AA::Interprocedural}); + } + } + if (!AllLocal && ScopeIsLocal) + addValue(A, getState(), LI, CtxI, AA::Intraprocedural, getAnchorScope()); + return true; + } + + bool handlePHINode( + Attributor &A, PHINode &PHI, ItemInfo II, + SmallVectorImpl &Worklist, + SmallMapVector &LivenessAAs) { + auto GetLivenessInfo = [&](const Function &F) -> LivenessInfo & { + LivenessInfo &LI = LivenessAAs[&F]; + if (!LI.LivenessAA) + LI.LivenessAA = &A.getAAFor(*this, IRPosition::function(F), + DepClassTy::NONE); + return LI; + }; + + LivenessInfo &LI = GetLivenessInfo(*PHI.getFunction()); + for (unsigned u = 0, e = PHI.getNumIncomingValues(); u < e; u++) { + BasicBlock *IncomingBB = PHI.getIncomingBlock(u); + if (LI.LivenessAA->isEdgeDead(IncomingBB, PHI.getParent())) { + LI.AnyDead = true; + continue; + } + Worklist.push_back( + {{*PHI.getIncomingValue(u), IncomingBB->getTerminator()}, II.S}); + } + return true; + } + + /// Use the generic, non-optimistic InstSimplfy functionality if we managed to + /// simplify any operand of the instruction \p I. Return true if successful, + /// in that case Worklist will be updated. + bool handleGenericInst(Attributor &A, Instruction &I, ItemInfo II, + SmallVectorImpl &Worklist) { + bool SomeSimplified = false; + bool UsedAssumedInformation = false; + + SmallVector NewOps(I.getNumOperands()); + int Idx = 0; + for (Value *Op : I.operands()) { + const auto &SimplifiedOp = A.getAssumedSimplified( + IRPosition::value(*Op, getCallBaseContext()), *this, + UsedAssumedInformation, AA::Intraprocedural); + // If we are not sure about any operand we are not sure about the entire + // instruction, we'll wait. + if (!SimplifiedOp.hasValue()) + return true; + + if (SimplifiedOp.getValue()) + NewOps[Idx] = SimplifiedOp.getValue(); + else + NewOps[Idx] = Op; + + SomeSimplified |= (NewOps[Idx] != Op); + ++Idx; + } + + // We won't bother with the InstSimplify interface if we didn't simplify any + // operand ourselves. + if (!SomeSimplified) + return false; + + InformationCache &InfoCache = A.getInfoCache(); + Function *F = I.getFunction(); + const auto *DT = + InfoCache.getAnalysisResultForFunction(*F); + const auto *TLI = A.getInfoCache().getTargetLibraryInfoForFunction(*F); + auto *AC = InfoCache.getAnalysisResultForFunction(*F); + OptimizationRemarkEmitter *ORE = nullptr; + + const DataLayout &DL = I.getModule()->getDataLayout(); + SimplifyQuery Q(DL, TLI, DT, AC, &I); + Value *NewV = simplifyInstructionWithOperands(&I, NewOps, Q, ORE); + if (!NewV || NewV == &I) + return false; + + LLVM_DEBUG(dbgs() << "Generic inst " << I << " assumed simplified to " + << *NewV << "\n"); + Worklist.push_back({{*NewV, II.I.getCtxI()}, II.S}); + return true; + } + + bool simplifyInstruction( + Attributor &A, Instruction &I, ItemInfo II, + SmallVectorImpl &Worklist, + SmallMapVector &LivenessAAs) { + if (auto *CI = dyn_cast(&I)) + if (handleCmp(A, *CI, II, Worklist)) + return true; + + switch (I.getOpcode()) { + case Instruction::Select: + return handleSelectInst(A, cast(I), II, Worklist); + case Instruction::PHI: + return handlePHINode(A, cast(I), II, Worklist, LivenessAAs); + case Instruction::Load: + return handleLoadInst(A, cast(I), II, Worklist); + default: + return handleGenericInst(A, I, II, Worklist); + }; + return false; + } + + void genericValueTraversal(Attributor &A) { + SmallMapVector LivenessAAs; + + Value *InitialV = &getAssociatedValue(); + SmallSet Visited; + SmallVector Worklist; + Worklist.push_back({{*InitialV, getCtxI()}, AA::AnyScope}); + + int Iteration = 0; + do { + ItemInfo II = Worklist.pop_back_val(); + Value *V = II.I.getValue(); + assert(V); + const Instruction *CtxI = II.I.getCtxI(); + AA::ValueScope S = II.S; + + // Check if we should process the current value. To prevent endless + // recursion keep a record of the values we followed! + if (!Visited.insert(II.I).second) + continue; + + // Make sure we limit the compile time for complex expressions. + if (Iteration++ >= MaxPotentialValuesIterations) { + LLVM_DEBUG(dbgs() << "Generic value traversal reached iteration limit: " + << Iteration << "!\n"); + addValue(A, getState(), *V, CtxI, S, getAnchorScope()); + continue; + } + + // Explicitly look through calls with a "returned" attribute if we do + // not have a pointer as stripPointerCasts only works on them. + Value *NewV = nullptr; + if (V->getType()->isPointerTy()) { + NewV = AA::getWithType(*V->stripPointerCasts(), *V->getType()); + } else { + auto *CB = dyn_cast(V); + if (CB && CB->getCalledFunction()) { + for (Argument &Arg : CB->getCalledFunction()->args()) + if (Arg.hasReturnedAttr()) { + NewV = CB->getArgOperand(Arg.getArgNo()); + break; + } + } + } + if (NewV && NewV != V) { + Worklist.push_back({{*NewV, CtxI}, S}); + continue; + } + + if (auto *I = dyn_cast(V)) { + if (simplifyInstruction(A, *I, II, Worklist, LivenessAAs)) + continue; + } + + if (V != InitialV || isa(V)) + if (recurseForValue(A, IRPosition::value(*V), II.S)) + continue; + + // If we haven't stripped anything we give up. + if (V == InitialV && CtxI == getCtxI()) { + indicatePessimisticFixpoint(); + return; + } + + addValue(A, getState(), *V, CtxI, S, getAnchorScope()); + } while (!Worklist.empty()); + + // If we actually used liveness information so we have to record a + // dependence. + for (auto &It : LivenessAAs) + if (It.second.AnyDead) + A.recordDependence(*It.second.LivenessAA, *this, DepClassTy::OPTIONAL); + } + + /// See AbstractAttribute::trackStatistics() + void trackStatistics() const override { + STATS_DECLTRACK_FLOATING_ATTR(potential_values) + } +}; + +struct AAPotentialValuesArgument final : AAPotentialValuesImpl { + using Base = AAPotentialValuesImpl; + AAPotentialValuesArgument(const IRPosition &IRP, Attributor &A) + : Base(IRP, A) {} + + /// See AbstractAttribute::initialize(..). + void initialize(Attributor &A) override { + auto &Arg = cast(getAssociatedValue()); + if (Arg.hasPointeeInMemoryValueAttr()) + indicatePessimisticFixpoint(); + } + + /// See AbstractAttribute::updateImpl(...). + ChangeStatus updateImpl(Attributor &A) override { + auto AssumedBefore = getAssumed(); + + unsigned CSArgNo = getCallSiteArgNo(); + + bool UsedAssumedInformation = false; + SmallVector Values; + auto CallSitePred = [&](AbstractCallSite ACS) { + const auto CSArgIRP = IRPosition::callsite_argument(ACS, CSArgNo); + if (CSArgIRP.getPositionKind() == IRP_INVALID) + return false; + + if (!A.getAssumedSimplifiedValues(CSArgIRP, this, Values, + AA::Interprocedural, + UsedAssumedInformation)) + return false; + + return isValidState(); + }; + + if (!A.checkForAllCallSites(CallSitePred, *this, + /* RequireAllCallSites */ true, + UsedAssumedInformation)) + return indicatePessimisticFixpoint(); + + Function *Fn = getAssociatedFunction(); + bool AnyNonLocal = false; + for (auto &It : Values) { + if (isa(It.getValue())) { + addValue(A, getState(), *It.getValue(), It.getCtxI(), AA::AnyScope, + getAnchorScope()); + continue; + } + if (!AA::isDynamicallyUnique(A, *this, *It.getValue())) + return indicatePessimisticFixpoint(); + + if (auto *Arg = dyn_cast(It.getValue())) + if (Arg->getParent() == Fn) { + addValue(A, getState(), *It.getValue(), It.getCtxI(), AA::AnyScope, + getAnchorScope()); + continue; + } + addValue(A, getState(), *It.getValue(), It.getCtxI(), AA::Interprocedural, + getAnchorScope()); + AnyNonLocal = true; + } + if (undefIsContained()) + unionAssumedWithUndef(); + if (AnyNonLocal) + giveUpOnIntraprocedural(A); + + return (AssumedBefore == getAssumed()) ? ChangeStatus::UNCHANGED + : ChangeStatus::CHANGED; + } + + /// See AbstractAttribute::trackStatistics() + void trackStatistics() const override { + STATS_DECLTRACK_ARG_ATTR(potential_values) + } +}; + +struct AAPotentialValuesReturned + : AAReturnedFromReturnedValues { + using Base = + AAReturnedFromReturnedValues; + AAPotentialValuesReturned(const IRPosition &IRP, Attributor &A) + : Base(IRP, A) {} + + /// See AbstractAttribute::initialize(..). + void initialize(Attributor &A) override { + if (A.hasSimplificationCallback(getIRPosition())) + indicatePessimisticFixpoint(); + else + AAPotentialValues::initialize(A); + } + + ChangeStatus manifest(Attributor &A) override { + // We queried AAValueSimplify for the returned values so they will be + // replaced if a simplified form was found. Nothing to do here. + return ChangeStatus::UNCHANGED; + } + + ChangeStatus indicatePessimisticFixpoint() override { + return AAPotentialValues::indicatePessimisticFixpoint(); + } + + /// See AbstractAttribute::trackStatistics() + void trackStatistics() const override { + STATS_DECLTRACK_FNRET_ATTR(potential_values) + } +}; + +struct AAPotentialValuesFunction : AAPotentialValuesImpl { + AAPotentialValuesFunction(const IRPosition &IRP, Attributor &A) + : AAPotentialValuesImpl(IRP, A) {} + + /// See AbstractAttribute::updateImpl(...). + ChangeStatus updateImpl(Attributor &A) override { + llvm_unreachable("AAPotentialValues(Function|CallSite)::updateImpl will " + "not be called"); + } + + /// See AbstractAttribute::trackStatistics() + void trackStatistics() const override { + STATS_DECLTRACK_FN_ATTR(potential_values) + } +}; + +struct AAPotentialValuesCallSite : AAPotentialValuesFunction { + AAPotentialValuesCallSite(const IRPosition &IRP, Attributor &A) + : AAPotentialValuesFunction(IRP, A) {} + + /// See AbstractAttribute::trackStatistics() + void trackStatistics() const override { + STATS_DECLTRACK_CS_ATTR(potential_values) + } +}; + +struct AAPotentialValuesCallSiteReturned : AAPotentialValuesImpl { + AAPotentialValuesCallSiteReturned(const IRPosition &IRP, Attributor &A) + : AAPotentialValuesImpl(IRP, A) {} + + /// See AbstractAttribute::updateImpl(...). + ChangeStatus updateImpl(Attributor &A) override { + auto AssumedBefore = getAssumed(); + + Function *Callee = getAssociatedFunction(); + if (!Callee) + return indicatePessimisticFixpoint(); + + bool UsedAssumedInformation = false; + auto *CB = cast(getCtxI()); + if (CB->isMustTailCall() && + !A.isAssumedDead(IRPosition::inst(*CB), this, nullptr, + UsedAssumedInformation)) + return indicatePessimisticFixpoint(); + + SmallVector Values; + if (!A.getAssumedSimplifiedValues(IRPosition::returned(*Callee), this, + Values, AA::Intraprocedural, + UsedAssumedInformation)) + return indicatePessimisticFixpoint(); + + Function *Caller = CB->getCaller(); + + bool AnyNonLocal = false; + for (auto &It : Values) { + Value *V = It.getValue(); + Optional CallerV = A.translateArgumentToCallSiteContent( + V, *CB, *this, UsedAssumedInformation); + if (!CallerV.hasValue()) { + // Nothing to do as long as no value was determined. + continue; + } + V = CallerV.getValue() ? CallerV.getValue() : V; + if (AA::isDynamicallyUnique(A, *this, *V) && + AA::isValidInScope(*V, Caller)) { + if (CallerV.getValue()) { + SmallVector ArgValues; + IRPosition IRP = IRPosition::value(*V); + if (auto *Arg = dyn_cast(V)) + if (Arg->getParent() == CB->getCalledFunction()) + IRP = IRPosition::callsite_argument(*CB, Arg->getArgNo()); + if (recurseForValue(A, IRP, AA::AnyScope)) + continue; + } + addValue(A, getState(), *V, CB, AA::AnyScope, getAnchorScope()); + } else { + AnyNonLocal = true; + break; + } + } + if (AnyNonLocal) { + Values.clear(); + if (!A.getAssumedSimplifiedValues(IRPosition::returned(*Callee), this, + Values, AA::Interprocedural, + UsedAssumedInformation)) + return indicatePessimisticFixpoint(); + AnyNonLocal = false; + getState() = PotentialLLVMValuesState::getBestState(); + for (auto &It : Values) { + Value *V = It.getValue(); + if (!AA::isDynamicallyUnique(A, *this, *V)) + return indicatePessimisticFixpoint(); + if (AA::isValidInScope(*V, Caller)) { + addValue(A, getState(), *V, CB, AA::AnyScope, getAnchorScope()); + } else { + AnyNonLocal = true; + addValue(A, getState(), *V, CB, AA::Interprocedural, + getAnchorScope()); + } + } + if (AnyNonLocal) + giveUpOnIntraprocedural(A); + } + return (AssumedBefore == getAssumed()) ? ChangeStatus::UNCHANGED + : ChangeStatus::CHANGED; + } + + ChangeStatus indicatePessimisticFixpoint() override { + return AAPotentialValues::indicatePessimisticFixpoint(); + } + + /// See AbstractAttribute::trackStatistics() + void trackStatistics() const override { + STATS_DECLTRACK_CSRET_ATTR(potential_values) + } +}; + +struct AAPotentialValuesCallSiteArgument : AAPotentialValuesFloating { + AAPotentialValuesCallSiteArgument(const IRPosition &IRP, Attributor &A) + : AAPotentialValuesFloating(IRP, A) {} + + /// See AbstractAttribute::trackStatistics() + void trackStatistics() const override { + STATS_DECLTRACK_CSARG_ATTR(potential_values) + } +}; +} // namespace + /// ---------------------- Assumption Propagation ------------------------------ namespace { struct AAAssumptionInfoImpl : public AAAssumptionInfo { @@ -10323,6 +10685,7 @@ const char AAMemoryBehavior::ID = 0; const char AAMemoryLocation::ID = 0; const char AAValueConstantRange::ID = 0; const char AAPotentialConstantValues::ID = 0; +const char AAPotentialValues::ID = 0; const char AANoUndef::ID = 0; const char AACallEdges::ID = 0; const char AAFunctionReachability::ID = 0; @@ -10441,6 +10804,7 @@ CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION(AAInstanceInfo) CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION(AANoCapture) CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION(AAValueConstantRange) CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION(AAPotentialConstantValues) +CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION(AAPotentialValues) CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION(AANoUndef) CREATE_VALUE_ABSTRACT_ATTRIBUTE_FOR_POSITION(AAPointerInfo) diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp index 8e0ca8c6c997..0b42fc151991 100644 --- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp +++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp @@ -4808,7 +4808,7 @@ void OpenMPOpt::registerAAs(bool IsModulePass) { if (auto *LI = dyn_cast(&I)) { bool UsedAssumedInformation = false; A.getAssumedSimplified(IRPosition::value(*LI), /* AA */ nullptr, - UsedAssumedInformation); + UsedAssumedInformation, AA::Interprocedural); } else if (auto *SI = dyn_cast(&I)) { A.getOrCreateAAFor(IRPosition::value(*SI)); } diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/2008-02-01-ReturnAttrs.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/2008-02-01-ReturnAttrs.ll index 5212a5c63245..8c653b09a1e1 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/2008-02-01-ReturnAttrs.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/2008-02-01-ReturnAttrs.ll @@ -5,21 +5,21 @@ ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM define internal i32 @deref(i32* %x) nounwind { -; IS________OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn -; IS________OPM-LABEL: define {{[^@]+}}@deref -; IS________OPM-SAME: (i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[X:%.*]]) #[[ATTR0:[0-9]+]] { -; IS________OPM-NEXT: entry: -; IS________OPM-NEXT: [[TMP2:%.*]] = load i32, i32* [[X]], align 4 -; IS________OPM-NEXT: ret i32 [[TMP2]] +; IS__CGSCC_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@deref +; IS__CGSCC_OPM-SAME: (i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[X:%.*]]) #[[ATTR0:[0-9]+]] { +; IS__CGSCC_OPM-NEXT: entry: +; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = load i32, i32* [[X]], align 4 +; IS__CGSCC_OPM-NEXT: ret i32 [[TMP2]] ; -; IS________NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn -; IS________NPM-LABEL: define {{[^@]+}}@deref -; IS________NPM-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] { -; IS________NPM-NEXT: entry: -; IS________NPM-NEXT: [[X_PRIV:%.*]] = alloca i32, align 4 -; IS________NPM-NEXT: store i32 [[TMP0]], i32* [[X_PRIV]], align 4 -; IS________NPM-NEXT: [[TMP2:%.*]] = load i32, i32* [[X_PRIV]], align 4 -; IS________NPM-NEXT: ret i32 [[TMP2]] +; IS__CGSCC_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@deref +; IS__CGSCC_NPM-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] { +; IS__CGSCC_NPM-NEXT: entry: +; IS__CGSCC_NPM-NEXT: [[X_PRIV:%.*]] = alloca i32, align 4 +; IS__CGSCC_NPM-NEXT: store i32 [[TMP0]], i32* [[X_PRIV]], align 4 +; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = load i32, i32* [[X_PRIV]], align 4 +; IS__CGSCC_NPM-NEXT: ret i32 [[TMP2]] ; entry: %tmp2 = load i32, i32* %x, align 4 @@ -27,24 +27,13 @@ entry: } define i32 @f(i32 %x) { -; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@f -; IS__TUNIT_OPM-SAME: (i32 [[X:%.*]]) #[[ATTR1:[0-9]+]] { -; IS__TUNIT_OPM-NEXT: entry: -; IS__TUNIT_OPM-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4 -; IS__TUNIT_OPM-NEXT: store i32 [[X]], i32* [[X_ADDR]], align 4 -; IS__TUNIT_OPM-NEXT: [[TMP1:%.*]] = call i32 @deref(i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[X_ADDR]]) #[[ATTR2:[0-9]+]] -; IS__TUNIT_OPM-NEXT: ret i32 [[TMP1]] -; -; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@f -; IS__TUNIT_NPM-SAME: (i32 [[X:%.*]]) #[[ATTR1:[0-9]+]] { -; IS__TUNIT_NPM-NEXT: entry: -; IS__TUNIT_NPM-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4 -; IS__TUNIT_NPM-NEXT: store i32 [[X]], i32* [[X_ADDR]], align 4 -; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[X_ADDR]], align 4 -; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = call i32 @deref(i32 [[TMP0]]) #[[ATTR2:[0-9]+]] -; IS__TUNIT_NPM-NEXT: ret i32 [[TMP1]] +; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT____-LABEL: define {{[^@]+}}@f +; IS__TUNIT____-SAME: (i32 returned [[X:%.*]]) #[[ATTR0:[0-9]+]] { +; IS__TUNIT____-NEXT: entry: +; IS__TUNIT____-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4 +; IS__TUNIT____-NEXT: store i32 [[X]], i32* [[X_ADDR]], align 4 +; IS__TUNIT____-NEXT: ret i32 [[X]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f @@ -71,9 +60,7 @@ entry: ret i32 %tmp1 } ;. -; IS__TUNIT____: attributes #[[ATTR0:[0-9]+]] = { argmemonly nofree norecurse nosync nounwind readonly willreturn } -; IS__TUNIT____: attributes #[[ATTR1:[0-9]+]] = { nofree norecurse nosync nounwind readnone willreturn } -; IS__TUNIT____: attributes #[[ATTR2:[0-9]+]] = { nofree nosync nounwind readonly willreturn } +; IS__TUNIT____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } ;. ; IS__CGSCC____: attributes #[[ATTR0:[0-9]+]] = { argmemonly nofree norecurse nosync nounwind readonly willreturn } ; IS__CGSCC____: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind readnone willreturn } diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/X86/min-legal-vector-width.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/X86/min-legal-vector-width.ll index 2b2b1131bd4c..5155c544a1b0 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/X86/min-legal-vector-width.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/X86/min-legal-vector-width.ll @@ -71,7 +71,7 @@ define void @avx512_legal512_prefer512_call_avx512_legal512_prefer512(<8 x i64>* ; IS__CGSCC_OPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6:[0-9]+]] +; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6:[0-9]+]] ; IS__CGSCC_OPM-NEXT: call fastcc void @callee_avx512_legal512_prefer512_call_avx512_legal512_prefer512(<8 x i64>* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64>* nocapture nofree noundef nonnull readonly align 64 dereferenceable(64) [[TMP]]) #[[ATTR7:[0-9]+]] ; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 ; IS__CGSCC_OPM-NEXT: store <8 x i64> [[TMP4]], <8 x i64>* [[ARG]], align 2 @@ -84,7 +84,7 @@ define void @avx512_legal512_prefer512_call_avx512_legal512_prefer512(<8 x i64>* ; IS__CGSCC_NPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5:[0-9]+]] +; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5:[0-9]+]] ; IS__CGSCC_NPM-NEXT: [[TMP0:%.*]] = load <8 x i64>, <8 x i64>* [[TMP]], align 64 ; IS__CGSCC_NPM-NEXT: call fastcc void @callee_avx512_legal512_prefer512_call_avx512_legal512_prefer512(<8 x i64>* noalias nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64> [[TMP0]]) #[[ATTR6:[0-9]+]] ; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 @@ -165,7 +165,7 @@ define void @avx512_legal512_prefer256_call_avx512_legal512_prefer256(<8 x i64>* ; IS__CGSCC_OPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] +; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] ; IS__CGSCC_OPM-NEXT: call fastcc void @callee_avx512_legal512_prefer256_call_avx512_legal512_prefer256(<8 x i64>* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64>* nocapture nofree noundef nonnull readonly align 64 dereferenceable(64) [[TMP]]) #[[ATTR7]] ; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 ; IS__CGSCC_OPM-NEXT: store <8 x i64> [[TMP4]], <8 x i64>* [[ARG]], align 2 @@ -178,7 +178,7 @@ define void @avx512_legal512_prefer256_call_avx512_legal512_prefer256(<8 x i64>* ; IS__CGSCC_NPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] +; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] ; IS__CGSCC_NPM-NEXT: [[TMP0:%.*]] = load <8 x i64>, <8 x i64>* [[TMP]], align 64 ; IS__CGSCC_NPM-NEXT: call fastcc void @callee_avx512_legal512_prefer256_call_avx512_legal512_prefer256(<8 x i64>* noalias nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64> [[TMP0]]) #[[ATTR6]] ; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 @@ -259,7 +259,7 @@ define void @avx512_legal512_prefer512_call_avx512_legal512_prefer256(<8 x i64>* ; IS__CGSCC_OPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] +; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] ; IS__CGSCC_OPM-NEXT: call fastcc void @callee_avx512_legal512_prefer512_call_avx512_legal512_prefer256(<8 x i64>* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64>* nocapture nofree noundef nonnull readonly align 64 dereferenceable(64) [[TMP]]) #[[ATTR7]] ; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 ; IS__CGSCC_OPM-NEXT: store <8 x i64> [[TMP4]], <8 x i64>* [[ARG]], align 2 @@ -272,7 +272,7 @@ define void @avx512_legal512_prefer512_call_avx512_legal512_prefer256(<8 x i64>* ; IS__CGSCC_NPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] +; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] ; IS__CGSCC_NPM-NEXT: [[TMP0:%.*]] = load <8 x i64>, <8 x i64>* [[TMP]], align 64 ; IS__CGSCC_NPM-NEXT: call fastcc void @callee_avx512_legal512_prefer512_call_avx512_legal512_prefer256(<8 x i64>* noalias nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64> [[TMP0]]) #[[ATTR6]] ; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 @@ -353,7 +353,7 @@ define void @avx512_legal512_prefer256_call_avx512_legal512_prefer512(<8 x i64>* ; IS__CGSCC_OPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] +; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] ; IS__CGSCC_OPM-NEXT: call fastcc void @callee_avx512_legal512_prefer256_call_avx512_legal512_prefer512(<8 x i64>* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64>* nocapture nofree noundef nonnull readonly align 64 dereferenceable(64) [[TMP]]) #[[ATTR7]] ; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 ; IS__CGSCC_OPM-NEXT: store <8 x i64> [[TMP4]], <8 x i64>* [[ARG]], align 2 @@ -366,7 +366,7 @@ define void @avx512_legal512_prefer256_call_avx512_legal512_prefer512(<8 x i64>* ; IS__CGSCC_NPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] +; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] ; IS__CGSCC_NPM-NEXT: [[TMP0:%.*]] = load <8 x i64>, <8 x i64>* [[TMP]], align 64 ; IS__CGSCC_NPM-NEXT: call fastcc void @callee_avx512_legal512_prefer256_call_avx512_legal512_prefer512(<8 x i64>* noalias nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64> [[TMP0]]) #[[ATTR6]] ; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 @@ -444,7 +444,7 @@ define void @avx512_legal256_prefer256_call_avx512_legal512_prefer256(<8 x i64>* ; IS__CGSCC_OPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] +; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] ; IS__CGSCC_OPM-NEXT: call fastcc void @callee_avx512_legal256_prefer256_call_avx512_legal512_prefer256(<8 x i64>* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64>* nocapture nofree noundef nonnull readonly align 64 dereferenceable(64) [[TMP]]) #[[ATTR7]] ; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 ; IS__CGSCC_OPM-NEXT: store <8 x i64> [[TMP4]], <8 x i64>* [[ARG]], align 2 @@ -457,7 +457,7 @@ define void @avx512_legal256_prefer256_call_avx512_legal512_prefer256(<8 x i64>* ; IS__CGSCC_NPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] +; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] ; IS__CGSCC_NPM-NEXT: call fastcc void @callee_avx512_legal256_prefer256_call_avx512_legal512_prefer256(<8 x i64>* noalias nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64>* noalias nocapture nofree noundef nonnull readonly align 64 dereferenceable(64) [[TMP]]) #[[ATTR6]] ; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 ; IS__CGSCC_NPM-NEXT: store <8 x i64> [[TMP4]], <8 x i64>* [[ARG]], align 2 @@ -534,7 +534,7 @@ define void @avx512_legal512_prefer256_call_avx512_legal256_prefer256(<8 x i64>* ; IS__CGSCC_OPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] +; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] ; IS__CGSCC_OPM-NEXT: call fastcc void @callee_avx512_legal512_prefer256_call_avx512_legal256_prefer256(<8 x i64>* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64>* nocapture nofree noundef nonnull readonly align 64 dereferenceable(64) [[TMP]]) #[[ATTR7]] ; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 ; IS__CGSCC_OPM-NEXT: store <8 x i64> [[TMP4]], <8 x i64>* [[ARG]], align 2 @@ -547,7 +547,7 @@ define void @avx512_legal512_prefer256_call_avx512_legal256_prefer256(<8 x i64>* ; IS__CGSCC_NPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] +; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] ; IS__CGSCC_NPM-NEXT: call fastcc void @callee_avx512_legal512_prefer256_call_avx512_legal256_prefer256(<8 x i64>* noalias nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64>* noalias nocapture nofree noundef nonnull readonly align 64 dereferenceable(64) [[TMP]]) #[[ATTR6]] ; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 ; IS__CGSCC_NPM-NEXT: store <8 x i64> [[TMP4]], <8 x i64>* [[ARG]], align 2 @@ -627,7 +627,7 @@ define void @avx2_legal256_prefer256_call_avx2_legal512_prefer256(<8 x i64>* %ar ; IS__CGSCC_OPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] +; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] ; IS__CGSCC_OPM-NEXT: call fastcc void @callee_avx2_legal256_prefer256_call_avx2_legal512_prefer256(<8 x i64>* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64>* nocapture nofree noundef nonnull readonly align 64 dereferenceable(64) [[TMP]]) #[[ATTR7]] ; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 ; IS__CGSCC_OPM-NEXT: store <8 x i64> [[TMP4]], <8 x i64>* [[ARG]], align 2 @@ -640,7 +640,7 @@ define void @avx2_legal256_prefer256_call_avx2_legal512_prefer256(<8 x i64>* %ar ; IS__CGSCC_NPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] +; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] ; IS__CGSCC_NPM-NEXT: [[TMP0:%.*]] = load <8 x i64>, <8 x i64>* [[TMP]], align 64 ; IS__CGSCC_NPM-NEXT: call fastcc void @callee_avx2_legal256_prefer256_call_avx2_legal512_prefer256(<8 x i64>* noalias nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64> [[TMP0]]) #[[ATTR6]] ; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 @@ -721,7 +721,7 @@ define void @avx2_legal512_prefer256_call_avx2_legal256_prefer256(<8 x i64>* %ar ; IS__CGSCC_OPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_OPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] +; IS__CGSCC_OPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR6]] ; IS__CGSCC_OPM-NEXT: call fastcc void @callee_avx2_legal512_prefer256_call_avx2_legal256_prefer256(<8 x i64>* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64>* nocapture nofree noundef nonnull readonly align 64 dereferenceable(64) [[TMP]]) #[[ATTR7]] ; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 ; IS__CGSCC_OPM-NEXT: store <8 x i64> [[TMP4]], <8 x i64>* [[ARG]], align 2 @@ -734,7 +734,7 @@ define void @avx2_legal512_prefer256_call_avx2_legal256_prefer256(<8 x i64>* %ar ; IS__CGSCC_NPM-NEXT: [[TMP:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = alloca <8 x i64>, align 32 ; IS__CGSCC_NPM-NEXT: [[TMP3:%.*]] = bitcast <8 x i64>* [[TMP]] to i8* -; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] +; IS__CGSCC_NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* nocapture nofree noundef nonnull writeonly align 32 dereferenceable(64) [[TMP3]], i8 noundef 0, i64 noundef 32, i1 noundef false) #[[ATTR5]] ; IS__CGSCC_NPM-NEXT: [[TMP0:%.*]] = load <8 x i64>, <8 x i64>* [[TMP]], align 64 ; IS__CGSCC_NPM-NEXT: call fastcc void @callee_avx2_legal512_prefer256_call_avx2_legal256_prefer256(<8 x i64>* noalias nocapture nofree noundef nonnull writeonly align 64 dereferenceable(64) [[TMP2]], <8 x i64> [[TMP0]]) #[[ATTR6]] ; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = load <8 x i64>, <8 x i64>* [[TMP2]], align 64 diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/X86/thiscall.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/X86/thiscall.ll index acbb183955f5..cf7607b90418 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/X86/thiscall.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/X86/thiscall.ll @@ -21,7 +21,7 @@ define internal x86_thiscallcc void @internalfun(%struct.a* %this, <{ %struct.a ; CHECK-NEXT: [[A:%.*]] = getelementptr inbounds <{ [[STRUCT_A]] }>, <{ [[STRUCT_A]] }>* [[TMP0]], i32 0, i32 0 ; CHECK-NEXT: [[ARGMEM:%.*]] = alloca inalloca <{ [[STRUCT_A]] }>, align 4 ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds <{ [[STRUCT_A]] }>, <{ [[STRUCT_A]] }>* [[ARGMEM]], i32 0, i32 0 -; CHECK-NEXT: [[CALL:%.*]] = call x86_thiscallcc %struct.a* @copy_ctor(%struct.a* noundef nonnull align 4 dereferenceable(1) [[TMP1]], %struct.a* noundef nonnull align 4 dereferenceable(1) [[A]]) +; CHECK-NEXT: [[CALL:%.*]] = call x86_thiscallcc %struct.a* @copy_ctor(%struct.a* noundef nonnull align 4 dereferenceable(1) [[TMP1]], %struct.a* noundef nonnull dereferenceable(1) [[A]]) ; CHECK-NEXT: call void @ext(<{ [[STRUCT_A]] }>* noundef nonnull inalloca(<{ [[STRUCT_A]] }>) align 4 dereferenceable(1) [[ARGMEM]]) ; CHECK-NEXT: ret void ; diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/aggregate-promote.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/aggregate-promote.ll index 9ef8a2eddbcc..e49e90a0388e 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/aggregate-promote.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/aggregate-promote.ll @@ -11,11 +11,14 @@ ; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = constant [[T:%.*]] { i32 0, i32 0, i32 17, i32 25 } ;. define internal i32 @test(%T* %p) { -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@test -; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] { -; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: ret i32 42 +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@test +; CHECK-SAME: () #[[ATTR0:[0-9]+]] { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[A:%.*]] = load i32, i32* getelementptr inbounds ([[T:%.*]], %T* @G, i64 0, i32 3), align 4 +; CHECK-NEXT: [[B:%.*]] = load i32, i32* getelementptr inbounds ([[T]], %T* @G, i64 0, i32 2), align 8 +; CHECK-NEXT: [[V:%.*]] = add i32 [[A]], [[B]] +; CHECK-NEXT: ret i32 [[V]] ; entry: %a.gep = getelementptr %T, %T* %p, i64 0, i32 3 @@ -29,15 +32,16 @@ entry: define i32 @caller() { ; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT____-LABEL: define {{[^@]+}}@caller -; IS__TUNIT____-SAME: () #[[ATTR0:[0-9]+]] { +; IS__TUNIT____-SAME: () #[[ATTR0]] { ; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: ret i32 42 +; IS__TUNIT____-NEXT: [[V:%.*]] = call i32 @test() #[[ATTR1:[0-9]+]] +; IS__TUNIT____-NEXT: ret i32 [[V]] ; ; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@caller ; IS__CGSCC____-SAME: () #[[ATTR1:[0-9]+]] { ; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: [[V:%.*]] = call noundef i32 @test() #[[ATTR2:[0-9]+]] +; IS__CGSCC____-NEXT: [[V:%.*]] = call i32 @test() #[[ATTR2:[0-9]+]] ; IS__CGSCC____-NEXT: ret i32 [[V]] ; entry: @@ -46,6 +50,7 @@ entry: } ;. ; IS__TUNIT____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } +; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } ;. ; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } ; IS__CGSCC____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/alignment.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/alignment.ll index 218ab83b01b6..023bdc7b3129 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/alignment.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/alignment.ll @@ -5,16 +5,18 @@ ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM define void @f() { -; IS__TUNIT____-LABEL: define {{[^@]+}}@f() { -; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: call void @g() -; IS__TUNIT____-NEXT: ret void +; IS________OPM-LABEL: define {{[^@]+}}@f() { +; IS________OPM-NEXT: entry: +; IS________OPM-NEXT: [[A:%.*]] = alloca i32, align 1 +; IS________OPM-NEXT: call void @g(i32* noalias nocapture nofree noundef nonnull readonly dereferenceable(4) [[A]]) +; IS________OPM-NEXT: ret void ; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f() { -; IS__CGSCC_OPM-NEXT: entry: -; IS__CGSCC_OPM-NEXT: [[A:%.*]] = alloca i32, align 1 -; IS__CGSCC_OPM-NEXT: call void @g(i32* noalias nocapture nofree noundef nonnull readonly dereferenceable(4) [[A]]) -; IS__CGSCC_OPM-NEXT: ret void +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@f() { +; IS__TUNIT_NPM-NEXT: entry: +; IS__TUNIT_NPM-NEXT: [[A:%.*]] = alloca i32, align 1 +; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[A]], align 1 +; IS__TUNIT_NPM-NEXT: call void @g(i32 [[TMP0]]) +; IS__TUNIT_NPM-NEXT: ret void ; ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f() { ; IS__CGSCC_NPM-NEXT: entry: @@ -28,23 +30,19 @@ entry: } define internal void @g(i32* %a) { -; IS__TUNIT____-LABEL: define {{[^@]+}}@g() { -; IS__TUNIT____-NEXT: call void @z(i32 undef) -; IS__TUNIT____-NEXT: ret void +; IS________OPM-LABEL: define {{[^@]+}}@g +; IS________OPM-SAME: (i32* noalias nocapture nofree noundef nonnull readonly dereferenceable(4) [[A:%.*]]) { +; IS________OPM-NEXT: [[AA:%.*]] = load i32, i32* [[A]], align 1 +; IS________OPM-NEXT: call void @z(i32 [[AA]]) +; IS________OPM-NEXT: ret void ; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@g -; IS__CGSCC_OPM-SAME: (i32* noalias nocapture nofree noundef nonnull readonly dereferenceable(4) [[A:%.*]]) { -; IS__CGSCC_OPM-NEXT: [[AA:%.*]] = load i32, i32* [[A]], align 1 -; IS__CGSCC_OPM-NEXT: call void @z(i32 [[AA]]) -; IS__CGSCC_OPM-NEXT: ret void -; -; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@g -; IS__CGSCC_NPM-SAME: (i32 [[TMP0:%.*]]) { -; IS__CGSCC_NPM-NEXT: [[A_PRIV:%.*]] = alloca i32, align 4 -; IS__CGSCC_NPM-NEXT: store i32 [[TMP0]], i32* [[A_PRIV]], align 4 -; IS__CGSCC_NPM-NEXT: [[AA:%.*]] = load i32, i32* [[A_PRIV]], align 1 -; IS__CGSCC_NPM-NEXT: call void @z(i32 [[AA]]) -; IS__CGSCC_NPM-NEXT: ret void +; IS________NPM-LABEL: define {{[^@]+}}@g +; IS________NPM-SAME: (i32 [[TMP0:%.*]]) { +; IS________NPM-NEXT: [[A_PRIV:%.*]] = alloca i32, align 4 +; IS________NPM-NEXT: store i32 [[TMP0]], i32* [[A_PRIV]], align 4 +; IS________NPM-NEXT: [[AA:%.*]] = load i32, i32* [[A_PRIV]], align 1 +; IS________NPM-NEXT: call void @z(i32 [[AA]]) +; IS________NPM-NEXT: ret void ; %aa = load i32, i32* %a, align 1 call void @z(i32 %aa) @@ -112,7 +110,7 @@ define internal i32 @caller(i32* %A) { ; IS__CGSCC_NPM-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1:[0-9]+]] { ; IS__CGSCC_NPM-NEXT: [[A_PRIV:%.*]] = alloca i32, align 4 ; IS__CGSCC_NPM-NEXT: store i32 [[TMP0]], i32* [[A_PRIV]], align 4 -; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call i32 @test(i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A_PRIV]], i64 noundef 1) #[[ATTR3:[0-9]+]] +; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call i32 @test(i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A_PRIV]], i64 1) #[[ATTR3:[0-9]+]] ; IS__CGSCC_NPM-NEXT: ret i32 [[C]] ; %B = alloca i64 @@ -139,7 +137,7 @@ define i32 @callercaller() { ; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@callercaller ; IS__CGSCC_NPM-SAME: () #[[ATTR2:[0-9]+]] { -; IS__CGSCC_NPM-NEXT: [[X:%.*]] = call i32 @caller(i32 noundef 2) #[[ATTR4:[0-9]+]] +; IS__CGSCC_NPM-NEXT: [[X:%.*]] = call i32 @caller(i32 2) #[[ATTR4:[0-9]+]] ; IS__CGSCC_NPM-NEXT: ret i32 [[X]] ; %B = alloca i32 diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/alloca-as.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/alloca-as.ll index 4e90fc4c2c9e..b056ddfc7513 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/alloca-as.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/alloca-as.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/array.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/array.ll index 8a6238dd193d..9e941eebc732 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/array.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/array.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM ; diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/attrs.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/attrs.ll index 49dbc04cf813..31295fc3f73f 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/attrs.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/attrs.ll @@ -14,9 +14,9 @@ define internal i32 @f(%struct.ss* byval(%struct.ss) %b, i32* byval(i32) %X, i32 ; IS________OPM-SAME: (%struct.ss* noalias nocapture nofree noundef nonnull byval([[STRUCT_SS:%.*]]) align 8 dereferenceable(12) [[B:%.*]], i32* noalias nocapture nofree noundef nonnull byval(i32) align 4 dereferenceable(4) [[X:%.*]]) #[[ATTR0:[0-9]+]] { ; IS________OPM-NEXT: entry: ; IS________OPM-NEXT: [[TMP:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[B]], i32 0, i32 0 -; IS________OPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP]], align 8 +; IS________OPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP]], align 4 ; IS________OPM-NEXT: [[TMP2:%.*]] = add i32 [[TMP1]], 1 -; IS________OPM-NEXT: store i32 [[TMP2]], i32* [[TMP]], align 8 +; IS________OPM-NEXT: store i32 [[TMP2]], i32* [[TMP]], align 4 ; IS________OPM-NEXT: store i32 0, i32* [[X]], align 4 ; IS________OPM-NEXT: [[L:%.*]] = load i32, i32* [[X]], align 4 ; IS________OPM-NEXT: [[A:%.*]] = add i32 [[L]], [[TMP2]] @@ -34,9 +34,9 @@ define internal i32 @f(%struct.ss* byval(%struct.ss) %b, i32* byval(i32) %X, i32 ; IS________NPM-NEXT: [[B_PRIV_0_1:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[B_PRIV]], i64 0, i32 1 ; IS________NPM-NEXT: store i64 [[TMP1]], i64* [[B_PRIV_0_1]], align 4 ; IS________NPM-NEXT: [[TMP:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[B_PRIV]], i32 0, i32 0 -; IS________NPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP]], align 8 +; IS________NPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP]], align 4 ; IS________NPM-NEXT: [[TMP2:%.*]] = add i32 [[TMP1]], 1 -; IS________NPM-NEXT: store i32 [[TMP2]], i32* [[TMP]], align 8 +; IS________NPM-NEXT: store i32 [[TMP2]], i32* [[TMP]], align 4 ; IS________NPM-NEXT: store i32 0, i32* [[X_PRIV]], align 4 ; IS________NPM-NEXT: [[L:%.*]] = load i32, i32* [[X_PRIV]], align 4 ; IS________NPM-NEXT: [[A:%.*]] = add i32 [[L]], [[TMP2]] @@ -105,7 +105,7 @@ define i32 @test(i32* %X) { ; IS__CGSCC_NPM-NEXT: [[TMP1:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[S]], i32 0, i32 0 ; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[S]], i32 0, i32 1 ; IS__CGSCC_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[X]], align 4 -; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call i32 @f(i32 noundef 1, i64 noundef 2, i32 [[TMP0]]) #[[ATTR2:[0-9]+]] +; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call i32 @f(i32 1, i64 2, i32 [[TMP0]]) #[[ATTR2:[0-9]+]] ; IS__CGSCC_NPM-NEXT: ret i32 [[C]] ; entry: diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll index ba1e3668403b..28f621500ed5 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll @@ -44,7 +44,7 @@ define internal i32 @caller(i32* %B) { ; IS__CGSCC_NPM-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1:[0-9]+]] { ; IS__CGSCC_NPM-NEXT: [[B_PRIV:%.*]] = alloca i32, align 4 ; IS__CGSCC_NPM-NEXT: store i32 [[TMP0]], i32* [[B_PRIV]], align 4 -; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call i32 @test(i32 noundef 1, i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B_PRIV]]) #[[ATTR3:[0-9]+]] +; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call i32 @test(i32 1, i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B_PRIV]]) #[[ATTR3:[0-9]+]] ; IS__CGSCC_NPM-NEXT: ret i32 [[C]] ; %A = alloca i32 @@ -71,7 +71,7 @@ define i32 @callercaller() { ; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@callercaller ; IS__CGSCC_NPM-SAME: () #[[ATTR2:[0-9]+]] { -; IS__CGSCC_NPM-NEXT: [[X:%.*]] = call i32 @caller(i32 noundef 2) #[[ATTR4:[0-9]+]] +; IS__CGSCC_NPM-NEXT: [[X:%.*]] = call i32 @caller(i32 2) #[[ATTR4:[0-9]+]] ; IS__CGSCC_NPM-NEXT: ret i32 [[X]] ; %B = alloca i32 diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/byval-2.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/byval-2.ll index 463b3656d567..9ae184452d77 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/byval-2.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/byval-2.ll @@ -12,9 +12,9 @@ define internal void @f(%struct.ss* byval(%struct.ss) %b, i32* byval(i32) %X) n ; IS________OPM-SAME: (%struct.ss* noalias nocapture nofree noundef nonnull byval([[STRUCT_SS:%.*]]) align 8 dereferenceable(12) [[B:%.*]], i32* noalias nocapture nofree noundef nonnull writeonly byval(i32) align 4 dereferenceable(4) [[X:%.*]]) #[[ATTR0:[0-9]+]] { ; IS________OPM-NEXT: entry: ; IS________OPM-NEXT: [[TMP:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[B]], i32 0, i32 0 -; IS________OPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP]], align 8 +; IS________OPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP]], align 4 ; IS________OPM-NEXT: [[TMP2:%.*]] = add i32 [[TMP1]], 1 -; IS________OPM-NEXT: store i32 [[TMP2]], i32* [[TMP]], align 8 +; IS________OPM-NEXT: store i32 [[TMP2]], i32* [[TMP]], align 4 ; IS________OPM-NEXT: store i32 0, i32* [[X]], align 4 ; IS________OPM-NEXT: ret void ; @@ -30,9 +30,9 @@ define internal void @f(%struct.ss* byval(%struct.ss) %b, i32* byval(i32) %X) n ; IS________NPM-NEXT: [[B_PRIV_0_1:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[B_PRIV]], i64 0, i32 1 ; IS________NPM-NEXT: store i64 [[TMP1]], i64* [[B_PRIV_0_1]], align 4 ; IS________NPM-NEXT: [[TMP:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[B_PRIV]], i32 0, i32 0 -; IS________NPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP]], align 8 +; IS________NPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP]], align 4 ; IS________NPM-NEXT: [[TMP2:%.*]] = add i32 [[TMP1]], 1 -; IS________NPM-NEXT: store i32 [[TMP2]], i32* [[TMP]], align 8 +; IS________NPM-NEXT: store i32 [[TMP2]], i32* [[TMP]], align 4 ; IS________NPM-NEXT: store i32 0, i32* [[X_PRIV]], align 4 ; IS________NPM-NEXT: ret void ; @@ -95,7 +95,7 @@ define i32 @test(i32* %X) { ; IS__CGSCC_NPM-NEXT: [[TMP1:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[S]], i32 0, i32 0 ; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[S]], i32 0, i32 1 ; IS__CGSCC_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[X]], align 4 -; IS__CGSCC_NPM-NEXT: call void @f(i32 noundef 1, i64 noundef 2, i32 [[TMP0]]) #[[ATTR2:[0-9]+]] +; IS__CGSCC_NPM-NEXT: call void @f(i32 1, i64 2, i32 [[TMP0]]) #[[ATTR2:[0-9]+]] ; IS__CGSCC_NPM-NEXT: ret i32 0 ; entry: diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/byval.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/byval.ll index ecec7776754f..f49d30b8ee52 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/byval.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/byval.ll @@ -14,9 +14,9 @@ define internal i32 @f(%struct.ss* byval(%struct.ss) %b) nounwind { ; IS________OPM-SAME: (%struct.ss* noalias nocapture nofree noundef nonnull byval([[STRUCT_SS:%.*]]) align 8 dereferenceable(12) [[B:%.*]]) #[[ATTR0:[0-9]+]] { ; IS________OPM-NEXT: entry: ; IS________OPM-NEXT: [[TMP:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[B]], i32 0, i32 0 -; IS________OPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP]], align 8 +; IS________OPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP]], align 4 ; IS________OPM-NEXT: [[TMP2:%.*]] = add i32 [[TMP1]], 1 -; IS________OPM-NEXT: store i32 [[TMP2]], i32* [[TMP]], align 8 +; IS________OPM-NEXT: store i32 [[TMP2]], i32* [[TMP]], align 4 ; IS________OPM-NEXT: ret i32 [[TMP1]] ; ; IS________NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn @@ -29,9 +29,9 @@ define internal i32 @f(%struct.ss* byval(%struct.ss) %b) nounwind { ; IS________NPM-NEXT: [[B_PRIV_0_1:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[B_PRIV]], i64 0, i32 1 ; IS________NPM-NEXT: store i64 [[TMP1]], i64* [[B_PRIV_0_1]], align 4 ; IS________NPM-NEXT: [[TMP:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[B_PRIV]], i32 0, i32 0 -; IS________NPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP]], align 8 +; IS________NPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP]], align 4 ; IS________NPM-NEXT: [[TMP2:%.*]] = add i32 [[TMP1]], 1 -; IS________NPM-NEXT: store i32 [[TMP2]], i32* [[TMP]], align 8 +; IS________NPM-NEXT: store i32 [[TMP2]], i32* [[TMP]], align 4 ; IS________NPM-NEXT: ret i32 [[TMP1]] ; entry: @@ -100,15 +100,15 @@ define i32 @main() nounwind { ; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[S]], i32 0, i32 0 ; IS__TUNIT_NPM-NEXT: store i32 1, i32* [[TMP1]], align 8 ; IS__TUNIT_NPM-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[S]], i32 0, i32 1 -; IS__TUNIT_NPM-NEXT: [[S_CAST:%.*]] = bitcast %struct.ss* [[S]] to i32* -; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[S_CAST]], align 8 -; IS__TUNIT_NPM-NEXT: [[S_0_1:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[S]], i64 0, i32 1 -; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = load i64, i64* [[S_0_1]], align 8 -; IS__TUNIT_NPM-NEXT: [[C0:%.*]] = call i32 @f(i32 [[TMP0]], i64 [[TMP1]]) #[[ATTR2:[0-9]+]] ; IS__TUNIT_NPM-NEXT: [[S_CAST1:%.*]] = bitcast %struct.ss* [[S]] to i32* -; IS__TUNIT_NPM-NEXT: [[TMP2:%.*]] = load i32, i32* [[S_CAST1]], align 32 +; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[S_CAST1]], align 8 ; IS__TUNIT_NPM-NEXT: [[S_0_12:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[S]], i64 0, i32 1 -; IS__TUNIT_NPM-NEXT: [[TMP3:%.*]] = load i64, i64* [[S_0_12]], align 32 +; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = load i64, i64* [[S_0_12]], align 8 +; IS__TUNIT_NPM-NEXT: [[C0:%.*]] = call i32 @f(i32 [[TMP0]], i64 [[TMP1]]) #[[ATTR2:[0-9]+]] +; IS__TUNIT_NPM-NEXT: [[S_CAST:%.*]] = bitcast %struct.ss* [[S]] to i32* +; IS__TUNIT_NPM-NEXT: [[TMP2:%.*]] = load i32, i32* [[S_CAST]], align 32 +; IS__TUNIT_NPM-NEXT: [[S_0_1:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[S]], i64 0, i32 1 +; IS__TUNIT_NPM-NEXT: [[TMP3:%.*]] = load i64, i64* [[S_0_1]], align 32 ; IS__TUNIT_NPM-NEXT: [[C1:%.*]] = call i32 @g(i32 [[TMP2]], i64 [[TMP3]]) #[[ATTR2]] ; IS__TUNIT_NPM-NEXT: [[A:%.*]] = add i32 [[C0]], [[C1]] ; IS__TUNIT_NPM-NEXT: ret i32 [[A]] @@ -119,7 +119,7 @@ define i32 @main() nounwind { ; IS__CGSCC_OPM-NEXT: entry: ; IS__CGSCC_OPM-NEXT: [[S:%.*]] = alloca [[STRUCT_SS:%.*]], align 4 ; IS__CGSCC_OPM-NEXT: [[TMP1:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[S]], i32 0, i32 0 -; IS__CGSCC_OPM-NEXT: store i32 1, i32* [[TMP1]], align 32 +; IS__CGSCC_OPM-NEXT: store i32 1, i32* [[TMP1]], align 8 ; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[S]], i32 0, i32 1 ; IS__CGSCC_OPM-NEXT: store i64 2, i64* [[TMP4]], align 4 ; IS__CGSCC_OPM-NEXT: [[C0:%.*]] = call i32 @f(%struct.ss* noalias nocapture nofree noundef nonnull readonly byval([[STRUCT_SS]]) align 32 dereferenceable(12) [[S]]) #[[ATTR2:[0-9]+]] @@ -134,8 +134,8 @@ define i32 @main() nounwind { ; IS__CGSCC_NPM-NEXT: [[S:%.*]] = alloca [[STRUCT_SS:%.*]], align 4 ; IS__CGSCC_NPM-NEXT: [[TMP1:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[S]], i32 0, i32 0 ; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_SS]], %struct.ss* [[S]], i32 0, i32 1 -; IS__CGSCC_NPM-NEXT: [[C0:%.*]] = call i32 @f(i32 noundef 1, i64 noundef 2) #[[ATTR2:[0-9]+]] -; IS__CGSCC_NPM-NEXT: [[C1:%.*]] = call i32 @g(i32 noundef 1, i64 noundef 2) #[[ATTR2]] +; IS__CGSCC_NPM-NEXT: [[C0:%.*]] = call i32 @f(i32 1, i64 2) #[[ATTR2:[0-9]+]] +; IS__CGSCC_NPM-NEXT: [[C1:%.*]] = call i32 @g(i32 1, i64 2) #[[ATTR2]] ; IS__CGSCC_NPM-NEXT: [[A:%.*]] = add i32 [[C0]], [[C1]] ; IS__CGSCC_NPM-NEXT: ret i32 [[A]] ; diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/chained.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/chained.ll index 658340bdaf74..8572f33a4254 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/chained.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/chained.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM @@ -13,11 +13,12 @@ ;. define internal i32 @test(i32** %x) { ; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@test -; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] { -; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: ret i32 0 +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@test +; CHECK-SAME: () #[[ATTR0:[0-9]+]] { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[Z:%.*]] = load i32, i32* @G1, align 4 +; CHECK-NEXT: ret i32 [[Z]] ; entry: %y = load i32*, i32** %x @@ -28,15 +29,16 @@ entry: define i32 @caller() { ; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT____-LABEL: define {{[^@]+}}@caller -; IS__TUNIT____-SAME: () #[[ATTR0:[0-9]+]] { +; IS__TUNIT____-SAME: () #[[ATTR0]] { ; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: ret i32 0 +; IS__TUNIT____-NEXT: [[X:%.*]] = call i32 @test() #[[ATTR1:[0-9]+]] +; IS__TUNIT____-NEXT: ret i32 [[X]] ; ; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@caller ; IS__CGSCC____-SAME: () #[[ATTR1:[0-9]+]] { ; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: [[X:%.*]] = call noundef i32 @test() #[[ATTR2:[0-9]+]] +; IS__CGSCC____-NEXT: [[X:%.*]] = call i32 @test() #[[ATTR2:[0-9]+]] ; IS__CGSCC____-NEXT: ret i32 [[X]] ; entry: @@ -46,6 +48,7 @@ entry: ;. ; IS__TUNIT____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } +; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } ;. ; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } ; IS__CGSCC____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/control-flow2.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/control-flow2.ll index 112f70c824d4..0dac5c3195a3 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/control-flow2.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/control-flow2.ll @@ -57,7 +57,7 @@ define i32 @foo() { ; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@foo ; IS__CGSCC_NPM-SAME: () #[[ATTR1:[0-9]+]] { -; IS__CGSCC_NPM-NEXT: [[X:%.*]] = call i32 @callee(i32 noundef 17) #[[ATTR2:[0-9]+]] +; IS__CGSCC_NPM-NEXT: [[X:%.*]] = call i32 @callee(i32 17) #[[ATTR2:[0-9]+]] ; IS__CGSCC_NPM-NEXT: ret i32 [[X]] ; %A = alloca i32 ; [#uses=2] diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/crash.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/crash.ll index 2e22611fcea6..824bfd9e61a4 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/crash.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/crash.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/musttail.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/musttail.ll index 2be05748ad10..fb878b82cd7c 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/musttail.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/musttail.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM ; PR36543 @@ -131,7 +131,7 @@ define internal i32 @test2b(%T* %p, i32 %p2) { ; IS__TUNIT____-NEXT: [[A:%.*]] = load i32, i32* [[A_GEP]], align 4 ; IS__TUNIT____-NEXT: [[B:%.*]] = load i32, i32* [[B_GEP]], align 4 ; IS__TUNIT____-NEXT: [[V:%.*]] = add i32 [[A]], [[B]] -; IS__TUNIT____-NEXT: [[CA:%.*]] = musttail call i32 @bar(%T* undef, i32 [[V]]) #[[ATTR5:[0-9]+]] +; IS__TUNIT____-NEXT: [[CA:%.*]] = musttail call noundef i32 @bar(%T* undef, i32 [[V]]) #[[ATTR5:[0-9]+]] ; IS__TUNIT____-NEXT: ret i32 [[CA]] ; ; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn @@ -158,8 +158,8 @@ define i32 @caller2b(%T* %g) { ; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn ; IS__TUNIT____-LABEL: define {{[^@]+}}@caller2b ; IS__TUNIT____-SAME: (%T* nocapture nofree readonly [[G:%.*]]) #[[ATTR3]] { -; IS__TUNIT____-NEXT: [[V:%.*]] = call i32 @test2b(%T* nocapture nofree readonly [[G]], i32 undef) #[[ATTR6:[0-9]+]] -; IS__TUNIT____-NEXT: ret i32 0 +; IS__TUNIT____-NEXT: [[V:%.*]] = call noundef i32 @test2b(%T* nocapture nofree readonly [[G]], i32 undef) #[[ATTR6:[0-9]+]] +; IS__TUNIT____-NEXT: ret i32 [[V]] ; ; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@caller2b diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/profile.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/profile.ll index 583cd5d1f789..20f7d0dd6537 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/profile.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/profile.ll @@ -8,19 +8,21 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1 ; Checks if !prof metadata is corret in deadargelim. define void @caller() #0 { -; IS__TUNIT____-LABEL: define {{[^@]+}}@caller() { -; IS__TUNIT____-NEXT: [[X:%.*]] = alloca i32, align 4 -; IS__TUNIT____-NEXT: call void @promote_i32_ptr(), !prof [[PROF0:![0-9]+]] -; IS__TUNIT____-NEXT: ret void +; IS________OPM-LABEL: define {{[^@]+}}@caller() { +; IS________OPM-NEXT: [[X:%.*]] = alloca i32, align 4 +; IS________OPM-NEXT: store i32 42, i32* [[X]], align 4 +; IS________OPM-NEXT: call void @promote_i32_ptr(i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[X]]), !prof [[PROF0:![0-9]+]] +; IS________OPM-NEXT: ret void ; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@caller() { -; IS__CGSCC_OPM-NEXT: [[X:%.*]] = alloca i32, align 4 -; IS__CGSCC_OPM-NEXT: store i32 42, i32* [[X]], align 4 -; IS__CGSCC_OPM-NEXT: call void @promote_i32_ptr(i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[X]]), !prof [[PROF0:![0-9]+]] -; IS__CGSCC_OPM-NEXT: ret void +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@caller() { +; IS__TUNIT_NPM-NEXT: [[X:%.*]] = alloca i32, align 4 +; IS__TUNIT_NPM-NEXT: store i32 42, i32* [[X]], align 4 +; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[X]], align 4 +; IS__TUNIT_NPM-NEXT: call void @promote_i32_ptr(i32 [[TMP1]]), !prof [[PROF0:![0-9]+]] +; IS__TUNIT_NPM-NEXT: ret void ; ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@caller() { -; IS__CGSCC_NPM-NEXT: call void @promote_i32_ptr(i32 noundef 42), !prof [[PROF0:![0-9]+]] +; IS__CGSCC_NPM-NEXT: call void @promote_i32_ptr(i32 42), !prof [[PROF0:![0-9]+]] ; IS__CGSCC_NPM-NEXT: ret void ; %x = alloca i32 @@ -30,23 +32,19 @@ define void @caller() #0 { } define internal void @promote_i32_ptr(i32* %xp) { -; IS__TUNIT____-LABEL: define {{[^@]+}}@promote_i32_ptr() { -; IS__TUNIT____-NEXT: call void @use_i32(i32 noundef 42) -; IS__TUNIT____-NEXT: ret void +; IS________OPM-LABEL: define {{[^@]+}}@promote_i32_ptr +; IS________OPM-SAME: (i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[XP:%.*]]) { +; IS________OPM-NEXT: [[X:%.*]] = load i32, i32* [[XP]], align 4 +; IS________OPM-NEXT: call void @use_i32(i32 [[X]]) +; IS________OPM-NEXT: ret void ; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@promote_i32_ptr -; IS__CGSCC_OPM-SAME: (i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[XP:%.*]]) { -; IS__CGSCC_OPM-NEXT: [[X:%.*]] = load i32, i32* [[XP]], align 4 -; IS__CGSCC_OPM-NEXT: call void @use_i32(i32 [[X]]) -; IS__CGSCC_OPM-NEXT: ret void -; -; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@promote_i32_ptr -; IS__CGSCC_NPM-SAME: (i32 [[TMP0:%.*]]) { -; IS__CGSCC_NPM-NEXT: [[XP_PRIV:%.*]] = alloca i32, align 4 -; IS__CGSCC_NPM-NEXT: store i32 [[TMP0]], i32* [[XP_PRIV]], align 4 -; IS__CGSCC_NPM-NEXT: [[X:%.*]] = load i32, i32* [[XP_PRIV]], align 4 -; IS__CGSCC_NPM-NEXT: call void @use_i32(i32 [[X]]) -; IS__CGSCC_NPM-NEXT: ret void +; IS________NPM-LABEL: define {{[^@]+}}@promote_i32_ptr +; IS________NPM-SAME: (i32 [[TMP0:%.*]]) { +; IS________NPM-NEXT: [[XP_PRIV:%.*]] = alloca i32, align 4 +; IS________NPM-NEXT: store i32 [[TMP0]], i32* [[XP_PRIV]], align 4 +; IS________NPM-NEXT: [[X:%.*]] = load i32, i32* [[XP_PRIV]], align 4 +; IS________NPM-NEXT: call void @use_i32(i32 [[X]]) +; IS________NPM-NEXT: ret void ; %x = load i32, i32* %xp call void @use_i32(i32 %x) diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/sret.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/sret.ll index 2b422b513802..ec5f96ed64d5 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/sret.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/sret.ll @@ -12,6 +12,7 @@ define internal void @add({i32, i32}* %this, i32* sret(i32) %r) { ; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly ; IS__TUNIT____-LABEL: define {{[^@]+}}@add ; IS__TUNIT____-SAME: ({ i32, i32 }* noalias nocapture nofree nonnull readnone align 8 dereferenceable(8) [[THIS:%.*]], i32* noalias nocapture nofree noundef nonnull writeonly sret(i32) align 4 dereferenceable(4) [[R:%.*]]) #[[ATTR0:[0-9]+]] { +; IS__TUNIT____-NEXT: store i32 undef, i32* [[R]], align 4 ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn @@ -19,7 +20,7 @@ define internal void @add({i32, i32}* %this, i32* sret(i32) %r) { ; IS__CGSCC_OPM-SAME: ({ i32, i32 }* nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[THIS:%.*]], i32* nocapture nofree noundef nonnull writeonly sret(i32) align 4 dereferenceable(4) [[R:%.*]]) #[[ATTR0:[0-9]+]] { ; IS__CGSCC_OPM-NEXT: [[AP:%.*]] = getelementptr { i32, i32 }, { i32, i32 }* [[THIS]], i32 0, i32 0 ; IS__CGSCC_OPM-NEXT: [[BP:%.*]] = getelementptr { i32, i32 }, { i32, i32 }* [[THIS]], i32 0, i32 1 -; IS__CGSCC_OPM-NEXT: [[A:%.*]] = load i32, i32* [[AP]], align 8 +; IS__CGSCC_OPM-NEXT: [[A:%.*]] = load i32, i32* [[AP]], align 4 ; IS__CGSCC_OPM-NEXT: [[B:%.*]] = load i32, i32* [[BP]], align 4 ; IS__CGSCC_OPM-NEXT: [[AB:%.*]] = add i32 [[A]], [[B]] ; IS__CGSCC_OPM-NEXT: store i32 [[AB]], i32* [[R]], align 4 @@ -30,7 +31,7 @@ define internal void @add({i32, i32}* %this, i32* sret(i32) %r) { ; IS__CGSCC_NPM-SAME: ({ i32, i32 }* noalias nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[THIS:%.*]], i32* noalias nocapture nofree noundef nonnull writeonly sret(i32) align 4 dereferenceable(4) [[R:%.*]]) #[[ATTR0:[0-9]+]] { ; IS__CGSCC_NPM-NEXT: [[AP:%.*]] = getelementptr { i32, i32 }, { i32, i32 }* [[THIS]], i32 0, i32 0 ; IS__CGSCC_NPM-NEXT: [[BP:%.*]] = getelementptr { i32, i32 }, { i32, i32 }* [[THIS]], i32 0, i32 1 -; IS__CGSCC_NPM-NEXT: [[A:%.*]] = load i32, i32* [[AP]], align 8 +; IS__CGSCC_NPM-NEXT: [[A:%.*]] = load i32, i32* [[AP]], align 4 ; IS__CGSCC_NPM-NEXT: [[B:%.*]] = load i32, i32* [[BP]], align 4 ; IS__CGSCC_NPM-NEXT: [[AB:%.*]] = add i32 [[A]], [[B]] ; IS__CGSCC_NPM-NEXT: store i32 [[AB]], i32* [[R]], align 4 diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll b/llvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll index c8b82ab60afe..f695ddb9777f 100644 --- a/llvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll +++ b/llvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll @@ -21,8 +21,8 @@ define internal void @vfu1(%struct.MYstr* byval(%struct.MYstr) align 4 %u) nounw ; IS________OPM-NEXT: [[TMP0:%.*]] = getelementptr [[STRUCT_MYSTR]], %struct.MYstr* [[U]], i32 0, i32 1 ; IS________OPM-NEXT: store i32 99, i32* [[TMP0]], align 4 ; IS________OPM-NEXT: [[TMP1:%.*]] = getelementptr [[STRUCT_MYSTR]], %struct.MYstr* [[U]], i32 0, i32 0 -; IS________OPM-NEXT: store i8 97, i8* [[TMP1]], align 8 -; IS________OPM-NEXT: [[L:%.*]] = load i8, i8* [[TMP1]], align 8 +; IS________OPM-NEXT: store i8 97, i8* [[TMP1]], align 4 +; IS________OPM-NEXT: [[L:%.*]] = load i8, i8* [[TMP1]], align 4 ; IS________OPM-NEXT: call void @use(i8 [[L]]) ; IS________OPM-NEXT: br label [[RETURN:%.*]] ; IS________OPM: return: @@ -40,8 +40,8 @@ define internal void @vfu1(%struct.MYstr* byval(%struct.MYstr) align 4 %u) nounw ; IS________NPM-NEXT: [[TMP2:%.*]] = getelementptr [[STRUCT_MYSTR]], %struct.MYstr* [[U_PRIV]], i32 0, i32 1 ; IS________NPM-NEXT: store i32 99, i32* [[TMP2]], align 4 ; IS________NPM-NEXT: [[TMP3:%.*]] = getelementptr [[STRUCT_MYSTR]], %struct.MYstr* [[U_PRIV]], i32 0, i32 0 -; IS________NPM-NEXT: store i8 97, i8* [[TMP3]], align 8 -; IS________NPM-NEXT: [[L:%.*]] = load i8, i8* [[TMP3]], align 8 +; IS________NPM-NEXT: store i8 97, i8* [[TMP3]], align 4 +; IS________NPM-NEXT: [[L:%.*]] = load i8, i8* [[TMP3]], align 4 ; IS________NPM-NEXT: call void @use(i8 [[L]]) ; IS________NPM-NEXT: br label [[RETURN:%.*]] ; IS________NPM: return: @@ -68,7 +68,7 @@ define internal i32 @vfu2(%struct.MYstr* byval(%struct.MYstr) align 4 %u) nounwi ; IS________OPM-NEXT: [[TMP0:%.*]] = getelementptr [[STRUCT_MYSTR]], %struct.MYstr* [[U]], i32 0, i32 1 ; IS________OPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP0]], align 4 ; IS________OPM-NEXT: [[TMP2:%.*]] = getelementptr [[STRUCT_MYSTR]], %struct.MYstr* [[U]], i32 0, i32 0 -; IS________OPM-NEXT: [[TMP3:%.*]] = load i8, i8* [[TMP2]], align 8 +; IS________OPM-NEXT: [[TMP3:%.*]] = load i8, i8* [[TMP2]], align 4 ; IS________OPM-NEXT: [[TMP4:%.*]] = zext i8 [[TMP3]] to i32 ; IS________OPM-NEXT: [[TMP5:%.*]] = add i32 [[TMP4]], [[TMP1]] ; IS________OPM-NEXT: ret i32 [[TMP5]] @@ -85,7 +85,7 @@ define internal i32 @vfu2(%struct.MYstr* byval(%struct.MYstr) align 4 %u) nounwi ; IS________NPM-NEXT: [[TMP2:%.*]] = getelementptr [[STRUCT_MYSTR]], %struct.MYstr* [[U_PRIV]], i32 0, i32 1 ; IS________NPM-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 ; IS________NPM-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_MYSTR]], %struct.MYstr* [[U_PRIV]], i32 0, i32 0 -; IS________NPM-NEXT: [[TMP5:%.*]] = load i8, i8* [[TMP4]], align 8 +; IS________NPM-NEXT: [[TMP5:%.*]] = load i8, i8* [[TMP4]], align 4 ; IS________NPM-NEXT: [[TMP6:%.*]] = zext i8 [[TMP5]] to i32 ; IS________NPM-NEXT: [[TMP7:%.*]] = add i32 [[TMP6]], [[TMP3]] ; IS________NPM-NEXT: ret i32 [[TMP7]] @@ -163,7 +163,7 @@ define internal i32 @vfu2_v2(%struct.MYstr* byval(%struct.MYstr) align 4 %u) nou ; IS________OPM-NEXT: [[TMP0:%.*]] = getelementptr [[STRUCT_MYSTR]], %struct.MYstr* [[U]], i32 0, i32 1 ; IS________OPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP0]], align 4 ; IS________OPM-NEXT: [[TMP2:%.*]] = getelementptr [[STRUCT_MYSTR]], %struct.MYstr* [[U]], i32 0, i32 0 -; IS________OPM-NEXT: [[TMP3:%.*]] = load i8, i8* [[TMP2]], align 8 +; IS________OPM-NEXT: [[TMP3:%.*]] = load i8, i8* [[TMP2]], align 4 ; IS________OPM-NEXT: [[TMP4:%.*]] = zext i8 [[TMP3]] to i32 ; IS________OPM-NEXT: [[TMP5:%.*]] = add i32 [[TMP4]], [[TMP1]] ; IS________OPM-NEXT: ret i32 [[TMP5]] @@ -182,7 +182,7 @@ define internal i32 @vfu2_v2(%struct.MYstr* byval(%struct.MYstr) align 4 %u) nou ; IS________NPM-NEXT: [[TMP2:%.*]] = getelementptr [[STRUCT_MYSTR]], %struct.MYstr* [[U_PRIV]], i32 0, i32 1 ; IS________NPM-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 ; IS________NPM-NEXT: [[TMP4:%.*]] = getelementptr [[STRUCT_MYSTR]], %struct.MYstr* [[U_PRIV]], i32 0, i32 0 -; IS________NPM-NEXT: [[TMP5:%.*]] = load i8, i8* [[TMP4]], align 8 +; IS________NPM-NEXT: [[TMP5:%.*]] = load i8, i8* [[TMP4]], align 4 ; IS________NPM-NEXT: [[TMP6:%.*]] = zext i8 [[TMP5]] to i32 ; IS________NPM-NEXT: [[TMP7:%.*]] = add i32 [[TMP6]], [[TMP3]] ; IS________NPM-NEXT: ret i32 [[TMP7]] diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll b/llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll index f35a37a3c1a6..a5d9f5e74834 100644 --- a/llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll +++ b/llvm/test/Transforms/Attributor/IPConstantProp/PR16052.ll @@ -13,13 +13,16 @@ define i64 @fn2() { ; IS__TUNIT____-LABEL: define {{[^@]+}}@fn2 ; IS__TUNIT____-SAME: () #[[ATTR0:[0-9]+]] { ; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: ret i64 poison +; IS__TUNIT____-NEXT: ret i64 undef ; ; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@fn2 ; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] { ; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: ret i64 poison +; IS__CGSCC____-NEXT: [[CONV:%.*]] = sext i32 undef to i64 +; IS__CGSCC____-NEXT: [[DIV:%.*]] = sdiv i64 8, [[CONV]] +; IS__CGSCC____-NEXT: [[CALL2:%.*]] = call i64 @fn1(i64 [[DIV]]) #[[ATTR2:[0-9]+]] +; IS__CGSCC____-NEXT: ret i64 [[CALL2]] ; entry: %conv = sext i32 undef to i64 @@ -44,7 +47,8 @@ define i64 @fn2b(i32 %arg) { ; IS__CGSCC____-NEXT: entry: ; IS__CGSCC____-NEXT: [[CONV:%.*]] = sext i32 [[ARG]] to i64 ; IS__CGSCC____-NEXT: [[DIV:%.*]] = sdiv i64 8, [[CONV]] -; IS__CGSCC____-NEXT: ret i64 [[DIV]] +; IS__CGSCC____-NEXT: [[CALL2:%.*]] = call i64 @fn1(i64 [[DIV]]) #[[ATTR2]] +; IS__CGSCC____-NEXT: ret i64 [[CALL2]] ; entry: %conv = sext i32 %arg to i64 @@ -64,7 +68,10 @@ define i64 @fn2c() { ; IS__CGSCC____-LABEL: define {{[^@]+}}@fn2c ; IS__CGSCC____-SAME: () #[[ATTR0]] { ; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: ret i64 42 +; IS__CGSCC____-NEXT: [[CONV:%.*]] = sext i32 undef to i64 +; IS__CGSCC____-NEXT: [[ADD:%.*]] = add i64 42, [[CONV]] +; IS__CGSCC____-NEXT: [[CALL2:%.*]] = call i64 @fn1(i64 [[ADD]]) #[[ATTR2]] +; IS__CGSCC____-NEXT: ret i64 [[CALL2]] ; entry: %conv = sext i32 undef to i64 @@ -78,9 +85,7 @@ define internal i64 @fn1(i64 %p1) { ; IS__CGSCC____-LABEL: define {{[^@]+}}@fn1 ; IS__CGSCC____-SAME: (i64 returned [[P1:%.*]]) #[[ATTR1:[0-9]+]] { ; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: [[TOBOOL:%.*]] = icmp ne i64 [[P1]], 0 -; IS__CGSCC____-NEXT: [[COND:%.*]] = select i1 [[TOBOOL]], i64 [[P1]], i64 [[P1]] -; IS__CGSCC____-NEXT: ret i64 [[COND]] +; IS__CGSCC____-NEXT: ret i64 [[P1]] ; entry: %tobool = icmp ne i64 %p1, 0 @@ -92,4 +97,5 @@ entry: ;. ; IS__CGSCC____: attributes #[[ATTR0]] = { nofree nosync nounwind readnone willreturn } ; IS__CGSCC____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn } +; IS__CGSCC____: attributes #[[ATTR2]] = { readnone willreturn } ;. diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/PR26044.ll b/llvm/test/Transforms/Attributor/IPConstantProp/PR26044.ll index aa8fabb94a5e..9bdbe2b69d5c 100644 --- a/llvm/test/Transforms/Attributor/IPConstantProp/PR26044.ll +++ b/llvm/test/Transforms/Attributor/IPConstantProp/PR26044.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=11 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=11 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" @@ -33,7 +33,8 @@ define void @fn2(i32* %P, i1 %C) { ; IS__CGSCC____: if.end: ; IS__CGSCC____-NEXT: [[E_2:%.*]] = phi i32* [ [[P]], [[ENTRY:%.*]] ], [ null, [[FOR_COND1:%.*]] ] ; IS__CGSCC____-NEXT: [[TMP0:%.*]] = load i32, i32* [[E_2]], align 4 -; IS__CGSCC____-NEXT: store i32 [[TMP0]], i32* [[P]], align 4 +; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i32 @fn1(i32 [[TMP0]]) +; IS__CGSCC____-NEXT: store i32 [[CALL]], i32* [[P]], align 4 ; IS__CGSCC____-NEXT: br label [[FOR_COND1]] ; IS__CGSCC____: exit: ; IS__CGSCC____-NEXT: ret void @@ -59,9 +60,7 @@ define internal i32 @fn1(i32 %p1) { ; IS__CGSCC____-LABEL: define {{[^@]+}}@fn1 ; IS__CGSCC____-SAME: (i32 returned [[P1:%.*]]) #[[ATTR1:[0-9]+]] { ; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[P1]], 0 -; IS__CGSCC____-NEXT: [[COND:%.*]] = select i1 [[TOBOOL]], i32 [[P1]], i32 [[P1]] -; IS__CGSCC____-NEXT: ret i32 [[COND]] +; IS__CGSCC____-NEXT: ret i32 [[P1]] ; entry: %tobool = icmp ne i32 %p1, 0 @@ -96,7 +95,8 @@ define void @fn_no_null_opt(i32* %P, i1 %C) null_pointer_is_valid { ; IS__CGSCC____: if.end: ; IS__CGSCC____-NEXT: [[E_2:%.*]] = phi i32* [ undef, [[ENTRY:%.*]] ], [ null, [[FOR_COND1:%.*]] ] ; IS__CGSCC____-NEXT: [[TMP0:%.*]] = load i32, i32* null, align 4294967296 -; IS__CGSCC____-NEXT: store i32 [[TMP0]], i32* [[P]], align 4 +; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i32 @fn0(i32 [[TMP0]]) +; IS__CGSCC____-NEXT: store i32 [[CALL]], i32* [[P]], align 4 ; IS__CGSCC____-NEXT: br label [[FOR_COND1]] ; IS__CGSCC____: exit: ; IS__CGSCC____-NEXT: ret void @@ -122,9 +122,7 @@ define internal i32 @fn0(i32 %p1) { ; IS__CGSCC____-LABEL: define {{[^@]+}}@fn0 ; IS__CGSCC____-SAME: (i32 returned [[P1:%.*]]) #[[ATTR1]] { ; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[P1]], 0 -; IS__CGSCC____-NEXT: [[COND:%.*]] = select i1 [[TOBOOL]], i32 [[P1]], i32 [[P1]] -; IS__CGSCC____-NEXT: ret i32 [[COND]] +; IS__CGSCC____-NEXT: ret i32 [[P1]] ; entry: %tobool = icmp ne i32 %p1, 0 diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/multiple_callbacks.ll b/llvm/test/Transforms/Attributor/IPConstantProp/multiple_callbacks.ll index 4b33e60594af..8ab6c8638169 100644 --- a/llvm/test/Transforms/Attributor/IPConstantProp/multiple_callbacks.ll +++ b/llvm/test/Transforms/Attributor/IPConstantProp/multiple_callbacks.ll @@ -53,7 +53,7 @@ entry: define internal i32 @cb1(i32 %unknown) { ; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; CHECK-LABEL: define {{[^@]+}}@cb1 -; CHECK-SAME: (i32 noundef returned [[UNKNOWN:%.*]]) #[[ATTR0]] { +; CHECK-SAME: (i32 noundef [[UNKNOWN:%.*]]) #[[ATTR0]] { ; CHECK-NEXT: entry: ; CHECK-NEXT: ret i32 [[UNKNOWN]] ; @@ -64,13 +64,13 @@ entry: define internal i32 @cb2(i32 %unknown) { ; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT____-LABEL: define {{[^@]+}}@cb2 -; IS__TUNIT____-SAME: (i32 noundef returned [[UNKNOWN:%.*]]) #[[ATTR0]] { +; IS__TUNIT____-SAME: (i32 noundef [[UNKNOWN:%.*]]) #[[ATTR0]] { ; IS__TUNIT____-NEXT: entry: ; IS__TUNIT____-NEXT: ret i32 [[UNKNOWN]] ; ; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@cb2 -; IS__CGSCC____-SAME: (i32 noundef returned [[UNKNOWN:%.*]]) #[[ATTR1:[0-9]+]] { +; IS__CGSCC____-SAME: (i32 noundef [[UNKNOWN:%.*]]) #[[ATTR1:[0-9]+]] { ; IS__CGSCC____-NEXT: entry: ; IS__CGSCC____-NEXT: ret i32 [[UNKNOWN]] ; @@ -82,7 +82,7 @@ entry: define internal i32 @cb3(i32 %unknown) { ; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; CHECK-LABEL: define {{[^@]+}}@cb3 -; CHECK-SAME: (i32 noundef returned [[UNKNOWN:%.*]]) #[[ATTR0]] { +; CHECK-SAME: (i32 noundef [[UNKNOWN:%.*]]) #[[ATTR0]] { ; CHECK-NEXT: entry: ; CHECK-NEXT: ret i32 [[UNKNOWN]] ; @@ -93,7 +93,7 @@ entry: define internal i32 @cb4(i32 %unknown) { ; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; CHECK-LABEL: define {{[^@]+}}@cb4 -; CHECK-SAME: (i32 noundef returned [[UNKNOWN:%.*]]) #[[ATTR0]] { +; CHECK-SAME: (i32 noundef [[UNKNOWN:%.*]]) #[[ATTR0]] { ; CHECK-NEXT: entry: ; CHECK-NEXT: ret i32 [[UNKNOWN]] ; diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/musttail-call.ll b/llvm/test/Transforms/Attributor/IPConstantProp/musttail-call.ll index 4f899a386015..248ca4fbc54c 100644 --- a/llvm/test/Transforms/Attributor/IPConstantProp/musttail-call.ll +++ b/llvm/test/Transforms/Attributor/IPConstantProp/musttail-call.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM ; PR36485 @@ -10,71 +10,38 @@ declare i32 @external() define i8* @start(i8 %v) { ; -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@start -; IS__TUNIT_OPM-SAME: (i8 [[V:%.*]]) { -; IS__TUNIT_OPM-NEXT: [[C1:%.*]] = icmp eq i8 [[V]], 0 -; IS__TUNIT_OPM-NEXT: br i1 [[C1]], label [[TRUE:%.*]], label [[FALSE:%.*]] -; IS__TUNIT_OPM: true: -; IS__TUNIT_OPM-NEXT: [[CA:%.*]] = musttail call i8* @side_effects(i8 [[V]]) -; IS__TUNIT_OPM-NEXT: ret i8* [[CA]] -; IS__TUNIT_OPM: false: -; IS__TUNIT_OPM-NEXT: [[C2:%.*]] = icmp eq i8 [[V]], 1 -; IS__TUNIT_OPM-NEXT: br i1 [[C2]], label [[C2_TRUE:%.*]], label [[C2_FALSE:%.*]] -; IS__TUNIT_OPM: c2_true: -; IS__TUNIT_OPM-NEXT: ret i8* null -; IS__TUNIT_OPM: c2_false: -; IS__TUNIT_OPM-NEXT: [[CA2:%.*]] = musttail call i8* @dont_zap_me(i8 undef) -; IS__TUNIT_OPM-NEXT: ret i8* [[CA2]] -; -; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@start -; IS__TUNIT_NPM-SAME: (i8 [[V:%.*]]) { -; IS__TUNIT_NPM-NEXT: [[C1:%.*]] = icmp eq i8 [[V]], 0 -; IS__TUNIT_NPM-NEXT: br i1 [[C1]], label [[TRUE:%.*]], label [[FALSE:%.*]] -; IS__TUNIT_NPM: true: -; IS__TUNIT_NPM-NEXT: [[CA:%.*]] = musttail call i8* @side_effects(i8 undef) -; IS__TUNIT_NPM-NEXT: ret i8* [[CA]] -; IS__TUNIT_NPM: false: -; IS__TUNIT_NPM-NEXT: [[C2:%.*]] = icmp eq i8 [[V]], 1 -; IS__TUNIT_NPM-NEXT: br i1 [[C2]], label [[C2_TRUE:%.*]], label [[C2_FALSE:%.*]] -; IS__TUNIT_NPM: c2_true: -; IS__TUNIT_NPM-NEXT: ret i8* null -; IS__TUNIT_NPM: c2_false: -; IS__TUNIT_NPM-NEXT: [[CA2:%.*]] = musttail call i8* @dont_zap_me(i8 undef) -; IS__TUNIT_NPM-NEXT: ret i8* [[CA2]] -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@start -; IS__CGSCC_OPM-SAME: (i8 [[V:%.*]]) { -; IS__CGSCC_OPM-NEXT: [[C1:%.*]] = icmp eq i8 [[V]], 0 -; IS__CGSCC_OPM-NEXT: br i1 [[C1]], label [[TRUE:%.*]], label [[FALSE:%.*]] -; IS__CGSCC_OPM: true: -; IS__CGSCC_OPM-NEXT: [[CA:%.*]] = musttail call noalias noundef align 4294967296 i8* @side_effects(i8 [[V]]) -; IS__CGSCC_OPM-NEXT: ret i8* [[CA]] -; IS__CGSCC_OPM: false: -; IS__CGSCC_OPM-NEXT: [[C2:%.*]] = icmp eq i8 [[V]], 1 -; IS__CGSCC_OPM-NEXT: br i1 [[C2]], label [[C2_TRUE:%.*]], label [[C2_FALSE:%.*]] -; IS__CGSCC_OPM: c2_true: -; IS__CGSCC_OPM-NEXT: [[CA1:%.*]] = musttail call noalias noundef align 4294967296 i8* @no_side_effects(i8 [[V]]) -; IS__CGSCC_OPM-NEXT: ret i8* [[CA1]] -; IS__CGSCC_OPM: c2_false: -; IS__CGSCC_OPM-NEXT: [[CA2:%.*]] = musttail call noalias noundef align 4294967296 i8* @dont_zap_me(i8 [[V]]) -; IS__CGSCC_OPM-NEXT: ret i8* [[CA2]] +; IS__TUNIT____-LABEL: define {{[^@]+}}@start +; IS__TUNIT____-SAME: (i8 [[V:%.*]]) { +; IS__TUNIT____-NEXT: [[C1:%.*]] = icmp eq i8 [[V]], 0 +; IS__TUNIT____-NEXT: br i1 [[C1]], label [[TRUE:%.*]], label [[FALSE:%.*]] +; IS__TUNIT____: true: +; IS__TUNIT____-NEXT: [[CA:%.*]] = musttail call noalias noundef align 4294967296 i8* @side_effects(i8 [[V]]) +; IS__TUNIT____-NEXT: ret i8* [[CA]] +; IS__TUNIT____: false: +; IS__TUNIT____-NEXT: [[C2:%.*]] = icmp eq i8 [[V]], 1 +; IS__TUNIT____-NEXT: br i1 [[C2]], label [[C2_TRUE:%.*]], label [[C2_FALSE:%.*]] +; IS__TUNIT____: c2_true: +; IS__TUNIT____-NEXT: ret i8* null +; IS__TUNIT____: c2_false: +; IS__TUNIT____-NEXT: [[CA2:%.*]] = musttail call noalias noundef align 4294967296 i8* @dont_zap_me(i8 undef) +; IS__TUNIT____-NEXT: ret i8* [[CA2]] ; -; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@start -; IS__CGSCC_NPM-SAME: (i8 [[V:%.*]]) { -; IS__CGSCC_NPM-NEXT: [[C1:%.*]] = icmp eq i8 [[V]], 0 -; IS__CGSCC_NPM-NEXT: br i1 [[C1]], label [[TRUE:%.*]], label [[FALSE:%.*]] -; IS__CGSCC_NPM: true: -; IS__CGSCC_NPM-NEXT: [[CA:%.*]] = musttail call noalias noundef align 4294967296 i8* @side_effects(i8 undef) -; IS__CGSCC_NPM-NEXT: ret i8* [[CA]] -; IS__CGSCC_NPM: false: -; IS__CGSCC_NPM-NEXT: [[C2:%.*]] = icmp eq i8 [[V]], 1 -; IS__CGSCC_NPM-NEXT: br i1 [[C2]], label [[C2_TRUE:%.*]], label [[C2_FALSE:%.*]] -; IS__CGSCC_NPM: c2_true: -; IS__CGSCC_NPM-NEXT: [[CA1:%.*]] = musttail call noalias noundef align 4294967296 i8* @no_side_effects(i8 [[V]]) -; IS__CGSCC_NPM-NEXT: ret i8* [[CA1]] -; IS__CGSCC_NPM: c2_false: -; IS__CGSCC_NPM-NEXT: [[CA2:%.*]] = musttail call noalias noundef align 4294967296 i8* @dont_zap_me(i8 [[V]]) -; IS__CGSCC_NPM-NEXT: ret i8* [[CA2]] +; IS__CGSCC____-LABEL: define {{[^@]+}}@start +; IS__CGSCC____-SAME: (i8 [[V:%.*]]) { +; IS__CGSCC____-NEXT: [[C1:%.*]] = icmp eq i8 [[V]], 0 +; IS__CGSCC____-NEXT: br i1 [[C1]], label [[TRUE:%.*]], label [[FALSE:%.*]] +; IS__CGSCC____: true: +; IS__CGSCC____-NEXT: [[CA:%.*]] = musttail call noalias noundef align 4294967296 i8* @side_effects(i8 [[V]]) +; IS__CGSCC____-NEXT: ret i8* [[CA]] +; IS__CGSCC____: false: +; IS__CGSCC____-NEXT: [[C2:%.*]] = icmp eq i8 [[V]], 1 +; IS__CGSCC____-NEXT: br i1 [[C2]], label [[C2_TRUE:%.*]], label [[C2_FALSE:%.*]] +; IS__CGSCC____: c2_true: +; IS__CGSCC____-NEXT: [[CA1:%.*]] = musttail call noalias noundef align 4294967296 i8* @no_side_effects(i8 [[V]]) +; IS__CGSCC____-NEXT: ret i8* [[CA1]] +; IS__CGSCC____: c2_false: +; IS__CGSCC____-NEXT: [[CA2:%.*]] = musttail call noalias noundef align 4294967296 i8* @dont_zap_me(i8 [[V]]) +; IS__CGSCC____-NEXT: ret i8* [[CA2]] ; %c1 = icmp eq i8 %v, 0 br i1 %c1, label %true, label %false @@ -94,29 +61,17 @@ c2_false: } define internal i8* @side_effects(i8 %v) { -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@side_effects -; IS__TUNIT_OPM-SAME: (i8 [[V:%.*]]) { -; IS__TUNIT_OPM-NEXT: [[I1:%.*]] = call i32 @external() -; IS__TUNIT_OPM-NEXT: [[CA:%.*]] = musttail call i8* @start(i8 [[V]]) -; IS__TUNIT_OPM-NEXT: ret i8* [[CA]] -; -; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@side_effects -; IS__TUNIT_NPM-SAME: (i8 [[V:%.*]]) { -; IS__TUNIT_NPM-NEXT: [[I1:%.*]] = call i32 @external() -; IS__TUNIT_NPM-NEXT: [[CA:%.*]] = musttail call i8* @start(i8 0) -; IS__TUNIT_NPM-NEXT: ret i8* [[CA]] +; IS________OPM-LABEL: define {{[^@]+}}@side_effects +; IS________OPM-SAME: (i8 [[V:%.*]]) { +; IS________OPM-NEXT: [[I1:%.*]] = call i32 @external() +; IS________OPM-NEXT: [[CA:%.*]] = musttail call noalias noundef align 4294967296 i8* @start(i8 [[V]]) +; IS________OPM-NEXT: ret i8* [[CA]] ; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@side_effects -; IS__CGSCC_OPM-SAME: (i8 [[V:%.*]]) { -; IS__CGSCC_OPM-NEXT: [[I1:%.*]] = call i32 @external() -; IS__CGSCC_OPM-NEXT: [[CA:%.*]] = musttail call noalias noundef align 4294967296 i8* @start(i8 [[V]]) -; IS__CGSCC_OPM-NEXT: ret i8* [[CA]] -; -; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@side_effects -; IS__CGSCC_NPM-SAME: (i8 [[V:%.*]]) { -; IS__CGSCC_NPM-NEXT: [[I1:%.*]] = call i32 @external() -; IS__CGSCC_NPM-NEXT: [[CA:%.*]] = musttail call noalias noundef align 4294967296 i8* @start(i8 0) -; IS__CGSCC_NPM-NEXT: ret i8* [[CA]] +; IS________NPM-LABEL: define {{[^@]+}}@side_effects +; IS________NPM-SAME: (i8 [[V:%.*]]) { +; IS________NPM-NEXT: [[I1:%.*]] = call i32 @external() +; IS________NPM-NEXT: [[CA:%.*]] = musttail call noalias noundef align 4294967296 i8* @start(i8 0) +; IS________NPM-NEXT: ret i8* [[CA]] ; %i1 = call i32 @external() @@ -140,15 +95,10 @@ define internal i8* @no_side_effects(i8 %v) readonly nounwind { } define internal i8* @dont_zap_me(i8 %v) { -; IS__TUNIT____-LABEL: define {{[^@]+}}@dont_zap_me -; IS__TUNIT____-SAME: (i8 [[V:%.*]]) { -; IS__TUNIT____-NEXT: [[I1:%.*]] = call i32 @external() -; IS__TUNIT____-NEXT: ret i8* undef -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@dont_zap_me -; IS__CGSCC____-SAME: (i8 [[V:%.*]]) { -; IS__CGSCC____-NEXT: [[I1:%.*]] = call i32 @external() -; IS__CGSCC____-NEXT: ret i8* null +; CHECK-LABEL: define {{[^@]+}}@dont_zap_me +; CHECK-SAME: (i8 [[V:%.*]]) { +; CHECK-NEXT: [[I1:%.*]] = call i32 @external() +; CHECK-NEXT: ret i8* null ; %i1 = call i32 @external() ret i8* null diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/openmp_parallel_for.ll b/llvm/test/Transforms/Attributor/IPConstantProp/openmp_parallel_for.ll index 56d945171cd8..c9d85f4d0138 100644 --- a/llvm/test/Transforms/Attributor/IPConstantProp/openmp_parallel_for.ll +++ b/llvm/test/Transforms/Attributor/IPConstantProp/openmp_parallel_for.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=15 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=15 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM ; diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/return-argument.ll b/llvm/test/Transforms/Attributor/IPConstantProp/return-argument.ll index c6fcb08786d8..95e6ae84099c 100644 --- a/llvm/test/Transforms/Attributor/IPConstantProp/return-argument.ll +++ b/llvm/test/Transforms/Attributor/IPConstantProp/return-argument.ll @@ -66,81 +66,43 @@ define internal { i32, i32 } @foo(i32 %A, i32 %B) { } define void @caller(i1 %C) personality i32 (...)* @__gxx_personality_v0 { -; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@caller -; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] personality i32 (...)* @__gxx_personality_v0 { -; IS__TUNIT_OPM-NEXT: [[Q:%.*]] = alloca i32, align 4 -; IS__TUNIT_OPM-NEXT: [[W:%.*]] = call align 4 i32* @incdec(i1 [[C]], i32* noalias nofree noundef nonnull align 4 dereferenceable(4) "no-capture-maybe-returned" [[Q]]) #[[ATTR2:[0-9]+]] -; IS__TUNIT_OPM-NEXT: [[S1:%.*]] = call { i32, i32 } @foo(i32 noundef 1, i32 noundef 2) #[[ATTR3:[0-9]+]] -; IS__TUNIT_OPM-NEXT: [[X1:%.*]] = extractvalue { i32, i32 } [[S1]], 0 -; IS__TUNIT_OPM-NEXT: [[S2:%.*]] = call { i32, i32 } @foo(i32 noundef 3, i32 noundef 4) #[[ATTR3]] -; IS__TUNIT_OPM-NEXT: br label [[OK:%.*]] -; IS__TUNIT_OPM: OK: -; IS__TUNIT_OPM-NEXT: [[X2:%.*]] = extractvalue { i32, i32 } [[S2]], 0 -; IS__TUNIT_OPM-NEXT: [[Z:%.*]] = add i32 [[X1]], [[X2]] -; IS__TUNIT_OPM-NEXT: store i32 [[Z]], i32* [[W]], align 4 -; IS__TUNIT_OPM-NEXT: br label [[RET:%.*]] -; IS__TUNIT_OPM: LPAD: -; IS__TUNIT_OPM-NEXT: unreachable -; IS__TUNIT_OPM: RET: -; IS__TUNIT_OPM-NEXT: ret void +; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT____-LABEL: define {{[^@]+}}@caller +; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] personality i32 (...)* @__gxx_personality_v0 { +; IS__TUNIT____-NEXT: [[Q:%.*]] = alloca i32, align 4 +; IS__TUNIT____-NEXT: [[W:%.*]] = call align 4 i32* @incdec(i1 [[C]], i32* noalias nofree noundef nonnull align 4 dereferenceable(4) "no-capture-maybe-returned" [[Q]]) #[[ATTR2:[0-9]+]] +; IS__TUNIT____-NEXT: [[S1:%.*]] = call { i32, i32 } @foo(i32 noundef 1, i32 noundef 2) #[[ATTR3:[0-9]+]] +; IS__TUNIT____-NEXT: [[X1:%.*]] = extractvalue { i32, i32 } [[S1]], 0 +; IS__TUNIT____-NEXT: [[S2:%.*]] = call { i32, i32 } @foo(i32 noundef 3, i32 noundef 4) #[[ATTR3]] +; IS__TUNIT____-NEXT: br label [[OK:%.*]] +; IS__TUNIT____: OK: +; IS__TUNIT____-NEXT: [[X2:%.*]] = extractvalue { i32, i32 } [[S2]], 0 +; IS__TUNIT____-NEXT: [[Z:%.*]] = add i32 [[X1]], [[X2]] +; IS__TUNIT____-NEXT: store i32 [[Z]], i32* [[Q]], align 4 +; IS__TUNIT____-NEXT: br label [[RET:%.*]] +; IS__TUNIT____: LPAD: +; IS__TUNIT____-NEXT: unreachable +; IS__TUNIT____: RET: +; IS__TUNIT____-NEXT: ret void ; -; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@caller -; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] personality i32 (...)* @__gxx_personality_v0 { -; IS__TUNIT_NPM-NEXT: [[Q:%.*]] = alloca i32, align 4 -; IS__TUNIT_NPM-NEXT: [[W:%.*]] = call align 4 i32* @incdec(i1 [[C]], i32* noalias nofree noundef nonnull align 4 dereferenceable(4) "no-capture-maybe-returned" [[Q]]) #[[ATTR2:[0-9]+]] -; IS__TUNIT_NPM-NEXT: [[S1:%.*]] = call { i32, i32 } @foo(i32 noundef 1, i32 noundef 2) #[[ATTR3:[0-9]+]] -; IS__TUNIT_NPM-NEXT: [[X1:%.*]] = extractvalue { i32, i32 } [[S1]], 0 -; IS__TUNIT_NPM-NEXT: [[S2:%.*]] = call { i32, i32 } @foo(i32 noundef 3, i32 noundef 4) #[[ATTR3]] -; IS__TUNIT_NPM-NEXT: br label [[OK:%.*]] -; IS__TUNIT_NPM: OK: -; IS__TUNIT_NPM-NEXT: [[X2:%.*]] = extractvalue { i32, i32 } [[S2]], 0 -; IS__TUNIT_NPM-NEXT: [[Z:%.*]] = add i32 [[X1]], [[X2]] -; IS__TUNIT_NPM-NEXT: store i32 [[Z]], i32* [[Q]], align 4 -; IS__TUNIT_NPM-NEXT: br label [[RET:%.*]] -; IS__TUNIT_NPM: LPAD: -; IS__TUNIT_NPM-NEXT: unreachable -; IS__TUNIT_NPM: RET: -; IS__TUNIT_NPM-NEXT: ret void -; -; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@caller -; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR2:[0-9]+]] personality i32 (...)* @__gxx_personality_v0 { -; IS__CGSCC_OPM-NEXT: [[Q:%.*]] = alloca i32, align 4 -; IS__CGSCC_OPM-NEXT: [[W:%.*]] = call align 4 i32* @incdec(i1 [[C]], i32* noalias nofree noundef nonnull align 4 dereferenceable(4) [[Q]]) #[[ATTR3:[0-9]+]] -; IS__CGSCC_OPM-NEXT: [[S1:%.*]] = call { i32, i32 } @foo(i32 noundef 1, i32 noundef 2) #[[ATTR4:[0-9]+]] -; IS__CGSCC_OPM-NEXT: [[X1:%.*]] = extractvalue { i32, i32 } [[S1]], 0 -; IS__CGSCC_OPM-NEXT: [[S2:%.*]] = call { i32, i32 } @foo(i32 noundef 3, i32 noundef 4) #[[ATTR5:[0-9]+]] -; IS__CGSCC_OPM-NEXT: br label [[OK:%.*]] -; IS__CGSCC_OPM: OK: -; IS__CGSCC_OPM-NEXT: [[X2:%.*]] = extractvalue { i32, i32 } [[S2]], 0 -; IS__CGSCC_OPM-NEXT: [[Z:%.*]] = add i32 [[X1]], [[X2]] -; IS__CGSCC_OPM-NEXT: store i32 [[Z]], i32* [[W]], align 4 -; IS__CGSCC_OPM-NEXT: br label [[RET:%.*]] -; IS__CGSCC_OPM: LPAD: -; IS__CGSCC_OPM-NEXT: unreachable -; IS__CGSCC_OPM: RET: -; IS__CGSCC_OPM-NEXT: ret void -; -; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn -; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@caller -; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR2:[0-9]+]] personality i32 (...)* @__gxx_personality_v0 { -; IS__CGSCC_NPM-NEXT: [[Q:%.*]] = alloca i32, align 4 -; IS__CGSCC_NPM-NEXT: [[W:%.*]] = call align 4 i32* @incdec(i1 [[C]], i32* noalias nofree noundef nonnull align 4 dereferenceable(4) [[Q]]) #[[ATTR3:[0-9]+]] -; IS__CGSCC_NPM-NEXT: [[S1:%.*]] = call { i32, i32 } @foo(i32 noundef 1, i32 noundef 2) #[[ATTR4:[0-9]+]] -; IS__CGSCC_NPM-NEXT: [[X1:%.*]] = extractvalue { i32, i32 } [[S1]], 0 -; IS__CGSCC_NPM-NEXT: [[S2:%.*]] = call { i32, i32 } @foo(i32 noundef 3, i32 noundef 4) #[[ATTR5:[0-9]+]] -; IS__CGSCC_NPM-NEXT: br label [[OK:%.*]] -; IS__CGSCC_NPM: OK: -; IS__CGSCC_NPM-NEXT: [[X2:%.*]] = extractvalue { i32, i32 } [[S2]], 0 -; IS__CGSCC_NPM-NEXT: [[Z:%.*]] = add i32 [[X1]], [[X2]] -; IS__CGSCC_NPM-NEXT: store i32 [[Z]], i32* [[Q]], align 4 -; IS__CGSCC_NPM-NEXT: br label [[RET:%.*]] -; IS__CGSCC_NPM: LPAD: -; IS__CGSCC_NPM-NEXT: unreachable -; IS__CGSCC_NPM: RET: -; IS__CGSCC_NPM-NEXT: ret void +; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn +; IS__CGSCC____-LABEL: define {{[^@]+}}@caller +; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR2:[0-9]+]] personality i32 (...)* @__gxx_personality_v0 { +; IS__CGSCC____-NEXT: [[Q:%.*]] = alloca i32, align 4 +; IS__CGSCC____-NEXT: [[W:%.*]] = call align 4 i32* @incdec(i1 [[C]], i32* nofree noundef nonnull align 4 dereferenceable(4) [[Q]]) #[[ATTR3:[0-9]+]] +; IS__CGSCC____-NEXT: [[S1:%.*]] = call { i32, i32 } @foo(i32 noundef 1, i32 noundef 2) #[[ATTR4:[0-9]+]] +; IS__CGSCC____-NEXT: [[X1:%.*]] = extractvalue { i32, i32 } [[S1]], 0 +; IS__CGSCC____-NEXT: [[S2:%.*]] = call { i32, i32 } @foo(i32 noundef 3, i32 noundef 4) #[[ATTR5:[0-9]+]] +; IS__CGSCC____-NEXT: br label [[OK:%.*]] +; IS__CGSCC____: OK: +; IS__CGSCC____-NEXT: [[X2:%.*]] = extractvalue { i32, i32 } [[S2]], 0 +; IS__CGSCC____-NEXT: [[Z:%.*]] = add i32 [[X1]], [[X2]] +; IS__CGSCC____-NEXT: store i32 [[Z]], i32* [[W]], align 4 +; IS__CGSCC____-NEXT: br label [[RET:%.*]] +; IS__CGSCC____: LPAD: +; IS__CGSCC____-NEXT: unreachable +; IS__CGSCC____: RET: +; IS__CGSCC____-NEXT: ret void ; %Q = alloca i32 ;; Call incdec to see if %W is properly replaced by %Q @@ -172,13 +134,13 @@ declare i32 @__gxx_personality_v0(...) ;. ; IS__TUNIT____: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind willreturn } ; IS__TUNIT____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn } -; IS__TUNIT____: attributes #[[ATTR2:[0-9]+]] = { nofree nosync nounwind willreturn } -; IS__TUNIT____: attributes #[[ATTR3:[0-9]+]] = { nofree nosync nounwind readnone willreturn } +; IS__TUNIT____: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn } +; IS__TUNIT____: attributes #[[ATTR3]] = { nofree nosync nounwind readnone willreturn } ;. ; IS__CGSCC____: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind willreturn } ; IS__CGSCC____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn } -; IS__CGSCC____: attributes #[[ATTR2:[0-9]+]] = { nofree nosync nounwind readnone willreturn } -; IS__CGSCC____: attributes #[[ATTR3:[0-9]+]] = { nounwind willreturn } -; IS__CGSCC____: attributes #[[ATTR4:[0-9]+]] = { readnone willreturn } -; IS__CGSCC____: attributes #[[ATTR5:[0-9]+]] = { nounwind readnone willreturn } +; IS__CGSCC____: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn } +; IS__CGSCC____: attributes #[[ATTR3]] = { nounwind willreturn } +; IS__CGSCC____: attributes #[[ATTR4]] = { readnone willreturn } +; IS__CGSCC____: attributes #[[ATTR5]] = { nounwind readnone willreturn } ;. diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/thread_local_acs.ll b/llvm/test/Transforms/Attributor/IPConstantProp/thread_local_acs.ll index 94ffa04d45bf..cf9ecb099d41 100644 --- a/llvm/test/Transforms/Attributor/IPConstantProp/thread_local_acs.ll +++ b/llvm/test/Transforms/Attributor/IPConstantProp/thread_local_acs.ll @@ -30,9 +30,9 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" define internal i32 @callee(i32* %thread_local_ptr, i32* %shared_ptr) { ; CHECK: Function Attrs: nofree norecurse nosync nounwind readonly willreturn ; CHECK-LABEL: define {{[^@]+}}@callee -; CHECK-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[THREAD_LOCAL_PTR:%.*]], i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) [[SHARED_PTR:%.*]]) #[[ATTR0:[0-9]+]] { +; CHECK-SAME: (i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) [[THREAD_LOCAL_PTR:%.*]], i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) [[SHARED_PTR:%.*]]) #[[ATTR0:[0-9]+]] { ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP:%.*]] = load i32, i32* [[THREAD_LOCAL_PTR]], align 4 +; CHECK-NEXT: [[TMP:%.*]] = load i32, i32* @gtl, align 4 ; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @gsh, align 4 ; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP]], [[TMP1]] ; CHECK-NEXT: ret i32 [[ADD]] @@ -47,7 +47,7 @@ entry: define dso_local void @caller() { ; IS__TUNIT____-LABEL: define {{[^@]+}}@caller() { ; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: call void @broker(i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) @gtl, i32 (i32*, i32*)* noundef nonnull @callee, i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) undef) +; IS__TUNIT____-NEXT: call void @broker(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) undef, i32 (i32*, i32*)* noundef nonnull @callee, i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) undef) ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____-LABEL: define {{[^@]+}}@caller() { diff --git a/llvm/test/Transforms/Attributor/align.ll b/llvm/test/Transforms/Attributor/align.ll index 3524f1da4719..2c4c68649e7f 100644 --- a/llvm/test/Transforms/Attributor/align.ll +++ b/llvm/test/Transforms/Attributor/align.ll @@ -136,14 +136,14 @@ define i32* @test6_2() #0 { ; Function Attrs: nounwind readnone ssp uwtable define internal i8* @f1(i8* readnone %0) local_unnamed_addr #0 { -; IS__CGSCC____: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable -; IS__CGSCC____-LABEL: define {{[^@]+}}@f1 -; IS__CGSCC____-SAME: (i8* noalias nofree noundef nonnull readnone returned align 8 dereferenceable(1) "no-capture-maybe-returned" [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] { -; IS__CGSCC____-NEXT: br label [[TMP3:%.*]] -; IS__CGSCC____: 2: -; IS__CGSCC____-NEXT: unreachable -; IS__CGSCC____: 3: -; IS__CGSCC____-NEXT: ret i8* [[TMP0]] +; CHECK: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable +; CHECK-LABEL: define {{[^@]+}}@f1 +; CHECK-SAME: (i8* noalias nofree nonnull readnone align 8 dereferenceable(1) "no-capture-maybe-returned" [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] { +; CHECK-NEXT: br label [[TMP3:%.*]] +; CHECK: 2: +; CHECK-NEXT: unreachable +; CHECK: 3: +; CHECK-NEXT: ret i8* [[TMP0]] ; %2 = icmp eq i8* %0, null br i1 %2, label %3, label %5 @@ -163,10 +163,10 @@ define internal i8* @f2(i8* readnone %0) local_unnamed_addr #0 { ; IS__CGSCC_OPM: Function Attrs: noinline nounwind uwtable ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f2 ; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] { -; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null +; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* undef, null ; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]] ; IS__CGSCC_OPM: 3: -; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1(i8* noalias noundef nonnull readnone align 4294967296 dereferenceable(4294967295) [[TMP0]]) +; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1(i8* noalias nonnull readnone align 4294967296 dereferenceable(4294967295) undef) ; IS__CGSCC_OPM-NEXT: br label [[TMP7:%.*]] ; IS__CGSCC_OPM: 5: ; IS__CGSCC_OPM-NEXT: [[TMP6:%.*]] = tail call i8* @f3(i8* nonnull @a2) @@ -178,10 +178,10 @@ define internal i8* @f2(i8* readnone %0) local_unnamed_addr #0 { ; IS__CGSCC_NPM: Function Attrs: noinline nounwind uwtable ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f2 ; IS__CGSCC_NPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] { -; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null +; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = icmp eq i8* undef, null ; IS__CGSCC_NPM-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]] ; IS__CGSCC_NPM: 3: -; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1(i8* noalias noundef nonnull readnone align 4294967296 dereferenceable(4294967295) [[TMP0]]) +; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1(i8* noalias nonnull readnone align 4294967296 dereferenceable(4294967295) undef) ; IS__CGSCC_NPM-NEXT: br label [[TMP7:%.*]] ; IS__CGSCC_NPM: 5: ; IS__CGSCC_NPM-NEXT: [[TMP6:%.*]] = tail call i8* @f3() @@ -248,17 +248,20 @@ define align 4 i8* @test7() #0 { ; IS__TUNIT____: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable ; IS__TUNIT____-LABEL: define {{[^@]+}}@test7 ; IS__TUNIT____-SAME: () #[[ATTR0]] { -; IS__TUNIT____-NEXT: ret i8* @a1 +; IS__TUNIT____-NEXT: [[C:%.*]] = tail call i8* @f1(i8* noalias nofree noundef nonnull readnone align 8 dereferenceable(1) "no-capture-maybe-returned" @a1) #[[ATTR9:[0-9]+]] +; IS__TUNIT____-NEXT: ret i8* [[C]] ; ; IS__CGSCC_OPM: Function Attrs: nofree noinline nosync nounwind readnone willreturn uwtable ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test7 ; IS__CGSCC_OPM-SAME: () #[[ATTR1]] { -; IS__CGSCC_OPM-NEXT: ret i8* @a1 +; IS__CGSCC_OPM-NEXT: [[C:%.*]] = tail call noundef nonnull align 8 dereferenceable(1) i8* @f1(i8* noalias nofree noundef nonnull readnone align 8 dereferenceable(1) @a1) #[[ATTR13:[0-9]+]] +; IS__CGSCC_OPM-NEXT: ret i8* [[C]] ; ; IS__CGSCC_NPM: Function Attrs: nofree noinline nosync nounwind readnone willreturn uwtable ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test7 ; IS__CGSCC_NPM-SAME: () #[[ATTR2:[0-9]+]] { -; IS__CGSCC_NPM-NEXT: ret i8* @a1 +; IS__CGSCC_NPM-NEXT: [[C:%.*]] = tail call noundef nonnull align 8 dereferenceable(1) i8* @f1(i8* noalias nofree noundef nonnull readnone align 8 dereferenceable(1) @a1) #[[ATTR13:[0-9]+]] +; IS__CGSCC_NPM-NEXT: ret i8* [[C]] ; %c = tail call i8* @f1(i8* align 8 dereferenceable(1) @a1) ret i8* %c @@ -267,23 +270,14 @@ define align 4 i8* @test7() #0 { ; TEST 7b ; Function Attrs: nounwind readnone ssp uwtable define internal i8* @f1b(i8* readnone %0) local_unnamed_addr #0 { -; IS__CGSCC_OPM: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f1b -; IS__CGSCC_OPM-SAME: (i8* noalias nocapture nofree nonnull readnone align 8 dereferenceable(1) [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] { -; IS__CGSCC_OPM-NEXT: br label [[TMP3:%.*]] -; IS__CGSCC_OPM: 2: -; IS__CGSCC_OPM-NEXT: unreachable -; IS__CGSCC_OPM: 3: -; IS__CGSCC_OPM-NEXT: ret i8* undef -; -; IS__CGSCC_NPM: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable -; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f1b -; IS__CGSCC_NPM-SAME: () local_unnamed_addr #[[ATTR0]] { -; IS__CGSCC_NPM-NEXT: br label [[TMP2:%.*]] -; IS__CGSCC_NPM: 1: -; IS__CGSCC_NPM-NEXT: unreachable -; IS__CGSCC_NPM: 2: -; IS__CGSCC_NPM-NEXT: ret i8* undef +; IS__CGSCC____: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable +; IS__CGSCC____-LABEL: define {{[^@]+}}@f1b +; IS__CGSCC____-SAME: (i8* noalias nofree nonnull readnone align 8 dereferenceable(1) "no-capture-maybe-returned" [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] { +; IS__CGSCC____-NEXT: br label [[TMP3:%.*]] +; IS__CGSCC____: 2: +; IS__CGSCC____-NEXT: unreachable +; IS__CGSCC____: 3: +; IS__CGSCC____-NEXT: ret i8* [[TMP0]] ; %2 = icmp eq i8* %0, null br i1 %2, label %3, label %5 @@ -305,30 +299,32 @@ define internal i8* @f2b(i8* readnone %0) local_unnamed_addr #0 { ; IS__CGSCC_OPM: Function Attrs: noinline nounwind uwtable ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f2b ; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2]] { -; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null -; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]] +; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* undef, null +; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]] ; IS__CGSCC_OPM: 3: -; IS__CGSCC_OPM-NEXT: br label [[TMP6:%.*]] -; IS__CGSCC_OPM: 4: -; IS__CGSCC_OPM-NEXT: [[TMP5:%.*]] = tail call i8* @f3b(i8* nonnull @a2) -; IS__CGSCC_OPM-NEXT: br label [[TMP6]] -; IS__CGSCC_OPM: 6: -; IS__CGSCC_OPM-NEXT: [[TMP7:%.*]] = phi i8* [ undef, [[TMP3]] ], [ [[TMP5]], [[TMP4]] ] -; IS__CGSCC_OPM-NEXT: ret i8* [[TMP7]] +; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1b(i8* noalias nonnull readnone align 4294967296 dereferenceable(4294967295) undef) +; IS__CGSCC_OPM-NEXT: br label [[TMP7:%.*]] +; IS__CGSCC_OPM: 5: +; IS__CGSCC_OPM-NEXT: [[TMP6:%.*]] = tail call i8* @f3b(i8* nonnull @a2) +; IS__CGSCC_OPM-NEXT: br label [[TMP7]] +; IS__CGSCC_OPM: 7: +; IS__CGSCC_OPM-NEXT: [[TMP8:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [ [[TMP6]], [[TMP5]] ] +; IS__CGSCC_OPM-NEXT: ret i8* [[TMP8]] ; ; IS__CGSCC_NPM: Function Attrs: noinline nounwind uwtable ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f2b ; IS__CGSCC_NPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1]] { -; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null -; IS__CGSCC_NPM-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]] +; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = icmp eq i8* undef, null +; IS__CGSCC_NPM-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]] ; IS__CGSCC_NPM: 3: -; IS__CGSCC_NPM-NEXT: br label [[TMP6:%.*]] -; IS__CGSCC_NPM: 4: -; IS__CGSCC_NPM-NEXT: [[TMP5:%.*]] = tail call i8* @f3b() -; IS__CGSCC_NPM-NEXT: br label [[TMP6]] -; IS__CGSCC_NPM: 6: -; IS__CGSCC_NPM-NEXT: [[TMP7:%.*]] = phi i8* [ undef, [[TMP3]] ], [ [[TMP5]], [[TMP4]] ] -; IS__CGSCC_NPM-NEXT: ret i8* [[TMP7]] +; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1b(i8* noalias nonnull readnone align 4294967296 dereferenceable(4294967295) undef) +; IS__CGSCC_NPM-NEXT: br label [[TMP7:%.*]] +; IS__CGSCC_NPM: 5: +; IS__CGSCC_NPM-NEXT: [[TMP6:%.*]] = tail call i8* @f3b() +; IS__CGSCC_NPM-NEXT: br label [[TMP7]] +; IS__CGSCC_NPM: 7: +; IS__CGSCC_NPM-NEXT: [[TMP8:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [ [[TMP6]], [[TMP5]] ] +; IS__CGSCC_NPM-NEXT: ret i8* [[TMP8]] ; %2 = icmp eq i8* %0, null br i1 %2, label %5, label %3 @@ -354,12 +350,13 @@ define internal i8* @f3b(i8* readnone %0) local_unnamed_addr #0 { ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f3b ; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2]] { ; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null -; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]] +; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP5:%.*]] ; IS__CGSCC_OPM: 3: -; IS__CGSCC_OPM-NEXT: br label [[TMP4]] -; IS__CGSCC_OPM: 4: -; IS__CGSCC_OPM-NEXT: [[TMP5:%.*]] = phi i8* [ @a2, [[TMP3]] ], [ @a1, [[TMP1:%.*]] ] -; IS__CGSCC_OPM-NEXT: ret i8* [[TMP5]] +; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1b(i8* noalias noundef nonnull readnone align 16 dereferenceable(1) @a2) +; IS__CGSCC_OPM-NEXT: br label [[TMP5]] +; IS__CGSCC_OPM: 5: +; IS__CGSCC_OPM-NEXT: [[TMP6:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [ @a1, [[TMP1:%.*]] ] +; IS__CGSCC_OPM-NEXT: ret i8* [[TMP6]] ; ; IS__CGSCC_NPM: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f3b @@ -924,7 +921,7 @@ end: define i64 @ptr2int(i32* %p) { ; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT____-LABEL: define {{[^@]+}}@ptr2int -; IS__TUNIT____-SAME: (i32* nofree readnone [[P:%.*]]) #[[ATTR9:[0-9]+]] { +; IS__TUNIT____-SAME: (i32* nofree readnone [[P:%.*]]) #[[ATTR9]] { ; IS__TUNIT____-NEXT: [[P2I:%.*]] = ptrtoint i32* [[P]] to i64 ; IS__TUNIT____-NEXT: ret i64 [[P2I]] ; @@ -1042,7 +1039,7 @@ define i32 @musttail_caller_1(i32* %p) { ; IS__CGSCC____-NEXT: [[C:%.*]] = load i1, i1* @cnd, align 1 ; IS__CGSCC____-NEXT: br i1 [[C]], label [[MT:%.*]], label [[EXIT:%.*]] ; IS__CGSCC____: mt: -; IS__CGSCC____-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(i32* nocapture nofree noundef nonnull readonly dereferenceable(4) [[P]]) #[[ATTR13:[0-9]+]] +; IS__CGSCC____-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(i32* nocapture nofree noundef nonnull readonly dereferenceable(4) [[P]]) #[[ATTR14:[0-9]+]] ; IS__CGSCC____-NEXT: ret i32 [[V]] ; IS__CGSCC____: exit: ; IS__CGSCC____-NEXT: ret i32 0 @@ -1066,10 +1063,10 @@ define i32* @checkAndAdvance(i32* align(16) %p) { ; IS__TUNIT____-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]] ; IS__TUNIT____: if.then: ; IS__TUNIT____-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, i32* [[P]], i64 4 -; IS__TUNIT____-NEXT: [[CALL:%.*]] = call nonnull align 16 i32* @checkAndAdvance(i32* nonnull readonly align 16 "no-capture-maybe-returned" [[ADD_PTR]]) #[[ATTR2]] +; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32* @checkAndAdvance(i32* nonnull readonly align 16 "no-capture-maybe-returned" [[ADD_PTR]]) #[[ATTR2]] ; IS__TUNIT____-NEXT: br label [[RETURN]] ; IS__TUNIT____: return: -; IS__TUNIT____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[CALL]], [[IF_THEN]] ], [ [[P]], [[ENTRY:%.*]] ] +; IS__TUNIT____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[ADD_PTR]], [[IF_THEN]] ], [ [[P]], [[ENTRY:%.*]] ] ; IS__TUNIT____-NEXT: call void @user_i32_ptr(i32* noalias nocapture nonnull readnone align 16 [[RETVAL_0]]) #[[ATTR2]] ; IS__TUNIT____-NEXT: ret i32* [[RETVAL_0]] ; @@ -1082,10 +1079,10 @@ define i32* @checkAndAdvance(i32* align(16) %p) { ; IS__CGSCC____-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]] ; IS__CGSCC____: if.then: ; IS__CGSCC____-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, i32* [[P]], i64 4 -; IS__CGSCC____-NEXT: [[CALL:%.*]] = call nonnull align 16 i32* @checkAndAdvance(i32* nonnull readonly align 16 "no-capture-maybe-returned" [[ADD_PTR]]) #[[ATTR3]] +; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i32* @checkAndAdvance(i32* nonnull readonly align 16 "no-capture-maybe-returned" [[ADD_PTR]]) #[[ATTR3]] ; IS__CGSCC____-NEXT: br label [[RETURN]] ; IS__CGSCC____: return: -; IS__CGSCC____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[CALL]], [[IF_THEN]] ], [ [[P]], [[ENTRY:%.*]] ] +; IS__CGSCC____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[ADD_PTR]], [[IF_THEN]] ], [ [[P]], [[ENTRY:%.*]] ] ; IS__CGSCC____-NEXT: call void @user_i32_ptr(i32* noalias nocapture nonnull readnone align 16 [[RETVAL_0]]) #[[ATTR3]] ; IS__CGSCC____-NEXT: ret i32* [[RETVAL_0]] ; @@ -1180,7 +1177,7 @@ define i8* @aligned_8_return_caller(i8* align(16) %a, i1 %c1, i1 %c2) { ; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@aligned_8_return_caller ; IS__CGSCC____-SAME: (i8* nofree readnone align 16 [[A:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR12:[0-9]+]] { -; IS__CGSCC____-NEXT: [[R:%.*]] = call align 8 i8* @aligned_8_return(i8* noalias nofree readnone align 16 [[A]], i1 [[C1]], i1 [[C2]]) #[[ATTR14:[0-9]+]] +; IS__CGSCC____-NEXT: [[R:%.*]] = call align 8 i8* @aligned_8_return(i8* noalias nofree readnone align 16 [[A]], i1 [[C1]], i1 [[C2]]) #[[ATTR13:[0-9]+]] ; IS__CGSCC____-NEXT: ret i8* [[R]] ; %r = call i8* @aligned_8_return(i8* %a, i1 %c1, i1 %c2) @@ -1218,8 +1215,8 @@ attributes #2 = { null_pointer_is_valid } ; IS__CGSCC_OPM: attributes #[[ATTR10]] = { nofree norecurse nosync nounwind readnone willreturn } ; IS__CGSCC_OPM: attributes #[[ATTR11]] = { nofree nosync nounwind readonly willreturn } ; IS__CGSCC_OPM: attributes #[[ATTR12]] = { nofree nosync nounwind readnone willreturn } -; IS__CGSCC_OPM: attributes #[[ATTR13]] = { readonly willreturn } -; IS__CGSCC_OPM: attributes #[[ATTR14]] = { readnone willreturn } +; IS__CGSCC_OPM: attributes #[[ATTR13]] = { readnone willreturn } +; IS__CGSCC_OPM: attributes #[[ATTR14]] = { readonly willreturn } ;. ; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone willreturn uwtable } ; IS__CGSCC_NPM: attributes #[[ATTR1]] = { noinline nounwind uwtable } @@ -1234,6 +1231,6 @@ attributes #2 = { null_pointer_is_valid } ; IS__CGSCC_NPM: attributes #[[ATTR10]] = { nofree norecurse nosync nounwind readnone willreturn } ; IS__CGSCC_NPM: attributes #[[ATTR11]] = { nofree nosync nounwind readonly willreturn } ; IS__CGSCC_NPM: attributes #[[ATTR12]] = { nofree nosync nounwind readnone willreturn } -; IS__CGSCC_NPM: attributes #[[ATTR13]] = { readonly willreturn } -; IS__CGSCC_NPM: attributes #[[ATTR14]] = { readnone willreturn } +; IS__CGSCC_NPM: attributes #[[ATTR13]] = { readnone willreturn } +; IS__CGSCC_NPM: attributes #[[ATTR14]] = { readonly willreturn } ;. diff --git a/llvm/test/Transforms/Attributor/allow_list.ll b/llvm/test/Transforms/Attributor/allow_list.ll index f94ea046140c..65650d174e3c 100644 --- a/llvm/test/Transforms/Attributor/allow_list.ll +++ b/llvm/test/Transforms/Attributor/allow_list.ll @@ -21,6 +21,13 @@ define internal i32 @range_test(i32 %a) #0 { ; CHECK_DISABLED-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32 ; CHECK_DISABLED-NEXT: ret i32 [[TMP2]] ; +; CHECK_ENABLED: Function Attrs: noinline nounwind uwtable +; CHECK_ENABLED-LABEL: define {{[^@]+}}@range_test +; CHECK_ENABLED-SAME: (i32 [[A:%.*]]) #[[ATTR0:[0-9]+]] { +; CHECK_ENABLED-NEXT: [[TMP1:%.*]] = icmp sgt i32 [[A]], 100 +; CHECK_ENABLED-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32 +; CHECK_ENABLED-NEXT: ret i32 [[TMP2]] +; ; CHECK_DISABLED_FUNCTION: Function Attrs: noinline nounwind uwtable ; CHECK_DISABLED_FUNCTION-LABEL: define {{[^@]+}}@range_test ; CHECK_DISABLED_FUNCTION-SAME: (i32 [[A:%.*]]) #[[ATTR0:[0-9]+]] { @@ -48,8 +55,9 @@ define i32 @range_use1() #0 { ; ; CHECK_ENABLED: Function Attrs: noinline nounwind uwtable ; CHECK_ENABLED-LABEL: define {{[^@]+}}@range_use1 -; CHECK_ENABLED-SAME: () #[[ATTR0:[0-9]+]] { -; CHECK_ENABLED-NEXT: ret i32 1 +; CHECK_ENABLED-SAME: () #[[ATTR0]] { +; CHECK_ENABLED-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 123) +; CHECK_ENABLED-NEXT: ret i32 [[TMP1]] ; ; CHECK_DISABLED_FUNCTION: Function Attrs: noinline nounwind uwtable ; CHECK_DISABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use1 @@ -74,10 +82,11 @@ define i32 @range_use2() #0 { ; CHECK_DISABLED-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 123) ; CHECK_DISABLED-NEXT: ret i32 [[TMP1]] ; -; CHECK_ENABLED: Function Attrs: noinline norecurse nounwind uwtable +; CHECK_ENABLED: Function Attrs: noinline nounwind uwtable ; CHECK_ENABLED-LABEL: define {{[^@]+}}@range_use2 -; CHECK_ENABLED-SAME: () #[[ATTR1:[0-9]+]] { -; CHECK_ENABLED-NEXT: ret i32 1 +; CHECK_ENABLED-SAME: () #[[ATTR0]] { +; CHECK_ENABLED-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 123) +; CHECK_ENABLED-NEXT: ret i32 [[TMP1]] ; ; CHECK_DISABLED_FUNCTION: Function Attrs: noinline nounwind uwtable ; CHECK_DISABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use2 @@ -100,7 +109,6 @@ attributes #0 = { nounwind uwtable noinline } ; CHECK_DISABLED: attributes #[[ATTR0]] = { noinline nounwind uwtable } ;. ; CHECK_ENABLED: attributes #[[ATTR0]] = { noinline nounwind uwtable } -; CHECK_ENABLED: attributes #[[ATTR1]] = { noinline norecurse nounwind uwtable } ;. ; CHECK_DISABLED_FUNCTION: attributes #[[ATTR0]] = { noinline nounwind uwtable } ;. diff --git a/llvm/test/Transforms/Attributor/callbacks.ll b/llvm/test/Transforms/Attributor/callbacks.ll index 9eb536c02ab2..1e6405032bcd 100644 --- a/llvm/test/Transforms/Attributor/callbacks.ll +++ b/llvm/test/Transforms/Attributor/callbacks.ll @@ -73,7 +73,7 @@ define internal void @t0_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a, ; IS__TUNIT_OPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8 ; IS__TUNIT_OPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4 ; IS__TUNIT_OPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64 -; IS__TUNIT_OPM-NEXT: tail call void @t0_check(i32* align 256 [[A]], i64 noundef 99, i32* noundef nonnull align 32 dereferenceable(4) [[TMP0]]) +; IS__TUNIT_OPM-NEXT: tail call void @t0_check(i32* align 256 [[A]], i64 noundef 99, i32* nonnull align 32 [[TMP0]]) ; IS__TUNIT_OPM-NEXT: ret void ; ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@t0_callback_callee @@ -82,7 +82,7 @@ define internal void @t0_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a, ; IS__TUNIT_NPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8 ; IS__TUNIT_NPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4 ; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64 -; IS__TUNIT_NPM-NEXT: tail call void @t0_check(i32* align 256 [[A]], i64 noundef 99, i32* noundef nonnull align 32 dereferenceable(4) [[TMP0]]) +; IS__TUNIT_NPM-NEXT: tail call void @t0_check(i32* align 256 [[A]], i64 noundef 99, i32* nonnull align 32 [[TMP0]]) ; IS__TUNIT_NPM-NEXT: ret void ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@t0_callback_callee @@ -192,7 +192,7 @@ define internal void @t1_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a, ; IS__TUNIT_OPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8 ; IS__TUNIT_OPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4 ; IS__TUNIT_OPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64 -; IS__TUNIT_OPM-NEXT: tail call void @t1_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture noundef nonnull align 32 dereferenceable(4) [[TMP0]]) +; IS__TUNIT_OPM-NEXT: tail call void @t1_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture nonnull align 32 [[TMP0]]) ; IS__TUNIT_OPM-NEXT: ret void ; ; IS__TUNIT_NPM: Function Attrs: nosync @@ -202,7 +202,7 @@ define internal void @t1_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a, ; IS__TUNIT_NPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8 ; IS__TUNIT_NPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4 ; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64 -; IS__TUNIT_NPM-NEXT: tail call void @t1_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture noundef nonnull align 32 dereferenceable(4) [[TMP0]]) +; IS__TUNIT_NPM-NEXT: tail call void @t1_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture nonnull align 32 [[TMP0]]) ; IS__TUNIT_NPM-NEXT: ret void ; ; IS__CGSCC_OPM: Function Attrs: nosync @@ -313,7 +313,7 @@ define internal void @t2_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a, ; IS__TUNIT_OPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8 ; IS__TUNIT_OPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4 ; IS__TUNIT_OPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64 -; IS__TUNIT_OPM-NEXT: tail call void @t2_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture noundef nonnull align 32 dereferenceable(4) [[TMP0]]) +; IS__TUNIT_OPM-NEXT: tail call void @t2_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture nonnull align 32 [[TMP0]]) ; IS__TUNIT_OPM-NEXT: ret void ; ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@t2_callback_callee @@ -322,7 +322,7 @@ define internal void @t2_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a, ; IS__TUNIT_NPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8 ; IS__TUNIT_NPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4 ; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64 -; IS__TUNIT_NPM-NEXT: tail call void @t2_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture noundef nonnull align 32 dereferenceable(4) [[TMP0]]) +; IS__TUNIT_NPM-NEXT: tail call void @t2_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture nonnull align 32 [[TMP0]]) ; IS__TUNIT_NPM-NEXT: ret void ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@t2_callback_callee @@ -436,7 +436,7 @@ define internal void @t3_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a, ; IS__TUNIT_OPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8 ; IS__TUNIT_OPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4 ; IS__TUNIT_OPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64 -; IS__TUNIT_OPM-NEXT: tail call void @t3_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture noundef nonnull align 32 dereferenceable(4) [[TMP0]]) +; IS__TUNIT_OPM-NEXT: tail call void @t3_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture nonnull align 32 [[TMP0]]) ; IS__TUNIT_OPM-NEXT: ret void ; ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@t3_callback_callee @@ -445,7 +445,7 @@ define internal void @t3_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a, ; IS__TUNIT_NPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8 ; IS__TUNIT_NPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4 ; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64 -; IS__TUNIT_NPM-NEXT: tail call void @t3_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture noundef nonnull align 32 dereferenceable(4) [[TMP0]]) +; IS__TUNIT_NPM-NEXT: tail call void @t3_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture nonnull align 32 [[TMP0]]) ; IS__TUNIT_NPM-NEXT: ret void ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@t3_callback_callee diff --git a/llvm/test/Transforms/Attributor/cb_liveness_disabled.ll b/llvm/test/Transforms/Attributor/cb_liveness_disabled.ll index d6909dfe5c5e..a6a7b0835301 100644 --- a/llvm/test/Transforms/Attributor/cb_liveness_disabled.ll +++ b/llvm/test/Transforms/Attributor/cb_liveness_disabled.ll @@ -68,10 +68,10 @@ define i32 @test(i32 %0, i32 %1) #0 { ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP1]], 0 ; IS__TUNIT____-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP6:%.*]] ; IS__TUNIT____: 4: -; IS__TUNIT____-NEXT: [[TMP5:%.*]] = call noundef i32 @test_range1(i32 [[TMP0]]) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]] +; IS__TUNIT____-NEXT: [[TMP5:%.*]] = call i32 @test_range1(i32 [[TMP0]]) ; IS__TUNIT____-NEXT: br label [[TMP8:%.*]] ; IS__TUNIT____: 6: -; IS__TUNIT____-NEXT: [[TMP7:%.*]] = call noundef i32 @test_range2(i32 [[TMP0]]) #[[ATTR1]], !range [[RNG1:![0-9]+]] +; IS__TUNIT____-NEXT: [[TMP7:%.*]] = call i32 @test_range2(i32 [[TMP0]]) ; IS__TUNIT____-NEXT: br label [[TMP8]] ; IS__TUNIT____: 8: ; IS__TUNIT____-NEXT: [[DOT0:%.*]] = phi i32 [ [[TMP5]], [[TMP4]] ], [ [[TMP7]], [[TMP6]] ] @@ -110,7 +110,7 @@ define i32 @test(i32 %0, i32 %1) #0 { define i32 @test_pcheck1(i32 %0) #0 { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_pcheck1 ; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) #[[ATTR1]], !range [[RNG2:![0-9]+]] +; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 101 ; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32 ; IS__TUNIT____-NEXT: ret i32 [[TMP4]] @@ -131,7 +131,7 @@ define i32 @test_pcheck1(i32 %0) #0 { define i32 @test_pcheck2(i32 %0) #0 { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_pcheck2 ; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) #[[ATTR1]], !range [[RNG2]] +; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 99 ; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32 ; IS__TUNIT____-NEXT: ret i32 [[TMP4]] @@ -152,7 +152,7 @@ define i32 @test_pcheck2(i32 %0) #0 { define i32 @test_ncheck1(i32 %0) #0 { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_ncheck1 ; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) #[[ATTR1]], !range [[RNG2]] +; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 50 ; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32 ; IS__TUNIT____-NEXT: ret i32 [[TMP4]] @@ -173,7 +173,7 @@ define i32 @test_ncheck1(i32 %0) #0 { define i32 @test_ncheck2(i32 %0) #0 { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_ncheck2 ; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) #[[ATTR1]], !range [[RNG2]] +; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 150 ; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32 ; IS__TUNIT____-NEXT: ret i32 [[TMP4]] @@ -197,13 +197,9 @@ attributes #0 = { noinline nounwind sspstrong uwtable} ; IS__TUNIT_____: !1 = !{i32 100, i32 201} ;. ; IS__TUNIT____: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone sspstrong willreturn uwtable } -; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } +; IS__TUNIT____: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind readnone willreturn } ;. ; IS__CGSCC____: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone sspstrong willreturn uwtable } ; IS__CGSCC____: attributes #[[ATTR1]] = { nofree noinline nosync nounwind readnone sspstrong willreturn uwtable } ; IS__CGSCC____: attributes #[[ATTR2:[0-9]+]] = { readnone willreturn } ;. -; IS__TUNIT____: [[RNG0]] = !{i32 0, i32 101} -; IS__TUNIT____: [[RNG1]] = !{i32 100, i32 201} -; IS__TUNIT____: [[RNG2]] = !{i32 0, i32 201} -;. diff --git a/llvm/test/Transforms/Attributor/cb_liveness_enabled.ll b/llvm/test/Transforms/Attributor/cb_liveness_enabled.ll index 03537c816d22..fe12d16db572 100644 --- a/llvm/test/Transforms/Attributor/cb_liveness_enabled.ll +++ b/llvm/test/Transforms/Attributor/cb_liveness_enabled.ll @@ -68,10 +68,10 @@ define i32 @test(i32 %0, i32 %1) #0 { ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP1]], 0 ; IS__TUNIT____-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP6:%.*]] ; IS__TUNIT____: 4: -; IS__TUNIT____-NEXT: [[TMP5:%.*]] = call noundef i32 @test_range1(i32 [[TMP0]]) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]] +; IS__TUNIT____-NEXT: [[TMP5:%.*]] = call i32 @test_range1(i32 [[TMP0]]) ; IS__TUNIT____-NEXT: br label [[TMP8:%.*]] ; IS__TUNIT____: 6: -; IS__TUNIT____-NEXT: [[TMP7:%.*]] = call noundef i32 @test_range2(i32 [[TMP0]]) #[[ATTR1]], !range [[RNG1:![0-9]+]] +; IS__TUNIT____-NEXT: [[TMP7:%.*]] = call i32 @test_range2(i32 [[TMP0]]) ; IS__TUNIT____-NEXT: br label [[TMP8]] ; IS__TUNIT____: 8: ; IS__TUNIT____-NEXT: [[DOT0:%.*]] = phi i32 [ [[TMP5]], [[TMP4]] ], [ [[TMP7]], [[TMP6]] ] @@ -110,7 +110,7 @@ define i32 @test(i32 %0, i32 %1) #0 { define i32 @test_pcheck1(i32 %0) #0 { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_pcheck1 ; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) #[[ATTR1]], !range [[RNG2:![0-9]+]] +; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 101 ; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32 ; IS__TUNIT____-NEXT: ret i32 [[TMP4]] @@ -134,7 +134,7 @@ define i32 @test_pcheck1(i32 %0) #0 { define i32 @test_pcheck2(i32 %0) #0 { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_pcheck2 ; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) #[[ATTR1]], !range [[RNG2]] +; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 99 ; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32 ; IS__TUNIT____-NEXT: ret i32 [[TMP4]] @@ -155,7 +155,7 @@ define i32 @test_pcheck2(i32 %0) #0 { define i32 @test_ncheck1(i32 %0) #0 { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_ncheck1 ; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) #[[ATTR1]], !range [[RNG2]] +; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 50 ; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32 ; IS__TUNIT____-NEXT: ret i32 [[TMP4]] @@ -176,7 +176,7 @@ define i32 @test_ncheck1(i32 %0) #0 { define i32 @test_ncheck2(i32 %0) #0 { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_ncheck2 ; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) #[[ATTR1]], !range [[RNG2]] +; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 150 ; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32 ; IS__TUNIT____-NEXT: ret i32 [[TMP4]] @@ -200,13 +200,9 @@ attributes #0 = { noinline nounwind sspstrong uwtable} ; IS__TUNIT_____: !1 = !{i32 100, i32 201} ;. ; IS__TUNIT____: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone sspstrong willreturn uwtable } -; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } +; IS__TUNIT____: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind readnone willreturn } ;. ; IS__CGSCC____: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone sspstrong willreturn uwtable } ; IS__CGSCC____: attributes #[[ATTR1]] = { nofree noinline nosync nounwind readnone sspstrong willreturn uwtable } ; IS__CGSCC____: attributes #[[ATTR2:[0-9]+]] = { readnone willreturn } ;. -; IS__TUNIT____: [[RNG0]] = !{i32 0, i32 101} -; IS__TUNIT____: [[RNG1]] = !{i32 100, i32 201} -; IS__TUNIT____: [[RNG2]] = !{i32 0, i32 201} -;. diff --git a/llvm/test/Transforms/Attributor/cb_range_disabled.ll b/llvm/test/Transforms/Attributor/cb_range_disabled.ll index 4a925549bc24..ce5eb4ae54a0 100644 --- a/llvm/test/Transforms/Attributor/cb_range_disabled.ll +++ b/llvm/test/Transforms/Attributor/cb_range_disabled.ll @@ -24,7 +24,7 @@ define i32 @test_range(i32 %unknown) { define i32 @test1(i32 %unknown, i32 %b) { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test1 ; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]], i32 [[B:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]]) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]] +; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]]) ; IS__TUNIT____-NEXT: [[TMP2:%.*]] = sub nsw i32 [[TMP1]], [[B]] ; IS__TUNIT____-NEXT: ret i32 [[TMP2]] ; @@ -42,7 +42,7 @@ define i32 @test1(i32 %unknown, i32 %b) { define i32 @test2(i32 %unknown, i32 %b) { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test2 ; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]], i32 [[B:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]]) #[[ATTR1]], !range [[RNG0]] +; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]]) ; IS__TUNIT____-NEXT: [[TMP2:%.*]] = add nsw i32 [[TMP1]], [[B]] ; IS__TUNIT____-NEXT: ret i32 [[TMP2]] ; @@ -146,11 +146,9 @@ define i32 @test2_ncheck(i32 %unknown) { } ;. ; IS__TUNIT____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } -; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } +; IS__TUNIT____: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind readnone willreturn } ;. ; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } ; IS__CGSCC____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } ; IS__CGSCC____: attributes #[[ATTR2:[0-9]+]] = { readnone willreturn } ;. -; IS__TUNIT____: [[RNG0]] = !{i32 0, i32 101} -;. diff --git a/llvm/test/Transforms/Attributor/cb_range_enabled.ll b/llvm/test/Transforms/Attributor/cb_range_enabled.ll index d61009a37122..b41539e74c60 100644 --- a/llvm/test/Transforms/Attributor/cb_range_enabled.ll +++ b/llvm/test/Transforms/Attributor/cb_range_enabled.ll @@ -24,7 +24,7 @@ define i32 @test_range(i32 %unknown) { define i32 @test1(i32 %unknown, i32 %b) { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test1 ; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]], i32 [[B:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]]) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]] +; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]]) ; IS__TUNIT____-NEXT: [[TMP2:%.*]] = sub nsw i32 [[TMP1]], [[B]] ; IS__TUNIT____-NEXT: ret i32 [[TMP2]] ; @@ -42,7 +42,7 @@ define i32 @test1(i32 %unknown, i32 %b) { define i32 @test2(i32 %unknown, i32 %b) { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test2 ; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]], i32 [[B:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]]) #[[ATTR1]], !range [[RNG0]] +; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]]) ; IS__TUNIT____-NEXT: [[TMP2:%.*]] = add nsw i32 [[TMP1]], [[B]] ; IS__TUNIT____-NEXT: ret i32 [[TMP2]] ; @@ -66,7 +66,10 @@ define i32 @test2(i32 %unknown, i32 %b) { define i32 @test1_pcheck(i32 %unknown) { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test1_pcheck ; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: ret i32 1 +; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test1(i32 [[UNKNOWN]], i32 noundef 20) +; IS__TUNIT____-NEXT: [[TMP2:%.*]] = icmp sle i32 [[TMP1]], 90 +; IS__TUNIT____-NEXT: [[TMP3:%.*]] = zext i1 [[TMP2]] to i32 +; IS__TUNIT____-NEXT: ret i32 [[TMP3]] ; ; IS__CGSCC____-LABEL: define {{[^@]+}}@test1_pcheck ; IS__CGSCC____-SAME: (i32 [[UNKNOWN:%.*]]) #[[ATTR1]] { @@ -84,7 +87,10 @@ define i32 @test1_pcheck(i32 %unknown) { define i32 @test2_pcheck(i32 %unknown) { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_pcheck ; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: ret i32 1 +; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test2(i32 [[UNKNOWN]], i32 noundef 20) +; IS__TUNIT____-NEXT: [[TMP2:%.*]] = icmp sge i32 [[TMP1]], 20 +; IS__TUNIT____-NEXT: [[TMP3:%.*]] = zext i1 [[TMP2]] to i32 +; IS__TUNIT____-NEXT: ret i32 [[TMP3]] ; ; IS__CGSCC____-LABEL: define {{[^@]+}}@test2_pcheck ; IS__CGSCC____-SAME: (i32 [[UNKNOWN:%.*]]) #[[ATTR1]] { @@ -104,7 +110,7 @@ define i32 @test2_pcheck(i32 %unknown) { define i32 @test1_ncheck(i32 %unknown) { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test1_ncheck ; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test1(i32 [[UNKNOWN]], i32 noundef 20) #[[ATTR1]], !range [[RNG1:![0-9]+]] +; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test1(i32 [[UNKNOWN]], i32 noundef 20) ; IS__TUNIT____-NEXT: [[TMP2:%.*]] = icmp sle i32 [[TMP1]], 10 ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = zext i1 [[TMP2]] to i32 ; IS__TUNIT____-NEXT: ret i32 [[TMP3]] @@ -125,7 +131,7 @@ define i32 @test1_ncheck(i32 %unknown) { define i32 @test2_ncheck(i32 %unknown) { ; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_ncheck ; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test2(i32 [[UNKNOWN]], i32 noundef 20) #[[ATTR1]], !range [[RNG2:![0-9]+]] +; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test2(i32 [[UNKNOWN]], i32 noundef 20) ; IS__TUNIT____-NEXT: [[TMP2:%.*]] = icmp sge i32 [[TMP1]], 30 ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = zext i1 [[TMP2]] to i32 ; IS__TUNIT____-NEXT: ret i32 [[TMP3]] @@ -144,13 +150,9 @@ define i32 @test2_ncheck(i32 %unknown) { } ;. ; IS__TUNIT____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } -; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } +; IS__TUNIT____: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind readnone willreturn } ;. ; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } ; IS__CGSCC____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } ; IS__CGSCC____: attributes #[[ATTR2:[0-9]+]] = { readnone willreturn } ;. -; IS__TUNIT____: [[RNG0]] = !{i32 0, i32 101} -; IS__TUNIT____: [[RNG1]] = !{i32 -20, i32 81} -; IS__TUNIT____: [[RNG2]] = !{i32 20, i32 121} -;. diff --git a/llvm/test/Transforms/Attributor/depgraph.ll b/llvm/test/Transforms/Attributor/depgraph.ll index 0769bc0d6e35..48d11a76e313 100644 --- a/llvm/test/Transforms/Attributor/depgraph.ll +++ b/llvm/test/Transforms/Attributor/depgraph.ll @@ -22,12 +22,12 @@ define i32* @checkAndAdvance(i32* align 16 %0) { ; CHECK-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP7:%.*]] ; CHECK: 4: ; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 4 -; CHECK-NEXT: [[TMP6:%.*]] = call nonnull align 16 i32* @checkAndAdvance(i32* nofree nonnull readonly align 16 [[TMP5]]) #[[ATTR1:[0-9]+]] +; CHECK-NEXT: [[TMP6:%.*]] = call i32* @checkAndAdvance(i32* nofree nonnull readonly align 16 [[TMP5]]) #[[ATTR1:[0-9]+]] ; CHECK-NEXT: br label [[TMP8:%.*]] ; CHECK: 7: ; CHECK-NEXT: br label [[TMP8]] ; CHECK: 8: -; CHECK-NEXT: [[DOT0:%.*]] = phi i32* [ [[TMP6]], [[TMP4]] ], [ [[TMP0]], [[TMP7]] ] +; CHECK-NEXT: [[DOT0:%.*]] = phi i32* [ [[TMP5]], [[TMP4]] ], [ [[TMP0]], [[TMP7]] ] ; CHECK-NEXT: ret i32* [[DOT0]] ; %2 = load i32, i32* %0, align 4 @@ -53,29 +53,19 @@ define i32* @checkAndAdvance(i32* align 16 %0) { ; GRAPH: [AAIsDead] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state Live[#BB 4/4][#TBEP 0][#KDE 1] ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAValueSimplify] for CtxI ' %3 = icmp eq i32 %2, 0' at position {flt: [@-1]} with state not-simple +; GRAPH-NEXT: [AAPotentialValues] for CtxI ' %3 = icmp eq i32 %2, 0' at position {flt: [@-1]} with state set-state(< { %3 = icmp eq i32 %2, 0[3], } >) ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAValueSimplify] for CtxI ' %2 = load i32, i32* %0, align 4' at position {flt: [@-1]} with state not-simple +; GRAPH-NEXT: [AAPotentialValues] for CtxI ' %2 = load i32, i32* %0, align 4' at position {flt: [@-1]} with state set-state(< { %2 = load i32, i32* %0, align 4[3], } >) ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAValueSimplify] for CtxI ' %2 = load i32, i32* %0, align 4' at position {arg: [@0]} with state not-simple +; GRAPH-NEXT: [AAPotentialValues] for CtxI ' %2 = load i32, i32* %0, align 4' at position {arg: [@0]} with state set-state(< {i32* %0[3], } >) ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAValueConstantRange] for CtxI ' %2 = load i32, i32* %0, align 4' at position {flt: [@-1]} with state range(32) -; GRAPH-EMPTY: -; GRAPH-NEXT: [AAPotentialConstantValues] for CtxI ' %2 = load i32, i32* %0, align 4' at position {flt: [@-1]} with state set-state(< {full-set} >) -; GRAPH-EMPTY: -; GRAPH-NEXT: [AAValueSimplify] for CtxI <> at position {flt: [@-1]} with state not-simple -; GRAPH-EMPTY: -; GRAPH-NEXT: [AAValueConstantRange] for CtxI ' %3 = icmp eq i32 %2, 0' at position {flt: [@-1]} with state range(1) -; GRAPH-EMPTY: -; GRAPH-NEXT: [AAValueConstantRange] for CtxI <> at position {flt: [@-1]} with state range(32)<[0,1) / [0,1)> -; GRAPH-EMPTY: -; GRAPH-NEXT: [AAPotentialConstantValues] for CtxI ' %3 = icmp eq i32 %2, 0' at position {flt: [@-1]} with state set-state(< {full-set} >) +; GRAPH-NEXT: [AAPotentialValues] for CtxI <> at position {flt: [@-1]} with state set-state(< {i32 0[3], } >) ; GRAPH-EMPTY: ; GRAPH-NEXT: [AANoReturn] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs: [@-1]} with state may-return ; GRAPH-EMPTY: ; GRAPH-NEXT: [AANoReturn] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state may-return ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAIsDead] for CtxI ' ret i32* %.0' at position {flt: [@-1]} with state assumed-live +; GRAPH-NEXT: [AAIsDead] for CtxI ' ret i32* %.0' at position {flt: [@-1]} with state assumed-live ; GRAPH-EMPTY: ; GRAPH-NEXT: [AAWillReturn] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state may-noreturn ; GRAPH-EMPTY: @@ -122,21 +112,35 @@ define i32* @checkAndAdvance(i32* align 16 %0) { ; GRAPH-NEXT: updates [AAMemoryBehavior] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state readonly ; GRAPH-NEXT: updates [AAMemoryBehavior] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state readonly ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAValueSimplify] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_ret: [@-1]} with state not-simple +; GRAPH-NEXT: [AAPotentialValues] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_ret: [@-1]} with state set-state(< { %5 = getelementptr inbounds i32, i32* %0, i64 4[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], } >) +; GRAPH-NEXT: updates [AAPotentialValues] for CtxI ' %.0 = phi i32* [ %6, %4 ], [ %0, %7 ]' at position {flt:.0 [.0@-1]} with state set-state(< {i32* %0[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], } >) +; GRAPH-NEXT: updates [AAPotentialValues] for CtxI ' %.0 = phi i32* [ %6, %4 ], [ %0, %7 ]' at position {flt:.0 [.0@-1]} with state set-state(< {i32* %0[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], } >) +; GRAPH-NEXT: updates [AAPotentialValues] for CtxI ' %.0 = phi i32* [ %6, %4 ], [ %0, %7 ]' at position {flt:.0 [.0@-1]} with state set-state(< {i32* %0[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], } >) +; GRAPH-NEXT: updates [AAPotentialValues] for CtxI ' %.0 = phi i32* [ %6, %4 ], [ %0, %7 ]' at position {flt:.0 [.0@-1]} with state set-state(< {i32* %0[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], } >) +; GRAPH-EMPTY: +; GRAPH-NEXT: [AAPotentialValues] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state set-state(< {i32* %0[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], } >) +; GRAPH-NEXT: updates [AAPotentialValues] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_ret: [@-1]} with state set-state(< { %5 = getelementptr inbounds i32, i32* %0, i64 4[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], } >) +; GRAPH-NEXT: updates [AAPotentialValues] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_ret: [@-1]} with state set-state(< { %5 = getelementptr inbounds i32, i32* %0, i64 4[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], } >) ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAReturnedValues] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state returns(#3) +; GRAPH-NEXT: [AAReturnedValues] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state may-return(#2) +; GRAPH-NEXT: updates [AANoCapture] for CtxI ' %2 = load i32, i32* %0, align 4' at position {arg: [@0]} with state assumed not-captured-maybe-returned +; GRAPH-NEXT: updates [AANonNull] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state nonnull +; GRAPH-NEXT: updates [AAAlign] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state align<1-16> +; GRAPH-NEXT: updates [AAPotentialValues] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state set-state(< {i32* %0[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], } >) +; GRAPH-NEXT: updates [AAPotentialValues] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state set-state(< {i32* %0[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], } >) ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAValueSimplify] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_arg: [@0]} with state simplified +; GRAPH-NEXT: [AAPotentialValues] for CtxI ' %.0 = phi i32* [ %6, %4 ], [ %0, %7 ]' at position {flt:.0 [.0@-1]} with state set-state(< {i32* %0[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], %5 = getelementptr inbounds i32, i32* %0, i64 4[3], } >) +; GRAPH-NEXT: updates [AAReturnedValues] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state may-return(#2) ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAValueSimplify] for CtxI ' %5 = getelementptr inbounds i32, i32* %0, i64 4' at position {flt: [@-1]} with state not-simple +; GRAPH-NEXT: [AAPotentialValues] for CtxI ' %5 = getelementptr inbounds i32, i32* %0, i64 4' at position {flt: [@-1]} with state set-state(< { %5 = getelementptr inbounds i32, i32* %0, i64 4[3], } >) ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAValueSimplify] for CtxI <> at position {flt: [@-1]} with state not-simple +; GRAPH-NEXT: [AAPotentialValues] for CtxI <> at position {flt: [@-1]} with state set-state(< {i64 4[3], } >) ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAIsDead] for CtxI ' br label %8' at position {flt: [@-1]} with state assumed-live +; GRAPH-NEXT: [AAPotentialValues] for CtxI ' %2 = load i32, i32* %0, align 4' at position {flt:checkAndAdvance [checkAndAdvance@-1]} with state set-state(< {@checkAndAdvance[3], } >) ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAWillReturn] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs: [@-1]} with state may-noreturn +; GRAPH-NEXT: [AAPotentialValues] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_arg: [@0]} with state set-state(< { %5 = getelementptr inbounds i32, i32* %0, i64 4[3], } >) ; GRAPH-EMPTY: -; GRAPH-NEXT: [AANoRecurse] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs: [@-1]} with state may-recurse +; GRAPH-NEXT: [AAInstanceInfo] for CtxI ' %5 = getelementptr inbounds i32, i32* %0, i64 4' at position {flt: [@-1]} with state ; GRAPH-EMPTY: ; GRAPH-NEXT: [AANoRecurse] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state may-recurse ; GRAPH-EMPTY: @@ -146,6 +150,12 @@ define i32* @checkAndAdvance(i32* align 16 %0) { ; GRAPH-EMPTY: ; GRAPH-NEXT: [AACallEdges] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs: [@-1]} with state CallEdges[0,1] ; GRAPH-EMPTY: +; GRAPH-NEXT: [AAIsDead] for CtxI ' br label %8' at position {flt: [@-1]} with state assumed-live +; GRAPH-EMPTY: +; GRAPH-NEXT: [AAWillReturn] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs: [@-1]} with state may-noreturn +; GRAPH-EMPTY: +; GRAPH-NEXT: [AANoRecurse] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs: [@-1]} with state may-recurse +; GRAPH-EMPTY: ; GRAPH-NEXT: [AAUndefinedBehavior] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state undefined-behavior ; GRAPH-EMPTY: ; GRAPH-NEXT: [AANoUndef] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_arg: [@0]} with state may-undef-or-poison @@ -176,17 +186,11 @@ define i32* @checkAndAdvance(i32* align 16 %0) { ; GRAPH-NEXT: updates [AANoFree] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state nofree ; GRAPH-NEXT: updates [AANoFree] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state nofree ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAAssumptionInfo] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state Known [], Assumed [] +; GRAPH-NEXT: [AAAssumptionInfo] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state Known [], Assumed [] ; GRAPH-EMPTY: ; GRAPH-NEXT: [AAHeapToStack] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn:checkAndAdvance [checkAndAdvance@-1]} with state [H2S] Mallocs Good/Bad: 0/0 ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAValueSimplify] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state simplified -; GRAPH-EMPTY: -; GRAPH-NEXT: [AAValueSimplify] for CtxI ' %.0 = phi i32* [ %6, %4 ], [ %0, %7 ]' at position {flt:.0 [.0@-1]} with state not-simple -; GRAPH-EMPTY: ; GRAPH-NEXT: [AAAlign] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state align<1-16> -; GRAPH-NEXT: updates [AAAlign] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_ret: [@-1]} with state align<1-16> -; GRAPH-NEXT: updates [AAAlign] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_ret: [@-1]} with state align<1-16> ; GRAPH-EMPTY: ; GRAPH-NEXT: [AAAlign] for CtxI ' %2 = load i32, i32* %0, align 4' at position {arg: [@0]} with state align<16-16> ; GRAPH-EMPTY: @@ -195,8 +199,6 @@ define i32* @checkAndAdvance(i32* align 16 %0) { ; GRAPH-NEXT: [AAAlign] for CtxI ' %5 = getelementptr inbounds i32, i32* %0, i64 4' at position {flt: [@-1]} with state align<16-16> ; GRAPH-EMPTY: ; GRAPH-NEXT: [AANonNull] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state nonnull -; GRAPH-NEXT: updates [AANonNull] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_ret: [@-1]} with state nonnull -; GRAPH-NEXT: updates [AANonNull] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_ret: [@-1]} with state nonnull ; GRAPH-EMPTY: ; GRAPH-NEXT: [AANonNull] for CtxI ' %2 = load i32, i32* %0, align 4' at position {arg: [@0]} with state nonnull ; GRAPH-EMPTY: @@ -205,7 +207,7 @@ define i32* @checkAndAdvance(i32* align 16 %0) { ; GRAPH-NEXT: [AADereferenceable] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state unknown-dereferenceable ; GRAPH-EMPTY: ; GRAPH-NEXT: [AADereferenceable] for CtxI ' %2 = load i32, i32* %0, align 4' at position {arg: [@0]} with state dereferenceable<4-4> -; GRAPH-NEXT: updates [AADereferenceable] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_arg: [@0]} with state unknown-dereferenceable +; GRAPH-NEXT: updates [AADereferenceable] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_arg: [@0]} with state unknown-dereferenceable ; GRAPH-EMPTY: ; GRAPH-NEXT: [AADereferenceable] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_arg: [@0]} with state unknown-dereferenceable ; GRAPH-EMPTY: @@ -214,12 +216,9 @@ define i32* @checkAndAdvance(i32* align 16 %0) { ; GRAPH-NEXT: [AANonNull] for CtxI ' %5 = getelementptr inbounds i32, i32* %0, i64 4' at position {flt: [@-1]} with state nonnull ; GRAPH-NEXT: updates [AANonNull] for CtxI ' %5 = getelementptr inbounds i32, i32* %0, i64 4' at position {flt: [@-1]} with state nonnull ; GRAPH-NEXT: updates [AANonNull] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_arg: [@0]} with state nonnull -; GRAPH-NEXT: updates [AANonNull] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state nonnull ; GRAPH-NEXT: updates [AANonNull] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_arg: [@0]} with state nonnull ; GRAPH-NEXT: updates [AANonNull] for CtxI ' %5 = getelementptr inbounds i32, i32* %0, i64 4' at position {flt: [@-1]} with state nonnull ; GRAPH-NEXT: updates [AANonNull] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state nonnull -; GRAPH-NEXT: updates [AANonNull] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state nonnull -; GRAPH-NEXT: updates [AANonNull] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state nonnull ; GRAPH-EMPTY: ; GRAPH-NEXT: [AAIsDead] for CtxI ' %2 = load i32, i32* %0, align 4' at position {arg: [@0]} with state assumed-live ; GRAPH-EMPTY: @@ -257,7 +256,7 @@ define i32* @checkAndAdvance(i32* align 16 %0) { ; GRAPH-EMPTY: ; GRAPH-NEXT: [AAPrivatizablePtr] for CtxI ' %2 = load i32, i32* %0, align 4' at position {arg: [@0]} with state [no-priv] ; GRAPH-EMPTY: -; GRAPH-NEXT: [AAAssumptionInfo] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs: [@-1]} with state Known [], Assumed [] +; GRAPH-NEXT: [AAAssumptionInfo] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs: [@-1]} with state Known [], Assumed [] ; GRAPH-EMPTY: ; GRAPH-NEXT: [AANoAlias] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_arg: [@0]} with state may-alias ; GRAPH-EMPTY: @@ -265,70 +264,121 @@ define i32* @checkAndAdvance(i32* align 16 %0) { ; GRAPH-EMPTY: ; GRAPH-NEXT: [AANoFree] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_arg: [@0]} with state nofree ; GRAPH-EMPTY: -; GRAPH-NEXT: [AADereferenceable] for CtxI ' %5 = getelementptr inbounds i32, i32* %0, i64 4' at position {flt: [@-1]} with state unknown-dereferenceable -; GRAPH-EMPTY: -; GRAPH-NEXT: [AAAlign] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_ret: [@-1]} with state align<1-16> -; GRAPH-NEXT: updates [AAAlign] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state align<1-16> -; GRAPH-EMPTY: -; GRAPH-NEXT: [AANonNull] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position {cs_ret: [@-1]} with state nonnull -; GRAPH-NEXT: updates [AANonNull] for CtxI ' %2 = load i32, i32* %0, align 4' at position {fn_ret:checkAndAdvance [checkAndAdvance@-1]} with state nonnull +; GRAPH-NEXT: [AADereferenceable] for CtxI ' %5 = getelementptr inbounds i32, i32* %0, i64 4' at position {flt: [@-1]} with state unknown-dereferenceable ; GRAPH-NOT: update ; ; Check for .dot file ; +; DOT-DAG: Node[[Node0:0x[a-z0-9]+]] [shape=record,label="{[AAIsDead] +; DOT-DAG: Node[[Node1:0x[a-z0-9]+]] [shape=record,label="{[AAPotentialValues] +; DOT-DAG: Node[[Node2:0x[a-z0-9]+]] [shape=record,label="{[AAPotentialValues] +; DOT-DAG: Node[[Node3:0x[a-z0-9]+]] [shape=record,label="{[AAPotentialValues] +; DOT-DAG: Node[[Node4:0x[a-z0-9]+]] [shape=record,label="{[AAPotentialValues] +; DOT-DAG: Node[[Node5:0x[a-z0-9]+]] [shape=record,label="{[AANoReturn] +; DOT-DAG: Node[[Node6:0x[a-z0-9]+]] [shape=record,label="{[AANoReturn] +; DOT-DAG: Node[[Node7:0x[a-z0-9]+]] [shape=record,label="{[AAIsDead] +; DOT-DAG: Node[[Node8:0x[a-z0-9]+]] [shape=record,label="{[AAWillReturn] +; DOT-DAG: Node[[Node9:0x[a-z0-9]+]] [shape=record,label="{[AAIsDead] +; DOT-DAG: Node[[Node10:0x[a-z0-9]+]] [shape=record,label="{[AANoUnwind] +; DOT-DAG: Node[[Node11:0x[a-z0-9]+]] [shape=record,label="{[AANoUnwind] +; DOT-DAG: Node[[Node12:0x[a-z0-9]+]] [shape=record,label="{[AAMemoryLocation] +; DOT-DAG: Node[[Node13:0x[a-z0-9]+]] [shape=record,label="{[AAMemoryLocation] +; DOT-DAG: Node[[Node14:0x[a-z0-9]+]] [shape=record,label="{[AAMemoryBehavior] +; DOT-DAG: Node[[Node15:0x[a-z0-9]+]] [shape=record,label="{[AAIsDead] +; DOT-DAG: Node[[Node16:0x[a-z0-9]+]] [shape=record,label="{[AAIsDead] +; DOT-DAG: Node[[Node17:0x[a-z0-9]+]] [shape=record,label="{[AAIsDead] +; DOT-DAG: Node[[Node18:0x[a-z0-9]+]] [shape=record,label="{[AAMemoryBehavior] +; DOT-DAG: Node[[Node19:0x[a-z0-9]+]] [shape=record,label="{[AAPotentialValues] +; DOT-DAG: Node[[Node20:0x[a-z0-9]+]] [shape=record,label="{[AAPotentialValues] +; DOT-DAG: Node[[Node21:0x[a-z0-9]+]] [shape=record,label="{[AAReturnedValues] +; DOT-DAG: Node[[Node22:0x[a-z0-9]+]] [shape=record,label="{[AAPotentialValues] +; DOT-DAG: Node[[Node23:0x[a-z0-9]+]] [shape=record,label="{[AAPotentialValues] +; DOT-DAG: Node[[Node24:0x[a-z0-9]+]] [shape=record,label="{[AAPotentialValues] +; DOT-DAG: Node[[Node25:0x[a-z0-9]+]] [shape=record,label="{[AAPotentialValues] +; DOT-DAG: Node[[Node26:0x[a-z0-9]+]] [shape=record,label="{[AAPotentialValues] +; DOT-DAG: Node[[Node27:0x[a-z0-9]+]] [shape=record,label="{[AAInstanceInfo] +; DOT-DAG: Node[[Node28:0x[a-z0-9]+]] [shape=record,label="{[AANoRecurse] +; DOT-DAG: Node[[Node29:0x[a-z0-9]+]] [shape=record,label="{[AAFunctionReachability] +; DOT-DAG: Node[[Node30:0x[a-z0-9]+]] [shape=record,label="{[AACallEdges] +; DOT-DAG: Node[[Node31:0x[a-z0-9]+]] [shape=record,label="{[AACallEdges] +; DOT-DAG: Node[[Node32:0x[a-z0-9]+]] [shape=record,label="{[AAIsDead] +; DOT-DAG: Node[[Node33:0x[a-z0-9]+]] [shape=record,label="{[AAWillReturn] +; DOT-DAG: Node[[Node34:0x[a-z0-9]+]] [shape=record,label="{[AANoRecurse] +; DOT-DAG: Node[[Node35:0x[a-z0-9]+]] [shape=record,label="{[AAUndefinedBehavior] +; DOT-DAG: Node[[Node36:0x[a-z0-9]+]] [shape=record,label="{[AANoUndef] +; DOT-DAG: Node[[Node37:0x[a-z0-9]+]] [shape=record,label="{[AANoUndef] +; DOT-DAG: Node[[Node38:0x[a-z0-9]+]] [shape=record,label="{[AAIsDead] +; DOT-DAG: Node[[Node39:0x[a-z0-9]+]] [shape=record,label="{[AANoUndef] +; DOT-DAG: Node[[Node40:0x[a-z0-9]+]] [shape=record,label="{[AANoUndef] +; DOT-DAG: Node[[Node41:0x[a-z0-9]+]] [shape=record,label="{[AANoSync] +; DOT-DAG: Node[[Node42:0x[a-z0-9]+]] [shape=record,label="{[AANoSync] +; DOT-DAG: Node[[Node43:0x[a-z0-9]+]] [shape=record,label="{[AANoFree] +; DOT-DAG: Node[[Node44:0x[a-z0-9]+]] [shape=record,label="{[AANoFree] +; DOT-DAG: Node[[Node45:0x[a-z0-9]+]] [shape=record,label="{[AAAssumptionInfo] +; DOT-DAG: Node[[Node46:0x[a-z0-9]+]] [shape=record,label="{[AAHeapToStack] +; DOT-DAG: Node[[Node47:0x[a-z0-9]+]] [shape=record,label="{[AAAlign] +; DOT-DAG: Node[[Node48:0x[a-z0-9]+]] [shape=record,label="{[AAAlign] +; DOT-DAG: Node[[Node49:0x[a-z0-9]+]] [shape=record,label="{[AAAlign] +; DOT-DAG: Node[[Node50:0x[a-z0-9]+]] [shape=record,label="{[AAAlign] +; DOT-DAG: Node[[Node51:0x[a-z0-9]+]] [shape=record,label="{[AANonNull] +; DOT-DAG: Node[[Node52:0x[a-z0-9]+]] [shape=record,label="{[AANonNull] +; DOT-DAG: Node[[Node53:0x[a-z0-9]+]] [shape=record,label="{[AANoAlias] +; DOT-DAG: Node[[Node54:0x[a-z0-9]+]] [shape=record,label="{[AADereferenceable] +; DOT-DAG: Node[[Node55:0x[a-z0-9]+]] [shape=record,label="{[AADereferenceable] +; DOT-DAG: Node[[Node56:0x[a-z0-9]+]] [shape=record,label="{[AADereferenceable] +; DOT-DAG: Node[[Node57:0x[a-z0-9]+]] [shape=record,label="{[AANonNull] +; DOT-DAG: Node[[Node58:0x[a-z0-9]+]] [shape=record,label="{[AANonNull] +; DOT-DAG: Node[[Node59:0x[a-z0-9]+]] [shape=record,label="{[AAIsDead] +; DOT-DAG: Node[[Node60:0x[a-z0-9]+]] [shape=record,label="{[AANoAlias] +; DOT-DAG: Node[[Node61:0x[a-z0-9]+]] [shape=record,label="{[AANoCapture] +; DOT-DAG: Node[[Node62:0x[a-z0-9]+]] [shape=record,label="{[AAIsDead] +; DOT-DAG: Node[[Node63:0x[a-z0-9]+]] [shape=record,label="{[AAIsDead] +; DOT-DAG: Node[[Node64:0x[a-z0-9]+]] [shape=record,label="{[AANoCapture] +; DOT-DAG: Node[[Node65:0x[a-z0-9]+]] [shape=record,label="{[AAIsDead] +; DOT-DAG: Node[[Node66:0x[a-z0-9]+]] [shape=record,label="{[AAMemoryBehavior] +; DOT-DAG: Node[[Node67:0x[a-z0-9]+]] [shape=record,label="{[AAMemoryBehavior] +; DOT-DAG: Node[[Node68:0x[a-z0-9]+]] [shape=record,label="{[AANoFree] +; DOT-DAG: Node[[Node69:0x[a-z0-9]+]] [shape=record,label="{[AAPrivatizablePtr] +; DOT-DAG: Node[[Node70:0x[a-z0-9]+]] [shape=record,label="{[AAAssumptionInfo] +; DOT-DAG: Node[[Node71:0x[a-z0-9]+]] [shape=record,label="{[AANoAlias] +; DOT-DAG: Node[[Node72:0x[a-z0-9]+]] [shape=record,label="{[AANoAlias] +; DOT-DAG: Node[[Node73:0x[a-z0-9]+]] [shape=record,label="{[AANoFree] +; DOT-DAG: Node[[Node74:0x[a-z0-9]+]] [shape=record,label="{[AADereferenceable] -; DOT-DAG: Node[[Node6:0x[a-z0-9]+]] [shape=record,label="{[AANoUnwind] for CtxI ' %2 = load i32, i32* %0, align 4' at position \{fn:checkAndAdvance [checkAndAdvance@-1]\} -; DOT-DAG: Node[[Node34:0x[a-z0-9]+]] [shape=record,label="{[AANoCapture] for CtxI ' %2 = load i32, i32* %0, align 4' at position \{arg: [@0]\} -; DOT-DAG: Node[[Node39:0x[a-z0-9]+]] [shape=record,label="{[AANoUnwind] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position \{cs: [@-1]\} -; DOT-DAG: Node[[Node7:0x[a-z0-9]+]] [shape=record,label="{[AANoSync] for CtxI ' %2 = load i32, i32* %0, align 4' at position \{fn:checkAndAdvance [checkAndAdvance@-1]\} -; DOT-DAG: Node[[Node61:0x[a-z0-9]+]] [shape=record,label="{[AANoSync] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position \{cs: [@-1]\} -; DOT-DAG: Node[[Node13:0x[a-z0-9]+]] [shape=record,label="{[AANoFree] for CtxI ' %2 = load i32, i32* %0, align 4' at position \{fn:checkAndAdvance [checkAndAdvance@-1]\} -; DOT-DAG: Node[[Node36:0x[a-z0-9]+]] [shape=record,label="{[AANoFree] for CtxI ' %2 = load i32, i32* %0, align 4' at position \{arg: [@0]\} -; DOT-DAG: Node[[Node62:0x[a-z0-9]+]] [shape=record,label="{[AANoFree] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position \{cs: [@-1]\} -; DOT-DAG: Node[[Node16:0x[a-z0-9]+]] [shape=record,label="{[AAMemoryBehavior] for CtxI ' %2 = load i32, i32* %0, align 4' at position \{fn:checkAndAdvance [checkAndAdvance@-1]\} -; DOT-DAG: Node[[Node35:0x[a-z0-9]+]] [shape=record,label="{[AAMemoryBehavior] for CtxI ' %2 = load i32, i32* %0, align 4' at position \{arg: [@0]\} -; DOT-DAG: Node[[Node40:0x[a-z0-9]+]] [shape=record,label="{[AAMemoryBehavior] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position \{cs: [@-1]\} -; DOT-DAG: Node[[Node17:0x[a-z0-9]+]] [shape=record,label="{[AAMemoryLocation] for CtxI ' %2 = load i32, i32* %0, align 4' at position \{fn:checkAndAdvance [checkAndAdvance@-1]\} -; DOT-DAG: Node[[Node63:0x[a-z0-9]+]] [shape=record,label="{[AAMemoryLocation] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position \{cs: [@-1]\} -; DOT-DAG: Node[[Node22:0x[a-z0-9]+]] [shape=record,label="{[AAAlign] for CtxI ' %2 = load i32, i32* %0, align 4' at position \{fn_ret:checkAndAdvance [checkAndAdvance@-1]\} -; DOT-DAG: Node[[Node65:0x[a-z0-9]+]] [shape=record,label="{[AAAlign] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position \{cs_ret: [@-1]\} -; DOT-DAG: Node[[Node23:0x[a-z0-9]+]] [shape=record,label="{[AANonNull] for CtxI ' %2 = load i32, i32* %0, align 4' at position \{fn_ret:checkAndAdvance [checkAndAdvance@-1]\} -; DOT-DAG: Node[[Node67:0x[a-z0-9]+]] [shape=record,label="{[AANonNull] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position \{cs_ret: [@-1]\} -; DOT-DAG: Node[[Node43:0x[a-z0-9]+]] [shape=record,label="{[AANoCapture] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position \{cs_arg: [@0]\} -; DOT-DAG: Node[[Node45:0x[a-z0-9]+]] [shape=record,label="{[AAMemoryBehavior] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position \{cs_arg: [@0]\} -; DOT-DAG: Node[[Node46:0x[a-z0-9]+]] [shape=record,label="{[AANoFree] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position \{cs_arg: [@0]\} -; DOT-DAG: Node[[Node38:0x[a-z0-9]+]] [shape=record,label="{[AAIsDead] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position \{flt: [@-1]\} -; DOT-DAG: Node[[Node55:0x[a-z0-9]+]] [shape=record,label="{[AANonNull] for CtxI ' %5 = getelementptr inbounds i32, i32* %0, i64 4' at position \{flt: [@-1]\} -; DOT-DAG: Node[[Node31:0x[a-x0-9]+]] [shape=record,label="{[AANonNull] for CtxI ' %6 = call i32* @checkAndAdvance(i32* %5)' at position \{cs_arg: [@0]\} - -; DOT-DAG: Node[[Node6]] -> Node[[Node34]] -; DOT-DAG: Node[[Node6]] -> Node[[Node39]] -; DOT-DAG: Node[[Node7]] -> Node[[Node61]] -; DOT-DAG: Node[[Node13]] -> Node[[Node36]] -; DOT-DAG: Node[[Node13]] -> Node[[Node62]] -; DOT-DAG: Node[[Node16]] -> Node[[Node34]] -; DOT-DAG: Node[[Node16]] -> Node[[Node35]] -; DOT-DAG: Node[[Node16]] -> Node[[Node40]] -; DOT-DAG: Node[[Node17]] -> Node[[Node63]] -; DOT-DAG: Node[[Node22]] -> Node[[Node65]] -; DOT-DAG: Node[[Node23]] -> Node[[Node67]] -; DOT-DAG: Node[[Node34]] -> Node[[Node43]] -; DOT-DAG: Node[[Node35]] -> Node[[Node45]] -; DOT-DAG: Node[[Node36]] -> Node[[Node46]] -; DOT-DAG: Node[[Node39]] -> Node[[Node6]] -; DOT-DAG: Node[[Node40]] -> Node[[Node16]] -; DOT-DAG: Node[[Node43]] -> Node[[Node34]] -; DOT-DAG: Node[[Node45]] -> Node[[Node17]] -; DOT-DAG: Node[[Node55]] -> Node[[Node55]] -; DOT-DAG: Node[[Node55]] -> Node[[Node31]] -; DOT-DAG: Node[[Node55]] -> Node[[Node23]] -; DOT-DAG: Node[[Node61]] -> Node[[Node7]] -; DOT-DAG: Node[[Node62]] -> Node[[Node13]] -; DOT-DAG: Node[[Node63]] -> Node[[Node17]] -; DOT-DAG: Node[[Node65]] -> Node[[Node22]] -; DOT-DAG: Node[[Node67]] -> Node[[Node23]] +; DOT-DAG: Node[[Node20]] -> Node[[Node19]]; +; DOT-DAG: Node[[Node67]] -> Node[[Node13]]; +; DOT-DAG: Node[[Node58]] -> Node[[Node58]]; +; DOT-DAG: Node[[Node13]] -> Node[[Node12]]; +; DOT-DAG: Node[[Node55]] -> Node[[Node56]]; +; DOT-DAG: Node[[Node68]] -> Node[[Node73]]; +; DOT-DAG: Node[[Node61]] -> Node[[Node66]]; +; DOT-DAG: Node[[Node21]] -> Node[[Node20]]; +; DOT-DAG: Node[[Node64]] -> Node[[Node61]]; +; DOT-DAG: Node[[Node14]] -> Node[[Node61]]; +; DOT-DAG: Node[[Node61]] -> Node[[Node64]]; +; DOT-DAG: Node[[Node12]] -> Node[[Node13]]; +; DOT-DAG: Node[[Node11]] -> Node[[Node61]]; +; DOT-DAG: Node[[Node58]] -> Node[[Node51]]; +; DOT-DAG: Node[[Node14]] -> Node[[Node18]]; +; DOT-DAG: Node[[Node22]] -> Node[[Node21]]; +; DOT-DAG: Node[[Node43]] -> Node[[Node68]]; +; DOT-DAG: Node[[Node19]] -> Node[[Node22]]; +; DOT-DAG: Node[[Node21]] -> Node[[Node51]]; +; DOT-DAG: Node[[Node14]] -> Node[[Node66]]; +; DOT-DAG: Node[[Node10]] -> Node[[Node11]]; +; DOT-DAG: Node[[Node41]] -> Node[[Node42]]; +; DOT-DAG: Node[[Node42]] -> Node[[Node41]]; +; DOT-DAG: Node[[Node11]] -> Node[[Node10]]; +; DOT-DAG: Node[[Node21]] -> Node[[Node61]]; +; DOT-DAG: Node[[Node67]] -> Node[[Node66]]; +; DOT-DAG: Node[[Node18]] -> Node[[Node14]]; +; DOT-DAG: Node[[Node58]] -> Node[[Node57]]; +; DOT-DAG: Node[[Node66]] -> Node[[Node67]]; +; DOT-DAG: Node[[Node21]] -> Node[[Node47]]; +; DOT-DAG: Node[[Node44]] -> Node[[Node43]]; +; DOT-DAG: Node[[Node43]] -> Node[[Node44]]; ;. ; CHECK: attributes #[[ATTR0]] = { argmemonly nofree nosync nounwind readonly } ; CHECK: attributes #[[ATTR1]] = { nofree nosync nounwind readonly } diff --git a/llvm/test/Transforms/Attributor/dereferenceable-1.ll b/llvm/test/Transforms/Attributor/dereferenceable-1.ll index fa552f82c6b4..d9bfb1af7a50 100644 --- a/llvm/test/Transforms/Attributor/dereferenceable-1.ll +++ b/llvm/test/Transforms/Attributor/dereferenceable-1.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM ; FIXME: Figure out why we need 16 iterations here. @@ -945,9 +945,10 @@ define void @max_offset(i1 %c) { ; CHECK-NEXT: entry: ; CHECK-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] ; CHECK: t: +; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, i8* bitcast (i64* @g to i8*), i64 2 ; CHECK-NEXT: br label [[F]] ; CHECK: f: -; CHECK-NEXT: [[PHI:%.*]] = phi i8* [ getelementptr (i8, i8* bitcast (i64* @g to i8*), i64 2), [[T]] ], [ bitcast (i64* @g to i8*), [[ENTRY:%.*]] ] +; CHECK-NEXT: [[PHI:%.*]] = phi i8* [ [[GEP]], [[T]] ], [ bitcast (i64* @g to i8*), [[ENTRY:%.*]] ] ; CHECK-NEXT: call void @unknown_use8(i8* noundef align 2 dereferenceable_or_null(6) [[PHI]]) #[[ATTR1]] ; CHECK-NEXT: ret void ; diff --git a/llvm/test/Transforms/Attributor/dereferenceable-2-inseltpoison.ll b/llvm/test/Transforms/Attributor/dereferenceable-2-inseltpoison.ll index b8438a61649c..3b4bc2aa06f1 100644 --- a/llvm/test/Transforms/Attributor/dereferenceable-2-inseltpoison.ll +++ b/llvm/test/Transforms/Attributor/dereferenceable-2-inseltpoison.ll @@ -567,10 +567,11 @@ define i32 @require_cfg_analysis(i32 %c, i32* %p) { ; IS________NPM-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[C]], 0 ; IS________NPM-NEXT: br i1 [[TOBOOL1]], label [[L1:%.*]], label [[L2:%.*]] ; IS________NPM: l1: -; IS________NPM-NEXT: br label [[L4:%.*]] +; IS________NPM-NEXT: [[TOBOOL2:%.*]] = icmp eq i32 [[C]], 1 +; IS________NPM-NEXT: br i1 [[TOBOOL2]], label [[L3:%.*]], label [[L4:%.*]] ; IS________NPM: l2: ; IS________NPM-NEXT: [[TOBOOL3:%.*]] = icmp eq i32 [[C]], 2 -; IS________NPM-NEXT: br i1 [[TOBOOL3]], label [[L3:%.*]], label [[L4]] +; IS________NPM-NEXT: br i1 [[TOBOOL3]], label [[L3]], label [[L4]] ; IS________NPM: l3: ; IS________NPM-NEXT: br label [[L5:%.*]] ; IS________NPM: l4: diff --git a/llvm/test/Transforms/Attributor/dereferenceable-2.ll b/llvm/test/Transforms/Attributor/dereferenceable-2.ll index effa35057772..ab4796235c5a 100644 --- a/llvm/test/Transforms/Attributor/dereferenceable-2.ll +++ b/llvm/test/Transforms/Attributor/dereferenceable-2.ll @@ -567,10 +567,11 @@ define i32 @require_cfg_analysis(i32 %c, i32* %p) { ; IS________NPM-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[C]], 0 ; IS________NPM-NEXT: br i1 [[TOBOOL1]], label [[L1:%.*]], label [[L2:%.*]] ; IS________NPM: l1: -; IS________NPM-NEXT: br label [[L4:%.*]] +; IS________NPM-NEXT: [[TOBOOL2:%.*]] = icmp eq i32 [[C]], 1 +; IS________NPM-NEXT: br i1 [[TOBOOL2]], label [[L3:%.*]], label [[L4:%.*]] ; IS________NPM: l2: ; IS________NPM-NEXT: [[TOBOOL3:%.*]] = icmp eq i32 [[C]], 2 -; IS________NPM-NEXT: br i1 [[TOBOOL3]], label [[L3:%.*]], label [[L4]] +; IS________NPM-NEXT: br i1 [[TOBOOL3]], label [[L3]], label [[L4]] ; IS________NPM: l3: ; IS________NPM-NEXT: br label [[L5:%.*]] ; IS________NPM: l4: diff --git a/llvm/test/Transforms/Attributor/heap_to_stack.ll b/llvm/test/Transforms/Attributor/heap_to_stack.ll index 58c046dd1c08..cff172b0459f 100644 --- a/llvm/test/Transforms/Attributor/heap_to_stack.ll +++ b/llvm/test/Transforms/Attributor/heap_to_stack.ll @@ -34,7 +34,8 @@ define void @h2s_value_simplify_interaction(i1 %c, i8* %A) { ; IS________OPM-LABEL: define {{[^@]+}}@h2s_value_simplify_interaction ; IS________OPM-SAME: (i1 [[C:%.*]], i8* nocapture nofree readnone [[A:%.*]]) { ; IS________OPM-NEXT: entry: -; IS________OPM-NEXT: [[M:%.*]] = tail call noalias align 16 i8* @malloc(i64 noundef 4) +; IS________OPM-NEXT: [[ADD:%.*]] = add i64 2, 2 +; IS________OPM-NEXT: [[M:%.*]] = tail call noalias align 16 i8* @malloc(i64 noundef [[ADD]]) ; IS________OPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] ; IS________OPM: t: ; IS________OPM-NEXT: br i1 false, label [[DEAD:%.*]], label [[F2:%.*]] @@ -57,21 +58,22 @@ define void @h2s_value_simplify_interaction(i1 %c, i8* %A) { ; IS________NPM-LABEL: define {{[^@]+}}@h2s_value_simplify_interaction ; IS________NPM-SAME: (i1 [[C:%.*]], i8* nocapture nofree readnone [[A:%.*]]) { ; IS________NPM-NEXT: entry: -; IS________NPM-NEXT: [[M_H2S:%.*]] = alloca i8, i64 4, align 16 +; IS________NPM-NEXT: [[ADD:%.*]] = add i64 2, 2 +; IS________NPM-NEXT: [[M:%.*]] = tail call noalias align 16 i8* @malloc(i64 noundef [[ADD]]) ; IS________NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] ; IS________NPM: t: ; IS________NPM-NEXT: br i1 false, label [[DEAD:%.*]], label [[F2:%.*]] ; IS________NPM: f: ; IS________NPM-NEXT: br label [[J:%.*]] ; IS________NPM: f2: -; IS________NPM-NEXT: [[L:%.*]] = load i8, i8* [[M_H2S]], align 16 +; IS________NPM-NEXT: [[L:%.*]] = load i8, i8* [[M]], align 16 ; IS________NPM-NEXT: call void @usei8(i8 [[L]]) -; IS________NPM-NEXT: call void @no_sync_func(i8* nocapture nofree noundef align 16 [[M_H2S]]) #[[ATTR6:[0-9]+]] +; IS________NPM-NEXT: call void @no_sync_func(i8* nocapture nofree noundef align 16 [[M]]) #[[ATTR6:[0-9]+]] ; IS________NPM-NEXT: br label [[J]] ; IS________NPM: dead: ; IS________NPM-NEXT: unreachable ; IS________NPM: j: -; IS________NPM-NEXT: [[PHI:%.*]] = phi i8* [ [[M_H2S]], [[F]] ], [ null, [[F2]] ] +; IS________NPM-NEXT: [[PHI:%.*]] = phi i8* [ [[M]], [[F]] ], [ null, [[F2]] ] ; IS________NPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree noundef align 16 [[PHI]]) #[[ATTR6]] ; IS________NPM-NEXT: ret void ; @@ -587,9 +589,8 @@ define i32 @irreducible_cfg(i32 %0) { ; IS________NPM-NEXT: [[TMP13]] = add nsw i32 [[DOT1]], 1 ; IS________NPM-NEXT: br label [[TMP7]] ; IS________NPM: 14: -; IS________NPM-NEXT: [[TMP15:%.*]] = bitcast i32* [[TMP2]] to i8* -; IS________NPM-NEXT: [[TMP16:%.*]] = load i32, i32* [[TMP2]], align 4 -; IS________NPM-NEXT: ret i32 [[TMP16]] +; IS________NPM-NEXT: [[TMP15:%.*]] = load i32, i32* [[TMP2]], align 4 +; IS________NPM-NEXT: ret i32 [[TMP15]] ; %2 = call noalias i8* @malloc(i64 4) %3 = bitcast i8* %2 to i32* diff --git a/llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll b/llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll index 48518064e0d0..d7edc9d484be 100644 --- a/llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll +++ b/llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll @@ -680,8 +680,8 @@ define void @test17() { ; IS________OPM-NEXT: ret void ; ; IS________NPM-LABEL: define {{[^@]+}}@test17() { -; IS________NPM-NEXT: [[TMP1:%.*]] = alloca i8, i64 4, align 1, addrspace(5) -; IS________NPM-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast i8 addrspace(5)* [[TMP1]] to i8* +; IS________NPM-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 4, align 1, addrspace(5) +; IS________NPM-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast i8 addrspace(5)* [[DOTH2S]] to i8* ; IS________NPM-NEXT: tail call void @usei8(i8* noalias nocapture nofree [[MALLOC_CAST]]) #[[ATTR6:[0-9]+]] ; IS________NPM-NEXT: ret void ; @@ -716,10 +716,10 @@ define void @move_alloca() { ; ; IS________NPM-LABEL: define {{[^@]+}}@move_alloca() { ; IS________NPM-NEXT: entry: -; IS________NPM-NEXT: [[TMP0:%.*]] = alloca i8, i64 4, align 1, addrspace(5) +; IS________NPM-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 4, align 1, addrspace(5) ; IS________NPM-NEXT: br label [[NOT_ENTRY:%.*]] ; IS________NPM: not_entry: -; IS________NPM-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast i8 addrspace(5)* [[TMP0]] to i8* +; IS________NPM-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast i8 addrspace(5)* [[DOTH2S]] to i8* ; IS________NPM-NEXT: tail call void @usei8(i8* noalias nocapture nofree [[MALLOC_CAST]]) #[[ATTR6]] ; IS________NPM-NEXT: ret void ; diff --git a/llvm/test/Transforms/Attributor/internal-noalias.ll b/llvm/test/Transforms/Attributor/internal-noalias.ll index 95046349bb6c..a9b4bb4d178c 100644 --- a/llvm/test/Transforms/Attributor/internal-noalias.ll +++ b/llvm/test/Transforms/Attributor/internal-noalias.ll @@ -1,13 +1,13 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM define dso_local i32 @visible(i32* noalias %A, i32* noalias %B) #0 { ; IS__TUNIT____: Function Attrs: argmemonly nofree noinline norecurse nosync nounwind readonly willreturn uwtable ; IS__TUNIT____-LABEL: define {{[^@]+}}@visible -; IS__TUNIT____-SAME: (i32* noalias nocapture nofree readonly align 4 [[A:%.*]], i32* noalias nocapture nofree readonly align 4 [[B:%.*]]) #[[ATTR0:[0-9]+]] { +; IS__TUNIT____-SAME: (i32* noalias nocapture nofree readonly [[A:%.*]], i32* noalias nocapture nofree readonly align 4 [[B:%.*]]) #[[ATTR0:[0-9]+]] { ; IS__TUNIT____-NEXT: entry: ; IS__TUNIT____-NEXT: [[CALL1:%.*]] = call i32 @noalias_args(i32* noalias nocapture nofree readonly align 4 [[A]], i32* noalias nocapture nofree readonly align 4 [[B]]) #[[ATTR3:[0-9]+]] ; IS__TUNIT____-NEXT: [[CALL2:%.*]] = call i32 @noalias_args_argmem(i32* noalias nocapture nofree readonly align 4 [[A]], i32* noalias nocapture nofree readonly align 4 [[B]]) #[[ATTR3]] @@ -166,7 +166,7 @@ define i32 @visible_local_2() { ; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@visible_local_2 ; IS__CGSCC_NPM-SAME: () #[[ATTR3:[0-9]+]] { -; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call i32 @noalias_args_argmem_ro(i32 noundef 5, i32 noundef 5) #[[ATTR6:[0-9]+]] +; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call i32 @noalias_args_argmem_ro(i32 5, i32 5) #[[ATTR6:[0-9]+]] ; IS__CGSCC_NPM-NEXT: ret i32 [[CALL]] ; %B = alloca i32, align 4 diff --git a/llvm/test/Transforms/Attributor/liveness.ll b/llvm/test/Transforms/Attributor/liveness.ll index 1af967dafd98..9d5d8f9c874d 100644 --- a/llvm/test/Transforms/Attributor/liveness.ll +++ b/llvm/test/Transforms/Attributor/liveness.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=30 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=30 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; TODO: The old pass manager cgscc run is disabled as it causes a crash on windows which is under investigation: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/23151 ; opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM @@ -501,22 +501,22 @@ cleanup: ; FIXME: Should be able to detect undefined behavior. define void @ub(i32* %0) { -; IS________OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly -; IS________OPM-LABEL: define {{[^@]+}}@ub -; IS________OPM-SAME: (i32* nocapture nofree writeonly [[TMP0:%.*]]) #[[ATTR7:[0-9]+]] { -; IS________OPM-NEXT: store i32 0, i32* [[TMP0]], align 4 -; IS________OPM-NEXT: ret void -; -; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly -; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ub -; IS__TUNIT_NPM-SAME: (i32* nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR7:[0-9]+]] { -; IS__TUNIT_NPM-NEXT: store i32 0, i32* undef, align 4294967296 -; IS__TUNIT_NPM-NEXT: ret void +; NOT_CGSCC_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@ub +; NOT_CGSCC_NPM-SAME: (i32* nocapture nofree writeonly [[TMP0:%.*]]) #[[ATTR7:[0-9]+]] { +; NOT_CGSCC_NPM-NEXT: [[POISON:%.*]] = sub nuw i32 0, 1 +; NOT_CGSCC_NPM-NEXT: [[STILL_POISON:%.*]] = and i32 [[POISON]], 0 +; NOT_CGSCC_NPM-NEXT: [[POISON_YET_AGAIN:%.*]] = getelementptr i32, i32* [[TMP0]], i32 [[STILL_POISON]] +; NOT_CGSCC_NPM-NEXT: store i32 0, i32* [[POISON_YET_AGAIN]], align 4 +; NOT_CGSCC_NPM-NEXT: ret void ; ; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly ; IS__CGSCC____-LABEL: define {{[^@]+}}@ub -; IS__CGSCC____-SAME: (i32* nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR9:[0-9]+]] { -; IS__CGSCC____-NEXT: store i32 0, i32* undef, align 4294967296 +; IS__CGSCC____-SAME: (i32* nocapture nofree writeonly [[TMP0:%.*]]) #[[ATTR9:[0-9]+]] { +; IS__CGSCC____-NEXT: [[POISON:%.*]] = sub nuw i32 0, 1 +; IS__CGSCC____-NEXT: [[STILL_POISON:%.*]] = and i32 [[POISON]], 0 +; IS__CGSCC____-NEXT: [[POISON_YET_AGAIN:%.*]] = getelementptr i32, i32* [[TMP0]], i32 [[STILL_POISON]] +; IS__CGSCC____-NEXT: store i32 0, i32* [[POISON_YET_AGAIN]], align 4 ; IS__CGSCC____-NEXT: ret void ; %poison = sub nuw i32 0, 1 ; Results in a poison value. @@ -2284,29 +2284,19 @@ define void @call_via_pointer_with_dead_args(i32* %a, i32* %b, void (i32*, i32*, } define internal void @call_via_pointer_with_dead_args_internal_a(i32* %a, i32* %b, void (i32*, i32*, i32*, i64, i32**)* %fp) { -; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_a -; NOT_CGSCC_NPM-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) { -; NOT_CGSCC_NPM-NEXT: call void poison(i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null) -; NOT_CGSCC_NPM-NEXT: ret void -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_a -; IS__CGSCC____-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull [[FP:%.*]]) { -; IS__CGSCC____-NEXT: call void [[FP]](i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null) -; IS__CGSCC____-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_a +; CHECK-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) { +; CHECK-NEXT: call void poison(i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null) +; CHECK-NEXT: ret void ; call void %fp(i32* %a, i32* %b, i32* %a, i64 -1, i32** null) ret void } define internal void @call_via_pointer_with_dead_args_internal_b(i32* %a, i32* %b, void (i32*, i32*, i32*, i64, i32**)* %fp) { -; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_b -; NOT_CGSCC_NPM-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) { -; NOT_CGSCC_NPM-NEXT: call void poison(i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null) -; NOT_CGSCC_NPM-NEXT: ret void -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_b -; IS__CGSCC____-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull [[FP:%.*]]) { -; IS__CGSCC____-NEXT: call void [[FP]](i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null) -; IS__CGSCC____-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_b +; CHECK-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) { +; CHECK-NEXT: call void poison(i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null) +; CHECK-NEXT: ret void ; call void %fp(i32* %a, i32* %b, i32* %a, i64 -1, i32** null) ret void @@ -2332,8 +2322,8 @@ define void @call_via_pointer_with_dead_args_caller(i32* %a, i32* %b) { ; IS__CGSCC____-NEXT: [[PTR4:%.*]] = alloca i32, align 128 ; IS__CGSCC____-NEXT: call void @call_via_pointer_with_dead_args(i32* [[A]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR1]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull @called_via_pointer) ; IS__CGSCC____-NEXT: call void @call_via_pointer_with_dead_args(i32* [[A]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR2]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull @called_via_pointer_internal_1) -; IS__CGSCC____-NEXT: call void @call_via_pointer_with_dead_args_internal_a(i32* [[B]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR3]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull @called_via_pointer) -; IS__CGSCC____-NEXT: call void @call_via_pointer_with_dead_args_internal_b(i32* [[B]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR4]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull @called_via_pointer_internal_2) +; IS__CGSCC____-NEXT: call void @call_via_pointer_with_dead_args_internal_a(i32* [[B]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR3]]) +; IS__CGSCC____-NEXT: call void @call_via_pointer_with_dead_args_internal_b(i32* [[B]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR4]]) ; IS__CGSCC____-NEXT: ret void ; %ptr1 = alloca i32, align 128 @@ -2375,7 +2365,7 @@ entry: ; FIXME: Figure out why the MODULE has the unused arguments still define internal void @called_via_pointer_internal_2(i32* %a, i32* %b, i32* %c, i64 %d, i32** %e) { ; IS__CGSCC____-LABEL: define {{[^@]+}}@called_via_pointer_internal_2 -; IS__CGSCC____-SAME: (i32* [[A:%.*]], i32* nocapture nofree readnone [[B:%.*]], i32* nocapture nofree readnone [[C:%.*]], i64 [[D:%.*]], i32** nocapture nofree readnone [[E:%.*]]) { +; IS__CGSCC____-SAME: (i32* [[A:%.*]], i32* [[B:%.*]], i32* [[C:%.*]], i64 [[D:%.*]], i32** [[E:%.*]]) { ; IS__CGSCC____-NEXT: entry: ; IS__CGSCC____-NEXT: tail call void @use_i32p(i32* [[A]]) ; IS__CGSCC____-NEXT: tail call void @use_i32p(i32* [[A]]) @@ -2668,7 +2658,7 @@ declare void @llvm.lifetime.end.p0i8(i64 %0, i8* %1) ; NOT_CGSCC_NPM: attributes #[[ATTR4]] = { noreturn } ; NOT_CGSCC_NPM: attributes #[[ATTR5]] = { nosync readnone } ; NOT_CGSCC_NPM: attributes #[[ATTR6]] = { argmemonly nofree norecurse nounwind willreturn uwtable } -; NOT_CGSCC_NPM: attributes #[[ATTR7:[0-9]+]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } +; NOT_CGSCC_NPM: attributes #[[ATTR7]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } ; NOT_CGSCC_NPM: attributes #[[ATTR8]] = { nofree norecurse noreturn nosync nounwind readnone } ; NOT_CGSCC_NPM: attributes #[[ATTR9]] = { nofree nosync nounwind readnone willreturn } ; NOT_CGSCC_NPM: attributes #[[ATTR10]] = { nofree nosync nounwind willreturn } diff --git a/llvm/test/Transforms/Attributor/lvi-after-jumpthreading.ll b/llvm/test/Transforms/Attributor/lvi-after-jumpthreading.ll index 8cb27115ce26..6d9ee5e17dd1 100644 --- a/llvm/test/Transforms/Attributor/lvi-after-jumpthreading.ll +++ b/llvm/test/Transforms/Attributor/lvi-after-jumpthreading.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=13 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=13 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM @@ -28,11 +28,12 @@ define i8 @test1(i32 %a, i32 %length) { ; IS________NPM-NEXT: br label [[LOOP:%.*]] ; IS________NPM: loop: ; IS________NPM-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ] -; IS________NPM-NEXT: br label [[BACKEDGE]] +; IS________NPM-NEXT: [[CND:%.*]] = icmp sge i32 [[IV]], 0 +; IS________NPM-NEXT: br i1 [[CND]], label [[BACKEDGE]], label [[EXIT:%.*]] ; IS________NPM: backedge: ; IS________NPM-NEXT: [[IV_NEXT]] = add nsw i32 [[IV]], 1 ; IS________NPM-NEXT: [[CONT:%.*]] = icmp slt i32 [[IV_NEXT]], 400 -; IS________NPM-NEXT: br i1 [[CONT]], label [[LOOP]], label [[EXIT:%.*]] +; IS________NPM-NEXT: br i1 [[CONT]], label [[LOOP]], label [[EXIT]] ; IS________NPM: exit: ; IS________NPM-NEXT: ret i8 0 ; @@ -84,8 +85,10 @@ define i8 @test2(i32 %n) { ; IS________NPM: loop: ; IS________NPM-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ] ; IS________NPM-NEXT: [[IV2:%.*]] = phi i32 [ [[N]], [[ENTRY]] ], [ [[IV2_NEXT:%.*]], [[BACKEDGE]] ] +; IS________NPM-NEXT: [[CND1:%.*]] = icmp sge i32 [[IV]], 0 ; IS________NPM-NEXT: [[CND2:%.*]] = icmp sgt i32 [[IV2]], 0 -; IS________NPM-NEXT: br i1 [[CND2]], label [[BACKEDGE]], label [[EXIT:%.*]] +; IS________NPM-NEXT: [[CND:%.*]] = and i1 [[CND1]], [[CND2]] +; IS________NPM-NEXT: br i1 [[CND]], label [[BACKEDGE]], label [[EXIT:%.*]] ; IS________NPM: backedge: ; IS________NPM-NEXT: [[IV_NEXT]] = add nsw i32 [[IV]], 1 ; IS________NPM-NEXT: [[IV2_NEXT]] = sub nsw i32 [[IV2]], 1 @@ -122,46 +125,26 @@ exit: ; Merging cont block into do block. define i32 @test3(i32 %i, i1 %f, i32 %n) { -; IS________OPM-LABEL: define {{[^@]+}}@test3 -; IS________OPM-SAME: (i32 [[I:%.*]], i1 [[F:%.*]], i32 [[N:%.*]]) { -; IS________OPM-NEXT: entry: -; IS________OPM-NEXT: [[C:%.*]] = icmp ne i32 [[I]], -2134 -; IS________OPM-NEXT: br i1 [[C]], label [[DO:%.*]], label [[EXIT:%.*]] -; IS________OPM: exit: -; IS________OPM-NEXT: [[C1:%.*]] = icmp ne i32 [[I]], -42 -; IS________OPM-NEXT: br i1 [[C1]], label [[EXIT2:%.*]], label [[EXIT]] -; IS________OPM: cont: -; IS________OPM-NEXT: [[COND_3:%.*]] = icmp sgt i32 [[I]], [[N]] -; IS________OPM-NEXT: br i1 [[COND_3]], label [[EXIT2]], label [[EXIT]] -; IS________OPM: do: -; IS________OPM-NEXT: [[COND_0:%.*]] = icmp sgt i32 [[I]], 0 -; IS________OPM-NEXT: [[CONSUME:%.*]] = call i32 @consume(i1 [[COND_0]]) -; IS________OPM-NEXT: [[COND:%.*]] = icmp eq i32 [[I]], 0 -; IS________OPM-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[COND]]) [ "deopt"() ] -; IS________OPM-NEXT: [[COND_2:%.*]] = icmp sgt i32 [[I]], 0 -; IS________OPM-NEXT: br i1 [[COND_2]], label [[EXIT]], label [[CONT:%.*]] -; IS________OPM: exit2: -; IS________OPM-NEXT: ret i32 30 -; -; IS________NPM-LABEL: define {{[^@]+}}@test3 -; IS________NPM-SAME: (i32 [[I:%.*]], i1 [[F:%.*]], i32 [[N:%.*]]) { -; IS________NPM-NEXT: entry: -; IS________NPM-NEXT: [[C:%.*]] = icmp ne i32 [[I]], -2134 -; IS________NPM-NEXT: br i1 [[C]], label [[DO:%.*]], label [[EXIT:%.*]] -; IS________NPM: exit: -; IS________NPM-NEXT: [[C1:%.*]] = icmp ne i32 [[I]], -42 -; IS________NPM-NEXT: br i1 [[C1]], label [[EXIT2:%.*]], label [[EXIT]] -; IS________NPM: cont: -; IS________NPM-NEXT: [[COND_3:%.*]] = icmp sgt i32 [[I]], [[N]] -; IS________NPM-NEXT: br i1 [[COND_3]], label [[EXIT2]], label [[EXIT]] -; IS________NPM: do: -; IS________NPM-NEXT: [[COND_0:%.*]] = icmp sgt i32 [[I]], 0 -; IS________NPM-NEXT: [[CONSUME:%.*]] = call i32 @consume(i1 [[COND_0]]) -; IS________NPM-NEXT: [[COND:%.*]] = icmp eq i32 [[I]], 0 -; IS________NPM-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[COND]]) [ "deopt"() ] -; IS________NPM-NEXT: br label [[CONT:%.*]] -; IS________NPM: exit2: -; IS________NPM-NEXT: ret i32 30 +; CHECK-LABEL: define {{[^@]+}}@test3 +; CHECK-SAME: (i32 [[I:%.*]], i1 [[F:%.*]], i32 [[N:%.*]]) { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[C:%.*]] = icmp ne i32 [[I]], -2134 +; CHECK-NEXT: br i1 [[C]], label [[DO:%.*]], label [[EXIT:%.*]] +; CHECK: exit: +; CHECK-NEXT: [[C1:%.*]] = icmp ne i32 [[I]], -42 +; CHECK-NEXT: br i1 [[C1]], label [[EXIT2:%.*]], label [[EXIT]] +; CHECK: cont: +; CHECK-NEXT: [[COND_3:%.*]] = icmp sgt i32 [[I]], [[N]] +; CHECK-NEXT: br i1 [[COND_3]], label [[EXIT2]], label [[EXIT]] +; CHECK: do: +; CHECK-NEXT: [[COND_0:%.*]] = icmp sgt i32 [[I]], 0 +; CHECK-NEXT: [[CONSUME:%.*]] = call i32 @consume(i1 [[COND_0]]) +; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[I]], 0 +; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[COND]]) [ "deopt"() ] +; CHECK-NEXT: [[COND_2:%.*]] = icmp sgt i32 [[I]], 0 +; CHECK-NEXT: br i1 [[COND_2]], label [[EXIT]], label [[CONT:%.*]] +; CHECK: exit2: +; CHECK-NEXT: ret i32 30 ; entry: %c = icmp ne i32 %i, -2134 diff --git a/llvm/test/Transforms/Attributor/lvi-for-ashr.ll b/llvm/test/Transforms/Attributor/lvi-for-ashr.ll index a30fe1faff92..41e3a8fc138e 100644 --- a/llvm/test/Transforms/Attributor/lvi-for-ashr.ll +++ b/llvm/test/Transforms/Attributor/lvi-for-ashr.ll @@ -7,45 +7,26 @@ ; FIXME: DOT should be replaced with 3 define i32 @test-ashr(i32 %c) { -; IS________OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS________OPM-LABEL: define {{[^@]+}}@test-ashr -; IS________OPM-SAME: (i32 [[C:%.*]]) #[[ATTR0:[0-9]+]] { -; IS________OPM-NEXT: chk65: -; IS________OPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[C]], 65 -; IS________OPM-NEXT: br i1 [[CMP]], label [[RETURN:%.*]], label [[CHK0:%.*]] -; IS________OPM: chk0: -; IS________OPM-NEXT: [[CMP1:%.*]] = icmp slt i32 [[C]], 0 -; IS________OPM-NEXT: br i1 [[CMP]], label [[RETURN]], label [[BB_IF:%.*]] -; IS________OPM: bb_if: -; IS________OPM-NEXT: [[ASHR_VAL:%.*]] = ashr exact i32 [[C]], 2 -; IS________OPM-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[ASHR_VAL]], 15 -; IS________OPM-NEXT: br i1 [[CMP2]], label [[BB_THEN:%.*]], label [[RETURN]] -; IS________OPM: bb_then: -; IS________OPM-NEXT: [[CMP3:%.*]] = icmp eq i32 [[ASHR_VAL]], 16 -; IS________OPM-NEXT: [[DOT:%.*]] = select i1 [[CMP3]], i32 3, i32 2 -; IS________OPM-NEXT: br label [[RETURN]] -; IS________OPM: return: -; IS________OPM-NEXT: [[RETVAL:%.*]] = phi i32 [ 0, [[CHK65:%.*]] ], [ 1, [[CHK0]] ], [ [[DOT]], [[BB_THEN]] ], [ 4, [[BB_IF]] ] -; IS________OPM-NEXT: ret i32 [[RETVAL]] -; -; IS________NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS________NPM-LABEL: define {{[^@]+}}@test-ashr -; IS________NPM-SAME: (i32 [[C:%.*]]) #[[ATTR0:[0-9]+]] { -; IS________NPM-NEXT: chk65: -; IS________NPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[C]], 65 -; IS________NPM-NEXT: br i1 [[CMP]], label [[RETURN:%.*]], label [[CHK0:%.*]] -; IS________NPM: chk0: -; IS________NPM-NEXT: [[CMP1:%.*]] = icmp slt i32 [[C]], 0 -; IS________NPM-NEXT: br i1 [[CMP]], label [[RETURN]], label [[BB_IF:%.*]] -; IS________NPM: bb_if: -; IS________NPM-NEXT: [[ASHR_VAL:%.*]] = ashr exact i32 [[C]], 2 -; IS________NPM-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[ASHR_VAL]], 15 -; IS________NPM-NEXT: br i1 [[CMP2]], label [[BB_THEN:%.*]], label [[RETURN]] -; IS________NPM: bb_then: -; IS________NPM-NEXT: br label [[RETURN]] -; IS________NPM: return: -; IS________NPM-NEXT: [[RETVAL:%.*]] = phi i32 [ 0, [[CHK65:%.*]] ], [ 1, [[CHK0]] ], [ 3, [[BB_THEN]] ], [ 4, [[BB_IF]] ] -; IS________NPM-NEXT: ret i32 [[RETVAL]] +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@test-ashr +; CHECK-SAME: (i32 [[C:%.*]]) #[[ATTR0:[0-9]+]] { +; CHECK-NEXT: chk65: +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[C]], 65 +; CHECK-NEXT: br i1 [[CMP]], label [[RETURN:%.*]], label [[CHK0:%.*]] +; CHECK: chk0: +; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[C]], 0 +; CHECK-NEXT: br i1 [[CMP]], label [[RETURN]], label [[BB_IF:%.*]] +; CHECK: bb_if: +; CHECK-NEXT: [[ASHR_VAL:%.*]] = ashr exact i32 [[C]], 2 +; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[ASHR_VAL]], 15 +; CHECK-NEXT: br i1 [[CMP2]], label [[BB_THEN:%.*]], label [[RETURN]] +; CHECK: bb_then: +; CHECK-NEXT: [[CMP3:%.*]] = icmp eq i32 [[ASHR_VAL]], 16 +; CHECK-NEXT: [[DOT:%.*]] = select i1 [[CMP3]], i32 3, i32 2 +; CHECK-NEXT: br label [[RETURN]] +; CHECK: return: +; CHECK-NEXT: [[RETVAL:%.*]] = phi i32 [ 0, [[CHK65:%.*]] ], [ 1, [[CHK0]] ], [ [[DOT]], [[BB_THEN]] ], [ 4, [[BB_IF]] ] +; CHECK-NEXT: ret i32 [[RETVAL]] ; chk65: %cmp = icmp sgt i32 %c, 65 @@ -70,5 +51,5 @@ return: ret i32 %retval } ;. -; CHECK: attributes #[[ATTR0:[0-9]+]] = { nofree norecurse nosync nounwind readnone willreturn } +; CHECK: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } ;. diff --git a/llvm/test/Transforms/Attributor/memory_locations.ll b/llvm/test/Transforms/Attributor/memory_locations.ll index 9937dd649c5c..853a865bd3f7 100644 --- a/llvm/test/Transforms/Attributor/memory_locations.ll +++ b/llvm/test/Transforms/Attributor/memory_locations.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=10 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=10 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" @@ -528,6 +528,7 @@ define internal i8 @recursive_not_readnone_internal(i8* %ptr, i1 %c) { ; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i8 @recursive_not_readnone_internal(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 noundef false) #[[ATTR11]] ; IS__TUNIT____-NEXT: ret i8 1 ; IS__TUNIT____: f: +; IS__TUNIT____-NEXT: store i8 1, i8* [[PTR]], align 1 ; IS__TUNIT____-NEXT: ret i8 0 ; ; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind writeonly @@ -558,14 +559,14 @@ define i8 @readnone_caller(i1 %c) { ; IS__TUNIT____-LABEL: define {{[^@]+}}@readnone_caller ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR9:[0-9]+]] { ; IS__TUNIT____-NEXT: [[A:%.*]] = alloca i8, align 1 -; IS__TUNIT____-NEXT: [[R:%.*]] = call noundef i8 @recursive_not_readnone_internal(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[A]], i1 [[C]]) #[[ATTR11]], !range [[RNG0:![0-9]+]] +; IS__TUNIT____-NEXT: [[R:%.*]] = call i8 @recursive_not_readnone_internal(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[A]], i1 [[C]]) #[[ATTR11]] ; IS__TUNIT____-NEXT: ret i8 [[R]] ; ; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone ; IS__CGSCC____-LABEL: define {{[^@]+}}@readnone_caller ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR10:[0-9]+]] { ; IS__CGSCC____-NEXT: [[A:%.*]] = alloca i8, align 1 -; IS__CGSCC____-NEXT: [[R:%.*]] = call noundef i8 @recursive_not_readnone_internal(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[A]], i1 [[C]]) #[[ATTR13:[0-9]+]] +; IS__CGSCC____-NEXT: [[R:%.*]] = call i8 @recursive_not_readnone_internal(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[A]], i1 [[C]]) #[[ATTR13:[0-9]+]] ; IS__CGSCC____-NEXT: ret i8 [[R]] ; %a = alloca i8 @@ -583,6 +584,7 @@ define internal i8 @recursive_readnone_internal2(i8* %ptr, i1 %c) { ; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i8 @recursive_readnone_internal2(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 noundef false) #[[ATTR11]] ; IS__TUNIT____-NEXT: ret i8 1 ; IS__TUNIT____: f: +; IS__TUNIT____-NEXT: store i8 1, i8* [[PTR]], align 1 ; IS__TUNIT____-NEXT: ret i8 0 ; ; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind writeonly @@ -594,6 +596,7 @@ define internal i8 @recursive_readnone_internal2(i8* %ptr, i1 %c) { ; IS__CGSCC____-NEXT: [[TMP1:%.*]] = call i8 @recursive_readnone_internal2(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 noundef false) #[[ATTR12]] ; IS__CGSCC____-NEXT: ret i8 1 ; IS__CGSCC____: f: +; IS__CGSCC____-NEXT: store i8 1, i8* [[PTR]], align 1 ; IS__CGSCC____-NEXT: ret i8 0 ; %alloc = alloca i8 @@ -611,13 +614,13 @@ define i8 @readnone_caller2(i1 %c) { ; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone ; IS__TUNIT____-LABEL: define {{[^@]+}}@readnone_caller2 ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR9]] { -; IS__TUNIT____-NEXT: [[R:%.*]] = call noundef i8 @recursive_readnone_internal2(i8* undef, i1 [[C]]) #[[ATTR11]], !range [[RNG0]] +; IS__TUNIT____-NEXT: [[R:%.*]] = call i8 @recursive_readnone_internal2(i8* undef, i1 [[C]]) #[[ATTR11]] ; IS__TUNIT____-NEXT: ret i8 [[R]] ; ; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone ; IS__CGSCC____-LABEL: define {{[^@]+}}@readnone_caller2 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR10]] { -; IS__CGSCC____-NEXT: [[R:%.*]] = call noundef i8 @recursive_readnone_internal2(i8* undef, i1 [[C]]) #[[ATTR13]] +; IS__CGSCC____-NEXT: [[R:%.*]] = call i8 @recursive_readnone_internal2(i8* undef, i1 [[C]]) #[[ATTR13]] ; IS__CGSCC____-NEXT: ret i8 [[R]] ; %r = call i8 @recursive_readnone_internal2(i8* undef, i1 %c) @@ -634,6 +637,7 @@ define internal i8 @recursive_not_readnone_internal3(i8* %ptr, i1 %c) { ; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i8 @recursive_not_readnone_internal3(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 noundef false) #[[ATTR11]] ; IS__TUNIT____-NEXT: ret i8 1 ; IS__TUNIT____: f: +; IS__TUNIT____-NEXT: store i8 1, i8* [[PTR]], align 1 ; IS__TUNIT____-NEXT: ret i8 0 ; ; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind writeonly @@ -664,14 +668,14 @@ define i8 @readnone_caller3(i1 %c) { ; IS__TUNIT____-LABEL: define {{[^@]+}}@readnone_caller3 ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR9]] { ; IS__TUNIT____-NEXT: [[ALLOC:%.*]] = alloca i8, align 1 -; IS__TUNIT____-NEXT: [[R:%.*]] = call noundef i8 @recursive_not_readnone_internal3(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 [[C]]) #[[ATTR11]], !range [[RNG0]] +; IS__TUNIT____-NEXT: [[R:%.*]] = call i8 @recursive_not_readnone_internal3(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 [[C]]) #[[ATTR11]] ; IS__TUNIT____-NEXT: ret i8 [[R]] ; ; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone ; IS__CGSCC____-LABEL: define {{[^@]+}}@readnone_caller3 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR10]] { ; IS__CGSCC____-NEXT: [[ALLOC:%.*]] = alloca i8, align 1 -; IS__CGSCC____-NEXT: [[R:%.*]] = call noundef i8 @recursive_not_readnone_internal3(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 [[C]]) #[[ATTR13]] +; IS__CGSCC____-NEXT: [[R:%.*]] = call i8 @recursive_not_readnone_internal3(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 [[C]]) #[[ATTR13]] ; IS__CGSCC____-NEXT: ret i8 [[R]] ; %alloc = alloca i8 @@ -735,5 +739,3 @@ define void @argmemonky_caller() { ; IS__CGSCC____: attributes #[[ATTR12]] = { nofree nosync nounwind writeonly } ; IS__CGSCC____: attributes #[[ATTR13]] = { nounwind writeonly } ;. -; IS__TUNIT____: [[RNG0]] = !{i8 0, i8 2} -;. diff --git a/llvm/test/Transforms/Attributor/noalias.ll b/llvm/test/Transforms/Attributor/noalias.ll index 6b49c3e1f7e1..0116afd9471f 100644 --- a/llvm/test/Transforms/Attributor/noalias.ll +++ b/llvm/test/Transforms/Attributor/noalias.ll @@ -461,13 +461,11 @@ define void @test12_4(){ ; NOT_TUNIT_OPM-LABEL: define {{[^@]+}}@test12_4() { ; NOT_TUNIT_OPM-NEXT: [[A:%.*]] = tail call noalias i8* @malloc(i64 noundef 4) ; NOT_TUNIT_OPM-NEXT: [[B:%.*]] = tail call noalias i8* @malloc(i64 noundef 4) -; NOT_TUNIT_OPM-NEXT: [[A_0:%.*]] = getelementptr i8, i8* [[A]], i64 0 ; NOT_TUNIT_OPM-NEXT: [[A_1:%.*]] = getelementptr i8, i8* [[A]], i64 1 -; NOT_TUNIT_OPM-NEXT: [[B_0:%.*]] = getelementptr i8, i8* [[B]], i64 0 ; NOT_TUNIT_OPM-NEXT: tail call void @two_args(i8* noalias nocapture [[A]], i8* noalias nocapture [[B]]) -; NOT_TUNIT_OPM-NEXT: tail call void @two_args(i8* nocapture [[A]], i8* nocapture [[A_0]]) +; NOT_TUNIT_OPM-NEXT: tail call void @two_args(i8* nocapture [[A]], i8* nocapture [[A]]) ; NOT_TUNIT_OPM-NEXT: tail call void @two_args(i8* nocapture [[A]], i8* nocapture [[A_1]]) -; NOT_TUNIT_OPM-NEXT: tail call void @two_args(i8* nocapture [[A_0]], i8* nocapture [[B_0]]) +; NOT_TUNIT_OPM-NEXT: tail call void @two_args(i8* nocapture [[A]], i8* nocapture [[B]]) ; NOT_TUNIT_OPM-NEXT: ret void ; %A = tail call noalias i8* @malloc(i64 4) @@ -499,17 +497,10 @@ define void @use_i8_internal(i8* %a) { } define void @test13_use_noalias(){ -; IS________OPM-LABEL: define {{[^@]+}}@test13_use_noalias() { -; IS________OPM-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4) -; IS________OPM-NEXT: call void @use_i8_internal(i8* noalias nocapture [[M1]]) -; IS________OPM-NEXT: ret void -; -; NOT_TUNIT_OPM-LABEL: define {{[^@]+}}@test13_use_noalias() { -; NOT_TUNIT_OPM-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4) -; NOT_TUNIT_OPM-NEXT: [[C1:%.*]] = bitcast i8* [[M1]] to i16* -; NOT_TUNIT_OPM-NEXT: [[C2:%.*]] = bitcast i16* [[C1]] to i8* -; NOT_TUNIT_OPM-NEXT: call void @use_i8_internal(i8* noalias nocapture [[C2]]) -; NOT_TUNIT_OPM-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test13_use_noalias() { +; CHECK-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4) +; CHECK-NEXT: call void @use_i8_internal(i8* noalias nocapture [[M1]]) +; CHECK-NEXT: ret void ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test13_use_noalias() ; IS__CGSCC_OPM-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 4) @@ -525,20 +516,11 @@ define void @test13_use_noalias(){ } define void @test13_use_alias(){ -; IS________OPM-LABEL: define {{[^@]+}}@test13_use_alias() { -; IS________OPM-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4) -; IS________OPM-NEXT: call void @use_i8_internal(i8* nocapture [[M1]]) -; IS________OPM-NEXT: call void @use_i8_internal(i8* nocapture [[M1]]) -; IS________OPM-NEXT: ret void -; -; NOT_TUNIT_OPM-LABEL: define {{[^@]+}}@test13_use_alias() { -; NOT_TUNIT_OPM-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4) -; NOT_TUNIT_OPM-NEXT: [[C1:%.*]] = bitcast i8* [[M1]] to i16* -; NOT_TUNIT_OPM-NEXT: [[C2A:%.*]] = bitcast i16* [[C1]] to i8* -; NOT_TUNIT_OPM-NEXT: [[C2B:%.*]] = bitcast i16* [[C1]] to i8* -; NOT_TUNIT_OPM-NEXT: call void @use_i8_internal(i8* nocapture [[C2A]]) -; NOT_TUNIT_OPM-NEXT: call void @use_i8_internal(i8* nocapture [[C2B]]) -; NOT_TUNIT_OPM-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test13_use_alias() { +; CHECK-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4) +; CHECK-NEXT: call void @use_i8_internal(i8* nocapture [[M1]]) +; CHECK-NEXT: call void @use_i8_internal(i8* nocapture [[M1]]) +; CHECK-NEXT: ret void ; %m1 = tail call noalias i8* @malloc(i64 4) %c1 = bitcast i8* %m1 to i16* diff --git a/llvm/test/Transforms/Attributor/nocapture-1.ll b/llvm/test/Transforms/Attributor/nocapture-1.ll index a6cf38646e05..05d6c0e701e8 100644 --- a/llvm/test/Transforms/Attributor/nocapture-1.ll +++ b/llvm/test/Transforms/Attributor/nocapture-1.ll @@ -37,13 +37,13 @@ define void @c3(i32* %q) { ; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly ; IS__TUNIT____-LABEL: define {{[^@]+}}@c3 ; IS__TUNIT____-SAME: (i32* nofree writeonly [[Q:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: call void @c2(i32* nofree writeonly [[Q]]) #[[ATTR16:[0-9]+]] +; IS__TUNIT____-NEXT: call void @c2(i32* nofree writeonly [[Q]]) #[[ATTR14:[0-9]+]] ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn writeonly ; IS__CGSCC____-LABEL: define {{[^@]+}}@c3 ; IS__CGSCC____-SAME: (i32* nofree writeonly [[Q:%.*]]) #[[ATTR2:[0-9]+]] { -; IS__CGSCC____-NEXT: call void @c2(i32* nofree writeonly [[Q]]) #[[ATTR19:[0-9]+]] +; IS__CGSCC____-NEXT: call void @c2(i32* nofree writeonly [[Q]]) #[[ATTR17:[0-9]+]] ; IS__CGSCC____-NEXT: ret void ; call void @c2(i32* %q) @@ -189,14 +189,14 @@ define i1 @c7(i32* %q, i32 %bitno) { ; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readonly willreturn ; IS__TUNIT____-LABEL: define {{[^@]+}}@c7 ; IS__TUNIT____-SAME: (i32* nofree readonly [[Q:%.*]], i32 [[BITNO:%.*]]) #[[ATTR2]] { -; IS__TUNIT____-NEXT: [[PTR:%.*]] = call i1* @lookup_bit(i32* noalias nofree readnone [[Q]], i32 [[BITNO]]) #[[ATTR17:[0-9]+]] +; IS__TUNIT____-NEXT: [[PTR:%.*]] = call i1* @lookup_bit(i32* noalias nofree readnone [[Q]], i32 [[BITNO]]) #[[ATTR15:[0-9]+]] ; IS__TUNIT____-NEXT: [[VAL:%.*]] = load i1, i1* [[PTR]], align 1 ; IS__TUNIT____-NEXT: ret i1 [[VAL]] ; ; IS__CGSCC____: Function Attrs: nofree nosync nounwind readonly willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@c7 ; IS__CGSCC____-SAME: (i32* nofree readonly [[Q:%.*]], i32 [[BITNO:%.*]]) #[[ATTR6:[0-9]+]] { -; IS__CGSCC____-NEXT: [[PTR:%.*]] = call i1* @lookup_bit(i32* noalias nofree readnone [[Q]], i32 [[BITNO]]) #[[ATTR20:[0-9]+]] +; IS__CGSCC____-NEXT: [[PTR:%.*]] = call i1* @lookup_bit(i32* noalias nofree readnone [[Q]], i32 [[BITNO]]) #[[ATTR18:[0-9]+]] ; IS__CGSCC____-NEXT: [[VAL:%.*]] = load i1, i1* [[PTR]], align 1 ; IS__CGSCC____-NEXT: ret i1 [[VAL]] ; @@ -255,7 +255,7 @@ define i32 @nc1_addrspace(i32* %q, i32 addrspace(1)* %p, i1 %b) { ; IS__TUNIT____: l: ; IS__TUNIT____-NEXT: [[X:%.*]] = phi i32 addrspace(1)* [ [[P]], [[E:%.*]] ] ; IS__TUNIT____-NEXT: [[Y:%.*]] = phi i32* [ [[Q]], [[E]] ] -; IS__TUNIT____-NEXT: [[TMP:%.*]] = addrspacecast i32 addrspace(1)* [[X]] to i32* +; IS__TUNIT____-NEXT: [[TMP:%.*]] = addrspacecast i32 addrspace(1)* [[P]] to i32* ; IS__TUNIT____-NEXT: [[TMP2:%.*]] = select i1 [[B]], i32* [[TMP]], i32* [[Q]] ; IS__TUNIT____-NEXT: [[VAL:%.*]] = load i32, i32* [[TMP2]], align 4 ; IS__TUNIT____-NEXT: store i32 0, i32* [[TMP]], align 4 @@ -270,7 +270,7 @@ define i32 @nc1_addrspace(i32* %q, i32 addrspace(1)* %p, i1 %b) { ; IS__CGSCC____: l: ; IS__CGSCC____-NEXT: [[X:%.*]] = phi i32 addrspace(1)* [ [[P]], [[E:%.*]] ] ; IS__CGSCC____-NEXT: [[Y:%.*]] = phi i32* [ [[Q]], [[E]] ] -; IS__CGSCC____-NEXT: [[TMP:%.*]] = addrspacecast i32 addrspace(1)* [[X]] to i32* +; IS__CGSCC____-NEXT: [[TMP:%.*]] = addrspacecast i32 addrspace(1)* [[P]] to i32* ; IS__CGSCC____-NEXT: [[TMP2:%.*]] = select i1 [[B]], i32* [[TMP]], i32* [[Q]] ; IS__CGSCC____-NEXT: [[VAL:%.*]] = load i32, i32* [[TMP2]], align 4 ; IS__CGSCC____-NEXT: store i32 0, i32* [[TMP]], align 4 @@ -294,13 +294,13 @@ define void @nc2(i32* %p, i32* %q) { ; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__TUNIT____-LABEL: define {{[^@]+}}@nc2 ; IS__TUNIT____-SAME: (i32* nocapture nofree [[P:%.*]], i32* nofree [[Q:%.*]]) #[[ATTR5]] { -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @nc1(i32* nofree [[Q]], i32* nocapture nofree [[P]], i1 noundef false) #[[ATTR18:[0-9]+]] +; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @nc1(i32* nofree [[Q]], i32* nocapture nofree [[P]], i1 noundef false) #[[ATTR16:[0-9]+]] ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@nc2 ; IS__CGSCC____-SAME: (i32* nocapture nofree align 4 [[P:%.*]], i32* nofree [[Q:%.*]]) #[[ATTR8:[0-9]+]] { -; IS__CGSCC____-NEXT: [[TMP1:%.*]] = call i32 @nc1(i32* nofree [[Q]], i32* nocapture nofree align 4 [[P]], i1 noundef false) #[[ATTR16:[0-9]+]] +; IS__CGSCC____-NEXT: [[TMP1:%.*]] = call i32 @nc1(i32* nofree [[Q]], i32* nocapture nofree align 4 [[P]], i1 noundef false) #[[ATTR14:[0-9]+]] ; IS__CGSCC____-NEXT: ret void ; %1 = call i32 @nc1(i32* %q, i32* %p, i1 0) ; [#uses=0] @@ -325,13 +325,13 @@ define void @nc4(i8* %p) { ; IS__TUNIT____: Function Attrs: argmemonly nounwind ; IS__TUNIT____-LABEL: define {{[^@]+}}@nc4 ; IS__TUNIT____-SAME: (i8* [[P:%.*]]) #[[ATTR6:[0-9]+]] { -; IS__TUNIT____-NEXT: call void @external(i8* readonly [[P]]) #[[ATTR19:[0-9]+]] +; IS__TUNIT____-NEXT: call void @external(i8* readonly [[P]]) #[[ATTR17:[0-9]+]] ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____: Function Attrs: argmemonly nounwind ; IS__CGSCC____-LABEL: define {{[^@]+}}@nc4 ; IS__CGSCC____-SAME: (i8* [[P:%.*]]) #[[ATTR9:[0-9]+]] { -; IS__CGSCC____-NEXT: call void @external(i8* readonly [[P]]) #[[ATTR21:[0-9]+]] +; IS__CGSCC____-NEXT: call void @external(i8* readonly [[P]]) #[[ATTR19:[0-9]+]] ; IS__CGSCC____-NEXT: ret void ; call void @external(i8* %p) @@ -641,19 +641,19 @@ entry: } define void @nocaptureLaunder(i8* %p) { -; IS__TUNIT____: Function Attrs: inaccessiblemem_or_argmemonly nofree norecurse nosync nounwind willreturn +; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__TUNIT____-LABEL: define {{[^@]+}}@nocaptureLaunder -; IS__TUNIT____-SAME: (i8* nocapture nofree [[P:%.*]]) #[[ATTR9:[0-9]+]] { +; IS__TUNIT____-SAME: (i8* nocapture nofree [[P:%.*]]) #[[ATTR5]] { ; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: [[B:%.*]] = call i8* @llvm.launder.invariant.group.p0i8(i8* nofree [[P]]) #[[ATTR20:[0-9]+]] +; IS__TUNIT____-NEXT: [[B:%.*]] = call i8* @llvm.launder.invariant.group.p0i8(i8* nofree [[P]]) #[[ATTR18:[0-9]+]] ; IS__TUNIT____-NEXT: store i8 42, i8* [[B]], align 1 ; IS__TUNIT____-NEXT: ret void ; -; IS__CGSCC____: Function Attrs: inaccessiblemem_or_argmemonly nofree norecurse nosync nounwind willreturn +; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@nocaptureLaunder -; IS__CGSCC____-SAME: (i8* nocapture nofree [[P:%.*]]) #[[ATTR12:[0-9]+]] { +; IS__CGSCC____-SAME: (i8* nocapture nofree [[P:%.*]]) #[[ATTR7]] { ; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: [[B:%.*]] = call i8* @llvm.launder.invariant.group.p0i8(i8* nofree [[P]]) #[[ATTR22:[0-9]+]] +; IS__CGSCC____-NEXT: [[B:%.*]] = call i8* @llvm.launder.invariant.group.p0i8(i8* nofree [[P]]) #[[ATTR20:[0-9]+]] ; IS__CGSCC____-NEXT: store i8 42, i8* [[B]], align 1 ; IS__CGSCC____-NEXT: ret void ; @@ -668,14 +668,14 @@ define void @captureLaunder(i8* %p) { ; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__TUNIT____-LABEL: define {{[^@]+}}@captureLaunder ; IS__TUNIT____-SAME: (i8* nofree [[P:%.*]]) #[[ATTR5]] { -; IS__TUNIT____-NEXT: [[B:%.*]] = call i8* @llvm.launder.invariant.group.p0i8(i8* nofree [[P]]) #[[ATTR20]] +; IS__TUNIT____-NEXT: [[B:%.*]] = call i8* @llvm.launder.invariant.group.p0i8(i8* nofree [[P]]) #[[ATTR18]] ; IS__TUNIT____-NEXT: store i8* [[B]], i8** @g2, align 8 ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@captureLaunder ; IS__CGSCC____-SAME: (i8* nofree [[P:%.*]]) #[[ATTR7]] { -; IS__CGSCC____-NEXT: [[B:%.*]] = call i8* @llvm.launder.invariant.group.p0i8(i8* nofree [[P]]) #[[ATTR22]] +; IS__CGSCC____-NEXT: [[B:%.*]] = call i8* @llvm.launder.invariant.group.p0i8(i8* nofree [[P]]) #[[ATTR20]] ; IS__CGSCC____-NEXT: store i8* [[B]], i8** @g2, align 8 ; IS__CGSCC____-NEXT: ret void ; @@ -685,19 +685,19 @@ define void @captureLaunder(i8* %p) { } define void @nocaptureStrip(i8* %p) { -; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly ; IS__TUNIT____-LABEL: define {{[^@]+}}@nocaptureStrip -; IS__TUNIT____-SAME: (i8* nocapture nofree writeonly [[P:%.*]]) #[[ATTR10:[0-9]+]] { +; IS__TUNIT____-SAME: (i8* nocapture nofree writeonly [[P:%.*]]) #[[ATTR1]] { ; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: [[B:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* noalias nofree readnone [[P]]) #[[ATTR21:[0-9]+]] +; IS__TUNIT____-NEXT: [[B:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* noalias nofree readnone [[P]]) #[[ATTR19:[0-9]+]] ; IS__TUNIT____-NEXT: store i8 42, i8* [[B]], align 1 ; IS__TUNIT____-NEXT: ret void ; -; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly ; IS__CGSCC____-LABEL: define {{[^@]+}}@nocaptureStrip -; IS__CGSCC____-SAME: (i8* nocapture nofree writeonly [[P:%.*]]) #[[ATTR13:[0-9]+]] { +; IS__CGSCC____-SAME: (i8* nocapture nofree writeonly [[P:%.*]]) #[[ATTR1]] { ; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: [[B:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* noalias nofree readnone [[P]]) #[[ATTR20]] +; IS__CGSCC____-NEXT: [[B:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* noalias nofree readnone [[P]]) #[[ATTR18]] ; IS__CGSCC____-NEXT: store i8 42, i8* [[B]], align 1 ; IS__CGSCC____-NEXT: ret void ; @@ -712,14 +712,14 @@ define void @captureStrip(i8* %p) { ; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly ; IS__TUNIT____-LABEL: define {{[^@]+}}@captureStrip ; IS__TUNIT____-SAME: (i8* nofree writeonly [[P:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: [[B:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* noalias nofree readnone [[P]]) #[[ATTR21]] +; IS__TUNIT____-NEXT: [[B:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* noalias nofree readnone [[P]]) #[[ATTR19]] ; IS__TUNIT____-NEXT: store i8* [[B]], i8** @g3, align 8 ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly ; IS__CGSCC____-LABEL: define {{[^@]+}}@captureStrip ; IS__CGSCC____-SAME: (i8* nofree writeonly [[P:%.*]]) #[[ATTR1]] { -; IS__CGSCC____-NEXT: [[B:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* noalias nofree readnone [[P]]) #[[ATTR20]] +; IS__CGSCC____-NEXT: [[B:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* noalias nofree readnone [[P]]) #[[ATTR18]] ; IS__CGSCC____-NEXT: store i8* [[B]], i8** @g3, align 8 ; IS__CGSCC____-NEXT: ret void ; @@ -790,14 +790,14 @@ define i1 @nocaptureDereferenceableOrNullICmp(i32* dereferenceable_or_null(4) %x define i1 @captureDereferenceableOrNullICmp(i32* dereferenceable_or_null(4) %x) null_pointer_is_valid { ; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind null_pointer_is_valid readnone willreturn ; IS__TUNIT____-LABEL: define {{[^@]+}}@captureDereferenceableOrNullICmp -; IS__TUNIT____-SAME: (i32* nofree readnone dereferenceable_or_null(4) [[X:%.*]]) #[[ATTR11:[0-9]+]] { +; IS__TUNIT____-SAME: (i32* nofree readnone dereferenceable_or_null(4) [[X:%.*]]) #[[ATTR9:[0-9]+]] { ; IS__TUNIT____-NEXT: [[TMP1:%.*]] = bitcast i32* [[X]] to i8* ; IS__TUNIT____-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP1]], null ; IS__TUNIT____-NEXT: ret i1 [[TMP2]] ; ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind null_pointer_is_valid readnone willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@captureDereferenceableOrNullICmp -; IS__CGSCC____-SAME: (i32* nofree readnone dereferenceable_or_null(4) [[X:%.*]]) #[[ATTR14:[0-9]+]] { +; IS__CGSCC____-SAME: (i32* nofree readnone dereferenceable_or_null(4) [[X:%.*]]) #[[ATTR12:[0-9]+]] { ; IS__CGSCC____-NEXT: [[TMP1:%.*]] = bitcast i32* [[X]] to i8* ; IS__CGSCC____-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP1]], null ; IS__CGSCC____-NEXT: ret i1 [[TMP2]] @@ -827,14 +827,14 @@ define i8* @test_returned1(i8* %A, i8* returned %B) nounwind readonly { ; IS__TUNIT____-SAME: (i8* nocapture readonly [[A:%.*]], i8* readonly returned [[B:%.*]]) #[[ATTR4]] { ; IS__TUNIT____-NEXT: entry: ; IS__TUNIT____-NEXT: [[P:%.*]] = call i8* @unknownpi8pi8(i8* [[A]], i8* [[B]]) -; IS__TUNIT____-NEXT: ret i8* [[B]] +; IS__TUNIT____-NEXT: ret i8* [[P]] ; ; IS__CGSCC____: Function Attrs: nounwind readonly ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_returned1 ; IS__CGSCC____-SAME: (i8* nocapture readonly [[A:%.*]], i8* readonly returned [[B:%.*]]) #[[ATTR5]] { ; IS__CGSCC____-NEXT: entry: ; IS__CGSCC____-NEXT: [[P:%.*]] = call i8* @unknownpi8pi8(i8* [[A]], i8* [[B]]) -; IS__CGSCC____-NEXT: ret i8* [[B]] +; IS__CGSCC____-NEXT: ret i8* [[P]] ; entry: %p = call i8* @unknownpi8pi8(i8* %A, i8* %B) @@ -844,17 +844,17 @@ entry: define i8* @test_returned2(i8* %A, i8* %B) { ; IS__TUNIT____: Function Attrs: nounwind readonly ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_returned2 -; IS__TUNIT____-SAME: (i8* nocapture readonly [[A:%.*]], i8* readonly returned [[B:%.*]]) #[[ATTR4]] { +; IS__TUNIT____-SAME: (i8* readonly [[A:%.*]], i8* readonly [[B:%.*]]) #[[ATTR4]] { ; IS__TUNIT____-NEXT: entry: ; IS__TUNIT____-NEXT: [[P:%.*]] = call i8* @unknownpi8pi8(i8* readonly [[A]], i8* readonly [[B]]) #[[ATTR4]] -; IS__TUNIT____-NEXT: ret i8* [[B]] +; IS__TUNIT____-NEXT: ret i8* [[P]] ; ; IS__CGSCC____: Function Attrs: nounwind readonly ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_returned2 -; IS__CGSCC____-SAME: (i8* nocapture readonly [[A:%.*]], i8* readonly returned [[B:%.*]]) #[[ATTR5]] { +; IS__CGSCC____-SAME: (i8* readonly [[A:%.*]], i8* readonly [[B:%.*]]) #[[ATTR5]] { ; IS__CGSCC____-NEXT: entry: ; IS__CGSCC____-NEXT: [[P:%.*]] = call i8* @unknownpi8pi8(i8* readonly [[A]], i8* readonly [[B]]) #[[ATTR5]] -; IS__CGSCC____-NEXT: ret i8* [[B]] +; IS__CGSCC____-NEXT: ret i8* [[P]] ; entry: %p = call i8* @unknownpi8pi8(i8* %A, i8* %B) nounwind readonly @@ -869,13 +869,13 @@ declare void @val_use(i8 %ptr) readonly nounwind willreturn define void @ptr_uses(i8* %ptr, i8* %wptr) { ; IS__TUNIT____: Function Attrs: nounwind willreturn ; IS__TUNIT____-LABEL: define {{[^@]+}}@ptr_uses -; IS__TUNIT____-SAME: (i8* [[PTR:%.*]], i8* nocapture nofree noundef nonnull writeonly dereferenceable(1) [[WPTR:%.*]]) #[[ATTR13:[0-9]+]] { +; IS__TUNIT____-SAME: (i8* [[PTR:%.*]], i8* nocapture nofree noundef nonnull writeonly dereferenceable(1) [[WPTR:%.*]]) #[[ATTR11:[0-9]+]] { ; IS__TUNIT____-NEXT: store i8 0, i8* [[WPTR]], align 1 ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____: Function Attrs: nounwind willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@ptr_uses -; IS__CGSCC____-SAME: (i8* [[PTR:%.*]], i8* nocapture nofree noundef nonnull writeonly dereferenceable(1) [[WPTR:%.*]]) #[[ATTR16]] { +; IS__CGSCC____-SAME: (i8* [[PTR:%.*]], i8* nocapture nofree noundef nonnull writeonly dereferenceable(1) [[WPTR:%.*]]) #[[ATTR14]] { ; IS__CGSCC____-NEXT: store i8 0, i8* [[WPTR]], align 1 ; IS__CGSCC____-NEXT: ret void ; @@ -898,19 +898,17 @@ declare i8* @llvm.strip.invariant.group.p0i8(i8*) ; IS__TUNIT____: attributes #[[ATTR6]] = { argmemonly nounwind } ; IS__TUNIT____: attributes #[[ATTR7]] = { nofree nosync nounwind writeonly } ; IS__TUNIT____: attributes #[[ATTR8]] = { argmemonly nofree norecurse nounwind willreturn } -; IS__TUNIT____: attributes #[[ATTR9]] = { inaccessiblemem_or_argmemonly nofree norecurse nosync nounwind willreturn } -; IS__TUNIT____: attributes #[[ATTR10]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } -; IS__TUNIT____: attributes #[[ATTR11]] = { nofree norecurse nosync nounwind null_pointer_is_valid readnone willreturn } -; IS__TUNIT____: attributes #[[ATTR12:[0-9]+]] = { nounwind readonly willreturn } -; IS__TUNIT____: attributes #[[ATTR13]] = { nounwind willreturn } -; IS__TUNIT____: attributes #[[ATTR14:[0-9]+]] = { inaccessiblememonly nocallback nofree nosync nounwind speculatable willreturn } -; IS__TUNIT____: attributes #[[ATTR15:[0-9]+]] = { nocallback nofree nosync nounwind readnone speculatable willreturn } -; IS__TUNIT____: attributes #[[ATTR16]] = { nofree nosync nounwind willreturn writeonly } -; IS__TUNIT____: attributes #[[ATTR17]] = { nofree nounwind readnone willreturn } -; IS__TUNIT____: attributes #[[ATTR18]] = { nofree nosync nounwind willreturn } -; IS__TUNIT____: attributes #[[ATTR19]] = { nounwind } -; IS__TUNIT____: attributes #[[ATTR20]] = { willreturn } -; IS__TUNIT____: attributes #[[ATTR21]] = { readnone willreturn } +; IS__TUNIT____: attributes #[[ATTR9]] = { nofree norecurse nosync nounwind null_pointer_is_valid readnone willreturn } +; IS__TUNIT____: attributes #[[ATTR10:[0-9]+]] = { nounwind readonly willreturn } +; IS__TUNIT____: attributes #[[ATTR11]] = { nounwind willreturn } +; IS__TUNIT____: attributes #[[ATTR12:[0-9]+]] = { inaccessiblememonly nocallback nofree nosync nounwind speculatable willreturn } +; IS__TUNIT____: attributes #[[ATTR13:[0-9]+]] = { nocallback nofree nosync nounwind readnone speculatable willreturn } +; IS__TUNIT____: attributes #[[ATTR14]] = { nofree nosync nounwind willreturn writeonly } +; IS__TUNIT____: attributes #[[ATTR15]] = { nofree nounwind readnone willreturn } +; IS__TUNIT____: attributes #[[ATTR16]] = { nofree nosync nounwind willreturn } +; IS__TUNIT____: attributes #[[ATTR17]] = { nounwind } +; IS__TUNIT____: attributes #[[ATTR18]] = { willreturn } +; IS__TUNIT____: attributes #[[ATTR19]] = { readnone willreturn } ;. ; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } ; IS__CGSCC____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind willreturn writeonly } @@ -924,15 +922,13 @@ declare i8* @llvm.strip.invariant.group.p0i8(i8*) ; IS__CGSCC____: attributes #[[ATTR9]] = { argmemonly nounwind } ; IS__CGSCC____: attributes #[[ATTR10]] = { nofree nosync nounwind writeonly } ; IS__CGSCC____: attributes #[[ATTR11]] = { argmemonly nofree norecurse nounwind willreturn } -; IS__CGSCC____: attributes #[[ATTR12]] = { inaccessiblemem_or_argmemonly nofree norecurse nosync nounwind willreturn } -; IS__CGSCC____: attributes #[[ATTR13]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } -; IS__CGSCC____: attributes #[[ATTR14]] = { nofree norecurse nosync nounwind null_pointer_is_valid readnone willreturn } -; IS__CGSCC____: attributes #[[ATTR15:[0-9]+]] = { nounwind readonly willreturn } -; IS__CGSCC____: attributes #[[ATTR16]] = { nounwind willreturn } -; IS__CGSCC____: attributes #[[ATTR17:[0-9]+]] = { inaccessiblememonly nocallback nofree nosync nounwind speculatable willreturn } -; IS__CGSCC____: attributes #[[ATTR18:[0-9]+]] = { nocallback nofree nosync nounwind readnone speculatable willreturn } -; IS__CGSCC____: attributes #[[ATTR19]] = { nounwind willreturn writeonly } -; IS__CGSCC____: attributes #[[ATTR20]] = { readnone willreturn } -; IS__CGSCC____: attributes #[[ATTR21]] = { nounwind } -; IS__CGSCC____: attributes #[[ATTR22]] = { willreturn } +; IS__CGSCC____: attributes #[[ATTR12]] = { nofree norecurse nosync nounwind null_pointer_is_valid readnone willreturn } +; IS__CGSCC____: attributes #[[ATTR13:[0-9]+]] = { nounwind readonly willreturn } +; IS__CGSCC____: attributes #[[ATTR14]] = { nounwind willreturn } +; IS__CGSCC____: attributes #[[ATTR15:[0-9]+]] = { inaccessiblememonly nocallback nofree nosync nounwind speculatable willreturn } +; IS__CGSCC____: attributes #[[ATTR16:[0-9]+]] = { nocallback nofree nosync nounwind readnone speculatable willreturn } +; IS__CGSCC____: attributes #[[ATTR17]] = { nounwind willreturn writeonly } +; IS__CGSCC____: attributes #[[ATTR18]] = { readnone willreturn } +; IS__CGSCC____: attributes #[[ATTR19]] = { nounwind } +; IS__CGSCC____: attributes #[[ATTR20]] = { willreturn } ;. diff --git a/llvm/test/Transforms/Attributor/nocapture-2.ll b/llvm/test/Transforms/Attributor/nocapture-2.ll index 6f368e3ed68e..465bcd74d731 100644 --- a/llvm/test/Transforms/Attributor/nocapture-2.ll +++ b/llvm/test/Transforms/Attributor/nocapture-2.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM ; @@ -166,27 +166,49 @@ entry: ; return scc_A((int*)(scc_A(a) ? scc_B((double*)a) : scc_C(a))); ; } define float* @scc_A(i32* dereferenceable_or_null(4) %a) { -; CHECK: Function Attrs: nofree nosync nounwind readnone -; CHECK-LABEL: define {{[^@]+}}@scc_A -; CHECK-SAME: (i32* nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR2:[0-9]+]] { -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32* [[A]], null -; CHECK-NEXT: br i1 [[TOBOOL]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]] -; CHECK: cond.true: -; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[A]] to i16* -; CHECK-NEXT: [[CALL:%.*]] = call dereferenceable_or_null(4) i8* @scc_C(i16* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP0]]) #[[ATTR2]] -; CHECK-NEXT: [[TMP1:%.*]] = bitcast i8* [[CALL]] to double* -; CHECK-NEXT: [[CALL1:%.*]] = call dereferenceable_or_null(4) i64* @scc_B(double* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP1]]) #[[ATTR2]] -; CHECK-NEXT: [[TMP2:%.*]] = bitcast i64* [[CALL1]] to i32* -; CHECK-NEXT: [[CALL2:%.*]] = call dereferenceable_or_null(4) float* @scc_A(i32* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP2]]) #[[ATTR2]] -; CHECK-NEXT: [[TMP3:%.*]] = bitcast float* [[CALL2]] to i32* -; CHECK-NEXT: br label [[COND_END:%.*]] -; CHECK: cond.false: -; CHECK-NEXT: br label [[COND_END]] -; CHECK: cond.end: -; CHECK-NEXT: [[COND:%.*]] = phi i32* [ [[TMP3]], [[COND_TRUE]] ], [ [[A]], [[COND_FALSE]] ] -; CHECK-NEXT: [[TMP4:%.*]] = bitcast i32* [[COND]] to float* -; CHECK-NEXT: ret float* [[TMP4]] +; IS________OPM: Function Attrs: nofree nosync nounwind readnone +; IS________OPM-LABEL: define {{[^@]+}}@scc_A +; IS________OPM-SAME: (i32* nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR2:[0-9]+]] { +; IS________OPM-NEXT: entry: +; IS________OPM-NEXT: [[TOBOOL:%.*]] = icmp ne i32* [[A]], null +; IS________OPM-NEXT: br i1 [[TOBOOL]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]] +; IS________OPM: cond.true: +; IS________OPM-NEXT: [[TMP0:%.*]] = bitcast i32* [[A]] to i16* +; IS________OPM-NEXT: [[CALL:%.*]] = call dereferenceable_or_null(4) i8* @scc_C(i16* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP0]]) #[[ATTR2]] +; IS________OPM-NEXT: [[TMP1:%.*]] = bitcast i8* [[CALL]] to double* +; IS________OPM-NEXT: [[CALL1:%.*]] = call dereferenceable_or_null(4) i64* @scc_B(double* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP1]]) #[[ATTR2]] +; IS________OPM-NEXT: [[TMP2:%.*]] = bitcast i64* [[CALL1]] to i32* +; IS________OPM-NEXT: [[CALL2:%.*]] = call dereferenceable_or_null(4) float* @scc_A(i32* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP2]]) #[[ATTR2]] +; IS________OPM-NEXT: [[TMP3:%.*]] = bitcast float* [[CALL2]] to i32* +; IS________OPM-NEXT: br label [[COND_END:%.*]] +; IS________OPM: cond.false: +; IS________OPM-NEXT: br label [[COND_END]] +; IS________OPM: cond.end: +; IS________OPM-NEXT: [[COND:%.*]] = phi i32* [ [[TMP3]], [[COND_TRUE]] ], [ [[A]], [[COND_FALSE]] ] +; IS________OPM-NEXT: [[TMP4:%.*]] = bitcast i32* [[COND]] to float* +; IS________OPM-NEXT: ret float* [[TMP4]] +; +; IS________NPM: Function Attrs: nofree nosync nounwind readnone +; IS________NPM-LABEL: define {{[^@]+}}@scc_A +; IS________NPM-SAME: (i32* nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR2:[0-9]+]] { +; IS________NPM-NEXT: entry: +; IS________NPM-NEXT: [[TOBOOL:%.*]] = icmp ne i32* [[A]], null +; IS________NPM-NEXT: br i1 [[TOBOOL]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]] +; IS________NPM: cond.true: +; IS________NPM-NEXT: [[TMP0:%.*]] = bitcast i32* [[A]] to i16* +; IS________NPM-NEXT: [[CALL:%.*]] = call dereferenceable_or_null(4) i8* @scc_C(i16* noalias nofree nonnull readnone dereferenceable(4) "no-capture-maybe-returned" [[TMP0]]) #[[ATTR2]] +; IS________NPM-NEXT: [[TMP1:%.*]] = bitcast i8* [[CALL]] to double* +; IS________NPM-NEXT: [[CALL1:%.*]] = call dereferenceable_or_null(4) i64* @scc_B(double* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP1]]) #[[ATTR2]] +; IS________NPM-NEXT: [[TMP2:%.*]] = bitcast i64* [[CALL1]] to i32* +; IS________NPM-NEXT: [[CALL2:%.*]] = call dereferenceable_or_null(4) float* @scc_A(i32* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP2]]) #[[ATTR2]] +; IS________NPM-NEXT: [[TMP3:%.*]] = bitcast float* [[CALL2]] to i32* +; IS________NPM-NEXT: br label [[COND_END:%.*]] +; IS________NPM: cond.false: +; IS________NPM-NEXT: br label [[COND_END]] +; IS________NPM: cond.end: +; IS________NPM-NEXT: [[COND:%.*]] = phi i32* [ [[TMP3]], [[COND_TRUE]] ], [ [[A]], [[COND_FALSE]] ] +; IS________NPM-NEXT: [[TMP4:%.*]] = bitcast i32* [[COND]] to float* +; IS________NPM-NEXT: ret float* [[TMP4]] ; entry: %tobool = icmp ne i32* %a, null @@ -213,27 +235,49 @@ cond.end: ; preds = %cond.false, %cond.t ; FIXME: the call1 below to scc_B should return dereferenceable_or_null(8) (as the callee does). Something prevented that deduction and needs to be investigated. define i64* @scc_B(double* dereferenceable_or_null(8) %a) { -; CHECK: Function Attrs: nofree nosync nounwind readnone -; CHECK-LABEL: define {{[^@]+}}@scc_B -; CHECK-SAME: (double* nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR2]] { -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne double* [[A]], null -; CHECK-NEXT: br i1 [[TOBOOL]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]] -; CHECK: cond.true: -; CHECK-NEXT: [[TMP0:%.*]] = bitcast double* [[A]] to i32* -; CHECK-NEXT: [[CALL:%.*]] = call dereferenceable_or_null(4) float* @scc_A(i32* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP0]]) #[[ATTR2]] -; CHECK-NEXT: [[TMP1:%.*]] = bitcast float* [[CALL]] to double* -; CHECK-NEXT: [[CALL1:%.*]] = call dereferenceable_or_null(4) i64* @scc_B(double* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP1]]) #[[ATTR2]] -; CHECK-NEXT: [[TMP2:%.*]] = bitcast i64* [[CALL1]] to i16* -; CHECK-NEXT: [[CALL2:%.*]] = call dereferenceable_or_null(4) i8* @scc_C(i16* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP2]]) #[[ATTR2]] -; CHECK-NEXT: br label [[COND_END:%.*]] -; CHECK: cond.false: -; CHECK-NEXT: [[TMP3:%.*]] = bitcast double* [[A]] to i8* -; CHECK-NEXT: br label [[COND_END]] -; CHECK: cond.end: -; CHECK-NEXT: [[COND:%.*]] = phi i8* [ [[CALL2]], [[COND_TRUE]] ], [ [[TMP3]], [[COND_FALSE]] ] -; CHECK-NEXT: [[TMP4:%.*]] = bitcast i8* [[COND]] to i64* -; CHECK-NEXT: ret i64* [[TMP4]] +; IS________OPM: Function Attrs: nofree nosync nounwind readnone +; IS________OPM-LABEL: define {{[^@]+}}@scc_B +; IS________OPM-SAME: (double* nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR2]] { +; IS________OPM-NEXT: entry: +; IS________OPM-NEXT: [[TOBOOL:%.*]] = icmp ne double* [[A]], null +; IS________OPM-NEXT: br i1 [[TOBOOL]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]] +; IS________OPM: cond.true: +; IS________OPM-NEXT: [[TMP0:%.*]] = bitcast double* [[A]] to i32* +; IS________OPM-NEXT: [[CALL:%.*]] = call dereferenceable_or_null(4) float* @scc_A(i32* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP0]]) #[[ATTR2]] +; IS________OPM-NEXT: [[TMP1:%.*]] = bitcast float* [[CALL]] to double* +; IS________OPM-NEXT: [[CALL1:%.*]] = call dereferenceable_or_null(4) i64* @scc_B(double* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP1]]) #[[ATTR2]] +; IS________OPM-NEXT: [[TMP2:%.*]] = bitcast i64* [[CALL1]] to i16* +; IS________OPM-NEXT: [[CALL2:%.*]] = call dereferenceable_or_null(4) i8* @scc_C(i16* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP2]]) #[[ATTR2]] +; IS________OPM-NEXT: br label [[COND_END:%.*]] +; IS________OPM: cond.false: +; IS________OPM-NEXT: [[TMP3:%.*]] = bitcast double* [[A]] to i8* +; IS________OPM-NEXT: br label [[COND_END]] +; IS________OPM: cond.end: +; IS________OPM-NEXT: [[COND:%.*]] = phi i8* [ [[CALL2]], [[COND_TRUE]] ], [ [[TMP3]], [[COND_FALSE]] ] +; IS________OPM-NEXT: [[TMP4:%.*]] = bitcast i8* [[COND]] to i64* +; IS________OPM-NEXT: ret i64* [[TMP4]] +; +; IS________NPM: Function Attrs: nofree nosync nounwind readnone +; IS________NPM-LABEL: define {{[^@]+}}@scc_B +; IS________NPM-SAME: (double* nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR2]] { +; IS________NPM-NEXT: entry: +; IS________NPM-NEXT: [[TOBOOL:%.*]] = icmp ne double* [[A]], null +; IS________NPM-NEXT: br i1 [[TOBOOL]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]] +; IS________NPM: cond.true: +; IS________NPM-NEXT: [[TMP0:%.*]] = bitcast double* [[A]] to i32* +; IS________NPM-NEXT: [[CALL:%.*]] = call dereferenceable_or_null(4) float* @scc_A(i32* noalias nofree nonnull readnone dereferenceable(8) "no-capture-maybe-returned" [[TMP0]]) #[[ATTR2]] +; IS________NPM-NEXT: [[TMP1:%.*]] = bitcast float* [[CALL]] to double* +; IS________NPM-NEXT: [[CALL1:%.*]] = call dereferenceable_or_null(4) i64* @scc_B(double* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP1]]) #[[ATTR2]] +; IS________NPM-NEXT: [[TMP2:%.*]] = bitcast i64* [[CALL1]] to i16* +; IS________NPM-NEXT: [[CALL2:%.*]] = call dereferenceable_or_null(4) i8* @scc_C(i16* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP2]]) #[[ATTR2]] +; IS________NPM-NEXT: br label [[COND_END:%.*]] +; IS________NPM: cond.false: +; IS________NPM-NEXT: [[TMP3:%.*]] = bitcast double* [[A]] to i8* +; IS________NPM-NEXT: br label [[COND_END]] +; IS________NPM: cond.end: +; IS________NPM-NEXT: [[COND:%.*]] = phi i8* [ [[CALL2]], [[COND_TRUE]] ], [ [[TMP3]], [[COND_FALSE]] ] +; IS________NPM-NEXT: [[TMP4:%.*]] = bitcast i8* [[COND]] to i64* +; IS________NPM-NEXT: ret i64* [[TMP4]] ; entry: %tobool = icmp ne double* %a, null @@ -261,7 +305,7 @@ cond.end: ; preds = %cond.false, %cond.t define i8* @scc_C(i16* dereferenceable_or_null(2) %a) { ; CHECK: Function Attrs: nofree nosync nounwind readnone ; CHECK-LABEL: define {{[^@]+}}@scc_C -; CHECK-SAME: (i16* nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR2]] { +; CHECK-SAME: (i16* nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR2:[0-9]+]] { ; CHECK-NEXT: entry: ; CHECK-NEXT: [[BC:%.*]] = bitcast i16* [[A]] to i32* ; CHECK-NEXT: [[CALL:%.*]] = call dereferenceable_or_null(4) float* @scc_A(i32* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[BC]]) #[[ATTR2]] @@ -444,10 +488,10 @@ define i64* @negative_test_not_captured_but_returned_call_0a(i64* %a) #0 { ; ; IS__CGSCC____: Function Attrs: argmemonly nofree noinline nosync nounwind willreturn writeonly uwtable ; IS__CGSCC____-LABEL: define {{[^@]+}}@negative_test_not_captured_but_returned_call_0a -; IS__CGSCC____-SAME: (i64* nofree noundef nonnull returned writeonly align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR5]] { +; IS__CGSCC____-SAME: (i64* nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR5]] { ; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i64* @not_captured_but_returned_0(i64* nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A]]) #[[ATTR10]] -; IS__CGSCC____-NEXT: ret i64* [[A]] +; IS__CGSCC____-NEXT: [[CALL:%.*]] = call noundef nonnull align 8 dereferenceable(8) i64* @not_captured_but_returned_0(i64* nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A]]) #[[ATTR10]] +; IS__CGSCC____-NEXT: ret i64* [[CALL]] ; entry: %call = call i64* @not_captured_but_returned_0(i64* %a) @@ -476,7 +520,7 @@ define void @negative_test_not_captured_but_returned_call_0b(i64* %a) #0 { ; IS__CGSCC____-SAME: (i64* nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR5]] { ; IS__CGSCC____-NEXT: entry: ; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i64* @not_captured_but_returned_0(i64* nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A]]) #[[ATTR10]] -; IS__CGSCC____-NEXT: [[TMP0:%.*]] = ptrtoint i64* [[A]] to i64 +; IS__CGSCC____-NEXT: [[TMP0:%.*]] = ptrtoint i64* [[CALL]] to i64 ; IS__CGSCC____-NEXT: store i64 [[TMP0]], i64* [[A]], align 8 ; IS__CGSCC____-NEXT: ret void ; @@ -669,17 +713,17 @@ declare i32* @readonly_unknown_r1a(i32*, i32* returned) readonly define i32* @not_captured_by_readonly_call_not_returned_either2(i32* %b, i32* %r) { ; IS__TUNIT____: Function Attrs: nounwind readonly ; IS__TUNIT____-LABEL: define {{[^@]+}}@not_captured_by_readonly_call_not_returned_either2 -; IS__TUNIT____-SAME: (i32* nocapture readonly [[B:%.*]], i32* readonly returned [[R:%.*]]) #[[ATTR8]] { +; IS__TUNIT____-SAME: (i32* readonly [[B:%.*]], i32* readonly [[R:%.*]]) #[[ATTR8]] { ; IS__TUNIT____-NEXT: entry: ; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32* @readonly_unknown_r1a(i32* readonly [[B]], i32* readonly [[R]]) #[[ATTR8]] -; IS__TUNIT____-NEXT: ret i32* [[R]] +; IS__TUNIT____-NEXT: ret i32* [[CALL]] ; ; IS__CGSCC____: Function Attrs: nounwind readonly ; IS__CGSCC____-LABEL: define {{[^@]+}}@not_captured_by_readonly_call_not_returned_either2 -; IS__CGSCC____-SAME: (i32* nocapture readonly [[B:%.*]], i32* readonly returned [[R:%.*]]) #[[ATTR9]] { +; IS__CGSCC____-SAME: (i32* readonly [[B:%.*]], i32* readonly [[R:%.*]]) #[[ATTR9]] { ; IS__CGSCC____-NEXT: entry: ; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i32* @readonly_unknown_r1a(i32* readonly [[B]], i32* readonly [[R]]) #[[ATTR9]] -; IS__CGSCC____-NEXT: ret i32* [[R]] +; IS__CGSCC____-NEXT: ret i32* [[CALL]] ; entry: %call = call i32* @readonly_unknown_r1a(i32* %b, i32* %r) nounwind @@ -690,17 +734,17 @@ declare i32* @readonly_unknown_r1b(i32*, i32* returned) readonly nounwind define i32* @not_captured_by_readonly_call_not_returned_either3(i32* %b, i32* %r) { ; IS__TUNIT____: Function Attrs: nounwind readonly ; IS__TUNIT____-LABEL: define {{[^@]+}}@not_captured_by_readonly_call_not_returned_either3 -; IS__TUNIT____-SAME: (i32* nocapture readonly [[B:%.*]], i32* readonly returned [[R:%.*]]) #[[ATTR8]] { +; IS__TUNIT____-SAME: (i32* nocapture readonly [[B:%.*]], i32* readonly [[R:%.*]]) #[[ATTR8]] { ; IS__TUNIT____-NEXT: entry: ; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32* @readonly_unknown_r1b(i32* nocapture readonly [[B]], i32* readonly [[R]]) #[[ATTR8]] -; IS__TUNIT____-NEXT: ret i32* [[R]] +; IS__TUNIT____-NEXT: ret i32* [[CALL]] ; ; IS__CGSCC____: Function Attrs: nounwind readonly ; IS__CGSCC____-LABEL: define {{[^@]+}}@not_captured_by_readonly_call_not_returned_either3 -; IS__CGSCC____-SAME: (i32* nocapture readonly [[B:%.*]], i32* readonly returned [[R:%.*]]) #[[ATTR9]] { +; IS__CGSCC____-SAME: (i32* nocapture readonly [[B:%.*]], i32* readonly [[R:%.*]]) #[[ATTR9]] { ; IS__CGSCC____-NEXT: entry: ; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i32* @readonly_unknown_r1b(i32* nocapture readonly [[B]], i32* readonly [[R]]) #[[ATTR9]] -; IS__CGSCC____-NEXT: ret i32* [[R]] +; IS__CGSCC____-NEXT: ret i32* [[CALL]] ; entry: %call = call i32* @readonly_unknown_r1b(i32* %b, i32* %r) @@ -710,17 +754,17 @@ entry: define i32* @not_captured_by_readonly_call_not_returned_either4(i32* %b, i32* %r) nounwind { ; IS__TUNIT____: Function Attrs: nounwind readonly ; IS__TUNIT____-LABEL: define {{[^@]+}}@not_captured_by_readonly_call_not_returned_either4 -; IS__TUNIT____-SAME: (i32* nocapture readonly [[B:%.*]], i32* readonly returned [[R:%.*]]) #[[ATTR8]] { +; IS__TUNIT____-SAME: (i32* readonly [[B:%.*]], i32* readonly [[R:%.*]]) #[[ATTR8]] { ; IS__TUNIT____-NEXT: entry: ; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32* @readonly_unknown_r1a(i32* readonly [[B]], i32* readonly [[R]]) #[[ATTR6]] -; IS__TUNIT____-NEXT: ret i32* [[R]] +; IS__TUNIT____-NEXT: ret i32* [[CALL]] ; ; IS__CGSCC____: Function Attrs: nounwind readonly ; IS__CGSCC____-LABEL: define {{[^@]+}}@not_captured_by_readonly_call_not_returned_either4 -; IS__CGSCC____-SAME: (i32* nocapture readonly [[B:%.*]], i32* readonly returned [[R:%.*]]) #[[ATTR9]] { +; IS__CGSCC____-SAME: (i32* readonly [[B:%.*]], i32* readonly [[R:%.*]]) #[[ATTR9]] { ; IS__CGSCC____-NEXT: entry: ; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i32* @readonly_unknown_r1a(i32* readonly [[B]], i32* readonly [[R]]) #[[ATTR7]] -; IS__CGSCC____-NEXT: ret i32* [[R]] +; IS__CGSCC____-NEXT: ret i32* [[CALL]] ; entry: %call = call i32* @readonly_unknown_r1a(i32* %b, i32* %r) diff --git a/llvm/test/Transforms/Attributor/nonnull.ll b/llvm/test/Transforms/Attributor/nonnull.ll index 17e9ff9c2647..1d66ed989dd0 100644 --- a/llvm/test/Transforms/Attributor/nonnull.ll +++ b/llvm/test/Transforms/Attributor/nonnull.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=13 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=13 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=15 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=15 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM diff --git a/llvm/test/Transforms/Attributor/norecurse.ll b/llvm/test/Transforms/Attributor/norecurse.ll index 945c0f93fe73..3aa9c4f4cbd2 100644 --- a/llvm/test/Transforms/Attributor/norecurse.ll +++ b/llvm/test/Transforms/Attributor/norecurse.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM @@ -257,16 +257,27 @@ Dead: } define i1 @test_rec_neg(i1 %c) norecurse { -; CHECK: Function Attrs: norecurse -; CHECK-LABEL: define {{[^@]+}}@test_rec_neg -; CHECK-SAME: (i1 [[C:%.*]]) #[[ATTR8:[0-9]+]] { -; CHECK-NEXT: [[RC1:%.*]] = call noundef i1 @rec(i1 noundef true) -; CHECK-NEXT: br i1 [[RC1]], label [[T:%.*]], label [[F:%.*]] -; CHECK: t: -; CHECK-NEXT: [[RC2:%.*]] = call noundef i1 @rec(i1 [[C]]) -; CHECK-NEXT: ret i1 [[RC2]] -; CHECK: f: -; CHECK-NEXT: ret i1 [[RC1]] +; IS__TUNIT____: Function Attrs: norecurse +; IS__TUNIT____-LABEL: define {{[^@]+}}@test_rec_neg +; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR8:[0-9]+]] { +; IS__TUNIT____-NEXT: [[RC1:%.*]] = call i1 @rec(i1 noundef true) +; IS__TUNIT____-NEXT: br i1 [[RC1]], label [[T:%.*]], label [[F:%.*]] +; IS__TUNIT____: t: +; IS__TUNIT____-NEXT: [[RC2:%.*]] = call i1 @rec(i1 [[C]]) +; IS__TUNIT____-NEXT: ret i1 [[RC2]] +; IS__TUNIT____: f: +; IS__TUNIT____-NEXT: ret i1 [[RC1]] +; +; IS__CGSCC____: Function Attrs: norecurse +; IS__CGSCC____-LABEL: define {{[^@]+}}@test_rec_neg +; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR8:[0-9]+]] { +; IS__CGSCC____-NEXT: [[RC1:%.*]] = call noundef i1 @rec(i1 noundef true) +; IS__CGSCC____-NEXT: br i1 [[RC1]], label [[T:%.*]], label [[F:%.*]] +; IS__CGSCC____: t: +; IS__CGSCC____-NEXT: [[RC2:%.*]] = call noundef i1 @rec(i1 [[C]]) +; IS__CGSCC____-NEXT: ret i1 [[RC2]] +; IS__CGSCC____: f: +; IS__CGSCC____-NEXT: ret i1 [[RC1]] ; %rc1 = call i1 @rec(i1 true) br i1 %rc1, label %t, label %f @@ -306,6 +317,6 @@ f: ; CHECK: attributes #[[ATTR5:[0-9]+]] = { argmemonly nofree nounwind willreturn } ; CHECK: attributes #[[ATTR6]] = { norecurse nosync readnone } ; CHECK: attributes #[[ATTR7]] = { null_pointer_is_valid } -; CHECK: attributes #[[ATTR8]] = { norecurse } +; CHECK: attributes #[[ATTR8:[0-9]+]] = { norecurse } ; CHECK: attributes #[[ATTR9]] = { willreturn } ;. diff --git a/llvm/test/Transforms/Attributor/openmp_parallel.ll b/llvm/test/Transforms/Attributor/openmp_parallel.ll index a4b8197d7353..eaa435ba7d3e 100644 --- a/llvm/test/Transforms/Attributor/openmp_parallel.ll +++ b/llvm/test/Transforms/Attributor/openmp_parallel.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM diff --git a/llvm/test/Transforms/Attributor/potential.ll b/llvm/test/Transforms/Attributor/potential.ll index b90e7d16a4b4..b41eaa8e1e63 100644 --- a/llvm/test/Transforms/Attributor/potential.ll +++ b/llvm/test/Transforms/Attributor/potential.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -enable-new-pm=0 -attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=20 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=20 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -enable-new-pm=0 -attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=13 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=13 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -enable-new-pm=0 -attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM ; @@ -56,12 +56,12 @@ define i1 @potential_test1(i1 %c) { ; int potential_test2(int x) { return call_with_two_values(1) + call_with_two_values(-1); } define internal i32 @iszero2(i32 %c) { -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@iszero2 -; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { -; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 0 -; IS__CGSCC____-NEXT: [[RET:%.*]] = zext i1 [[CMP]] to i32 -; IS__CGSCC____-NEXT: ret i32 [[RET]] +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@iszero2 +; CHECK-SAME: (i32 [[C:%.*]]) #[[ATTR0:[0-9]+]] { +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 0 +; CHECK-NEXT: [[RET:%.*]] = zext i1 [[CMP]] to i32 +; CHECK-NEXT: ret i32 [[RET]] ; %cmp = icmp eq i32 %c, 0 %ret = zext i1 %cmp to i32 @@ -69,6 +69,24 @@ define internal i32 @iszero2(i32 %c) { } define internal i32 @call_with_two_values(i32 %c) { +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@call_with_two_values +; IS__TUNIT_OPM-SAME: (i32 noundef [[C:%.*]]) #[[ATTR0]] { +; IS__TUNIT_OPM-NEXT: [[CSRET1:%.*]] = call i32 @iszero2(i32 noundef [[C]]) #[[ATTR2:[0-9]+]], !range [[RNG0:![0-9]+]] +; IS__TUNIT_OPM-NEXT: [[MINUSC:%.*]] = sub i32 0, [[C]] +; IS__TUNIT_OPM-NEXT: [[CSRET2:%.*]] = call i32 @iszero2(i32 [[MINUSC]]) #[[ATTR2]], !range [[RNG0]] +; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = add i32 [[CSRET1]], [[CSRET2]] +; IS__TUNIT_OPM-NEXT: ret i32 [[RET]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@call_with_two_values +; IS__TUNIT_NPM-SAME: (i32 noundef [[C:%.*]]) #[[ATTR0]] { +; IS__TUNIT_NPM-NEXT: [[CSRET1:%.*]] = call i32 @iszero2(i32 noundef [[C]]) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]] +; IS__TUNIT_NPM-NEXT: [[MINUSC:%.*]] = sub i32 0, [[C]] +; IS__TUNIT_NPM-NEXT: [[CSRET2:%.*]] = call i32 @iszero2(i32 [[MINUSC]]) #[[ATTR1]], !range [[RNG0]] +; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = add i32 [[CSRET1]], [[CSRET2]] +; IS__TUNIT_NPM-NEXT: ret i32 [[RET]] +; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@call_with_two_values ; IS__CGSCC_OPM-SAME: (i32 noundef [[C:%.*]]) #[[ATTR1]] { @@ -95,10 +113,21 @@ define internal i32 @call_with_two_values(i32 %c) { } define i32 @potential_test2(i1 %c) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test2 -; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: ret i32 0 +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test2 +; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { +; IS__TUNIT_OPM-NEXT: [[CSRET1:%.*]] = call i32 @call_with_two_values(i32 noundef 1) #[[ATTR2]], !range [[RNG1:![0-9]+]] +; IS__TUNIT_OPM-NEXT: [[CSRET2:%.*]] = call i32 @call_with_two_values(i32 noundef -1) #[[ATTR2]], !range [[RNG1]] +; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = add i32 [[CSRET1]], [[CSRET2]] +; IS__TUNIT_OPM-NEXT: ret i32 [[RET]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test2 +; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { +; IS__TUNIT_NPM-NEXT: [[CSRET1:%.*]] = call i32 @call_with_two_values(i32 noundef 1) #[[ATTR1]], !range [[RNG1:![0-9]+]] +; IS__TUNIT_NPM-NEXT: [[CSRET2:%.*]] = call i32 @call_with_two_values(i32 noundef -1) #[[ATTR1]], !range [[RNG1]] +; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = add i32 [[CSRET1]], [[CSRET2]] +; IS__TUNIT_NPM-NEXT: ret i32 [[RET]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test2 @@ -205,10 +234,21 @@ define i32 @potential_test3() { ; int potential_test7(int c) { return return1or3(c) == return3or4(c); } define i32 @potential_test4(i32 %c) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test4 -; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: ret i32 0 +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test4 +; IS__TUNIT_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { +; IS__TUNIT_OPM-NEXT: [[CSRET:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR2]] +; IS__TUNIT_OPM-NEXT: [[FALSE:%.*]] = icmp eq i32 [[CSRET]], 2 +; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = zext i1 [[FALSE]] to i32 +; IS__TUNIT_OPM-NEXT: ret i32 [[RET]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test4 +; IS__TUNIT_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { +; IS__TUNIT_NPM-NEXT: [[CSRET:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR1]] +; IS__TUNIT_NPM-NEXT: [[FALSE:%.*]] = icmp eq i32 [[CSRET]], 2 +; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = zext i1 [[FALSE]] to i32 +; IS__TUNIT_NPM-NEXT: ret i32 [[RET]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test4 @@ -233,10 +273,23 @@ define i32 @potential_test4(i32 %c) { } define i32 @potential_test5(i32 %c) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test5 -; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: ret i32 0 +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test5 +; IS__TUNIT_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { +; IS__TUNIT_OPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR2]] +; IS__TUNIT_OPM-NEXT: [[CSRET2:%.*]] = call i32 @return2or4(i32 [[C]]) #[[ATTR2]] +; IS__TUNIT_OPM-NEXT: [[FALSE:%.*]] = icmp eq i32 [[CSRET1]], [[CSRET2]] +; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = zext i1 [[FALSE]] to i32 +; IS__TUNIT_OPM-NEXT: ret i32 [[RET]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test5 +; IS__TUNIT_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { +; IS__TUNIT_NPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR1]] +; IS__TUNIT_NPM-NEXT: [[CSRET2:%.*]] = call i32 @return2or4(i32 [[C]]) #[[ATTR1]] +; IS__TUNIT_NPM-NEXT: [[FALSE:%.*]] = icmp eq i32 [[CSRET1]], [[CSRET2]] +; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = zext i1 [[FALSE]] to i32 +; IS__TUNIT_NPM-NEXT: ret i32 [[RET]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test5 @@ -267,14 +320,14 @@ define i1 @potential_test6(i32 %c) { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test6 ; IS__TUNIT_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { -; IS__TUNIT_OPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR2:[0-9]+]], !range [[RNG0:![0-9]+]] +; IS__TUNIT_OPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR2]] ; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], 3 ; IS__TUNIT_OPM-NEXT: ret i1 [[RET]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test6 ; IS__TUNIT_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { -; IS__TUNIT_NPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]] +; IS__TUNIT_NPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR1]] ; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], 3 ; IS__TUNIT_NPM-NEXT: ret i1 [[RET]] ; @@ -301,16 +354,16 @@ define i1 @potential_test7(i32 %c) { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test7 ; IS__TUNIT_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { -; IS__TUNIT_OPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR2]], !range [[RNG0]] -; IS__TUNIT_OPM-NEXT: [[CSRET2:%.*]] = call i32 @return3or4(i32 [[C]]) #[[ATTR2]], !range [[RNG1:![0-9]+]] +; IS__TUNIT_OPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR2]] +; IS__TUNIT_OPM-NEXT: [[CSRET2:%.*]] = call i32 @return3or4(i32 [[C]]) #[[ATTR2]] ; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], [[CSRET2]] ; IS__TUNIT_OPM-NEXT: ret i1 [[RET]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test7 ; IS__TUNIT_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { -; IS__TUNIT_NPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR1]], !range [[RNG0]] -; IS__TUNIT_NPM-NEXT: [[CSRET2:%.*]] = call i32 @return3or4(i32 [[C]]) #[[ATTR1]], !range [[RNG1:![0-9]+]] +; IS__TUNIT_NPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR1]] +; IS__TUNIT_NPM-NEXT: [[CSRET2:%.*]] = call i32 @return3or4(i32 [[C]]) #[[ATTR1]] ; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], [[CSRET2]] ; IS__TUNIT_NPM-NEXT: ret i1 [[RET]] ; @@ -339,7 +392,7 @@ define i1 @potential_test7(i32 %c) { define internal i32 @return1or3(i32 %c) { ; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; CHECK-LABEL: define {{[^@]+}}@return1or3 -; CHECK-SAME: (i32 [[C:%.*]]) #[[ATTR0:[0-9]+]] { +; CHECK-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 0 ; CHECK-NEXT: [[RET:%.*]] = select i1 [[CMP]], i32 1, i32 3 ; CHECK-NEXT: ret i32 [[RET]] @@ -350,12 +403,12 @@ define internal i32 @return1or3(i32 %c) { } define internal i32 @return2or4(i32 %c) { -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@return2or4 -; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { -; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 0 -; IS__CGSCC____-NEXT: [[RET:%.*]] = select i1 [[CMP]], i32 2, i32 4 -; IS__CGSCC____-NEXT: ret i32 [[RET]] +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@return2or4 +; CHECK-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 0 +; CHECK-NEXT: [[RET:%.*]] = select i1 [[CMP]], i32 2, i32 4 +; CHECK-NEXT: ret i32 [[RET]] ; %cmp = icmp eq i32 %c, 0 %ret = select i1 %cmp, i32 2, i32 4 @@ -382,7 +435,7 @@ define internal i32 @return3or4(i32 %c) { define internal i1 @cmp_with_four(i32 %c) { ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@cmp_with_four -; IS__CGSCC____-SAME: (i32 noundef [[C:%.*]]) #[[ATTR0]] { +; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { ; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 4 ; IS__CGSCC____-NEXT: ret i1 [[CMP]] ; @@ -459,7 +512,8 @@ define i1 @potential_test9() { ; IS__TUNIT_OPM-NEXT: [[I_1]] = add i32 [[I_0]], 1 ; IS__TUNIT_OPM-NEXT: br label [[COND]] ; IS__TUNIT_OPM: end: -; IS__TUNIT_OPM-NEXT: ret i1 false +; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = icmp eq i32 [[C_0]], 0 +; IS__TUNIT_OPM-NEXT: ret i1 [[RET]] ; ; IS________NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS________NPM-LABEL: define {{[^@]+}}@potential_test9 @@ -478,7 +532,8 @@ define i1 @potential_test9() { ; IS________NPM-NEXT: [[I_1]] = add i32 [[I_0]], 1 ; IS________NPM-NEXT: br label [[COND]] ; IS________NPM: end: -; IS________NPM-NEXT: ret i1 false +; IS________NPM-NEXT: [[RET:%.*]] = icmp eq i32 [[C_0]], 0 +; IS________NPM-NEXT: ret i1 [[RET]] ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test9 @@ -497,7 +552,8 @@ define i1 @potential_test9() { ; IS__CGSCC_OPM-NEXT: [[I_1]] = add i32 [[I_0]], 1 ; IS__CGSCC_OPM-NEXT: br label [[COND]] ; IS__CGSCC_OPM: end: -; IS__CGSCC_OPM-NEXT: ret i1 false +; IS__CGSCC_OPM-NEXT: [[RET:%.*]] = icmp eq i32 [[C_0]], 0 +; IS__CGSCC_OPM-NEXT: ret i1 [[RET]] ; entry: br label %cond @@ -522,19 +578,19 @@ end: ; and returned value of @potential_test10 can be simplified to 0(false) define internal i32 @may_return_undef(i32 %c) { -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@may_return_undef -; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { -; IS__CGSCC____-NEXT: switch i32 [[C]], label [[OTHERWISE:%.*]] [ -; IS__CGSCC____-NEXT: i32 1, label [[A:%.*]] -; IS__CGSCC____-NEXT: i32 -1, label [[B:%.*]] -; IS__CGSCC____-NEXT: ] -; IS__CGSCC____: a: -; IS__CGSCC____-NEXT: ret i32 1 -; IS__CGSCC____: b: -; IS__CGSCC____-NEXT: ret i32 -1 -; IS__CGSCC____: otherwise: -; IS__CGSCC____-NEXT: ret i32 undef +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@may_return_undef +; CHECK-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { +; CHECK-NEXT: switch i32 [[C]], label [[OTHERWISE:%.*]] [ +; CHECK-NEXT: i32 1, label [[A:%.*]] +; CHECK-NEXT: i32 -1, label [[B:%.*]] +; CHECK-NEXT: ] +; CHECK: a: +; CHECK-NEXT: ret i32 1 +; CHECK: b: +; CHECK-NEXT: ret i32 -1 +; CHECK: otherwise: +; CHECK-NEXT: ret i32 undef ; switch i32 %c, label %otherwise [i32 1, label %a i32 -1, label %b] @@ -547,10 +603,19 @@ otherwise: } define i1 @potential_test10(i32 %c) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test10 -; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { -; IS__TUNIT____-NEXT: ret i1 false +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test10 +; IS__TUNIT_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { +; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = call i32 @may_return_undef(i32 [[C]]) #[[ATTR2]] +; IS__TUNIT_OPM-NEXT: [[CMP:%.*]] = icmp eq i32 [[RET]], 0 +; IS__TUNIT_OPM-NEXT: ret i1 [[CMP]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test10 +; IS__TUNIT_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { +; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = call i32 @may_return_undef(i32 [[C]]) #[[ATTR1]] +; IS__TUNIT_NPM-NEXT: [[CMP:%.*]] = icmp eq i32 [[RET]], 0 +; IS__TUNIT_NPM-NEXT: ret i1 [[CMP]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test10 @@ -579,7 +644,8 @@ define i32 @optimize_undef_1(i1 %c) { ; CHECK: t: ; CHECK-NEXT: ret i32 0 ; CHECK: f: -; CHECK-NEXT: ret i32 1 +; CHECK-NEXT: [[UNDEF:%.*]] = add i32 undef, 1 +; CHECK-NEXT: ret i32 [[UNDEF]] ; br i1 %c, label %t, label %f t: @@ -597,7 +663,8 @@ define i32 @optimize_undef_2(i1 %c) { ; CHECK: t: ; CHECK-NEXT: ret i32 0 ; CHECK: f: -; CHECK-NEXT: ret i32 -1 +; CHECK-NEXT: [[UNDEF:%.*]] = sub i32 undef, 1 +; CHECK-NEXT: ret i32 [[UNDEF]] ; br i1 %c, label %t, label %f t: @@ -615,7 +682,9 @@ define i32 @optimize_undef_3(i1 %c) { ; CHECK: t: ; CHECK-NEXT: ret i32 0 ; CHECK: f: -; CHECK-NEXT: ret i32 1 +; CHECK-NEXT: [[UNDEF:%.*]] = icmp eq i32 undef, 0 +; CHECK-NEXT: [[UNDEF2:%.*]] = zext i1 [[UNDEF]] to i32 +; CHECK-NEXT: ret i32 [[UNDEF2]] ; br i1 %c, label %t, label %f t: @@ -632,9 +701,9 @@ define i32 @potential_test11(i1 %c) { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test11 ; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { -; IS__TUNIT_OPM-NEXT: [[ZERO1:%.*]] = call i32 @optimize_undef_1(i1 [[C]]) #[[ATTR2]], !range [[RNG2:![0-9]+]] -; IS__TUNIT_OPM-NEXT: [[ZERO2:%.*]] = call i32 @optimize_undef_2(i1 [[C]]) #[[ATTR2]], !range [[RNG3:![0-9]+]] -; IS__TUNIT_OPM-NEXT: [[ZERO3:%.*]] = call i32 @optimize_undef_3(i1 [[C]]) #[[ATTR2]], !range [[RNG2]] +; IS__TUNIT_OPM-NEXT: [[ZERO1:%.*]] = call i32 @optimize_undef_1(i1 [[C]]) #[[ATTR2]], !range [[RNG0]] +; IS__TUNIT_OPM-NEXT: [[ZERO2:%.*]] = call i32 @optimize_undef_2(i1 [[C]]) #[[ATTR2]], !range [[RNG2:![0-9]+]] +; IS__TUNIT_OPM-NEXT: [[ZERO3:%.*]] = call i32 @optimize_undef_3(i1 [[C]]) #[[ATTR2]], !range [[RNG0]] ; IS__TUNIT_OPM-NEXT: [[ACC1:%.*]] = add i32 [[ZERO1]], [[ZERO2]] ; IS__TUNIT_OPM-NEXT: [[ACC2:%.*]] = add i32 [[ACC1]], [[ZERO3]] ; IS__TUNIT_OPM-NEXT: ret i32 [[ACC2]] @@ -642,9 +711,9 @@ define i32 @potential_test11(i1 %c) { ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test11 ; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { -; IS__TUNIT_NPM-NEXT: [[ZERO1:%.*]] = call i32 @optimize_undef_1(i1 [[C]]) #[[ATTR1]], !range [[RNG2:![0-9]+]] -; IS__TUNIT_NPM-NEXT: [[ZERO2:%.*]] = call i32 @optimize_undef_2(i1 [[C]]) #[[ATTR1]], !range [[RNG3:![0-9]+]] -; IS__TUNIT_NPM-NEXT: [[ZERO3:%.*]] = call i32 @optimize_undef_3(i1 [[C]]) #[[ATTR1]], !range [[RNG2]] +; IS__TUNIT_NPM-NEXT: [[ZERO1:%.*]] = call i32 @optimize_undef_1(i1 [[C]]) #[[ATTR1]], !range [[RNG0]] +; IS__TUNIT_NPM-NEXT: [[ZERO2:%.*]] = call i32 @optimize_undef_2(i1 [[C]]) #[[ATTR1]], !range [[RNG2:![0-9]+]] +; IS__TUNIT_NPM-NEXT: [[ZERO3:%.*]] = call i32 @optimize_undef_3(i1 [[C]]) #[[ATTR1]], !range [[RNG0]] ; IS__TUNIT_NPM-NEXT: [[ACC1:%.*]] = add i32 [[ZERO1]], [[ZERO2]] ; IS__TUNIT_NPM-NEXT: [[ACC2:%.*]] = add i32 [[ACC1]], [[ZERO3]] ; IS__TUNIT_NPM-NEXT: ret i32 [[ACC2]] @@ -678,23 +747,15 @@ define i32 @potential_test11(i1 %c) { } define i32 @optimize_poison_1(i1 %c) { -; IS________OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS________OPM-LABEL: define {{[^@]+}}@optimize_poison_1 -; IS________OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { -; IS________OPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] -; IS________OPM: t: -; IS________OPM-NEXT: ret i32 0 -; IS________OPM: f: -; IS________OPM-NEXT: ret i32 -1 -; -; IS________NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS________NPM-LABEL: define {{[^@]+}}@optimize_poison_1 -; IS________NPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { -; IS________NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] -; IS________NPM: t: -; IS________NPM-NEXT: ret i32 0 -; IS________NPM: f: -; IS________NPM-NEXT: ret i32 undef +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@optimize_poison_1 +; CHECK-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { +; CHECK-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] +; CHECK: t: +; CHECK-NEXT: ret i32 0 +; CHECK: f: +; CHECK-NEXT: [[POISON:%.*]] = sub nuw i32 0, 1 +; CHECK-NEXT: ret i32 [[POISON]] ; br i1 %c, label %t, label %f t: @@ -709,7 +770,7 @@ define i32 @potential_test12(i1 %c) { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test12 ; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { -; IS__TUNIT_OPM-NEXT: [[ZERO:%.*]] = call noundef i32 @optimize_poison_1(i1 [[C]]) #[[ATTR2]], !range [[RNG3]] +; IS__TUNIT_OPM-NEXT: [[ZERO:%.*]] = call i32 @optimize_poison_1(i1 [[C]]) #[[ATTR2]], !range [[RNG2]] ; IS__TUNIT_OPM-NEXT: ret i32 [[ZERO]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn @@ -720,13 +781,13 @@ define i32 @potential_test12(i1 %c) { ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test12 ; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { -; IS__CGSCC_OPM-NEXT: [[ZERO:%.*]] = call noundef i32 @optimize_poison_1(i1 [[C]]) #[[ATTR3]] +; IS__CGSCC_OPM-NEXT: [[ZERO:%.*]] = call i32 @optimize_poison_1(i1 [[C]]) #[[ATTR3]] ; IS__CGSCC_OPM-NEXT: ret i32 [[ZERO]] ; ; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test12 ; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { -; IS__CGSCC_NPM-NEXT: [[ZERO:%.*]] = call noundef i32 @optimize_poison_1(i1 [[C]]) #[[ATTR2]] +; IS__CGSCC_NPM-NEXT: [[ZERO:%.*]] = call i32 @optimize_poison_1(i1 [[C]]) #[[ATTR2]] ; IS__CGSCC_NPM-NEXT: ret i32 [[ZERO]] ; %zero = call i32 @optimize_poison_1(i1 %c) @@ -753,13 +814,13 @@ define i32 @potential_test13_caller1() { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test13_caller1 ; IS__TUNIT_OPM-SAME: () #[[ATTR0]] { -; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 0) #[[ATTR2]], !range [[RNG2]] +; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 0) #[[ATTR2]], !range [[RNG0]] ; IS__TUNIT_OPM-NEXT: ret i32 [[RET]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test13_caller1 ; IS__TUNIT_NPM-SAME: () #[[ATTR0]] { -; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 0) #[[ATTR1]], !range [[RNG2]] +; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 0) #[[ATTR1]], !range [[RNG0]] ; IS__TUNIT_NPM-NEXT: ret i32 [[RET]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn @@ -782,13 +843,13 @@ define i32 @potential_test13_caller2() { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test13_caller2 ; IS__TUNIT_OPM-SAME: () #[[ATTR0]] { -; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 1) #[[ATTR2]], !range [[RNG2]] +; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 1) #[[ATTR2]], !range [[RNG0]] ; IS__TUNIT_OPM-NEXT: ret i32 [[RET]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test13_caller2 ; IS__TUNIT_NPM-SAME: () #[[ATTR0]] { -; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 1) #[[ATTR1]], !range [[RNG2]] +; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 1) #[[ATTR1]], !range [[RNG0]] ; IS__TUNIT_NPM-NEXT: ret i32 [[RET]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn @@ -811,13 +872,13 @@ define i32 @potential_test13_caller3() { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test13_caller3 ; IS__TUNIT_OPM-SAME: () #[[ATTR0]] { -; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 undef) #[[ATTR2]], !range [[RNG2]] +; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 undef) #[[ATTR2]], !range [[RNG0]] ; IS__TUNIT_OPM-NEXT: ret i32 [[RET]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test13_caller3 ; IS__TUNIT_NPM-SAME: () #[[ATTR0]] { -; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 undef) #[[ATTR1]], !range [[RNG2]] +; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 undef) #[[ATTR1]], !range [[RNG0]] ; IS__TUNIT_NPM-NEXT: ret i32 [[RET]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn @@ -859,7 +920,10 @@ define i1 @potential_test15(i1 %c0, i1 %c1) { ; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; CHECK-LABEL: define {{[^@]+}}@potential_test15 ; CHECK-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]]) #[[ATTR0]] { -; CHECK-NEXT: ret i1 false +; CHECK-NEXT: [[X0:%.*]] = select i1 [[C0]], i32 0, i32 1 +; CHECK-NEXT: [[X1:%.*]] = select i1 [[C1]], i32 [[X0]], i32 undef +; CHECK-NEXT: [[RET:%.*]] = icmp eq i32 [[X1]], 7 +; CHECK-NEXT: ret i1 [[RET]] ; %x0 = select i1 %c0, i32 0, i32 1 %x1 = select i1 %c1, i32 %x0, i32 undef @@ -871,7 +935,9 @@ define i1 @potential_test16(i1 %c0, i1 %c1) { ; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; CHECK-LABEL: define {{[^@]+}}@potential_test16 ; CHECK-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]]) #[[ATTR0]] { -; CHECK-NEXT: ret i1 false +; CHECK-NEXT: [[X1:%.*]] = select i1 [[C1]], i32 0, i32 1 +; CHECK-NEXT: [[RET:%.*]] = icmp eq i32 [[X1]], 7 +; CHECK-NEXT: ret i1 [[RET]] ; %x0 = select i1 %c0, i32 0, i32 undef %x1 = select i1 %c1, i32 %x0, i32 1 @@ -896,8 +962,7 @@ define i1 @potential_test16(i1 %c0, i1 %c1) { ; IS__CGSCC_NPM: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } ; IS__CGSCC_NPM: attributes #[[ATTR2]] = { readnone willreturn } ;. -; IS__TUNIT____: [[META0:![0-9]+]] = !{i32 1, i32 4} -; IS__TUNIT____: [[META1:![0-9]+]] = !{i32 3, i32 5} -; IS__TUNIT____: [[META2:![0-9]+]] = !{i32 0, i32 2} -; IS__TUNIT____: [[META3:![0-9]+]] = !{i32 -1, i32 1} +; IS__TUNIT____: [[META0:![0-9]+]] = !{i32 0, i32 2} +; IS__TUNIT____: [[META1:![0-9]+]] = !{i32 0, i32 3} +; IS__TUNIT____: [[META2:![0-9]+]] = !{i32 -1, i32 1} ;. diff --git a/llvm/test/Transforms/Attributor/range.ll b/llvm/test/Transforms/Attributor/range.ll index eb22052fdfab..449023037efe 100644 --- a/llvm/test/Transforms/Attributor/range.ll +++ b/llvm/test/Transforms/Attributor/range.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=22 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=21 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM @@ -51,48 +51,70 @@ define void @test0-icmp-check(i32* %p){ ; IS__TUNIT____-LABEL: define {{[^@]+}}@test0-icmp-check ; IS__TUNIT____-SAME: (i32* nocapture nofree readonly align 4 [[P:%.*]]) { ; IS__TUNIT____-NEXT: [[RET:%.*]] = tail call i32 @test0(i32* nocapture nofree readonly align 4 [[P]]) #[[ATTR3]], !range [[RNG0]] +; IS__TUNIT____-NEXT: [[CMP_EQ_1:%.*]] = icmp eq i32 [[RET]], 10 ; IS__TUNIT____-NEXT: [[CMP_EQ_2:%.*]] = icmp eq i32 [[RET]], 9 ; IS__TUNIT____-NEXT: [[CMP_EQ_3:%.*]] = icmp eq i32 [[RET]], 8 ; IS__TUNIT____-NEXT: [[CMP_EQ_4:%.*]] = icmp eq i32 [[RET]], 1 ; IS__TUNIT____-NEXT: [[CMP_EQ_5:%.*]] = icmp eq i32 [[RET]], 0 -; IS__TUNIT____-NEXT: tail call void @use3(i1 noundef false, i1 [[CMP_EQ_2]], i1 [[CMP_EQ_3]]) -; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_EQ_4]], i1 [[CMP_EQ_5]], i1 noundef false) +; IS__TUNIT____-NEXT: [[CMP_EQ_6:%.*]] = icmp eq i32 [[RET]], -1 +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_EQ_1]], i1 [[CMP_EQ_2]], i1 [[CMP_EQ_3]]) +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_EQ_4]], i1 [[CMP_EQ_5]], i1 [[CMP_EQ_6]]) +; IS__TUNIT____-NEXT: [[CMP_NE_1:%.*]] = icmp ne i32 [[RET]], 10 ; IS__TUNIT____-NEXT: [[CMP_NE_2:%.*]] = icmp ne i32 [[RET]], 9 ; IS__TUNIT____-NEXT: [[CMP_NE_3:%.*]] = icmp ne i32 [[RET]], 8 ; IS__TUNIT____-NEXT: [[CMP_NE_4:%.*]] = icmp ne i32 [[RET]], 1 ; IS__TUNIT____-NEXT: [[CMP_NE_5:%.*]] = icmp ne i32 [[RET]], 0 -; IS__TUNIT____-NEXT: tail call void @use3(i1 noundef true, i1 [[CMP_NE_2]], i1 [[CMP_NE_3]]) -; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_NE_4]], i1 [[CMP_NE_5]], i1 noundef true) +; IS__TUNIT____-NEXT: [[CMP_NE_6:%.*]] = icmp ne i32 [[RET]], -1 +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_NE_1]], i1 [[CMP_NE_2]], i1 [[CMP_NE_3]]) +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_NE_4]], i1 [[CMP_NE_5]], i1 [[CMP_NE_6]]) +; IS__TUNIT____-NEXT: [[CMP_UGT_1:%.*]] = icmp ugt i32 [[RET]], 10 +; IS__TUNIT____-NEXT: [[CMP_UGT_2:%.*]] = icmp ugt i32 [[RET]], 9 ; IS__TUNIT____-NEXT: [[CMP_UGT_3:%.*]] = icmp ugt i32 [[RET]], 8 ; IS__TUNIT____-NEXT: [[CMP_UGT_4:%.*]] = icmp ugt i32 [[RET]], 1 ; IS__TUNIT____-NEXT: [[CMP_UGT_5:%.*]] = icmp ugt i32 [[RET]], 0 -; IS__TUNIT____-NEXT: tail call void @use3(i1 noundef false, i1 noundef false, i1 [[CMP_UGT_3]]) -; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_UGT_4]], i1 [[CMP_UGT_5]], i1 noundef false) +; IS__TUNIT____-NEXT: [[CMP_UGT_6:%.*]] = icmp ugt i32 [[RET]], -1 +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_UGT_1]], i1 [[CMP_UGT_2]], i1 [[CMP_UGT_3]]) +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_UGT_4]], i1 [[CMP_UGT_5]], i1 [[CMP_UGT_6]]) +; IS__TUNIT____-NEXT: [[CMP_UGE_1:%.*]] = icmp uge i32 [[RET]], 10 ; IS__TUNIT____-NEXT: [[CMP_UGE_2:%.*]] = icmp uge i32 [[RET]], 9 ; IS__TUNIT____-NEXT: [[CMP_UGE_3:%.*]] = icmp uge i32 [[RET]], 8 ; IS__TUNIT____-NEXT: [[CMP_UGE_4:%.*]] = icmp uge i32 [[RET]], 1 -; IS__TUNIT____-NEXT: tail call void @use3(i1 noundef false, i1 [[CMP_UGE_2]], i1 [[CMP_UGE_3]]) -; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_UGE_4]], i1 noundef true, i1 noundef false) +; IS__TUNIT____-NEXT: [[CMP_UGE_5:%.*]] = icmp uge i32 [[RET]], 0 +; IS__TUNIT____-NEXT: [[CMP_UGE_6:%.*]] = icmp uge i32 [[RET]], -1 +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_UGE_1]], i1 [[CMP_UGE_2]], i1 [[CMP_UGE_3]]) +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_UGE_4]], i1 [[CMP_UGE_5]], i1 [[CMP_UGE_6]]) +; IS__TUNIT____-NEXT: [[CMP_SGT_1:%.*]] = icmp sgt i32 [[RET]], 10 +; IS__TUNIT____-NEXT: [[CMP_SGT_2:%.*]] = icmp sgt i32 [[RET]], 9 ; IS__TUNIT____-NEXT: [[CMP_SGT_3:%.*]] = icmp sgt i32 [[RET]], 8 ; IS__TUNIT____-NEXT: [[CMP_SGT_4:%.*]] = icmp sgt i32 [[RET]], 1 ; IS__TUNIT____-NEXT: [[CMP_SGT_5:%.*]] = icmp sgt i32 [[RET]], 0 -; IS__TUNIT____-NEXT: tail call void @use3(i1 noundef false, i1 noundef false, i1 [[CMP_SGT_3]]) -; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_SGT_4]], i1 [[CMP_SGT_5]], i1 noundef true) +; IS__TUNIT____-NEXT: [[CMP_SGT_6:%.*]] = icmp sgt i32 [[RET]], -1 +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_SGT_1]], i1 [[CMP_SGT_2]], i1 [[CMP_SGT_3]]) +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_SGT_4]], i1 [[CMP_SGT_5]], i1 [[CMP_SGT_6]]) +; IS__TUNIT____-NEXT: [[CMP_GTE_1:%.*]] = icmp sge i32 [[RET]], 10 ; IS__TUNIT____-NEXT: [[CMP_GTE_2:%.*]] = icmp sge i32 [[RET]], 9 ; IS__TUNIT____-NEXT: [[CMP_GTE_3:%.*]] = icmp sge i32 [[RET]], 8 ; IS__TUNIT____-NEXT: [[CMP_GTE_4:%.*]] = icmp sge i32 [[RET]], 1 -; IS__TUNIT____-NEXT: tail call void @use3(i1 noundef false, i1 [[CMP_GTE_2]], i1 [[CMP_GTE_3]]) -; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_GTE_4]], i1 noundef true, i1 noundef true) +; IS__TUNIT____-NEXT: [[CMP_GTE_5:%.*]] = icmp sge i32 [[RET]], 0 +; IS__TUNIT____-NEXT: [[CMP_GTE_6:%.*]] = icmp sge i32 [[RET]], -1 +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_GTE_1]], i1 [[CMP_GTE_2]], i1 [[CMP_GTE_3]]) +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_GTE_4]], i1 [[CMP_GTE_5]], i1 [[CMP_GTE_6]]) +; IS__TUNIT____-NEXT: [[CMP_SLT_1:%.*]] = icmp slt i32 [[RET]], 10 ; IS__TUNIT____-NEXT: [[CMP_SLT_2:%.*]] = icmp slt i32 [[RET]], 9 ; IS__TUNIT____-NEXT: [[CMP_SLT_3:%.*]] = icmp slt i32 [[RET]], 8 ; IS__TUNIT____-NEXT: [[CMP_SLT_4:%.*]] = icmp slt i32 [[RET]], 1 -; IS__TUNIT____-NEXT: tail call void @use3(i1 noundef true, i1 [[CMP_SLT_2]], i1 [[CMP_SLT_3]]) -; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_SLT_4]], i1 noundef false, i1 noundef false) +; IS__TUNIT____-NEXT: [[CMP_SLT_5:%.*]] = icmp slt i32 [[RET]], 0 +; IS__TUNIT____-NEXT: [[CMP_SLT_6:%.*]] = icmp slt i32 [[RET]], -1 +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_SLT_1]], i1 [[CMP_SLT_2]], i1 [[CMP_SLT_3]]) +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_SLT_4]], i1 [[CMP_SLT_5]], i1 [[CMP_SLT_6]]) +; IS__TUNIT____-NEXT: [[CMP_LTE_1:%.*]] = icmp sle i32 [[RET]], 10 +; IS__TUNIT____-NEXT: [[CMP_LTE_2:%.*]] = icmp sle i32 [[RET]], 9 ; IS__TUNIT____-NEXT: [[CMP_LTE_3:%.*]] = icmp sle i32 [[RET]], 8 ; IS__TUNIT____-NEXT: [[CMP_LTE_4:%.*]] = icmp sle i32 [[RET]], 1 ; IS__TUNIT____-NEXT: [[CMP_LTE_5:%.*]] = icmp sle i32 [[RET]], 0 -; IS__TUNIT____-NEXT: tail call void @use3(i1 noundef true, i1 noundef true, i1 [[CMP_LTE_3]]) -; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_LTE_4]], i1 [[CMP_LTE_5]], i1 noundef false) +; IS__TUNIT____-NEXT: [[CMP_LTE_6:%.*]] = icmp sle i32 [[RET]], -1 +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_LTE_1]], i1 [[CMP_LTE_2]], i1 [[CMP_LTE_3]]) +; IS__TUNIT____-NEXT: tail call void @use3(i1 [[CMP_LTE_4]], i1 [[CMP_LTE_5]], i1 [[CMP_LTE_6]]) ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____-LABEL: define {{[^@]+}}@test0-icmp-check @@ -119,15 +141,17 @@ define void @test0-icmp-check(i32* %p){ ; IS__CGSCC____-NEXT: [[CMP_UGT_3:%.*]] = icmp ugt i32 [[RET]], 8 ; IS__CGSCC____-NEXT: [[CMP_UGT_4:%.*]] = icmp ugt i32 [[RET]], 1 ; IS__CGSCC____-NEXT: [[CMP_UGT_5:%.*]] = icmp ugt i32 [[RET]], 0 +; IS__CGSCC____-NEXT: [[CMP_UGT_6:%.*]] = icmp ugt i32 [[RET]], -1 ; IS__CGSCC____-NEXT: tail call void @use3(i1 [[CMP_UGT_1]], i1 [[CMP_UGT_2]], i1 [[CMP_UGT_3]]) -; IS__CGSCC____-NEXT: tail call void @use3(i1 [[CMP_UGT_4]], i1 [[CMP_UGT_5]], i1 noundef false) +; IS__CGSCC____-NEXT: tail call void @use3(i1 [[CMP_UGT_4]], i1 [[CMP_UGT_5]], i1 [[CMP_UGT_6]]) ; IS__CGSCC____-NEXT: [[CMP_UGE_1:%.*]] = icmp uge i32 [[RET]], 10 ; IS__CGSCC____-NEXT: [[CMP_UGE_2:%.*]] = icmp uge i32 [[RET]], 9 ; IS__CGSCC____-NEXT: [[CMP_UGE_3:%.*]] = icmp uge i32 [[RET]], 8 ; IS__CGSCC____-NEXT: [[CMP_UGE_4:%.*]] = icmp uge i32 [[RET]], 1 +; IS__CGSCC____-NEXT: [[CMP_UGE_5:%.*]] = icmp uge i32 [[RET]], 0 ; IS__CGSCC____-NEXT: [[CMP_UGE_6:%.*]] = icmp uge i32 [[RET]], -1 ; IS__CGSCC____-NEXT: tail call void @use3(i1 [[CMP_UGE_1]], i1 [[CMP_UGE_2]], i1 [[CMP_UGE_3]]) -; IS__CGSCC____-NEXT: tail call void @use3(i1 [[CMP_UGE_4]], i1 noundef true, i1 [[CMP_UGE_6]]) +; IS__CGSCC____-NEXT: tail call void @use3(i1 [[CMP_UGE_4]], i1 [[CMP_UGE_5]], i1 [[CMP_UGE_6]]) ; IS__CGSCC____-NEXT: [[CMP_SGT_1:%.*]] = icmp sgt i32 [[RET]], 10 ; IS__CGSCC____-NEXT: [[CMP_SGT_2:%.*]] = icmp sgt i32 [[RET]], 9 ; IS__CGSCC____-NEXT: [[CMP_SGT_3:%.*]] = icmp sgt i32 [[RET]], 8 @@ -312,17 +336,20 @@ entry: } define i32 @test2_check(i32* %p) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn ; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_check -; IS__TUNIT____-SAME: (i32* nocapture nofree readnone align 4 [[P:%.*]]) #[[ATTR1:[0-9]+]] { +; IS__TUNIT____-SAME: (i32* nocapture nofree readonly align 4 [[P:%.*]]) #[[ATTR0]] { ; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: br label [[IF_THEN:%.*]] +; IS__TUNIT____-NEXT: [[CALL:%.*]] = tail call i32 @test2(i32* nocapture nofree readonly align 4 [[P]]) #[[ATTR3]] +; IS__TUNIT____-NEXT: [[CMP:%.*]] = icmp slt i32 [[CALL]], 5 +; IS__TUNIT____-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_END:%.*]] ; IS__TUNIT____: if.then: ; IS__TUNIT____-NEXT: br label [[RETURN:%.*]] ; IS__TUNIT____: if.end: -; IS__TUNIT____-NEXT: unreachable +; IS__TUNIT____-NEXT: br label [[RETURN]] ; IS__TUNIT____: return: -; IS__TUNIT____-NEXT: ret i32 2 +; IS__TUNIT____-NEXT: [[RETVAL_0:%.*]] = phi i32 [ 2, [[IF_THEN]] ], [ 3, [[IF_END]] ] +; IS__TUNIT____-NEXT: ret i32 [[RETVAL_0]] ; ; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind readonly willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@test2_check @@ -383,42 +410,81 @@ return: ; preds = %if.end, %if.then declare dso_local void @unkown() define internal i32 @r1(i32) local_unnamed_addr { -; IS________OPM: Function Attrs: nofree norecurse nosync nounwind readnone -; IS________OPM-LABEL: define {{[^@]+}}@r1 -; IS________OPM-SAME: () local_unnamed_addr #[[ATTR2:[0-9]+]] { -; IS________OPM-NEXT: br label [[TMP4:%.*]] -; IS________OPM: 1: -; IS________OPM-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP7:%.*]], 10000 -; IS________OPM-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[F:%.*]] -; IS________OPM: 3: -; IS________OPM-NEXT: ret i32 20 -; IS________OPM: f: -; IS________OPM-NEXT: ret i32 10 -; IS________OPM: 4: -; IS________OPM-NEXT: [[TMP5:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP8:%.*]], [[TMP4]] ] -; IS________OPM-NEXT: [[TMP6:%.*]] = phi i32 [ 0, [[TMP0]] ], [ [[TMP7]], [[TMP4]] ] -; IS________OPM-NEXT: [[TMP7]] = add nuw nsw i32 [[TMP5]], [[TMP6]] -; IS________OPM-NEXT: [[TMP8]] = add nuw nsw i32 [[TMP5]], 1 -; IS________OPM-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP8]], 100 -; IS________OPM-NEXT: br i1 [[TMP9]], label [[TMP1:%.*]], label [[TMP4]] +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@r1 +; IS__TUNIT_OPM-SAME: () local_unnamed_addr #[[ATTR1:[0-9]+]] { +; IS__TUNIT_OPM-NEXT: br label [[TMP4:%.*]] +; IS__TUNIT_OPM: 1: +; IS__TUNIT_OPM-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP7:%.*]], 10000 +; IS__TUNIT_OPM-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[F:%.*]] +; IS__TUNIT_OPM: 3: +; IS__TUNIT_OPM-NEXT: ret i32 20 +; IS__TUNIT_OPM: f: +; IS__TUNIT_OPM-NEXT: ret i32 10 +; IS__TUNIT_OPM: 4: +; IS__TUNIT_OPM-NEXT: [[TMP5:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP8:%.*]], [[TMP4]] ] +; IS__TUNIT_OPM-NEXT: [[TMP6:%.*]] = phi i32 [ 0, [[TMP0]] ], [ [[TMP7]], [[TMP4]] ] +; IS__TUNIT_OPM-NEXT: [[TMP7]] = add nuw nsw i32 [[TMP5]], [[TMP6]] +; IS__TUNIT_OPM-NEXT: [[TMP8]] = add nuw nsw i32 [[TMP5]], 1 +; IS__TUNIT_OPM-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP8]], 100 +; IS__TUNIT_OPM-NEXT: br i1 [[TMP9]], label [[TMP1:%.*]], label [[TMP4]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@r1 +; IS__TUNIT_NPM-SAME: () local_unnamed_addr #[[ATTR1:[0-9]+]] { +; IS__TUNIT_NPM-NEXT: br label [[TMP4:%.*]] +; IS__TUNIT_NPM: 1: +; IS__TUNIT_NPM-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP7:%.*]], 10000 +; IS__TUNIT_NPM-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[F:%.*]] +; IS__TUNIT_NPM: 3: +; IS__TUNIT_NPM-NEXT: ret i32 20 +; IS__TUNIT_NPM: f: +; IS__TUNIT_NPM-NEXT: ret i32 10 +; IS__TUNIT_NPM: 4: +; IS__TUNIT_NPM-NEXT: [[TMP5:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP8:%.*]], [[TMP4]] ] +; IS__TUNIT_NPM-NEXT: [[TMP6:%.*]] = phi i32 [ 0, [[TMP0]] ], [ [[TMP7]], [[TMP4]] ] +; IS__TUNIT_NPM-NEXT: [[TMP7]] = add nuw nsw i32 [[TMP5]], [[TMP6]] +; IS__TUNIT_NPM-NEXT: [[TMP8]] = add nuw nsw i32 [[TMP5]], 1 +; IS__TUNIT_NPM-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP8]], 100 +; IS__TUNIT_NPM-NEXT: br i1 [[TMP9]], label [[TMP1:%.*]], label [[TMP4]] +; +; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@r1 +; IS__CGSCC_OPM-SAME: () local_unnamed_addr #[[ATTR2:[0-9]+]] { +; IS__CGSCC_OPM-NEXT: br label [[TMP4:%.*]] +; IS__CGSCC_OPM: 1: +; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP7:%.*]], 10000 +; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[F:%.*]] +; IS__CGSCC_OPM: 3: +; IS__CGSCC_OPM-NEXT: ret i32 20 +; IS__CGSCC_OPM: f: +; IS__CGSCC_OPM-NEXT: ret i32 10 +; IS__CGSCC_OPM: 4: +; IS__CGSCC_OPM-NEXT: [[TMP5:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP8:%.*]], [[TMP4]] ] +; IS__CGSCC_OPM-NEXT: [[TMP6:%.*]] = phi i32 [ 0, [[TMP0]] ], [ [[TMP7]], [[TMP4]] ] +; IS__CGSCC_OPM-NEXT: [[TMP7]] = add nuw nsw i32 [[TMP5]], [[TMP6]] +; IS__CGSCC_OPM-NEXT: [[TMP8]] = add nuw nsw i32 [[TMP5]], 1 +; IS__CGSCC_OPM-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP8]], 100 +; IS__CGSCC_OPM-NEXT: br i1 [[TMP9]], label [[TMP1:%.*]], label [[TMP4]] ; ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@r1 ; IS__CGSCC_NPM-SAME: () local_unnamed_addr #[[ATTR2:[0-9]+]] { -; IS__CGSCC_NPM-NEXT: br label [[TMP3:%.*]] +; IS__CGSCC_NPM-NEXT: br label [[TMP4:%.*]] ; IS__CGSCC_NPM: 1: -; IS__CGSCC_NPM-NEXT: br label [[F:%.*]] -; IS__CGSCC_NPM: 2: -; IS__CGSCC_NPM-NEXT: unreachable +; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP7:%.*]], 10000 +; IS__CGSCC_NPM-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[F:%.*]] +; IS__CGSCC_NPM: 3: +; IS__CGSCC_NPM-NEXT: ret i32 20 ; IS__CGSCC_NPM: f: ; IS__CGSCC_NPM-NEXT: ret i32 10 -; IS__CGSCC_NPM: 3: -; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP7:%.*]], [[TMP3]] ] -; IS__CGSCC_NPM-NEXT: [[TMP5:%.*]] = phi i32 [ 0, [[TMP0]] ], [ [[TMP6:%.*]], [[TMP3]] ] -; IS__CGSCC_NPM-NEXT: [[TMP6]] = add nuw nsw i32 [[TMP4]], [[TMP5]] -; IS__CGSCC_NPM-NEXT: [[TMP7]] = add nuw nsw i32 [[TMP4]], 1 -; IS__CGSCC_NPM-NEXT: [[TMP8:%.*]] = icmp eq i32 [[TMP7]], 100 -; IS__CGSCC_NPM-NEXT: br i1 [[TMP8]], label [[TMP1:%.*]], label [[TMP3]] +; IS__CGSCC_NPM: 4: +; IS__CGSCC_NPM-NEXT: [[TMP5:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP8:%.*]], [[TMP4]] ] +; IS__CGSCC_NPM-NEXT: [[TMP6:%.*]] = phi i32 [ 0, [[TMP0]] ], [ [[TMP7]], [[TMP4]] ] +; IS__CGSCC_NPM-NEXT: [[TMP7]] = add nuw nsw i32 [[TMP5]], [[TMP6]] +; IS__CGSCC_NPM-NEXT: [[TMP8]] = add nuw nsw i32 [[TMP5]], 1 +; IS__CGSCC_NPM-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP8]], 100 +; IS__CGSCC_NPM-NEXT: br i1 [[TMP9]], label [[TMP1:%.*]], label [[TMP4]] ; br label %5 @@ -439,25 +505,16 @@ f: } define void @f1(i32){ -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@f1 -; IS__TUNIT_OPM-SAME: (i32 [[TMP0:%.*]]) { -; IS__TUNIT_OPM-NEXT: [[TMP2:%.*]] = tail call i32 @r1() #[[ATTR4:[0-9]+]] -; IS__TUNIT_OPM-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 15 -; IS__TUNIT_OPM-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP5:%.*]] -; IS__TUNIT_OPM: 4: -; IS__TUNIT_OPM-NEXT: tail call void @unkown() -; IS__TUNIT_OPM-NEXT: br label [[TMP5]] -; IS__TUNIT_OPM: 5: -; IS__TUNIT_OPM-NEXT: ret void -; -; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@f1 -; IS__TUNIT_NPM-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1]] { -; IS__TUNIT_NPM-NEXT: br label [[TMP3:%.*]] -; IS__TUNIT_NPM: 2: -; IS__TUNIT_NPM-NEXT: unreachable -; IS__TUNIT_NPM: 3: -; IS__TUNIT_NPM-NEXT: ret void +; IS__TUNIT____-LABEL: define {{[^@]+}}@f1 +; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) { +; IS__TUNIT____-NEXT: [[TMP2:%.*]] = tail call i32 @r1() #[[ATTR4:[0-9]+]] +; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 15 +; IS__TUNIT____-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP5:%.*]] +; IS__TUNIT____: 4: +; IS__TUNIT____-NEXT: tail call void @unkown() +; IS__TUNIT____-NEXT: br label [[TMP5]] +; IS__TUNIT____: 5: +; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____-LABEL: define {{[^@]+}}@f1 ; IS__CGSCC____-SAME: (i32 [[TMP0:%.*]]) { @@ -493,17 +550,29 @@ define void @f1(i32){ ; } ; } define dso_local i32 @test4-f1(i32 %u) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@test4-f1 -; IS__TUNIT____-SAME: (i32 [[U:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: [[CMP:%.*]] = icmp sgt i32 [[U]], -1 -; IS__TUNIT____-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]] -; IS__TUNIT____: if.then: -; IS__TUNIT____-NEXT: br label [[RETURN]] -; IS__TUNIT____: return: -; IS__TUNIT____-NEXT: [[RETVAL_0:%.*]] = phi i32 [ [[U]], [[IF_THEN]] ], [ 0, [[ENTRY:%.*]] ] -; IS__TUNIT____-NEXT: ret i32 [[RETVAL_0]] +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test4-f1 +; IS__TUNIT_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR2:[0-9]+]] { +; IS__TUNIT_OPM-NEXT: entry: +; IS__TUNIT_OPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[U]], -1 +; IS__TUNIT_OPM-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]] +; IS__TUNIT_OPM: if.then: +; IS__TUNIT_OPM-NEXT: br label [[RETURN]] +; IS__TUNIT_OPM: return: +; IS__TUNIT_OPM-NEXT: [[RETVAL_0:%.*]] = phi i32 [ [[U]], [[IF_THEN]] ], [ 0, [[ENTRY:%.*]] ] +; IS__TUNIT_OPM-NEXT: ret i32 [[RETVAL_0]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test4-f1 +; IS__TUNIT_NPM-SAME: (i32 [[U:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: entry: +; IS__TUNIT_NPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[U]], -1 +; IS__TUNIT_NPM-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]] +; IS__TUNIT_NPM: if.then: +; IS__TUNIT_NPM-NEXT: br label [[RETURN]] +; IS__TUNIT_NPM: return: +; IS__TUNIT_NPM-NEXT: [[RETVAL_0:%.*]] = phi i32 [ [[U]], [[IF_THEN]] ], [ 0, [[ENTRY:%.*]] ] +; IS__TUNIT_NPM-NEXT: ret i32 [[RETVAL_0]] ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test4-f1 @@ -546,7 +615,7 @@ return: ; preds = %entry, %if.then define dso_local i32 @test4-g1(i32 %u) { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test4-g1 -; IS__TUNIT_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR1]] { +; IS__TUNIT_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR2]] { ; IS__TUNIT_OPM-NEXT: entry: ; IS__TUNIT_OPM-NEXT: [[CALL:%.*]] = tail call i32 @test4-f1(i32 [[U]]) #[[ATTR5:[0-9]+]] ; IS__TUNIT_OPM-NEXT: ret i32 [[CALL]] @@ -555,7 +624,7 @@ define dso_local i32 @test4-g1(i32 %u) { ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test4-g1 ; IS__TUNIT_NPM-SAME: (i32 [[U:%.*]]) #[[ATTR1]] { ; IS__TUNIT_NPM-NEXT: entry: -; IS__TUNIT_NPM-NEXT: [[CALL:%.*]] = tail call i32 @test4-f1(i32 [[U]]) #[[ATTR4:[0-9]+]] +; IS__TUNIT_NPM-NEXT: [[CALL:%.*]] = tail call i32 @test4-f1(i32 [[U]]) #[[ATTR4]] ; IS__TUNIT_NPM-NEXT: ret i32 [[CALL]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn @@ -588,20 +657,35 @@ entry: ; } ; } define dso_local i32 @test4-f2(i32 %u) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@test4-f2 -; IS__TUNIT____-SAME: (i32 [[U:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: [[CMP:%.*]] = icmp sgt i32 [[U]], -1 -; IS__TUNIT____-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] -; IS__TUNIT____: if.then: -; IS__TUNIT____-NEXT: [[ADD:%.*]] = add nuw nsw i32 [[U]], 1 -; IS__TUNIT____-NEXT: br label [[RETURN:%.*]] -; IS__TUNIT____: if.else: -; IS__TUNIT____-NEXT: br label [[RETURN]] -; IS__TUNIT____: return: -; IS__TUNIT____-NEXT: [[RETVAL_0:%.*]] = phi i32 [ [[ADD]], [[IF_THEN]] ], [ 1, [[IF_ELSE]] ] -; IS__TUNIT____-NEXT: ret i32 [[RETVAL_0]] +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test4-f2 +; IS__TUNIT_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: entry: +; IS__TUNIT_OPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[U]], -1 +; IS__TUNIT_OPM-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] +; IS__TUNIT_OPM: if.then: +; IS__TUNIT_OPM-NEXT: [[ADD:%.*]] = add nuw nsw i32 [[U]], 1 +; IS__TUNIT_OPM-NEXT: br label [[RETURN:%.*]] +; IS__TUNIT_OPM: if.else: +; IS__TUNIT_OPM-NEXT: br label [[RETURN]] +; IS__TUNIT_OPM: return: +; IS__TUNIT_OPM-NEXT: [[RETVAL_0:%.*]] = phi i32 [ [[ADD]], [[IF_THEN]] ], [ 1, [[IF_ELSE]] ] +; IS__TUNIT_OPM-NEXT: ret i32 [[RETVAL_0]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test4-f2 +; IS__TUNIT_NPM-SAME: (i32 [[U:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: entry: +; IS__TUNIT_NPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[U]], -1 +; IS__TUNIT_NPM-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] +; IS__TUNIT_NPM: if.then: +; IS__TUNIT_NPM-NEXT: [[ADD:%.*]] = add nuw nsw i32 [[U]], 1 +; IS__TUNIT_NPM-NEXT: br label [[RETURN:%.*]] +; IS__TUNIT_NPM: if.else: +; IS__TUNIT_NPM-NEXT: br label [[RETURN]] +; IS__TUNIT_NPM: return: +; IS__TUNIT_NPM-NEXT: [[RETVAL_0:%.*]] = phi i32 [ [[ADD]], [[IF_THEN]] ], [ 1, [[IF_ELSE]] ] +; IS__TUNIT_NPM-NEXT: ret i32 [[RETVAL_0]] ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test4-f2 @@ -653,7 +737,7 @@ return: ; preds = %if.else, %if.then define dso_local i32 @test4-g2(i32 %u) { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test4-g2 -; IS__TUNIT_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR1]] { +; IS__TUNIT_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR2]] { ; IS__TUNIT_OPM-NEXT: entry: ; IS__TUNIT_OPM-NEXT: [[CALL:%.*]] = tail call i32 @test4-f2(i32 [[U]]) #[[ATTR5]] ; IS__TUNIT_OPM-NEXT: ret i32 [[CALL]] @@ -685,15 +769,10 @@ entry: } define dso_local i32 @test-5() { -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test-5() { -; IS__TUNIT_OPM-NEXT: entry: -; IS__TUNIT_OPM-NEXT: [[CALL:%.*]] = call noundef i32 @rec(i32 noundef 0), !range [[RNG3:![0-9]+]] -; IS__TUNIT_OPM-NEXT: ret i32 [[CALL]] -; -; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test-5() { -; IS__TUNIT_NPM-NEXT: entry: -; IS__TUNIT_NPM-NEXT: [[CALL:%.*]] = call noundef i32 @rec(i32 noundef 0), !range [[RNG4:![0-9]+]] -; IS__TUNIT_NPM-NEXT: ret i32 [[CALL]] +; IS__TUNIT____-LABEL: define {{[^@]+}}@test-5() { +; IS__TUNIT____-NEXT: entry: +; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32 @rec(i32 noundef 0) +; IS__TUNIT____-NEXT: ret i32 [[CALL]] ; ; IS__CGSCC____-LABEL: define {{[^@]+}}@test-5() { ; IS__CGSCC____-NEXT: entry: @@ -761,31 +840,69 @@ declare dso_local i32 @foo(i32) ; FIXME: All but the return is not needed anymore define dso_local zeroext i1 @phi(i32 %arg) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@phi -; IS__TUNIT____-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: bb: -; IS__TUNIT____-NEXT: [[TMP:%.*]] = icmp sgt i32 [[ARG]], 5 -; IS__TUNIT____-NEXT: br i1 [[TMP]], label [[BB1:%.*]], label [[BB2:%.*]] -; IS__TUNIT____: bb1: -; IS__TUNIT____-NEXT: br label [[BB3:%.*]] -; IS__TUNIT____: bb2: -; IS__TUNIT____-NEXT: br label [[BB3]] -; IS__TUNIT____: bb3: -; IS__TUNIT____-NEXT: [[TMP4:%.*]] = icmp sgt i32 [[ARG]], 10 -; IS__TUNIT____-NEXT: br i1 [[TMP4]], label [[BB5:%.*]], label [[BB7:%.*]] -; IS__TUNIT____: bb5: -; IS__TUNIT____-NEXT: br label [[BB9:%.*]] -; IS__TUNIT____: bb7: -; IS__TUNIT____-NEXT: br label [[BB9]] -; IS__TUNIT____: bb9: -; IS__TUNIT____-NEXT: br label [[BB12:%.*]] -; IS__TUNIT____: bb11: -; IS__TUNIT____-NEXT: unreachable -; IS__TUNIT____: bb12: -; IS__TUNIT____-NEXT: br label [[BB13:%.*]] -; IS__TUNIT____: bb13: -; IS__TUNIT____-NEXT: ret i1 false +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@phi +; IS__TUNIT_OPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: bb: +; IS__TUNIT_OPM-NEXT: [[TMP:%.*]] = icmp sgt i32 [[ARG]], 5 +; IS__TUNIT_OPM-NEXT: br i1 [[TMP]], label [[BB1:%.*]], label [[BB2:%.*]] +; IS__TUNIT_OPM: bb1: +; IS__TUNIT_OPM-NEXT: br label [[BB3:%.*]] +; IS__TUNIT_OPM: bb2: +; IS__TUNIT_OPM-NEXT: br label [[BB3]] +; IS__TUNIT_OPM: bb3: +; IS__TUNIT_OPM-NEXT: [[DOT02:%.*]] = phi i32 [ 1, [[BB1]] ], [ 2, [[BB2]] ] +; IS__TUNIT_OPM-NEXT: [[TMP4:%.*]] = icmp sgt i32 [[ARG]], 10 +; IS__TUNIT_OPM-NEXT: br i1 [[TMP4]], label [[BB5:%.*]], label [[BB7:%.*]] +; IS__TUNIT_OPM: bb5: +; IS__TUNIT_OPM-NEXT: [[TMP6:%.*]] = add nsw i32 [[DOT02]], 1 +; IS__TUNIT_OPM-NEXT: br label [[BB9:%.*]] +; IS__TUNIT_OPM: bb7: +; IS__TUNIT_OPM-NEXT: [[TMP8:%.*]] = add nsw i32 [[DOT02]], 2 +; IS__TUNIT_OPM-NEXT: br label [[BB9]] +; IS__TUNIT_OPM: bb9: +; IS__TUNIT_OPM-NEXT: [[DOT01:%.*]] = phi i32 [ [[TMP6]], [[BB5]] ], [ [[TMP8]], [[BB7]] ] +; IS__TUNIT_OPM-NEXT: [[TMP10:%.*]] = icmp eq i32 [[DOT01]], 5 +; IS__TUNIT_OPM-NEXT: br i1 [[TMP10]], label [[BB11:%.*]], label [[BB12:%.*]] +; IS__TUNIT_OPM: bb11: +; IS__TUNIT_OPM-NEXT: br label [[BB13:%.*]] +; IS__TUNIT_OPM: bb12: +; IS__TUNIT_OPM-NEXT: br label [[BB13]] +; IS__TUNIT_OPM: bb13: +; IS__TUNIT_OPM-NEXT: [[DOT0:%.*]] = phi i1 [ true, [[BB11]] ], [ false, [[BB12]] ] +; IS__TUNIT_OPM-NEXT: ret i1 [[DOT0]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@phi +; IS__TUNIT_NPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: bb: +; IS__TUNIT_NPM-NEXT: [[TMP:%.*]] = icmp sgt i32 [[ARG]], 5 +; IS__TUNIT_NPM-NEXT: br i1 [[TMP]], label [[BB1:%.*]], label [[BB2:%.*]] +; IS__TUNIT_NPM: bb1: +; IS__TUNIT_NPM-NEXT: br label [[BB3:%.*]] +; IS__TUNIT_NPM: bb2: +; IS__TUNIT_NPM-NEXT: br label [[BB3]] +; IS__TUNIT_NPM: bb3: +; IS__TUNIT_NPM-NEXT: [[DOT02:%.*]] = phi i32 [ 1, [[BB1]] ], [ 2, [[BB2]] ] +; IS__TUNIT_NPM-NEXT: [[TMP4:%.*]] = icmp sgt i32 [[ARG]], 10 +; IS__TUNIT_NPM-NEXT: br i1 [[TMP4]], label [[BB5:%.*]], label [[BB7:%.*]] +; IS__TUNIT_NPM: bb5: +; IS__TUNIT_NPM-NEXT: [[TMP6:%.*]] = add nsw i32 [[DOT02]], 1 +; IS__TUNIT_NPM-NEXT: br label [[BB9:%.*]] +; IS__TUNIT_NPM: bb7: +; IS__TUNIT_NPM-NEXT: [[TMP8:%.*]] = add nsw i32 [[DOT02]], 2 +; IS__TUNIT_NPM-NEXT: br label [[BB9]] +; IS__TUNIT_NPM: bb9: +; IS__TUNIT_NPM-NEXT: [[DOT01:%.*]] = phi i32 [ [[TMP6]], [[BB5]] ], [ [[TMP8]], [[BB7]] ] +; IS__TUNIT_NPM-NEXT: [[TMP10:%.*]] = icmp eq i32 [[DOT01]], 5 +; IS__TUNIT_NPM-NEXT: br i1 [[TMP10]], label [[BB11:%.*]], label [[BB12:%.*]] +; IS__TUNIT_NPM: bb11: +; IS__TUNIT_NPM-NEXT: br label [[BB13:%.*]] +; IS__TUNIT_NPM: bb12: +; IS__TUNIT_NPM-NEXT: br label [[BB13]] +; IS__TUNIT_NPM: bb13: +; IS__TUNIT_NPM-NEXT: [[DOT0:%.*]] = phi i1 [ true, [[BB11]] ], [ false, [[BB12]] ] +; IS__TUNIT_NPM-NEXT: ret i1 [[DOT0]] ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@phi @@ -798,20 +915,26 @@ define dso_local zeroext i1 @phi(i32 %arg) { ; IS__CGSCC_OPM: bb2: ; IS__CGSCC_OPM-NEXT: br label [[BB3]] ; IS__CGSCC_OPM: bb3: +; IS__CGSCC_OPM-NEXT: [[DOT02:%.*]] = phi i32 [ 1, [[BB1]] ], [ 2, [[BB2]] ] ; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = icmp sgt i32 [[ARG]], 10 ; IS__CGSCC_OPM-NEXT: br i1 [[TMP4]], label [[BB5:%.*]], label [[BB7:%.*]] ; IS__CGSCC_OPM: bb5: +; IS__CGSCC_OPM-NEXT: [[TMP6:%.*]] = add nsw i32 [[DOT02]], 1 ; IS__CGSCC_OPM-NEXT: br label [[BB9:%.*]] ; IS__CGSCC_OPM: bb7: +; IS__CGSCC_OPM-NEXT: [[TMP8:%.*]] = add nsw i32 [[DOT02]], 2 ; IS__CGSCC_OPM-NEXT: br label [[BB9]] ; IS__CGSCC_OPM: bb9: -; IS__CGSCC_OPM-NEXT: br label [[BB12:%.*]] +; IS__CGSCC_OPM-NEXT: [[DOT01:%.*]] = phi i32 [ [[TMP6]], [[BB5]] ], [ [[TMP8]], [[BB7]] ] +; IS__CGSCC_OPM-NEXT: [[TMP10:%.*]] = icmp eq i32 [[DOT01]], 5 +; IS__CGSCC_OPM-NEXT: br i1 [[TMP10]], label [[BB11:%.*]], label [[BB12:%.*]] ; IS__CGSCC_OPM: bb11: -; IS__CGSCC_OPM-NEXT: unreachable -; IS__CGSCC_OPM: bb12: ; IS__CGSCC_OPM-NEXT: br label [[BB13:%.*]] +; IS__CGSCC_OPM: bb12: +; IS__CGSCC_OPM-NEXT: br label [[BB13]] ; IS__CGSCC_OPM: bb13: -; IS__CGSCC_OPM-NEXT: ret i1 false +; IS__CGSCC_OPM-NEXT: [[DOT0:%.*]] = phi i1 [ true, [[BB11]] ], [ false, [[BB12]] ] +; IS__CGSCC_OPM-NEXT: ret i1 [[DOT0]] ; ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@phi @@ -824,20 +947,26 @@ define dso_local zeroext i1 @phi(i32 %arg) { ; IS__CGSCC_NPM: bb2: ; IS__CGSCC_NPM-NEXT: br label [[BB3]] ; IS__CGSCC_NPM: bb3: +; IS__CGSCC_NPM-NEXT: [[DOT02:%.*]] = phi i32 [ 1, [[BB1]] ], [ 2, [[BB2]] ] ; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = icmp sgt i32 [[ARG]], 10 ; IS__CGSCC_NPM-NEXT: br i1 [[TMP4]], label [[BB5:%.*]], label [[BB7:%.*]] ; IS__CGSCC_NPM: bb5: +; IS__CGSCC_NPM-NEXT: [[TMP6:%.*]] = add nsw i32 [[DOT02]], 1 ; IS__CGSCC_NPM-NEXT: br label [[BB9:%.*]] ; IS__CGSCC_NPM: bb7: +; IS__CGSCC_NPM-NEXT: [[TMP8:%.*]] = add nsw i32 [[DOT02]], 2 ; IS__CGSCC_NPM-NEXT: br label [[BB9]] ; IS__CGSCC_NPM: bb9: -; IS__CGSCC_NPM-NEXT: br label [[BB12:%.*]] +; IS__CGSCC_NPM-NEXT: [[DOT01:%.*]] = phi i32 [ [[TMP6]], [[BB5]] ], [ [[TMP8]], [[BB7]] ] +; IS__CGSCC_NPM-NEXT: [[TMP10:%.*]] = icmp eq i32 [[DOT01]], 5 +; IS__CGSCC_NPM-NEXT: br i1 [[TMP10]], label [[BB11:%.*]], label [[BB12:%.*]] ; IS__CGSCC_NPM: bb11: -; IS__CGSCC_NPM-NEXT: unreachable -; IS__CGSCC_NPM: bb12: ; IS__CGSCC_NPM-NEXT: br label [[BB13:%.*]] +; IS__CGSCC_NPM: bb12: +; IS__CGSCC_NPM-NEXT: br label [[BB13]] ; IS__CGSCC_NPM: bb13: -; IS__CGSCC_NPM-NEXT: ret i1 false +; IS__CGSCC_NPM-NEXT: [[DOT0:%.*]] = phi i1 [ true, [[BB11]] ], [ false, [[BB12]] ] +; IS__CGSCC_NPM-NEXT: ret i1 [[DOT0]] ; bb: %tmp = icmp sgt i32 %arg, 5 @@ -879,23 +1008,53 @@ bb13: ; preds = %bb12, %bb11 } define dso_local i1 @select(i32 %a) local_unnamed_addr #0 { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@select -; IS__TUNIT____-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR1]] { -; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: ret i1 false +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@select +; IS__TUNIT_OPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: entry: +; IS__TUNIT_OPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 5 +; IS__TUNIT_OPM-NEXT: [[DOT:%.*]] = select i1 [[CMP]], i32 1, i32 2 +; IS__TUNIT_OPM-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[A]], 10 +; IS__TUNIT_OPM-NEXT: [[Y_0_V:%.*]] = select i1 [[CMP1]], i32 1, i32 2 +; IS__TUNIT_OPM-NEXT: [[Y_0:%.*]] = add nuw nsw i32 [[DOT]], [[Y_0_V]] +; IS__TUNIT_OPM-NEXT: [[CMP6:%.*]] = icmp eq i32 [[Y_0]], 5 +; IS__TUNIT_OPM-NEXT: ret i1 [[CMP6]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@select +; IS__TUNIT_NPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: entry: +; IS__TUNIT_NPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 5 +; IS__TUNIT_NPM-NEXT: [[DOT:%.*]] = select i1 [[CMP]], i32 1, i32 2 +; IS__TUNIT_NPM-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[A]], 10 +; IS__TUNIT_NPM-NEXT: [[Y_0_V:%.*]] = select i1 [[CMP1]], i32 1, i32 2 +; IS__TUNIT_NPM-NEXT: [[Y_0:%.*]] = add nuw nsw i32 [[DOT]], [[Y_0_V]] +; IS__TUNIT_NPM-NEXT: [[CMP6:%.*]] = icmp eq i32 [[Y_0]], 5 +; IS__TUNIT_NPM-NEXT: ret i1 [[CMP6]] ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@select ; IS__CGSCC_OPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR3]] { ; IS__CGSCC_OPM-NEXT: entry: -; IS__CGSCC_OPM-NEXT: ret i1 false +; IS__CGSCC_OPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 5 +; IS__CGSCC_OPM-NEXT: [[DOT:%.*]] = select i1 [[CMP]], i32 1, i32 2 +; IS__CGSCC_OPM-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[A]], 10 +; IS__CGSCC_OPM-NEXT: [[Y_0_V:%.*]] = select i1 [[CMP1]], i32 1, i32 2 +; IS__CGSCC_OPM-NEXT: [[Y_0:%.*]] = add nuw nsw i32 [[DOT]], [[Y_0_V]] +; IS__CGSCC_OPM-NEXT: [[CMP6:%.*]] = icmp eq i32 [[Y_0]], 5 +; IS__CGSCC_OPM-NEXT: ret i1 [[CMP6]] ; ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@select ; IS__CGSCC_NPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR2]] { ; IS__CGSCC_NPM-NEXT: entry: -; IS__CGSCC_NPM-NEXT: ret i1 false +; IS__CGSCC_NPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 5 +; IS__CGSCC_NPM-NEXT: [[DOT:%.*]] = select i1 [[CMP]], i32 1, i32 2 +; IS__CGSCC_NPM-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[A]], 10 +; IS__CGSCC_NPM-NEXT: [[Y_0_V:%.*]] = select i1 [[CMP1]], i32 1, i32 2 +; IS__CGSCC_NPM-NEXT: [[Y_0:%.*]] = add nuw nsw i32 [[DOT]], [[Y_0_V]] +; IS__CGSCC_NPM-NEXT: [[CMP6:%.*]] = icmp eq i32 [[Y_0]], 5 +; IS__CGSCC_NPM-NEXT: ret i1 [[CMP6]] ; entry: %cmp = icmp sgt i32 %a, 5 @@ -908,23 +1067,57 @@ entry: } define dso_local i32 @select_zext(i32 %a) local_unnamed_addr #0 { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@select_zext -; IS__TUNIT____-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR1]] { -; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: ret i32 0 +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@select_zext +; IS__TUNIT_OPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: entry: +; IS__TUNIT_OPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 5 +; IS__TUNIT_OPM-NEXT: [[DOT:%.*]] = select i1 [[CMP]], i32 1, i32 2 +; IS__TUNIT_OPM-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[A]], 10 +; IS__TUNIT_OPM-NEXT: [[Y_0_V:%.*]] = select i1 [[CMP1]], i32 1, i32 2 +; IS__TUNIT_OPM-NEXT: [[Y_0:%.*]] = add nuw nsw i32 [[DOT]], [[Y_0_V]] +; IS__TUNIT_OPM-NEXT: [[CMP6:%.*]] = icmp eq i32 [[Y_0]], 5 +; IS__TUNIT_OPM-NEXT: [[DOT13:%.*]] = zext i1 [[CMP6]] to i32 +; IS__TUNIT_OPM-NEXT: ret i32 [[DOT13]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@select_zext +; IS__TUNIT_NPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: entry: +; IS__TUNIT_NPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 5 +; IS__TUNIT_NPM-NEXT: [[DOT:%.*]] = select i1 [[CMP]], i32 1, i32 2 +; IS__TUNIT_NPM-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[A]], 10 +; IS__TUNIT_NPM-NEXT: [[Y_0_V:%.*]] = select i1 [[CMP1]], i32 1, i32 2 +; IS__TUNIT_NPM-NEXT: [[Y_0:%.*]] = add nuw nsw i32 [[DOT]], [[Y_0_V]] +; IS__TUNIT_NPM-NEXT: [[CMP6:%.*]] = icmp eq i32 [[Y_0]], 5 +; IS__TUNIT_NPM-NEXT: [[DOT13:%.*]] = zext i1 [[CMP6]] to i32 +; IS__TUNIT_NPM-NEXT: ret i32 [[DOT13]] ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@select_zext ; IS__CGSCC_OPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR3]] { ; IS__CGSCC_OPM-NEXT: entry: -; IS__CGSCC_OPM-NEXT: ret i32 0 +; IS__CGSCC_OPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 5 +; IS__CGSCC_OPM-NEXT: [[DOT:%.*]] = select i1 [[CMP]], i32 1, i32 2 +; IS__CGSCC_OPM-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[A]], 10 +; IS__CGSCC_OPM-NEXT: [[Y_0_V:%.*]] = select i1 [[CMP1]], i32 1, i32 2 +; IS__CGSCC_OPM-NEXT: [[Y_0:%.*]] = add nuw nsw i32 [[DOT]], [[Y_0_V]] +; IS__CGSCC_OPM-NEXT: [[CMP6:%.*]] = icmp eq i32 [[Y_0]], 5 +; IS__CGSCC_OPM-NEXT: [[DOT13:%.*]] = zext i1 [[CMP6]] to i32 +; IS__CGSCC_OPM-NEXT: ret i32 [[DOT13]] ; ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@select_zext ; IS__CGSCC_NPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR2]] { ; IS__CGSCC_NPM-NEXT: entry: -; IS__CGSCC_NPM-NEXT: ret i32 0 +; IS__CGSCC_NPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 5 +; IS__CGSCC_NPM-NEXT: [[DOT:%.*]] = select i1 [[CMP]], i32 1, i32 2 +; IS__CGSCC_NPM-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[A]], 10 +; IS__CGSCC_NPM-NEXT: [[Y_0_V:%.*]] = select i1 [[CMP1]], i32 1, i32 2 +; IS__CGSCC_NPM-NEXT: [[Y_0:%.*]] = add nuw nsw i32 [[DOT]], [[Y_0_V]] +; IS__CGSCC_NPM-NEXT: [[CMP6:%.*]] = icmp eq i32 [[Y_0]], 5 +; IS__CGSCC_NPM-NEXT: [[DOT13:%.*]] = zext i1 [[CMP6]] to i32 +; IS__CGSCC_NPM-NEXT: ret i32 [[DOT13]] ; entry: %cmp = icmp sgt i32 %a, 5 @@ -938,23 +1131,65 @@ entry: } define dso_local i64 @select_int2ptr_bitcast_ptr2int(i32 %a) local_unnamed_addr #0 { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@select_int2ptr_bitcast_ptr2int -; IS__TUNIT____-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR1]] { -; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: ret i64 0 +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@select_int2ptr_bitcast_ptr2int +; IS__TUNIT_OPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: entry: +; IS__TUNIT_OPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 5 +; IS__TUNIT_OPM-NEXT: [[DOT:%.*]] = select i1 [[CMP]], i32 1, i32 2 +; IS__TUNIT_OPM-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[A]], 10 +; IS__TUNIT_OPM-NEXT: [[Y_0_V:%.*]] = select i1 [[CMP1]], i32 1, i32 2 +; IS__TUNIT_OPM-NEXT: [[Y_0:%.*]] = add nuw nsw i32 [[DOT]], [[Y_0_V]] +; IS__TUNIT_OPM-NEXT: [[CMP6:%.*]] = icmp eq i32 [[Y_0]], 5 +; IS__TUNIT_OPM-NEXT: [[I2P:%.*]] = inttoptr i1 [[CMP6]] to i1* +; IS__TUNIT_OPM-NEXT: [[BC:%.*]] = bitcast i1* [[I2P]] to i32* +; IS__TUNIT_OPM-NEXT: [[P2I:%.*]] = ptrtoint i32* [[BC]] to i64 +; IS__TUNIT_OPM-NEXT: ret i64 [[P2I]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@select_int2ptr_bitcast_ptr2int +; IS__TUNIT_NPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: entry: +; IS__TUNIT_NPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 5 +; IS__TUNIT_NPM-NEXT: [[DOT:%.*]] = select i1 [[CMP]], i32 1, i32 2 +; IS__TUNIT_NPM-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[A]], 10 +; IS__TUNIT_NPM-NEXT: [[Y_0_V:%.*]] = select i1 [[CMP1]], i32 1, i32 2 +; IS__TUNIT_NPM-NEXT: [[Y_0:%.*]] = add nuw nsw i32 [[DOT]], [[Y_0_V]] +; IS__TUNIT_NPM-NEXT: [[CMP6:%.*]] = icmp eq i32 [[Y_0]], 5 +; IS__TUNIT_NPM-NEXT: [[I2P:%.*]] = inttoptr i1 [[CMP6]] to i1* +; IS__TUNIT_NPM-NEXT: [[BC:%.*]] = bitcast i1* [[I2P]] to i32* +; IS__TUNIT_NPM-NEXT: [[P2I:%.*]] = ptrtoint i32* [[BC]] to i64 +; IS__TUNIT_NPM-NEXT: ret i64 [[P2I]] ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@select_int2ptr_bitcast_ptr2int ; IS__CGSCC_OPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR3]] { ; IS__CGSCC_OPM-NEXT: entry: -; IS__CGSCC_OPM-NEXT: ret i64 0 +; IS__CGSCC_OPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 5 +; IS__CGSCC_OPM-NEXT: [[DOT:%.*]] = select i1 [[CMP]], i32 1, i32 2 +; IS__CGSCC_OPM-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[A]], 10 +; IS__CGSCC_OPM-NEXT: [[Y_0_V:%.*]] = select i1 [[CMP1]], i32 1, i32 2 +; IS__CGSCC_OPM-NEXT: [[Y_0:%.*]] = add nuw nsw i32 [[DOT]], [[Y_0_V]] +; IS__CGSCC_OPM-NEXT: [[CMP6:%.*]] = icmp eq i32 [[Y_0]], 5 +; IS__CGSCC_OPM-NEXT: [[I2P:%.*]] = inttoptr i1 [[CMP6]] to i1* +; IS__CGSCC_OPM-NEXT: [[BC:%.*]] = bitcast i1* [[I2P]] to i32* +; IS__CGSCC_OPM-NEXT: [[P2I:%.*]] = ptrtoint i32* [[BC]] to i64 +; IS__CGSCC_OPM-NEXT: ret i64 [[P2I]] ; ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@select_int2ptr_bitcast_ptr2int ; IS__CGSCC_NPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR2]] { ; IS__CGSCC_NPM-NEXT: entry: -; IS__CGSCC_NPM-NEXT: ret i64 0 +; IS__CGSCC_NPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 5 +; IS__CGSCC_NPM-NEXT: [[DOT:%.*]] = select i1 [[CMP]], i32 1, i32 2 +; IS__CGSCC_NPM-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[A]], 10 +; IS__CGSCC_NPM-NEXT: [[Y_0_V:%.*]] = select i1 [[CMP1]], i32 1, i32 2 +; IS__CGSCC_NPM-NEXT: [[Y_0:%.*]] = add nuw nsw i32 [[DOT]], [[Y_0_V]] +; IS__CGSCC_NPM-NEXT: [[CMP6:%.*]] = icmp eq i32 [[Y_0]], 5 +; IS__CGSCC_NPM-NEXT: [[I2P:%.*]] = inttoptr i1 [[CMP6]] to i1* +; IS__CGSCC_NPM-NEXT: [[BC:%.*]] = bitcast i1* [[I2P]] to i32* +; IS__CGSCC_NPM-NEXT: [[P2I:%.*]] = ptrtoint i32* [[BC]] to i64 +; IS__CGSCC_NPM-NEXT: ret i64 [[P2I]] ; entry: %cmp = icmp sgt i32 %a, 5 @@ -972,12 +1207,19 @@ entry: ; } define i1 @f_fcmp(float %a, float %b) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@f_fcmp -; IS__TUNIT____-SAME: (float [[A:%.*]], float [[B:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: [[R:%.*]] = fcmp uge float [[A]], [[B]] -; IS__TUNIT____-NEXT: [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false -; IS__TUNIT____-NEXT: ret i1 [[S]] +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@f_fcmp +; IS__TUNIT_OPM-SAME: (float [[A:%.*]], float [[B:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: [[R:%.*]] = fcmp uge float [[A]], [[B]] +; IS__TUNIT_OPM-NEXT: [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false +; IS__TUNIT_OPM-NEXT: ret i1 [[S]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@f_fcmp +; IS__TUNIT_NPM-SAME: (float [[A:%.*]], float [[B:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: [[R:%.*]] = fcmp uge float [[A]], [[B]] +; IS__TUNIT_NPM-NEXT: [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false +; IS__TUNIT_NPM-NEXT: ret i1 [[S]] ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f_fcmp @@ -998,12 +1240,19 @@ define i1 @f_fcmp(float %a, float %b) { ret i1 %s } define i1 @d_fcmp(double %a, double %b) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@d_fcmp -; IS__TUNIT____-SAME: (double [[A:%.*]], double [[B:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: [[R:%.*]] = fcmp oeq double [[A]], [[B]] -; IS__TUNIT____-NEXT: [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false -; IS__TUNIT____-NEXT: ret i1 [[S]] +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@d_fcmp +; IS__TUNIT_OPM-SAME: (double [[A:%.*]], double [[B:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: [[R:%.*]] = fcmp oeq double [[A]], [[B]] +; IS__TUNIT_OPM-NEXT: [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false +; IS__TUNIT_OPM-NEXT: ret i1 [[S]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@d_fcmp +; IS__TUNIT_NPM-SAME: (double [[A:%.*]], double [[B:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: [[R:%.*]] = fcmp oeq double [[A]], [[B]] +; IS__TUNIT_NPM-NEXT: [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false +; IS__TUNIT_NPM-NEXT: ret i1 [[S]] ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@d_fcmp @@ -1024,12 +1273,19 @@ define i1 @d_fcmp(double %a, double %b) { ret i1 %s } define i1 @dp_icmp(double* %a, double* %b) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@dp_icmp -; IS__TUNIT____-SAME: (double* nofree readnone [[A:%.*]], double* nofree readnone [[B:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: [[R:%.*]] = icmp sge double* [[A]], [[B]] -; IS__TUNIT____-NEXT: [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false -; IS__TUNIT____-NEXT: ret i1 [[S]] +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@dp_icmp +; IS__TUNIT_OPM-SAME: (double* nofree readnone [[A:%.*]], double* nofree readnone [[B:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: [[R:%.*]] = icmp sge double* [[A]], [[B]] +; IS__TUNIT_OPM-NEXT: [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false +; IS__TUNIT_OPM-NEXT: ret i1 [[S]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@dp_icmp +; IS__TUNIT_NPM-SAME: (double* nofree readnone [[A:%.*]], double* nofree readnone [[B:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: [[R:%.*]] = icmp sge double* [[A]], [[B]] +; IS__TUNIT_NPM-NEXT: [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false +; IS__TUNIT_NPM-NEXT: ret i1 [[S]] ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@dp_icmp @@ -1050,12 +1306,19 @@ define i1 @dp_icmp(double* %a, double* %b) { ret i1 %s } define i1 @ip_icmp(i8* %a, i8* %b) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@ip_icmp -; IS__TUNIT____-SAME: (i8* nofree readnone [[A:%.*]], i8* nofree readnone [[B:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: [[R:%.*]] = icmp ult i8* [[A]], [[B]] -; IS__TUNIT____-NEXT: [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false -; IS__TUNIT____-NEXT: ret i1 [[S]] +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@ip_icmp +; IS__TUNIT_OPM-SAME: (i8* nofree readnone [[A:%.*]], i8* nofree readnone [[B:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: [[R:%.*]] = icmp ult i8* [[A]], [[B]] +; IS__TUNIT_OPM-NEXT: [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false +; IS__TUNIT_OPM-NEXT: ret i1 [[S]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ip_icmp +; IS__TUNIT_NPM-SAME: (i8* nofree readnone [[A:%.*]], i8* nofree readnone [[B:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: [[R:%.*]] = icmp ult i8* [[A]], [[B]] +; IS__TUNIT_NPM-NEXT: [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false +; IS__TUNIT_NPM-NEXT: ret i1 [[S]] ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@ip_icmp @@ -1078,7 +1341,7 @@ define i1 @ip_icmp(i8* %a, i8* %b) { define i1 @fcmp_caller(float %fa, float %fb, double %da, double %db, double* %dpa, double* %dpb, i8* %ipa, i8* %ipb) { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@fcmp_caller -; IS__TUNIT_OPM-SAME: (float [[FA:%.*]], float [[FB:%.*]], double [[DA:%.*]], double [[DB:%.*]], double* nofree readnone [[DPA:%.*]], double* nofree readnone [[DPB:%.*]], i8* nofree readnone [[IPA:%.*]], i8* nofree readnone [[IPB:%.*]]) #[[ATTR1]] { +; IS__TUNIT_OPM-SAME: (float [[FA:%.*]], float [[FB:%.*]], double [[DA:%.*]], double [[DB:%.*]], double* nofree readnone [[DPA:%.*]], double* nofree readnone [[DPB:%.*]], i8* nofree readnone [[IPA:%.*]], i8* nofree readnone [[IPB:%.*]]) #[[ATTR2]] { ; IS__TUNIT_OPM-NEXT: [[R1:%.*]] = call i1 @f_fcmp(float [[FA]], float [[FB]]) #[[ATTR5]] ; IS__TUNIT_OPM-NEXT: [[R2:%.*]] = call i1 @d_fcmp(double [[DA]], double [[DB]]) #[[ATTR5]] ; IS__TUNIT_OPM-NEXT: [[R3:%.*]] = call i1 @dp_icmp(double* noalias nofree readnone [[DPA]], double* noalias nofree readnone [[DPB]]) #[[ATTR5]] @@ -1135,10 +1398,15 @@ define i1 @fcmp_caller(float %fa, float %fb, double %da, double %db, double* %dp } define i8 @ret_two() { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@ret_two -; IS__TUNIT____-SAME: () #[[ATTR1]] { -; IS__TUNIT____-NEXT: ret i8 2 +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@ret_two +; IS__TUNIT_OPM-SAME: () #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: ret i8 2 +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ret_two +; IS__TUNIT_NPM-SAME: () #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: ret i8 2 ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@ret_two @@ -1153,10 +1421,15 @@ define i8 @ret_two() { ret i8 2 } define i8 @ret_undef() { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@ret_undef -; IS__TUNIT____-SAME: () #[[ATTR1]] { -; IS__TUNIT____-NEXT: ret i8 undef +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@ret_undef +; IS__TUNIT_OPM-SAME: () #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: ret i8 undef +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ret_undef +; IS__TUNIT_NPM-SAME: () #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: ret i8 undef ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@ret_undef @@ -1173,10 +1446,15 @@ define i8 @ret_undef() { ; Verify we collapse undef to a value and return something non-undef here. define i8 @undef_collapse_1() { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@undef_collapse_1 -; IS__TUNIT____-SAME: () #[[ATTR1]] { -; IS__TUNIT____-NEXT: ret i8 0 +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@undef_collapse_1 +; IS__TUNIT_OPM-SAME: () #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: ret i8 0 +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@undef_collapse_1 +; IS__TUNIT_NPM-SAME: () #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: ret i8 0 ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@undef_collapse_1 @@ -1199,10 +1477,15 @@ define i8 @undef_collapse_1() { ; Verify we collapse undef to a value and return something non-undef here. define i8 @undef_collapse_2() { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@undef_collapse_2 -; IS__TUNIT____-SAME: () #[[ATTR1]] { -; IS__TUNIT____-NEXT: ret i8 0 +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@undef_collapse_2 +; IS__TUNIT_OPM-SAME: () #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: ret i8 0 +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@undef_collapse_2 +; IS__TUNIT_NPM-SAME: () #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: ret i8 0 ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@undef_collapse_2 @@ -1225,10 +1508,15 @@ define i8 @undef_collapse_2() { define i8 @undef_collapse_caller() { ; -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@undef_collapse_caller -; IS__TUNIT____-SAME: () #[[ATTR1]] { -; IS__TUNIT____-NEXT: ret i8 0 +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@undef_collapse_caller +; IS__TUNIT_OPM-SAME: () #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: ret i8 0 +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@undef_collapse_caller +; IS__TUNIT_NPM-SAME: () #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: ret i8 0 ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@undef_collapse_caller @@ -1253,11 +1541,17 @@ define i8 @undef_collapse_caller() { } define i32 @ret1or2(i1 %c) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@ret1or2 -; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: [[S:%.*]] = select i1 [[C]], i32 1, i32 2 -; IS__TUNIT____-NEXT: ret i32 [[S]] +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@ret1or2 +; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: [[S:%.*]] = select i1 [[C]], i32 1, i32 2 +; IS__TUNIT_OPM-NEXT: ret i32 [[S]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ret1or2 +; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: [[S:%.*]] = select i1 [[C]], i32 1, i32 2 +; IS__TUNIT_NPM-NEXT: ret i32 [[S]] ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@ret1or2 @@ -1276,10 +1570,29 @@ define i32 @ret1or2(i1 %c) { } define i1 @callee_range_1(i1 %c1, i1 %c2, i1 %c3) { ; -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@callee_range_1 -; IS__TUNIT____-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: ret i1 true +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@callee_range_1 +; IS__TUNIT_OPM-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: [[R1:%.*]] = call i32 @ret1or2(i1 [[C1]]) #[[ATTR5]] +; IS__TUNIT_OPM-NEXT: [[R2:%.*]] = call i32 @ret1or2(i1 [[C2]]) #[[ATTR5]] +; IS__TUNIT_OPM-NEXT: [[INDIRECTION:%.*]] = select i1 [[C3]], i32 [[R1]], i32 [[R2]] +; IS__TUNIT_OPM-NEXT: [[A:%.*]] = add i32 [[R1]], [[INDIRECTION]] +; IS__TUNIT_OPM-NEXT: [[I1:%.*]] = icmp sle i32 [[A]], 4 +; IS__TUNIT_OPM-NEXT: [[I2:%.*]] = icmp sge i32 [[A]], 2 +; IS__TUNIT_OPM-NEXT: [[F:%.*]] = and i1 [[I1]], [[I2]] +; IS__TUNIT_OPM-NEXT: ret i1 [[F]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@callee_range_1 +; IS__TUNIT_NPM-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: [[R1:%.*]] = call i32 @ret1or2(i1 [[C1]]) #[[ATTR4]] +; IS__TUNIT_NPM-NEXT: [[R2:%.*]] = call i32 @ret1or2(i1 [[C2]]) #[[ATTR4]] +; IS__TUNIT_NPM-NEXT: [[INDIRECTION:%.*]] = select i1 [[C3]], i32 [[R1]], i32 [[R2]] +; IS__TUNIT_NPM-NEXT: [[A:%.*]] = add i32 [[R1]], [[INDIRECTION]] +; IS__TUNIT_NPM-NEXT: [[I1:%.*]] = icmp sle i32 [[A]], 4 +; IS__TUNIT_NPM-NEXT: [[I2:%.*]] = icmp sge i32 [[A]], 2 +; IS__TUNIT_NPM-NEXT: [[F:%.*]] = and i1 [[I1]], [[I2]] +; IS__TUNIT_NPM-NEXT: ret i1 [[F]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@callee_range_1 @@ -1319,21 +1632,25 @@ define i1 @callee_range_2(i1 %c1, i1 %c2) { ; ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@callee_range_2 -; IS__TUNIT_OPM-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR1]] { -; IS__TUNIT_OPM-NEXT: [[R1:%.*]] = call i32 @ret1or2(i1 [[C1]]) #[[ATTR5]], !range [[RNG4:![0-9]+]] -; IS__TUNIT_OPM-NEXT: [[R2:%.*]] = call i32 @ret1or2(i1 [[C2]]) #[[ATTR5]], !range [[RNG4]] +; IS__TUNIT_OPM-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: [[R1:%.*]] = call i32 @ret1or2(i1 [[C1]]) #[[ATTR5]] +; IS__TUNIT_OPM-NEXT: [[R2:%.*]] = call i32 @ret1or2(i1 [[C2]]) #[[ATTR5]] ; IS__TUNIT_OPM-NEXT: [[A:%.*]] = add i32 [[R1]], [[R2]] ; IS__TUNIT_OPM-NEXT: [[I1:%.*]] = icmp sle i32 [[A]], 3 -; IS__TUNIT_OPM-NEXT: ret i1 [[I1]] +; IS__TUNIT_OPM-NEXT: [[I2:%.*]] = icmp sge i32 [[A]], 2 +; IS__TUNIT_OPM-NEXT: [[F:%.*]] = and i1 [[I1]], [[I2]] +; IS__TUNIT_OPM-NEXT: ret i1 [[F]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@callee_range_2 ; IS__TUNIT_NPM-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR1]] { -; IS__TUNIT_NPM-NEXT: [[R1:%.*]] = call i32 @ret1or2(i1 [[C1]]) #[[ATTR4]], !range [[RNG5:![0-9]+]] -; IS__TUNIT_NPM-NEXT: [[R2:%.*]] = call i32 @ret1or2(i1 [[C2]]) #[[ATTR4]], !range [[RNG5]] +; IS__TUNIT_NPM-NEXT: [[R1:%.*]] = call i32 @ret1or2(i1 [[C1]]) #[[ATTR4]] +; IS__TUNIT_NPM-NEXT: [[R2:%.*]] = call i32 @ret1or2(i1 [[C2]]) #[[ATTR4]] ; IS__TUNIT_NPM-NEXT: [[A:%.*]] = add i32 [[R1]], [[R2]] ; IS__TUNIT_NPM-NEXT: [[I1:%.*]] = icmp sle i32 [[A]], 3 -; IS__TUNIT_NPM-NEXT: ret i1 [[I1]] +; IS__TUNIT_NPM-NEXT: [[I2:%.*]] = icmp sge i32 [[A]], 2 +; IS__TUNIT_NPM-NEXT: [[F:%.*]] = and i1 [[I1]], [[I2]] +; IS__TUNIT_NPM-NEXT: ret i1 [[F]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@callee_range_2 @@ -1368,10 +1685,15 @@ define i1 @callee_range_2(i1 %c1, i1 %c2) { define i32 @ret100() { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@ret100 -; IS__TUNIT____-SAME: () #[[ATTR1]] { -; IS__TUNIT____-NEXT: ret i32 100 +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@ret100 +; IS__TUNIT_OPM-SAME: () #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: ret i32 100 +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ret100 +; IS__TUNIT_NPM-SAME: () #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: ret i32 100 ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@ret100 @@ -1390,7 +1712,7 @@ define i1 @ctx_adjustment(i32 %V) { ; ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@ctx_adjustment -; IS__TUNIT_OPM-SAME: (i32 [[V:%.*]]) #[[ATTR1]] { +; IS__TUNIT_OPM-SAME: (i32 [[V:%.*]]) #[[ATTR2]] { ; IS__TUNIT_OPM-NEXT: [[C1:%.*]] = icmp sge i32 [[V]], 100 ; IS__TUNIT_OPM-NEXT: br i1 [[C1]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] ; IS__TUNIT_OPM: if.true: @@ -1412,7 +1734,9 @@ define i1 @ctx_adjustment(i32 %V) { ; IS__TUNIT_NPM: if.false: ; IS__TUNIT_NPM-NEXT: br label [[END]] ; IS__TUNIT_NPM: end: -; IS__TUNIT_NPM-NEXT: ret i1 true +; IS__TUNIT_NPM-NEXT: [[PHI:%.*]] = phi i32 [ [[V]], [[IF_TRUE]] ], [ 100, [[IF_FALSE]] ] +; IS__TUNIT_NPM-NEXT: [[C2:%.*]] = icmp sge i32 [[PHI]], 100 +; IS__TUNIT_NPM-NEXT: ret i1 [[C2]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@ctx_adjustment @@ -1459,11 +1783,17 @@ end: define i32 @func(i1 %c) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@func -; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: [[RET:%.*]] = select i1 [[C]], i32 0, i32 1 -; IS__TUNIT____-NEXT: ret i32 [[RET]] +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@func +; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: [[RET:%.*]] = select i1 [[C]], i32 0, i32 1 +; IS__TUNIT_OPM-NEXT: ret i32 [[RET]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@func +; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: [[RET:%.*]] = select i1 [[C]], i32 0, i32 1 +; IS__TUNIT_NPM-NEXT: ret i32 [[RET]] ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@func @@ -1484,14 +1814,14 @@ define i32 @func(i1 %c) { define i32 @simplify_callsite_argument(i1 %d) { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@simplify_callsite_argument -; IS__TUNIT_OPM-SAME: (i1 [[D:%.*]]) #[[ATTR1]] { +; IS__TUNIT_OPM-SAME: (i1 [[D:%.*]]) #[[ATTR2]] { ; IS__TUNIT_OPM-NEXT: [[C:%.*]] = select i1 [[D]], i1 true, i1 false ; IS__TUNIT_OPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] ; IS__TUNIT_OPM: t: -; IS__TUNIT_OPM-NEXT: [[RET1:%.*]] = call noundef i32 @func(i1 noundef [[C]]) #[[ATTR5]], !range [[RNG3]] +; IS__TUNIT_OPM-NEXT: [[RET1:%.*]] = call i32 @func(i1 noundef [[C]]) #[[ATTR5]] ; IS__TUNIT_OPM-NEXT: ret i32 [[RET1]] ; IS__TUNIT_OPM: f: -; IS__TUNIT_OPM-NEXT: [[RET2:%.*]] = call noundef i32 @func(i1 noundef false) #[[ATTR5]], !range [[RNG3]] +; IS__TUNIT_OPM-NEXT: [[RET2:%.*]] = call i32 @func(i1 noundef false) #[[ATTR5]] ; IS__TUNIT_OPM-NEXT: ret i32 [[RET2]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn @@ -1500,10 +1830,10 @@ define i32 @simplify_callsite_argument(i1 %d) { ; IS__TUNIT_NPM-NEXT: [[C:%.*]] = select i1 [[D]], i1 true, i1 false ; IS__TUNIT_NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] ; IS__TUNIT_NPM: t: -; IS__TUNIT_NPM-NEXT: [[RET1:%.*]] = call noundef i32 @func(i1 noundef true) #[[ATTR4]], !range [[RNG4]] +; IS__TUNIT_NPM-NEXT: [[RET1:%.*]] = call i32 @func(i1 noundef [[C]]) #[[ATTR4]] ; IS__TUNIT_NPM-NEXT: ret i32 [[RET1]] ; IS__TUNIT_NPM: f: -; IS__TUNIT_NPM-NEXT: [[RET2:%.*]] = call noundef i32 @func(i1 noundef false) #[[ATTR4]], !range [[RNG4]] +; IS__TUNIT_NPM-NEXT: [[RET2:%.*]] = call i32 @func(i1 noundef false) #[[ATTR4]] ; IS__TUNIT_NPM-NEXT: ret i32 [[RET2]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn @@ -1524,7 +1854,7 @@ define i32 @simplify_callsite_argument(i1 %d) { ; IS__CGSCC_NPM-NEXT: [[C:%.*]] = select i1 [[D]], i1 true, i1 false ; IS__CGSCC_NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] ; IS__CGSCC_NPM: t: -; IS__CGSCC_NPM-NEXT: [[RET1:%.*]] = call noundef i32 @func(i1 noundef true) #[[ATTR6]] +; IS__CGSCC_NPM-NEXT: [[RET1:%.*]] = call noundef i32 @func(i1 noundef [[C]]) #[[ATTR6]] ; IS__CGSCC_NPM-NEXT: ret i32 [[RET1]] ; IS__CGSCC_NPM: f: ; IS__CGSCC_NPM-NEXT: [[RET2:%.*]] = call noundef i32 @func(i1 noundef false) #[[ATTR6]] @@ -1576,10 +1906,15 @@ define internal i1 @is_less_than_65536(i32 %arg) { } define i1 @check_divided_range(i32 %arg) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@check_divided_range -; IS__TUNIT____-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: ret i1 true +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@check_divided_range +; IS__TUNIT_OPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: ret i1 true +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@check_divided_range +; IS__TUNIT_NPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: ret i1 true ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@check_divided_range @@ -1645,10 +1980,15 @@ define internal i1 @is_less_than_3(i32 %c) { } define i1 @check_casted_range(i1 %c) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@check_casted_range -; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: ret i1 true +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@check_casted_range +; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: ret i1 true +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@check_casted_range +; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: ret i1 true ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@check_casted_range @@ -1777,10 +2117,15 @@ define internal i1 @is_less_than_100_1(i32 %c) { } define i1 @propagate_range1(i32 %c){ -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@propagate_range1 -; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: ret i1 true +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@propagate_range1 +; IS__TUNIT_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: ret i1 true +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@propagate_range1 +; IS__TUNIT_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: ret i1 true ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@propagate_range1 @@ -1803,6 +2148,64 @@ define i1 @propagate_range1(i32 %c){ define internal i32 @less_than_100_2(i32 %c) { ; +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@less_than_100_2 +; IS__TUNIT_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: switch i32 [[C]], label [[OTHERWISE:%.*]] [ +; IS__TUNIT_OPM-NEXT: i32 0, label [[ONZERO:%.*]] +; IS__TUNIT_OPM-NEXT: i32 1, label [[ONONE:%.*]] +; IS__TUNIT_OPM-NEXT: i32 2, label [[ONTWO:%.*]] +; IS__TUNIT_OPM-NEXT: i32 3, label [[ONTHREE:%.*]] +; IS__TUNIT_OPM-NEXT: i32 4, label [[ONFOUR:%.*]] +; IS__TUNIT_OPM-NEXT: i32 5, label [[ONFIVE:%.*]] +; IS__TUNIT_OPM-NEXT: i32 6, label [[ONSIX:%.*]] +; IS__TUNIT_OPM-NEXT: ] +; IS__TUNIT_OPM: onzero: +; IS__TUNIT_OPM-NEXT: ret i32 0 +; IS__TUNIT_OPM: onone: +; IS__TUNIT_OPM-NEXT: ret i32 1 +; IS__TUNIT_OPM: ontwo: +; IS__TUNIT_OPM-NEXT: ret i32 2 +; IS__TUNIT_OPM: onthree: +; IS__TUNIT_OPM-NEXT: ret i32 3 +; IS__TUNIT_OPM: onfour: +; IS__TUNIT_OPM-NEXT: ret i32 4 +; IS__TUNIT_OPM: onfive: +; IS__TUNIT_OPM-NEXT: ret i32 5 +; IS__TUNIT_OPM: onsix: +; IS__TUNIT_OPM-NEXT: ret i32 6 +; IS__TUNIT_OPM: otherwise: +; IS__TUNIT_OPM-NEXT: ret i32 99 +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@less_than_100_2 +; IS__TUNIT_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: switch i32 [[C]], label [[OTHERWISE:%.*]] [ +; IS__TUNIT_NPM-NEXT: i32 0, label [[ONZERO:%.*]] +; IS__TUNIT_NPM-NEXT: i32 1, label [[ONONE:%.*]] +; IS__TUNIT_NPM-NEXT: i32 2, label [[ONTWO:%.*]] +; IS__TUNIT_NPM-NEXT: i32 3, label [[ONTHREE:%.*]] +; IS__TUNIT_NPM-NEXT: i32 4, label [[ONFOUR:%.*]] +; IS__TUNIT_NPM-NEXT: i32 5, label [[ONFIVE:%.*]] +; IS__TUNIT_NPM-NEXT: i32 6, label [[ONSIX:%.*]] +; IS__TUNIT_NPM-NEXT: ] +; IS__TUNIT_NPM: onzero: +; IS__TUNIT_NPM-NEXT: ret i32 0 +; IS__TUNIT_NPM: onone: +; IS__TUNIT_NPM-NEXT: ret i32 1 +; IS__TUNIT_NPM: ontwo: +; IS__TUNIT_NPM-NEXT: ret i32 2 +; IS__TUNIT_NPM: onthree: +; IS__TUNIT_NPM-NEXT: ret i32 3 +; IS__TUNIT_NPM: onfour: +; IS__TUNIT_NPM-NEXT: ret i32 4 +; IS__TUNIT_NPM: onfive: +; IS__TUNIT_NPM-NEXT: ret i32 5 +; IS__TUNIT_NPM: onsix: +; IS__TUNIT_NPM-NEXT: ret i32 6 +; IS__TUNIT_NPM: otherwise: +; IS__TUNIT_NPM-NEXT: ret i32 99 +; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@less_than_100_2 ; IS__CGSCC_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR3]] { @@ -1888,6 +2291,18 @@ otherwise: define internal i1 @is_less_than_100_2(i32 %c) { ; +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@is_less_than_100_2 +; IS__TUNIT_OPM-SAME: (i32 noundef [[C:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[C]], 100 +; IS__TUNIT_OPM-NEXT: ret i1 [[CMP]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@is_less_than_100_2 +; IS__TUNIT_NPM-SAME: (i32 noundef [[C:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[C]], 100 +; IS__TUNIT_NPM-NEXT: ret i1 [[CMP]] +; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@is_less_than_100_2 ; IS__CGSCC_OPM-SAME: (i32 noundef [[C:%.*]]) #[[ATTR3]] { @@ -1905,10 +2320,25 @@ define internal i1 @is_less_than_100_2(i32 %c) { } define i1 @propagate_range2(i32 %c) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@propagate_range2 -; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR1]] { -; IS__TUNIT____-NEXT: ret i1 true +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@propagate_range2 +; IS__TUNIT_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR2]] { +; IS__TUNIT_OPM-NEXT: [[CSRET1:%.*]] = call noundef i32 @less_than_100_2(i32 noundef 0) #[[ATTR5]] +; IS__TUNIT_OPM-NEXT: [[TRUE1:%.*]] = call i1 @is_less_than_100_2(i32 noundef [[CSRET1]]) #[[ATTR5]] +; IS__TUNIT_OPM-NEXT: [[CSRET2:%.*]] = call noundef i32 @less_than_100_2(i32 [[C]]) #[[ATTR5]] +; IS__TUNIT_OPM-NEXT: [[TRUE2:%.*]] = call i1 @is_less_than_100_2(i32 noundef [[CSRET2]]) #[[ATTR5]] +; IS__TUNIT_OPM-NEXT: [[TRUE:%.*]] = and i1 [[TRUE1]], [[TRUE2]] +; IS__TUNIT_OPM-NEXT: ret i1 [[TRUE]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@propagate_range2 +; IS__TUNIT_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: [[CSRET1:%.*]] = call noundef i32 @less_than_100_2(i32 noundef 0) #[[ATTR4]] +; IS__TUNIT_NPM-NEXT: [[TRUE1:%.*]] = call i1 @is_less_than_100_2(i32 noundef [[CSRET1]]) #[[ATTR4]] +; IS__TUNIT_NPM-NEXT: [[CSRET2:%.*]] = call noundef i32 @less_than_100_2(i32 [[C]]) #[[ATTR4]] +; IS__TUNIT_NPM-NEXT: [[TRUE2:%.*]] = call i1 @is_less_than_100_2(i32 noundef [[CSRET2]]) #[[ATTR4]] +; IS__TUNIT_NPM-NEXT: [[TRUE:%.*]] = and i1 [[TRUE1]], [[TRUE2]] +; IS__TUNIT_NPM-NEXT: ret i1 [[TRUE]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@propagate_range2 @@ -1941,10 +2371,16 @@ define i1 @propagate_range2(i32 %c) { define internal i1 @non_zero(i8 %v) { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@non_zero -; IS__TUNIT_OPM-SAME: (i8 [[V:%.*]]) #[[ATTR1]] { +; IS__TUNIT_OPM-SAME: (i8 [[V:%.*]]) #[[ATTR2]] { ; IS__TUNIT_OPM-NEXT: [[R:%.*]] = icmp ne i8 [[V]], 0 ; IS__TUNIT_OPM-NEXT: ret i1 [[R]] ; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@non_zero +; IS__TUNIT_NPM-SAME: (i8 [[V:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: [[R:%.*]] = icmp ne i8 [[V]], 0 +; IS__TUNIT_NPM-NEXT: ret i1 [[R]] +; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@non_zero ; IS__CGSCC_OPM-SAME: (i8 [[V:%.*]]) #[[ATTR3]] { @@ -1953,8 +2389,9 @@ define internal i1 @non_zero(i8 %v) { ; ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@non_zero -; IS__CGSCC_NPM-SAME: () #[[ATTR2]] { -; IS__CGSCC_NPM-NEXT: ret i1 true +; IS__CGSCC_NPM-SAME: (i8 [[V:%.*]]) #[[ATTR2]] { +; IS__CGSCC_NPM-NEXT: [[R:%.*]] = icmp ne i8 [[V]], 0 +; IS__CGSCC_NPM-NEXT: ret i1 [[R]] ; %r = icmp ne i8 %v, 0 ret i1 %r @@ -1981,7 +2418,8 @@ define i1 @context(i8* %p) { ; IS__TUNIT_NPM-NEXT: [[C:%.*]] = icmp slt i8 0, [[L]] ; IS__TUNIT_NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] ; IS__TUNIT_NPM: t: -; IS__TUNIT_NPM-NEXT: ret i1 true +; IS__TUNIT_NPM-NEXT: [[R:%.*]] = call i1 @non_zero(i8 [[L]]) #[[ATTR4]] +; IS__TUNIT_NPM-NEXT: ret i1 [[R]] ; IS__TUNIT_NPM: f: ; IS__TUNIT_NPM-NEXT: ret i1 false ; @@ -2004,7 +2442,7 @@ define i1 @context(i8* %p) { ; IS__CGSCC_NPM-NEXT: [[C:%.*]] = icmp slt i8 0, [[L]] ; IS__CGSCC_NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] ; IS__CGSCC_NPM: t: -; IS__CGSCC_NPM-NEXT: [[R:%.*]] = call noundef i1 @non_zero() #[[ATTR6]] +; IS__CGSCC_NPM-NEXT: [[R:%.*]] = call i1 @non_zero(i8 [[L]]) #[[ATTR6]] ; IS__CGSCC_NPM-NEXT: ret i1 [[R]] ; IS__CGSCC_NPM: f: ; IS__CGSCC_NPM-NEXT: ret i1 false @@ -2083,20 +2521,50 @@ bb3: ; preds = %bb2, %bb1 } define i1 @loop_1(i32 %N) { -; NOT_CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone -; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@loop_1 -; NOT_CGSCC_NPM-SAME: (i32 [[N:%.*]]) #[[ATTR2:[0-9]+]] { -; NOT_CGSCC_NPM-NEXT: entry: -; NOT_CGSCC_NPM-NEXT: br label [[HEADER:%.*]] -; NOT_CGSCC_NPM: header: -; NOT_CGSCC_NPM-NEXT: [[I:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[AND:%.*]], [[HEADER]] ] -; NOT_CGSCC_NPM-NEXT: [[INC:%.*]] = add i32 [[I]], 1 -; NOT_CGSCC_NPM-NEXT: [[AND]] = and i32 [[INC]], 9999 -; NOT_CGSCC_NPM-NEXT: [[CMP:%.*]] = icmp ne i32 [[N]], [[AND]] -; NOT_CGSCC_NPM-NEXT: br i1 [[CMP]], label [[HEADER]], label [[EXIT:%.*]] -; NOT_CGSCC_NPM: exit: -; NOT_CGSCC_NPM-NEXT: [[R:%.*]] = icmp sle i32 [[I]], 5 -; NOT_CGSCC_NPM-NEXT: ret i1 [[R]] +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@loop_1 +; IS__TUNIT_OPM-SAME: (i32 [[N:%.*]]) #[[ATTR1]] { +; IS__TUNIT_OPM-NEXT: entry: +; IS__TUNIT_OPM-NEXT: br label [[HEADER:%.*]] +; IS__TUNIT_OPM: header: +; IS__TUNIT_OPM-NEXT: [[I:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[AND:%.*]], [[HEADER]] ] +; IS__TUNIT_OPM-NEXT: [[INC:%.*]] = add i32 [[I]], 1 +; IS__TUNIT_OPM-NEXT: [[AND]] = and i32 [[INC]], 9999 +; IS__TUNIT_OPM-NEXT: [[CMP:%.*]] = icmp ne i32 [[N]], [[AND]] +; IS__TUNIT_OPM-NEXT: br i1 [[CMP]], label [[HEADER]], label [[EXIT:%.*]] +; IS__TUNIT_OPM: exit: +; IS__TUNIT_OPM-NEXT: [[R:%.*]] = icmp sle i32 [[I]], 5 +; IS__TUNIT_OPM-NEXT: ret i1 [[R]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@loop_1 +; IS__TUNIT_NPM-SAME: (i32 [[N:%.*]]) #[[ATTR2:[0-9]+]] { +; IS__TUNIT_NPM-NEXT: entry: +; IS__TUNIT_NPM-NEXT: br label [[HEADER:%.*]] +; IS__TUNIT_NPM: header: +; IS__TUNIT_NPM-NEXT: [[I:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[AND:%.*]], [[HEADER]] ] +; IS__TUNIT_NPM-NEXT: [[INC:%.*]] = add i32 [[I]], 1 +; IS__TUNIT_NPM-NEXT: [[AND]] = and i32 [[INC]], 9999 +; IS__TUNIT_NPM-NEXT: [[CMP:%.*]] = icmp ne i32 [[N]], [[AND]] +; IS__TUNIT_NPM-NEXT: br i1 [[CMP]], label [[HEADER]], label [[EXIT:%.*]] +; IS__TUNIT_NPM: exit: +; IS__TUNIT_NPM-NEXT: [[R:%.*]] = icmp sle i32 [[I]], 5 +; IS__TUNIT_NPM-NEXT: ret i1 [[R]] +; +; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@loop_1 +; IS__CGSCC_OPM-SAME: (i32 [[N:%.*]]) #[[ATTR2]] { +; IS__CGSCC_OPM-NEXT: entry: +; IS__CGSCC_OPM-NEXT: br label [[HEADER:%.*]] +; IS__CGSCC_OPM: header: +; IS__CGSCC_OPM-NEXT: [[I:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[AND:%.*]], [[HEADER]] ] +; IS__CGSCC_OPM-NEXT: [[INC:%.*]] = add i32 [[I]], 1 +; IS__CGSCC_OPM-NEXT: [[AND]] = and i32 [[INC]], 9999 +; IS__CGSCC_OPM-NEXT: [[CMP:%.*]] = icmp ne i32 [[N]], [[AND]] +; IS__CGSCC_OPM-NEXT: br i1 [[CMP]], label [[HEADER]], label [[EXIT:%.*]] +; IS__CGSCC_OPM: exit: +; IS__CGSCC_OPM-NEXT: [[R:%.*]] = icmp sle i32 [[I]], 5 +; IS__CGSCC_OPM-NEXT: ret i1 [[R]] ; ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@loop_1 @@ -2135,8 +2603,8 @@ declare void @barney(i32 signext, i32 signext) !1 = !{i32 10, i32 100} ;. ; IS__TUNIT_OPM: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind readonly willreturn } -; IS__TUNIT_OPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn } -; IS__TUNIT_OPM: attributes #[[ATTR2]] = { nofree norecurse nosync nounwind readnone } +; IS__TUNIT_OPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone } +; IS__TUNIT_OPM: attributes #[[ATTR2]] = { nofree norecurse nosync nounwind readnone willreturn } ; IS__TUNIT_OPM: attributes #[[ATTR3]] = { nofree nosync nounwind readonly willreturn } ; IS__TUNIT_OPM: attributes #[[ATTR4]] = { nofree nosync nounwind readnone } ; IS__TUNIT_OPM: attributes #[[ATTR5]] = { nofree nosync nounwind readnone willreturn } @@ -2167,15 +2635,11 @@ declare void @barney(i32 signext, i32 signext) ; IS__TUNIT_OPM: [[RNG0]] = !{i32 0, i32 10} ; IS__TUNIT_OPM: [[RNG1]] = !{i32 10, i32 100} ; IS__TUNIT_OPM: [[RNG2]] = !{i32 200, i32 1091} -; IS__TUNIT_OPM: [[RNG3]] = !{i32 0, i32 2} -; IS__TUNIT_OPM: [[RNG4]] = !{i32 1, i32 3} ;. ; IS__TUNIT_NPM: [[RNG0]] = !{i32 0, i32 10} ; IS__TUNIT_NPM: [[RNG1]] = !{i32 10, i32 100} ; IS__TUNIT_NPM: [[RNG2]] = !{i32 200, i32 1091} ; IS__TUNIT_NPM: [[RNG3]] = !{i32 1, i32 -2147483648} -; IS__TUNIT_NPM: [[RNG4]] = !{i32 0, i32 2} -; IS__TUNIT_NPM: [[RNG5]] = !{i32 1, i32 3} ;. ; IS__CGSCC____: [[RNG0]] = !{i32 0, i32 10} ; IS__CGSCC____: [[RNG1]] = !{i32 10, i32 100} diff --git a/llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll b/llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll index 1070923a6ea3..e9e0cea64a2f 100644 --- a/llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll +++ b/llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM @@ -37,23 +37,23 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" define i32* @external_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) { ; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind ; IS__TUNIT____-LABEL: define {{[^@]+}}@external_ret2_nrw -; IS__TUNIT____-SAME: (i32* nofree [[N0:%.*]], i32* nofree [[R0:%.*]], i32* nofree [[W0:%.*]]) #[[ATTR0:[0-9]+]] { +; IS__TUNIT____-SAME: (i32* nofree [[N0:%.*]], i32* nofree [[R0:%.*]], i32* nofree returned [[W0:%.*]]) #[[ATTR0:[0-9]+]] { ; IS__TUNIT____-NEXT: entry: ; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32* @internal_ret0_nw(i32* nofree [[N0]], i32* nofree [[W0]]) #[[ATTR3:[0-9]+]] ; IS__TUNIT____-NEXT: [[CALL1:%.*]] = call i32* @internal_ret1_rrw(i32* nofree align 4 [[R0]], i32* nofree align 4 [[R0]], i32* nofree [[W0]]) #[[ATTR3]] -; IS__TUNIT____-NEXT: [[CALL2:%.*]] = call i32* @external_sink_ret2_nrw(i32* nofree [[N0]], i32* nocapture nofree readonly [[R0]], i32* nofree writeonly "no-capture-maybe-returned" [[W0]]) #[[ATTR3]] +; IS__TUNIT____-NEXT: [[CALL2:%.*]] = call i32* @external_sink_ret2_nrw(i32* nofree [[N0]], i32* nocapture nofree readonly align 4 [[R0]], i32* nofree writeonly "no-capture-maybe-returned" [[W0]]) #[[ATTR3]] ; IS__TUNIT____-NEXT: [[CALL3:%.*]] = call i32* @internal_ret1_rw(i32* nofree align 4 [[R0]], i32* nofree [[W0]]) #[[ATTR3]] -; IS__TUNIT____-NEXT: ret i32* [[CALL3]] +; IS__TUNIT____-NEXT: ret i32* [[W0]] ; ; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind ; IS__CGSCC____-LABEL: define {{[^@]+}}@external_ret2_nrw -; IS__CGSCC____-SAME: (i32* nofree [[N0:%.*]], i32* nofree [[R0:%.*]], i32* nofree [[W0:%.*]]) #[[ATTR0:[0-9]+]] { +; IS__CGSCC____-SAME: (i32* nofree [[N0:%.*]], i32* nofree [[R0:%.*]], i32* nofree returned [[W0:%.*]]) #[[ATTR0:[0-9]+]] { ; IS__CGSCC____-NEXT: entry: ; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i32* @internal_ret0_nw(i32* nofree [[N0]], i32* nofree [[W0]]) #[[ATTR2:[0-9]+]] ; IS__CGSCC____-NEXT: [[CALL1:%.*]] = call i32* @internal_ret1_rrw(i32* nofree align 4 [[R0]], i32* nofree align 4 [[R0]], i32* nofree [[W0]]) #[[ATTR2]] -; IS__CGSCC____-NEXT: [[CALL2:%.*]] = call i32* @external_sink_ret2_nrw(i32* nofree [[N0]], i32* nocapture nofree readonly [[R0]], i32* nofree writeonly [[W0]]) #[[ATTR3:[0-9]+]] +; IS__CGSCC____-NEXT: [[CALL2:%.*]] = call i32* @external_sink_ret2_nrw(i32* nofree [[N0]], i32* nocapture nofree readonly align 4 [[R0]], i32* nofree writeonly [[W0]]) #[[ATTR3:[0-9]+]] ; IS__CGSCC____-NEXT: [[CALL3:%.*]] = call i32* @internal_ret1_rw(i32* nofree align 4 [[R0]], i32* nofree [[W0]]) #[[ATTR2]] -; IS__CGSCC____-NEXT: ret i32* [[CALL3]] +; IS__CGSCC____-NEXT: ret i32* [[W0]] ; entry: %call = call i32* @internal_ret0_nw(i32* %n0, i32* %w0) @@ -66,7 +66,7 @@ entry: define internal i32* @internal_ret0_nw(i32* %n0, i32* %w0) { ; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind ; IS__TUNIT____-LABEL: define {{[^@]+}}@internal_ret0_nw -; IS__TUNIT____-SAME: (i32* nofree returned [[N0:%.*]], i32* nofree [[W0:%.*]]) #[[ATTR0]] { +; IS__TUNIT____-SAME: (i32* nofree [[N0:%.*]], i32* nofree [[W0:%.*]]) #[[ATTR0]] { ; IS__TUNIT____-NEXT: entry: ; IS__TUNIT____-NEXT: [[R0:%.*]] = alloca i32, align 4 ; IS__TUNIT____-NEXT: [[R1:%.*]] = alloca i32, align 4 @@ -86,12 +86,12 @@ define internal i32* @internal_ret0_nw(i32* %n0, i32* %w0) { ; IS__TUNIT____-NEXT: [[CALL5:%.*]] = call i32* @internal_ret0_nw(i32* nofree [[N0]], i32* nofree nonnull align 4 dereferenceable(4) [[W0]]) #[[ATTR3]] ; IS__TUNIT____-NEXT: br label [[RETURN]] ; IS__TUNIT____: return: -; IS__TUNIT____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[N0]], [[IF_END]] ], [ [[N0]], [[IF_THEN]] ] +; IS__TUNIT____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[CALL5]], [[IF_END]] ], [ [[N0]], [[IF_THEN]] ] ; IS__TUNIT____-NEXT: ret i32* [[RETVAL_0]] ; ; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind ; IS__CGSCC____-LABEL: define {{[^@]+}}@internal_ret0_nw -; IS__CGSCC____-SAME: (i32* nofree returned [[N0:%.*]], i32* nofree [[W0:%.*]]) #[[ATTR0]] { +; IS__CGSCC____-SAME: (i32* nofree [[N0:%.*]], i32* nofree [[W0:%.*]]) #[[ATTR0]] { ; IS__CGSCC____-NEXT: entry: ; IS__CGSCC____-NEXT: [[R0:%.*]] = alloca i32, align 4 ; IS__CGSCC____-NEXT: [[R1:%.*]] = alloca i32, align 4 @@ -111,7 +111,7 @@ define internal i32* @internal_ret0_nw(i32* %n0, i32* %w0) { ; IS__CGSCC____-NEXT: [[CALL5:%.*]] = call i32* @internal_ret0_nw(i32* nofree [[N0]], i32* nofree nonnull align 4 dereferenceable(4) [[W0]]) #[[ATTR2]] ; IS__CGSCC____-NEXT: br label [[RETURN]] ; IS__CGSCC____: return: -; IS__CGSCC____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[N0]], [[IF_END]] ], [ [[N0]], [[IF_THEN]] ] +; IS__CGSCC____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[CALL5]], [[IF_END]] ], [ [[N0]], [[IF_THEN]] ] ; IS__CGSCC____-NEXT: ret i32* [[RETVAL_0]] ; entry: @@ -166,7 +166,7 @@ define internal i32* @internal_ret1_rrw(i32* %r0, i32* %r1, i32* %w0) { ; IS__TUNIT____-NEXT: [[CALL8:%.*]] = call i32* @internal_ret0_nw(i32* nofree nonnull align 4 dereferenceable(4) [[R1]], i32* nofree nonnull align 4 dereferenceable(4) [[W0]]) #[[ATTR3]] ; IS__TUNIT____-NEXT: br label [[RETURN]] ; IS__TUNIT____: return: -; IS__TUNIT____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[R1]], [[IF_END]] ], [ [[R1]], [[IF_THEN]] ] +; IS__TUNIT____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[CALL8]], [[IF_END]] ], [ [[R1]], [[IF_THEN]] ] ; IS__TUNIT____-NEXT: ret i32* undef ; ; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind @@ -194,7 +194,7 @@ define internal i32* @internal_ret1_rrw(i32* %r0, i32* %r1, i32* %w0) { ; IS__CGSCC____-NEXT: [[CALL8:%.*]] = call i32* @internal_ret0_nw(i32* nofree nonnull align 4 dereferenceable(4) [[R1]], i32* nofree nonnull align 4 dereferenceable(4) [[W0]]) #[[ATTR2]] ; IS__CGSCC____-NEXT: br label [[RETURN]] ; IS__CGSCC____: return: -; IS__CGSCC____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[R1]], [[IF_END]] ], [ [[R1]], [[IF_THEN]] ] +; IS__CGSCC____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[CALL8]], [[IF_END]] ], [ [[R1]], [[IF_THEN]] ] ; IS__CGSCC____-NEXT: ret i32* undef ; entry: @@ -329,11 +329,11 @@ return: ; preds = %if.end, %if.then define i32* @external_source_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) { ; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind ; IS__TUNIT____-LABEL: define {{[^@]+}}@external_source_ret2_nrw -; IS__TUNIT____-SAME: (i32* nofree [[N0:%.*]], i32* nofree [[R0:%.*]], i32* nofree [[W0:%.*]]) #[[ATTR2:[0-9]+]] { +; IS__TUNIT____-SAME: (i32* nofree [[N0:%.*]], i32* nofree [[R0:%.*]], i32* nofree returned [[W0:%.*]]) #[[ATTR2:[0-9]+]] { ; IS__TUNIT____-NEXT: entry: ; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32* @external_sink_ret2_nrw(i32* nofree [[N0]], i32* nocapture nofree readonly [[R0]], i32* nofree writeonly "no-capture-maybe-returned" [[W0]]) #[[ATTR4:[0-9]+]] ; IS__TUNIT____-NEXT: [[CALL1:%.*]] = call i32* @external_ret2_nrw(i32* nofree [[N0]], i32* nofree [[R0]], i32* nofree [[W0]]) #[[ATTR3]] -; IS__TUNIT____-NEXT: ret i32* [[CALL1]] +; IS__TUNIT____-NEXT: ret i32* [[W0]] ; ; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind ; IS__CGSCC____-LABEL: define {{[^@]+}}@external_source_ret2_nrw diff --git a/llvm/test/Transforms/Attributor/readattrs.ll b/llvm/test/Transforms/Attributor/readattrs.ll index d3af93dbb4c3..dcc8d21e91b7 100644 --- a/llvm/test/Transforms/Attributor/readattrs.ll +++ b/llvm/test/Transforms/Attributor/readattrs.ll @@ -117,11 +117,12 @@ define void @test8_2(i32* %p) { ; IS__TUNIT____-NEXT: store i32 10, i32* [[P]], align 4 ; IS__TUNIT____-NEXT: ret void ; -; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly +; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn writeonly ; IS__CGSCC____-LABEL: define {{[^@]+}}@test8_2 ; IS__CGSCC____-SAME: (i32* nofree writeonly [[P:%.*]]) #[[ATTR4:[0-9]+]] { ; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: store i32 10, i32* [[P]], align 4 +; IS__CGSCC____-NEXT: [[CALL:%.*]] = call align 4 i32* @test8_1(i32* noalias nofree readnone [[P]]) #[[ATTR13:[0-9]+]] +; IS__CGSCC____-NEXT: store i32 10, i32* [[CALL]], align 4 ; IS__CGSCC____-NEXT: ret void ; entry: @@ -145,7 +146,7 @@ define void @test9(<4 x i32*> %ptrs, <4 x i32>%val) { ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly ; IS__CGSCC____-LABEL: define {{[^@]+}}@test9 ; IS__CGSCC____-SAME: (<4 x i32*> [[PTRS:%.*]], <4 x i32> [[VAL:%.*]]) #[[ATTR0]] { -; IS__CGSCC____-NEXT: call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32> [[VAL]], <4 x i32*> [[PTRS]], i32 noundef 4, <4 x i1> noundef ) #[[ATTR13:[0-9]+]] +; IS__CGSCC____-NEXT: call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32> [[VAL]], <4 x i32*> [[PTRS]], i32 noundef 4, <4 x i1> noundef ) #[[ATTR14:[0-9]+]] ; IS__CGSCC____-NEXT: ret void ; call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32>%val, <4 x i32*> %ptrs, i32 4, <4 x i1>) @@ -164,7 +165,7 @@ define <4 x i32> @test10(<4 x i32*> %ptrs) { ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readonly willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@test10 ; IS__CGSCC____-SAME: (<4 x i32*> [[PTRS:%.*]]) #[[ATTR7:[0-9]+]] { -; IS__CGSCC____-NEXT: [[RES:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> [[PTRS]], i32 noundef 4, <4 x i1> noundef , <4 x i32> undef) #[[ATTR14:[0-9]+]] +; IS__CGSCC____-NEXT: [[RES:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> [[PTRS]], i32 noundef 4, <4 x i1> noundef , <4 x i32> undef) #[[ATTR15:[0-9]+]] ; IS__CGSCC____-NEXT: ret <4 x i32> [[RES]] ; %res = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> %ptrs, i32 4, <4 x i1>, <4 x i32>undef) @@ -202,7 +203,7 @@ define <4 x i32> @test12_2(<4 x i32*> %ptrs) { ; IS__CGSCC____: Function Attrs: argmemonly nounwind ; IS__CGSCC____-LABEL: define {{[^@]+}}@test12_2 ; IS__CGSCC____-SAME: (<4 x i32*> [[PTRS:%.*]]) #[[ATTR9:[0-9]+]] { -; IS__CGSCC____-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x i32*> [[PTRS]]) #[[ATTR15:[0-9]+]] +; IS__CGSCC____-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x i32*> [[PTRS]]) #[[ATTR16:[0-9]+]] ; IS__CGSCC____-NEXT: ret <4 x i32> [[RES]] ; %res = call <4 x i32> @test12_1(<4 x i32*> %ptrs) @@ -344,7 +345,7 @@ define void @testbyval(i8* %read_only) { ; IS__CGSCC____-SAME: (i8* nocapture noundef nonnull readonly dereferenceable(1) [[READ_ONLY:%.*]]) { ; IS__CGSCC____-NEXT: call void @byval_not_readonly_1(i8* noalias nocapture noundef nonnull readonly byval(i8) dereferenceable(1) [[READ_ONLY]]) #[[ATTR2]] ; IS__CGSCC____-NEXT: call void @byval_not_readnone_1(i8* noalias nocapture noundef nonnull readnone byval(i8) dereferenceable(1) [[READ_ONLY]]) -; IS__CGSCC____-NEXT: call void @byval_no_fnarg(i8* noalias nocapture nofree noundef nonnull readnone byval(i8) dereferenceable(1) [[READ_ONLY]]) #[[ATTR16:[0-9]+]] +; IS__CGSCC____-NEXT: call void @byval_no_fnarg(i8* noalias nocapture nofree noundef nonnull readnone byval(i8) dereferenceable(1) [[READ_ONLY]]) #[[ATTR17:[0-9]+]] ; IS__CGSCC____-NEXT: ret void ; call void @byval_not_readonly_1(i8* byval(i8) %read_only) @@ -442,7 +443,7 @@ define i32 @read_only_constant_mem() { ; IS__CGSCC____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn } ; IS__CGSCC____: attributes #[[ATTR2]] = { readonly } ; IS__CGSCC____: attributes #[[ATTR3]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } -; IS__CGSCC____: attributes #[[ATTR4]] = { argmemonly nofree nosync nounwind willreturn writeonly } +; IS__CGSCC____: attributes #[[ATTR4]] = { nofree nosync nounwind willreturn writeonly } ; IS__CGSCC____: attributes #[[ATTR5:[0-9]+]] = { nocallback nofree nosync nounwind willreturn writeonly } ; IS__CGSCC____: attributes #[[ATTR6:[0-9]+]] = { nocallback nofree nosync nounwind readonly willreturn } ; IS__CGSCC____: attributes #[[ATTR7]] = { nofree norecurse nosync nounwind readonly willreturn } @@ -451,8 +452,9 @@ define i32 @read_only_constant_mem() { ; IS__CGSCC____: attributes #[[ATTR10]] = { argmemonly nofree norecurse nounwind willreturn } ; IS__CGSCC____: attributes #[[ATTR11]] = { readnone } ; IS__CGSCC____: attributes #[[ATTR12]] = { nounwind readonly } -; IS__CGSCC____: attributes #[[ATTR13]] = { willreturn writeonly } -; IS__CGSCC____: attributes #[[ATTR14]] = { readonly willreturn } -; IS__CGSCC____: attributes #[[ATTR15]] = { nounwind } -; IS__CGSCC____: attributes #[[ATTR16]] = { nounwind writeonly } +; IS__CGSCC____: attributes #[[ATTR13]] = { readnone willreturn } +; IS__CGSCC____: attributes #[[ATTR14]] = { willreturn writeonly } +; IS__CGSCC____: attributes #[[ATTR15]] = { readonly willreturn } +; IS__CGSCC____: attributes #[[ATTR16]] = { nounwind } +; IS__CGSCC____: attributes #[[ATTR17]] = { nounwind writeonly } ;. diff --git a/llvm/test/Transforms/Attributor/returned.ll b/llvm/test/Transforms/Attributor/returned.ll index e6c08dca67d3..a877f2cfe84e 100644 --- a/llvm/test/Transforms/Attributor/returned.ll +++ b/llvm/test/Transforms/Attributor/returned.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM ; @@ -255,10 +255,10 @@ define i32 @scc_rX(i32 %a, i32 %b, i32 %r) #0 { ; IS__CGSCC____-NEXT: [[CALL14:%.*]] = call i32 @scc_r2(i32 [[A]], i32 [[B]], i32 [[R]]) #[[ATTR8]] ; IS__CGSCC____-NEXT: br label [[COND_END]] ; IS__CGSCC____: cond.end: -; IS__CGSCC____-NEXT: [[COND:%.*]] = phi i32 [ [[R]], [[COND_TRUE]] ], [ [[R]], [[COND_FALSE]] ] +; IS__CGSCC____-NEXT: [[COND:%.*]] = phi i32 [ [[R]], [[COND_TRUE]] ], [ [[CALL14]], [[COND_FALSE]] ] ; IS__CGSCC____-NEXT: br label [[RETURN]] ; IS__CGSCC____: return: -; IS__CGSCC____-NEXT: [[RETVAL_0:%.*]] = phi i32 [ [[R]], [[IF_THEN]] ], [ [[B]], [[IF_THEN3]] ], [ [[COND]], [[COND_END]] ] +; IS__CGSCC____-NEXT: [[RETVAL_0:%.*]] = phi i32 [ [[CALL1]], [[IF_THEN]] ], [ [[CALL11]], [[IF_THEN3]] ], [ [[COND]], [[COND_END]] ] ; IS__CGSCC____-NEXT: ret i32 [[RETVAL_0]] ; entry: @@ -1388,10 +1388,10 @@ define i32 @exact(i32* align 8 %a, i32* align 8 %b) { ; IS__CGSCC____-NEXT: [[C2:%.*]] = call i32 @non_exact_2(i32 noundef 2) ; IS__CGSCC____-NEXT: [[C3:%.*]] = call align 32 i32* @non_exact_3(i32* align 32 [[A]]) ; IS__CGSCC____-NEXT: [[C4:%.*]] = call align 16 i32* @non_exact_4(i32* align 32 [[B]]) -; IS__CGSCC____-NEXT: [[C3L:%.*]] = load i32, i32* [[A]], align 32 +; IS__CGSCC____-NEXT: [[C3L:%.*]] = load i32, i32* [[C3]], align 32 ; IS__CGSCC____-NEXT: [[C4L:%.*]] = load i32, i32* [[C4]], align 16 ; IS__CGSCC____-NEXT: [[ADD1:%.*]] = add i32 [[C0]], [[C1]] -; IS__CGSCC____-NEXT: [[ADD2:%.*]] = add i32 [[ADD1]], 2 +; IS__CGSCC____-NEXT: [[ADD2:%.*]] = add i32 [[ADD1]], [[C2]] ; IS__CGSCC____-NEXT: [[ADD3:%.*]] = add i32 [[ADD2]], [[C3L]] ; IS__CGSCC____-NEXT: [[ADD4:%.*]] = add i32 [[ADD3]], [[C4L]] ; IS__CGSCC____-NEXT: ret i32 [[ADD4]] diff --git a/llvm/test/Transforms/Attributor/undefined_behavior.ll b/llvm/test/Transforms/Attributor/undefined_behavior.ll index 136d5ec565dc..e86345e1d0d3 100644 --- a/llvm/test/Transforms/Attributor/undefined_behavior.ll +++ b/llvm/test/Transforms/Attributor/undefined_behavior.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=5 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=5 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM @@ -484,11 +484,12 @@ define i32 @cond_br_on_undef3() { ; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; CHECK-LABEL: define {{[^@]+}}@cond_br_on_undef3 ; CHECK-SAME: () #[[ATTR0]] { -; CHECK-NEXT: br label [[T:%.*]] +; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 1, undef +; CHECK-NEXT: br i1 [[COND]], label [[T:%.*]], label [[E:%.*]] ; CHECK: t: ; CHECK-NEXT: ret i32 1 ; CHECK: e: -; CHECK-NEXT: unreachable +; CHECK-NEXT: ret i32 2 ; %cond = icmp ne i32 1, undef br i1 %cond, label %t, label %e @@ -983,7 +984,7 @@ define i32 @violate_noundef_nonpointer() { ; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@violate_noundef_nonpointer ; IS__CGSCC____-SAME: () #[[ATTR2]] { -; IS__CGSCC____-NEXT: ret i32 undef +; IS__CGSCC____-NEXT: unreachable ; %ret = call i32 @argument_noundef1(i32 undef) ret i32 %ret diff --git a/llvm/test/Transforms/Attributor/value-simplify-dbg.ll b/llvm/test/Transforms/Attributor/value-simplify-dbg.ll index 3be91222f0ff..527677db8273 100644 --- a/llvm/test/Transforms/Attributor/value-simplify-dbg.ll +++ b/llvm/test/Transforms/Attributor/value-simplify-dbg.ll @@ -10,20 +10,12 @@ ; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal global i32 undef, align 4, !dbg [[DBG0:![0-9]+]] ;. define void @dest() !dbg !15 { -; IS__TUNIT____-LABEL: define {{[^@]+}}@dest -; IS__TUNIT____-SAME: () !dbg [[DBG15:![0-9]+]] { -; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: [[TMP0:%.*]] = call i32 @speculatable() -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = add i32 [[TMP0]], 1 -; IS__TUNIT____-NEXT: call void @use(i32 noundef [[TMP1]]), !dbg [[DBG19:![0-9]+]] -; IS__TUNIT____-NEXT: ret void, !dbg [[DBG20:![0-9]+]] -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@dest -; IS__CGSCC____-SAME: () !dbg [[DBG15:![0-9]+]] { -; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: [[TMP0:%.*]] = load i32, ptr @G, align 4, !dbg [[DBG19:![0-9]+]] -; IS__CGSCC____-NEXT: call void @use(i32 noundef [[TMP0]]), !dbg [[DBG20:![0-9]+]] -; IS__CGSCC____-NEXT: ret void, !dbg [[DBG21:![0-9]+]] +; CHECK-LABEL: define {{[^@]+}}@dest +; CHECK-SAME: () !dbg [[DBG15:![0-9]+]] { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr @G, align 4, !dbg [[DBG19:![0-9]+]] +; CHECK-NEXT: call void @use(i32 noundef [[TMP0]]), !dbg [[DBG20:![0-9]+]] +; CHECK-NEXT: ret void, !dbg [[DBG21:![0-9]+]] ; entry: %0 = load i32, ptr @G, align 4, !dbg !19 @@ -34,23 +26,14 @@ entry: declare void @use(i32 noundef) define void @src() norecurse !dbg !22 { -; IS__TUNIT____: Function Attrs: norecurse nosync writeonly -; IS__TUNIT____-LABEL: define {{[^@]+}}@src -; IS__TUNIT____-SAME: () #[[ATTR0:[0-9]+]] !dbg [[DBG21:![0-9]+]] { -; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32 @speculatable(), !dbg [[DBG22:![0-9]+]] -; IS__TUNIT____-NEXT: [[PLUS1:%.*]] = add i32 [[CALL]], 1 -; IS__TUNIT____-NEXT: store i32 [[PLUS1]], ptr @G, align 4, !dbg [[DBG23:![0-9]+]] -; IS__TUNIT____-NEXT: ret void, !dbg [[DBG24:![0-9]+]] -; -; IS__CGSCC____: Function Attrs: norecurse nosync writeonly -; IS__CGSCC____-LABEL: define {{[^@]+}}@src -; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] !dbg [[DBG22:![0-9]+]] { -; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i32 @speculatable(), !dbg [[DBG23:![0-9]+]] -; IS__CGSCC____-NEXT: [[PLUS1:%.*]] = add i32 [[CALL]], 1 -; IS__CGSCC____-NEXT: store i32 [[PLUS1]], ptr @G, align 4, !dbg [[DBG24:![0-9]+]] -; IS__CGSCC____-NEXT: ret void, !dbg [[DBG25:![0-9]+]] +; CHECK: Function Attrs: norecurse nosync writeonly +; CHECK-LABEL: define {{[^@]+}}@src +; CHECK-SAME: () #[[ATTR0:[0-9]+]] !dbg [[DBG22:![0-9]+]] { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[CALL:%.*]] = call i32 @speculatable(), !dbg [[DBG23:![0-9]+]] +; CHECK-NEXT: [[PLUS1:%.*]] = add i32 [[CALL]], 1 +; CHECK-NEXT: store i32 [[PLUS1]], ptr @G, align 4, !dbg [[DBG24:![0-9]+]] +; CHECK-NEXT: ret void, !dbg [[DBG25:![0-9]+]] ; entry: %call = call i32 @speculatable(), !dbg !23 @@ -92,59 +75,33 @@ declare i32 @speculatable() speculatable readnone !24 = !DILocation(line: 10, column: 7, scope: !22) !25 = !DILocation(line: 11, column: 1, scope: !22) ;. -; CHECK: attributes #[[ATTR0:[0-9]+]] = { norecurse nosync writeonly } +; CHECK: attributes #[[ATTR0]] = { norecurse nosync writeonly } ; CHECK: attributes #[[ATTR1:[0-9]+]] = { readnone speculatable } ;. -; IS__TUNIT____: [[DBG0]] = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) -; IS__TUNIT____: [[META1:![0-9]+]] = distinct !DIGlobalVariable(name: "G", scope: !2, file: !5, line: 1, type: !6, isLocal: true, isDefinition: true) -; IS__TUNIT____: [[META2:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git ef94609d6ebe981767788e6877b0b3b731d425af)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None) -; IS__TUNIT____: [[META3:![0-9]+]] = !DIFile(filename: "/app/example.c", directory: "/app", checksumkind: CSK_MD5, checksum: "b456b90cec5c3705a028b274d88ee970") -; IS__TUNIT____: [[META4:![0-9]+]] = !{!0} -; IS__TUNIT____: [[META5:![0-9]+]] = !DIFile(filename: "example.c", directory: "/app", checksumkind: CSK_MD5, checksum: "b456b90cec5c3705a028b274d88ee970") -; IS__TUNIT____: [[META6:![0-9]+]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -; IS__TUNIT____: [[META7:![0-9]+]] = !{i32 7, !"Dwarf Version", i32 5} -; IS__TUNIT____: [[META8:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3} -; IS__TUNIT____: [[META9:![0-9]+]] = !{i32 1, !"wchar_size", i32 4} -; IS__TUNIT____: [[META10:![0-9]+]] = !{i32 7, !"PIC Level", i32 2} -; IS__TUNIT____: [[META11:![0-9]+]] = !{i32 7, !"PIE Level", i32 2} -; IS__TUNIT____: [[META12:![0-9]+]] = !{i32 7, !"uwtable", i32 2} -; IS__TUNIT____: [[META13:![0-9]+]] = !{i32 7, !"frame-pointer", i32 2} -; IS__TUNIT____: [[META14:![0-9]+]] = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project.git ef94609d6ebe981767788e6877b0b3b731d425af)"} -; IS__TUNIT____: [[DBG15]] = distinct !DISubprogram(name: "dest", scope: !5, file: !5, line: 4, type: !16, scopeLine: 4, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18) -; IS__TUNIT____: [[META16:![0-9]+]] = !DISubroutineType(types: !17) -; IS__TUNIT____: [[META17:![0-9]+]] = !{null} -; IS__TUNIT____: [[META18:![0-9]+]] = !{} -; IS__TUNIT____: [[DBG19]] = !DILocation(line: 5, column: 5, scope: !15) -; IS__TUNIT____: [[DBG20]] = !DILocation(line: 6, column: 1, scope: !15) -; IS__TUNIT____: [[DBG21]] = distinct !DISubprogram(name: "src", scope: !5, file: !5, line: 9, type: !16, scopeLine: 9, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18) -; IS__TUNIT____: [[DBG22]] = !DILocation(line: 10, column: 9, scope: !21) -; IS__TUNIT____: [[DBG23]] = !DILocation(line: 10, column: 7, scope: !21) -; IS__TUNIT____: [[DBG24]] = !DILocation(line: 11, column: 1, scope: !21) -;. -; IS__CGSCC____: [[DBG0]] = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) -; IS__CGSCC____: [[META1:![0-9]+]] = distinct !DIGlobalVariable(name: "G", scope: !2, file: !5, line: 1, type: !6, isLocal: true, isDefinition: true) -; IS__CGSCC____: [[META2:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git ef94609d6ebe981767788e6877b0b3b731d425af)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None) -; IS__CGSCC____: [[META3:![0-9]+]] = !DIFile(filename: "/app/example.c", directory: "/app", checksumkind: CSK_MD5, checksum: "b456b90cec5c3705a028b274d88ee970") -; IS__CGSCC____: [[META4:![0-9]+]] = !{!0} -; IS__CGSCC____: [[META5:![0-9]+]] = !DIFile(filename: "example.c", directory: "/app", checksumkind: CSK_MD5, checksum: "b456b90cec5c3705a028b274d88ee970") -; IS__CGSCC____: [[META6:![0-9]+]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -; IS__CGSCC____: [[META7:![0-9]+]] = !{i32 7, !"Dwarf Version", i32 5} -; IS__CGSCC____: [[META8:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3} -; IS__CGSCC____: [[META9:![0-9]+]] = !{i32 1, !"wchar_size", i32 4} -; IS__CGSCC____: [[META10:![0-9]+]] = !{i32 7, !"PIC Level", i32 2} -; IS__CGSCC____: [[META11:![0-9]+]] = !{i32 7, !"PIE Level", i32 2} -; IS__CGSCC____: [[META12:![0-9]+]] = !{i32 7, !"uwtable", i32 2} -; IS__CGSCC____: [[META13:![0-9]+]] = !{i32 7, !"frame-pointer", i32 2} -; IS__CGSCC____: [[META14:![0-9]+]] = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project.git ef94609d6ebe981767788e6877b0b3b731d425af)"} -; IS__CGSCC____: [[DBG15]] = distinct !DISubprogram(name: "dest", scope: !5, file: !5, line: 4, type: !16, scopeLine: 4, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18) -; IS__CGSCC____: [[META16:![0-9]+]] = !DISubroutineType(types: !17) -; IS__CGSCC____: [[META17:![0-9]+]] = !{null} -; IS__CGSCC____: [[META18:![0-9]+]] = !{} -; IS__CGSCC____: [[DBG19]] = !DILocation(line: 5, column: 9, scope: !15) -; IS__CGSCC____: [[DBG20]] = !DILocation(line: 5, column: 5, scope: !15) -; IS__CGSCC____: [[DBG21]] = !DILocation(line: 6, column: 1, scope: !15) -; IS__CGSCC____: [[DBG22]] = distinct !DISubprogram(name: "src", scope: !5, file: !5, line: 9, type: !16, scopeLine: 9, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18) -; IS__CGSCC____: [[DBG23]] = !DILocation(line: 10, column: 9, scope: !22) -; IS__CGSCC____: [[DBG24]] = !DILocation(line: 10, column: 7, scope: !22) -; IS__CGSCC____: [[DBG25]] = !DILocation(line: 11, column: 1, scope: !22) +; CHECK: [[DBG0]] = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) +; CHECK: [[META1:![0-9]+]] = distinct !DIGlobalVariable(name: "G", scope: !2, file: !5, line: 1, type: !6, isLocal: true, isDefinition: true) +; CHECK: [[META2:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git ef94609d6ebe981767788e6877b0b3b731d425af)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None) +; CHECK: [[META3:![0-9]+]] = !DIFile(filename: "/app/example.c", directory: "/app", checksumkind: CSK_MD5, checksum: "b456b90cec5c3705a028b274d88ee970") +; CHECK: [[META4:![0-9]+]] = !{!0} +; CHECK: [[META5:![0-9]+]] = !DIFile(filename: "example.c", directory: "/app", checksumkind: CSK_MD5, checksum: "b456b90cec5c3705a028b274d88ee970") +; CHECK: [[META6:![0-9]+]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +; CHECK: [[META7:![0-9]+]] = !{i32 7, !"Dwarf Version", i32 5} +; CHECK: [[META8:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3} +; CHECK: [[META9:![0-9]+]] = !{i32 1, !"wchar_size", i32 4} +; CHECK: [[META10:![0-9]+]] = !{i32 7, !"PIC Level", i32 2} +; CHECK: [[META11:![0-9]+]] = !{i32 7, !"PIE Level", i32 2} +; CHECK: [[META12:![0-9]+]] = !{i32 7, !"uwtable", i32 2} +; CHECK: [[META13:![0-9]+]] = !{i32 7, !"frame-pointer", i32 2} +; CHECK: [[META14:![0-9]+]] = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project.git ef94609d6ebe981767788e6877b0b3b731d425af)"} +; CHECK: [[DBG15]] = distinct !DISubprogram(name: "dest", scope: !5, file: !5, line: 4, type: !16, scopeLine: 4, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18) +; CHECK: [[META16:![0-9]+]] = !DISubroutineType(types: !17) +; CHECK: [[META17:![0-9]+]] = !{null} +; CHECK: [[META18:![0-9]+]] = !{} +; CHECK: [[DBG19]] = !DILocation(line: 5, column: 9, scope: !15) +; CHECK: [[DBG20]] = !DILocation(line: 5, column: 5, scope: !15) +; CHECK: [[DBG21]] = !DILocation(line: 6, column: 1, scope: !15) +; CHECK: [[DBG22]] = distinct !DISubprogram(name: "src", scope: !5, file: !5, line: 9, type: !16, scopeLine: 9, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18) +; CHECK: [[DBG23]] = !DILocation(line: 10, column: 9, scope: !22) +; CHECK: [[DBG24]] = !DILocation(line: 10, column: 7, scope: !22) +; CHECK: [[DBG25]] = !DILocation(line: 11, column: 1, scope: !22) ;. diff --git a/llvm/test/Transforms/Attributor/value-simplify-gpu.ll b/llvm/test/Transforms/Attributor/value-simplify-gpu.ll index fa19fe63622d..0ef99fcca343 100644 --- a/llvm/test/Transforms/Attributor/value-simplify-gpu.ll +++ b/llvm/test/Transforms/Attributor/value-simplify-gpu.ll @@ -288,7 +288,7 @@ define internal void @level2a(i32* %addr) { ; IS__TUNIT____-NEXT: entry: ; IS__TUNIT____-NEXT: [[TMP0:%.*]] = load i32, i32* addrspacecast (i32 addrspace(3)* @ReachableNonKernel to i32*), align 4 ; IS__TUNIT____-NEXT: [[TMP1:%.*]] = load i32, i32* addrspacecast (i32 addrspace(3)* @UnreachableNonKernel to i32*), align 4 -; IS__TUNIT____-NEXT: call void @use(i32 noundef [[TMP0]], i32 noundef [[TMP1]], i32 17) #[[ATTR6]] +; IS__TUNIT____-NEXT: call void @use(i32 [[TMP0]], i32 [[TMP1]], i32 17) #[[ATTR6]] ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____: Function Attrs: nosync nounwind @@ -298,7 +298,7 @@ define internal void @level2a(i32* %addr) { ; IS__CGSCC____-NEXT: [[TMP0:%.*]] = load i32, i32* addrspacecast (i32 addrspace(3)* @ReachableNonKernel to i32*), align 4 ; IS__CGSCC____-NEXT: [[TMP1:%.*]] = load i32, i32* addrspacecast (i32 addrspace(3)* @UnreachableNonKernel to i32*), align 4 ; IS__CGSCC____-NEXT: [[QQQQ2:%.*]] = load i32, i32* [[ADDR]], align 4 -; IS__CGSCC____-NEXT: call void @use(i32 noundef [[TMP0]], i32 noundef [[TMP1]], i32 [[QQQQ2]]) #[[ATTR4]] +; IS__CGSCC____-NEXT: call void @use(i32 [[TMP0]], i32 [[TMP1]], i32 [[QQQQ2]]) #[[ATTR4]] ; IS__CGSCC____-NEXT: ret void ; entry: @@ -316,7 +316,7 @@ define internal void @level2b(i32* %addr) { ; IS__TUNIT____-NEXT: entry: ; IS__TUNIT____-NEXT: [[TMP0:%.*]] = load i32, i32* addrspacecast (i32 addrspace(3)* @ReachableNonKernel to i32*), align 4 ; IS__TUNIT____-NEXT: [[TMP1:%.*]] = load i32, i32* addrspacecast (i32 addrspace(3)* @UnreachableNonKernel to i32*), align 4 -; IS__TUNIT____-NEXT: call void @use(i32 noundef [[TMP0]], i32 noundef [[TMP1]], i32 17) #[[ATTR6]] +; IS__TUNIT____-NEXT: call void @use(i32 [[TMP0]], i32 [[TMP1]], i32 17) #[[ATTR6]] ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____: Function Attrs: nosync nounwind @@ -326,7 +326,7 @@ define internal void @level2b(i32* %addr) { ; IS__CGSCC____-NEXT: [[TMP0:%.*]] = load i32, i32* addrspacecast (i32 addrspace(3)* @ReachableNonKernel to i32*), align 4 ; IS__CGSCC____-NEXT: [[TMP1:%.*]] = load i32, i32* addrspacecast (i32 addrspace(3)* @UnreachableNonKernel to i32*), align 4 ; IS__CGSCC____-NEXT: [[TMP2:%.*]] = load i32, i32* [[ADDR]], align 4 -; IS__CGSCC____-NEXT: call void @use(i32 noundef [[TMP0]], i32 noundef [[TMP1]], i32 [[TMP2]]) #[[ATTR4]] +; IS__CGSCC____-NEXT: call void @use(i32 [[TMP0]], i32 [[TMP1]], i32 [[TMP2]]) #[[ATTR4]] ; IS__CGSCC____-NEXT: ret void ; entry: diff --git a/llvm/test/Transforms/Attributor/value-simplify-instances.ll b/llvm/test/Transforms/Attributor/value-simplify-instances.ll index 2b5d40e64d43..ef9afb60980a 100644 --- a/llvm/test/Transforms/Attributor/value-simplify-instances.ll +++ b/llvm/test/Transforms/Attributor/value-simplify-instances.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=17 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=17 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM @@ -26,49 +26,27 @@ define internal i1 @recursive_inst_comparator(i1* %a, i1* %b) { } define internal i1 @recursive_inst_generator(i1 %c, i1* %p) { -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@recursive_inst_generator -; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]], i1* nofree [[P:%.*]]) { -; IS__TUNIT_OPM-NEXT: [[A:%.*]] = call i1* @geti1Ptr() -; IS__TUNIT_OPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] -; IS__TUNIT_OPM: t: -; IS__TUNIT_OPM-NEXT: [[R1:%.*]] = call i1 @recursive_inst_comparator(i1* noalias nofree readnone [[A]], i1* noalias nofree readnone [[P]]) #[[ATTR6:[0-9]+]] -; IS__TUNIT_OPM-NEXT: ret i1 [[R1]] -; IS__TUNIT_OPM: f: -; IS__TUNIT_OPM-NEXT: [[R2:%.*]] = call i1 @recursive_inst_generator(i1 noundef true, i1* nofree [[A]]) -; IS__TUNIT_OPM-NEXT: ret i1 [[R2]] -; -; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@recursive_inst_generator -; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]], i1* nofree [[P:%.*]]) { -; IS__TUNIT_NPM-NEXT: [[A:%.*]] = call i1* @geti1Ptr() -; IS__TUNIT_NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] -; IS__TUNIT_NPM: t: -; IS__TUNIT_NPM-NEXT: [[R1:%.*]] = call i1 @recursive_inst_comparator(i1* noalias nofree readnone [[A]], i1* noalias nofree readnone [[A]]) #[[ATTR6:[0-9]+]] -; IS__TUNIT_NPM-NEXT: ret i1 [[R1]] -; IS__TUNIT_NPM: f: -; IS__TUNIT_NPM-NEXT: [[R2:%.*]] = call i1 @recursive_inst_generator(i1 noundef true, i1* nofree [[A]]) -; IS__TUNIT_NPM-NEXT: ret i1 [[R2]] -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@recursive_inst_generator -; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]], i1* nofree [[P:%.*]]) { -; IS__CGSCC_OPM-NEXT: [[A:%.*]] = call i1* @geti1Ptr() -; IS__CGSCC_OPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] -; IS__CGSCC_OPM: t: -; IS__CGSCC_OPM-NEXT: [[R1:%.*]] = call i1 @recursive_inst_comparator(i1* noalias nofree readnone [[A]], i1* noalias nofree readnone [[P]]) -; IS__CGSCC_OPM-NEXT: ret i1 [[R1]] -; IS__CGSCC_OPM: f: -; IS__CGSCC_OPM-NEXT: [[R2:%.*]] = call i1 @recursive_inst_generator(i1 noundef true, i1* nofree [[A]]) -; IS__CGSCC_OPM-NEXT: ret i1 [[R2]] +; IS__TUNIT____-LABEL: define {{[^@]+}}@recursive_inst_generator +; IS__TUNIT____-SAME: (i1 [[C:%.*]], i1* nofree [[P:%.*]]) { +; IS__TUNIT____-NEXT: [[A:%.*]] = call i1* @geti1Ptr() +; IS__TUNIT____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] +; IS__TUNIT____: t: +; IS__TUNIT____-NEXT: [[R1:%.*]] = call i1 @recursive_inst_comparator(i1* noalias nofree readnone [[A]], i1* noalias nofree readnone [[P]]) #[[ATTR6:[0-9]+]] +; IS__TUNIT____-NEXT: ret i1 [[R1]] +; IS__TUNIT____: f: +; IS__TUNIT____-NEXT: [[R2:%.*]] = call i1 @recursive_inst_generator(i1 noundef true, i1* nofree [[A]]) +; IS__TUNIT____-NEXT: ret i1 [[R2]] ; -; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@recursive_inst_generator -; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]], i1* nofree [[P:%.*]]) { -; IS__CGSCC_NPM-NEXT: [[A:%.*]] = call i1* @geti1Ptr() -; IS__CGSCC_NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] -; IS__CGSCC_NPM: t: -; IS__CGSCC_NPM-NEXT: [[R1:%.*]] = call i1 @recursive_inst_comparator(i1* noalias nofree readnone [[A]], i1* noalias nofree readnone [[A]]) -; IS__CGSCC_NPM-NEXT: ret i1 [[R1]] -; IS__CGSCC_NPM: f: -; IS__CGSCC_NPM-NEXT: [[R2:%.*]] = call i1 @recursive_inst_generator(i1 noundef true, i1* nofree [[A]]) -; IS__CGSCC_NPM-NEXT: ret i1 [[R2]] +; IS__CGSCC____-LABEL: define {{[^@]+}}@recursive_inst_generator +; IS__CGSCC____-SAME: (i1 [[C:%.*]], i1* nofree [[P:%.*]]) { +; IS__CGSCC____-NEXT: [[A:%.*]] = call i1* @geti1Ptr() +; IS__CGSCC____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] +; IS__CGSCC____: t: +; IS__CGSCC____-NEXT: [[R1:%.*]] = call i1 @recursive_inst_comparator(i1* noalias nofree readnone [[A]], i1* noalias nofree readnone [[P]]) +; IS__CGSCC____-NEXT: ret i1 [[R1]] +; IS__CGSCC____: f: +; IS__CGSCC____-NEXT: [[R2:%.*]] = call i1 @recursive_inst_generator(i1 noundef true, i1* nofree [[A]]) +; IS__CGSCC____-NEXT: ret i1 [[R2]] ; %a = call i1* @geti1Ptr() br i1 %c, label %t, label %f @@ -411,7 +389,7 @@ define i1 @recursive_inst_compare_caller_global3(i1 %c) { ; IS__TUNIT____: attributes #[[ATTR3]] = { argmemonly nofree nosync nounwind } ; IS__TUNIT____: attributes #[[ATTR4]] = { nofree nosync nounwind } ; IS__TUNIT____: attributes #[[ATTR5]] = { nofree norecurse nosync nounwind } -; IS__TUNIT____: attributes #[[ATTR6:[0-9]+]] = { nounwind readnone } +; IS__TUNIT____: attributes #[[ATTR6]] = { nounwind readnone } ;. ; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } ; IS__CGSCC____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone } diff --git a/llvm/test/Transforms/Attributor/value-simplify-local-remote.ll b/llvm/test/Transforms/Attributor/value-simplify-local-remote.ll new file mode 100644 index 000000000000..ec0e6c56ebef --- /dev/null +++ b/llvm/test/Transforms/Attributor/value-simplify-local-remote.ll @@ -0,0 +1,802 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM + +; Most reduced from the OpenMC app running OpenMP offloading code, caused crashes before as we +; mixed local and remote (=intra and inter procedural) values. + +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" + +%S = type { ptr } +%S.2 = type { ptr, i64, i64 } +%struct1 = type { %struct2 } +%struct2 = type <{ ptr, i64, i64, i32, [4 x i8] }> + +define i64 @t1(ptr %first, ptr %first.addr, ptr %0) { +; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; IS__TUNIT____-LABEL: define {{[^@]+}}@t1 +; IS__TUNIT____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST:%.*]], ptr nocapture nofree readnone [[FIRST_ADDR:%.*]], ptr nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] { +; IS__TUNIT____-NEXT: entry: +; IS__TUNIT____-NEXT: [[FIRST_ADDR1:%.*]] = alloca ptr, i32 0, align 8 +; IS__TUNIT____-NEXT: store ptr [[FIRST]], ptr [[FIRST]], align 8 +; IS__TUNIT____-NEXT: br label [[IF_END:%.*]] +; IS__TUNIT____: if.end: +; IS__TUNIT____-NEXT: [[CALL:%.*]] = call ptr @foo.4(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST]]) #[[ATTR3:[0-9]+]] +; IS__TUNIT____-NEXT: ret i64 0 +; +; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly +; IS__CGSCC____-LABEL: define {{[^@]+}}@t1 +; IS__CGSCC____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST:%.*]], ptr nocapture nofree readnone [[FIRST_ADDR:%.*]], ptr nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] { +; IS__CGSCC____-NEXT: entry: +; IS__CGSCC____-NEXT: [[FIRST_ADDR1:%.*]] = alloca ptr, i32 0, align 8 +; IS__CGSCC____-NEXT: store ptr [[FIRST]], ptr [[FIRST]], align 8 +; IS__CGSCC____-NEXT: br label [[IF_END:%.*]] +; IS__CGSCC____: if.end: +; IS__CGSCC____-NEXT: [[CALL:%.*]] = call ptr @foo.4(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST]]) #[[ATTR6:[0-9]+]] +; IS__CGSCC____-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds double, ptr [[CALL]], i64 -1 +; IS__CGSCC____-NEXT: ret i64 0 +; +entry: + %first.addr1 = alloca ptr, i32 0, align 8 + store ptr %first, ptr %first, align 8 + br label %if.end + +if.end: ; preds = %entry + %1 = load ptr, ptr %first, align 8 + %call = call ptr @foo.4(ptr %first) + %add.ptr = getelementptr inbounds double, ptr %call, i64 -1 + ret i64 0 +} + +define internal ptr @foo.4(ptr %__first) { +; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; IS__TUNIT____-LABEL: define {{[^@]+}}@foo.4 +; IS__TUNIT____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[__FIRST:%.*]]) #[[ATTR0]] { +; IS__TUNIT____-NEXT: entry: +; IS__TUNIT____-NEXT: [[__FIRST_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__TUNIT____-NEXT: store ptr [[__FIRST]], ptr [[__FIRST]], align 8 +; IS__TUNIT____-NEXT: ret ptr undef +; +; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly +; IS__CGSCC____-LABEL: define {{[^@]+}}@foo.4 +; IS__CGSCC____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[__FIRST:%.*]]) #[[ATTR0]] { +; IS__CGSCC____-NEXT: entry: +; IS__CGSCC____-NEXT: [[__FIRST_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__CGSCC____-NEXT: store ptr [[__FIRST]], ptr [[__FIRST]], align 8 +; IS__CGSCC____-NEXT: [[CALL1:%.*]] = call noalias noundef nonnull align 8 dereferenceable(8) ptr @bar(ptr noalias nofree noundef nonnull readnone align 8 dereferenceable(8) [[__FIRST]]) #[[ATTR7:[0-9]+]] +; IS__CGSCC____-NEXT: ret ptr [[CALL1]] +; +entry: + %__first.addr = alloca ptr, i32 0, align 8 + store ptr %__first, ptr %__first, align 8 + %0 = load ptr, ptr %__first, align 8 + %call1 = call ptr @bar(ptr %__first) + ret ptr %call1 +} + +define internal ptr @bar(ptr %QQfirst) { +; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__CGSCC____-LABEL: define {{[^@]+}}@bar +; IS__CGSCC____-SAME: (ptr noalias nofree noundef nonnull readnone returned align 8 dereferenceable(8) "no-capture-maybe-returned" [[QQFIRST:%.*]]) #[[ATTR1:[0-9]+]] { +; IS__CGSCC____-NEXT: entry: +; IS__CGSCC____-NEXT: [[QQFIRST_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__CGSCC____-NEXT: store ptr [[QQFIRST]], ptr [[QQFIRST_ADDR]], align 8 +; IS__CGSCC____-NEXT: br label [[WHILE_COND:%.*]] +; IS__CGSCC____: while.cond: +; IS__CGSCC____-NEXT: br label [[WHILE_END:%.*]] +; IS__CGSCC____: while.end: +; IS__CGSCC____-NEXT: ret ptr [[QQFIRST]] +; +entry: + %QQfirst.addr = alloca ptr, i32 0, align 8 + store ptr %QQfirst, ptr %QQfirst.addr, align 8 + br label %while.cond + +while.cond: ; preds = %entry + br label %while.end + +while.end: ; preds = %while.cond + %0 = load ptr, ptr %QQfirst.addr, align 8 + ret ptr %0 +} + +define ptr @t2(ptr %this, ptr %this.addr, ptr %this1) { +; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn +; IS__TUNIT____-LABEL: define {{[^@]+}}@t2 +; IS__TUNIT____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR1:[0-9]+]] { +; IS__TUNIT____-NEXT: entry: +; IS__TUNIT____-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8 +; IS__TUNIT____-NEXT: [[CALL:%.*]] = call [[S:%.*]] @foo.1(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4:[0-9]+]] +; IS__TUNIT____-NEXT: [[TEST_RET:%.*]] = extractvalue [[S]] [[CALL]], 0 +; IS__TUNIT____-NEXT: ret ptr [[TEST_RET]] +; +; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn +; IS__CGSCC____-LABEL: define {{[^@]+}}@t2 +; IS__CGSCC____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR2:[0-9]+]] { +; IS__CGSCC____-NEXT: entry: +; IS__CGSCC____-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8 +; IS__CGSCC____-NEXT: [[CALL:%.*]] = call [[S:%.*]] @foo.1(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8:[0-9]+]] +; IS__CGSCC____-NEXT: [[TEST_RET:%.*]] = extractvalue [[S]] [[CALL]], 0 +; IS__CGSCC____-NEXT: ret ptr [[TEST_RET]] +; +entry: + store ptr %this, ptr %this, align 8 + %this12 = load ptr, ptr %this, align 8 + %call = call %S @foo.1(ptr %this) + %test.ret = extractvalue %S %call, 0 + ret ptr %test.ret +} + +define internal %S @foo.1(ptr %foo.this) { +; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@foo.1 +; IS__TUNIT_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR1]] { +; IS__TUNIT_OPM-NEXT: entry: +; IS__TUNIT_OPM-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8 +; IS__TUNIT_OPM-NEXT: store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8 +; IS__TUNIT_OPM-NEXT: call void @bar.2(ptr nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR5:[0-9]+]] +; IS__TUNIT_OPM-NEXT: [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8 +; IS__TUNIT_OPM-NEXT: ret [[S]] [[FOO_RET]] +; +; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@foo.1 +; IS__TUNIT_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: entry: +; IS__TUNIT_NPM-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8 +; IS__TUNIT_NPM-NEXT: store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8 +; IS__TUNIT_NPM-NEXT: call void @bar.2(ptr noalias nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR5:[0-9]+]] +; IS__TUNIT_NPM-NEXT: [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8 +; IS__TUNIT_NPM-NEXT: ret [[S]] [[FOO_RET]] +; +; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@foo.1 +; IS__CGSCC_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR2]] { +; IS__CGSCC_OPM-NEXT: entry: +; IS__CGSCC_OPM-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8 +; IS__CGSCC_OPM-NEXT: store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8 +; IS__CGSCC_OPM-NEXT: call void @bar.2(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR6]] +; IS__CGSCC_OPM-NEXT: [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8 +; IS__CGSCC_OPM-NEXT: ret [[S]] [[FOO_RET]] +; +; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@foo.1 +; IS__CGSCC_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR2]] { +; IS__CGSCC_NPM-NEXT: entry: +; IS__CGSCC_NPM-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8 +; IS__CGSCC_NPM-NEXT: store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8 +; IS__CGSCC_NPM-NEXT: call void @bar.2(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR6]] +; IS__CGSCC_NPM-NEXT: [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8 +; IS__CGSCC_NPM-NEXT: ret [[S]] [[FOO_RET]] +; +entry: + %retval = alloca %S, i32 0, align 8 + store ptr %foo.this, ptr %foo.this, align 8 + call void @bar.2(ptr %retval, ptr %foo.this) + %foo.ret = load %S, ptr %retval, align 8 + ret %S %foo.ret +} + +define internal void @bar.2(ptr %bar.this, ptr %bar.data) { +; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@bar.2 +; IS__TUNIT_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] { +; IS__TUNIT_OPM-NEXT: entry: +; IS__TUNIT_OPM-NEXT: store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8 +; IS__TUNIT_OPM-NEXT: call void @baz(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR5]] +; IS__TUNIT_OPM-NEXT: ret void +; +; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@bar.2 +; IS__TUNIT_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] { +; IS__TUNIT_NPM-NEXT: entry: +; IS__TUNIT_NPM-NEXT: store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8 +; IS__TUNIT_NPM-NEXT: call void @baz(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR5]] +; IS__TUNIT_NPM-NEXT: ret void +; +; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@bar.2 +; IS__CGSCC_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] { +; IS__CGSCC_OPM-NEXT: entry: +; IS__CGSCC_OPM-NEXT: store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8 +; IS__CGSCC_OPM-NEXT: call void @baz(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR6]] +; IS__CGSCC_OPM-NEXT: ret void +; +; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@bar.2 +; IS__CGSCC_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] { +; IS__CGSCC_NPM-NEXT: entry: +; IS__CGSCC_NPM-NEXT: store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8 +; IS__CGSCC_NPM-NEXT: call void @baz(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR6]] +; IS__CGSCC_NPM-NEXT: ret void +; +entry: + store ptr %bar.data, ptr %bar.this, align 8 + call void @baz(ptr %bar.this, ptr %bar.data) + ret void +} + +define internal void @baz(ptr %baz.this, ptr %baz.data) { +; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; IS__TUNIT____-LABEL: define {{[^@]+}}@baz +; IS__TUNIT____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAZ_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAZ_DATA:%.*]]) #[[ATTR0]] { +; IS__TUNIT____-NEXT: entry: +; IS__TUNIT____-NEXT: store ptr [[BAZ_DATA]], ptr [[BAZ_THIS]], align 8 +; IS__TUNIT____-NEXT: ret void +; +; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; IS__CGSCC____-LABEL: define {{[^@]+}}@baz +; IS__CGSCC____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAZ_THIS:%.*]], ptr nofree writeonly [[BAZ_DATA:%.*]]) #[[ATTR3:[0-9]+]] { +; IS__CGSCC____-NEXT: entry: +; IS__CGSCC____-NEXT: store ptr [[BAZ_DATA]], ptr [[BAZ_THIS]], align 8 +; IS__CGSCC____-NEXT: ret void +; +entry: + store ptr %baz.data, ptr %baz.this, align 8 + ret void +} + +define ptr @foo(ptr %this, ptr %this.addr, ptr %this1) { +; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn +; IS__TUNIT____-LABEL: define {{[^@]+}}@foo +; IS__TUNIT____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR1]] { +; IS__TUNIT____-NEXT: entry: +; IS__TUNIT____-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8 +; IS__TUNIT____-NEXT: [[CALL:%.*]] = call [[S:%.*]] @bar.5(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4]] +; IS__TUNIT____-NEXT: [[FOO_RET:%.*]] = extractvalue [[S]] [[CALL]], 0 +; IS__TUNIT____-NEXT: ret ptr [[FOO_RET]] +; +; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn +; IS__CGSCC____-LABEL: define {{[^@]+}}@foo +; IS__CGSCC____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR2]] { +; IS__CGSCC____-NEXT: entry: +; IS__CGSCC____-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8 +; IS__CGSCC____-NEXT: [[CALL:%.*]] = call [[S:%.*]] @bar.5(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]] +; IS__CGSCC____-NEXT: [[FOO_RET:%.*]] = extractvalue [[S]] [[CALL]], 0 +; IS__CGSCC____-NEXT: ret ptr [[FOO_RET]] +; +entry: + store ptr %this, ptr %this, align 8 + %this12 = load ptr, ptr %this, align 8 + %call = call %S @bar.5(ptr %this) + %foo.ret = extractvalue %S %call, 0 + ret ptr %foo.ret +} + +define internal %S @bar.5(ptr %this) { +; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@bar.5 +; IS__TUNIT_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR1]] { +; IS__TUNIT_OPM-NEXT: entry: +; IS__TUNIT_OPM-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8 +; IS__TUNIT_OPM-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8 +; IS__TUNIT_OPM-NEXT: call void @baz.6(ptr nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4]] +; IS__TUNIT_OPM-NEXT: [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8 +; IS__TUNIT_OPM-NEXT: ret [[S]] [[BAR_RET]] +; +; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@bar.5 +; IS__TUNIT_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: entry: +; IS__TUNIT_NPM-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8 +; IS__TUNIT_NPM-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8 +; IS__TUNIT_NPM-NEXT: call void @baz.6(ptr noalias nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4]] +; IS__TUNIT_NPM-NEXT: [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8 +; IS__TUNIT_NPM-NEXT: ret [[S]] [[BAR_RET]] +; +; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@bar.5 +; IS__CGSCC_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] { +; IS__CGSCC_OPM-NEXT: entry: +; IS__CGSCC_OPM-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8 +; IS__CGSCC_OPM-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8 +; IS__CGSCC_OPM-NEXT: call void @baz.6(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]] +; IS__CGSCC_OPM-NEXT: [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8 +; IS__CGSCC_OPM-NEXT: ret [[S]] [[BAR_RET]] +; +; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@bar.5 +; IS__CGSCC_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] { +; IS__CGSCC_NPM-NEXT: entry: +; IS__CGSCC_NPM-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8 +; IS__CGSCC_NPM-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8 +; IS__CGSCC_NPM-NEXT: call void @baz.6(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]] +; IS__CGSCC_NPM-NEXT: [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8 +; IS__CGSCC_NPM-NEXT: ret [[S]] [[BAR_RET]] +; +entry: + %retval = alloca %S, i32 0, align 8 + store ptr %this, ptr %this, align 8 + %0 = load ptr, ptr %this, align 8 + call void @baz.6(ptr %retval, ptr %this) + %bar.ret = load %S, ptr %retval, align 8 + ret %S %bar.ret +} + +define internal void @baz.6(ptr %this, ptr %data) { +; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@baz.6 +; IS__TUNIT_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR1]] { +; IS__TUNIT_OPM-NEXT: entry: +; IS__TUNIT_OPM-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8 +; IS__TUNIT_OPM-NEXT: call void @boom(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR4]] +; IS__TUNIT_OPM-NEXT: ret void +; +; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@baz.6 +; IS__TUNIT_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR1]] { +; IS__TUNIT_NPM-NEXT: entry: +; IS__TUNIT_NPM-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8 +; IS__TUNIT_NPM-NEXT: call void @boom(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR4]] +; IS__TUNIT_NPM-NEXT: ret void +; +; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@baz.6 +; IS__CGSCC_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR2]] { +; IS__CGSCC_OPM-NEXT: entry: +; IS__CGSCC_OPM-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8 +; IS__CGSCC_OPM-NEXT: call void @boom(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR8]] +; IS__CGSCC_OPM-NEXT: ret void +; +; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@baz.6 +; IS__CGSCC_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR2]] { +; IS__CGSCC_NPM-NEXT: entry: +; IS__CGSCC_NPM-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8 +; IS__CGSCC_NPM-NEXT: call void @boom(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR8]] +; IS__CGSCC_NPM-NEXT: ret void +; +entry: + store ptr %data, ptr %this, align 8 + call void @boom(ptr %this, ptr %data) + ret void +} + +define internal void @boom(ptr %this, ptr %data) { +; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn +; IS__TUNIT____-LABEL: define {{[^@]+}}@boom +; IS__TUNIT____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR1]] { +; IS__TUNIT____-NEXT: entry: +; IS__TUNIT____-NEXT: [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__TUNIT____-NEXT: store ptr [[DATA]], ptr [[DATA_ADDR]], align 8 +; IS__TUNIT____-NEXT: [[V:%.*]] = load ptr, ptr [[DATA_ADDR]], align 8 +; IS__TUNIT____-NEXT: store ptr [[V]], ptr [[THIS]], align 8 +; IS__TUNIT____-NEXT: ret void +; +; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn +; IS__CGSCC____-LABEL: define {{[^@]+}}@boom +; IS__CGSCC____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree [[DATA:%.*]]) #[[ATTR4:[0-9]+]] { +; IS__CGSCC____-NEXT: entry: +; IS__CGSCC____-NEXT: [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__CGSCC____-NEXT: store ptr [[DATA]], ptr [[DATA_ADDR]], align 8 +; IS__CGSCC____-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8 +; IS__CGSCC____-NEXT: ret void +; +entry: + %data.addr = alloca ptr, i32 0, align 8 + store ptr %data, ptr %data.addr, align 8 + %v = load ptr, ptr %data.addr, align 8 + store ptr %v, ptr %this, align 8 + ret void +} + +define weak_odr void @t3() { +; CHECK-LABEL: define {{[^@]+}}@t3() { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[TMP0:%.*]] = call i32 @__kmpc_target_init(ptr noalias nocapture noundef align 4294967296 null, i8 noundef 0, i1 noundef false, i1 noundef false) +; CHECK-NEXT: br label [[USER_CODE_ENTRY:%.*]] +; CHECK: user_code.entry: +; CHECK-NEXT: br label [[FOR_COND:%.*]] +; CHECK: for.cond: +; CHECK-NEXT: br label [[FOR_BODY:%.*]] +; CHECK: for.body: +; CHECK-NEXT: [[CALL4:%.*]] = call [[S_2:%.*]] @t3.helper() +; CHECK-NEXT: ret void +; +entry: + %0 = call i32 @__kmpc_target_init(ptr null, i8 0, i1 false, i1 false) + br label %user_code.entry + +user_code.entry: ; preds = %entry + br label %for.cond + +for.cond: ; preds = %user_code.entry + br label %for.body + +for.body: ; preds = %for.cond + %call4 = call %S.2 @t3.helper() + ret void +} + +declare i32 @__kmpc_target_init(ptr, i8, i1, i1) + +define %S.2 @t3.helper() { +; CHECK-LABEL: define {{[^@]+}}@t3.helper() { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[RETVAL:%.*]] = alloca [[S_2:%.*]], align 8 +; CHECK-NEXT: call void @ext1(ptr noundef nonnull align 8 dereferenceable(24) [[RETVAL]]) +; CHECK-NEXT: [[DOTFCA_0_LOAD:%.*]] = load ptr, ptr [[RETVAL]], align 8 +; CHECK-NEXT: [[DOTFCA_0_INSERT:%.*]] = insertvalue [[S_2]] poison, ptr [[DOTFCA_0_LOAD]], 0 +; CHECK-NEXT: [[DOTFCA_1_GEP:%.*]] = getelementptr inbounds [[S_2]], ptr [[RETVAL]], i32 0, i32 1 +; CHECK-NEXT: [[DOTFCA_1_LOAD:%.*]] = load i64, ptr [[DOTFCA_1_GEP]], align 8 +; CHECK-NEXT: [[DOTFCA_1_INSERT:%.*]] = insertvalue [[S_2]] [[DOTFCA_0_INSERT]], i64 [[DOTFCA_1_LOAD]], 1 +; CHECK-NEXT: [[DOTFCA_2_GEP:%.*]] = getelementptr inbounds [[S_2]], ptr [[RETVAL]], i32 0, i32 2 +; CHECK-NEXT: [[DOTFCA_2_LOAD:%.*]] = load i64, ptr [[DOTFCA_2_GEP]], align 8 +; CHECK-NEXT: [[DOTFCA_2_INSERT:%.*]] = insertvalue [[S_2]] [[DOTFCA_1_INSERT]], i64 [[DOTFCA_2_LOAD]], 2 +; CHECK-NEXT: ret [[S_2]] zeroinitializer +; +entry: + %retval = alloca %S.2, align 8 + call void @ext1(ptr %retval) + %.fca.0.gep = getelementptr inbounds %S.2, ptr %retval, i32 0, i32 0 + %.fca.0.load = load ptr, ptr %.fca.0.gep, align 8 + %.fca.0.insert = insertvalue %S.2 poison, ptr %.fca.0.load, 0 + %.fca.1.gep = getelementptr inbounds %S.2, ptr %retval, i32 0, i32 1 + %.fca.1.load = load i64, ptr %.fca.1.gep, align 8 + %.fca.1.insert = insertvalue %S.2 %.fca.0.insert, i64 %.fca.1.load, 1 + %.fca.2.gep = getelementptr inbounds %S.2, ptr %retval, i32 0, i32 2 + %.fca.2.load = load i64, ptr %.fca.2.gep, align 8 + %.fca.2.insert = insertvalue %S.2 %.fca.1.insert, i64 %.fca.2.load, 2 + ret %S.2 zeroinitializer +} + +declare void @ext1(ptr) + +; Taken from https://github.com/llvm/llvm-project/issues/54981 +define dso_local void @spam() { +; IS__TUNIT_OPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@spam +; IS__TUNIT_OPM-SAME: () #[[ATTR2:[0-9]+]] { +; IS__TUNIT_OPM-NEXT: bb: +; IS__TUNIT_OPM-NEXT: [[TMP:%.*]] = alloca i32, align 4 +; IS__TUNIT_OPM-NEXT: [[X:%.*]] = fptosi float undef to i32 +; IS__TUNIT_OPM-NEXT: store i32 [[X]], ptr [[TMP]], align 4 +; IS__TUNIT_OPM-NEXT: br label [[BB16:%.*]] +; IS__TUNIT_OPM: bb16: +; IS__TUNIT_OPM-NEXT: [[TMP17:%.*]] = load i32, ptr [[TMP]], align 4 +; IS__TUNIT_OPM-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP17]], 0 +; IS__TUNIT_OPM-NEXT: br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]] +; IS__TUNIT_OPM: bb19: +; IS__TUNIT_OPM-NEXT: [[Y:%.*]] = getelementptr inbounds i32, ptr [[TMP]], i64 0 +; IS__TUNIT_OPM-NEXT: [[TMP20:%.*]] = bitcast ptr [[Y]] to ptr +; IS__TUNIT_OPM-NEXT: [[TMP21:%.*]] = load float, ptr [[TMP20]], align 4 +; IS__TUNIT_OPM-NEXT: [[TMP22:%.*]] = fadd fast float [[TMP21]], 0.000000e+00 +; IS__TUNIT_OPM-NEXT: br label [[BB23:%.*]] +; IS__TUNIT_OPM: bb23: +; IS__TUNIT_OPM-NEXT: [[TMP24:%.*]] = phi <2 x float> [ undef, [[BB19]] ], [ [[TMP26:%.*]], [[BB34:%.*]] ] +; IS__TUNIT_OPM-NEXT: br label [[BB25:%.*]] +; IS__TUNIT_OPM: bb25: +; IS__TUNIT_OPM-NEXT: [[TMP26]] = phi <2 x float> [ [[TMP30:%.*]], [[BB28:%.*]] ], [ [[TMP24]], [[BB23]] ] +; IS__TUNIT_OPM-NEXT: [[TMP27:%.*]] = icmp ult i32 undef, 8 +; IS__TUNIT_OPM-NEXT: br i1 [[TMP27]], label [[BB28]], label [[BB34]] +; IS__TUNIT_OPM: bb28: +; IS__TUNIT_OPM-NEXT: [[TMP29:%.*]] = insertelement <2 x float> [[TMP26]], float undef, i32 0 +; IS__TUNIT_OPM-NEXT: [[TMP30]] = insertelement <2 x float> [[TMP29]], float [[TMP22]], i32 1 +; IS__TUNIT_OPM-NEXT: br label [[BB25]] +; IS__TUNIT_OPM: bb34: +; IS__TUNIT_OPM-NEXT: br label [[BB23]] +; IS__TUNIT_OPM: bb35: +; IS__TUNIT_OPM-NEXT: unreachable +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone +; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@spam +; IS__TUNIT_NPM-SAME: () #[[ATTR2:[0-9]+]] { +; IS__TUNIT_NPM-NEXT: bb: +; IS__TUNIT_NPM-NEXT: [[TMP:%.*]] = alloca i32, align 4 +; IS__TUNIT_NPM-NEXT: [[X:%.*]] = fptosi float undef to i32 +; IS__TUNIT_NPM-NEXT: store i32 [[X]], ptr [[TMP]], align 4 +; IS__TUNIT_NPM-NEXT: br label [[BB16:%.*]] +; IS__TUNIT_NPM: bb16: +; IS__TUNIT_NPM-NEXT: [[TMP18:%.*]] = icmp eq i32 [[X]], 0 +; IS__TUNIT_NPM-NEXT: br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]] +; IS__TUNIT_NPM: bb19: +; IS__TUNIT_NPM-NEXT: [[TMP21:%.*]] = load float, ptr [[TMP]], align 4 +; IS__TUNIT_NPM-NEXT: [[TMP22:%.*]] = fadd fast float [[TMP21]], 0.000000e+00 +; IS__TUNIT_NPM-NEXT: br label [[BB23:%.*]] +; IS__TUNIT_NPM: bb23: +; IS__TUNIT_NPM-NEXT: [[TMP24:%.*]] = phi <2 x float> [ undef, [[BB19]] ], [ [[TMP26:%.*]], [[BB34:%.*]] ] +; IS__TUNIT_NPM-NEXT: br label [[BB25:%.*]] +; IS__TUNIT_NPM: bb25: +; IS__TUNIT_NPM-NEXT: [[TMP26]] = phi <2 x float> [ [[TMP30:%.*]], [[BB28:%.*]] ], [ [[TMP24]], [[BB23]] ] +; IS__TUNIT_NPM-NEXT: [[TMP27:%.*]] = icmp ult i32 undef, 8 +; IS__TUNIT_NPM-NEXT: br i1 [[TMP27]], label [[BB28]], label [[BB34]] +; IS__TUNIT_NPM: bb28: +; IS__TUNIT_NPM-NEXT: [[TMP29:%.*]] = insertelement <2 x float> [[TMP26]], float undef, i32 0 +; IS__TUNIT_NPM-NEXT: [[TMP30]] = insertelement <2 x float> [[TMP29]], float [[TMP22]], i32 1 +; IS__TUNIT_NPM-NEXT: br label [[BB25]] +; IS__TUNIT_NPM: bb34: +; IS__TUNIT_NPM-NEXT: br label [[BB23]] +; IS__TUNIT_NPM: bb35: +; IS__TUNIT_NPM-NEXT: unreachable +; +; IS__CGSCC_OPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@spam +; IS__CGSCC_OPM-SAME: () #[[ATTR5:[0-9]+]] { +; IS__CGSCC_OPM-NEXT: bb: +; IS__CGSCC_OPM-NEXT: [[TMP:%.*]] = alloca i32, align 4 +; IS__CGSCC_OPM-NEXT: [[X:%.*]] = fptosi float undef to i32 +; IS__CGSCC_OPM-NEXT: store i32 [[X]], ptr [[TMP]], align 4 +; IS__CGSCC_OPM-NEXT: br label [[BB16:%.*]] +; IS__CGSCC_OPM: bb16: +; IS__CGSCC_OPM-NEXT: [[TMP17:%.*]] = load i32, ptr [[TMP]], align 4 +; IS__CGSCC_OPM-NEXT: [[TMP18:%.*]] = icmp eq i32 [[TMP17]], 0 +; IS__CGSCC_OPM-NEXT: br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]] +; IS__CGSCC_OPM: bb19: +; IS__CGSCC_OPM-NEXT: [[Y:%.*]] = getelementptr inbounds i32, ptr [[TMP]], i64 0 +; IS__CGSCC_OPM-NEXT: [[TMP20:%.*]] = bitcast ptr [[Y]] to ptr +; IS__CGSCC_OPM-NEXT: [[TMP21:%.*]] = load float, ptr [[TMP20]], align 4 +; IS__CGSCC_OPM-NEXT: [[TMP22:%.*]] = fadd fast float [[TMP21]], 0.000000e+00 +; IS__CGSCC_OPM-NEXT: br label [[BB23:%.*]] +; IS__CGSCC_OPM: bb23: +; IS__CGSCC_OPM-NEXT: [[TMP24:%.*]] = phi <2 x float> [ undef, [[BB19]] ], [ [[TMP26:%.*]], [[BB34:%.*]] ] +; IS__CGSCC_OPM-NEXT: br label [[BB25:%.*]] +; IS__CGSCC_OPM: bb25: +; IS__CGSCC_OPM-NEXT: [[TMP26]] = phi <2 x float> [ [[TMP30:%.*]], [[BB28:%.*]] ], [ [[TMP24]], [[BB23]] ] +; IS__CGSCC_OPM-NEXT: [[TMP27:%.*]] = icmp ult i32 undef, 8 +; IS__CGSCC_OPM-NEXT: br i1 [[TMP27]], label [[BB28]], label [[BB34]] +; IS__CGSCC_OPM: bb28: +; IS__CGSCC_OPM-NEXT: [[TMP29:%.*]] = insertelement <2 x float> [[TMP26]], float undef, i32 0 +; IS__CGSCC_OPM-NEXT: [[TMP30]] = insertelement <2 x float> [[TMP29]], float [[TMP22]], i32 1 +; IS__CGSCC_OPM-NEXT: br label [[BB25]] +; IS__CGSCC_OPM: bb34: +; IS__CGSCC_OPM-NEXT: br label [[BB23]] +; IS__CGSCC_OPM: bb35: +; IS__CGSCC_OPM-NEXT: unreachable +; +; IS__CGSCC_NPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@spam +; IS__CGSCC_NPM-SAME: () #[[ATTR5:[0-9]+]] { +; IS__CGSCC_NPM-NEXT: bb: +; IS__CGSCC_NPM-NEXT: [[TMP:%.*]] = alloca i32, align 4 +; IS__CGSCC_NPM-NEXT: [[X:%.*]] = fptosi float undef to i32 +; IS__CGSCC_NPM-NEXT: store i32 [[X]], ptr [[TMP]], align 4 +; IS__CGSCC_NPM-NEXT: br label [[BB16:%.*]] +; IS__CGSCC_NPM: bb16: +; IS__CGSCC_NPM-NEXT: [[TMP18:%.*]] = icmp eq i32 [[X]], 0 +; IS__CGSCC_NPM-NEXT: br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]] +; IS__CGSCC_NPM: bb19: +; IS__CGSCC_NPM-NEXT: [[TMP21:%.*]] = load float, ptr [[TMP]], align 4 +; IS__CGSCC_NPM-NEXT: [[TMP22:%.*]] = fadd fast float [[TMP21]], 0.000000e+00 +; IS__CGSCC_NPM-NEXT: br label [[BB23:%.*]] +; IS__CGSCC_NPM: bb23: +; IS__CGSCC_NPM-NEXT: [[TMP24:%.*]] = phi <2 x float> [ undef, [[BB19]] ], [ [[TMP26:%.*]], [[BB34:%.*]] ] +; IS__CGSCC_NPM-NEXT: br label [[BB25:%.*]] +; IS__CGSCC_NPM: bb25: +; IS__CGSCC_NPM-NEXT: [[TMP26]] = phi <2 x float> [ [[TMP30:%.*]], [[BB28:%.*]] ], [ [[TMP24]], [[BB23]] ] +; IS__CGSCC_NPM-NEXT: [[TMP27:%.*]] = icmp ult i32 undef, 8 +; IS__CGSCC_NPM-NEXT: br i1 [[TMP27]], label [[BB28]], label [[BB34]] +; IS__CGSCC_NPM: bb28: +; IS__CGSCC_NPM-NEXT: [[TMP29:%.*]] = insertelement <2 x float> [[TMP26]], float undef, i32 0 +; IS__CGSCC_NPM-NEXT: [[TMP30]] = insertelement <2 x float> [[TMP29]], float [[TMP22]], i32 1 +; IS__CGSCC_NPM-NEXT: br label [[BB25]] +; IS__CGSCC_NPM: bb34: +; IS__CGSCC_NPM-NEXT: br label [[BB23]] +; IS__CGSCC_NPM: bb35: +; IS__CGSCC_NPM-NEXT: unreachable +; +bb: + %tmp = alloca i32, align 4 + %tmp12 = getelementptr inbounds i32, ptr %tmp, i64 0 + %tmp15 = getelementptr inbounds i32, ptr %tmp, i64 0 + %x = fptosi float undef to i32 + store i32 %x, ptr %tmp15, align 4 + br label %bb16 + +bb16: ; preds = %bb + %tmp17 = load i32, ptr %tmp12, align 4 + %tmp18 = icmp eq i32 %tmp17, 0 + br i1 %tmp18, label %bb35, label %bb19 + +bb19: ; preds = %bb16 + %y = getelementptr inbounds i32, ptr %tmp, i64 0 + %tmp20 = bitcast ptr %y to ptr + %tmp21 = load float, ptr %tmp20, align 4 + %tmp22 = fadd fast float %tmp21, 0.000000e+00 + br label %bb23 + +bb23: ; preds = %bb34, %bb19 + %tmp24 = phi <2 x float> [ undef, %bb19 ], [ %tmp26, %bb34 ] + br label %bb25 + +bb25: ; preds = %bb28, %bb23 + %tmp26 = phi <2 x float> [ %tmp30, %bb28 ], [ %tmp24, %bb23 ] + %tmp27 = icmp ult i32 undef, 8 + br i1 %tmp27, label %bb28, label %bb34 + +bb28: ; preds = %bb25 + %tmp29 = insertelement <2 x float> %tmp26, float undef, i32 0 + %tmp30 = insertelement <2 x float> %tmp29, float %tmp22, i32 1 + br label %bb25 + +bb34: ; preds = %bb25 + br label %bb23 + +bb35: ; preds = %bb16 + unreachable +} + +define double @t4(ptr %this, ptr %this.addr, ptr %this1) { +; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; IS__TUNIT____-LABEL: define {{[^@]+}}@t4 +; IS__TUNIT____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR0]] { +; IS__TUNIT____-NEXT: entry: +; IS__TUNIT____-NEXT: [[THIS_ADDR1:%.*]] = alloca ptr, i32 0, align 8 +; IS__TUNIT____-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8 +; IS__TUNIT____-NEXT: [[CALL:%.*]] = call [[S:%.*]] @t4a(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR5:[0-9]+]] +; IS__TUNIT____-NEXT: ret double 0.000000e+00 +; +; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn +; IS__CGSCC____-LABEL: define {{[^@]+}}@t4 +; IS__CGSCC____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR2]] { +; IS__CGSCC____-NEXT: entry: +; IS__CGSCC____-NEXT: [[THIS_ADDR1:%.*]] = alloca ptr, i32 0, align 8 +; IS__CGSCC____-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8 +; IS__CGSCC____-NEXT: [[CALL:%.*]] = call [[S:%.*]] @t4a(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]] +; IS__CGSCC____-NEXT: [[TMP0:%.*]] = extractvalue [[S]] [[CALL]], 0 +; IS__CGSCC____-NEXT: ret double 0.000000e+00 +; +entry: + %this.addr1 = alloca ptr, i32 0, align 8 + store ptr %this, ptr %this, align 8 + %this12 = load ptr, ptr %this, align 8 + %call = call %S @t4a(ptr %this) + %0 = extractvalue %S %call, 0 + ret double 0.000000e+00 +} + +define internal %S @t4a(ptr %this) { +; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; IS__TUNIT____-LABEL: define {{[^@]+}}@t4a +; IS__TUNIT____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR0]] { +; IS__TUNIT____-NEXT: entry: +; IS__TUNIT____-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8 +; IS__TUNIT____-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__TUNIT____-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8 +; IS__TUNIT____-NEXT: call void @t4b(ptr noalias nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]]) #[[ATTR5]] +; IS__TUNIT____-NEXT: ret [[S]] undef +; +; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@t4a +; IS__CGSCC_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] { +; IS__CGSCC_OPM-NEXT: entry: +; IS__CGSCC_OPM-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8 +; IS__CGSCC_OPM-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__CGSCC_OPM-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8 +; IS__CGSCC_OPM-NEXT: call void @t4b(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR6]] +; IS__CGSCC_OPM-NEXT: [[TMP0:%.*]] = load [[S]], ptr [[RETVAL]], align 8 +; IS__CGSCC_OPM-NEXT: ret [[S]] [[TMP0]] +; +; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@t4a +; IS__CGSCC_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] { +; IS__CGSCC_NPM-NEXT: entry: +; IS__CGSCC_NPM-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8 +; IS__CGSCC_NPM-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__CGSCC_NPM-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8 +; IS__CGSCC_NPM-NEXT: call void @t4b(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR6]] +; IS__CGSCC_NPM-NEXT: [[TMP0:%.*]] = load [[S]], ptr [[RETVAL]], align 8 +; IS__CGSCC_NPM-NEXT: ret [[S]] [[TMP0]] +; +entry: + %retval = alloca %S, i32 0, align 8 + %this.addr = alloca ptr, i32 0, align 8 + store ptr %this, ptr %this, align 8 + %this1 = load ptr, ptr %this, align 8 + %buffer_ = getelementptr inbounds %struct1, ptr %this1, i32 0, i32 0 + %data_ = getelementptr inbounds %struct2, ptr %buffer_, i32 0, i32 0 + %0 = load ptr, ptr %this, align 8 + call void @t4b(ptr %retval, ptr %this) + %1 = load %S, ptr %retval, align 8 + ret %S %1 +} + +define internal void @t4b(ptr %this, ptr %data) { +; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; IS__TUNIT____-LABEL: define {{[^@]+}}@t4b +; IS__TUNIT____-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR0]] { +; IS__TUNIT____-NEXT: entry: +; IS__TUNIT____-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__TUNIT____-NEXT: [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__TUNIT____-NEXT: call void @t4c(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR5]] +; IS__TUNIT____-NEXT: ret void +; +; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@t4b +; IS__CGSCC_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR0]] { +; IS__CGSCC_OPM-NEXT: entry: +; IS__CGSCC_OPM-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__CGSCC_OPM-NEXT: [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__CGSCC_OPM-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8 +; IS__CGSCC_OPM-NEXT: call void @t4c(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA]]) #[[ATTR6]] +; IS__CGSCC_OPM-NEXT: ret void +; +; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@t4b +; IS__CGSCC_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR0]] { +; IS__CGSCC_NPM-NEXT: entry: +; IS__CGSCC_NPM-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__CGSCC_NPM-NEXT: [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__CGSCC_NPM-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8 +; IS__CGSCC_NPM-NEXT: call void @t4c(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA]]) #[[ATTR6]] +; IS__CGSCC_NPM-NEXT: ret void +; +entry: + %this.addr = alloca ptr, i32 0, align 8 + %data.addr = alloca ptr, i32 0, align 8 + store ptr %this, ptr %this.addr, align 8 + store ptr %data, ptr %this, align 8 + %this1 = load ptr, ptr %this, align 8 + %0 = load ptr, ptr %this, align 8 + call void @t4c(ptr %this, ptr %data) + ret void +} + +define internal void @t4c(ptr %this, ptr %data) { +; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; IS__TUNIT____-LABEL: define {{[^@]+}}@t4c +; IS__TUNIT____-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR0]] { +; IS__TUNIT____-NEXT: entry: +; IS__TUNIT____-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__TUNIT____-NEXT: [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__TUNIT____-NEXT: ret void +; +; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly +; IS__CGSCC____-LABEL: define {{[^@]+}}@t4c +; IS__CGSCC____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree writeonly [[DATA:%.*]]) #[[ATTR3]] { +; IS__CGSCC____-NEXT: entry: +; IS__CGSCC____-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__CGSCC____-NEXT: [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8 +; IS__CGSCC____-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8 +; IS__CGSCC____-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8 +; IS__CGSCC____-NEXT: ret void +; +entry: + %this.addr = alloca ptr, i32 0, align 8 + %data.addr = alloca ptr, i32 0, align 8 + store ptr %this, ptr %this.addr, align 8 + store ptr %data, ptr %this, align 8 + %this1 = load ptr, ptr %this, align 8 + %data_ = getelementptr inbounds %S, ptr %this1, i32 0, i32 0 + %0 = load ptr, ptr %this, align 8 + store ptr %data, ptr %this, align 8 + ret void +} + +!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7} + +!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 11, i32 5]} +!1 = !{i32 1, !"wchar_size", i32 4} +!2 = !{i32 7, !"openmp", i32 50} +!3 = !{i32 7, !"openmp-device", i32 50} +!4 = !{i32 7, !"PIC Level", i32 2} +!5 = !{i32 7, !"frame-pointer", i32 2} +!6 = !{i32 7, !"Dwarf Version", i32 2} +!7 = !{i32 2, !"Debug Info Version", i32 3} +;. +; IS__TUNIT____: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } +; IS__TUNIT____: attributes #[[ATTR1]] = { argmemonly nofree norecurse nosync nounwind willreturn } +; IS__TUNIT____: attributes #[[ATTR2:[0-9]+]] = { nofree norecurse noreturn nosync nounwind readnone } +; IS__TUNIT____: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind willreturn writeonly } +; IS__TUNIT____: attributes #[[ATTR4]] = { nofree nosync nounwind willreturn } +; IS__TUNIT____: attributes #[[ATTR5]] = { nofree nosync nounwind willreturn writeonly } +;. +; IS__CGSCC____: attributes #[[ATTR0]] = { argmemonly nofree nosync nounwind willreturn writeonly } +; IS__CGSCC____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn } +; IS__CGSCC____: attributes #[[ATTR2]] = { argmemonly nofree nosync nounwind willreturn } +; IS__CGSCC____: attributes #[[ATTR3]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } +; IS__CGSCC____: attributes #[[ATTR4]] = { argmemonly nofree norecurse nosync nounwind willreturn } +; IS__CGSCC____: attributes #[[ATTR5:[0-9]+]] = { nofree norecurse noreturn nosync nounwind readnone } +; IS__CGSCC____: attributes #[[ATTR6]] = { nounwind willreturn writeonly } +; IS__CGSCC____: attributes #[[ATTR7]] = { readnone willreturn } +; IS__CGSCC____: attributes #[[ATTR8]] = { nounwind willreturn } +;. +; CHECK: [[META0:![0-9]+]] = !{i32 2, !"SDK Version", [2 x i32] [i32 11, i32 5]} +; CHECK: [[META1:![0-9]+]] = !{i32 1, !"wchar_size", i32 4} +; CHECK: [[META2:![0-9]+]] = !{i32 7, !"openmp", i32 50} +; CHECK: [[META3:![0-9]+]] = !{i32 7, !"openmp-device", i32 50} +; CHECK: [[META4:![0-9]+]] = !{i32 7, !"PIC Level", i32 2} +; CHECK: [[META5:![0-9]+]] = !{i32 7, !"frame-pointer", i32 2} +; CHECK: [[META6:![0-9]+]] = !{i32 7, !"Dwarf Version", i32 2} +; CHECK: [[META7:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3} +;. diff --git a/llvm/test/Transforms/Attributor/value-simplify-pointer-info.ll b/llvm/test/Transforms/Attributor/value-simplify-pointer-info.ll index 401bbc0ab255..b7077a9d992b 100644 --- a/llvm/test/Transforms/Attributor/value-simplify-pointer-info.ll +++ b/llvm/test/Transforms/Attributor/value-simplify-pointer-info.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=50 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=50 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=22 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=22 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM ; @@ -367,11 +367,10 @@ define void @local_alloca_simplifiable_2() { ; IS__TUNIT_OPM: for.body: ; IS__TUNIT_OPM-NEXT: [[I15:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10 ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 [[I15]] -; IS__TUNIT_OPM-NEXT: store i8 0, i8* [[ARRAYIDX]], align 2, !tbaa [[TBAA15:![0-9]+]] ; IS__TUNIT_OPM-NEXT: br label [[FOR_INC]] ; IS__TUNIT_OPM: for.inc: ; IS__TUNIT_OPM-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; IS__TUNIT_OPM-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP16:![0-9]+]] +; IS__TUNIT_OPM-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP15:![0-9]+]] ; IS__TUNIT_OPM: for.end: ; IS__TUNIT_OPM-NEXT: br label [[FOR_COND2:%.*]] ; IS__TUNIT_OPM: for.cond2: @@ -385,11 +384,10 @@ define void @local_alloca_simplifiable_2() { ; IS__TUNIT_OPM-NEXT: [[I17:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10 ; IS__TUNIT_OPM-NEXT: [[I18:%.*]] = or i64 [[I17]], 1 ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, float* [[I16]], i64 [[I18]] -; IS__TUNIT_OPM-NEXT: store float 0.000000e+00, float* [[ARRAYIDX8]], align 4, !tbaa [[TBAA18:![0-9]+]] ; IS__TUNIT_OPM-NEXT: br label [[FOR_INC9]] ; IS__TUNIT_OPM: for.inc9: ; IS__TUNIT_OPM-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1 -; IS__TUNIT_OPM-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP19:![0-9]+]] +; IS__TUNIT_OPM-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP17:![0-9]+]] ; IS__TUNIT_OPM: for.end11: ; IS__TUNIT_OPM-NEXT: br label [[FOR_COND13:%.*]] ; IS__TUNIT_OPM: for.cond13: @@ -403,14 +401,12 @@ define void @local_alloca_simplifiable_2() { ; IS__TUNIT_OPM-NEXT: [[I20:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10 ; IS__TUNIT_OPM-NEXT: [[I21:%.*]] = add nuw nsw i64 [[I20]], 2 ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX21:%.*]] = getelementptr inbounds i64, i64* [[I19]], i64 [[I21]] -; IS__TUNIT_OPM-NEXT: store i64 0, i64* [[ARRAYIDX21]], align 16, !tbaa [[TBAA20:![0-9]+]] ; IS__TUNIT_OPM-NEXT: br label [[FOR_INC22]] ; IS__TUNIT_OPM: for.inc22: ; IS__TUNIT_OPM-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1 -; IS__TUNIT_OPM-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP22:![0-9]+]] +; IS__TUNIT_OPM-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP18:![0-9]+]] ; IS__TUNIT_OPM: for.end24: ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 1023 -; IS__TUNIT_OPM-NEXT: store i8 0, i8* [[ARRAYIDX25]], align 1, !tbaa [[TBAA15]] ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX26:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 500 ; IS__TUNIT_OPM-NEXT: [[I22:%.*]] = bitcast i8* [[ARRAYIDX26]] to i32* ; IS__TUNIT_OPM-NEXT: call void @write_arg(i32* nocapture nofree nonnull writeonly align 4 dereferenceable(524) [[I22]], i32 noundef 0) #[[ATTR15:[0-9]+]] @@ -422,14 +418,12 @@ define void @local_alloca_simplifiable_2() { ; IS__TUNIT_OPM: for.cond.cleanup30: ; IS__TUNIT_OPM-NEXT: br label [[FOR_END38:%.*]] ; IS__TUNIT_OPM: for.body31: -; IS__TUNIT_OPM-NEXT: [[ARRAYIDX33:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 [[INDVARS_IV12]] -; IS__TUNIT_OPM-NEXT: [[I23:%.*]] = load i8, i8* [[ARRAYIDX33]], align 1, !tbaa [[TBAA15]] ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX35:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* @globalBytes, i64 0, i64 [[INDVARS_IV12]] -; IS__TUNIT_OPM-NEXT: store i8 [[I23]], i8* [[ARRAYIDX35]], align 1, !tbaa [[TBAA15]] +; IS__TUNIT_OPM-NEXT: store i8 0, i8* [[ARRAYIDX35]], align 1, !tbaa [[TBAA19:![0-9]+]] ; IS__TUNIT_OPM-NEXT: br label [[FOR_INC36]] ; IS__TUNIT_OPM: for.inc36: ; IS__TUNIT_OPM-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1 -; IS__TUNIT_OPM-NEXT: br label [[FOR_COND28]], !llvm.loop [[LOOP23:![0-9]+]] +; IS__TUNIT_OPM-NEXT: br label [[FOR_COND28]], !llvm.loop [[LOOP20:![0-9]+]] ; IS__TUNIT_OPM: for.end38: ; IS__TUNIT_OPM-NEXT: [[I24:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 0 ; IS__TUNIT_OPM-NEXT: call void @llvm.lifetime.end.p0i8(i64 noundef 1024, i8* nocapture nofree noundef nonnull align 16 dereferenceable(1024) [[I24]]) @@ -452,11 +446,10 @@ define void @local_alloca_simplifiable_2() { ; IS__TUNIT_NPM: for.body: ; IS__TUNIT_NPM-NEXT: [[I15:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10 ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 [[I15]] -; IS__TUNIT_NPM-NEXT: store i8 0, i8* [[ARRAYIDX]], align 2, !tbaa [[TBAA15:![0-9]+]] ; IS__TUNIT_NPM-NEXT: br label [[FOR_INC]] ; IS__TUNIT_NPM: for.inc: ; IS__TUNIT_NPM-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; IS__TUNIT_NPM-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP16:![0-9]+]] +; IS__TUNIT_NPM-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP15:![0-9]+]] ; IS__TUNIT_NPM: for.end: ; IS__TUNIT_NPM-NEXT: br label [[FOR_COND2:%.*]] ; IS__TUNIT_NPM: for.cond2: @@ -470,11 +463,10 @@ define void @local_alloca_simplifiable_2() { ; IS__TUNIT_NPM-NEXT: [[I17:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10 ; IS__TUNIT_NPM-NEXT: [[I18:%.*]] = or i64 [[I17]], 1 ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, float* [[I16]], i64 [[I18]] -; IS__TUNIT_NPM-NEXT: store float 0.000000e+00, float* [[ARRAYIDX8]], align 4, !tbaa [[TBAA18:![0-9]+]] ; IS__TUNIT_NPM-NEXT: br label [[FOR_INC9]] ; IS__TUNIT_NPM: for.inc9: ; IS__TUNIT_NPM-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1 -; IS__TUNIT_NPM-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP19:![0-9]+]] +; IS__TUNIT_NPM-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP17:![0-9]+]] ; IS__TUNIT_NPM: for.end11: ; IS__TUNIT_NPM-NEXT: br label [[FOR_COND13:%.*]] ; IS__TUNIT_NPM: for.cond13: @@ -488,14 +480,12 @@ define void @local_alloca_simplifiable_2() { ; IS__TUNIT_NPM-NEXT: [[I20:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10 ; IS__TUNIT_NPM-NEXT: [[I21:%.*]] = add nuw nsw i64 [[I20]], 2 ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX21:%.*]] = getelementptr inbounds i64, i64* [[I19]], i64 [[I21]] -; IS__TUNIT_NPM-NEXT: store i64 0, i64* [[ARRAYIDX21]], align 16, !tbaa [[TBAA20:![0-9]+]] ; IS__TUNIT_NPM-NEXT: br label [[FOR_INC22]] ; IS__TUNIT_NPM: for.inc22: ; IS__TUNIT_NPM-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1 -; IS__TUNIT_NPM-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP22:![0-9]+]] +; IS__TUNIT_NPM-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP18:![0-9]+]] ; IS__TUNIT_NPM: for.end24: ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 1023 -; IS__TUNIT_NPM-NEXT: store i8 0, i8* [[ARRAYIDX25]], align 1, !tbaa [[TBAA15]] ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX26:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 500 ; IS__TUNIT_NPM-NEXT: [[I22:%.*]] = bitcast i8* [[ARRAYIDX26]] to i32* ; IS__TUNIT_NPM-NEXT: call void @write_arg(i32* nocapture nofree nonnull writeonly align 4 dereferenceable(524) [[I22]], i32 noundef 0) #[[ATTR13]] @@ -507,20 +497,20 @@ define void @local_alloca_simplifiable_2() { ; IS__TUNIT_NPM: for.cond.cleanup30: ; IS__TUNIT_NPM-NEXT: br label [[FOR_END38:%.*]] ; IS__TUNIT_NPM: for.body31: -; IS__TUNIT_NPM-NEXT: [[ARRAYIDX33:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 [[INDVARS_IV12]] -; IS__TUNIT_NPM-NEXT: [[I23:%.*]] = load i8, i8* [[ARRAYIDX33]], align 1, !tbaa [[TBAA15]] ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX35:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* @globalBytes, i64 0, i64 [[INDVARS_IV12]] -; IS__TUNIT_NPM-NEXT: store i8 [[I23]], i8* [[ARRAYIDX35]], align 1, !tbaa [[TBAA15]] +; IS__TUNIT_NPM-NEXT: store i8 0, i8* [[ARRAYIDX35]], align 1, !tbaa [[TBAA19:![0-9]+]] ; IS__TUNIT_NPM-NEXT: br label [[FOR_INC36]] ; IS__TUNIT_NPM: for.inc36: ; IS__TUNIT_NPM-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1 -; IS__TUNIT_NPM-NEXT: br label [[FOR_COND28]], !llvm.loop [[LOOP23:![0-9]+]] +; IS__TUNIT_NPM-NEXT: br label [[FOR_COND28]], !llvm.loop [[LOOP20:![0-9]+]] ; IS__TUNIT_NPM: for.end38: ; IS__TUNIT_NPM-NEXT: [[I24:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 0 ; IS__TUNIT_NPM-NEXT: call void @llvm.lifetime.end.p0i8(i64 noundef 1024, i8* nocapture nofree noundef nonnull align 16 dereferenceable(1024) [[I24]]) #[[ATTR12]] ; IS__TUNIT_NPM-NEXT: ret void ; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@local_alloca_simplifiable_2() { +; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@local_alloca_simplifiable_2 +; IS__CGSCC_OPM-SAME: () #[[ATTR3:[0-9]+]] { ; IS__CGSCC_OPM-NEXT: entry: ; IS__CGSCC_OPM-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16 ; IS__CGSCC_OPM-NEXT: [[I:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 0 @@ -581,7 +571,7 @@ define void @local_alloca_simplifiable_2() { ; IS__CGSCC_OPM-NEXT: store i8 0, i8* [[ARRAYIDX25]], align 1, !tbaa [[TBAA15]] ; IS__CGSCC_OPM-NEXT: [[ARRAYIDX26:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 500 ; IS__CGSCC_OPM-NEXT: [[I22:%.*]] = bitcast i8* [[ARRAYIDX26]] to i32* -; IS__CGSCC_OPM-NEXT: call void @write_arg(i32* nofree noundef nonnull writeonly align 4 dereferenceable(4) [[I22]], i32 noundef 0) #[[ATTR17:[0-9]+]] +; IS__CGSCC_OPM-NEXT: call void @write_arg(i32* nocapture nofree noundef nonnull writeonly align 4 dereferenceable(524) [[I22]], i32 noundef 0) #[[ATTR17:[0-9]+]] ; IS__CGSCC_OPM-NEXT: br label [[FOR_COND28:%.*]] ; IS__CGSCC_OPM: for.cond28: ; IS__CGSCC_OPM-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], [[FOR_INC36:%.*]] ], [ 0, [[FOR_END24]] ] @@ -600,10 +590,12 @@ define void @local_alloca_simplifiable_2() { ; IS__CGSCC_OPM-NEXT: br label [[FOR_COND28]], !llvm.loop [[LOOP23:![0-9]+]] ; IS__CGSCC_OPM: for.end38: ; IS__CGSCC_OPM-NEXT: [[I24:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 0 -; IS__CGSCC_OPM-NEXT: call void @llvm.lifetime.end.p0i8(i64 noundef 1024, i8* nofree noundef nonnull align 16 dereferenceable(1024) [[I24]]) +; IS__CGSCC_OPM-NEXT: call void @llvm.lifetime.end.p0i8(i64 noundef 1024, i8* nocapture nofree noundef nonnull align 16 dereferenceable(1024) [[I24]]) ; IS__CGSCC_OPM-NEXT: ret void ; -; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@local_alloca_simplifiable_2() { +; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@local_alloca_simplifiable_2 +; IS__CGSCC_NPM-SAME: () #[[ATTR3:[0-9]+]] { ; IS__CGSCC_NPM-NEXT: entry: ; IS__CGSCC_NPM-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16 ; IS__CGSCC_NPM-NEXT: [[I:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 0 @@ -664,7 +656,7 @@ define void @local_alloca_simplifiable_2() { ; IS__CGSCC_NPM-NEXT: store i8 0, i8* [[ARRAYIDX25]], align 1, !tbaa [[TBAA15]] ; IS__CGSCC_NPM-NEXT: [[ARRAYIDX26:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 500 ; IS__CGSCC_NPM-NEXT: [[I22:%.*]] = bitcast i8* [[ARRAYIDX26]] to i32* -; IS__CGSCC_NPM-NEXT: call void @write_arg(i32* nofree noundef nonnull writeonly align 4 dereferenceable(4) [[I22]], i32 noundef 0) #[[ATTR16:[0-9]+]] +; IS__CGSCC_NPM-NEXT: call void @write_arg(i32* nocapture nofree noundef nonnull writeonly align 4 dereferenceable(524) [[I22]], i32 noundef 0) #[[ATTR15]] ; IS__CGSCC_NPM-NEXT: br label [[FOR_COND28:%.*]] ; IS__CGSCC_NPM: for.cond28: ; IS__CGSCC_NPM-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], [[FOR_INC36:%.*]] ], [ 0, [[FOR_END24]] ] @@ -683,7 +675,7 @@ define void @local_alloca_simplifiable_2() { ; IS__CGSCC_NPM-NEXT: br label [[FOR_COND28]], !llvm.loop [[LOOP23:![0-9]+]] ; IS__CGSCC_NPM: for.end38: ; IS__CGSCC_NPM-NEXT: [[I24:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* [[BYTES]], i64 0, i64 0 -; IS__CGSCC_NPM-NEXT: call void @llvm.lifetime.end.p0i8(i64 noundef 1024, i8* nofree noundef nonnull align 16 dereferenceable(1024) [[I24]]) +; IS__CGSCC_NPM-NEXT: call void @llvm.lifetime.end.p0i8(i64 noundef 1024, i8* nocapture nofree noundef nonnull align 16 dereferenceable(1024) [[I24]]) #[[ATTR14]] ; IS__CGSCC_NPM-NEXT: ret void ; entry: @@ -797,27 +789,16 @@ for.end38: ; preds = %for.cond.cleanup30 ; } ; define i32 @local_alloca_simplifiable_3() { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@local_alloca_simplifiable_3 -; IS__TUNIT____-SAME: () #[[ATTR4:[0-9]+]] { -; IS__TUNIT____-NEXT: [[A:%.*]] = alloca i32, align 4 -; IS__TUNIT____-NEXT: store i32 1, i32* [[A]], align 4 -; IS__TUNIT____-NEXT: br label [[SPLIT:%.*]] -; IS__TUNIT____: split: -; IS__TUNIT____-NEXT: store i32 2, i32* [[A]], align 4 -; IS__TUNIT____-NEXT: [[L:%.*]] = load i32, i32* [[A]], align 4 -; IS__TUNIT____-NEXT: ret i32 [[L]] -; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@local_alloca_simplifiable_3 -; IS__CGSCC____-SAME: () #[[ATTR3:[0-9]+]] { -; IS__CGSCC____-NEXT: [[A:%.*]] = alloca i32, align 4 -; IS__CGSCC____-NEXT: store i32 1, i32* [[A]], align 4 -; IS__CGSCC____-NEXT: br label [[SPLIT:%.*]] -; IS__CGSCC____: split: -; IS__CGSCC____-NEXT: store i32 2, i32* [[A]], align 4 -; IS__CGSCC____-NEXT: [[L:%.*]] = load i32, i32* [[A]], align 4 -; IS__CGSCC____-NEXT: ret i32 [[L]] +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@local_alloca_simplifiable_3 +; CHECK-SAME: () #[[ATTR4:[0-9]+]] { +; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4 +; CHECK-NEXT: store i32 1, i32* [[A]], align 4 +; CHECK-NEXT: br label [[SPLIT:%.*]] +; CHECK: split: +; CHECK-NEXT: store i32 2, i32* [[A]], align 4 +; CHECK-NEXT: [[L:%.*]] = load i32, i32* [[A]], align 4 +; CHECK-NEXT: ret i32 [[L]] ; %A = alloca i32, align 4 store i32 1, i32* %A @@ -833,15 +814,10 @@ split: ; } ; define i32 @local_alloca_simplifiable_4() { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@local_alloca_simplifiable_4 -; IS__TUNIT____-SAME: () #[[ATTR4]] { -; IS__TUNIT____-NEXT: ret i32 undef -; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@local_alloca_simplifiable_4 -; IS__CGSCC____-SAME: () #[[ATTR3]] { -; IS__CGSCC____-NEXT: ret i32 undef +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@local_alloca_simplifiable_4 +; CHECK-SAME: () #[[ATTR4]] { +; CHECK-NEXT: ret i32 undef ; %A = alloca i32, align 4 %l = load i32, i32* %A, align 4 @@ -893,7 +869,7 @@ define i32 @multi_obj_simplifiable_1(i32 %cnd) { ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@multi_obj_simplifiable_1 -; IS__CGSCC_OPM-SAME: (i32 [[CND:%.*]]) #[[ATTR4:[0-9]+]] { +; IS__CGSCC_OPM-SAME: (i32 [[CND:%.*]]) #[[ATTR5:[0-9]+]] { ; IS__CGSCC_OPM-NEXT: entry: ; IS__CGSCC_OPM-NEXT: [[L:%.*]] = alloca i32, align 4 ; IS__CGSCC_OPM-NEXT: [[I:%.*]] = bitcast i32* [[L]] to i8* @@ -911,7 +887,7 @@ define i32 @multi_obj_simplifiable_1(i32 %cnd) { ; ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@multi_obj_simplifiable_1 -; IS__CGSCC_NPM-SAME: (i32 [[CND:%.*]]) #[[ATTR4:[0-9]+]] { +; IS__CGSCC_NPM-SAME: (i32 [[CND:%.*]]) #[[ATTR5:[0-9]+]] { ; IS__CGSCC_NPM-NEXT: entry: ; IS__CGSCC_NPM-NEXT: [[L:%.*]] = alloca i32, align 4 ; IS__CGSCC_NPM-NEXT: [[I:%.*]] = bitcast i32* [[L]] to i8* @@ -997,7 +973,7 @@ define i32 @multi_obj_simplifiable_2(i32 %cnd) { ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@multi_obj_simplifiable_2 -; IS__CGSCC_OPM-SAME: (i32 [[CND:%.*]]) #[[ATTR4]] { +; IS__CGSCC_OPM-SAME: (i32 [[CND:%.*]]) #[[ATTR5]] { ; IS__CGSCC_OPM-NEXT: entry: ; IS__CGSCC_OPM-NEXT: [[L:%.*]] = alloca i32, align 4 ; IS__CGSCC_OPM-NEXT: [[I:%.*]] = bitcast i32* [[L]] to i8* @@ -1015,7 +991,7 @@ define i32 @multi_obj_simplifiable_2(i32 %cnd) { ; ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@multi_obj_simplifiable_2 -; IS__CGSCC_NPM-SAME: (i32 [[CND:%.*]]) #[[ATTR4]] { +; IS__CGSCC_NPM-SAME: (i32 [[CND:%.*]]) #[[ATTR5]] { ; IS__CGSCC_NPM-NEXT: entry: ; IS__CGSCC_NPM-NEXT: [[L:%.*]] = alloca i32, align 4 ; IS__CGSCC_NPM-NEXT: [[I:%.*]] = bitcast i32* [[L]] to i8* @@ -1116,7 +1092,7 @@ define void @static_global_simplifiable_1(%struct.S* noalias sret(%struct.S) ali ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind willreturn ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@static_global_simplifiable_1 -; IS__CGSCC_OPM-SAME: (%struct.S* noalias nocapture nofree nonnull writeonly sret([[STRUCT_S:%.*]]) align 4 dereferenceable(24) [[AGG_RESULT:%.*]]) #[[ATTR5:[0-9]+]] { +; IS__CGSCC_OPM-SAME: (%struct.S* noalias nocapture nofree nonnull writeonly sret([[STRUCT_S:%.*]]) align 4 dereferenceable(24) [[AGG_RESULT:%.*]]) #[[ATTR6:[0-9]+]] { ; IS__CGSCC_OPM-NEXT: entry: ; IS__CGSCC_OPM-NEXT: store float 0x3FF19999A0000000, float* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i64 0, i32 3), align 4, !tbaa [[TBAA7]] ; IS__CGSCC_OPM-NEXT: store float 0x40019999A0000000, float* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i64 0, i32 4), align 4, !tbaa [[TBAA10]] @@ -1136,7 +1112,7 @@ define void @static_global_simplifiable_1(%struct.S* noalias sret(%struct.S) ali ; IS__CGSCC_OPM-NEXT: [[ADD:%.*]] = fadd float [[I5]], [[I6]] ; IS__CGSCC_OPM-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[AGG_RESULT]], i64 0, i32 5 ; IS__CGSCC_OPM-NEXT: store float [[ADD]], float* [[F3]], align 4, !tbaa [[TBAA11]] -; IS__CGSCC_OPM-NEXT: [[I7:%.*]] = load i32, i32* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i64 0, i32 0), align 4, !tbaa [[TBAA12]] +; IS__CGSCC_OPM-NEXT: [[I7:%.*]] = load i32, i32* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i32 0, i32 0), align 4, !tbaa [[TBAA12]] ; IS__CGSCC_OPM-NEXT: [[I1:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[AGG_RESULT]], i64 0, i32 0 ; IS__CGSCC_OPM-NEXT: store i32 [[I7]], i32* [[I1]], align 4, !tbaa [[TBAA12]] ; IS__CGSCC_OPM-NEXT: [[I8:%.*]] = load i32, i32* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i64 0, i32 1), align 4, !tbaa [[TBAA13]] @@ -1144,7 +1120,7 @@ define void @static_global_simplifiable_1(%struct.S* noalias sret(%struct.S) ali ; IS__CGSCC_OPM-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[AGG_RESULT]], i64 0, i32 1 ; IS__CGSCC_OPM-NEXT: store i32 [[MUL1]], i32* [[I2]], align 4, !tbaa [[TBAA13]] ; IS__CGSCC_OPM-NEXT: [[I9:%.*]] = load i32, i32* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i64 0, i32 2), align 4, !tbaa [[TBAA14]] -; IS__CGSCC_OPM-NEXT: [[I10:%.*]] = load i32, i32* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i64 0, i32 0), align 4, !tbaa [[TBAA12]] +; IS__CGSCC_OPM-NEXT: [[I10:%.*]] = load i32, i32* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i32 0, i32 0), align 4, !tbaa [[TBAA12]] ; IS__CGSCC_OPM-NEXT: [[ADD2:%.*]] = add nsw i32 [[I9]], [[I10]] ; IS__CGSCC_OPM-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[AGG_RESULT]], i64 0, i32 2 ; IS__CGSCC_OPM-NEXT: store i32 [[ADD2]], i32* [[I3]], align 4, !tbaa [[TBAA14]] @@ -1152,7 +1128,7 @@ define void @static_global_simplifiable_1(%struct.S* noalias sret(%struct.S) ali ; ; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@static_global_simplifiable_1 -; IS__CGSCC_NPM-SAME: (%struct.S* noalias nocapture nofree nonnull writeonly sret([[STRUCT_S:%.*]]) align 4 dereferenceable(24) [[AGG_RESULT:%.*]]) #[[ATTR5:[0-9]+]] { +; IS__CGSCC_NPM-SAME: (%struct.S* noalias nocapture nofree nonnull writeonly sret([[STRUCT_S:%.*]]) align 4 dereferenceable(24) [[AGG_RESULT:%.*]]) #[[ATTR3]] { ; IS__CGSCC_NPM-NEXT: entry: ; IS__CGSCC_NPM-NEXT: store float 0x3FF19999A0000000, float* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i64 0, i32 3), align 4, !tbaa [[TBAA7]] ; IS__CGSCC_NPM-NEXT: store float 0x40019999A0000000, float* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i64 0, i32 4), align 4, !tbaa [[TBAA10]] @@ -1172,7 +1148,7 @@ define void @static_global_simplifiable_1(%struct.S* noalias sret(%struct.S) ali ; IS__CGSCC_NPM-NEXT: [[ADD:%.*]] = fadd float [[I5]], [[I6]] ; IS__CGSCC_NPM-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[AGG_RESULT]], i64 0, i32 5 ; IS__CGSCC_NPM-NEXT: store float [[ADD]], float* [[F3]], align 4, !tbaa [[TBAA11]] -; IS__CGSCC_NPM-NEXT: [[I7:%.*]] = load i32, i32* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i64 0, i32 0), align 4, !tbaa [[TBAA12]] +; IS__CGSCC_NPM-NEXT: [[I7:%.*]] = load i32, i32* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i32 0, i32 0), align 4, !tbaa [[TBAA12]] ; IS__CGSCC_NPM-NEXT: [[I1:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[AGG_RESULT]], i64 0, i32 0 ; IS__CGSCC_NPM-NEXT: store i32 [[I7]], i32* [[I1]], align 4, !tbaa [[TBAA12]] ; IS__CGSCC_NPM-NEXT: [[I8:%.*]] = load i32, i32* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i64 0, i32 1), align 4, !tbaa [[TBAA13]] @@ -1180,7 +1156,7 @@ define void @static_global_simplifiable_1(%struct.S* noalias sret(%struct.S) ali ; IS__CGSCC_NPM-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[AGG_RESULT]], i64 0, i32 1 ; IS__CGSCC_NPM-NEXT: store i32 [[MUL1]], i32* [[I2]], align 4, !tbaa [[TBAA13]] ; IS__CGSCC_NPM-NEXT: [[I9:%.*]] = load i32, i32* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i64 0, i32 2), align 4, !tbaa [[TBAA14]] -; IS__CGSCC_NPM-NEXT: [[I10:%.*]] = load i32, i32* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i64 0, i32 0), align 4, !tbaa [[TBAA12]] +; IS__CGSCC_NPM-NEXT: [[I10:%.*]] = load i32, i32* getelementptr inbounds ([[STRUCT_S]], %struct.S* @Gs1, i32 0, i32 0), align 4, !tbaa [[TBAA12]] ; IS__CGSCC_NPM-NEXT: [[ADD2:%.*]] = add nsw i32 [[I9]], [[I10]] ; IS__CGSCC_NPM-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[AGG_RESULT]], i64 0, i32 2 ; IS__CGSCC_NPM-NEXT: store i32 [[ADD2]], i32* [[I3]], align 4, !tbaa [[TBAA14]] @@ -1236,9 +1212,9 @@ entry: ; } ; define void @static_global_simplifiable_2() { -; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind writeonly ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@static_global_simplifiable_2 -; IS__TUNIT_OPM-SAME: () #[[ATTR3]] { +; IS__TUNIT_OPM-SAME: () #[[ATTR7:[0-9]+]] { ; IS__TUNIT_OPM-NEXT: entry: ; IS__TUNIT_OPM-NEXT: br label [[FOR_COND:%.*]] ; IS__TUNIT_OPM: for.cond: @@ -1250,11 +1226,10 @@ define void @static_global_simplifiable_2() { ; IS__TUNIT_OPM: for.body: ; IS__TUNIT_OPM-NEXT: [[I:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10 ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 [[I]] -; IS__TUNIT_OPM-NEXT: store i8 0, i8* [[ARRAYIDX]], align 2, !tbaa [[TBAA15]] ; IS__TUNIT_OPM-NEXT: br label [[FOR_INC]] ; IS__TUNIT_OPM: for.inc: ; IS__TUNIT_OPM-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; IS__TUNIT_OPM-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP24:![0-9]+]] +; IS__TUNIT_OPM-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP21:![0-9]+]] ; IS__TUNIT_OPM: for.end: ; IS__TUNIT_OPM-NEXT: br label [[FOR_COND2:%.*]] ; IS__TUNIT_OPM: for.cond2: @@ -1267,11 +1242,10 @@ define void @static_global_simplifiable_2() { ; IS__TUNIT_OPM-NEXT: [[I15:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10 ; IS__TUNIT_OPM-NEXT: [[I16:%.*]] = or i64 [[I15]], 1 ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, float* bitcast ([1024 x i8]* @GBytes to float*), i64 [[I16]] -; IS__TUNIT_OPM-NEXT: store float 0.000000e+00, float* [[ARRAYIDX8]], align 4, !tbaa [[TBAA18]] ; IS__TUNIT_OPM-NEXT: br label [[FOR_INC9]] ; IS__TUNIT_OPM: for.inc9: ; IS__TUNIT_OPM-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1 -; IS__TUNIT_OPM-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP25:![0-9]+]] +; IS__TUNIT_OPM-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP22:![0-9]+]] ; IS__TUNIT_OPM: for.end11: ; IS__TUNIT_OPM-NEXT: br label [[FOR_COND13:%.*]] ; IS__TUNIT_OPM: for.cond13: @@ -1284,13 +1258,11 @@ define void @static_global_simplifiable_2() { ; IS__TUNIT_OPM-NEXT: [[I17:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10 ; IS__TUNIT_OPM-NEXT: [[I18:%.*]] = add nuw nsw i64 [[I17]], 2 ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds i64, i64* bitcast ([1024 x i8]* @GBytes to i64*), i64 [[I18]] -; IS__TUNIT_OPM-NEXT: store i64 0, i64* [[ARRAYIDX20]], align 16, !tbaa [[TBAA20]] ; IS__TUNIT_OPM-NEXT: br label [[FOR_INC21]] ; IS__TUNIT_OPM: for.inc21: ; IS__TUNIT_OPM-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1 -; IS__TUNIT_OPM-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP26:![0-9]+]] +; IS__TUNIT_OPM-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP23:![0-9]+]] ; IS__TUNIT_OPM: for.end23: -; IS__TUNIT_OPM-NEXT: store i8 0, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 1023), align 1, !tbaa [[TBAA15]] ; IS__TUNIT_OPM-NEXT: call void @write_arg(i32* nocapture nofree writeonly align 4 dereferenceable_or_null(524) bitcast (i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 500) to i32*), i32 noundef 0) #[[ATTR15]] ; IS__TUNIT_OPM-NEXT: br label [[FOR_COND25:%.*]] ; IS__TUNIT_OPM: for.cond25: @@ -1300,20 +1272,18 @@ define void @static_global_simplifiable_2() { ; IS__TUNIT_OPM: for.cond.cleanup27: ; IS__TUNIT_OPM-NEXT: br label [[FOR_END35:%.*]] ; IS__TUNIT_OPM: for.body28: -; IS__TUNIT_OPM-NEXT: [[ARRAYIDX30:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 [[INDVARS_IV12]] -; IS__TUNIT_OPM-NEXT: [[I19:%.*]] = load i8, i8* [[ARRAYIDX30]], align 1, !tbaa [[TBAA15]] ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX32:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* @globalBytes, i64 0, i64 [[INDVARS_IV12]] -; IS__TUNIT_OPM-NEXT: store i8 [[I19]], i8* [[ARRAYIDX32]], align 1, !tbaa [[TBAA15]] +; IS__TUNIT_OPM-NEXT: store i8 0, i8* [[ARRAYIDX32]], align 1, !tbaa [[TBAA19]] ; IS__TUNIT_OPM-NEXT: br label [[FOR_INC33]] ; IS__TUNIT_OPM: for.inc33: ; IS__TUNIT_OPM-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1 -; IS__TUNIT_OPM-NEXT: br label [[FOR_COND25]], !llvm.loop [[LOOP27:![0-9]+]] +; IS__TUNIT_OPM-NEXT: br label [[FOR_COND25]], !llvm.loop [[LOOP24:![0-9]+]] ; IS__TUNIT_OPM: for.end35: ; IS__TUNIT_OPM-NEXT: ret void ; -; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@static_global_simplifiable_2 -; IS__TUNIT_NPM-SAME: () #[[ATTR3]] { +; IS__TUNIT_NPM-SAME: () #[[ATTR5]] { ; IS__TUNIT_NPM-NEXT: entry: ; IS__TUNIT_NPM-NEXT: br label [[FOR_COND:%.*]] ; IS__TUNIT_NPM: for.cond: @@ -1325,11 +1295,10 @@ define void @static_global_simplifiable_2() { ; IS__TUNIT_NPM: for.body: ; IS__TUNIT_NPM-NEXT: [[I:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10 ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 [[I]] -; IS__TUNIT_NPM-NEXT: store i8 0, i8* [[ARRAYIDX]], align 2, !tbaa [[TBAA15]] ; IS__TUNIT_NPM-NEXT: br label [[FOR_INC]] ; IS__TUNIT_NPM: for.inc: ; IS__TUNIT_NPM-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; IS__TUNIT_NPM-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP24:![0-9]+]] +; IS__TUNIT_NPM-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP21:![0-9]+]] ; IS__TUNIT_NPM: for.end: ; IS__TUNIT_NPM-NEXT: br label [[FOR_COND2:%.*]] ; IS__TUNIT_NPM: for.cond2: @@ -1342,11 +1311,10 @@ define void @static_global_simplifiable_2() { ; IS__TUNIT_NPM-NEXT: [[I15:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10 ; IS__TUNIT_NPM-NEXT: [[I16:%.*]] = or i64 [[I15]], 1 ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, float* bitcast ([1024 x i8]* @GBytes to float*), i64 [[I16]] -; IS__TUNIT_NPM-NEXT: store float 0.000000e+00, float* [[ARRAYIDX8]], align 4, !tbaa [[TBAA18]] ; IS__TUNIT_NPM-NEXT: br label [[FOR_INC9]] ; IS__TUNIT_NPM: for.inc9: ; IS__TUNIT_NPM-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1 -; IS__TUNIT_NPM-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP25:![0-9]+]] +; IS__TUNIT_NPM-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP22:![0-9]+]] ; IS__TUNIT_NPM: for.end11: ; IS__TUNIT_NPM-NEXT: br label [[FOR_COND13:%.*]] ; IS__TUNIT_NPM: for.cond13: @@ -1359,13 +1327,11 @@ define void @static_global_simplifiable_2() { ; IS__TUNIT_NPM-NEXT: [[I17:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10 ; IS__TUNIT_NPM-NEXT: [[I18:%.*]] = add nuw nsw i64 [[I17]], 2 ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds i64, i64* bitcast ([1024 x i8]* @GBytes to i64*), i64 [[I18]] -; IS__TUNIT_NPM-NEXT: store i64 0, i64* [[ARRAYIDX20]], align 16, !tbaa [[TBAA20]] ; IS__TUNIT_NPM-NEXT: br label [[FOR_INC21]] ; IS__TUNIT_NPM: for.inc21: ; IS__TUNIT_NPM-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1 -; IS__TUNIT_NPM-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP26:![0-9]+]] +; IS__TUNIT_NPM-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP23:![0-9]+]] ; IS__TUNIT_NPM: for.end23: -; IS__TUNIT_NPM-NEXT: store i8 0, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 1023), align 1, !tbaa [[TBAA15]] ; IS__TUNIT_NPM-NEXT: call void @write_arg(i32* nocapture nofree writeonly align 4 dereferenceable_or_null(524) bitcast (i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 500) to i32*), i32 noundef 0) #[[ATTR13]] ; IS__TUNIT_NPM-NEXT: br label [[FOR_COND25:%.*]] ; IS__TUNIT_NPM: for.cond25: @@ -1375,18 +1341,18 @@ define void @static_global_simplifiable_2() { ; IS__TUNIT_NPM: for.cond.cleanup27: ; IS__TUNIT_NPM-NEXT: br label [[FOR_END35:%.*]] ; IS__TUNIT_NPM: for.body28: -; IS__TUNIT_NPM-NEXT: [[ARRAYIDX30:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 [[INDVARS_IV12]] -; IS__TUNIT_NPM-NEXT: [[I19:%.*]] = load i8, i8* [[ARRAYIDX30]], align 1, !tbaa [[TBAA15]] ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX32:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* @globalBytes, i64 0, i64 [[INDVARS_IV12]] -; IS__TUNIT_NPM-NEXT: store i8 [[I19]], i8* [[ARRAYIDX32]], align 1, !tbaa [[TBAA15]] +; IS__TUNIT_NPM-NEXT: store i8 0, i8* [[ARRAYIDX32]], align 1, !tbaa [[TBAA19]] ; IS__TUNIT_NPM-NEXT: br label [[FOR_INC33]] ; IS__TUNIT_NPM: for.inc33: ; IS__TUNIT_NPM-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1 -; IS__TUNIT_NPM-NEXT: br label [[FOR_COND25]], !llvm.loop [[LOOP27:![0-9]+]] +; IS__TUNIT_NPM-NEXT: br label [[FOR_COND25]], !llvm.loop [[LOOP24:![0-9]+]] ; IS__TUNIT_NPM: for.end35: ; IS__TUNIT_NPM-NEXT: ret void ; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@static_global_simplifiable_2() { +; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@static_global_simplifiable_2 +; IS__CGSCC_OPM-SAME: () #[[ATTR3]] { ; IS__CGSCC_OPM-NEXT: entry: ; IS__CGSCC_OPM-NEXT: br label [[FOR_COND:%.*]] ; IS__CGSCC_OPM: for.cond: @@ -1439,7 +1405,7 @@ define void @static_global_simplifiable_2() { ; IS__CGSCC_OPM-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP26:![0-9]+]] ; IS__CGSCC_OPM: for.end23: ; IS__CGSCC_OPM-NEXT: store i8 0, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 1023), align 1, !tbaa [[TBAA15]] -; IS__CGSCC_OPM-NEXT: call void @write_arg(i32* nofree noundef nonnull writeonly align 4 dereferenceable(4) bitcast (i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 500) to i32*), i32 noundef 0) #[[ATTR17]] +; IS__CGSCC_OPM-NEXT: call void @write_arg(i32* nocapture nofree noundef nonnull writeonly align 4 dereferenceable(524) bitcast (i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 500) to i32*), i32 noundef 0) #[[ATTR17]] ; IS__CGSCC_OPM-NEXT: br label [[FOR_COND25:%.*]] ; IS__CGSCC_OPM: for.cond25: ; IS__CGSCC_OPM-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], [[FOR_INC33:%.*]] ], [ 0, [[FOR_END23]] ] @@ -1459,7 +1425,9 @@ define void @static_global_simplifiable_2() { ; IS__CGSCC_OPM: for.end35: ; IS__CGSCC_OPM-NEXT: ret void ; -; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@static_global_simplifiable_2() { +; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@static_global_simplifiable_2 +; IS__CGSCC_NPM-SAME: () #[[ATTR3]] { ; IS__CGSCC_NPM-NEXT: entry: ; IS__CGSCC_NPM-NEXT: br label [[FOR_COND:%.*]] ; IS__CGSCC_NPM: for.cond: @@ -1512,7 +1480,7 @@ define void @static_global_simplifiable_2() { ; IS__CGSCC_NPM-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP26:![0-9]+]] ; IS__CGSCC_NPM: for.end23: ; IS__CGSCC_NPM-NEXT: store i8 0, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 1023), align 1, !tbaa [[TBAA15]] -; IS__CGSCC_NPM-NEXT: call void @write_arg(i32* nofree noundef nonnull writeonly align 4 dereferenceable(4) bitcast (i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 500) to i32*), i32 noundef 0) #[[ATTR16]] +; IS__CGSCC_NPM-NEXT: call void @write_arg(i32* nocapture nofree noundef nonnull writeonly align 4 dereferenceable(524) bitcast (i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GBytes, i64 0, i64 500) to i32*), i32 noundef 0) #[[ATTR15]] ; IS__CGSCC_NPM-NEXT: br label [[FOR_COND25:%.*]] ; IS__CGSCC_NPM: for.cond25: ; IS__CGSCC_NPM-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], [[FOR_INC33:%.*]] ], [ 0, [[FOR_END23]] ] @@ -1631,12 +1599,12 @@ for.end35: ; preds = %for.cond.cleanup27 ; return Flag3; ; } define i32 @static_global_simplifiable_3() { -; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@static_global_simplifiable_3 -; IS__TUNIT_OPM-SAME: () #[[ATTR5]] { -; IS__TUNIT_OPM-NEXT: store i32 1, i32* @Flag3, align 4, !tbaa [[TBAA3]] -; IS__TUNIT_OPM-NEXT: [[I:%.*]] = load i32, i32* @Flag3, align 4, !tbaa [[TBAA3]] -; IS__TUNIT_OPM-NEXT: ret i32 [[I]] +; NOT_TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn +; NOT_TUNIT_NPM-LABEL: define {{[^@]+}}@static_global_simplifiable_3 +; NOT_TUNIT_NPM-SAME: () #[[ATTR5:[0-9]+]] { +; NOT_TUNIT_NPM-NEXT: store i32 1, i32* @Flag3, align 4, !tbaa [[TBAA3]] +; NOT_TUNIT_NPM-NEXT: [[I:%.*]] = load i32, i32* @Flag3, align 4, !tbaa [[TBAA3]] +; NOT_TUNIT_NPM-NEXT: ret i32 [[I]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@static_global_simplifiable_3 @@ -1644,13 +1612,6 @@ define i32 @static_global_simplifiable_3() { ; IS__TUNIT_NPM-NEXT: store i32 1, i32* @Flag3, align 4, !tbaa [[TBAA3]] ; IS__TUNIT_NPM-NEXT: [[I:%.*]] = load i32, i32* @Flag3, align 4, !tbaa [[TBAA3]] ; IS__TUNIT_NPM-NEXT: ret i32 [[I]] -; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@static_global_simplifiable_3 -; IS__CGSCC____-SAME: () #[[ATTR4:[0-9]+]] { -; IS__CGSCC____-NEXT: store i32 1, i32* @Flag3, align 4, !tbaa [[TBAA3]] -; IS__CGSCC____-NEXT: [[I:%.*]] = load i32, i32* @Flag3, align 4, !tbaa [[TBAA3]] -; IS__CGSCC____-NEXT: ret i32 [[I]] ; store i32 1, i32* @Flag3, align 4, !tbaa !3 %i = load i32, i32* @Flag3, align 4, !tbaa !3 @@ -1952,11 +1913,11 @@ define void @noalias_arg_simplifiable_2(i8* %Bytes) { ; IS__TUNIT_OPM: for.body: ; IS__TUNIT_OPM-NEXT: [[I:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10 ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i8, i8* [[BYTES]], i64 [[I]] -; IS__TUNIT_OPM-NEXT: store i8 0, i8* [[ARRAYIDX]], align 1, !tbaa [[TBAA15]] +; IS__TUNIT_OPM-NEXT: store i8 0, i8* [[ARRAYIDX]], align 1, !tbaa [[TBAA19]] ; IS__TUNIT_OPM-NEXT: br label [[FOR_INC]] ; IS__TUNIT_OPM: for.inc: ; IS__TUNIT_OPM-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; IS__TUNIT_OPM-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP28:![0-9]+]] +; IS__TUNIT_OPM-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP25:![0-9]+]] ; IS__TUNIT_OPM: for.end: ; IS__TUNIT_OPM-NEXT: br label [[FOR_COND2:%.*]] ; IS__TUNIT_OPM: for.cond2: @@ -1970,11 +1931,11 @@ define void @noalias_arg_simplifiable_2(i8* %Bytes) { ; IS__TUNIT_OPM-NEXT: [[I16:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10 ; IS__TUNIT_OPM-NEXT: [[I17:%.*]] = or i64 [[I16]], 1 ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, float* [[I15]], i64 [[I17]] -; IS__TUNIT_OPM-NEXT: store float 0.000000e+00, float* [[ARRAYIDX8]], align 4, !tbaa [[TBAA18]] +; IS__TUNIT_OPM-NEXT: store float 0.000000e+00, float* [[ARRAYIDX8]], align 4, !tbaa [[TBAA26:![0-9]+]] ; IS__TUNIT_OPM-NEXT: br label [[FOR_INC9]] ; IS__TUNIT_OPM: for.inc9: ; IS__TUNIT_OPM-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1 -; IS__TUNIT_OPM-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP29:![0-9]+]] +; IS__TUNIT_OPM-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP27:![0-9]+]] ; IS__TUNIT_OPM: for.end11: ; IS__TUNIT_OPM-NEXT: br label [[FOR_COND13:%.*]] ; IS__TUNIT_OPM: for.cond13: @@ -1988,14 +1949,14 @@ define void @noalias_arg_simplifiable_2(i8* %Bytes) { ; IS__TUNIT_OPM-NEXT: [[I19:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10 ; IS__TUNIT_OPM-NEXT: [[I20:%.*]] = add nuw nsw i64 [[I19]], 2 ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds i64, i64* [[I18]], i64 [[I20]] -; IS__TUNIT_OPM-NEXT: store i64 0, i64* [[ARRAYIDX20]], align 8, !tbaa [[TBAA20]] +; IS__TUNIT_OPM-NEXT: store i64 0, i64* [[ARRAYIDX20]], align 8, !tbaa [[TBAA28:![0-9]+]] ; IS__TUNIT_OPM-NEXT: br label [[FOR_INC21]] ; IS__TUNIT_OPM: for.inc21: ; IS__TUNIT_OPM-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1 ; IS__TUNIT_OPM-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP30:![0-9]+]] ; IS__TUNIT_OPM: for.end23: ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX24:%.*]] = getelementptr inbounds i8, i8* [[BYTES]], i64 1023 -; IS__TUNIT_OPM-NEXT: store i8 0, i8* [[ARRAYIDX24]], align 1, !tbaa [[TBAA15]] +; IS__TUNIT_OPM-NEXT: store i8 0, i8* [[ARRAYIDX24]], align 1, !tbaa [[TBAA19]] ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds i8, i8* [[BYTES]], i64 500 ; IS__TUNIT_OPM-NEXT: [[I21:%.*]] = bitcast i8* [[ARRAYIDX25]] to i32* ; IS__TUNIT_OPM-NEXT: call void @write_arg(i32* nocapture nofree nonnull writeonly align 4 [[I21]], i32 noundef 0) #[[ATTR15]] @@ -2008,9 +1969,9 @@ define void @noalias_arg_simplifiable_2(i8* %Bytes) { ; IS__TUNIT_OPM-NEXT: br label [[FOR_END37:%.*]] ; IS__TUNIT_OPM: for.body30: ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX32:%.*]] = getelementptr inbounds i8, i8* [[BYTES]], i64 [[INDVARS_IV12]] -; IS__TUNIT_OPM-NEXT: [[I22:%.*]] = load i8, i8* [[ARRAYIDX32]], align 1, !tbaa [[TBAA15]] +; IS__TUNIT_OPM-NEXT: [[I22:%.*]] = load i8, i8* [[ARRAYIDX32]], align 1, !tbaa [[TBAA19]] ; IS__TUNIT_OPM-NEXT: [[ARRAYIDX34:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* @globalBytes, i64 0, i64 [[INDVARS_IV12]] -; IS__TUNIT_OPM-NEXT: store i8 [[I22]], i8* [[ARRAYIDX34]], align 1, !tbaa [[TBAA15]] +; IS__TUNIT_OPM-NEXT: store i8 [[I22]], i8* [[ARRAYIDX34]], align 1, !tbaa [[TBAA19]] ; IS__TUNIT_OPM-NEXT: br label [[FOR_INC35]] ; IS__TUNIT_OPM: for.inc35: ; IS__TUNIT_OPM-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1 @@ -2032,11 +1993,11 @@ define void @noalias_arg_simplifiable_2(i8* %Bytes) { ; IS__TUNIT_NPM: for.body: ; IS__TUNIT_NPM-NEXT: [[I:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10 ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i8, i8* [[BYTES]], i64 [[I]] -; IS__TUNIT_NPM-NEXT: store i8 0, i8* [[ARRAYIDX]], align 1, !tbaa [[TBAA15]] +; IS__TUNIT_NPM-NEXT: store i8 0, i8* [[ARRAYIDX]], align 1, !tbaa [[TBAA19]] ; IS__TUNIT_NPM-NEXT: br label [[FOR_INC]] ; IS__TUNIT_NPM: for.inc: ; IS__TUNIT_NPM-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; IS__TUNIT_NPM-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP28:![0-9]+]] +; IS__TUNIT_NPM-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP25:![0-9]+]] ; IS__TUNIT_NPM: for.end: ; IS__TUNIT_NPM-NEXT: br label [[FOR_COND2:%.*]] ; IS__TUNIT_NPM: for.cond2: @@ -2050,11 +2011,11 @@ define void @noalias_arg_simplifiable_2(i8* %Bytes) { ; IS__TUNIT_NPM-NEXT: [[I16:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10 ; IS__TUNIT_NPM-NEXT: [[I17:%.*]] = or i64 [[I16]], 1 ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, float* [[I15]], i64 [[I17]] -; IS__TUNIT_NPM-NEXT: store float 0.000000e+00, float* [[ARRAYIDX8]], align 4, !tbaa [[TBAA18]] +; IS__TUNIT_NPM-NEXT: store float 0.000000e+00, float* [[ARRAYIDX8]], align 4, !tbaa [[TBAA26:![0-9]+]] ; IS__TUNIT_NPM-NEXT: br label [[FOR_INC9]] ; IS__TUNIT_NPM: for.inc9: ; IS__TUNIT_NPM-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1 -; IS__TUNIT_NPM-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP29:![0-9]+]] +; IS__TUNIT_NPM-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP27:![0-9]+]] ; IS__TUNIT_NPM: for.end11: ; IS__TUNIT_NPM-NEXT: br label [[FOR_COND13:%.*]] ; IS__TUNIT_NPM: for.cond13: @@ -2068,14 +2029,14 @@ define void @noalias_arg_simplifiable_2(i8* %Bytes) { ; IS__TUNIT_NPM-NEXT: [[I19:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10 ; IS__TUNIT_NPM-NEXT: [[I20:%.*]] = add nuw nsw i64 [[I19]], 2 ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds i64, i64* [[I18]], i64 [[I20]] -; IS__TUNIT_NPM-NEXT: store i64 0, i64* [[ARRAYIDX20]], align 8, !tbaa [[TBAA20]] +; IS__TUNIT_NPM-NEXT: store i64 0, i64* [[ARRAYIDX20]], align 8, !tbaa [[TBAA28:![0-9]+]] ; IS__TUNIT_NPM-NEXT: br label [[FOR_INC21]] ; IS__TUNIT_NPM: for.inc21: ; IS__TUNIT_NPM-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1 ; IS__TUNIT_NPM-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP30:![0-9]+]] ; IS__TUNIT_NPM: for.end23: ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX24:%.*]] = getelementptr inbounds i8, i8* [[BYTES]], i64 1023 -; IS__TUNIT_NPM-NEXT: store i8 0, i8* [[ARRAYIDX24]], align 1, !tbaa [[TBAA15]] +; IS__TUNIT_NPM-NEXT: store i8 0, i8* [[ARRAYIDX24]], align 1, !tbaa [[TBAA19]] ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds i8, i8* [[BYTES]], i64 500 ; IS__TUNIT_NPM-NEXT: [[I21:%.*]] = bitcast i8* [[ARRAYIDX25]] to i32* ; IS__TUNIT_NPM-NEXT: call void @write_arg(i32* nocapture nofree nonnull writeonly align 4 [[I21]], i32 noundef 0) #[[ATTR13]] @@ -2088,9 +2049,9 @@ define void @noalias_arg_simplifiable_2(i8* %Bytes) { ; IS__TUNIT_NPM-NEXT: br label [[FOR_END37:%.*]] ; IS__TUNIT_NPM: for.body30: ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX32:%.*]] = getelementptr inbounds i8, i8* [[BYTES]], i64 [[INDVARS_IV12]] -; IS__TUNIT_NPM-NEXT: [[I22:%.*]] = load i8, i8* [[ARRAYIDX32]], align 1, !tbaa [[TBAA15]] +; IS__TUNIT_NPM-NEXT: [[I22:%.*]] = load i8, i8* [[ARRAYIDX32]], align 1, !tbaa [[TBAA19]] ; IS__TUNIT_NPM-NEXT: [[ARRAYIDX34:%.*]] = getelementptr inbounds [1024 x i8], [1024 x i8]* @globalBytes, i64 0, i64 [[INDVARS_IV12]] -; IS__TUNIT_NPM-NEXT: store i8 [[I22]], i8* [[ARRAYIDX34]], align 1, !tbaa [[TBAA15]] +; IS__TUNIT_NPM-NEXT: store i8 [[I22]], i8* [[ARRAYIDX34]], align 1, !tbaa [[TBAA19]] ; IS__TUNIT_NPM-NEXT: br label [[FOR_INC35]] ; IS__TUNIT_NPM: for.inc35: ; IS__TUNIT_NPM-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1 @@ -2098,8 +2059,9 @@ define void @noalias_arg_simplifiable_2(i8* %Bytes) { ; IS__TUNIT_NPM: for.end37: ; IS__TUNIT_NPM-NEXT: ret void ; +; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@noalias_arg_simplifiable_2 -; IS__CGSCC_OPM-SAME: (i8* [[BYTES:%.*]]) { +; IS__CGSCC_OPM-SAME: (i8* nocapture nofree [[BYTES:%.*]]) #[[ATTR3]] { ; IS__CGSCC_OPM-NEXT: entry: ; IS__CGSCC_OPM-NEXT: br label [[FOR_COND:%.*]] ; IS__CGSCC_OPM: for.cond: @@ -2157,7 +2119,7 @@ define void @noalias_arg_simplifiable_2(i8* %Bytes) { ; IS__CGSCC_OPM-NEXT: store i8 0, i8* [[ARRAYIDX24]], align 1, !tbaa [[TBAA15]] ; IS__CGSCC_OPM-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds i8, i8* [[BYTES]], i64 500 ; IS__CGSCC_OPM-NEXT: [[I21:%.*]] = bitcast i8* [[ARRAYIDX25]] to i32* -; IS__CGSCC_OPM-NEXT: call void @write_arg(i32* nofree noundef nonnull writeonly align 4 dereferenceable(4) [[I21]], i32 noundef 0) #[[ATTR17]] +; IS__CGSCC_OPM-NEXT: call void @write_arg(i32* nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[I21]], i32 noundef 0) #[[ATTR17]] ; IS__CGSCC_OPM-NEXT: br label [[FOR_COND27:%.*]] ; IS__CGSCC_OPM: for.cond27: ; IS__CGSCC_OPM-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], [[FOR_INC35:%.*]] ], [ 0, [[FOR_END23]] ] @@ -2177,8 +2139,9 @@ define void @noalias_arg_simplifiable_2(i8* %Bytes) { ; IS__CGSCC_OPM: for.end37: ; IS__CGSCC_OPM-NEXT: ret void ; +; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@noalias_arg_simplifiable_2 -; IS__CGSCC_NPM-SAME: (i8* [[BYTES:%.*]]) { +; IS__CGSCC_NPM-SAME: (i8* nocapture nofree [[BYTES:%.*]]) #[[ATTR3]] { ; IS__CGSCC_NPM-NEXT: entry: ; IS__CGSCC_NPM-NEXT: br label [[FOR_COND:%.*]] ; IS__CGSCC_NPM: for.cond: @@ -2236,7 +2199,7 @@ define void @noalias_arg_simplifiable_2(i8* %Bytes) { ; IS__CGSCC_NPM-NEXT: store i8 0, i8* [[ARRAYIDX24]], align 1, !tbaa [[TBAA15]] ; IS__CGSCC_NPM-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds i8, i8* [[BYTES]], i64 500 ; IS__CGSCC_NPM-NEXT: [[I21:%.*]] = bitcast i8* [[ARRAYIDX25]] to i32* -; IS__CGSCC_NPM-NEXT: call void @write_arg(i32* nofree noundef nonnull writeonly align 4 dereferenceable(4) [[I21]], i32 noundef 0) #[[ATTR16]] +; IS__CGSCC_NPM-NEXT: call void @write_arg(i32* nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[I21]], i32 noundef 0) #[[ATTR15]] ; IS__CGSCC_NPM-NEXT: br label [[FOR_COND27:%.*]] ; IS__CGSCC_NPM: for.cond27: ; IS__CGSCC_NPM-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], [[FOR_INC35:%.*]] ], [ 0, [[FOR_END23]] ] @@ -2491,43 +2454,24 @@ entry: ; We could simplify these if we separate accessed bins wrt. alignment (here mod 4). define i32 @unknown_access_mixed_simplifiable(i32 %arg1, i32 %arg2) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@unknown_access_mixed_simplifiable -; IS__TUNIT____-SAME: (i32 [[ARG1:%.*]], i32 [[ARG2:%.*]]) #[[ATTR4]] { -; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: [[S:%.*]] = alloca [[STRUCT_S:%.*]], align 4 -; IS__TUNIT____-NEXT: [[BC:%.*]] = bitcast %struct.S* [[S]] to i32* -; IS__TUNIT____-NEXT: [[GEP1:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[S]], i64 0, i32 2 -; IS__TUNIT____-NEXT: [[GEP2:%.*]] = getelementptr inbounds i32, i32* [[BC]], i32 [[ARG1]] -; IS__TUNIT____-NEXT: [[GEP3:%.*]] = getelementptr inbounds i32, i32* [[BC]], i32 [[ARG2]] -; IS__TUNIT____-NEXT: store i32 7, i32* [[GEP1]], align 4 -; IS__TUNIT____-NEXT: store i32 7, i32* [[GEP2]], align 4 -; IS__TUNIT____-NEXT: store i32 7, i32* [[GEP3]], align 4 -; IS__TUNIT____-NEXT: [[L1:%.*]] = load i32, i32* [[GEP1]], align 4 -; IS__TUNIT____-NEXT: [[L2:%.*]] = load i32, i32* [[GEP2]], align 4 -; IS__TUNIT____-NEXT: [[L3:%.*]] = load i32, i32* [[GEP3]], align 4 -; IS__TUNIT____-NEXT: [[ADD1:%.*]] = add i32 [[L1]], [[L2]] -; IS__TUNIT____-NEXT: [[ADD2:%.*]] = add i32 [[ADD1]], [[L3]] -; IS__TUNIT____-NEXT: ret i32 [[ADD2]] -; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@unknown_access_mixed_simplifiable -; IS__CGSCC____-SAME: (i32 [[ARG1:%.*]], i32 [[ARG2:%.*]]) #[[ATTR3]] { -; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: [[S:%.*]] = alloca [[STRUCT_S:%.*]], align 4 -; IS__CGSCC____-NEXT: [[BC:%.*]] = bitcast %struct.S* [[S]] to i32* -; IS__CGSCC____-NEXT: [[GEP1:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[S]], i64 0, i32 2 -; IS__CGSCC____-NEXT: [[GEP2:%.*]] = getelementptr inbounds i32, i32* [[BC]], i32 [[ARG1]] -; IS__CGSCC____-NEXT: [[GEP3:%.*]] = getelementptr inbounds i32, i32* [[BC]], i32 [[ARG2]] -; IS__CGSCC____-NEXT: store i32 7, i32* [[GEP1]], align 4 -; IS__CGSCC____-NEXT: store i32 7, i32* [[GEP2]], align 4 -; IS__CGSCC____-NEXT: store i32 7, i32* [[GEP3]], align 4 -; IS__CGSCC____-NEXT: [[L1:%.*]] = load i32, i32* [[GEP1]], align 4 -; IS__CGSCC____-NEXT: [[L2:%.*]] = load i32, i32* [[GEP2]], align 4 -; IS__CGSCC____-NEXT: [[L3:%.*]] = load i32, i32* [[GEP3]], align 4 -; IS__CGSCC____-NEXT: [[ADD1:%.*]] = add i32 [[L1]], [[L2]] -; IS__CGSCC____-NEXT: [[ADD2:%.*]] = add i32 [[ADD1]], [[L3]] -; IS__CGSCC____-NEXT: ret i32 [[ADD2]] +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@unknown_access_mixed_simplifiable +; CHECK-SAME: (i32 [[ARG1:%.*]], i32 [[ARG2:%.*]]) #[[ATTR4]] { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[S:%.*]] = alloca [[STRUCT_S:%.*]], align 4 +; CHECK-NEXT: [[BC:%.*]] = bitcast %struct.S* [[S]] to i32* +; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[S]], i64 0, i32 2 +; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i32, i32* [[BC]], i32 [[ARG1]] +; CHECK-NEXT: [[GEP3:%.*]] = getelementptr inbounds i32, i32* [[BC]], i32 [[ARG2]] +; CHECK-NEXT: store i32 7, i32* [[GEP1]], align 4 +; CHECK-NEXT: store i32 7, i32* [[GEP2]], align 4 +; CHECK-NEXT: store i32 7, i32* [[GEP3]], align 4 +; CHECK-NEXT: [[L1:%.*]] = load i32, i32* [[GEP1]], align 4 +; CHECK-NEXT: [[L2:%.*]] = load i32, i32* [[GEP2]], align 4 +; CHECK-NEXT: [[L3:%.*]] = load i32, i32* [[GEP3]], align 4 +; CHECK-NEXT: [[ADD1:%.*]] = add i32 [[L1]], [[L2]] +; CHECK-NEXT: [[ADD2:%.*]] = add i32 [[ADD1]], [[L3]] +; CHECK-NEXT: ret i32 [[ADD2]] ; entry: %s = alloca %struct.S, align 4 @@ -2548,55 +2492,30 @@ entry: ; The access to bc4b could go anywhere, nothing is simplifiable. define i32 @unknown_access_mixed_not_simplifiable(i32 %arg1, i32 %arg2, i32 %arg3) { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@unknown_access_mixed_not_simplifiable -; IS__TUNIT____-SAME: (i32 [[ARG1:%.*]], i32 [[ARG2:%.*]], i32 [[ARG3:%.*]]) #[[ATTR4]] { -; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: [[S:%.*]] = alloca [[STRUCT_S:%.*]], align 4 -; IS__TUNIT____-NEXT: [[BC:%.*]] = bitcast %struct.S* [[S]] to i32* -; IS__TUNIT____-NEXT: [[GEP1:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[S]], i64 0, i32 2 -; IS__TUNIT____-NEXT: [[GEP2:%.*]] = getelementptr inbounds i32, i32* [[BC]], i32 [[ARG1]] -; IS__TUNIT____-NEXT: [[GEP3:%.*]] = getelementptr inbounds i32, i32* [[BC]], i32 [[ARG2]] -; IS__TUNIT____-NEXT: [[BC4A:%.*]] = bitcast %struct.S* [[S]] to i8* -; IS__TUNIT____-NEXT: [[GEP4:%.*]] = getelementptr inbounds i8, i8* [[BC4A]], i32 [[ARG3]] -; IS__TUNIT____-NEXT: [[BC4B:%.*]] = bitcast i8* [[GEP4]] to i32* -; IS__TUNIT____-NEXT: store i32 7, i32* [[GEP1]], align 4 -; IS__TUNIT____-NEXT: store i32 7, i32* [[GEP2]], align 4 -; IS__TUNIT____-NEXT: store i32 7, i32* [[GEP3]], align 4 -; IS__TUNIT____-NEXT: store i32 7, i32* [[BC4B]], align 4 -; IS__TUNIT____-NEXT: [[L1:%.*]] = load i32, i32* [[GEP1]], align 4 -; IS__TUNIT____-NEXT: [[L2:%.*]] = load i32, i32* [[GEP2]], align 4 -; IS__TUNIT____-NEXT: [[L3:%.*]] = load i32, i32* [[GEP3]], align 4 -; IS__TUNIT____-NEXT: [[L4:%.*]] = load i32, i32* [[BC4B]], align 4 -; IS__TUNIT____-NEXT: [[ADD1:%.*]] = add i32 [[L1]], [[L2]] -; IS__TUNIT____-NEXT: [[ADD2:%.*]] = add i32 [[ADD1]], [[L3]] -; IS__TUNIT____-NEXT: [[ADD3:%.*]] = add i32 [[ADD2]], [[L4]] -; IS__TUNIT____-NEXT: ret i32 [[ADD3]] -; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@unknown_access_mixed_not_simplifiable -; IS__CGSCC____-SAME: (i32 [[ARG1:%.*]], i32 [[ARG2:%.*]], i32 [[ARG3:%.*]]) #[[ATTR3]] { -; IS__CGSCC____-NEXT: entry: -; IS__CGSCC____-NEXT: [[S:%.*]] = alloca [[STRUCT_S:%.*]], align 4 -; IS__CGSCC____-NEXT: [[BC:%.*]] = bitcast %struct.S* [[S]] to i32* -; IS__CGSCC____-NEXT: [[GEP1:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[S]], i64 0, i32 2 -; IS__CGSCC____-NEXT: [[GEP2:%.*]] = getelementptr inbounds i32, i32* [[BC]], i32 [[ARG1]] -; IS__CGSCC____-NEXT: [[GEP3:%.*]] = getelementptr inbounds i32, i32* [[BC]], i32 [[ARG2]] -; IS__CGSCC____-NEXT: [[BC4A:%.*]] = bitcast %struct.S* [[S]] to i8* -; IS__CGSCC____-NEXT: [[GEP4:%.*]] = getelementptr inbounds i8, i8* [[BC4A]], i32 [[ARG3]] -; IS__CGSCC____-NEXT: [[BC4B:%.*]] = bitcast i8* [[GEP4]] to i32* -; IS__CGSCC____-NEXT: store i32 7, i32* [[GEP1]], align 4 -; IS__CGSCC____-NEXT: store i32 7, i32* [[GEP2]], align 4 -; IS__CGSCC____-NEXT: store i32 7, i32* [[GEP3]], align 4 -; IS__CGSCC____-NEXT: store i32 7, i32* [[BC4B]], align 4 -; IS__CGSCC____-NEXT: [[L1:%.*]] = load i32, i32* [[GEP1]], align 4 -; IS__CGSCC____-NEXT: [[L2:%.*]] = load i32, i32* [[GEP2]], align 4 -; IS__CGSCC____-NEXT: [[L3:%.*]] = load i32, i32* [[GEP3]], align 4 -; IS__CGSCC____-NEXT: [[L4:%.*]] = load i32, i32* [[BC4B]], align 4 -; IS__CGSCC____-NEXT: [[ADD1:%.*]] = add i32 [[L1]], [[L2]] -; IS__CGSCC____-NEXT: [[ADD2:%.*]] = add i32 [[ADD1]], [[L3]] -; IS__CGSCC____-NEXT: [[ADD3:%.*]] = add i32 [[ADD2]], [[L4]] -; IS__CGSCC____-NEXT: ret i32 [[ADD3]] +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@unknown_access_mixed_not_simplifiable +; CHECK-SAME: (i32 [[ARG1:%.*]], i32 [[ARG2:%.*]], i32 [[ARG3:%.*]]) #[[ATTR4]] { +; CHECK-NEXT: entry: +; CHECK-NEXT: [[S:%.*]] = alloca [[STRUCT_S:%.*]], align 4 +; CHECK-NEXT: [[BC:%.*]] = bitcast %struct.S* [[S]] to i32* +; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[S]], i64 0, i32 2 +; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i32, i32* [[BC]], i32 [[ARG1]] +; CHECK-NEXT: [[GEP3:%.*]] = getelementptr inbounds i32, i32* [[BC]], i32 [[ARG2]] +; CHECK-NEXT: [[BC4A:%.*]] = bitcast %struct.S* [[S]] to i8* +; CHECK-NEXT: [[GEP4:%.*]] = getelementptr inbounds i8, i8* [[BC4A]], i32 [[ARG3]] +; CHECK-NEXT: [[BC4B:%.*]] = bitcast i8* [[GEP4]] to i32* +; CHECK-NEXT: store i32 7, i32* [[GEP1]], align 4 +; CHECK-NEXT: store i32 7, i32* [[GEP2]], align 4 +; CHECK-NEXT: store i32 7, i32* [[GEP3]], align 4 +; CHECK-NEXT: store i32 7, i32* [[BC4B]], align 4 +; CHECK-NEXT: [[L1:%.*]] = load i32, i32* [[GEP1]], align 4 +; CHECK-NEXT: [[L2:%.*]] = load i32, i32* [[GEP2]], align 4 +; CHECK-NEXT: [[L3:%.*]] = load i32, i32* [[GEP3]], align 4 +; CHECK-NEXT: [[L4:%.*]] = load i32, i32* [[BC4B]], align 4 +; CHECK-NEXT: [[ADD1:%.*]] = add i32 [[L1]], [[L2]] +; CHECK-NEXT: [[ADD2:%.*]] = add i32 [[ADD1]], [[L3]] +; CHECK-NEXT: [[ADD3:%.*]] = add i32 [[ADD2]], [[L4]] +; CHECK-NEXT: ret i32 [[ADD3]] ; entry: %s = alloca %struct.S, align 4 @@ -2631,17 +2550,24 @@ declare void @escape(i8*) define i32 @global_not_simplifiable_1(i32 %cnd) { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@global_not_simplifiable_1 -; IS__TUNIT_OPM-SAME: (i32 [[CND:%.*]]) #[[ATTR7:[0-9]+]] { +; IS__TUNIT_OPM-SAME: (i32 [[CND:%.*]]) #[[ATTR8:[0-9]+]] { ; IS__TUNIT_OPM-NEXT: entry: ; IS__TUNIT_OPM-NEXT: [[I:%.*]] = load i32, i32* @Flag0, align 4, !tbaa [[TBAA3]] ; IS__TUNIT_OPM-NEXT: ret i32 [[I]] ; -; NOT_TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn -; NOT_TUNIT_OPM-LABEL: define {{[^@]+}}@global_not_simplifiable_1 -; NOT_TUNIT_OPM-SAME: (i32 [[CND:%.*]]) #[[ATTR6:[0-9]+]] { -; NOT_TUNIT_OPM-NEXT: entry: -; NOT_TUNIT_OPM-NEXT: [[I:%.*]] = load i32, i32* @Flag0, align 4, !tbaa [[TBAA3]] -; NOT_TUNIT_OPM-NEXT: ret i32 [[I]] +; IS________NPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn +; IS________NPM-LABEL: define {{[^@]+}}@global_not_simplifiable_1 +; IS________NPM-SAME: (i32 [[CND:%.*]]) #[[ATTR6:[0-9]+]] { +; IS________NPM-NEXT: entry: +; IS________NPM-NEXT: [[I:%.*]] = load i32, i32* @Flag0, align 4, !tbaa [[TBAA3]] +; IS________NPM-NEXT: ret i32 [[I]] +; +; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@global_not_simplifiable_1 +; IS__CGSCC_OPM-SAME: (i32 [[CND:%.*]]) #[[ATTR7:[0-9]+]] { +; IS__CGSCC_OPM-NEXT: entry: +; IS__CGSCC_OPM-NEXT: [[I:%.*]] = load i32, i32* @Flag0, align 4, !tbaa [[TBAA3]] +; IS__CGSCC_OPM-NEXT: ret i32 [[I]] ; entry: %i = load i32, i32* @Flag0, align 4, !tbaa !3 @@ -2724,12 +2650,12 @@ entry: ; ; FIXME: We could replace these loads. define i32 @write_read_global() { -; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@write_read_global -; IS__TUNIT_OPM-SAME: () #[[ATTR5]] { -; IS__TUNIT_OPM-NEXT: store i32 7, i32* @Gint1, align 4 -; IS__TUNIT_OPM-NEXT: [[L:%.*]] = load i32, i32* @Gint1, align 4 -; IS__TUNIT_OPM-NEXT: ret i32 [[L]] +; NOT_TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn +; NOT_TUNIT_NPM-LABEL: define {{[^@]+}}@write_read_global +; NOT_TUNIT_NPM-SAME: () #[[ATTR5]] { +; NOT_TUNIT_NPM-NEXT: store i32 7, i32* @Gint1, align 4 +; NOT_TUNIT_NPM-NEXT: [[L:%.*]] = load i32, i32* @Gint1, align 4 +; NOT_TUNIT_NPM-NEXT: ret i32 [[L]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@write_read_global @@ -2737,13 +2663,6 @@ define i32 @write_read_global() { ; IS__TUNIT_NPM-NEXT: store i32 7, i32* @Gint1, align 4 ; IS__TUNIT_NPM-NEXT: [[L:%.*]] = load i32, i32* @Gint1, align 4 ; IS__TUNIT_NPM-NEXT: ret i32 [[L]] -; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@write_read_global -; IS__CGSCC____-SAME: () #[[ATTR4]] { -; IS__CGSCC____-NEXT: store i32 7, i32* @Gint1, align 4 -; IS__CGSCC____-NEXT: [[L:%.*]] = load i32, i32* @Gint1, align 4 -; IS__CGSCC____-NEXT: ret i32 [[L]] ; store i32 7, i32* @Gint1 %l = load i32, i32* @Gint1 @@ -2762,11 +2681,17 @@ define void @write_global() { ; IS__TUNIT_NPM-NEXT: store i32 7, i32* @Gint2, align 4 ; IS__TUNIT_NPM-NEXT: ret void ; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly -; IS__CGSCC____-LABEL: define {{[^@]+}}@write_global -; IS__CGSCC____-SAME: () #[[ATTR7:[0-9]+]] { -; IS__CGSCC____-NEXT: store i32 7, i32* @Gint2, align 4 -; IS__CGSCC____-NEXT: ret void +; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@write_global +; IS__CGSCC_OPM-SAME: () #[[ATTR8:[0-9]+]] { +; IS__CGSCC_OPM-NEXT: store i32 7, i32* @Gint2, align 4 +; IS__CGSCC_OPM-NEXT: ret void +; +; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@write_global +; IS__CGSCC_NPM-SAME: () #[[ATTR7:[0-9]+]] { +; IS__CGSCC_NPM-NEXT: store i32 7, i32* @Gint2, align 4 +; IS__CGSCC_NPM-NEXT: ret void ; store i32 7, i32* @Gint2 ret void @@ -2774,27 +2699,33 @@ define void @write_global() { define i32 @read_global() { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@read_global -; IS__TUNIT_OPM-SAME: () #[[ATTR7]] { +; IS__TUNIT_OPM-SAME: () #[[ATTR8]] { ; IS__TUNIT_OPM-NEXT: [[L:%.*]] = load i32, i32* @Gint2, align 4 ; IS__TUNIT_OPM-NEXT: ret i32 [[L]] ; -; NOT_TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn -; NOT_TUNIT_OPM-LABEL: define {{[^@]+}}@read_global -; NOT_TUNIT_OPM-SAME: () #[[ATTR6]] { -; NOT_TUNIT_OPM-NEXT: [[L:%.*]] = load i32, i32* @Gint2, align 4 -; NOT_TUNIT_OPM-NEXT: ret i32 [[L]] +; IS________NPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn +; IS________NPM-LABEL: define {{[^@]+}}@read_global +; IS________NPM-SAME: () #[[ATTR6]] { +; IS________NPM-NEXT: [[L:%.*]] = load i32, i32* @Gint2, align 4 +; IS________NPM-NEXT: ret i32 [[L]] +; +; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@read_global +; IS__CGSCC_OPM-SAME: () #[[ATTR7]] { +; IS__CGSCC_OPM-NEXT: [[L:%.*]] = load i32, i32* @Gint2, align 4 +; IS__CGSCC_OPM-NEXT: ret i32 [[L]] ; %l = load i32, i32* @Gint2 ret i32 %l } ; FIXME: We could replace these loads. define i32 @write_read_static_global() { -; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@write_read_static_global -; IS__TUNIT_OPM-SAME: () #[[ATTR5]] { -; IS__TUNIT_OPM-NEXT: store i32 7, i32* @Gstatic_int1, align 4 -; IS__TUNIT_OPM-NEXT: [[L:%.*]] = load i32, i32* @Gstatic_int1, align 4 -; IS__TUNIT_OPM-NEXT: ret i32 [[L]] +; NOT_TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn +; NOT_TUNIT_NPM-LABEL: define {{[^@]+}}@write_read_static_global +; NOT_TUNIT_NPM-SAME: () #[[ATTR5]] { +; NOT_TUNIT_NPM-NEXT: store i32 7, i32* @Gstatic_int1, align 4 +; NOT_TUNIT_NPM-NEXT: [[L:%.*]] = load i32, i32* @Gstatic_int1, align 4 +; NOT_TUNIT_NPM-NEXT: ret i32 [[L]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@write_read_static_global @@ -2802,13 +2733,6 @@ define i32 @write_read_static_global() { ; IS__TUNIT_NPM-NEXT: store i32 7, i32* @Gstatic_int1, align 4 ; IS__TUNIT_NPM-NEXT: [[L:%.*]] = load i32, i32* @Gstatic_int1, align 4 ; IS__TUNIT_NPM-NEXT: ret i32 [[L]] -; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@write_read_static_global -; IS__CGSCC____-SAME: () #[[ATTR4]] { -; IS__CGSCC____-NEXT: store i32 7, i32* @Gstatic_int1, align 4 -; IS__CGSCC____-NEXT: [[L:%.*]] = load i32, i32* @Gstatic_int1, align 4 -; IS__CGSCC____-NEXT: ret i32 [[L]] ; store i32 7, i32* @Gstatic_int1 %l = load i32, i32* @Gstatic_int1 @@ -2827,11 +2751,17 @@ define void @write_static_global() { ; IS__TUNIT_NPM-NEXT: store i32 7, i32* @Gstatic_int2, align 4 ; IS__TUNIT_NPM-NEXT: ret void ; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly -; IS__CGSCC____-LABEL: define {{[^@]+}}@write_static_global -; IS__CGSCC____-SAME: () #[[ATTR7]] { -; IS__CGSCC____-NEXT: store i32 7, i32* @Gstatic_int2, align 4 -; IS__CGSCC____-NEXT: ret void +; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@write_static_global +; IS__CGSCC_OPM-SAME: () #[[ATTR8]] { +; IS__CGSCC_OPM-NEXT: store i32 7, i32* @Gstatic_int2, align 4 +; IS__CGSCC_OPM-NEXT: ret void +; +; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@write_static_global +; IS__CGSCC_NPM-SAME: () #[[ATTR7]] { +; IS__CGSCC_NPM-NEXT: store i32 7, i32* @Gstatic_int2, align 4 +; IS__CGSCC_NPM-NEXT: ret void ; store i32 7, i32* @Gstatic_int2 ret void @@ -2839,15 +2769,21 @@ define void @write_static_global() { define i32 @read_static_global() { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@read_static_global -; IS__TUNIT_OPM-SAME: () #[[ATTR7]] { +; IS__TUNIT_OPM-SAME: () #[[ATTR8]] { ; IS__TUNIT_OPM-NEXT: [[L:%.*]] = load i32, i32* @Gstatic_int2, align 4 ; IS__TUNIT_OPM-NEXT: ret i32 [[L]] ; -; NOT_TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn -; NOT_TUNIT_OPM-LABEL: define {{[^@]+}}@read_static_global -; NOT_TUNIT_OPM-SAME: () #[[ATTR6]] { -; NOT_TUNIT_OPM-NEXT: [[L:%.*]] = load i32, i32* @Gstatic_int2, align 4 -; NOT_TUNIT_OPM-NEXT: ret i32 [[L]] +; IS________NPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn +; IS________NPM-LABEL: define {{[^@]+}}@read_static_global +; IS________NPM-SAME: () #[[ATTR6]] { +; IS________NPM-NEXT: [[L:%.*]] = load i32, i32* @Gstatic_int2, align 4 +; IS________NPM-NEXT: ret i32 [[L]] +; +; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@read_static_global +; IS__CGSCC_OPM-SAME: () #[[ATTR7]] { +; IS__CGSCC_OPM-NEXT: [[L:%.*]] = load i32, i32* @Gstatic_int2, align 4 +; IS__CGSCC_OPM-NEXT: ret i32 [[L]] ; %l = load i32, i32* @Gstatic_int2 ret i32 %l @@ -2863,10 +2799,15 @@ define i32 @write_read_static_undef_global() { ; IS__TUNIT_NPM-SAME: () #[[ATTR5]] { ; IS__TUNIT_NPM-NEXT: ret i32 7 ; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly -; IS__CGSCC____-LABEL: define {{[^@]+}}@write_read_static_undef_global -; IS__CGSCC____-SAME: () #[[ATTR7]] { -; IS__CGSCC____-NEXT: ret i32 7 +; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@write_read_static_undef_global +; IS__CGSCC_OPM-SAME: () #[[ATTR8]] { +; IS__CGSCC_OPM-NEXT: ret i32 7 +; +; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@write_read_static_undef_global +; IS__CGSCC_NPM-SAME: () #[[ATTR7]] { +; IS__CGSCC_NPM-NEXT: ret i32 7 ; store i32 7, i32* @Gstatic_undef_int1 %l = load i32, i32* @Gstatic_undef_int1 @@ -2883,68 +2824,65 @@ define void @write_static_undef_global() { ; IS__TUNIT_NPM-SAME: () #[[ATTR5]] { ; IS__TUNIT_NPM-NEXT: ret void ; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly -; IS__CGSCC____-LABEL: define {{[^@]+}}@write_static_undef_global -; IS__CGSCC____-SAME: () #[[ATTR7]] { -; IS__CGSCC____-NEXT: store i32 7, i32* @Gstatic_undef_int2, align 4 -; IS__CGSCC____-NEXT: ret void +; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@write_static_undef_global +; IS__CGSCC_OPM-SAME: () #[[ATTR8]] { +; IS__CGSCC_OPM-NEXT: store i32 7, i32* @Gstatic_undef_int2, align 4 +; IS__CGSCC_OPM-NEXT: ret void +; +; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@write_static_undef_global +; IS__CGSCC_NPM-SAME: () #[[ATTR7]] { +; IS__CGSCC_NPM-NEXT: store i32 7, i32* @Gstatic_undef_int2, align 4 +; IS__CGSCC_NPM-NEXT: ret void ; store i32 7, i32* @Gstatic_undef_int2 ret void } define i32 @read_static_undef_global() { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@read_static_undef_global -; IS__TUNIT____-SAME: () #[[ATTR4]] { -; IS__TUNIT____-NEXT: ret i32 7 -; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@read_static_undef_global -; IS__CGSCC____-SAME: () #[[ATTR3]] { -; IS__CGSCC____-NEXT: ret i32 7 +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@read_static_undef_global +; CHECK-SAME: () #[[ATTR4]] { +; CHECK-NEXT: ret i32 7 ; %l = load i32, i32* @Gstatic_undef_int2 ret i32 %l } define i32 @single_read_of_static_global() { -; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__TUNIT____-LABEL: define {{[^@]+}}@single_read_of_static_global -; IS__TUNIT____-SAME: () #[[ATTR4]] { -; IS__TUNIT____-NEXT: ret i32 0 -; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@single_read_of_static_global -; IS__CGSCC____-SAME: () #[[ATTR3]] { -; IS__CGSCC____-NEXT: ret i32 0 +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@single_read_of_static_global +; CHECK-SAME: () #[[ATTR4]] { +; CHECK-NEXT: ret i32 0 ; %l = load i32, i32* @Gstatic_int3 ret i32 %l } define i8 @phi_store() { -; IS________OPM: Function Attrs: nofree norecurse nosync nounwind readnone -; IS________OPM-LABEL: define {{[^@]+}}@phi_store -; IS________OPM-SAME: () #[[ATTR8:[0-9]+]] { -; IS________OPM-NEXT: entry: -; IS________OPM-NEXT: [[A:%.*]] = alloca i16, align 2 -; IS________OPM-NEXT: [[B:%.*]] = bitcast i16* [[A]] to i8* -; IS________OPM-NEXT: br label [[LOOP:%.*]] -; IS________OPM: loop: -; IS________OPM-NEXT: [[P:%.*]] = phi i8* [ [[B]], [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] -; IS________OPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] -; IS________OPM-NEXT: [[G]] = getelementptr i8, i8* [[P]], i64 1 -; IS________OPM-NEXT: [[O]] = add nsw i8 [[I]], 1 -; IS________OPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 2 -; IS________OPM-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]] -; IS________OPM: end: -; IS________OPM-NEXT: [[S:%.*]] = getelementptr i8, i8* [[B]], i64 1 -; IS________OPM-NEXT: [[L:%.*]] = load i8, i8* [[S]], align 1 -; IS________OPM-NEXT: ret i8 [[L]] -; -; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind +; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@phi_store +; IS__TUNIT_OPM-SAME: () #[[ATTR3]] { +; IS__TUNIT_OPM-NEXT: entry: +; IS__TUNIT_OPM-NEXT: [[A:%.*]] = alloca i16, align 2 +; IS__TUNIT_OPM-NEXT: [[B:%.*]] = bitcast i16* [[A]] to i8* +; IS__TUNIT_OPM-NEXT: br label [[LOOP:%.*]] +; IS__TUNIT_OPM: loop: +; IS__TUNIT_OPM-NEXT: [[P:%.*]] = phi i8* [ [[B]], [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] +; IS__TUNIT_OPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] +; IS__TUNIT_OPM-NEXT: store i8 1, i8* [[P]], align 1 +; IS__TUNIT_OPM-NEXT: [[G]] = getelementptr i8, i8* [[P]], i64 1 +; IS__TUNIT_OPM-NEXT: [[O]] = add nsw i8 [[I]], 1 +; IS__TUNIT_OPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 2 +; IS__TUNIT_OPM-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]] +; IS__TUNIT_OPM: end: +; IS__TUNIT_OPM-NEXT: [[S:%.*]] = getelementptr i8, i8* [[B]], i64 1 +; IS__TUNIT_OPM-NEXT: [[L:%.*]] = load i8, i8* [[S]], align 1 +; IS__TUNIT_OPM-NEXT: ret i8 [[L]] +; +; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@phi_store -; IS__TUNIT_NPM-SAME: () #[[ATTR4]] { +; IS__TUNIT_NPM-SAME: () #[[ATTR3]] { ; IS__TUNIT_NPM-NEXT: entry: ; IS__TUNIT_NPM-NEXT: [[A:%.*]] = alloca i16, align 2 ; IS__TUNIT_NPM-NEXT: [[B:%.*]] = bitcast i16* [[A]] to i8* @@ -2952,6 +2890,7 @@ define i8 @phi_store() { ; IS__TUNIT_NPM: loop: ; IS__TUNIT_NPM-NEXT: [[P:%.*]] = phi i8* [ [[B]], [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__TUNIT_NPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] +; IS__TUNIT_NPM-NEXT: store i8 1, i8* [[P]], align 1 ; IS__TUNIT_NPM-NEXT: [[G]] = getelementptr i8, i8* [[P]], i64 1 ; IS__TUNIT_NPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__TUNIT_NPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 2 @@ -2961,9 +2900,29 @@ define i8 @phi_store() { ; IS__TUNIT_NPM-NEXT: [[L:%.*]] = load i8, i8* [[S]], align 1 ; IS__TUNIT_NPM-NEXT: ret i8 [[L]] ; -; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@phi_store +; IS__CGSCC_OPM-SAME: () #[[ATTR9:[0-9]+]] { +; IS__CGSCC_OPM-NEXT: entry: +; IS__CGSCC_OPM-NEXT: [[A:%.*]] = alloca i16, align 2 +; IS__CGSCC_OPM-NEXT: [[B:%.*]] = bitcast i16* [[A]] to i8* +; IS__CGSCC_OPM-NEXT: br label [[LOOP:%.*]] +; IS__CGSCC_OPM: loop: +; IS__CGSCC_OPM-NEXT: [[P:%.*]] = phi i8* [ [[B]], [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] +; IS__CGSCC_OPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] +; IS__CGSCC_OPM-NEXT: store i8 1, i8* [[P]], align 1 +; IS__CGSCC_OPM-NEXT: [[G]] = getelementptr i8, i8* [[P]], i64 1 +; IS__CGSCC_OPM-NEXT: [[O]] = add nsw i8 [[I]], 1 +; IS__CGSCC_OPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 2 +; IS__CGSCC_OPM-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]] +; IS__CGSCC_OPM: end: +; IS__CGSCC_OPM-NEXT: [[S:%.*]] = getelementptr i8, i8* [[B]], i64 1 +; IS__CGSCC_OPM-NEXT: [[L:%.*]] = load i8, i8* [[S]], align 1 +; IS__CGSCC_OPM-NEXT: ret i8 [[L]] +; +; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@phi_store -; IS__CGSCC_NPM-SAME: () #[[ATTR3]] { +; IS__CGSCC_NPM-SAME: () #[[ATTR5]] { ; IS__CGSCC_NPM-NEXT: entry: ; IS__CGSCC_NPM-NEXT: [[A:%.*]] = alloca i16, align 2 ; IS__CGSCC_NPM-NEXT: [[B:%.*]] = bitcast i16* [[A]] to i8* @@ -2971,6 +2930,7 @@ define i8 @phi_store() { ; IS__CGSCC_NPM: loop: ; IS__CGSCC_NPM-NEXT: [[P:%.*]] = phi i8* [ [[B]], [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__CGSCC_NPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] +; IS__CGSCC_NPM-NEXT: store i8 1, i8* [[P]], align 1 ; IS__CGSCC_NPM-NEXT: [[G]] = getelementptr i8, i8* [[P]], i64 1 ; IS__CGSCC_NPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__CGSCC_NPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 2 @@ -3009,6 +2969,7 @@ define i8 @phi_no_store_1() { ; IS__TUNIT_OPM: loop: ; IS__TUNIT_OPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a1 to i8*), [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__TUNIT_OPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] +; IS__TUNIT_OPM-NEXT: store i8 1, i8* [[P]], align 1 ; IS__TUNIT_OPM-NEXT: [[G]] = getelementptr i8, i8* [[P]], i64 1 ; IS__TUNIT_OPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__TUNIT_OPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 3 @@ -3027,6 +2988,7 @@ define i8 @phi_no_store_1() { ; IS__TUNIT_NPM: loop: ; IS__TUNIT_NPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a1 to i8*), [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__TUNIT_NPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] +; IS__TUNIT_NPM-NEXT: store i8 1, i8* [[P]], align 1 ; IS__TUNIT_NPM-NEXT: [[G]] = getelementptr i8, i8* [[P]], i64 1 ; IS__TUNIT_NPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__TUNIT_NPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 3 @@ -3039,12 +3001,13 @@ define i8 @phi_no_store_1() { ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@phi_no_store_1 -; IS__CGSCC_OPM-SAME: () #[[ATTR9:[0-9]+]] { +; IS__CGSCC_OPM-SAME: () #[[ATTR9]] { ; IS__CGSCC_OPM-NEXT: entry: ; IS__CGSCC_OPM-NEXT: br label [[LOOP:%.*]] ; IS__CGSCC_OPM: loop: ; IS__CGSCC_OPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a1 to i8*), [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__CGSCC_OPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] +; IS__CGSCC_OPM-NEXT: store i8 1, i8* [[P]], align 1 ; IS__CGSCC_OPM-NEXT: [[G]] = getelementptr i8, i8* [[P]], i64 1 ; IS__CGSCC_OPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__CGSCC_OPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 3 @@ -3057,12 +3020,13 @@ define i8 @phi_no_store_1() { ; ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@phi_no_store_1 -; IS__CGSCC_NPM-SAME: () #[[ATTR4]] { +; IS__CGSCC_NPM-SAME: () #[[ATTR5]] { ; IS__CGSCC_NPM-NEXT: entry: ; IS__CGSCC_NPM-NEXT: br label [[LOOP:%.*]] ; IS__CGSCC_NPM: loop: ; IS__CGSCC_NPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a1 to i8*), [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__CGSCC_NPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] +; IS__CGSCC_NPM-NEXT: store i8 1, i8* [[P]], align 1 ; IS__CGSCC_NPM-NEXT: [[G]] = getelementptr i8, i8* [[P]], i64 1 ; IS__CGSCC_NPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__CGSCC_NPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 3 @@ -3102,9 +3066,10 @@ define i8 @phi_no_store_2() { ; IS__TUNIT_OPM-NEXT: entry: ; IS__TUNIT_OPM-NEXT: br label [[LOOP:%.*]] ; IS__TUNIT_OPM: loop: -; IS__TUNIT_OPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a2 to i8*), [[ENTRY:%.*]] ], [ getelementptr (i8, i8* bitcast (i32* @a2 to i8*), i64 2), [[LOOP]] ] +; IS__TUNIT_OPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a2 to i8*), [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__TUNIT_OPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] ; IS__TUNIT_OPM-NEXT: store i8 1, i8* [[P]], align 2 +; IS__TUNIT_OPM-NEXT: [[G]] = getelementptr i8, i8* bitcast (i32* @a2 to i8*), i64 2 ; IS__TUNIT_OPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__TUNIT_OPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 7 ; IS__TUNIT_OPM-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]] @@ -3119,9 +3084,10 @@ define i8 @phi_no_store_2() { ; IS__TUNIT_NPM-NEXT: entry: ; IS__TUNIT_NPM-NEXT: br label [[LOOP:%.*]] ; IS__TUNIT_NPM: loop: -; IS__TUNIT_NPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a2 to i8*), [[ENTRY:%.*]] ], [ getelementptr (i8, i8* bitcast (i32* @a2 to i8*), i64 2), [[LOOP]] ] +; IS__TUNIT_NPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a2 to i8*), [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__TUNIT_NPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] ; IS__TUNIT_NPM-NEXT: store i8 1, i8* [[P]], align 2 +; IS__TUNIT_NPM-NEXT: [[G]] = getelementptr i8, i8* bitcast (i32* @a2 to i8*), i64 2 ; IS__TUNIT_NPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__TUNIT_NPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 7 ; IS__TUNIT_NPM-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]] @@ -3136,9 +3102,10 @@ define i8 @phi_no_store_2() { ; IS__CGSCC_OPM-NEXT: entry: ; IS__CGSCC_OPM-NEXT: br label [[LOOP:%.*]] ; IS__CGSCC_OPM: loop: -; IS__CGSCC_OPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a2 to i8*), [[ENTRY:%.*]] ], [ getelementptr (i8, i8* bitcast (i32* @a2 to i8*), i64 2), [[LOOP]] ] +; IS__CGSCC_OPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a2 to i8*), [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__CGSCC_OPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] ; IS__CGSCC_OPM-NEXT: store i8 1, i8* [[P]], align 2 +; IS__CGSCC_OPM-NEXT: [[G]] = getelementptr i8, i8* bitcast (i32* @a2 to i8*), i64 2 ; IS__CGSCC_OPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__CGSCC_OPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 7 ; IS__CGSCC_OPM-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]] @@ -3149,13 +3116,14 @@ define i8 @phi_no_store_2() { ; ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@phi_no_store_2 -; IS__CGSCC_NPM-SAME: () #[[ATTR4]] { +; IS__CGSCC_NPM-SAME: () #[[ATTR5]] { ; IS__CGSCC_NPM-NEXT: entry: ; IS__CGSCC_NPM-NEXT: br label [[LOOP:%.*]] ; IS__CGSCC_NPM: loop: -; IS__CGSCC_NPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a2 to i8*), [[ENTRY:%.*]] ], [ getelementptr (i8, i8* bitcast (i32* @a2 to i8*), i64 2), [[LOOP]] ] +; IS__CGSCC_NPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a2 to i8*), [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__CGSCC_NPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] ; IS__CGSCC_NPM-NEXT: store i8 1, i8* [[P]], align 2 +; IS__CGSCC_NPM-NEXT: [[G]] = getelementptr i8, i8* bitcast (i32* @a2 to i8*), i64 2 ; IS__CGSCC_NPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__CGSCC_NPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 7 ; IS__CGSCC_NPM-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]] @@ -3187,12 +3155,13 @@ end: define i8 @phi_no_store_3() { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind writeonly ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@phi_no_store_3 -; IS__TUNIT_OPM-SAME: () #[[ATTR9:[0-9]+]] { +; IS__TUNIT_OPM-SAME: () #[[ATTR7]] { ; IS__TUNIT_OPM-NEXT: entry: ; IS__TUNIT_OPM-NEXT: br label [[LOOP:%.*]] ; IS__TUNIT_OPM: loop: -; IS__TUNIT_OPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a3 to i8*), [[ENTRY:%.*]] ], [ getelementptr (i8, i8* bitcast (i32* @a3 to i8*), i64 2), [[LOOP]] ] +; IS__TUNIT_OPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a3 to i8*), [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__TUNIT_OPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] +; IS__TUNIT_OPM-NEXT: [[G]] = getelementptr i8, i8* bitcast (i32* @a3 to i8*), i64 2 ; IS__TUNIT_OPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__TUNIT_OPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 7 ; IS__TUNIT_OPM-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]] @@ -3205,8 +3174,9 @@ define i8 @phi_no_store_3() { ; IS__TUNIT_NPM-NEXT: entry: ; IS__TUNIT_NPM-NEXT: br label [[LOOP:%.*]] ; IS__TUNIT_NPM: loop: -; IS__TUNIT_NPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a3 to i8*), [[ENTRY:%.*]] ], [ getelementptr (i8, i8* bitcast (i32* @a3 to i8*), i64 2), [[LOOP]] ] +; IS__TUNIT_NPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a3 to i8*), [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__TUNIT_NPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] +; IS__TUNIT_NPM-NEXT: [[G]] = getelementptr i8, i8* bitcast (i32* @a3 to i8*), i64 2 ; IS__TUNIT_NPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__TUNIT_NPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 7 ; IS__TUNIT_NPM-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]] @@ -3219,8 +3189,9 @@ define i8 @phi_no_store_3() { ; IS__CGSCC_OPM-NEXT: entry: ; IS__CGSCC_OPM-NEXT: br label [[LOOP:%.*]] ; IS__CGSCC_OPM: loop: -; IS__CGSCC_OPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a3 to i8*), [[ENTRY:%.*]] ], [ getelementptr (i8, i8* bitcast (i32* @a3 to i8*), i64 2), [[LOOP]] ] +; IS__CGSCC_OPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a3 to i8*), [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__CGSCC_OPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] +; IS__CGSCC_OPM-NEXT: [[G]] = getelementptr i8, i8* bitcast (i32* @a3 to i8*), i64 2 ; IS__CGSCC_OPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__CGSCC_OPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 7 ; IS__CGSCC_OPM-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]] @@ -3233,8 +3204,9 @@ define i8 @phi_no_store_3() { ; IS__CGSCC_NPM-NEXT: entry: ; IS__CGSCC_NPM-NEXT: br label [[LOOP:%.*]] ; IS__CGSCC_NPM: loop: -; IS__CGSCC_NPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a3 to i8*), [[ENTRY:%.*]] ], [ getelementptr (i8, i8* bitcast (i32* @a3 to i8*), i64 2), [[LOOP]] ] +; IS__CGSCC_NPM-NEXT: [[P:%.*]] = phi i8* [ bitcast (i32* @a3 to i8*), [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ] ; IS__CGSCC_NPM-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ] +; IS__CGSCC_NPM-NEXT: [[G]] = getelementptr i8, i8* bitcast (i32* @a3 to i8*), i64 2 ; IS__CGSCC_NPM-NEXT: [[O]] = add nsw i8 [[I]], 1 ; IS__CGSCC_NPM-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 7 ; IS__CGSCC_NPM-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]] @@ -3264,12 +3236,12 @@ end: } define i8 @cast_and_load_1() { -; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@cast_and_load_1 -; IS__TUNIT_OPM-SAME: () #[[ATTR5]] { -; IS__TUNIT_OPM-NEXT: store i32 42, i32* @bytes1, align 4 -; IS__TUNIT_OPM-NEXT: [[L:%.*]] = load i8, i8* bitcast (i32* @bytes1 to i8*), align 4 -; IS__TUNIT_OPM-NEXT: ret i8 [[L]] +; NOT_TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn +; NOT_TUNIT_NPM-LABEL: define {{[^@]+}}@cast_and_load_1 +; NOT_TUNIT_NPM-SAME: () #[[ATTR5]] { +; NOT_TUNIT_NPM-NEXT: store i32 42, i32* @bytes1, align 4 +; NOT_TUNIT_NPM-NEXT: [[L:%.*]] = load i8, i8* bitcast (i32* @bytes1 to i8*), align 4 +; NOT_TUNIT_NPM-NEXT: ret i8 [[L]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@cast_and_load_1 @@ -3277,13 +3249,6 @@ define i8 @cast_and_load_1() { ; IS__TUNIT_NPM-NEXT: store i32 42, i32* @bytes1, align 4 ; IS__TUNIT_NPM-NEXT: [[L:%.*]] = load i8, i8* bitcast (i32* @bytes1 to i8*), align 4 ; IS__TUNIT_NPM-NEXT: ret i8 [[L]] -; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@cast_and_load_1 -; IS__CGSCC____-SAME: () #[[ATTR4]] { -; IS__CGSCC____-NEXT: store i32 42, i32* @bytes1, align 4 -; IS__CGSCC____-NEXT: [[L:%.*]] = load i8, i8* bitcast (i32* @bytes1 to i8*), align 4 -; IS__CGSCC____-NEXT: ret i8 [[L]] ; store i32 42, i32* @bytes1 %bc = bitcast i32* @bytes1 to i8* @@ -3292,12 +3257,12 @@ define i8 @cast_and_load_1() { } define i64 @cast_and_load_2() { -; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@cast_and_load_2 -; IS__TUNIT_OPM-SAME: () #[[ATTR5]] { -; IS__TUNIT_OPM-NEXT: store i32 42, i32* @bytes2, align 4 -; IS__TUNIT_OPM-NEXT: [[L:%.*]] = load i64, i64* bitcast (i32* @bytes2 to i64*), align 4 -; IS__TUNIT_OPM-NEXT: ret i64 [[L]] +; NOT_TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn +; NOT_TUNIT_NPM-LABEL: define {{[^@]+}}@cast_and_load_2 +; NOT_TUNIT_NPM-SAME: () #[[ATTR5]] { +; NOT_TUNIT_NPM-NEXT: store i32 42, i32* @bytes2, align 4 +; NOT_TUNIT_NPM-NEXT: [[L:%.*]] = load i64, i64* bitcast (i32* @bytes2 to i64*), align 4 +; NOT_TUNIT_NPM-NEXT: ret i64 [[L]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@cast_and_load_2 @@ -3305,13 +3270,6 @@ define i64 @cast_and_load_2() { ; IS__TUNIT_NPM-NEXT: store i32 42, i32* @bytes2, align 4 ; IS__TUNIT_NPM-NEXT: [[L:%.*]] = load i64, i64* bitcast (i32* @bytes2 to i64*), align 4 ; IS__TUNIT_NPM-NEXT: ret i64 [[L]] -; -; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@cast_and_load_2 -; IS__CGSCC____-SAME: () #[[ATTR4]] { -; IS__CGSCC____-NEXT: store i32 42, i32* @bytes2, align 4 -; IS__CGSCC____-NEXT: [[L:%.*]] = load i64, i64* bitcast (i32* @bytes2 to i64*), align 4 -; IS__CGSCC____-NEXT: ret i64 [[L]] ; store i32 42, i32* @bytes2 %bc = bitcast i32* @bytes2 to i64* @@ -3321,35 +3279,20 @@ define i64 @cast_and_load_2() { define void @recursive_load_store(i64 %N, i32 %v) { ; -; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind writeonly -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@recursive_load_store -; IS__TUNIT_OPM-SAME: (i64 [[N:%.*]], i32 [[V:%.*]]) #[[ATTR9]] { -; IS__TUNIT_OPM-NEXT: entry: -; IS__TUNIT_OPM-NEXT: br label [[FOR_COND:%.*]] -; IS__TUNIT_OPM: for.cond: -; IS__TUNIT_OPM-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY:%.*]] ], [ 0, [[ENTRY:%.*]] ] -; IS__TUNIT_OPM-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], [[N]] -; IS__TUNIT_OPM-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[FOR_END:%.*]] -; IS__TUNIT_OPM: for.body: -; IS__TUNIT_OPM-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; IS__TUNIT_OPM-NEXT: br label [[FOR_COND]] -; IS__TUNIT_OPM: for.end: -; IS__TUNIT_OPM-NEXT: ret void -; -; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind writeonly -; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@recursive_load_store -; IS__TUNIT_NPM-SAME: (i64 [[N:%.*]], i32 [[V:%.*]]) #[[ATTR7:[0-9]+]] { -; IS__TUNIT_NPM-NEXT: entry: -; IS__TUNIT_NPM-NEXT: br label [[FOR_COND:%.*]] -; IS__TUNIT_NPM: for.cond: -; IS__TUNIT_NPM-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY:%.*]] ], [ 0, [[ENTRY:%.*]] ] -; IS__TUNIT_NPM-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], [[N]] -; IS__TUNIT_NPM-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[FOR_END:%.*]] -; IS__TUNIT_NPM: for.body: -; IS__TUNIT_NPM-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 -; IS__TUNIT_NPM-NEXT: br label [[FOR_COND]] -; IS__TUNIT_NPM: for.end: -; IS__TUNIT_NPM-NEXT: ret void +; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind writeonly +; IS__TUNIT____-LABEL: define {{[^@]+}}@recursive_load_store +; IS__TUNIT____-SAME: (i64 [[N:%.*]], i32 [[V:%.*]]) #[[ATTR7:[0-9]+]] { +; IS__TUNIT____-NEXT: entry: +; IS__TUNIT____-NEXT: br label [[FOR_COND:%.*]] +; IS__TUNIT____: for.cond: +; IS__TUNIT____-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY:%.*]] ], [ 0, [[ENTRY:%.*]] ] +; IS__TUNIT____-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], [[N]] +; IS__TUNIT____-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[FOR_END:%.*]] +; IS__TUNIT____: for.body: +; IS__TUNIT____-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1 +; IS__TUNIT____-NEXT: br label [[FOR_COND]] +; IS__TUNIT____: for.end: +; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind writeonly ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@recursive_load_store @@ -3416,9 +3359,9 @@ define dso_local i32 @round_trip_malloc(i32 %x) { ; IS________NPM-LABEL: define {{[^@]+}}@round_trip_malloc ; IS________NPM-SAME: (i32 returned [[X:%.*]]) { ; IS________NPM-NEXT: entry: -; IS________NPM-NEXT: [[TMP0:%.*]] = alloca i8, i64 4, align 1 -; IS________NPM-NEXT: [[TMP1:%.*]] = bitcast i8* [[TMP0]] to i32* -; IS________NPM-NEXT: store i32 [[X]], i32* [[TMP1]], align 4 +; IS________NPM-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 1 +; IS________NPM-NEXT: [[TMP0:%.*]] = bitcast i8* [[CALL_H2S]] to i32* +; IS________NPM-NEXT: store i32 [[X]], i32* [[TMP0]], align 4 ; IS________NPM-NEXT: ret i32 [[X]] ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@round_trip_malloc @@ -3496,12 +3439,12 @@ define dso_local i32 @conditional_malloc(i32 %x) { ; IS________NPM-LABEL: define {{[^@]+}}@conditional_malloc ; IS________NPM-SAME: (i32 returned [[X:%.*]]) { ; IS________NPM-NEXT: entry: -; IS________NPM-NEXT: [[TMP0:%.*]] = alloca i8, i64 4, align 1 -; IS________NPM-NEXT: [[TMP1:%.*]] = bitcast i8* [[TMP0]] to i32* +; IS________NPM-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 1 +; IS________NPM-NEXT: [[TMP0:%.*]] = bitcast i8* [[CALL_H2S]] to i32* ; IS________NPM-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[X]], 0 ; IS________NPM-NEXT: br i1 [[TOBOOL]], label [[IF_THEN:%.*]], label [[IF_END:%.*]] ; IS________NPM: if.then: -; IS________NPM-NEXT: store i32 [[X]], i32* [[TMP1]], align 4 +; IS________NPM-NEXT: store i32 [[X]], i32* [[TMP0]], align 4 ; IS________NPM-NEXT: br label [[IF_END]] ; IS________NPM: if.end: ; IS________NPM-NEXT: ret i32 [[X]] @@ -3548,12 +3491,12 @@ define dso_local i32 @round_trip_calloc(i32 %x) { ; IS________NPM-LABEL: define {{[^@]+}}@round_trip_calloc ; IS________NPM-SAME: (i32 [[X:%.*]]) { ; IS________NPM-NEXT: entry: -; IS________NPM-NEXT: [[TMP0:%.*]] = alloca i8, i64 4, align 1 -; IS________NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* [[TMP0]], i8 0, i64 4, i1 false) -; IS________NPM-NEXT: [[TMP1:%.*]] = bitcast i8* [[TMP0]] to i32* -; IS________NPM-NEXT: store i32 [[X]], i32* [[TMP1]], align 4 -; IS________NPM-NEXT: [[TMP2:%.*]] = load i32, i32* [[TMP1]], align 4 -; IS________NPM-NEXT: ret i32 [[TMP2]] +; IS________NPM-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 1 +; IS________NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* [[CALL_H2S]], i8 0, i64 4, i1 false) +; IS________NPM-NEXT: [[TMP0:%.*]] = bitcast i8* [[CALL_H2S]] to i32* +; IS________NPM-NEXT: store i32 [[X]], i32* [[TMP0]], align 4 +; IS________NPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP0]], align 4 +; IS________NPM-NEXT: ret i32 [[TMP1]] ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@round_trip_calloc ; IS__CGSCC_OPM-SAME: (i32 [[X:%.*]]) { @@ -3583,12 +3526,12 @@ define dso_local i32 @round_trip_calloc_constant() { ; ; IS________NPM-LABEL: define {{[^@]+}}@round_trip_calloc_constant() { ; IS________NPM-NEXT: entry: -; IS________NPM-NEXT: [[TMP0:%.*]] = alloca i8, i64 4, align 1 -; IS________NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* [[TMP0]], i8 0, i64 4, i1 false) -; IS________NPM-NEXT: [[TMP1:%.*]] = bitcast i8* [[TMP0]] to i32* -; IS________NPM-NEXT: store i32 11, i32* [[TMP1]], align 4 -; IS________NPM-NEXT: [[TMP2:%.*]] = load i32, i32* [[TMP1]], align 4 -; IS________NPM-NEXT: ret i32 [[TMP2]] +; IS________NPM-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 1 +; IS________NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* [[CALL_H2S]], i8 0, i64 4, i1 false) +; IS________NPM-NEXT: [[TMP0:%.*]] = bitcast i8* [[CALL_H2S]] to i32* +; IS________NPM-NEXT: store i32 11, i32* [[TMP0]], align 4 +; IS________NPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP0]], align 4 +; IS________NPM-NEXT: ret i32 [[TMP1]] ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@round_trip_calloc_constant() { ; IS__CGSCC_OPM-NEXT: entry: @@ -3628,18 +3571,17 @@ define dso_local i32 @conditional_calloc(i32 %x) { ; IS________NPM-LABEL: define {{[^@]+}}@conditional_calloc ; IS________NPM-SAME: (i32 [[X:%.*]]) { ; IS________NPM-NEXT: entry: -; IS________NPM-NEXT: [[TMP0:%.*]] = alloca i8, i64 4, align 1 -; IS________NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* [[TMP0]], i8 0, i64 4, i1 false) -; IS________NPM-NEXT: [[TMP1:%.*]] = bitcast i8* [[TMP0]] to i32* +; IS________NPM-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 1 +; IS________NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* [[CALL_H2S]], i8 0, i64 4, i1 false) +; IS________NPM-NEXT: [[TMP0:%.*]] = bitcast i8* [[CALL_H2S]] to i32* ; IS________NPM-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[X]], 0 ; IS________NPM-NEXT: br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[IF_THEN:%.*]] ; IS________NPM: if.then: -; IS________NPM-NEXT: store i32 [[X]], i32* [[TMP1]], align 4 +; IS________NPM-NEXT: store i32 [[X]], i32* [[TMP0]], align 4 ; IS________NPM-NEXT: br label [[IF_END]] ; IS________NPM: if.end: -; IS________NPM-NEXT: [[TMP2:%.*]] = load i32, i32* [[TMP1]], align 4 -; IS________NPM-NEXT: [[TMP3:%.*]] = bitcast i32* [[TMP1]] to i8* -; IS________NPM-NEXT: ret i32 [[TMP2]] +; IS________NPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP0]], align 4 +; IS________NPM-NEXT: ret i32 [[TMP1]] ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@conditional_calloc ; IS__CGSCC_OPM-SAME: (i32 [[X:%.*]]) { @@ -3693,14 +3635,12 @@ define dso_local i32 @conditional_calloc_zero(i1 %c) { ; IS________NPM-LABEL: define {{[^@]+}}@conditional_calloc_zero ; IS________NPM-SAME: (i1 [[C:%.*]]) { ; IS________NPM-NEXT: entry: -; IS________NPM-NEXT: [[TMP0:%.*]] = alloca i8, i64 4, align 1 -; IS________NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* [[TMP0]], i8 0, i64 4, i1 false) -; IS________NPM-NEXT: [[TMP1:%.*]] = bitcast i8* [[TMP0]] to i32* +; IS________NPM-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 1 +; IS________NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* [[CALL_H2S]], i8 0, i64 4, i1 false) ; IS________NPM-NEXT: br i1 [[C]], label [[IF_END:%.*]], label [[IF_THEN:%.*]] ; IS________NPM: if.then: ; IS________NPM-NEXT: br label [[IF_END]] ; IS________NPM: if.end: -; IS________NPM-NEXT: [[TMP2:%.*]] = bitcast i32* [[TMP1]] to i8* ; IS________NPM-NEXT: ret i32 0 ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@conditional_calloc_zero @@ -3763,7 +3703,7 @@ define dso_local i32* @malloc_like(i32 %s) { ; IS__CGSCC_NPM-SAME: (i32 [[S:%.*]]) { ; IS__CGSCC_NPM-NEXT: entry: ; IS__CGSCC_NPM-NEXT: [[CONV:%.*]] = sext i32 [[S]] to i64 -; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call noalias i8* @malloc(i64 [[CONV]]) #[[ATTR17:[0-9]+]] +; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call noalias i8* @malloc(i64 [[CONV]]) #[[ATTR16:[0-9]+]] ; IS__CGSCC_NPM-NEXT: [[TMP0:%.*]] = bitcast i8* [[CALL]] to i32* ; IS__CGSCC_NPM-NEXT: ret i32* [[TMP0]] ; @@ -3792,7 +3732,7 @@ define dso_local i32 @round_trip_malloc_like(i32 %x) { ; IS__TUNIT_NPM-NEXT: store i32 [[X]], i32* [[CALL]], align 4 ; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[CALL]], align 4 ; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = bitcast i32* [[CALL]] to i8* -; IS__TUNIT_NPM-NEXT: call void @free(i8* noundef [[TMP1]]) #[[ATTR14]] +; IS__TUNIT_NPM-NEXT: call void @free(i8* noundef nonnull [[TMP1]]) #[[ATTR14]] ; IS__TUNIT_NPM-NEXT: ret i32 [[TMP0]] ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@round_trip_malloc_like @@ -3808,11 +3748,11 @@ define dso_local i32 @round_trip_malloc_like(i32 %x) { ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@round_trip_malloc_like ; IS__CGSCC_NPM-SAME: (i32 [[X:%.*]]) { ; IS__CGSCC_NPM-NEXT: entry: -; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call i32* @malloc_like(i32 noundef 4) #[[ATTR17]] +; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call i32* @malloc_like(i32 noundef 4) #[[ATTR16]] ; IS__CGSCC_NPM-NEXT: store i32 [[X]], i32* [[CALL]], align 4 ; IS__CGSCC_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[CALL]], align 4 ; IS__CGSCC_NPM-NEXT: [[TMP1:%.*]] = bitcast i32* [[CALL]] to i8* -; IS__CGSCC_NPM-NEXT: call void @free(i8* noundef [[TMP1]]) #[[ATTR17]] +; IS__CGSCC_NPM-NEXT: call void @free(i8* noundef nonnull [[TMP1]]) #[[ATTR16]] ; IS__CGSCC_NPM-NEXT: ret i32 [[TMP0]] ; entry: @@ -3842,7 +3782,7 @@ define dso_local i32 @round_trip_unknown_alloc(i32 %x) { ; IS__TUNIT_NPM-NEXT: store i32 [[X]], i32* [[CALL]], align 4 ; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[CALL]], align 4 ; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = bitcast i32* [[CALL]] to i8* -; IS__TUNIT_NPM-NEXT: call void @free(i8* noundef [[TMP1]]) #[[ATTR14]] +; IS__TUNIT_NPM-NEXT: call void @free(i8* noundef nonnull [[TMP1]]) #[[ATTR14]] ; IS__TUNIT_NPM-NEXT: ret i32 [[TMP0]] ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@round_trip_unknown_alloc @@ -3858,11 +3798,11 @@ define dso_local i32 @round_trip_unknown_alloc(i32 %x) { ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@round_trip_unknown_alloc ; IS__CGSCC_NPM-SAME: (i32 [[X:%.*]]) { ; IS__CGSCC_NPM-NEXT: entry: -; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call i32* @unknown_alloc(i32 noundef 4) #[[ATTR17]] +; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call i32* @unknown_alloc(i32 noundef 4) #[[ATTR16]] ; IS__CGSCC_NPM-NEXT: store i32 [[X]], i32* [[CALL]], align 4 ; IS__CGSCC_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[CALL]], align 4 ; IS__CGSCC_NPM-NEXT: [[TMP1:%.*]] = bitcast i32* [[CALL]] to i8* -; IS__CGSCC_NPM-NEXT: call void @free(i8* noundef [[TMP1]]) #[[ATTR17]] +; IS__CGSCC_NPM-NEXT: call void @free(i8* noundef nonnull [[TMP1]]) #[[ATTR16]] ; IS__CGSCC_NPM-NEXT: ret i32 [[TMP0]] ; entry: @@ -3904,7 +3844,7 @@ define dso_local i32 @conditional_unknown_alloc(i32 %x) { ; IS__TUNIT_NPM: if.end: ; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[CALL]], align 4 ; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = bitcast i32* [[CALL]] to i8* -; IS__TUNIT_NPM-NEXT: call void @free(i8* [[TMP1]]) #[[ATTR14]] +; IS__TUNIT_NPM-NEXT: call void @free(i8* nonnull [[TMP1]]) #[[ATTR14]] ; IS__TUNIT_NPM-NEXT: ret i32 [[TMP0]] ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@conditional_unknown_alloc @@ -3925,7 +3865,7 @@ define dso_local i32 @conditional_unknown_alloc(i32 %x) { ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@conditional_unknown_alloc ; IS__CGSCC_NPM-SAME: (i32 [[X:%.*]]) { ; IS__CGSCC_NPM-NEXT: entry: -; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call noalias i32* @unknown_alloc(i32 noundef 4) #[[ATTR17]] +; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call noalias i32* @unknown_alloc(i32 noundef 4) #[[ATTR16]] ; IS__CGSCC_NPM-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[X]], 0 ; IS__CGSCC_NPM-NEXT: br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[IF_THEN:%.*]] ; IS__CGSCC_NPM: if.then: @@ -3934,7 +3874,7 @@ define dso_local i32 @conditional_unknown_alloc(i32 %x) { ; IS__CGSCC_NPM: if.end: ; IS__CGSCC_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[CALL]], align 4 ; IS__CGSCC_NPM-NEXT: [[TMP1:%.*]] = bitcast i32* [[CALL]] to i8* -; IS__CGSCC_NPM-NEXT: call void @free(i8* [[TMP1]]) #[[ATTR17]] +; IS__CGSCC_NPM-NEXT: call void @free(i8* nonnull [[TMP1]]) #[[ATTR16]] ; IS__CGSCC_NPM-NEXT: ret i32 [[TMP0]] ; entry: @@ -3963,32 +3903,38 @@ define dso_local void @test_nested_memory(float* %dst, double* %src) { ; IS__TUNIT_OPM-SAME: (float* nocapture nofree writeonly [[DST:%.*]], double* nocapture nofree readonly [[SRC:%.*]]) { ; IS__TUNIT_OPM-NEXT: entry: ; IS__TUNIT_OPM-NEXT: [[LOCAL:%.*]] = alloca [[STRUCT_STY:%.*]], align 8 -; IS__TUNIT_OPM-NEXT: [[TMP0:%.*]] = bitcast %struct.STy* [[LOCAL]] to i8* ; IS__TUNIT_OPM-NEXT: [[INNER:%.*]] = getelementptr inbounds [[STRUCT_STY]], %struct.STy* [[LOCAL]], i64 0, i32 2 +; IS__TUNIT_OPM-NEXT: store %struct.STy* @global, %struct.STy** [[INNER]], align 8 ; IS__TUNIT_OPM-NEXT: [[CALL:%.*]] = call noalias dereferenceable_or_null(24) i8* @malloc(i64 noundef 24) ; IS__TUNIT_OPM-NEXT: [[DST1:%.*]] = bitcast i8* [[CALL]] to float** ; IS__TUNIT_OPM-NEXT: store float* [[DST]], float** [[DST1]], align 8 ; IS__TUNIT_OPM-NEXT: [[SRC2:%.*]] = getelementptr inbounds i8, i8* [[CALL]], i64 8 -; IS__TUNIT_OPM-NEXT: [[TMP1:%.*]] = bitcast i8* [[SRC2]] to double** -; IS__TUNIT_OPM-NEXT: store double* [[SRC]], double** [[TMP1]], align 8 +; IS__TUNIT_OPM-NEXT: [[TMP0:%.*]] = bitcast i8* [[SRC2]] to double** +; IS__TUNIT_OPM-NEXT: store double* [[SRC]], double** [[TMP0]], align 8 ; IS__TUNIT_OPM-NEXT: store i8* [[CALL]], i8** bitcast (%struct.STy** getelementptr inbounds ([[STRUCT_STY]], %struct.STy* @global, i64 0, i32 2) to i8**), align 8 -; IS__TUNIT_OPM-NEXT: call fastcc void @nested_memory_callee() #[[ATTR17:[0-9]+]] +; IS__TUNIT_OPM-NEXT: call fastcc void @nested_memory_callee(%struct.STy* noalias nocapture nofree noundef nonnull readonly align 8 dereferenceable(24) [[LOCAL]]) #[[ATTR17:[0-9]+]] ; IS__TUNIT_OPM-NEXT: ret void ; ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test_nested_memory ; IS__TUNIT_NPM-SAME: (float* nocapture nofree writeonly [[DST:%.*]], double* nocapture nofree readonly [[SRC:%.*]]) { ; IS__TUNIT_NPM-NEXT: entry: -; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = alloca i8, i64 24, align 1 +; IS__TUNIT_NPM-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 24, align 1 ; IS__TUNIT_NPM-NEXT: [[LOCAL:%.*]] = alloca [[STRUCT_STY:%.*]], align 8 -; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = bitcast %struct.STy* [[LOCAL]] to i8* ; IS__TUNIT_NPM-NEXT: [[INNER:%.*]] = getelementptr inbounds [[STRUCT_STY]], %struct.STy* [[LOCAL]], i64 0, i32 2 -; IS__TUNIT_NPM-NEXT: [[DST1:%.*]] = bitcast i8* [[TMP0]] to float** +; IS__TUNIT_NPM-NEXT: store %struct.STy* @global, %struct.STy** [[INNER]], align 8 +; IS__TUNIT_NPM-NEXT: [[DST1:%.*]] = bitcast i8* [[CALL_H2S]] to float** ; IS__TUNIT_NPM-NEXT: store float* [[DST]], float** [[DST1]], align 8 -; IS__TUNIT_NPM-NEXT: [[SRC2:%.*]] = getelementptr inbounds i8, i8* [[TMP0]], i64 8 -; IS__TUNIT_NPM-NEXT: [[TMP2:%.*]] = bitcast i8* [[SRC2]] to double** -; IS__TUNIT_NPM-NEXT: store double* [[SRC]], double** [[TMP2]], align 8 -; IS__TUNIT_NPM-NEXT: store i8* [[TMP0]], i8** bitcast (%struct.STy** getelementptr inbounds ([[STRUCT_STY]], %struct.STy* @global, i64 0, i32 2) to i8**), align 8 -; IS__TUNIT_NPM-NEXT: call fastcc void @nested_memory_callee() #[[ATTR15:[0-9]+]] +; IS__TUNIT_NPM-NEXT: [[SRC2:%.*]] = getelementptr inbounds i8, i8* [[CALL_H2S]], i64 8 +; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = bitcast i8* [[SRC2]] to double** +; IS__TUNIT_NPM-NEXT: store double* [[SRC]], double** [[TMP0]], align 8 +; IS__TUNIT_NPM-NEXT: store i8* [[CALL_H2S]], i8** bitcast (%struct.STy** getelementptr inbounds ([[STRUCT_STY]], %struct.STy* @global, i64 0, i32 2) to i8**), align 8 +; IS__TUNIT_NPM-NEXT: [[LOCAL_CAST:%.*]] = bitcast %struct.STy* [[LOCAL]] to float** +; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = load float*, float** [[LOCAL_CAST]], align 8 +; IS__TUNIT_NPM-NEXT: [[LOCAL_0_1:%.*]] = getelementptr [[STRUCT_STY]], %struct.STy* [[LOCAL]], i64 0, i32 1 +; IS__TUNIT_NPM-NEXT: [[TMP2:%.*]] = load double*, double** [[LOCAL_0_1]], align 8 +; IS__TUNIT_NPM-NEXT: [[LOCAL_0_2:%.*]] = getelementptr [[STRUCT_STY]], %struct.STy* [[LOCAL]], i64 0, i32 2 +; IS__TUNIT_NPM-NEXT: [[TMP3:%.*]] = load %struct.STy*, %struct.STy** [[LOCAL_0_2]], align 8 +; IS__TUNIT_NPM-NEXT: call fastcc void @nested_memory_callee(float* [[TMP1]], double* [[TMP2]], %struct.STy* [[TMP3]]) #[[ATTR15:[0-9]+]] ; IS__TUNIT_NPM-NEXT: ret void ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test_nested_memory @@ -4005,7 +3951,7 @@ define dso_local void @test_nested_memory(float* %dst, double* %src) { ; IS__CGSCC_OPM-NEXT: [[TMP1:%.*]] = bitcast i8* [[SRC2]] to double** ; IS__CGSCC_OPM-NEXT: store double* [[SRC]], double** [[TMP1]], align 8 ; IS__CGSCC_OPM-NEXT: store i8* [[CALL]], i8** bitcast (%struct.STy** getelementptr inbounds ([[STRUCT_STY]], %struct.STy* @global, i64 0, i32 2) to i8**), align 8 -; IS__CGSCC_OPM-NEXT: call fastcc void @nested_memory_callee(%struct.STy* noalias nocapture nofree noundef nonnull readonly align 8 dereferenceable(24) [[LOCAL]]) #[[ATTR17]] +; IS__CGSCC_OPM-NEXT: call fastcc void @nested_memory_callee(%struct.STy* noalias nocapture nofree noundef nonnull readonly align 8 dereferenceable(24) [[LOCAL]]) #[[ATTR19:[0-9]+]] ; IS__CGSCC_OPM-NEXT: ret void ; ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test_nested_memory @@ -4021,7 +3967,7 @@ define dso_local void @test_nested_memory(float* %dst, double* %src) { ; IS__CGSCC_NPM-NEXT: [[TMP1:%.*]] = bitcast i8* [[SRC2]] to double** ; IS__CGSCC_NPM-NEXT: store double* [[SRC]], double** [[TMP1]], align 8 ; IS__CGSCC_NPM-NEXT: store i8* [[CALL]], i8** bitcast (%struct.STy** getelementptr inbounds ([[STRUCT_STY]], %struct.STy* @global, i64 0, i32 2) to i8**), align 8 -; IS__CGSCC_NPM-NEXT: call fastcc void @nested_memory_callee(float* nofree nonnull align 4294967296 undef, double* nofree nonnull align 4294967296 undef, %struct.STy* nofree noundef nonnull align 8 dereferenceable(24) @global) #[[ATTR16]] +; IS__CGSCC_NPM-NEXT: call fastcc void @nested_memory_callee(float* nofree nonnull align 4294967296 undef, double* nofree nonnull align 4294967296 undef, %struct.STy* nofree nonnull align 8 @global) #[[ATTR17:[0-9]+]] ; IS__CGSCC_NPM-NEXT: ret void ; entry: @@ -4043,30 +3989,43 @@ entry: define internal fastcc void @nested_memory_callee(%struct.STy* nocapture readonly %S) nofree norecurse nounwind uwtable { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn uwtable ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@nested_memory_callee -; IS__TUNIT_OPM-SAME: () #[[ATTR10:[0-9]+]] { +; IS__TUNIT_OPM-SAME: (%struct.STy* noalias nocapture nofree noundef nonnull readonly align 8 dereferenceable(24) [[S:%.*]]) #[[ATTR9:[0-9]+]] { ; IS__TUNIT_OPM-NEXT: entry: -; IS__TUNIT_OPM-NEXT: [[TMP0:%.*]] = load %struct.STy*, %struct.STy** getelementptr inbounds ([[STRUCT_STY:%.*]], %struct.STy* @global, i64 0, i32 2), align 8 -; IS__TUNIT_OPM-NEXT: [[SRC:%.*]] = getelementptr inbounds [[STRUCT_STY]], %struct.STy* [[TMP0]], i64 0, i32 1 -; IS__TUNIT_OPM-NEXT: [[TMP1:%.*]] = load double*, double** [[SRC]], align 8 -; IS__TUNIT_OPM-NEXT: [[TMP2:%.*]] = load double, double* [[TMP1]], align 8 -; IS__TUNIT_OPM-NEXT: [[CONV:%.*]] = fptrunc double [[TMP2]] to float -; IS__TUNIT_OPM-NEXT: [[DST:%.*]] = getelementptr inbounds [[STRUCT_STY]], %struct.STy* [[TMP0]], i64 0, i32 0 -; IS__TUNIT_OPM-NEXT: [[TMP3:%.*]] = load float*, float** [[DST]], align 8 -; IS__TUNIT_OPM-NEXT: store float [[CONV]], float* [[TMP3]], align 4 +; IS__TUNIT_OPM-NEXT: [[INNER:%.*]] = getelementptr inbounds [[STRUCT_STY:%.*]], %struct.STy* [[S]], i64 0, i32 2 +; IS__TUNIT_OPM-NEXT: [[TMP0:%.*]] = load %struct.STy*, %struct.STy** [[INNER]], align 8 +; IS__TUNIT_OPM-NEXT: [[INNER1:%.*]] = getelementptr inbounds [[STRUCT_STY]], %struct.STy* [[TMP0]], i64 0, i32 2 +; IS__TUNIT_OPM-NEXT: [[TMP1:%.*]] = load %struct.STy*, %struct.STy** [[INNER1]], align 8 +; IS__TUNIT_OPM-NEXT: [[SRC:%.*]] = getelementptr inbounds [[STRUCT_STY]], %struct.STy* [[TMP1]], i64 0, i32 1 +; IS__TUNIT_OPM-NEXT: [[TMP2:%.*]] = load double*, double** [[SRC]], align 8 +; IS__TUNIT_OPM-NEXT: [[TMP3:%.*]] = load double, double* [[TMP2]], align 8 +; IS__TUNIT_OPM-NEXT: [[CONV:%.*]] = fptrunc double [[TMP3]] to float +; IS__TUNIT_OPM-NEXT: [[DST:%.*]] = getelementptr inbounds [[STRUCT_STY]], %struct.STy* [[TMP1]], i64 0, i32 0 +; IS__TUNIT_OPM-NEXT: [[TMP4:%.*]] = load float*, float** [[DST]], align 8 +; IS__TUNIT_OPM-NEXT: store float [[CONV]], float* [[TMP4]], align 4 ; IS__TUNIT_OPM-NEXT: ret void ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn uwtable ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@nested_memory_callee -; IS__TUNIT_NPM-SAME: () #[[ATTR8:[0-9]+]] { +; IS__TUNIT_NPM-SAME: (float* [[TMP0:%.*]], double* [[TMP1:%.*]], %struct.STy* [[TMP2:%.*]]) #[[ATTR8:[0-9]+]] { ; IS__TUNIT_NPM-NEXT: entry: -; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load %struct.STy*, %struct.STy** getelementptr inbounds ([[STRUCT_STY:%.*]], %struct.STy* @global, i64 0, i32 2), align 8 -; IS__TUNIT_NPM-NEXT: [[SRC:%.*]] = getelementptr inbounds [[STRUCT_STY]], %struct.STy* [[TMP0]], i64 0, i32 1 -; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = load double*, double** [[SRC]], align 8 -; IS__TUNIT_NPM-NEXT: [[TMP2:%.*]] = load double, double* [[TMP1]], align 8 -; IS__TUNIT_NPM-NEXT: [[CONV:%.*]] = fptrunc double [[TMP2]] to float -; IS__TUNIT_NPM-NEXT: [[DST:%.*]] = getelementptr inbounds [[STRUCT_STY]], %struct.STy* [[TMP0]], i64 0, i32 0 -; IS__TUNIT_NPM-NEXT: [[TMP3:%.*]] = load float*, float** [[DST]], align 8 -; IS__TUNIT_NPM-NEXT: store float [[CONV]], float* [[TMP3]], align 4 +; IS__TUNIT_NPM-NEXT: [[S_PRIV:%.*]] = alloca [[STRUCT_STY:%.*]], align 8 +; IS__TUNIT_NPM-NEXT: [[S_PRIV_CAST:%.*]] = bitcast %struct.STy* [[S_PRIV]] to float** +; IS__TUNIT_NPM-NEXT: store float* [[TMP0]], float** [[S_PRIV_CAST]], align 8 +; IS__TUNIT_NPM-NEXT: [[S_PRIV_0_1:%.*]] = getelementptr [[STRUCT_STY]], %struct.STy* [[S_PRIV]], i64 0, i32 1 +; IS__TUNIT_NPM-NEXT: store double* [[TMP1]], double** [[S_PRIV_0_1]], align 8 +; IS__TUNIT_NPM-NEXT: [[S_PRIV_0_2:%.*]] = getelementptr [[STRUCT_STY]], %struct.STy* [[S_PRIV]], i64 0, i32 2 +; IS__TUNIT_NPM-NEXT: store %struct.STy* [[TMP2]], %struct.STy** [[S_PRIV_0_2]], align 8 +; IS__TUNIT_NPM-NEXT: [[INNER:%.*]] = getelementptr inbounds [[STRUCT_STY]], %struct.STy* [[S_PRIV]], i64 0, i32 2 +; IS__TUNIT_NPM-NEXT: [[TMP3:%.*]] = load %struct.STy*, %struct.STy** [[INNER]], align 8 +; IS__TUNIT_NPM-NEXT: [[INNER1:%.*]] = getelementptr inbounds [[STRUCT_STY]], %struct.STy* [[TMP3]], i64 0, i32 2 +; IS__TUNIT_NPM-NEXT: [[TMP4:%.*]] = load %struct.STy*, %struct.STy** [[INNER1]], align 8 +; IS__TUNIT_NPM-NEXT: [[SRC:%.*]] = getelementptr inbounds [[STRUCT_STY]], %struct.STy* [[TMP4]], i64 0, i32 1 +; IS__TUNIT_NPM-NEXT: [[TMP5:%.*]] = load double*, double** [[SRC]], align 8 +; IS__TUNIT_NPM-NEXT: [[TMP6:%.*]] = load double, double* [[TMP5]], align 8 +; IS__TUNIT_NPM-NEXT: [[CONV:%.*]] = fptrunc double [[TMP6]] to float +; IS__TUNIT_NPM-NEXT: [[DST:%.*]] = getelementptr inbounds [[STRUCT_STY]], %struct.STy* [[TMP4]], i64 0, i32 0 +; IS__TUNIT_NPM-NEXT: [[TMP7:%.*]] = load float*, float** [[DST]], align 8 +; IS__TUNIT_NPM-NEXT: store float [[CONV]], float* [[TMP7]], align 4 ; IS__TUNIT_NPM-NEXT: ret void ; ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn uwtable @@ -4130,7 +4089,7 @@ entry: define hidden void @no_propagation_of_unknown_index_access(i32* %in, i32* %out, i32 %idx) #0 { ; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@no_propagation_of_unknown_index_access -; IS__TUNIT_OPM-SAME: (i32* nocapture nofree readonly [[IN:%.*]], i32* nocapture nofree writeonly [[OUT:%.*]], i32 [[IDX:%.*]]) #[[ATTR11:[0-9]+]] { +; IS__TUNIT_OPM-SAME: (i32* nocapture nofree readonly [[IN:%.*]], i32* nocapture nofree writeonly [[OUT:%.*]], i32 [[IDX:%.*]]) #[[ATTR10:[0-9]+]] { ; IS__TUNIT_OPM-NEXT: entry: ; IS__TUNIT_OPM-NEXT: [[BUF:%.*]] = alloca [128 x i32], align 16 ; IS__TUNIT_OPM-NEXT: [[TMP0:%.*]] = bitcast [128 x i32]* [[BUF]] to i8* @@ -4351,7 +4310,7 @@ for.body7: ; preds = %for.cond4 define internal i1 @alloca_non_unique(i32* %p, i32 %in, i1 %c) { ; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@alloca_non_unique -; IS__TUNIT_OPM-SAME: (i32* nocapture nofree nonnull readonly align 4 [[P:%.*]], i32 [[IN:%.*]], i1 [[C:%.*]]) #[[ATTR12:[0-9]+]] { +; IS__TUNIT_OPM-SAME: (i32* nocapture nofree nonnull readonly align 4 [[P:%.*]], i32 [[IN:%.*]], i1 [[C:%.*]]) #[[ATTR11:[0-9]+]] { ; IS__TUNIT_OPM-NEXT: [[A:%.*]] = alloca i32, align 4 ; IS__TUNIT_OPM-NEXT: store i32 [[IN]], i32* [[A]], align 4 ; IS__TUNIT_OPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] @@ -4384,7 +4343,7 @@ define internal i1 @alloca_non_unique(i32* %p, i32 %in, i1 %c) { ; IS__CGSCC_OPM-NEXT: store i32 [[IN]], i32* [[A]], align 4 ; IS__CGSCC_OPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] ; IS__CGSCC_OPM: t: -; IS__CGSCC_OPM-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], i32 noundef 42, i1 noundef false) #[[ATTR19:[0-9]+]] +; IS__CGSCC_OPM-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], i32 noundef 42, i1 noundef false) #[[ATTR3]] ; IS__CGSCC_OPM-NEXT: ret i1 [[R]] ; IS__CGSCC_OPM: f: ; IS__CGSCC_OPM-NEXT: [[L:%.*]] = load i32, i32* [[P]], align 4 @@ -4421,7 +4380,7 @@ f: define i1 @alloca_non_unique_caller(i32 %in, i1 %c) { ; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@alloca_non_unique_caller -; IS__TUNIT_OPM-SAME: (i32 [[IN:%.*]], i1 [[C:%.*]]) #[[ATTR8]] { +; IS__TUNIT_OPM-SAME: (i32 [[IN:%.*]], i1 [[C:%.*]]) #[[ATTR12:[0-9]+]] { ; IS__TUNIT_OPM-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(i32* undef, i32 [[IN]], i1 [[C]]) #[[ATTR18]] ; IS__TUNIT_OPM-NEXT: ret i1 [[R]] ; @@ -4434,13 +4393,13 @@ define i1 @alloca_non_unique_caller(i32 %in, i1 %c) { ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@alloca_non_unique_caller ; IS__CGSCC_OPM-SAME: (i32 [[IN:%.*]], i1 [[C:%.*]]) #[[ATTR14:[0-9]+]] { -; IS__CGSCC_OPM-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(i32* undef, i32 [[IN]], i1 [[C]]) #[[ATTR17]] +; IS__CGSCC_OPM-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(i32* undef, i32 [[IN]], i1 [[C]]) #[[ATTR19]] ; IS__CGSCC_OPM-NEXT: ret i1 [[R]] ; ; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@alloca_non_unique_caller ; IS__CGSCC_NPM-SAME: (i32 [[IN:%.*]], i1 [[C:%.*]]) #[[ATTR12:[0-9]+]] { -; IS__CGSCC_NPM-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(i32* undef, i32 [[IN]], i1 [[C]]) #[[ATTR16]] +; IS__CGSCC_NPM-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(i32* undef, i32 [[IN]], i1 [[C]]) #[[ATTR17]] ; IS__CGSCC_NPM-NEXT: ret i1 [[R]] ; %r = call i1 @alloca_non_unique(i32* undef, i32 %in, i1 %c) @@ -4490,12 +4449,12 @@ define i1 @alloca_non_unique_caller(i32 %in, i1 %c) { ; IS__TUNIT_OPM: attributes #[[ATTR4]] = { nofree norecurse nosync nounwind readnone willreturn } ; IS__TUNIT_OPM: attributes #[[ATTR5]] = { nofree norecurse nosync nounwind willreturn } ; IS__TUNIT_OPM: attributes #[[ATTR6]] = { nofree norecurse nosync nounwind willreturn writeonly } -; IS__TUNIT_OPM: attributes #[[ATTR7]] = { nofree norecurse nosync nounwind readonly willreturn } -; IS__TUNIT_OPM: attributes #[[ATTR8]] = { nofree norecurse nosync nounwind readnone } -; IS__TUNIT_OPM: attributes #[[ATTR9]] = { nofree norecurse nosync nounwind writeonly } -; IS__TUNIT_OPM: attributes #[[ATTR10]] = { nofree norecurse nosync nounwind willreturn uwtable } -; IS__TUNIT_OPM: attributes #[[ATTR11]] = { argmemonly nofree norecurse nosync nounwind } -; IS__TUNIT_OPM: attributes #[[ATTR12]] = { argmemonly nofree nosync nounwind } +; IS__TUNIT_OPM: attributes #[[ATTR7]] = { nofree norecurse nosync nounwind writeonly } +; IS__TUNIT_OPM: attributes #[[ATTR8]] = { nofree norecurse nosync nounwind readonly willreturn } +; IS__TUNIT_OPM: attributes #[[ATTR9]] = { nofree norecurse nosync nounwind willreturn uwtable } +; IS__TUNIT_OPM: attributes #[[ATTR10]] = { argmemonly nofree norecurse nosync nounwind } +; IS__TUNIT_OPM: attributes #[[ATTR11]] = { argmemonly nofree nosync nounwind } +; IS__TUNIT_OPM: attributes #[[ATTR12]] = { nofree norecurse nosync nounwind readnone } ; IS__TUNIT_OPM: attributes #[[ATTR13]] = { willreturn } ; IS__TUNIT_OPM: attributes #[[ATTR14]] = { nofree nosync nounwind willreturn writeonly } ; IS__TUNIT_OPM: attributes #[[ATTR15]] = { nofree nosync nounwind writeonly } @@ -4524,12 +4483,12 @@ define i1 @alloca_non_unique_caller(i32 %in, i1 %c) { ; IS__CGSCC_OPM: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } ; IS__CGSCC_OPM: attributes #[[ATTR1]] = { argmemonly nofree nosync nounwind willreturn } ; IS__CGSCC_OPM: attributes #[[ATTR2:[0-9]+]] = { argmemonly nocallback nofree nosync nounwind willreturn } -; IS__CGSCC_OPM: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind readnone willreturn } -; IS__CGSCC_OPM: attributes #[[ATTR4]] = { nofree norecurse nosync nounwind willreturn } -; IS__CGSCC_OPM: attributes #[[ATTR5]] = { nofree nosync nounwind willreturn } -; IS__CGSCC_OPM: attributes #[[ATTR6]] = { nofree norecurse nosync nounwind readonly willreturn } -; IS__CGSCC_OPM: attributes #[[ATTR7]] = { nofree norecurse nosync nounwind willreturn writeonly } -; IS__CGSCC_OPM: attributes #[[ATTR8]] = { nofree norecurse nosync nounwind readnone } +; IS__CGSCC_OPM: attributes #[[ATTR3]] = { nofree nosync nounwind } +; IS__CGSCC_OPM: attributes #[[ATTR4]] = { nofree norecurse nosync nounwind readnone willreturn } +; IS__CGSCC_OPM: attributes #[[ATTR5]] = { nofree norecurse nosync nounwind willreturn } +; IS__CGSCC_OPM: attributes #[[ATTR6]] = { nofree nosync nounwind willreturn } +; IS__CGSCC_OPM: attributes #[[ATTR7]] = { nofree norecurse nosync nounwind readonly willreturn } +; IS__CGSCC_OPM: attributes #[[ATTR8]] = { nofree norecurse nosync nounwind willreturn writeonly } ; IS__CGSCC_OPM: attributes #[[ATTR9]] = { nofree norecurse nosync nounwind } ; IS__CGSCC_OPM: attributes #[[ATTR10]] = { nofree norecurse nosync nounwind writeonly } ; IS__CGSCC_OPM: attributes #[[ATTR11]] = { nofree norecurse nosync nounwind willreturn uwtable } @@ -4538,16 +4497,16 @@ define i1 @alloca_non_unique_caller(i32 %in, i1 %c) { ; IS__CGSCC_OPM: attributes #[[ATTR14]] = { nofree nosync nounwind readnone } ; IS__CGSCC_OPM: attributes #[[ATTR15]] = { willreturn } ; IS__CGSCC_OPM: attributes #[[ATTR16]] = { nounwind willreturn writeonly } -; IS__CGSCC_OPM: attributes #[[ATTR17]] = { nounwind } +; IS__CGSCC_OPM: attributes #[[ATTR17]] = { nounwind writeonly } ; IS__CGSCC_OPM: attributes #[[ATTR18]] = { norecurse } -; IS__CGSCC_OPM: attributes #[[ATTR19]] = { nofree nosync nounwind } +; IS__CGSCC_OPM: attributes #[[ATTR19]] = { nounwind } ;. ; IS__CGSCC_NPM: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } ; IS__CGSCC_NPM: attributes #[[ATTR1]] = { argmemonly nofree nosync nounwind willreturn } ; IS__CGSCC_NPM: attributes #[[ATTR2:[0-9]+]] = { argmemonly nocallback nofree nosync nounwind willreturn } -; IS__CGSCC_NPM: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind readnone willreturn } -; IS__CGSCC_NPM: attributes #[[ATTR4]] = { nofree norecurse nosync nounwind willreturn } -; IS__CGSCC_NPM: attributes #[[ATTR5]] = { nofree nosync nounwind willreturn } +; IS__CGSCC_NPM: attributes #[[ATTR3]] = { nofree nosync nounwind willreturn } +; IS__CGSCC_NPM: attributes #[[ATTR4]] = { nofree norecurse nosync nounwind readnone willreturn } +; IS__CGSCC_NPM: attributes #[[ATTR5]] = { nofree norecurse nosync nounwind willreturn } ; IS__CGSCC_NPM: attributes #[[ATTR6]] = { nofree norecurse nosync nounwind readonly willreturn } ; IS__CGSCC_NPM: attributes #[[ATTR7]] = { nofree norecurse nosync nounwind willreturn writeonly } ; IS__CGSCC_NPM: attributes #[[ATTR8]] = { nofree norecurse nosync nounwind writeonly } @@ -4558,40 +4517,73 @@ define i1 @alloca_non_unique_caller(i32 %in, i1 %c) { ; IS__CGSCC_NPM: attributes #[[ATTR13:[0-9]+]] = { argmemonly nofree nounwind willreturn writeonly } ; IS__CGSCC_NPM: attributes #[[ATTR14]] = { willreturn } ; IS__CGSCC_NPM: attributes #[[ATTR15]] = { nounwind willreturn writeonly } -; IS__CGSCC_NPM: attributes #[[ATTR16]] = { nounwind } -; IS__CGSCC_NPM: attributes #[[ATTR17]] = { norecurse } +; IS__CGSCC_NPM: attributes #[[ATTR16]] = { norecurse } +; IS__CGSCC_NPM: attributes #[[ATTR17]] = { nounwind } ; IS__CGSCC_NPM: attributes #[[ATTR18]] = { nofree nosync nounwind } ;. -; CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4} -; CHECK: [[META1:![0-9]+]] = !{i32 7, !"uwtable", i32 1} -; CHECK: [[META2:![0-9]+]] = !{!"clang version 13.0.0"} -; CHECK: [[TBAA3]] = !{!4, !4, i64 0} -; CHECK: [[META4:![0-9]+]] = !{!"int", !5, i64 0} -; CHECK: [[META5:![0-9]+]] = !{!"omnipotent char", !6, i64 0} -; CHECK: [[META6:![0-9]+]] = !{!"Simple C/C++ TBAA"} -; CHECK: [[META7:![0-9]+]] = !{!8, !9, i64 12} -; CHECK: [[META8:![0-9]+]] = !{!"S", !4, i64 0, !4, i64 4, !4, i64 8, !9, i64 12, !9, i64 16, !9, i64 20} -; CHECK: [[META9:![0-9]+]] = !{!"float", !5, i64 0} -; CHECK: [[META10:![0-9]+]] = !{!8, !9, i64 16} -; CHECK: [[META11:![0-9]+]] = !{!8, !9, i64 20} -; CHECK: [[META12:![0-9]+]] = !{!8, !4, i64 0} -; CHECK: [[META13:![0-9]+]] = !{!8, !4, i64 4} -; CHECK: [[META14:![0-9]+]] = !{!8, !4, i64 8} -; CHECK: [[META15:![0-9]+]] = !{!5, !5, i64 0} -; CHECK: [[META16:![0-9]+]] = distinct !{!16, !17} -; CHECK: [[META17:![0-9]+]] = !{!"llvm.loop.mustprogress"} -; CHECK: [[META18:![0-9]+]] = !{!9, !9, i64 0} -; CHECK: [[META19:![0-9]+]] = distinct !{!19, !17} -; CHECK: [[META20:![0-9]+]] = !{!21, !21, i64 0} -; CHECK: [[META21:![0-9]+]] = !{!"long long", !5, i64 0} -; CHECK: [[META22:![0-9]+]] = distinct !{!22, !17} -; CHECK: [[META23:![0-9]+]] = distinct !{!23, !17} -; CHECK: [[META24:![0-9]+]] = distinct !{!24, !17} -; CHECK: [[META25:![0-9]+]] = distinct !{!25, !17} -; CHECK: [[META26:![0-9]+]] = distinct !{!26, !17} -; CHECK: [[META27:![0-9]+]] = distinct !{!27, !17} -; CHECK: [[META28:![0-9]+]] = distinct !{!28, !17} -; CHECK: [[META29:![0-9]+]] = distinct !{!29, !17} -; CHECK: [[META30:![0-9]+]] = distinct !{!30, !17} -; CHECK: [[META31:![0-9]+]] = distinct !{!31, !17} +; IS__TUNIT____: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4} +; IS__TUNIT____: [[META1:![0-9]+]] = !{i32 7, !"uwtable", i32 1} +; IS__TUNIT____: [[META2:![0-9]+]] = !{!"clang version 13.0.0"} +; IS__TUNIT____: [[TBAA3]] = !{!4, !4, i64 0} +; IS__TUNIT____: [[META4:![0-9]+]] = !{!"int", !5, i64 0} +; IS__TUNIT____: [[META5:![0-9]+]] = !{!"omnipotent char", !6, i64 0} +; IS__TUNIT____: [[META6:![0-9]+]] = !{!"Simple C/C++ TBAA"} +; IS__TUNIT____: [[META7:![0-9]+]] = !{!8, !9, i64 12} +; IS__TUNIT____: [[META8:![0-9]+]] = !{!"S", !4, i64 0, !4, i64 4, !4, i64 8, !9, i64 12, !9, i64 16, !9, i64 20} +; IS__TUNIT____: [[META9:![0-9]+]] = !{!"float", !5, i64 0} +; IS__TUNIT____: [[META10:![0-9]+]] = !{!8, !9, i64 16} +; IS__TUNIT____: [[META11:![0-9]+]] = !{!8, !9, i64 20} +; IS__TUNIT____: [[META12:![0-9]+]] = !{!8, !4, i64 0} +; IS__TUNIT____: [[META13:![0-9]+]] = !{!8, !4, i64 4} +; IS__TUNIT____: [[META14:![0-9]+]] = !{!8, !4, i64 8} +; IS__TUNIT____: [[META15:![0-9]+]] = distinct !{!15, !16} +; IS__TUNIT____: [[META16:![0-9]+]] = !{!"llvm.loop.mustprogress"} +; IS__TUNIT____: [[META17:![0-9]+]] = distinct !{!17, !16} +; IS__TUNIT____: [[META18:![0-9]+]] = distinct !{!18, !16} +; IS__TUNIT____: [[META19:![0-9]+]] = !{!5, !5, i64 0} +; IS__TUNIT____: [[META20:![0-9]+]] = distinct !{!20, !16} +; IS__TUNIT____: [[META21:![0-9]+]] = distinct !{!21, !16} +; IS__TUNIT____: [[META22:![0-9]+]] = distinct !{!22, !16} +; IS__TUNIT____: [[META23:![0-9]+]] = distinct !{!23, !16} +; IS__TUNIT____: [[META24:![0-9]+]] = distinct !{!24, !16} +; IS__TUNIT____: [[META25:![0-9]+]] = distinct !{!25, !16} +; IS__TUNIT____: [[META26:![0-9]+]] = !{!9, !9, i64 0} +; IS__TUNIT____: [[META27:![0-9]+]] = distinct !{!27, !16} +; IS__TUNIT____: [[META28:![0-9]+]] = !{!29, !29, i64 0} +; IS__TUNIT____: [[META29:![0-9]+]] = !{!"long long", !5, i64 0} +; IS__TUNIT____: [[META30:![0-9]+]] = distinct !{!30, !16} +; IS__TUNIT____: [[META31:![0-9]+]] = distinct !{!31, !16} +;. +; IS__CGSCC____: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4} +; IS__CGSCC____: [[META1:![0-9]+]] = !{i32 7, !"uwtable", i32 1} +; IS__CGSCC____: [[META2:![0-9]+]] = !{!"clang version 13.0.0"} +; IS__CGSCC____: [[TBAA3]] = !{!4, !4, i64 0} +; IS__CGSCC____: [[META4:![0-9]+]] = !{!"int", !5, i64 0} +; IS__CGSCC____: [[META5:![0-9]+]] = !{!"omnipotent char", !6, i64 0} +; IS__CGSCC____: [[META6:![0-9]+]] = !{!"Simple C/C++ TBAA"} +; IS__CGSCC____: [[META7:![0-9]+]] = !{!8, !9, i64 12} +; IS__CGSCC____: [[META8:![0-9]+]] = !{!"S", !4, i64 0, !4, i64 4, !4, i64 8, !9, i64 12, !9, i64 16, !9, i64 20} +; IS__CGSCC____: [[META9:![0-9]+]] = !{!"float", !5, i64 0} +; IS__CGSCC____: [[META10:![0-9]+]] = !{!8, !9, i64 16} +; IS__CGSCC____: [[META11:![0-9]+]] = !{!8, !9, i64 20} +; IS__CGSCC____: [[META12:![0-9]+]] = !{!8, !4, i64 0} +; IS__CGSCC____: [[META13:![0-9]+]] = !{!8, !4, i64 4} +; IS__CGSCC____: [[META14:![0-9]+]] = !{!8, !4, i64 8} +; IS__CGSCC____: [[META15:![0-9]+]] = !{!5, !5, i64 0} +; IS__CGSCC____: [[META16:![0-9]+]] = distinct !{!16, !17} +; IS__CGSCC____: [[META17:![0-9]+]] = !{!"llvm.loop.mustprogress"} +; IS__CGSCC____: [[META18:![0-9]+]] = !{!9, !9, i64 0} +; IS__CGSCC____: [[META19:![0-9]+]] = distinct !{!19, !17} +; IS__CGSCC____: [[META20:![0-9]+]] = !{!21, !21, i64 0} +; IS__CGSCC____: [[META21:![0-9]+]] = !{!"long long", !5, i64 0} +; IS__CGSCC____: [[META22:![0-9]+]] = distinct !{!22, !17} +; IS__CGSCC____: [[META23:![0-9]+]] = distinct !{!23, !17} +; IS__CGSCC____: [[META24:![0-9]+]] = distinct !{!24, !17} +; IS__CGSCC____: [[META25:![0-9]+]] = distinct !{!25, !17} +; IS__CGSCC____: [[META26:![0-9]+]] = distinct !{!26, !17} +; IS__CGSCC____: [[META27:![0-9]+]] = distinct !{!27, !17} +; IS__CGSCC____: [[META28:![0-9]+]] = distinct !{!28, !17} +; IS__CGSCC____: [[META29:![0-9]+]] = distinct !{!29, !17} +; IS__CGSCC____: [[META30:![0-9]+]] = distinct !{!30, !17} +; IS__CGSCC____: [[META31:![0-9]+]] = distinct !{!31, !17} ;. diff --git a/llvm/test/Transforms/Attributor/value-simplify.ll b/llvm/test/Transforms/Attributor/value-simplify.ll index 747030ca9a08..0277c651fd33 100644 --- a/llvm/test/Transforms/Attributor/value-simplify.ll +++ b/llvm/test/Transforms/Attributor/value-simplify.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=13 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=13 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM @@ -511,10 +511,17 @@ define i32* @complicated_args_inalloca(i32* %arg) { ; IS__TUNIT_NPM-NEXT: [[CALL:%.*]] = call nonnull dereferenceable(4) i32* @test_inalloca(i32* noalias nofree writeonly inalloca(i32) "no-capture-maybe-returned" [[ARG]]) #[[ATTR10:[0-9]+]] ; IS__TUNIT_NPM-NEXT: ret i32* [[CALL]] ; -; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@complicated_args_inalloca -; IS__CGSCC____-SAME: (i32* nofree noundef nonnull readnone returned dereferenceable(4) [[ARG:%.*]]) #[[ATTR2:[0-9]+]] { -; IS__CGSCC____-NEXT: ret i32* [[ARG]] +; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_inalloca +; IS__CGSCC_OPM-SAME: (i32* nofree noundef nonnull readnone dereferenceable(4) [[ARG:%.*]]) #[[ATTR2]] { +; IS__CGSCC_OPM-NEXT: [[CALL:%.*]] = call noalias nonnull dereferenceable(4) i32* @test_inalloca(i32* noalias nofree noundef nonnull writeonly inalloca(i32) dereferenceable(4) [[ARG]]) #[[ATTR12]] +; IS__CGSCC_OPM-NEXT: ret i32* [[CALL]] +; +; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_inalloca +; IS__CGSCC_NPM-SAME: (i32* nofree noundef nonnull readnone dereferenceable(4) [[ARG:%.*]]) #[[ATTR2]] { +; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call noalias nonnull dereferenceable(4) i32* @test_inalloca(i32* noalias nofree noundef nonnull writeonly inalloca(i32) dereferenceable(4) [[ARG]]) #[[ATTR11]] +; IS__CGSCC_NPM-NEXT: ret i32* [[CALL]] ; %call = call i32* @test_inalloca(i32* inalloca(i32) %arg) ret i32* %call @@ -605,8 +612,8 @@ define void @complicated_args_sret(%struct.X** %b) { define internal %struct.X* @test_nest(%struct.X* nest %a) { ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_nest -; IS__CGSCC____-SAME: (%struct.X* nest noalias nofree noundef readnone returned align 4294967296 "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] { -; IS__CGSCC____-NEXT: ret %struct.X* [[A]] +; IS__CGSCC____-SAME: (%struct.X* nest noalias nocapture nofree readnone align 4294967296 [[A:%.*]]) #[[ATTR1]] { +; IS__CGSCC____-NEXT: ret %struct.X* null ; ret %struct.X* %a } @@ -616,10 +623,17 @@ define %struct.X* @complicated_args_nest() { ; IS__TUNIT____-SAME: () #[[ATTR1]] { ; IS__TUNIT____-NEXT: ret %struct.X* null ; -; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn -; IS__CGSCC____-LABEL: define {{[^@]+}}@complicated_args_nest -; IS__CGSCC____-SAME: () #[[ATTR2]] { -; IS__CGSCC____-NEXT: ret %struct.X* null +; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn +; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_nest +; IS__CGSCC_OPM-SAME: () #[[ATTR2]] { +; IS__CGSCC_OPM-NEXT: [[CALL:%.*]] = call noalias noundef align 4294967296 %struct.X* @test_nest(%struct.X* noalias nocapture nofree noundef readnone align 4294967296 null) #[[ATTR12]] +; IS__CGSCC_OPM-NEXT: ret %struct.X* [[CALL]] +; +; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn +; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_nest +; IS__CGSCC_NPM-SAME: () #[[ATTR2]] { +; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call noalias noundef align 4294967296 %struct.X* @test_nest(%struct.X* noalias nocapture nofree noundef readnone align 4294967296 null) #[[ATTR11]] +; IS__CGSCC_NPM-NEXT: ret %struct.X* [[CALL]] ; %call = call %struct.X* @test_nest(%struct.X* null) ret %struct.X* %call @@ -1079,7 +1093,7 @@ define i1 @test_merge_with_undef_values_ptr(i1 %c) { define internal i1 @undef_then_null(i1 %c, i32* %i32Aptr, i32* %i32Bptr) { ; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@undef_then_null -; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR2]] { +; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR2:[0-9]+]] { ; IS__CGSCC____-NEXT: br i1 [[C]], label [[A:%.*]], label [[B:%.*]] ; IS__CGSCC____: a: ; IS__CGSCC____-NEXT: ret i1 false @@ -1331,19 +1345,12 @@ define internal i1 @cmp_null_after_cast(i32 %a, i8 %b) { declare i8* @m() define i32 @test(i1 %c) { -; IS__TUNIT____-LABEL: define {{[^@]+}}@test -; IS__TUNIT____-SAME: (i1 [[C:%.*]]) { -; IS__TUNIT____-NEXT: [[R1:%.*]] = call i32 @ctx_test1(i1 [[C]]) -; IS__TUNIT____-NEXT: [[R2:%.*]] = call i32 @ctx_test2(i1 [[C]]), !range [[RNG0:![0-9]+]] -; IS__TUNIT____-NEXT: [[ADD:%.*]] = add i32 [[R1]], [[R2]] -; IS__TUNIT____-NEXT: ret i32 [[ADD]] -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test -; IS__CGSCC____-SAME: (i1 [[C:%.*]]) { -; IS__CGSCC____-NEXT: [[R1:%.*]] = call i32 @ctx_test1(i1 [[C]]) -; IS__CGSCC____-NEXT: [[R2:%.*]] = call i32 @ctx_test2(i1 [[C]]) -; IS__CGSCC____-NEXT: [[ADD:%.*]] = add i32 [[R1]], [[R2]] -; IS__CGSCC____-NEXT: ret i32 [[ADD]] +; CHECK-LABEL: define {{[^@]+}}@test +; CHECK-SAME: (i1 [[C:%.*]]) { +; CHECK-NEXT: [[R1:%.*]] = call i32 @ctx_test1(i1 [[C]]) +; CHECK-NEXT: [[R2:%.*]] = call i32 @ctx_test2(i1 [[C]]) +; CHECK-NEXT: [[ADD:%.*]] = add i32 [[R1]], [[R2]] +; CHECK-NEXT: ret i32 [[ADD]] ; %r1 = call i32 @ctx_test1(i1 %c) %r2 = call i32 @ctx_test2(i1 %c) @@ -1419,7 +1426,7 @@ define i1 @test_liveness(i1 %c) { ; IS__TUNIT_OPM-NEXT: br label [[F]] ; IS__TUNIT_OPM: f: ; IS__TUNIT_OPM-NEXT: [[P:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ false, [[T]] ] -; IS__TUNIT_OPM-NEXT: [[RC1:%.*]] = call noundef i1 @ret(i1 noundef [[P]]) #[[ATTR11]] +; IS__TUNIT_OPM-NEXT: [[RC1:%.*]] = call i1 @ret(i1 noundef [[P]]) #[[ATTR11]] ; IS__TUNIT_OPM-NEXT: ret i1 [[RC1]] ; ; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn @@ -1431,7 +1438,7 @@ define i1 @test_liveness(i1 %c) { ; IS__TUNIT_NPM-NEXT: br label [[F]] ; IS__TUNIT_NPM: f: ; IS__TUNIT_NPM-NEXT: [[P:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ false, [[T]] ] -; IS__TUNIT_NPM-NEXT: [[RC1:%.*]] = call noundef i1 @ret(i1 noundef [[P]]) #[[ATTR10]] +; IS__TUNIT_NPM-NEXT: [[RC1:%.*]] = call i1 @ret(i1 noundef [[P]]) #[[ATTR10]] ; IS__TUNIT_NPM-NEXT: ret i1 [[RC1]] ; ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn @@ -1469,27 +1476,16 @@ f: } define internal i1 @ret(i1 %c) { -; IS________OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS________OPM-LABEL: define {{[^@]+}}@ret -; IS________OPM-SAME: (i1 noundef [[C:%.*]]) #[[ATTR1]] { -; IS________OPM-NEXT: entry: -; IS________OPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] -; IS________OPM: t: -; IS________OPM-NEXT: br label [[F]] -; IS________OPM: f: -; IS________OPM-NEXT: [[P:%.*]] = phi i1 [ [[C]], [[ENTRY:%.*]] ], [ false, [[T]] ] -; IS________OPM-NEXT: ret i1 [[P]] -; -; IS________NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; IS________NPM-LABEL: define {{[^@]+}}@ret -; IS________NPM-SAME: (i1 noundef [[C:%.*]]) #[[ATTR1]] { -; IS________NPM-NEXT: entry: -; IS________NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] -; IS________NPM: t: -; IS________NPM-NEXT: br label [[F]] -; IS________NPM: f: -; IS________NPM-NEXT: [[P:%.*]] = phi i1 [ [[C]], [[ENTRY:%.*]] ], [ false, [[T]] ] -; IS________NPM-NEXT: ret i1 false +; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn +; CHECK-LABEL: define {{[^@]+}}@ret +; CHECK-SAME: (i1 noundef [[C:%.*]]) #[[ATTR1]] { +; CHECK-NEXT: entry: +; CHECK-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] +; CHECK: t: +; CHECK-NEXT: br label [[F]] +; CHECK: f: +; CHECK-NEXT: [[P:%.*]] = phi i1 [ [[C]], [[ENTRY:%.*]] ], [ false, [[T]] ] +; CHECK-NEXT: ret i1 [[P]] ; entry: br i1 %c, label %t, label %f @@ -1641,7 +1637,7 @@ define i32 @test_speculatable_expr() norecurse { ; IS__CGSCC_NPM-NEXT: [[SPEC_RESULT:%.*]] = call i32 @speculatable() ; IS__CGSCC_NPM-NEXT: [[PLUS1:%.*]] = add i32 [[SPEC_RESULT]], 1 ; IS__CGSCC_NPM-NEXT: store i32 [[PLUS1]], i32* [[STACK]], align 4 -; IS__CGSCC_NPM-NEXT: [[RSPEC:%.*]] = call i32 @ret_speculatable_expr(i32 [[PLUS1]]) #[[ATTR15:[0-9]+]] +; IS__CGSCC_NPM-NEXT: [[RSPEC:%.*]] = call i32 @ret_speculatable_expr(i32 [[PLUS1]]) ; IS__CGSCC_NPM-NEXT: ret i32 [[RSPEC]] ; %stack = alloca i32 @@ -1656,9 +1652,8 @@ define internal i32 @ret_speculatable_expr(i32* %mem, i32 %a2) { ; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@ret_speculatable_expr ; IS__TUNIT_OPM-SAME: (i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[MEM:%.*]]) #[[ATTR9:[0-9]+]] { -; IS__TUNIT_OPM-NEXT: [[TMP1:%.*]] = call i32 @speculatable() -; IS__TUNIT_OPM-NEXT: [[TMP2:%.*]] = add i32 [[TMP1]], 1 -; IS__TUNIT_OPM-NEXT: [[MUL:%.*]] = mul i32 [[TMP2]], 13 +; IS__TUNIT_OPM-NEXT: [[L:%.*]] = load i32, i32* [[MEM]], align 4 +; IS__TUNIT_OPM-NEXT: [[MUL:%.*]] = mul i32 [[L]], 13 ; IS__TUNIT_OPM-NEXT: [[ADD:%.*]] = add i32 [[MUL]], 7 ; IS__TUNIT_OPM-NEXT: ret i32 [[ADD]] ; @@ -1667,9 +1662,8 @@ define internal i32 @ret_speculatable_expr(i32* %mem, i32 %a2) { ; IS__TUNIT_NPM-SAME: (i32 [[TMP0:%.*]]) #[[ATTR8:[0-9]+]] { ; IS__TUNIT_NPM-NEXT: [[MEM_PRIV:%.*]] = alloca i32, align 4 ; IS__TUNIT_NPM-NEXT: store i32 [[TMP0]], i32* [[MEM_PRIV]], align 4 -; IS__TUNIT_NPM-NEXT: [[TMP2:%.*]] = call i32 @speculatable() -; IS__TUNIT_NPM-NEXT: [[TMP3:%.*]] = add i32 [[TMP2]], 1 -; IS__TUNIT_NPM-NEXT: [[MUL:%.*]] = mul i32 [[TMP3]], 13 +; IS__TUNIT_NPM-NEXT: [[L:%.*]] = load i32, i32* [[MEM_PRIV]], align 4 +; IS__TUNIT_NPM-NEXT: [[MUL:%.*]] = mul i32 [[L]], 13 ; IS__TUNIT_NPM-NEXT: [[ADD:%.*]] = add i32 [[MUL]], 7 ; IS__TUNIT_NPM-NEXT: ret i32 [[ADD]] ; @@ -1763,7 +1757,4 @@ define internal i32 @ret_speculatable_expr(i32* %mem, i32 %a2) { ; IS__CGSCC_NPM: attributes #[[ATTR12]] = { willreturn } ; IS__CGSCC_NPM: attributes #[[ATTR13]] = { nounwind willreturn writeonly } ; IS__CGSCC_NPM: attributes #[[ATTR14]] = { nounwind willreturn } -; IS__CGSCC_NPM: attributes #[[ATTR15]] = { readonly } -;. -; IS__TUNIT____: [[RNG0]] = !{i32 0, i32 -2147483648} ;. diff --git a/llvm/test/Transforms/Attributor/willreturn.ll b/llvm/test/Transforms/Attributor/willreturn.ll index 00caa5f77151..f01eb34af7e7 100644 --- a/llvm/test/Transforms/Attributor/willreturn.ll +++ b/llvm/test/Transforms/Attributor/willreturn.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM +; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM diff --git a/llvm/test/Transforms/Attributor/wrapper.ll b/llvm/test/Transforms/Attributor/wrapper.ll index 85bf78a69d2e..5a0f68f50753 100644 --- a/llvm/test/Transforms/Attributor/wrapper.ll +++ b/llvm/test/Transforms/Attributor/wrapper.ll @@ -9,7 +9,7 @@ ; ; Check the original function, which is wrapped and becomes anonymous ; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn -; CHECK: define internal noundef i32 @0() +; CHECK: define internal i32 @0() ; CHECK: ret i32 1 define linkonce i32 @inner1() { entry: diff --git a/llvm/test/Transforms/OpenMP/is_spmd_exec_mode_fold.ll b/llvm/test/Transforms/OpenMP/is_spmd_exec_mode_fold.ll index 383cba27d446..6be9acea1780 100644 --- a/llvm/test/Transforms/OpenMP/is_spmd_exec_mode_fold.ll +++ b/llvm/test/Transforms/OpenMP/is_spmd_exec_mode_fold.ll @@ -145,7 +145,8 @@ define internal void @is_generic_helper1() { define internal void @is_generic_helper2() { ; CHECK-LABEL: define {{[^@]+}}@is_generic_helper2() { -; CHECK-NEXT: br label [[T:%.*]] +; CHECK-NEXT: [[C:%.*]] = icmp eq i8 0, 0 +; CHECK-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] ; CHECK: t: ; CHECK-NEXT: call void @foo() ; CHECK-NEXT: ret void diff --git a/llvm/test/Transforms/OpenMP/parallel_deletion.ll b/llvm/test/Transforms/OpenMP/parallel_deletion.ll index 7082cc79dfd0..ec2f3e219d21 100644 --- a/llvm/test/Transforms/OpenMP/parallel_deletion.ll +++ b/llvm/test/Transforms/OpenMP/parallel_deletion.ll @@ -547,7 +547,7 @@ define internal void @.omp_outlined..6(i32* noalias %.global_tid., i32* noalias ; CHECK-NEXT: store i32* [[A1]], i32** [[TMP1]], align 8 ; CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[DOTGLOBAL_TID_]], align 4 ; CHECK-NEXT: [[TMP3:%.*]] = bitcast [1 x i8*]* [[DOTOMP_REDUCTION_RED_LIST]] to i8* -; CHECK-NEXT: [[TMP4:%.*]] = call i32 @__kmpc_reduce_nowait(%struct.ident_t* noundef nonnull @[[GLOB2:[0-9]+]], i32 [[TMP2]], i32 noundef 1, i64 noundef 8, i8* noundef nonnull align 8 [[TMP3]], void (i8*, i8*)* noundef nonnull @.omp.reduction.reduction_func, [8 x i32]* noundef nonnull @.gomp_critical_user_.reduction.var) +; CHECK-NEXT: [[TMP4:%.*]] = call i32 @__kmpc_reduce_nowait(%struct.ident_t* noundef nonnull @[[GLOB2:[0-9]+]], i32 [[TMP2]], i32 noundef 1, i64 noundef 8, i8* noundef nonnull [[TMP3]], void (i8*, i8*)* noundef nonnull @.omp.reduction.reduction_func, [8 x i32]* noundef nonnull @.gomp_critical_user_.reduction.var) ; CHECK-NEXT: switch i32 [[TMP4]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [ ; CHECK-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]] ; CHECK-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]] diff --git a/llvm/test/Transforms/OpenMP/remove_globalization.ll b/llvm/test/Transforms/OpenMP/remove_globalization.ll index fdad618ea5cf..5d538a424168 100644 --- a/llvm/test/Transforms/OpenMP/remove_globalization.ll +++ b/llvm/test/Transforms/OpenMP/remove_globalization.ll @@ -183,7 +183,7 @@ declare void @unknown_no_openmp() "llvm.assume"="omp_no_openmp" ; CHECK: attributes #[[ATTR0]] = { nounwind } ; CHECK: attributes #[[ATTR1]] = { nosync nounwind } ; CHECK: attributes #[[ATTR2]] = { nounwind readnone } -; CHECK: attributes #[[ATTR3]] = { nofree nosync nounwind writeonly } +; CHECK: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind writeonly } ; CHECK: attributes #[[ATTR4:[0-9]+]] = { nosync nounwind allocsize(0) } ; CHECK: attributes #[[ATTR5:[0-9]+]] = { "llvm.assume"="omp_no_openmp" } ; CHECK: attributes #[[ATTR6]] = { nosync nounwind writeonly } @@ -191,7 +191,7 @@ declare void @unknown_no_openmp() "llvm.assume"="omp_no_openmp" ; CHECK-DISABLED: attributes #[[ATTR0]] = { nounwind } ; CHECK-DISABLED: attributes #[[ATTR1]] = { nosync nounwind } ; CHECK-DISABLED: attributes #[[ATTR2]] = { nounwind readnone } -; CHECK-DISABLED: attributes #[[ATTR3]] = { nofree nosync nounwind writeonly } +; CHECK-DISABLED: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind writeonly } ; CHECK-DISABLED: attributes #[[ATTR4:[0-9]+]] = { nosync nounwind allocsize(0) } ; CHECK-DISABLED: attributes #[[ATTR5:[0-9]+]] = { "llvm.assume"="omp_no_openmp" } ; CHECK-DISABLED: attributes #[[ATTR6]] = { nosync nounwind writeonly } diff --git a/llvm/test/Transforms/OpenMP/replace_globalization.ll b/llvm/test/Transforms/OpenMP/replace_globalization.ll index d9fb03b13630..87b186da345a 100644 --- a/llvm/test/Transforms/OpenMP/replace_globalization.ll +++ b/llvm/test/Transforms/OpenMP/replace_globalization.ll @@ -147,9 +147,7 @@ declare void @unknown_no_openmp() "llvm.assume"="omp_no_openmp" ; CHECK-NEXT: [[C:%.*]] = call i32 @__kmpc_target_init(%struct.ident_t* @[[GLOB1]], i8 1, i1 false, i1 true) ; CHECK-NEXT: [[X:%.*]] = call align 4 i8* @__kmpc_alloc_shared(i64 4) #[[ATTR6:[0-9]+]] ; CHECK-NEXT: call void @unknown_no_openmp() -; CHECK-NEXT: [[X_ON_STACK:%.*]] = bitcast i8* [[X]] to i32* -; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[X_ON_STACK]] to i8* -; CHECK-NEXT: call void @use.internalized(i8* nofree [[TMP0]]) #[[ATTR7:[0-9]+]] +; CHECK-NEXT: call void @use.internalized(i8* nofree [[X]]) #[[ATTR7:[0-9]+]] ; CHECK-NEXT: call void @__kmpc_free_shared(i8* [[X]], i64 4) #[[ATTR8:[0-9]+]] ; CHECK-NEXT: call void @__kmpc_target_deinit(%struct.ident_t* @[[GLOB1]], i8 1, i1 true) ; CHECK-NEXT: ret void @@ -162,17 +160,14 @@ declare void @unknown_no_openmp() "llvm.assume"="omp_no_openmp" ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], -1 ; CHECK-NEXT: br i1 [[CMP]], label [[MASTER1:%.*]], label [[EXIT:%.*]] ; CHECK: master1: -; CHECK-NEXT: [[X_ON_STACK:%.*]] = bitcast i8* addrspacecast (i8 addrspace(3)* getelementptr inbounds ([16 x i8], [16 x i8] addrspace(3)* @x_shared, i32 0, i32 0) to i8*) to [4 x i32]* -; CHECK-NEXT: [[A0:%.*]] = bitcast [4 x i32]* [[X_ON_STACK]] to i8* -; CHECK-NEXT: call void @use.internalized(i8* nofree [[A0]]) #[[ATTR7]] +; CHECK-NEXT: call void @use.internalized(i8* nofree addrspacecast (i8 addrspace(3)* getelementptr inbounds ([16 x i8], [16 x i8] addrspace(3)* @x_shared, i32 0, i32 0) to i8*)) #[[ATTR7]] ; CHECK-NEXT: br label [[NEXT:%.*]] ; CHECK: next: ; CHECK-NEXT: call void @unknown_no_openmp() -; CHECK-NEXT: br label [[MASTER2:%.*]] +; CHECK-NEXT: [[B0:%.*]] = icmp eq i32 [[C]], -1 +; CHECK-NEXT: br i1 [[B0]], label [[MASTER2:%.*]], label [[EXIT]] ; CHECK: master2: -; CHECK-NEXT: [[Y_ON_STACK:%.*]] = bitcast i8* addrspacecast (i8 addrspace(3)* getelementptr inbounds ([4 x i8], [4 x i8] addrspace(3)* @y_shared, i32 0, i32 0) to i8*) to [4 x i32]* -; CHECK-NEXT: [[B1:%.*]] = bitcast [4 x i32]* [[Y_ON_STACK]] to i8* -; CHECK-NEXT: call void @use.internalized(i8* nofree [[B1]]) #[[ATTR7]] +; CHECK-NEXT: call void @use.internalized(i8* nofree addrspacecast (i8 addrspace(3)* getelementptr inbounds ([4 x i8], [4 x i8] addrspace(3)* @y_shared, i32 0, i32 0) to i8*)) #[[ATTR7]] ; CHECK-NEXT: br label [[EXIT]] ; CHECK: exit: ; CHECK-NEXT: call void @__kmpc_target_deinit(%struct.ident_t* @[[GLOB1]], i8 1, i1 true) @@ -187,9 +182,7 @@ declare void @unknown_no_openmp() "llvm.assume"="omp_no_openmp" ; CHECK-NEXT: br i1 [[C0]], label [[MASTER3:%.*]], label [[EXIT:%.*]] ; CHECK: master3: ; CHECK-NEXT: [[Z:%.*]] = call align 4 i8* @__kmpc_alloc_shared(i64 24) #[[ATTR6]], !dbg [[DBG10:![0-9]+]] -; CHECK-NEXT: [[Z_ON_STACK:%.*]] = bitcast i8* [[Z]] to [6 x i32]* -; CHECK-NEXT: [[C1:%.*]] = bitcast [6 x i32]* [[Z_ON_STACK]] to i8* -; CHECK-NEXT: call void @use.internalized(i8* nofree [[C1]]) #[[ATTR7]] +; CHECK-NEXT: call void @use.internalized(i8* nofree [[Z]]) #[[ATTR7]] ; CHECK-NEXT: call void @__kmpc_free_shared(i8* [[Z]], i64 24) #[[ATTR8]] ; CHECK-NEXT: br label [[EXIT]] ; CHECK: exit: @@ -197,7 +190,7 @@ declare void @unknown_no_openmp() "llvm.assume"="omp_no_openmp" ; CHECK-NEXT: ret void ; ; -; CHECK: Function Attrs: nofree nounwind writeonly +; CHECK: Function Attrs: nofree norecurse nounwind writeonly ; CHECK-LABEL: define {{[^@]+}}@use.internalized ; CHECK-SAME: (i8* nofree [[X:%.*]]) #[[ATTR1:[0-9]+]] { ; CHECK-NEXT: entry: @@ -220,7 +213,7 @@ declare void @unknown_no_openmp() "llvm.assume"="omp_no_openmp" ; ;. ; CHECK: attributes #[[ATTR0]] = { "kernel" } -; CHECK: attributes #[[ATTR1]] = { nofree nounwind writeonly } +; CHECK: attributes #[[ATTR1]] = { nofree norecurse nounwind writeonly } ; CHECK: attributes #[[ATTR2]] = { nosync nounwind readonly allocsize(0) } ; CHECK: attributes #[[ATTR3:[0-9]+]] = { nosync nounwind } ; CHECK: attributes #[[ATTR4:[0-9]+]] = { nocallback nofree nosync nounwind readnone speculatable willreturn } diff --git a/llvm/test/Transforms/OpenMP/spmdization.ll b/llvm/test/Transforms/OpenMP/spmdization.ll index 9afed082fa38..d6f7c7d9dc12 100644 --- a/llvm/test/Transforms/OpenMP/spmdization.ll +++ b/llvm/test/Transforms/OpenMP/spmdization.ll @@ -1603,7 +1603,7 @@ define internal void @__omp_outlined__7(i32* noalias %.global_tid., i32* noalias ; AMDGPU-NEXT: [[TMP0:%.*]] = load i32, i32* [[X]], align 4, !tbaa [[TBAA18]] ; AMDGPU-NEXT: [[INC:%.*]] = add nsw i32 [[TMP0]], 1 ; AMDGPU-NEXT: store i32 [[INC]], i32* [[X]], align 4, !tbaa [[TBAA18]] -; AMDGPU-NEXT: call void @unknown() #[[ATTR8]] +; AMDGPU-NEXT: call void @unknowni32p(i32* [[X]]) #[[ATTR8]] ; AMDGPU-NEXT: ret void ; ; NVPTX-LABEL: define {{[^@]+}}@__omp_outlined__7 @@ -1612,7 +1612,7 @@ define internal void @__omp_outlined__7(i32* noalias %.global_tid., i32* noalias ; NVPTX-NEXT: [[TMP0:%.*]] = load i32, i32* [[X]], align 4, !tbaa [[TBAA18]] ; NVPTX-NEXT: [[INC:%.*]] = add nsw i32 [[TMP0]], 1 ; NVPTX-NEXT: store i32 [[INC]], i32* [[X]], align 4, !tbaa [[TBAA18]] -; NVPTX-NEXT: call void @unknown() #[[ATTR8]] +; NVPTX-NEXT: call void @unknowni32p(i32* [[X]]) #[[ATTR8]] ; NVPTX-NEXT: ret void ; ; AMDGPU-DISABLED-LABEL: define {{[^@]+}}@__omp_outlined__7 @@ -1621,7 +1621,7 @@ define internal void @__omp_outlined__7(i32* noalias %.global_tid., i32* noalias ; AMDGPU-DISABLED-NEXT: [[TMP0:%.*]] = load i32, i32* [[X]], align 4, !tbaa [[TBAA18]] ; AMDGPU-DISABLED-NEXT: [[INC:%.*]] = add nsw i32 [[TMP0]], 1 ; AMDGPU-DISABLED-NEXT: store i32 [[INC]], i32* [[X]], align 4, !tbaa [[TBAA18]] -; AMDGPU-DISABLED-NEXT: call void @unknown() #[[ATTR8]] +; AMDGPU-DISABLED-NEXT: call void @unknowni32p(i32* [[X]]) #[[ATTR8]] ; AMDGPU-DISABLED-NEXT: ret void ; ; NVPTX-DISABLED-LABEL: define {{[^@]+}}@__omp_outlined__7 @@ -1630,14 +1630,14 @@ define internal void @__omp_outlined__7(i32* noalias %.global_tid., i32* noalias ; NVPTX-DISABLED-NEXT: [[TMP0:%.*]] = load i32, i32* [[X]], align 4, !tbaa [[TBAA18]] ; NVPTX-DISABLED-NEXT: [[INC:%.*]] = add nsw i32 [[TMP0]], 1 ; NVPTX-DISABLED-NEXT: store i32 [[INC]], i32* [[X]], align 4, !tbaa [[TBAA18]] -; NVPTX-DISABLED-NEXT: call void @unknown() #[[ATTR8]] +; NVPTX-DISABLED-NEXT: call void @unknowni32p(i32* [[X]]) #[[ATTR8]] ; NVPTX-DISABLED-NEXT: ret void ; entry: %0 = load i32, i32* %x, align 4, !tbaa !18 %inc = add nsw i32 %0, 1 store i32 %inc, i32* %x, align 4, !tbaa !18 - call void @unknown() #11 + call void @unknowni32p(i32* %x) #11 ret void } @@ -2252,6 +2252,7 @@ declare void @use(i32* nocapture) #5 ; Function Attrs: convergent declare void @unknown() #2 +declare void @unknowni32p(i32*) #2 ; Function Attrs: argmemonly mustprogress nofree nosync nounwind willreturn declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1