[PATCH] D81468: [x86] refine conditions for immediate hoisting to save code-size

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 07:05:58 PDT 2020


spatel created this revision.
spatel added reviewers: craig.topper, RKSimon, lebedev.ri.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.
spatel updated this revision to Diff 269530.
spatel added a comment.

Patch updated:

1. Removed the existing special-case for 0/-1 immediates.
2. Updated comments in test files.


As shown in PR46237:
https://bugs.llvm.org/show_bug.cgi?id=46237

The size-savings win for hoisting an 8-bit ALU immediate (intentionally excluding store constants) requires extreme conditions; it may not even be possible when including REX prefix bytes on x86-64.

I did draft a version of this patch that included use counts after the loop, but I suspect that accounting is not working as expected. I think that is because the number of constant uses are changing as we select instructions (for example as we transform shl/add into LEA).


https://reviews.llvm.org/D81468

Files:
  llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
  llvm/test/CodeGen/X86/immediate_merging.ll
  llvm/test/CodeGen/X86/immediate_merging64.ll
  llvm/test/CodeGen/X86/pr27202.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81468.269530.patch
Type: text/x-patch
Size: 5684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200609/c487641e/attachment.bin>


More information about the llvm-commits mailing list