[PATCH] D35014: [X86] PR32755 : Improvement in CodeGen instruction selection for LEAs.

Jatin Bhateja via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 09:55:14 PDT 2017


jbhateja added inline comments.


================
Comment at: lib/Target/X86/X86OptimizeLEAs.cpp:341
+   LEAMapT::iterator Itr = LEAs.find(Key);
+   if (Itr == LEAs.end()) {
+       lsize = 0;
----------------
lsaba wrote:
> it is unclear what this function does, can you explain?
In a nutshell we are implementing a scoped hash map. Which is LEAs.
Every time we enter a new scope and encounter an LEA we first record the length of list of MIs corresponding to MemOpKey of new LEA. After that we insert the new LEA in the beginning of the list which is a value field of the hash map.

When we leave a scope we remove the LEA instructions from the LEAs hash map.  Since we recorded the original length of list of MIs when we entered the scope at exit we keep on removing elements from the beginning of list till the size becomes same as what was recorded at the entry.


https://reviews.llvm.org/D35014





More information about the llvm-commits mailing list