diff options
author | Bill Wendling <isanbard@gmail.com> | 2008-12-22 22:14:07 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2008-12-22 22:14:07 +0000 |
commit | 70ded19b3f69b8795423ec301da4ad9143ba9f15 (patch) | |
tree | 42ec359de6c46dd700498cf700f2954833375647 | |
parent | ec40d50aa41795adcf62ba30e3ddebb7c5c9f339 (diff) |
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
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 1d7a107db2..e517b3a529 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -40,11 +40,11 @@ #include <cstdio> 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<bool> 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<Instruction*, 4>::iterator + SI = II->second.begin(), SE = II->second.end(); SI != SE; ++SI) { + assert(*SI != I && "Inst is still a value in PHI map!"); + } + } } |