summaryrefslogtreecommitdiff
path: root/tools/bugpoint/Miscompilation.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-04-22 15:57:18 +0000
committerDan Gohman <gohman@apple.com>2009-04-22 15:57:18 +0000
commitd50330cd02b00c8e3de40e8544c45701b9891d87 (patch)
tree1d5bbca820546e217de34ab13727ee76fa662644 /tools/bugpoint/Miscompilation.cpp
parente370c80d316e1a7928dcca0373f42653cd614f96 (diff)
downloadllvm-d50330cd02b00c8e3de40e8544c45701b9891d87.tar.gz
llvm-d50330cd02b00c8e3de40e8544c45701b9891d87.tar.bz2
llvm-d50330cd02b00c8e3de40e8544c45701b9891d87.tar.xz
Use CloneModule's ValueMap in more places, instead of looking
up functions by name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/Miscompilation.cpp')
-rw-r--r--tools/bugpoint/Miscompilation.cpp35
1 files changed, 23 insertions, 12 deletions
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp
index 6a0911bfb5..7e8ff78a9c 100644
--- a/tools/bugpoint/Miscompilation.cpp
+++ b/tools/bugpoint/Miscompilation.cpp
@@ -220,8 +220,10 @@ bool ReduceMiscompilingFunctions::TestFuncs(const std::vector<Function*>&Funcs){
std::cout << '\n';
// Split the module into the two halves of the program we want.
- Module *ToNotOptimize = CloneModule(BD.getProgram());
- Module *ToOptimize = SplitFunctionsOutOfModule(ToNotOptimize, Funcs);
+ DenseMap<const Value*, Value*> ValueMap;
+ Module *ToNotOptimize = CloneModule(BD.getProgram(), ValueMap);
+ Module *ToOptimize = SplitFunctionsOutOfModule(ToNotOptimize, Funcs,
+ ValueMap);
// Run the predicate, note that the predicate will delete both input modules.
return TestFn(BD, ToOptimize, ToNotOptimize);
@@ -258,9 +260,11 @@ static bool ExtractLoops(BugDriver &BD,
while (1) {
if (BugpointIsInterrupted) return MadeChange;
- Module *ToNotOptimize = CloneModule(BD.getProgram());
+ DenseMap<const Value*, Value*> ValueMap;
+ Module *ToNotOptimize = CloneModule(BD.getProgram(), ValueMap);
Module *ToOptimize = SplitFunctionsOutOfModule(ToNotOptimize,
- MiscompiledFunctions);
+ MiscompiledFunctions,
+ ValueMap);
Module *ToOptimizeLoopExtracted = BD.ExtractLoop(ToOptimize);
if (!ToOptimizeLoopExtracted) {
// If the loop extractor crashed or if there were no extractible loops,
@@ -396,9 +400,11 @@ bool ReduceMiscompiledBlocks::TestFuncs(const std::vector<BasicBlock*> &BBs) {
std::cout << '\n';
// Split the module into the two halves of the program we want.
- Module *ToNotOptimize = CloneModule(BD.getProgram());
+ DenseMap<const Value*, Value*> ValueMap;
+ Module *ToNotOptimize = CloneModule(BD.getProgram(), ValueMap);
Module *ToOptimize = SplitFunctionsOutOfModule(ToNotOptimize,
- FunctionsBeingTested);
+ FunctionsBeingTested,
+ ValueMap);
// Try the extraction. If it doesn't work, then the block extractor crashed
// or something, in which case bugpoint can't chase down this possibility.
@@ -443,9 +449,11 @@ static bool ExtractBlocks(BugDriver &BD,
return false;
}
- Module *ProgClone = CloneModule(BD.getProgram());
+ DenseMap<const Value*, Value*> ValueMap;
+ Module *ProgClone = CloneModule(BD.getProgram(), ValueMap);
Module *ToExtract = SplitFunctionsOutOfModule(ProgClone,
- MiscompiledFunctions);
+ MiscompiledFunctions,
+ ValueMap);
Module *Extracted = BD.ExtractMappedBlocksFromModule(Blocks, ToExtract);
if (Extracted == 0) {
// Weird, extraction should have worked.
@@ -608,9 +616,11 @@ bool BugDriver::debugMiscompilation() {
// Output a bunch of bitcode files for the user...
std::cout << "Outputting reduced bitcode files which expose the problem:\n";
- Module *ToNotOptimize = CloneModule(getProgram());
+ DenseMap<const Value*, Value*> ValueMap;
+ Module *ToNotOptimize = CloneModule(getProgram(), ValueMap);
Module *ToOptimize = SplitFunctionsOutOfModule(ToNotOptimize,
- MiscompiledFunctions);
+ MiscompiledFunctions,
+ ValueMap);
std::cout << " Non-optimized portion: ";
ToNotOptimize = swapProgramIn(ToNotOptimize);
@@ -856,8 +866,9 @@ bool BugDriver::debugCodeGenerator() {
std::vector<Function*> Funcs = DebugAMiscompilation(*this, TestCodeGenerator);
// Split the module into the two halves of the program we want.
- Module *ToNotCodeGen = CloneModule(getProgram());
- Module *ToCodeGen = SplitFunctionsOutOfModule(ToNotCodeGen, Funcs);
+ DenseMap<const Value*, Value*> ValueMap;
+ Module *ToNotCodeGen = CloneModule(getProgram(), ValueMap);
+ Module *ToCodeGen = SplitFunctionsOutOfModule(ToNotCodeGen, Funcs, ValueMap);
// Condition the modules
CleanupAndPrepareModules(*this, ToCodeGen, ToNotCodeGen);