[PATCH] D44098: [ARM] Relax condition for PerformSHLSimplify

John Brawn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 9 06:15:29 PST 2018


john.brawn added a comment.

In https://reviews.llvm.org/D44098#1029809, @samparker wrote:

> I also tried exiting early when there's a shifted user and the immediate is already valid, but this produced worse code for almost all my new tests. The problem is that a mov is still required because the bin op is using an immediate and a shifted operand. This is particularly worse for Thumb where code size increase is greater as well.


It looks like, in the added tests at least, what we should be trying to do is:

- We have this node N
- We want to transform this node so that its user can use it in a shifted operand, in a way that saves us an instruction
- If the user already has another operand that it can use as a shifted operand, then we won't actually be saving an instruction in that way
- But we can save an instruction if this transformation causes an immediate to be a valid operand meaning we can eliminate a mov

I think it's specifically the "check that the other operand of the user could be used as a shifted operand" that we need to be careful about. Just checking for a shift isn't right in thumb because it's only a shift by an immediate that can be used as an operand, but in arm we can do that so the check needs to take that into account.


https://reviews.llvm.org/D44098





More information about the llvm-commits mailing list