[PATCH] D50780: Check that the key is in the LEAs map before accessing

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 10:06:44 PDT 2018


craig.topper added inline comments.


================
Comment at: lib/Target/X86/X86OptimizeLEAs.cpp:517
     int Dist;
-    if (!chooseBestLEA(LEAs[getMemOpKey(MI, MemOpNo)], MI, DefMI, AddrDispShift,
-                       Dist))
+    MemOpKey key = getMemOpKey(MI, MemOpNo);
+    auto insns = LEAs.find(key);
----------------
Can you just call getMemOpKey when you call find? I don't think we need a separate variable for it.


================
Comment at: lib/Target/X86/X86OptimizeLEAs.cpp:518
+    MemOpKey key = getMemOpKey(MI, MemOpNo);
+    auto insns = LEAs.find(key);
+
----------------
Variable names should be capitalized.


Repository:
  rL LLVM

https://reviews.llvm.org/D50780





More information about the llvm-commits mailing list