This is an archive of the discontinued LLVM Phabricator instance.

[TwoAddressInstructionPass] Try 3 Addr Conversion After Commuting
ClosedPublic

Authored by volkan on Jun 30 2015, 3:32 PM.

Details

Summary

TwoAddressInstructionPass stops after a successful commuting but 3 Addr conversion might be good for some cases.
Consider:

int foo(int a, int b) {
  return a + b;
}

LLVM emits:

addl	%esi, %edi
movl	%edi, %eax
ret

If we try 3 Addr conversion:

leal	(%rsi,%rdi), %eax
ret

This patch is going to produce one less instruction and save one byte.

Diff Detail

Repository
rL LLVM

Event Timeline

volkan updated this revision to Diff 28819.Jun 30 2015, 3:32 PM
volkan retitled this revision from to [TwoAddressInstructionPass] Try 3 Addr Conversion After Commuting.
volkan updated this object.
volkan edited the test plan for this revision. (Show Details)
volkan set the repository for this revision to rL LLVM.
volkan added a subscriber: Unknown Object (MLST).

Hi Volkan,

LGTM.

Thanks,
-Quentin

qcolombet accepted this revision.Jul 1 2015, 3:23 PM
qcolombet added a reviewer: qcolombet.

(Actually switch the action drop box!)

This revision is now accepted and ready to land.Jul 1 2015, 3:23 PM
This revision was automatically updated to reflect the committed changes.