[PATCH] D73866: [RDA] getInstFromId: find instructions. NFC.

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 6 02:35:03 PST 2020


SjoerdMeijer updated this revision to Diff 242843.
SjoerdMeijer added a comment.

got rid of the lambda for readability.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73866/new/

https://reviews.llvm.org/D73866

Files:
  llvm/include/llvm/CodeGen/ReachingDefAnalysis.h
  llvm/lib/CodeGen/ReachingDefAnalysis.cpp


Index: llvm/lib/CodeGen/ReachingDefAnalysis.cpp
===================================================================
--- llvm/lib/CodeGen/ReachingDefAnalysis.cpp
+++ llvm/lib/CodeGen/ReachingDefAnalysis.cpp
@@ -215,9 +215,11 @@
     return nullptr;
 
   for (auto &MI : *MBB) {
-    if (InstIds.count(&MI) && InstIds.lookup(&MI) == InstId)
-      return &MI;
+    auto F = InstIds.find(&MI);
+    if (F != InstIds.end() && F->second == InstId)
+      return F->first;
   }
+
   return nullptr;
 }
 
Index: llvm/include/llvm/CodeGen/ReachingDefAnalysis.h
===================================================================
--- llvm/include/llvm/CodeGen/ReachingDefAnalysis.h
+++ llvm/include/llvm/CodeGen/ReachingDefAnalysis.h
@@ -55,7 +55,7 @@
   /// The first instruction in each basic block is 0.
   int CurInstr;
 
-  /// Maps instructions to their instruction Ids, relative to the begining of
+  /// Maps instructions to their instruction Ids, relative to the beginning of
   /// their basic blocks.
   DenseMap<MachineInstr *, int> InstIds;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73866.242843.patch
Type: text/x-patch
Size: 1047 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200206/1ce6bbd1/attachment.bin>


More information about the llvm-commits mailing list