mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 06:25:18 +00:00
Factor out some of the code for updating old SCEVUnknown values, and
extend it to handle the case where multiple RAUWs affect a single SCEVUnknown. Add a ScalarEvolution unittest to test for this situation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109705 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -386,6 +386,11 @@ namespace llvm {
|
||||
bool isKnownPredicateWithRanges(ICmpInst::Predicate Pred,
|
||||
const SCEV *LHS, const SCEV *RHS);
|
||||
|
||||
/// forgetSCEVUnknown - V is being deleted or RAUW'd; remove the
|
||||
/// SCEVUnknown for it from the uniquing map, and optionally
|
||||
/// clear its contents to point to a replacement value.
|
||||
void forgetSCEVUnknown(Value *V, Value *NewV);
|
||||
|
||||
public:
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
ScalarEvolution();
|
||||
|
@@ -524,11 +524,26 @@ namespace llvm {
|
||||
friend class ScalarEvolution;
|
||||
friend class ScalarEvolution::SCEVCallbackVH;
|
||||
|
||||
// This should be an AssertingVH, however SCEVUnknowns are allocated in a
|
||||
// BumpPtrAllocator so their destructors are never called.
|
||||
/// V - The Value represented by this SCEVUnknown.
|
||||
/// This should be an AssertingVH, however SCEVUnknowns are allocated in a
|
||||
/// BumpPtrAllocator so their destructors are never called.
|
||||
Value *V;
|
||||
|
||||
/// UpdateList - When values are RAUW'd with new values, and the new
|
||||
/// values already have their own SCEVUnknowns, they can end up with
|
||||
/// muliple SCEVUnknowns. This pointer links them all together so that
|
||||
/// they can all be updated when another RAUW happens.
|
||||
SCEVUnknown *UpdateList;
|
||||
|
||||
/// getUpdateListBack - Return the last SCEVUnknown in te UpdateList.
|
||||
SCEVUnknown *getUpdateListBack() {
|
||||
SCEVUnknown *P = this;
|
||||
while (SCEVUnknown *Q = P->UpdateList) P = Q;
|
||||
return P;
|
||||
}
|
||||
|
||||
SCEVUnknown(const FoldingSetNodeIDRef ID, Value *v) :
|
||||
SCEV(ID, scUnknown), V(v) {}
|
||||
SCEV(ID, scUnknown), V(v), UpdateList(0) {}
|
||||
|
||||
public:
|
||||
Value *getValue() const { return V; }
|
||||
|
Reference in New Issue
Block a user