[PATCH] D88783: [InstCombine] matchFunnelShift - fold or(shl(a,x),lshr(b,sub(bw,x))) -> fshl(a,b,x) iff x < bw

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 9 09:31:55 PDT 2020


lebedev.ri added a comment.

In D88783#2322046 <https://reviews.llvm.org/D88783#2322046>, @RKSimon wrote:

> Improve comment describing the limits of the fold.

So it is indeed trying to prevent degradation of code quality in case of expansion
(maybe funnel shift intrinsics should simply track whether or not they were originally ub-safe?)

And that highlights my point - we might know that the shift amount is safe not from an explicit mask,
but e.g. from range metadata on load <https://llvm.org/docs/LangRef.html#range-metadata>,
which means expansion will still introduce a masking op that wasn't there originally.

How bad performance-wise would that be?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88783/new/

https://reviews.llvm.org/D88783



More information about the llvm-commits mailing list