diff options
Diffstat (limited to 'llvm/lib/Transforms/IPO/ConstantMerge.cpp')
| -rw-r--r-- | llvm/lib/Transforms/IPO/ConstantMerge.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/ConstantMerge.cpp b/llvm/lib/Transforms/IPO/ConstantMerge.cpp index e0b1037053f..a6cfbb26e79 100644 --- a/llvm/lib/Transforms/IPO/ConstantMerge.cpp +++ b/llvm/lib/Transforms/IPO/ConstantMerge.cpp @@ -174,9 +174,12 @@ static bool mergeConstants(Module &M) { Constant *Init = GV->getInitializer(); // Check to see if the initializer is already known. - GlobalVariable *Slot = CMap[Init]; + auto Found = CMap.find(Init); + if (Found == CMap.end()) + continue; - if (!Slot || Slot == GV) + GlobalVariable *Slot = Found->second; + if (Slot == GV) continue; if (!Slot->hasGlobalUnnamedAddr() && !GV->hasGlobalUnnamedAddr()) |

