mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 02:33:33 +00:00
With debug info, there are nameless constant global values. do not crash when we hit one
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48749 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b96af47381
commit
df4613ced2
@ -125,13 +125,14 @@ bool
|
|||||||
ReduceCrashingGlobalVariables::TestGlobalVariables(
|
ReduceCrashingGlobalVariables::TestGlobalVariables(
|
||||||
std::vector<GlobalVariable*>& GVs) {
|
std::vector<GlobalVariable*>& GVs) {
|
||||||
// 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<GlobalVariable*> GVSet;
|
std::set<GlobalVariable*> GVSet;
|
||||||
|
|
||||||
for (unsigned i = 0, e = GVs.size(); i != e; ++i) {
|
for (unsigned i = 0, e = GVs.size(); i != e; ++i) {
|
||||||
GlobalVariable* CMGV = M->getNamedGlobal(GVs[i]->getName());
|
GlobalVariable* CMGV = cast<GlobalVariable>(ValueMap[GVs[i]]);
|
||||||
assert(CMGV && "Global Variable not in module?!");
|
assert(CMGV && "Global Variable not in module?!");
|
||||||
GVSet.insert(CMGV);
|
GVSet.insert(CMGV);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user