mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
Fix a bugpoint bug on anonymous functions. Instead of looking up
functions in the new module by name, use the ValueMap provided by CloneModule to do the lookups. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66216 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1f4af262d5
commit
ef0ff140a7
@ -264,16 +264,18 @@ namespace {
|
|||||||
|
|
||||||
bool ReduceCrashingBlocks::TestBlocks(std::vector<const BasicBlock*> &BBs) {
|
bool ReduceCrashingBlocks::TestBlocks(std::vector<const BasicBlock*> &BBs) {
|
||||||
// Clone the program to try hacking it apart...
|
// Clone the program to try hacking it apart...
|
||||||
Module *M = CloneModule(BD.getProgram());
|
DenseMap<const Value*, Value*> ValueMap;
|
||||||
|
Module *M = CloneModule(BD.getProgram(), ValueMap);
|
||||||
|
|
||||||
// Convert list to set for fast lookup...
|
// Convert list to set for fast lookup...
|
||||||
std::set<BasicBlock*> Blocks;
|
std::set<BasicBlock*> Blocks;
|
||||||
for (unsigned i = 0, e = BBs.size(); i != e; ++i) {
|
for (unsigned i = 0, e = BBs.size(); i != e; ++i) {
|
||||||
// Convert the basic block from the original module to the new module...
|
// Convert the basic block from the original module to the new module...
|
||||||
const Function *F = BBs[i]->getParent();
|
const Function *F = BBs[i]->getParent();
|
||||||
Function *CMF = M->getFunction(F->getName());
|
Function *CMF = cast<Function>(ValueMap[F]);
|
||||||
assert(CMF && "Function not in module?!");
|
assert(CMF && "Function not in module?!");
|
||||||
assert(CMF->getFunctionType() == F->getFunctionType() && "wrong type?");
|
assert(CMF->getFunctionType() == F->getFunctionType() && "wrong type?");
|
||||||
|
assert(CMF->getName() == F->getName() && "wrong name?");
|
||||||
|
|
||||||
// Get the mapped basic block...
|
// Get the mapped basic block...
|
||||||
Function::iterator CBI = CMF->begin();
|
Function::iterator CBI = CMF->begin();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user