diff options
-rw-r--r-- | lib/Module/PhiCleaner.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Module/PhiCleaner.cpp b/lib/Module/PhiCleaner.cpp index eff3d495..2cf3ba4a 100644 --- a/lib/Module/PhiCleaner.cpp +++ b/lib/Module/PhiCleaner.cpp @@ -39,12 +39,16 @@ bool klee::PhiCleanerPass::runOnFunction(Function &f) { if (pi->getIncomingBlock(i) != reference->getIncomingBlock(i)) break; - if (i!=numBlocks) { - for (unsigned i=0; i<numBlocks; i++) { - pi->setIncomingBlock(i, reference->getIncomingBlock(i)); - pi->setIncomingValue(i, pi->getIncomingValueForBlock(reference->getIncomingBlock(i))); - } - changed = true; + if (i != numBlocks) { + std::vector<Value*> values; + values.reserve(numBlocks); + for (unsigned i = 0; i<numBlocks; i++) + values.push_back(pi->getIncomingValueForBlock(reference->getIncomingBlock(i))); + for (unsigned i = 0; i<numBlocks; i++) { + pi->setIncomingBlock(i, reference->getIncomingBlock(i)); + pi->setIncomingValue(i, values[i]); + } + changed = true; } // see if it uses any previously defined phi nodes |