42 cl::desc(
"Maximum size for the name of non-global values."));
48 assert(Ty &&
"Value defined with a null type: Error!");
53 : VTy(
checkType(ty)), UseList(nullptr), SubclassID(scid),
54 HasValueHandle(0), SubclassOptionalData(0), SubclassData(0),
55 NumUserOperands(0), IsUsedByMD(
false), HasName(
false) {
56 static_assert(ConstantFirstVal == 0,
"!(SubclassID < ConstantFirstVal)");
61 SubclassID == Instruction::CallBr)
63 "invalid CallInst type!");
64 else if (SubclassID != BasicBlockVal &&
65 ( SubclassID > ConstantLastVal))
67 "Cannot create non-first-class values except for constants!");
68 static_assert(
sizeof(
Value) == 2 *
sizeof(
void *) + 2 *
sizeof(
unsigned),
79 #ifndef NDEBUG // Only in -g mode... 86 dbgs() <<
"While deleting: " << *VTy <<
" %" <<
getName() <<
"\n";
87 for (
auto *U :
users())
88 dbgs() <<
"Use still stuck around after Def is destroyed:" << *U <<
"\n";
100 #define HANDLE_VALUE(Name) \ 101 case Value::Name##Val: \ 102 delete static_cast<Name *>(this); \ 104 #define HANDLE_MEMORY_VALUE(Name) \ 105 case Value::Name##Val: \ 106 static_cast<DerivedUser *>(this)->DeleteValue( \ 107 static_cast<DerivedUser *>(this)); \ 109 #define HANDLE_INSTRUCTION(Name) 110 #include "llvm/IR/Value.def" 112 #define HANDLE_INST(N, OPC, CLASS) \ 113 case Value::InstructionVal + Instruction::OPC: \ 114 delete static_cast<CLASS *>(this); \ 116 #define HANDLE_USER_INST(N, OPC, CLASS) 117 #include "llvm/IR/Instruction.def" 124 void Value::destroyValueName() {
148 for (; BI != BE && UI != UE; ++BI, ++UI) {
154 if (
User &&
User->getParent() == BB)
169 ST = PP->getValueSymbolTable();
170 }
else if (
BasicBlock *BB = dyn_cast<BasicBlock>(V)) {
172 ST =
P->getValueSymbolTable();
173 }
else if (
GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
174 if (
Module *
P = GV->getParent())
175 ST = &
P->getValueSymbolTable();
176 }
else if (
Argument *A = dyn_cast<Argument>(V)) {
178 ST =
P->getValueSymbolTable();
180 assert(isa<Constant>(V) &&
"Unknown value type!");
192 "No name entry found!");
201 "HasName bit out of sync!");
223 void Value::setNameImpl(
const Twine &NewName) {
225 if (
getContext().shouldDiscardValueNames() && !isa<GlobalValue>(
this))
235 "Null bytes are not allowed in names");
246 assert(!
getType()->isVoidTy() &&
"Cannot assign a name to void values!");
254 if (NameRef.
empty()) {
286 setNameImpl(NewName);
287 if (
Function *
F = dyn_cast<Function>(
this))
288 F->recalculateIntrinsicID();
326 assert(!Failure &&
"V has a name, so it should have a ST!"); (void)Failure;
348 ST->reinsertValue(
this);
366 if (!Cache.
insert(Expr).second)
398 void Value::doRAUW(
Value *New, ReplaceMetadataUses ReplaceMetaUses) {
399 assert(New &&
"Value::replaceAllUsesWith(<null>) is invalid!");
401 "this->replaceAllUsesWith(expr(this)) is NOT valid!");
403 "replaceAllUses of value with new value of different type!");
415 if (
auto *
C = dyn_cast<Constant>(U.
getUser())) {
416 if (!isa<GlobalValue>(
C)) {
417 C->handleOperandChange(
this, New);
425 if (
BasicBlock *BB = dyn_cast<BasicBlock>(
this))
426 BB->replaceSuccessorsPhiUsesWith(cast<BasicBlock>(New));
430 doRAUW(New, ReplaceMetadataUses::Yes);
434 doRAUW(New, ReplaceMetadataUses::No);
440 assert(New &&
"Value::replaceUsesOutsideBlock(<null>, BB) is invalid!");
442 "this->replaceUsesOutsideBlock(expr(this), BB) is NOT valid!");
444 "replaceUses of value with new value of different type!");
445 assert(BB &&
"Basic block that may contain a use of 'New' must be defined\n");
450 return !
I ||
I->getParent() != BB;
458 PSK_ZeroIndicesAndAliases,
459 PSK_ZeroIndicesSameRepresentation,
460 PSK_ZeroIndicesAndInvariantGroups,
461 PSK_InBoundsConstantIndices,
465 template <Po
interStripKind StripKind>
466 static const Value *stripPointerCastsAndOffsets(
const Value *V) {
476 if (
auto *
GEP = dyn_cast<GEPOperator>(V)) {
478 case PSK_ZeroIndices:
479 case PSK_ZeroIndicesAndAliases:
480 case PSK_ZeroIndicesSameRepresentation:
481 case PSK_ZeroIndicesAndInvariantGroups:
482 if (!
GEP->hasAllZeroIndices())
485 case PSK_InBoundsConstantIndices:
486 if (!
GEP->hasAllConstantIndices())
490 if (!
GEP->isInBounds())
494 V =
GEP->getPointerOperand();
496 V = cast<Operator>(V)->getOperand(0);
497 }
else if (StripKind != PSK_ZeroIndicesSameRepresentation &&
501 V = cast<Operator>(V)->getOperand(0);
502 }
else if (StripKind == PSK_ZeroIndicesAndAliases && isa<GlobalAlias>(V)) {
503 V = cast<GlobalAlias>(V)->getAliasee();
505 if (
const auto *Call = dyn_cast<CallBase>(V)) {
506 if (
const Value *RV = Call->getReturnedArgOperand()) {
513 if (StripKind == PSK_ZeroIndicesAndInvariantGroups &&
514 (Call->getIntrinsicID() == Intrinsic::launder_invariant_group ||
515 Call->getIntrinsicID() == Intrinsic::strip_invariant_group)) {
516 V = Call->getArgOperand(0);
523 }
while (Visited.
insert(V).second);
530 return stripPointerCastsAndOffsets<PSK_ZeroIndices>(
this);
534 return stripPointerCastsAndOffsets<PSK_ZeroIndicesAndAliases>(
this);
538 return stripPointerCastsAndOffsets<PSK_ZeroIndicesSameRepresentation>(
this);
542 return stripPointerCastsAndOffsets<PSK_InBoundsConstantIndices>(
this);
546 return stripPointerCastsAndOffsets<PSK_ZeroIndicesAndInvariantGroups>(
this);
551 bool AllowNonInbounds)
const {
552 if (!
getType()->isPtrOrPtrVectorTy())
557 "The offset bit width does not match the DL specification.");
563 const Value *V =
this;
565 if (
auto *
GEP = dyn_cast<GEPOperator>(V)) {
567 if (!AllowNonInbounds && !
GEP->isInBounds())
577 if (!
GEP->accumulateConstantOffset(DL, GEPOffset))
587 V =
GEP->getPointerOperand();
590 V = cast<Operator>(V)->getOperand(0);
591 }
else if (
auto *GA = dyn_cast<GlobalAlias>(V)) {
592 if (!GA->isInterposable())
593 V = GA->getAliasee();
594 }
else if (
const auto *Call = dyn_cast<CallBase>(V)) {
595 if (
const Value *RV = Call->getReturnedArgOperand())
599 }
while (Visited.insert(V).second);
605 return stripPointerCastsAndOffsets<PSK_InBounds>(
this);
609 bool &CanBeNull)
const {
612 uint64_t DerefBytes = 0;
614 if (
const Argument *A = dyn_cast<Argument>(
this)) {
615 DerefBytes = A->getDereferenceableBytes();
616 if (DerefBytes == 0 && (A->hasByValAttr() || A->hasStructRetAttr())) {
617 Type *PT = cast<PointerType>(A->getType())->getElementType();
621 if (DerefBytes == 0) {
622 DerefBytes = A->getDereferenceableOrNullBytes();
625 }
else if (
const auto *Call = dyn_cast<CallBase>(
this)) {
627 if (DerefBytes == 0) {
632 }
else if (
const LoadInst *LI = dyn_cast<LoadInst>(
this)) {
633 if (
MDNode *MD = LI->getMetadata(LLVMContext::MD_dereferenceable)) {
634 ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
637 if (DerefBytes == 0) {
639 LI->getMetadata(LLVMContext::MD_dereferenceable_or_null)) {
640 ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
645 }
else if (
auto *IP = dyn_cast<IntToPtrInst>(
this)) {
646 if (
MDNode *MD = IP->getMetadata(LLVMContext::MD_dereferenceable)) {
647 ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
650 if (DerefBytes == 0) {
652 IP->getMetadata(LLVMContext::MD_dereferenceable_or_null)) {
653 ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
658 }
else if (
auto *AI = dyn_cast<AllocaInst>(
this)) {
659 if (!AI->isArrayAllocation()) {
663 }
else if (
auto *GV = dyn_cast<GlobalVariable>(
this)) {
664 if (GV->getValueType()->isSized() && !GV->hasExternalWeakLinkage()) {
676 if (
auto *GO = dyn_cast<GlobalObject>(
this)) {
677 if (isa<Function>(GO)) {
681 return FunctionPtrAlign;
687 const MaybeAlign Alignment(GO->getAlignment());
689 if (
auto *GVar = dyn_cast<GlobalVariable>(GO)) {
690 Type *ObjectType = GVar->getValueType();
695 if (GVar->isStrongDefinitionForLinker())
703 }
else if (
const Argument *A = dyn_cast<Argument>(
this)) {
704 const MaybeAlign Alignment(A->getParamAlignment());
705 if (!Alignment && A->hasStructRetAttr()) {
707 Type *EltTy = cast<PointerType>(A->getType())->getElementType();
712 }
else if (
const AllocaInst *AI = dyn_cast<AllocaInst>(
this)) {
713 const MaybeAlign Alignment(AI->getAlignment());
715 Type *AllocatedType = AI->getAllocatedType();
720 }
else if (
const auto *Call = dyn_cast<CallBase>(
this)) {
721 const MaybeAlign Alignment(Call->getRetAlignment());
722 if (!Alignment && Call->getCalledFunction())
724 Call->getCalledFunction()->getAttributes().getRetAlignment());
726 }
else if (
const LoadInst *LI = dyn_cast<LoadInst>(
this)) {
727 if (
MDNode *MD = LI->getMetadata(LLVMContext::MD_align)) {
728 ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
738 if (PN && PN->getParent() == CurBB)
746 if (!UseList || !UseList->Next)
751 Use *Current = UseList->Next;
752 Head->Next =
nullptr;
754 Use *Next = Current->Next;
755 Current->Next = Head;
756 Head->setPrev(&Current->Next);
761 Head->setPrev(&UseList);
767 return Arg->hasSwiftErrorAttr();
779 assert(List &&
"Handle list is null?");
786 Next->setPrevPtr(&Next);
787 assert(getValPtr() == Next->getValPtr() &&
"Added to wrong list?");
791 void ValueHandleBase::AddToExistingUseListAfter(
ValueHandleBase *List) {
792 assert(List &&
"Must insert after existing node");
795 setPrevPtr(&List->Next);
798 Next->setPrevPtr(&Next);
801 void ValueHandleBase::AddToUseList() {
802 assert(getValPtr() &&
"Null pointer doesn't have a use list!");
806 if (getValPtr()->HasValueHandle) {
810 assert(Entry &&
"Value doesn't have any handles?");
811 AddToExistingUseList(&Entry);
824 assert(!Entry &&
"Value really did already have handles?");
825 AddToExistingUseList(&Entry);
826 getValPtr()->HasValueHandle =
true;
831 Handles.
size() == 1) {
837 E = Handles.
end();
I !=
E; ++
I) {
838 assert(
I->second &&
I->first ==
I->second->getValPtr() &&
839 "List invariant broken!");
840 I->second->setPrevPtr(&
I->second);
845 assert(getValPtr() && getValPtr()->HasValueHandle &&
846 "Pointer doesn't have a use list!");
850 assert(*PrevPtr ==
this &&
"List invariant broken");
854 assert(Next->getPrevPtr() == &Next &&
"List invariant broken");
855 Next->setPrevPtr(PrevPtr);
865 Handles.
erase(getValPtr());
866 getValPtr()->HasValueHandle =
false;
871 assert(V->HasValueHandle &&
"Should only be called if ValueHandles present");
877 assert(Entry &&
"Value bit set but no entries exist");
889 Iterator.RemoveFromUseList();
890 Iterator.AddToExistingUseListAfter(Entry);
891 assert(Entry->Next == &Iterator &&
"Loop invariant broken.");
893 switch (Entry->getKind()) {
900 Entry->operator=(
nullptr);
910 if (V->HasValueHandle) {
911 #ifndef NDEBUG // Only in +Asserts mode... 924 assert(Old->HasValueHandle &&
"Should only be called if ValueHandles present");
925 assert(Old != New &&
"Changing value into itself!");
927 "replaceAllUses of value with new value of different type!");
934 assert(Entry &&
"Value bit set but no entries exist");
941 Iterator.RemoveFromUseList();
942 Iterator.AddToExistingUseListAfter(Entry);
943 assert(Entry->Next == &Iterator &&
"Loop invariant broken.");
945 switch (Entry->getKind()) {
952 Entry->operator=(New);
956 static_cast<CallbackVH*
>(Entry)->allUsesReplacedWith(New);
964 if (Old->HasValueHandle)
965 for (Entry = pImpl->ValueHandles[Old]; Entry; Entry = Entry->Next)
966 switch (Entry->getKind()) {
968 dbgs() <<
"After RAUW from " << *Old->
getType() <<
" %" 972 "A weak tracking value handle still pointed to the old value!\n");
980 void CallbackVH::anchor() {}
This is the common base class of value handles.
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
This class provides a symbol table of name/value pairs.
static void ValueIsDeleted(Value *V)
This class represents an incoming formal argument to a Function.
unsigned getValueID() const
Return an ID for the concrete type of this object.
const Value * stripInBoundsOffsets() const
Strip off pointer casts and inbounds GEPs.
This class represents lattice values for constants.
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
A Module instance is used to store all the information related to an LLVM module. ...
bool isSized(SmallPtrSetImpl< Type *> *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
const Value * stripPointerCastsAndAliases() const
Strip off pointer casts, all-zero GEPs, address space casts, and aliases.
bool isTriviallyEmpty() const
Check if this twine is trivially empty; a false return value does not necessarily mean the twine is e...
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
The function pointer alignment is a multiple of the function alignment.
bool isSwiftError() const
Return true if this alloca is used as a swifterror argument to a call.
LLVMContext & getContext() const
All values hold a context through their type.
void deleteValue()
Delete a pointer to a generic Value.
const void * getPointerIntoBucketsArray() const
getPointerIntoBucketsArray() - Return an opaque pointer into the buckets array.
An instruction for reading from memory.
const Value * DoPHITranslation(const BasicBlock *CurBB, const BasicBlock *PredBB) const
Translate PHI node to its predecessor from the given basic block.
unsigned getBitWidth() const
Return the number of bits in the APInt.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
iterator begin()
Instruction iterator methods.
FunctionPtrAlignType getFunctionPtrAlignType() const
Return the type of function pointer alignment.
static Type * checkType(Type *Ty)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
A Use represents the edge between a Value definition and its users.
void setName(const Twine &Name)
Change the name of the value.
void assertModuleIsMaterializedImpl() const
LLVM_NODISCARD StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
DenseMap< const Value *, ValueName * > ValueNames
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
static StringMapEntry * Create(StringRef Key, AllocatorTy &Allocator, InitTy &&... InitVals)
Create a StringMapEntry for the specified key construct the value using InitiVals.
void Destroy(AllocatorTy &Allocator)
Destroy - Destroy this StringMapEntry, releasing memory back to the specified allocator.
User * getUser() const LLVM_READONLY
Returns the User that contains this Use.
A constant value that is initialized with an expression using other constant values.
Type * getType() const
All values are typed, get the type of this value.
bool isFirstClassType() const
Return true if the type is "first class", meaning it is a valid type for a Value. ...
TypeSize getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
bool isSwiftError() const
Return true if this value is a swifterror value.
APInt sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
LLVM_NODISCARD size_t size() const
size - Get the string size.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
static void ValueIsRAUWd(Value *Old, Value *New)
void setValue(const ValueTy &V)
void takeName(Value *V)
Transfer the name from V to this value.
void replaceUsesWithIf(Value *New, llvm::function_ref< bool(Use &U)> ShouldReplace)
Go through the uses list for this definition and make each use point to "V" if the callback ShouldRep...
bool isVoidTy() const
Return true if this is 'void'.
initializer< Ty > init(const Ty &Val)
bool erase(const KeyT &Val)
void RemoveFromUseList()
Remove this ValueHandle from its current use list.
bool hasNUsesOrMore(unsigned N) const
Return true if this value has N users or more.
bool hasNUses(unsigned N) const
Return true if this Value has exactly N users.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
void replaceNonMetadataUsesWith(Value *V)
Change non-metadata uses of this to point to a new Value.
Value * getIncomingValueForBlock(const BasicBlock *BB) const
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isPointerTy() const
True if this is an instance of PointerType.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
MaybeAlign getPointerAlignment(const DataLayout &DL) const
Returns an alignment of the pointer value.
unsigned getPrefTypeAlignment(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
bool isUsedInBasicBlock(const BasicBlock *BB) const
Check if this value is used in the specified basic block.
ValueHandlesTy ValueHandles
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
unsigned getIndexTypeSizeInBits(Type *Ty) const
Layout size of the index used in GEP calculation.
bool hasNItemsOrMore(IterTy &&Begin, IterTy &&End, unsigned N, typename std::enable_if< !std::is_same< typename std::iterator_traits< typename std::remove_reference< decltype(Begin)>::type >::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr)
Return true if the sequence [Begin, End) has N or more items.
const Value * stripPointerCastsSameRepresentation() const
Strip off pointer casts, all-zero GEPs and address space casts but ensures the representation of the ...
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
Value(Type *Ty, unsigned scid)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVMContextImpl *const pImpl
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
Iterator for intrusive lists based on ilist_node.
static cl::opt< unsigned > NonGlobalValueMaxNameSize("non-global-value-max-name-size", cl::Hidden, cl::init(1024), cl::desc("Maximum size for the name of non-global values."))
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
uint64_t getLimitedValue(uint64_t Limit=~0ULL) const
getLimitedValue - If the value is smaller than the specified limit, return it, otherwise return the l...
This is the shared class of boolean and integer constants.
bool materialized_use_empty() const
Align max(MaybeAlign Lhs, Align Rhs)
This struct is a compact representation of a valid (power of two) or undefined (0) alignment...
Module.h This file contains the declarations for the Module class.
ValueName * getValueName() const
unsigned getABITypeAlignment(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
uint64_t getPointerDereferenceableBytes(const DataLayout &DL, bool &CanBeNull) const
Returns the number of bytes known to be dereferenceable for the pointer value.
bool isPointerIntoBucketsArray(const void *Ptr) const
isPointerIntoBucketsArray - Return true if the specified pointer points somewhere into the DenseMap's...
const Value * stripPointerCastsAndInvariantGroups() const
Strip off pointer casts, all-zero GEPs and invariant group info.
bool isUsedByMetadata() const
Return true if there is metadata referencing this value.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
unsigned getPreferredAlignment(const GlobalVariable *GV) const
Returns the preferred alignment of the specified global.
Class for arbitrary precision integers.
iterator_range< user_iterator > users()
user_iterator_impl< const User > const_user_iterator
const Value * stripAndAccumulateConstantOffsets(const DataLayout &DL, APInt &Offset, bool AllowNonInbounds) const
Accumulate the constant offset this value has compared to a base pointer.
void reverseUseList()
Reverse the use-list.
bool isMaterialized() const
unsigned getNumUses() const
This method computes the number of uses of this Value.
StringRef getName() const
Return a constant reference to the value's name.
LLVM_NODISCARD size_t find_first_of(char C, size_t From=0) const
Find the first character in the string that is C, or npos if not found.
static bool getSymTab(Value *V, ValueSymbolTable *&ST)
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
~Value()
Value's destructor should be virtual by design, but that would require that Value and all of its subc...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getMinSignedBits() const
Get the minimum bit size for this signed APInt.
user_iterator user_begin()
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
unsigned getOpcode() const
Return the opcode for this Instruction or ConstantExpr.
bool hasNItems(IterTy &&Begin, IterTy &&End, unsigned N, typename std::enable_if< !std::is_same< typename std::iterator_traits< typename std::remove_reference< decltype(Begin)>::type >::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr)
Return true if the sequence [Begin, End) has exactly N items.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
MaybeAlign getFunctionPtrAlign() const
Returns the alignment of function pointers, which may or may not be related to the alignment of funct...
void setValueName(ValueName *VN)
Value handle with callbacks on RAUW and destruction.
StringRef - Represent a constant reference to a string, i.e.
void replaceUsesOutsideBlock(Value *V, BasicBlock *BB)
replaceUsesOutsideBlock - Go through the uses list for this definition and make each use point to "V"...
const Value * stripInBoundsConstantOffsets() const
Strip off pointer casts and all-constant inbounds GEPs.
static bool contains(SmallPtrSetImpl< ConstantExpr *> &Cache, ConstantExpr *Expr, Constant *C)
The function pointer alignment is independent of the function alignment.
bool isStructTy() const
True if this is an instance of StructType.
an instruction to allocate memory on the stack
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.