43 cl::desc(
"Maximum size for the name of non-global values."));
49 assert(Ty &&
"Value defined with a null type: Error!");
54 : VTy(
checkType(ty)), UseList(nullptr), SubclassID(scid),
55 HasValueHandle(0), SubclassOptionalData(0), SubclassData(0),
56 NumUserOperands(0), IsUsedByMD(
false), HasName(
false) {
57 static_assert(ConstantFirstVal == 0,
"!(SubclassID < ConstantFirstVal)");
62 SubclassID == Instruction::CallBr)
64 "invalid CallInst type!");
65 else if (SubclassID != BasicBlockVal &&
66 ( SubclassID > ConstantLastVal))
68 "Cannot create non-first-class values except for constants!");
69 static_assert(
sizeof(
Value) == 2 *
sizeof(
void *) + 2 *
sizeof(
unsigned),
80 #ifndef NDEBUG // Only in -g mode... 87 dbgs() <<
"While deleting: " << *VTy <<
" %" <<
getName() <<
"\n";
88 for (
auto *U :
users())
89 dbgs() <<
"Use still stuck around after Def is destroyed:" << *U <<
"\n";
101 #define HANDLE_VALUE(Name) \ 102 case Value::Name##Val: \ 103 delete static_cast<Name *>(this); \ 105 #define HANDLE_MEMORY_VALUE(Name) \ 106 case Value::Name##Val: \ 107 static_cast<DerivedUser *>(this)->DeleteValue( \ 108 static_cast<DerivedUser *>(this)); \ 110 #define HANDLE_INSTRUCTION(Name) 111 #include "llvm/IR/Value.def" 113 #define HANDLE_INST(N, OPC, CLASS) \ 114 case Value::InstructionVal + Instruction::OPC: \ 115 delete static_cast<CLASS *>(this); \ 117 #define HANDLE_USER_INST(N, OPC, CLASS) 118 #include "llvm/IR/Instruction.def" 125 void Value::destroyValueName() {
149 for (; BI != BE && UI != UE; ++BI, ++UI) {
155 if (
User &&
User->getParent() == BB)
170 ST = PP->getValueSymbolTable();
171 }
else if (
BasicBlock *BB = dyn_cast<BasicBlock>(V)) {
173 ST =
P->getValueSymbolTable();
174 }
else if (
GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
175 if (
Module *
P = GV->getParent())
176 ST = &
P->getValueSymbolTable();
177 }
else if (
Argument *A = dyn_cast<Argument>(V)) {
179 ST =
P->getValueSymbolTable();
181 assert(isa<Constant>(V) &&
"Unknown value type!");
193 "No name entry found!");
202 "HasName bit out of sync!");
224 void Value::setNameImpl(
const Twine &NewName) {
226 if (
getContext().shouldDiscardValueNames() && !isa<GlobalValue>(
this))
236 "Null bytes are not allowed in names");
247 assert(!
getType()->isVoidTy() &&
"Cannot assign a name to void values!");
255 if (NameRef.
empty()) {
287 setNameImpl(NewName);
288 if (
Function *
F = dyn_cast<Function>(
this))
289 F->recalculateIntrinsicID();
327 assert(!Failure &&
"V has a name, so it should have a ST!"); (void)Failure;
349 ST->reinsertValue(
this);
367 if (!Cache.
insert(Expr).second)
399 void Value::doRAUW(
Value *New, ReplaceMetadataUses ReplaceMetaUses) {
400 assert(New &&
"Value::replaceAllUsesWith(<null>) is invalid!");
402 "this->replaceAllUsesWith(expr(this)) is NOT valid!");
404 "replaceAllUses of value with new value of different type!");
416 if (
auto *
C = dyn_cast<Constant>(U.
getUser())) {
417 if (!isa<GlobalValue>(
C)) {
418 C->handleOperandChange(
this, New);
426 if (
BasicBlock *BB = dyn_cast<BasicBlock>(
this))
427 BB->replaceSuccessorsPhiUsesWith(cast<BasicBlock>(New));
431 doRAUW(New, ReplaceMetadataUses::Yes);
435 doRAUW(New, ReplaceMetadataUses::No);
441 assert(New &&
"Value::replaceUsesOutsideBlock(<null>, BB) is invalid!");
443 "this->replaceUsesOutsideBlock(expr(this), BB) is NOT valid!");
445 "replaceUses of value with new value of different type!");
446 assert(BB &&
"Basic block that may contain a use of 'New' must be defined\n");
451 return !
I ||
I->getParent() != BB;
459 PSK_ZeroIndicesAndAliases,
460 PSK_ZeroIndicesSameRepresentation,
461 PSK_ZeroIndicesAndInvariantGroups,
462 PSK_InBoundsConstantIndices,
466 template <Po
interStripKind StripKind>
467 static const Value *stripPointerCastsAndOffsets(
const Value *V) {
477 if (
auto *
GEP = dyn_cast<GEPOperator>(V)) {
479 case PSK_ZeroIndices:
480 case PSK_ZeroIndicesAndAliases:
481 case PSK_ZeroIndicesSameRepresentation:
482 case PSK_ZeroIndicesAndInvariantGroups:
483 if (!
GEP->hasAllZeroIndices())
486 case PSK_InBoundsConstantIndices:
487 if (!
GEP->hasAllConstantIndices())
491 if (!
GEP->isInBounds())
495 V =
GEP->getPointerOperand();
497 V = cast<Operator>(V)->getOperand(0);
498 }
else if (StripKind != PSK_ZeroIndicesSameRepresentation &&
502 V = cast<Operator>(V)->getOperand(0);
503 }
else if (StripKind == PSK_ZeroIndicesAndAliases && isa<GlobalAlias>(V)) {
504 V = cast<GlobalAlias>(V)->getAliasee();
506 if (
const auto *Call = dyn_cast<CallBase>(V)) {
507 if (
const Value *RV = Call->getReturnedArgOperand()) {
514 if (StripKind == PSK_ZeroIndicesAndInvariantGroups &&
515 (Call->getIntrinsicID() == Intrinsic::launder_invariant_group ||
516 Call->getIntrinsicID() == Intrinsic::strip_invariant_group)) {
517 V = Call->getArgOperand(0);
524 }
while (Visited.
insert(V).second);
531 return stripPointerCastsAndOffsets<PSK_ZeroIndices>(
this);
535 return stripPointerCastsAndOffsets<PSK_ZeroIndicesAndAliases>(
this);
539 return stripPointerCastsAndOffsets<PSK_ZeroIndicesSameRepresentation>(
this);
543 return stripPointerCastsAndOffsets<PSK_InBoundsConstantIndices>(
this);
547 return stripPointerCastsAndOffsets<PSK_ZeroIndicesAndInvariantGroups>(
this);
552 bool AllowNonInbounds)
const {
553 if (!
getType()->isPtrOrPtrVectorTy())
558 "The offset bit width does not match the DL specification.");
564 const Value *V =
this;
566 if (
auto *
GEP = dyn_cast<GEPOperator>(V)) {
568 if (!AllowNonInbounds && !
GEP->isInBounds())
578 if (!
GEP->accumulateConstantOffset(DL, GEPOffset))
588 V =
GEP->getPointerOperand();
591 V = cast<Operator>(V)->getOperand(0);
592 }
else if (
auto *GA = dyn_cast<GlobalAlias>(V)) {
593 if (!GA->isInterposable())
594 V = GA->getAliasee();
595 }
else if (
const auto *Call = dyn_cast<CallBase>(V)) {
596 if (
const Value *RV = Call->getReturnedArgOperand())
600 }
while (Visited.insert(V).second);
606 return stripPointerCastsAndOffsets<PSK_InBounds>(
this);
610 bool &CanBeNull)
const {
613 uint64_t DerefBytes = 0;
615 if (
const Argument *A = dyn_cast<Argument>(
this)) {
616 DerefBytes = A->getDereferenceableBytes();
617 if (DerefBytes == 0 && (A->hasByValAttr() || A->hasStructRetAttr())) {
618 Type *PT = cast<PointerType>(A->getType())->getElementType();
622 if (DerefBytes == 0) {
623 DerefBytes = A->getDereferenceableOrNullBytes();
626 }
else if (
const auto *Call = dyn_cast<CallBase>(
this)) {
628 if (DerefBytes == 0) {
633 }
else if (
const LoadInst *LI = dyn_cast<LoadInst>(
this)) {
634 if (
MDNode *MD = LI->getMetadata(LLVMContext::MD_dereferenceable)) {
635 ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
638 if (DerefBytes == 0) {
640 LI->getMetadata(LLVMContext::MD_dereferenceable_or_null)) {
641 ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
646 }
else if (
auto *IP = dyn_cast<IntToPtrInst>(
this)) {
647 if (
MDNode *MD = IP->getMetadata(LLVMContext::MD_dereferenceable)) {
648 ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
651 if (DerefBytes == 0) {
653 IP->getMetadata(LLVMContext::MD_dereferenceable_or_null)) {
654 ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
659 }
else if (
auto *AI = dyn_cast<AllocaInst>(
this)) {
660 if (!AI->isArrayAllocation()) {
664 }
else if (
auto *GV = dyn_cast<GlobalVariable>(
this)) {
665 if (GV->getValueType()->isSized() && !GV->hasExternalWeakLinkage()) {
677 if (
auto *GO = dyn_cast<GlobalObject>(
this)) {
678 if (isa<Function>(GO)) {
682 return FunctionPtrAlign;
688 const MaybeAlign Alignment(GO->getAlignment());
690 if (
auto *GVar = dyn_cast<GlobalVariable>(GO)) {
691 Type *ObjectType = GVar->getValueType();
696 if (GVar->isStrongDefinitionForLinker())
704 }
else if (
const Argument *A = dyn_cast<Argument>(
this)) {
705 const MaybeAlign Alignment(A->getParamAlignment());
706 if (!Alignment && A->hasStructRetAttr()) {
708 Type *EltTy = cast<PointerType>(A->getType())->getElementType();
713 }
else if (
const AllocaInst *AI = dyn_cast<AllocaInst>(
this)) {
714 const MaybeAlign Alignment(AI->getAlignment());
716 Type *AllocatedType = AI->getAllocatedType();
721 }
else if (
const auto *Call = dyn_cast<CallBase>(
this)) {
722 const MaybeAlign Alignment(Call->getRetAlignment());
723 if (!Alignment && Call->getCalledFunction())
725 Call->getCalledFunction()->getAttributes().getRetAlignment());
727 }
else if (
const LoadInst *LI = dyn_cast<LoadInst>(
this)) {
728 if (
MDNode *MD = LI->getMetadata(LLVMContext::MD_align)) {
729 ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
739 if (PN && PN->getParent() == CurBB)
747 if (!UseList || !UseList->Next)
752 Use *Current = UseList->Next;
753 Head->Next =
nullptr;
755 Use *Next = Current->Next;
756 Current->Next = Head;
757 Head->setPrev(&Current->Next);
762 Head->setPrev(&UseList);
768 return Arg->hasSwiftErrorAttr();
780 assert(List &&
"Handle list is null?");
787 Next->setPrevPtr(&Next);
788 assert(getValPtr() == Next->getValPtr() &&
"Added to wrong list?");
792 void ValueHandleBase::AddToExistingUseListAfter(
ValueHandleBase *List) {
793 assert(List &&
"Must insert after existing node");
796 setPrevPtr(&List->Next);
799 Next->setPrevPtr(&Next);
802 void ValueHandleBase::AddToUseList() {
803 assert(getValPtr() &&
"Null pointer doesn't have a use list!");
807 if (getValPtr()->HasValueHandle) {
811 assert(Entry &&
"Value doesn't have any handles?");
812 AddToExistingUseList(&Entry);
825 assert(!Entry &&
"Value really did already have handles?");
826 AddToExistingUseList(&Entry);
827 getValPtr()->HasValueHandle =
true;
832 Handles.
size() == 1) {
838 E = Handles.
end();
I !=
E; ++
I) {
839 assert(
I->second &&
I->first ==
I->second->getValPtr() &&
840 "List invariant broken!");
841 I->second->setPrevPtr(&
I->second);
846 assert(getValPtr() && getValPtr()->HasValueHandle &&
847 "Pointer doesn't have a use list!");
851 assert(*PrevPtr ==
this &&
"List invariant broken");
855 assert(Next->getPrevPtr() == &Next &&
"List invariant broken");
856 Next->setPrevPtr(PrevPtr);
866 Handles.
erase(getValPtr());
867 getValPtr()->HasValueHandle =
false;
872 assert(V->HasValueHandle &&
"Should only be called if ValueHandles present");
878 assert(Entry &&
"Value bit set but no entries exist");
890 Iterator.RemoveFromUseList();
891 Iterator.AddToExistingUseListAfter(Entry);
892 assert(Entry->Next == &Iterator &&
"Loop invariant broken.");
894 switch (Entry->getKind()) {
901 Entry->operator=(
nullptr);
911 if (V->HasValueHandle) {
912 #ifndef NDEBUG // Only in +Asserts mode... 925 assert(Old->HasValueHandle &&
"Should only be called if ValueHandles present");
926 assert(Old != New &&
"Changing value into itself!");
928 "replaceAllUses of value with new value of different type!");
935 assert(Entry &&
"Value bit set but no entries exist");
942 Iterator.RemoveFromUseList();
943 Iterator.AddToExistingUseListAfter(Entry);
944 assert(Entry->Next == &Iterator &&
"Loop invariant broken.");
946 switch (Entry->getKind()) {
953 Entry->operator=(New);
957 static_cast<CallbackVH*
>(Entry)->allUsesReplacedWith(New);
965 if (Old->HasValueHandle)
966 for (Entry = pImpl->ValueHandles[Old]; Entry; Entry = Entry->Next)
967 switch (Entry->getKind()) {
969 dbgs() <<
"After RAUW from " << *Old->
getType() <<
" %" 973 "A weak tracking value handle still pointed to the old value!\n");
981 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.