From dd0948a1b6ed0264fc0a7793bf690846faf2f97b Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Fri, 18 Dec 2015 03:53:28 +0000 Subject: [PATCH] [RS4GC] Use an value handle to help isolate errors quickly Inspired by the bug reported in 25846. Whatever we end up doing about that one, the value handle change is a generally good one since it will help catch this type of mistake more quickly. Patch by: Manuel Jacob llvm-svn: 255984 --- llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index ffa77bb2fd65..d72133287f56 100644 --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -641,7 +641,7 @@ public: private: Status status; - Value *base; // non null only if status == base + AssertingVH base; // non null only if status == base }; } @@ -1098,10 +1098,10 @@ static Value *findBasePointer(Value *I, DefiningValueMapTy &cache) { NewInsts.erase(BaseI); ReverseMap.erase(BaseI); BaseI->replaceAllUsesWith(Replacement); - BaseI->eraseFromParent(); assert(States.count(BDV)); assert(States[BDV].isConflict() && States[BDV].getBase() == BaseI); States[BDV] = BDVState(BDVState::Conflict, Replacement); + BaseI->eraseFromParent(); }; const DataLayout &DL = cast(def)->getModule()->getDataLayout(); while (!Worklist.empty()) {