about summary refs log tree commit diff homepage
path: root/lib/Module/PhiCleaner.cpp
diff options
context:
space:
mode:
authorvpushkar <vpushkar@ptsecurity.com>2016-03-16 17:32:15 +0300
committervpushkar <vpushkar@ptsecurity.com>2016-03-16 17:32:15 +0300
commitdb43444b45a28842a4e6693e84250c9d69863c52 (patch)
tree26c6021dffa65d538f764e6a763ad9e45e60ffee /lib/Module/PhiCleaner.cpp
parentbfc4714531978867a7f68a52f0b614b63f06a391 (diff)
downloadklee-db43444b45a28842a4e6693e84250c9d69863c52.tar.gz
push_back usage for values vector
Diffstat (limited to 'lib/Module/PhiCleaner.cpp')
-rw-r--r--lib/Module/PhiCleaner.cpp16
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