From: Bill Wendling Date: Mon, 22 Dec 2008 22:14:07 +0000 (+0000) Subject: Add verification that deleted instruction isn't hiding in the PHI map. X-Git-Tag: android-x86-6.0-r1~1047^2~16720 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=3858caeab12a0474fa9d15bf8761ea8ae5211b06;p=android-x86%2Fexternal-llvm.git Add verification that deleted instruction isn't hiding in the PHI map. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61350 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 1d7a107db23..e517b3a5295 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -40,11 +40,11 @@ #include using namespace llvm; -STATISTIC(NumGVNInstr, "Number of instructions deleted"); -STATISTIC(NumGVNLoad, "Number of loads deleted"); -STATISTIC(NumGVNPRE, "Number of instructions PRE'd"); +STATISTIC(NumGVNInstr, "Number of instructions deleted"); +STATISTIC(NumGVNLoad, "Number of loads deleted"); +STATISTIC(NumGVNPRE, "Number of instructions PRE'd"); STATISTIC(NumGVNBlocks, "Number of blocks merged"); -STATISTIC(NumPRELoad, "Number of loads PRE'd"); +STATISTIC(NumPRELoad, "Number of loads PRE'd"); static cl::opt EnablePRE("enable-pre", cl::init(true), cl::Hidden); @@ -1581,6 +1581,7 @@ bool GVN::performPRE(Function& F) { // are not value numbered precisely. if (!success) { delete PREInstr; + DEBUG(verifyRemoved(PREInstr)); continue; } @@ -1659,4 +1660,16 @@ void GVN::cleanupGlobalSets() { /// internal data structures. void GVN::verifyRemoved(const Instruction *I) const { VN.verifyRemoved(I); + + // 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!"); + + 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!"); + } + } }