[PATCH] D38730: X86: Fix X86CallFrameOptimization to search for the COPY StackPointer

Zvi Rackover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 07:20:23 PDT 2017


zvi added inline comments.


================
Comment at: test/CodeGen/X86/movtopush.ll:231
 ; NORMAL-NEXT: call
-; NORMAL-NEXT: subl $4, %esp
-; NORMAL-NEXT: movl 20(%esp), [[E1:%e..]]
-; NORMAL-NEXT: movl 24(%esp), [[E2:%e..]]
-; NORMAL-NEXT: movl    [[E2]], 4(%esp)
-; NORMAL-NEXT: movl    [[E1]], (%esp)
-; NORMAL-NEXT: leal 32(%esp), [[E3:%e..]]
-; NORMAL-NEXT: movl    [[E3]], 16(%esp)
-; NORMAL-NEXT: leal 28(%esp), [[E4:%e..]]
-; NORMAL-NEXT: movl    [[E4]], 12(%esp)
-; NORMAL-NEXT: movl    $6, 8(%esp)
+; NORMAL-NEXT: addl $16, %esp
+; NORMAL-NEXT: movl (%esp), [[E1:%e..]]
----------------
Overall code size reduced by 15 bytes


================
Comment at: test/CodeGen/X86/movtopush.ll:297
 
 ; Converting one mov into a push isn't worth it when 
 ; doing so forces too much overhead for other calls.
----------------
The check's don't show the issue at hand, so i will explain:
With the fix, the pass now fires and replacing mov's with push's results in the following
1.  Overall code size reduced by ~60 bytes
2. There is an extra overhead of resetting (with an add instruction) the frame after each call (but we still win overall in code size)



================
Comment at: test/CodeGen/X86/movtopush.ll:314
 
 ; But if the gains outweigh the overhead, we should do it
 ; NORMAL-LABEL: test12b:
----------------
Overall code size reduced by 24 bytes


https://reviews.llvm.org/D38730





More information about the llvm-commits mailing list