summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Analysis/AssumptionCache.h14
-rw-r--r--llvm/include/llvm/Analysis/CGSCCPassManager.h8
-rw-r--r--llvm/include/llvm/Analysis/CallGraph.h2
-rw-r--r--llvm/include/llvm/Analysis/IVUsers.h2
-rw-r--r--llvm/include/llvm/Analysis/MemoryBuiltins.h2
-rw-r--r--llvm/include/llvm/Analysis/ScalarEvolutionExpander.h2
-rw-r--r--llvm/include/llvm/IR/ValueHandle.h69
-rw-r--r--llvm/include/llvm/Transforms/Scalar/NaryReassociate.h2
-rw-r--r--llvm/include/llvm/Transforms/Utils/Cloning.h4
-rw-r--r--llvm/include/llvm/Transforms/Utils/SimplifyIndVar.h4
-rw-r--r--llvm/include/llvm/Transforms/Utils/ValueMapper.h2
-rw-r--r--llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h6
12 files changed, 42 insertions, 75 deletions
diff --git a/llvm/include/llvm/Analysis/AssumptionCache.h b/llvm/include/llvm/Analysis/AssumptionCache.h
index 04c6fd70e07..f833f417c7d 100644
--- a/llvm/include/llvm/Analysis/AssumptionCache.h
+++ b/llvm/include/llvm/Analysis/AssumptionCache.h
@@ -43,7 +43,7 @@ class AssumptionCache {
/// \brief Vector of weak value handles to calls of the @llvm.assume
/// intrinsic.
- SmallVector<WeakTrackingVH, 4> AssumeHandles;
+ SmallVector<WeakVH, 4> AssumeHandles;
class AffectedValueCallbackVH final : public CallbackVH {
AssumptionCache *AC;
@@ -62,12 +62,12 @@ class AssumptionCache {
/// \brief A map of values about which an assumption might be providing
/// information to the relevant set of assumptions.
using AffectedValuesMap =
- DenseMap<AffectedValueCallbackVH, SmallVector<WeakTrackingVH, 1>,
- AffectedValueCallbackVH::DMI>;
+ DenseMap<AffectedValueCallbackVH, SmallVector<WeakVH, 1>,
+ AffectedValueCallbackVH::DMI>;
AffectedValuesMap AffectedValues;
/// Get the vector of assumptions which affect a value from the cache.
- SmallVector<WeakTrackingVH, 1> &getOrInsertAffectedValues(Value *V);
+ SmallVector<WeakVH, 1> &getOrInsertAffectedValues(Value *V);
/// Copy affected values in the cache for OV to be affected values for NV.
void copyAffectedValuesInCache(Value *OV, Value *NV);
@@ -120,20 +120,20 @@ public:
/// FIXME: We should replace this with pointee_iterator<filter_iterator<...>>
/// when we can write that to filter out the null values. Then caller code
/// will become simpler.
- MutableArrayRef<WeakTrackingVH> assumptions() {
+ MutableArrayRef<WeakVH> assumptions() {
if (!Scanned)
scanFunction();
return AssumeHandles;
}
/// \brief Access the list of assumptions which affect this value.
- MutableArrayRef<WeakTrackingVH> assumptionsFor(const Value *V) {
+ MutableArrayRef<WeakVH> assumptionsFor(const Value *V) {
if (!Scanned)
scanFunction();
auto AVI = AffectedValues.find_as(const_cast<Value *>(V));
if (AVI == AffectedValues.end())
- return MutableArrayRef<WeakTrackingVH>();
+ return MutableArrayRef<WeakVH>();
return AVI->second;
}
diff --git a/llvm/include/llvm/Analysis/CGSCCPassManager.h b/llvm/include/llvm/Analysis/CGSCCPassManager.h
index a15a9e18c81..398bbfb0c41 100644
--- a/llvm/include/llvm/Analysis/CGSCCPassManager.h
+++ b/llvm/include/llvm/Analysis/CGSCCPassManager.h
@@ -646,7 +646,7 @@ public:
LazyCallGraph::SCC *C = &InitialC;
// Collect value handles for all of the indirect call sites.
- SmallVector<WeakTrackingVH, 8> CallHandles;
+ SmallVector<WeakVH, 8> CallHandles;
// Struct to track the counts of direct and indirect calls in each function
// of the SCC.
@@ -658,7 +658,7 @@ public:
// Put value handles on all of the indirect calls and return the number of
// direct calls for each function in the SCC.
auto ScanSCC = [](LazyCallGraph::SCC &C,
- SmallVectorImpl<WeakTrackingVH> &CallHandles) {
+ SmallVectorImpl<WeakVH> &CallHandles) {
assert(CallHandles.empty() && "Must start with a clear set of handles.");
SmallVector<CallCount, 4> CallCounts;
@@ -671,7 +671,7 @@ public:
++Count.Direct;
} else {
++Count.Indirect;
- CallHandles.push_back(WeakTrackingVH(&I));
+ CallHandles.push_back(WeakVH(&I));
}
}
}
@@ -699,7 +699,7 @@ public:
"Cannot have changed the size of the SCC!");
// Check whether any of the handles were devirtualized.
- auto IsDevirtualizedHandle = [&](WeakTrackingVH &CallH) {
+ auto IsDevirtualizedHandle = [&](WeakVH &CallH) {
if (!CallH)
return false;
auto CS = CallSite(CallH);
diff --git a/llvm/include/llvm/Analysis/CallGraph.h b/llvm/include/llvm/Analysis/CallGraph.h
index cc4788d3eda..ea85436ee58 100644
--- a/llvm/include/llvm/Analysis/CallGraph.h
+++ b/llvm/include/llvm/Analysis/CallGraph.h
@@ -172,7 +172,7 @@ class CallGraphNode {
public:
/// \brief A pair of the calling instruction (a call or invoke)
/// and the call graph node being called.
- typedef std::pair<WeakTrackingVH, CallGraphNode *> CallRecord;
+ typedef std::pair<WeakVH, CallGraphNode *> CallRecord;
public:
typedef std::vector<CallRecord> CalledFunctionsVector;
diff --git a/llvm/include/llvm/Analysis/IVUsers.h b/llvm/include/llvm/Analysis/IVUsers.h
index 035b974c5c1..bb572dd5603 100644
--- a/llvm/include/llvm/Analysis/IVUsers.h
+++ b/llvm/include/llvm/Analysis/IVUsers.h
@@ -80,7 +80,7 @@ private:
/// OperandValToReplace - The Value of the operand in the user instruction
/// that this IVStrideUse is representing.
- WeakTrackingVH OperandValToReplace;
+ WeakVH OperandValToReplace;
/// PostIncLoops - The set of loops for which Expr has been adjusted to
/// use post-inc mode. This corresponds with SCEVExpander's post-inc concept.
diff --git a/llvm/include/llvm/Analysis/MemoryBuiltins.h b/llvm/include/llvm/Analysis/MemoryBuiltins.h
index 60dafccd84b..743faf2b67d 100644
--- a/llvm/include/llvm/Analysis/MemoryBuiltins.h
+++ b/llvm/include/llvm/Analysis/MemoryBuiltins.h
@@ -235,7 +235,7 @@ class ObjectSizeOffsetEvaluator
: public InstVisitor<ObjectSizeOffsetEvaluator, SizeOffsetEvalType> {
typedef IRBuilder<TargetFolder> BuilderTy;
- typedef std::pair<WeakTrackingVH, WeakTrackingVH> WeakEvalType;
+ typedef std::pair<WeakVH, WeakVH> WeakEvalType;
typedef DenseMap<const Value*, WeakEvalType> CacheMapTy;
typedef SmallPtrSet<const Value*, 8> PtrSetTy;
diff --git a/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h b/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h
index 7d16f34e54c..517592a3d04 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h
@@ -189,7 +189,7 @@ namespace llvm {
/// replace congruent phis with their most canonical representative. Return
/// the number of phis eliminated.
unsigned replaceCongruentIVs(Loop *L, const DominatorTree *DT,
- SmallVectorImpl<WeakTrackingVH> &DeadInsts,
+ SmallVectorImpl<WeakVH> &DeadInsts,
const TargetTransformInfo *TTI = nullptr);
/// Insert code to directly compute the specified SCEV expression into the
diff --git a/llvm/include/llvm/IR/ValueHandle.h b/llvm/include/llvm/IR/ValueHandle.h
index cba06671314..4838bac9e0f 100644
--- a/llvm/include/llvm/IR/ValueHandle.h
+++ b/llvm/include/llvm/IR/ValueHandle.h
@@ -34,7 +34,12 @@ protected:
///
/// This is to avoid having a vtable for the light-weight handle pointers. The
/// fully general Callback version does have a vtable.
- enum HandleBaseKind { Assert, Callback, Tracking, Weak, WeakTracking };
+ enum HandleBaseKind {
+ Assert,
+ Callback,
+ Tracking,
+ Weak
+ };
ValueHandleBase(const ValueHandleBase &RHS)
: ValueHandleBase(RHS.PrevPair.getInt(), RHS) {}
@@ -46,7 +51,7 @@ protected:
}
private:
- PointerIntPair<ValueHandleBase**, 3, HandleBaseKind> PrevPair;
+ PointerIntPair<ValueHandleBase**, 2, HandleBaseKind> PrevPair;
ValueHandleBase *Next;
Value* V;
@@ -126,16 +131,19 @@ private:
void AddToUseList();
};
-/// \brief A nullable Value handle that is nullable.
+/// \brief Value handle that is nullable, but tries to track the Value.
///
-/// This is a value handle that points to a value, and nulls itself
-/// out if that value is deleted.
+/// This is a value handle that tries hard to point to a Value, even across
+/// RAUW operations, but will null itself out if the value is destroyed. this
+/// is useful for advisory sorts of information, but should not be used as the
+/// key of a map (since the map would have to rearrange itself when the pointer
+/// changes).
class WeakVH : public ValueHandleBase {
public:
WeakVH() : ValueHandleBase(Weak) {}
WeakVH(Value *P) : ValueHandleBase(Weak, P) {}
WeakVH(const WeakVH &RHS)
- : ValueHandleBase(Weak, RHS) {}
+ : ValueHandleBase(Weak, RHS) {}
WeakVH &operator=(const WeakVH &RHS) = default;
@@ -162,47 +170,6 @@ template <> struct simplify_type<const WeakVH> {
static SimpleType getSimplifiedValue(const WeakVH &WVH) { return WVH; }
};
-/// \brief Value handle that is nullable, but tries to track the Value.
-///
-/// This is a value handle that tries hard to point to a Value, even across
-/// RAUW operations, but will null itself out if the value is destroyed. this
-/// is useful for advisory sorts of information, but should not be used as the
-/// key of a map (since the map would have to rearrange itself when the pointer
-/// changes).
-class WeakTrackingVH : public ValueHandleBase {
-public:
- WeakTrackingVH() : ValueHandleBase(WeakTracking) {}
- WeakTrackingVH(Value *P) : ValueHandleBase(WeakTracking, P) {}
- WeakTrackingVH(const WeakTrackingVH &RHS)
- : ValueHandleBase(WeakTracking, RHS) {}
-
- WeakTrackingVH &operator=(const WeakTrackingVH &RHS) = default;
-
- Value *operator=(Value *RHS) {
- return ValueHandleBase::operator=(RHS);
- }
- Value *operator=(const ValueHandleBase &RHS) {
- return ValueHandleBase::operator=(RHS);
- }
-
- operator Value*() const {
- return getValPtr();
- }
-};
-
-// Specialize simplify_type to allow WeakTrackingVH to participate in
-// dyn_cast, isa, etc.
-template <> struct simplify_type<WeakTrackingVH> {
- typedef Value *SimpleType;
- static SimpleType getSimplifiedValue(WeakTrackingVH &WVH) { return WVH; }
-};
-template <> struct simplify_type<const WeakTrackingVH> {
- typedef Value *SimpleType;
- static SimpleType getSimplifiedValue(const WeakTrackingVH &WVH) {
- return WVH;
- }
-};
-
/// \brief Value handle that asserts if the Value is deleted.
///
/// This is a Value Handle that points to a value and asserts out if the value
@@ -392,8 +359,8 @@ public:
///
/// Called when this->getValPtr() is destroyed, inside ~Value(), so you
/// may call any non-virtual Value method on getValPtr(), but no subclass
- /// methods. If WeakTrackingVH were implemented as a CallbackVH, it would use
- /// this method to call setValPtr(NULL). AssertingVH would use this method to
+ /// methods. If WeakVH were implemented as a CallbackVH, it would use this
+ /// method to call setValPtr(NULL). AssertingVH would use this method to
/// cause an assertion failure.
///
/// All implementations must remove the reference from this object to the
@@ -403,8 +370,8 @@ public:
/// \brief Callback for Value RAUW.
///
/// Called when this->getValPtr()->replaceAllUsesWith(new_value) is called,
- /// _before_ any of the uses have actually been replaced. If WeakTrackingVH
- /// were implemented as a CallbackVH, it would use this method to call
+ /// _before_ any of the uses have actually been replaced. If WeakVH were
+ /// implemented as a CallbackVH, it would use this method to call
/// setValPtr(new_value). AssertingVH would do nothing in this method.
virtual void allUsesReplacedWith(Value *) {}
};
diff --git a/llvm/include/llvm/Transforms/Scalar/NaryReassociate.h b/llvm/include/llvm/Transforms/Scalar/NaryReassociate.h
index f35707eeb3f..a74bb6cc419 100644
--- a/llvm/include/llvm/Transforms/Scalar/NaryReassociate.h
+++ b/llvm/include/llvm/Transforms/Scalar/NaryReassociate.h
@@ -167,7 +167,7 @@ private:
// foo(a + b);
// if (p2)
// bar(a + b);
- DenseMap<const SCEV *, SmallVector<WeakTrackingVH, 2>> SeenExprs;
+ DenseMap<const SCEV *, SmallVector<WeakVH, 2>> SeenExprs;
};
} // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/Cloning.h b/llvm/include/llvm/Transforms/Utils/Cloning.h
index 0a8903a6ed7..337305a0a82 100644
--- a/llvm/include/llvm/Transforms/Utils/Cloning.h
+++ b/llvm/include/llvm/Transforms/Utils/Cloning.h
@@ -74,7 +74,7 @@ struct ClonedCodeInfo {
/// All cloned call sites that have operand bundles attached are appended to
/// this vector. This vector may contain nulls or undefs if some of the
/// originally inserted callsites were DCE'ed after they were cloned.
- std::vector<WeakTrackingVH> OperandBundleCallSites;
+ std::vector<WeakVH> OperandBundleCallSites;
ClonedCodeInfo() = default;
};
@@ -192,7 +192,7 @@ public:
/// InlinedCalls - InlineFunction fills this in with callsites that were
/// inlined from the callee. This is only filled in if CG is non-null.
- SmallVector<WeakTrackingVH, 8> InlinedCalls;
+ SmallVector<WeakVH, 8> InlinedCalls;
/// All of the new call sites inlined into the caller.
///
diff --git a/llvm/include/llvm/Transforms/Utils/SimplifyIndVar.h b/llvm/include/llvm/Transforms/Utils/SimplifyIndVar.h
index 8d50aeb10d6..6cdeeeb60a6 100644
--- a/llvm/include/llvm/Transforms/Utils/SimplifyIndVar.h
+++ b/llvm/include/llvm/Transforms/Utils/SimplifyIndVar.h
@@ -46,13 +46,13 @@ public:
/// simplifyUsersOfIV - Simplify instructions that use this induction variable
/// by using ScalarEvolution to analyze the IV's recurrence.
bool simplifyUsersOfIV(PHINode *CurrIV, ScalarEvolution *SE, DominatorTree *DT,
- LoopInfo *LI, SmallVectorImpl<WeakTrackingVH> &Dead,
+ LoopInfo *LI, SmallVectorImpl<WeakVH> &Dead,
IVVisitor *V = nullptr);
/// SimplifyLoopIVs - Simplify users of induction variables within this
/// loop. This does not actually change or add IVs.
bool simplifyLoopIVs(Loop *L, ScalarEvolution *SE, DominatorTree *DT,
- LoopInfo *LI, SmallVectorImpl<WeakTrackingVH> &Dead);
+ LoopInfo *LI, SmallVectorImpl<WeakVH> &Dead);
} // end namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/ValueMapper.h b/llvm/include/llvm/Transforms/Utils/ValueMapper.h
index e44dc437342..950ad92afcd 100644
--- a/llvm/include/llvm/Transforms/Utils/ValueMapper.h
+++ b/llvm/include/llvm/Transforms/Utils/ValueMapper.h
@@ -23,7 +23,7 @@ namespace llvm {
class Value;
class Instruction;
-typedef ValueMap<const Value *, WeakTrackingVH> ValueToValueMapTy;
+typedef ValueMap<const Value *, WeakVH> ValueToValueMapTy;
/// This is a class that can be implemented by clients to remap types when
/// cloning constants and instructions.
diff --git a/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h b/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
index 10338f7937e..d669a8e5b61 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
@@ -40,8 +40,8 @@ class BoUpSLP;
struct SLPVectorizerPass : public PassInfoMixin<SLPVectorizerPass> {
typedef SmallVector<StoreInst *, 8> StoreList;
typedef MapVector<Value *, StoreList> StoreListMap;
- typedef SmallVector<WeakTrackingVH, 8> WeakTrackingVHList;
- typedef MapVector<Value *, WeakTrackingVHList> WeakTrackingVHListMap;
+ typedef SmallVector<WeakVH, 8> WeakVHList;
+ typedef MapVector<Value *, WeakVHList> WeakVHListMap;
ScalarEvolution *SE = nullptr;
TargetTransformInfo *TTI = nullptr;
@@ -111,7 +111,7 @@ private:
StoreListMap Stores;
/// The getelementptr instructions in a basic block organized by base pointer.
- WeakTrackingVHListMap GEPs;
+ WeakVHListMap GEPs;
};
}
OpenPOWER on IntegriCloud