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

Jatin Bhateja via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 08:24:37 PDT 2017


jbhateja added inline comments.


================
Comment at: lib/Target/X86/X86OptimizeLEAs.cpp:737
+
+            LI1.eraseFromParent();
+            cseDone = NewMI != nullptr;
----------------
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..




https://reviews.llvm.org/D35014





More information about the llvm-commits mailing list