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

Lama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 05:03:12 PDT 2017


lsaba added inline comments.


================
Comment at: lib/Target/X86/X86OptimizeLEAs.cpp:737
+
+            LI1.eraseFromParent();
+            cseDone = NewMI != nullptr;
----------------
jbhateja wrote:
> lsaba wrote:
> > should it also be erased from the LEAs list?
> Why do you think so ?
> 
> LEAs is a Map where
> 
> Key    = F ( BASE , INDEX , DISP , SEGMENT) 
> Value = Vector of MI (LEA Instr).
> This MAP is populated per BasicBlock basis.
> 
> Outer Loop traverse over Map entries
> 
> Sort Vector in decresing order of Scale.
> Inner Loop traverses over Sorted vector of LEA for a given Key
> LI1 insturction will be traversed only once.
> 
> Map will be delted once we leave this function.
> 
> Machine CSE which is value number based is already run before this pass so if there are multiple identical LEAs (i.e same BASE/INDEX/SCALE/DISP/SEGMENT) in a BasicBlock they will be factored out before we land up here..
> 
> 
just making sure:) 
by the way, can't this algorithm work cross a function's basic blocks?


https://reviews.llvm.org/D35014





More information about the llvm-commits mailing list