+
+ /// getConstantStringInfo - This function computes the length of a
+ /// null-terminated C string pointed to by V. If successful, it returns true
+ /// and returns the string in Str. If unsuccessful, it returns false. This
+ /// does not include the trailing nul character by default. If TrimAtNul is
+ /// set to false, then this returns any trailing nul characters as well as any
+ /// other characters that come after it.
+ bool getConstantStringInfo(const Value *V, StringRef &Str,
+ uint64_t Offset = 0, bool TrimAtNul = true);
+
+ /// GetStringLength - If we can compute the length of the string pointed to by
+ /// the specified pointer, return 'len+1'. If we can't, return 0.
+ uint64_t GetStringLength(Value *V);
+
+ /// GetUnderlyingObject - This method strips off any GEP address adjustments
+ /// and pointer casts from the specified value, returning the original object
+ /// being addressed. Note that the returned value has pointer type if the
+ /// specified value does. If the MaxLookup value is non-zero, it limits the
+ /// number of instructions to be stripped off.
+ Value *GetUnderlyingObject(Value *V, const DataLayout *TD = nullptr,
+ unsigned MaxLookup = 6);
+ static inline const Value *
+ GetUnderlyingObject(const Value *V, const DataLayout *TD = nullptr,
+ unsigned MaxLookup = 6) {
+ return GetUnderlyingObject(const_cast<Value *>(V), TD, MaxLookup);
+ }
+
+ /// GetUnderlyingObjects - This method is similar to GetUnderlyingObject
+ /// except that it can look through phi and select instructions and return
+ /// multiple objects.
+ void GetUnderlyingObjects(Value *V,
+ SmallVectorImpl<Value *> &Objects,
+ const DataLayout *TD = nullptr,
+ unsigned MaxLookup = 6);
+
+ /// onlyUsedByLifetimeMarkers - Return true if the only users of this pointer
+ /// are lifetime markers.
+ bool onlyUsedByLifetimeMarkers(const Value *V);
+
+ /// isSafeToSpeculativelyExecute - Return true if the instruction does not
+ /// have any effects besides calculating the result and does not have
+ /// undefined behavior.
+ ///
+ /// This method never returns true for an instruction that returns true for
+ /// mayHaveSideEffects; however, this method also does some other checks in
+ /// addition. It checks for undefined behavior, like dividing by zero or
+ /// loading from an invalid pointer (but not for undefined results, like a
+ /// shift with a shift amount larger than the width of the result). It checks
+ /// for malloc and alloca because speculatively executing them might cause a
+ /// memory leak. It also returns false for instructions related to control
+ /// flow, specifically terminators and PHI nodes.
+ ///
+ /// This method only looks at the instruction itself and its operands, so if
+ /// this method returns true, it is safe to move the instruction as long as
+ /// the correct dominance relationships for the operands and users hold.
+ /// However, this method can return true for instructions that read memory;
+ /// for such instructions, moving them may change the resulting value.
+ bool isSafeToSpeculativelyExecute(const Value *V,
+ const DataLayout *TD = nullptr);
+
+ /// isKnownNonNull - Return true if this pointer couldn't possibly be null by
+ /// its definition. This returns true for allocas, non-extern-weak globals
+ /// and byval arguments.
+ bool isKnownNonNull(const Value *V, const TargetLibraryInfo *TLI = nullptr);
+