[llvm-commits] [llvm] r93093 - /llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp
Julien Lerouge
jlerouge at apple.com
Sat Jan 9 17:07:22 PST 2010
Author: jlerouge
Date: Sat Jan 9 19:07:22 2010
New Revision: 93093
URL: http://llvm.org/viewvc/llvm-project?rev=93093&view=rev
Log:
Fix nondeterministic behavior.
Modified:
llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp
Modified: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp?rev=93093&r1=93092&r2=93093&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp Sat Jan 9 19:07:22 2010
@@ -45,7 +45,7 @@
namespace {
class CodeExtractor {
- typedef std::vector<Value*> Values;
+ typedef SetVector<Value*> Values;
SetVector<BasicBlock*> BlocksToExtract;
DominatorTree* DT;
bool AggregateArgs;
@@ -216,13 +216,13 @@
// instruction is used outside the region, it's an output.
for (User::op_iterator O = I->op_begin(), E = I->op_end(); O != E; ++O)
if (definedInCaller(*O))
- inputs.push_back(*O);
+ inputs.insert(*O);
// Consider uses of this instruction (outputs).
for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
UI != E; ++UI)
if (!definedInRegion(*UI)) {
- outputs.push_back(I);
+ outputs.insert(I);
break;
}
} // for: insts
@@ -235,12 +235,6 @@
} // for: basic blocks
NumExitBlocks = ExitBlocks.size();
-
- // Eliminate duplicates.
- std::sort(inputs.begin(), inputs.end());
- inputs.erase(std::unique(inputs.begin(), inputs.end()), inputs.end());
- std::sort(outputs.begin(), outputs.end());
- outputs.erase(std::unique(outputs.begin(), outputs.end()), outputs.end());
}
/// constructFunction - make a function based on inputs and outputs, as follows:
More information about the llvm-commits
mailing list