[PATCH] D48853: [SCEV] Add [zs]ext{C, +, x} -> (D + [zs]ext{C-D, +, x})<nuw><nsw> transform

Roman Tereshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 24 11:13:37 PDT 2018


rtereshin added a comment.

In https://reviews.llvm.org/D48853#1165748, @efriedma wrote:

> I think if we're going to do this, we need to implement it on top of a SCEV-based known-bits implementation; introducing a separate getZeroExtendExprForValue API is going to lead to weird results if SCEV creates a zero-extend expression for some other reason.
>
> Whether we should do this in general, I'm not really sure.  I mean, yes, I can see how this particular form is a bit more convenient for the load-store vectorizer, but it doesn't seem very general; it seems more intuitive to canonicalize towards reducing the number of AddExprs.  But maybe pulling as much information as possible outside of the zext is generally useful enough to make this worthwhile?
>
> Do you also plan to implement a similar transform for AddRecs? (e.g. `(zext i32 {1,+,2}<%while.body> to i64)`).


Hi Eli,

I have moved away from using KnownBits, so no new API anymore, I have also generalized this for AddRec's and sext's, which effectively generalized pre-existing transforms for sext's and added them anew for zext's.

Do you think this is good to go now?

Thanks,
Roman


Repository:
  rL LLVM

https://reviews.llvm.org/D48853





More information about the llvm-commits mailing list