From f9c0e9e3015f7e724902a20a94e779e8b7666653 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Mon, 22 Dec 2008 22:28:56 +0000 Subject: [PATCH] Check that the instruction isn't in the value numbering scope. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61353 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/GVN.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index aca49ba3c09..6087fd5ae9c 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -1635,18 +1635,34 @@ void GVN::cleanupGlobalSets() { /// verifyRemoved - Verify that the specified instruction does not occur in our /// internal data structures. -void GVN::verifyRemoved(const Instruction *I) const { - VN.verifyRemoved(I); +void GVN::verifyRemoved(const Instruction *Inst) const { + VN.verifyRemoved(Inst); // Walk through the PHI map to make sure the instruction isn't hiding in there // somewhere. for (PhiMapType::iterator - II = phiMap.begin(), IE = phiMap.end(); II != IE; ++II) { - assert(II->first != I && "Inst is still a key in PHI map!"); + I = phiMap.begin(), E = phiMap.end(); I != E; ++I) { + assert(I->first != Inst && "Inst is still a key in PHI map!"); for (SmallPtrSet::iterator - SI = II->second.begin(), SE = II->second.end(); SI != SE; ++SI) { - assert(*SI != I && "Inst is still a value in PHI map!"); + II = I->second.begin(), IE = I->second.end(); II != IE; ++II) { + assert(*II != Inst && "Inst is still a value in PHI map!"); + } + } + + // Walk through the value number scope to make sure the instruction isn't + // ferreted away in it. + for (DenseMap::iterator + I = localAvail.begin(), E = localAvail.end(); I != E; ++I) { + const ValueNumberScope *VNS = I->second; + + while (VNS) { + for (DenseMap::iterator + II = VNS->table.begin(), IE = VNS->table.end(); II != IE; ++II) { + assert(II->second != Inst && "Inst still in value numbering scope!"); + } + + VNS = VNS->parent; } } } -- 2.11.0