[PATCH] D50476: [NFC] ConstantMerge: don't insert when find should be used

JF Bastien via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 8 21:18:31 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL339309: [NFC] ConstantMerge: don't insert when find should be used (authored by jfb, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D50476

Files:
  llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp


Index: llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp
+++ llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp
@@ -174,9 +174,12 @@
       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())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50476.159852.patch
Type: text/x-patch
Size: 682 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180809/4fc3d0f5/attachment.bin>


More information about the llvm-commits mailing list