[PATCH] D36170: LSR: Fix PR33514

Evgeny Stupachenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 15:03:43 PDT 2017


evstupac added a comment.

Hi Quentin,

In https://reviews.llvm.org/D36170#828004, @qcolombet wrote:

> Multiplying pointers is indeed illegal in the IR, but instead of just dropping them, would it make sense to keep them with the proper ptrtoint casts?


We could do this, however I have some concerns:

1. If we convert pointer to int we can miss some optimizations. For example comparison of pointer == 1 is always false, comparison of int == 1 not.
2. If we insert more converts we should raise Formula cost somehow (most likely leading to the formula drop).

> Also, if that is not something we are supposed to do, I think it would make sense to have SCEV complain when we are trying to do that.

SCEV expands to undefined value and it seems good enough. The expansion could be in dead code for example - so assert or error is too strict.

It is hard to imagine a case when C*p will be in the best solution (so that C*p is reused somewhere else). However that can happen if other formulas were deleted because of "too complex solution".

I've tested performance for x86.
spec2000/spec2006 are build same
Other tests that have difference in binaries got the same performance.

Thanks,
Evgeny


Repository:
  rL LLVM

https://reviews.llvm.org/D36170





More information about the llvm-commits mailing list