[PATCH] D11363: Allow merging of immediates within a basic block for code size savings and reduced footprint.

Zia Ansari via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 16:47:40 PDT 2015


zansari updated this revision to Diff 31559.
zansari added a comment.

Thanks, Quentin.

Totally understand and agree with your position, and I also appreciate your patience with me.

I've started with a restricted set of target instructions but I think that as we add to the selection heuristics for the cases we catch, it should get easier to expose more places that ConstantHoisting can't catch, as we continue to improve code-size reductions.

However, as you suggested, I did add to my lit-test to check for a case where ISEL exposes constants not available in ConstantHoisting, even with my current restricted heuristics.

For example, the simple case of :

  memset(a, 33, 24)

Before:

  movl    $555819297, a+20        # imm = 0x21212121
  movl    $555819297, a+16        # imm = 0x21212121
  movl    $555819297, a+12        # imm = 0x21212121
  movl    $555819297, a+8         # imm = 0x21212121
  movl    $555819297, a+4         # imm = 0x21212121
  movl    $555819297, a           # imm = 0x21212121

with my changes:

  movl    $555819297, %eax        # imm = 0x21212121
  movl    %eax, a+20
  movl    %eax, a+16
  movl    %eax, a+12
  movl    %eax, a+8
  movl    %eax, a+4
  movl    %eax, a

That's about 40% size reduction.

If the changes to the test look OK to you, I'll go ahead with the commit.

Thanks, again.
Zia.


http://reviews.llvm.org/D11363

Files:
  lib/Target/X86/X86ISelDAGToDAG.cpp
  lib/Target/X86/X86InstrArithmetic.td
  lib/Target/X86/X86InstrInfo.td
  test/CodeGen/X86/immediate_merging.ll
  test/CodeGen/X86/remat-invalid-liveness.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11363.31559.patch
Type: text/x-patch
Size: 14106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150807/1202c59b/attachment.bin>


More information about the llvm-commits mailing list