[PATCH] D47113: [CVP] Teach CorrelatedValuePropagation to reduce the width of lshr instruction.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 09:29:12 PDT 2018


spatel added a comment.

I think this patch requires discussion on llvm-dev so everyone is clear on the direction and outcome:

1. We're saying that CVP (a target-independent IR canonicalization pass) will always try to narrow the width of binops.
2. It doesn't matter if that means increasing cast instruction count.
3. It doesn't matter if the narrow type is not legal in the target's datalayout (as long as we have a power-of-2).

The fact that we're dealing with 1 opcode at a time is only because we're not considering the general pattern and consequences.
We overlooked these questions in the specific case of div/rem (https://reviews.llvm.org/D44102) because we assumed that narrower div/rem are always better for analysis and codegen, but I doubt that we can extend that reasoning to all binops on all targets. This will fight with transforms in instcombine (see canEvaluateSExtd / canEvaluateZExtd).


Repository:
  rL LLVM

https://reviews.llvm.org/D47113





More information about the llvm-commits mailing list