Commit e44735cf authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #887 from undingen/objectcache_2runs

Generate better module names to make the object cache more effective
parents 59639120 e6407eea
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <cstdio> #include <cstdio>
#include <iostream> #include <iostream>
#include <set> #include <set>
#include <sstream>
#include <stdint.h> #include <stdint.h>
#include "llvm/Analysis/Passes.h" #include "llvm/Analysis/Passes.h"
...@@ -30,6 +29,7 @@ ...@@ -30,6 +29,7 @@
#include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/LegacyPassManager.h"
#endif #endif
#include "llvm/Support/FileSystem.h" #include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetSubtargetInfo.h" #include "llvm/Target/TargetSubtargetInfo.h"
#include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Instrumentation.h"
...@@ -960,16 +960,16 @@ static llvm::MDNode* setupDebugInfo(SourceInfo* source, llvm::Function* f, std:: ...@@ -960,16 +960,16 @@ static llvm::MDNode* setupDebugInfo(SourceInfo* source, llvm::Function* f, std::
} }
static std::string getUniqueFunctionName(std::string nameprefix, EffortLevel effort, const OSREntryDescriptor* entry) { static std::string getUniqueFunctionName(std::string nameprefix, EffortLevel effort, const OSREntryDescriptor* entry) {
static int num_functions = 0; static llvm::StringMap<int> used_module_names;
std::string name;
std::ostringstream os; llvm::raw_string_ostream os(name);
os << nameprefix; os << nameprefix;
os << "_e" << (int)effort; os << "_e" << (int)effort;
if (entry) { if (entry)
os << "_osr" << entry->backedge->target->idx; os << "_osr" << entry->backedge->target->idx;
} // in order to generate a unique id add the number of times we encountered this name to end of the string.
os << '_' << num_functions; auto& times = used_module_names[os.str()];
num_functions++; os << '_' << ++times;
return os.str(); return os.str();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment