From: Philip Reames Date: Fri, 18 Dec 2015 03:53:28 +0000 (+0000) Subject: [RS4GC] Use an value handle to help isolate errors quickly X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=2027fcbfdaea79a5486db80a4da7407f50f7f4ec;hp=1fef99c857a6ecca56f1665d1518ee875a093484 [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255984 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index ffa77bb2fd6..d72133287f5 100644 --- a/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/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()) {