OSDN Git Service

Subzero: Improve lowering sequence for "a=b*b".
authorJim Stichnoth <stichnot@chromium.org>
Mon, 5 Oct 2015 22:12:09 +0000 (15:12 -0700)
committerJim Stichnoth <stichnot@chromium.org>
Mon, 5 Oct 2015 22:12:09 +0000 (15:12 -0700)
commitebbb5912415bf46798f064fea93863a95f32efd8
treef9062f9a50b323e2a53b65ff65b7393134657a09
parentb36757e1cf19a443ed40128b43b8e2f1f8579eb0
Subzero: Improve lowering sequence for "a=b*b".

Originally, the lowering sequence looked like:
  T = b
  T *= b
  a = T
Now it looks like:
  T = b
  T *= T
  a = T

If "b" gets a register and its live range ends after this instruction, then the new lowering sequence allows its register to be reused for "T".  This decreases register pressure, and removes an instruction (register move) from what could be a critical path.

This optimization is actually applicable for most arithmetic operations whose source operands are identical, but mul/fmul are the only ones that seem at all likely in practice.

BUG= none
R=kschimpf@google.com

Review URL: https://codereview.chromium.org/1377213004 .
src/IceTargetLoweringX86BaseImpl.h
tests_lit/llvm2ice_tests/square.ll [new file with mode: 0644]