[PATCH] D48705: [CodeGenPrepare] Reverse LICM pass for shift and rotate patterns.

Tomasz Krupa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 28 14:30:04 PDT 2018


tkrupa added a comment.

In https://reviews.llvm.org/D48705#1147074, @efriedma wrote:

> I'm not sure https://reviews.llvm.org/D46946 and https://reviews.llvm.org/D47019 are good ideas in the first place, particularly https://reviews.llvm.org/D47019.  Expanding an intrinsic to an 8-instruction sequence is getting past the point where we're actually getting any benefit from transforming intrinsic to native IR.  Emitting a complicated lowering like that, and trying to recover it in isel seems very tricky to get right, and as far as I can tell we don't get much benefit.
>
> If we are going to expand out x86 shift and rotate intrinsics, we should probably consider pattern-matching on IR, rather than waiting for SelectionDAG.  Trying to work around isel limitations in this fashion is fragile, and will probably have a wider effect than you want.
>
> For rotates, there was a proposal to add a generic IR intrinsic for variable rotates on llvmdev, due to the complications involved in late pattern-matching.


FWIW we don't do the whole pattern matching in lowering stage - most of the pattern disappears during the combining right after creating the DAG because the extra instructions are only needed in IR to avoid creating poison values. Because of this, we can't do pattern matching in IR. If it was possible I would just emit shortened IR - unless I'm missing something?

But all in all yeah, the whole thing is rather tricky.


Repository:
  rL LLVM

https://reviews.llvm.org/D48705





More information about the llvm-commits mailing list