This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Make scalable size representation more explicit
ClosedPublic

Authored by nikic on Feb 23 2023, 12:54 AM.

Details

Summary

Represent scalable type sizes using C * vscale, where vscale is the vscale constant expression. This exposes a bit more information to SCEV, because the vscale multiplier is explicitly modeled in SCEV (rather than part of the sizeof expression).

This is mainly intended as an alternative to D143642.

Depends on D144566.

Diff Detail

Event Timeline

nikic created this revision.Feb 23 2023, 12:54 AM
nikic requested review of this revision.Feb 23 2023, 12:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2023, 12:54 AM

I realise this patch is partly refactoring but it does seem to increase the value of scalable vector GEP ConstantExprs, which is inconsistent to your view on D134648? Is it possible for SCEV to have its own representation of vscale that is independent to the Constant class hierarchy?

nikic added a comment.Feb 23 2023, 6:14 AM

I realise this patch is partly refactoring but it does seem to increase the value of scalable vector GEP ConstantExprs, which is inconsistent to your view on D134648?

I don't think this patch changes the situation either way: It replaces on constexpr vscale GEP with another (more canonical) one.

Is it possible for SCEV to have its own representation of vscale that is independent to the Constant class hierarchy?

Yes, it's possible to add a first class vscale SCEV expression. It's not even particularly hard, just takes a bit of boilerplate to adjust all the SCEV type switches.

Incidentally, I just put up https://discourse.llvm.org/t/rfc-replacing-getelementptr-with-ptradd/68699, which will be removing the vscale constant expressions as a side effect, so I guess we'll have to indeed do that SCEV change at some point. (Unless we can avoid the need entirely, I think one use in LAA is the only bit that that really needs vscale SCEV that is not present in IR).

sdesmalen accepted this revision.Feb 23 2023, 8:26 AM

Seems like a sensible refactoring to me and also removes the need for D143642.

This revision is now accepted and ready to land.Feb 23 2023, 8:26 AM

Thanks for the information @nikic . I'm assuming the road to ptradd will not be short? so I'll investigate adding something to SCEV so we can move towards updating the LangRef for vscale.

This revision was landed with ongoing or failed builds.Feb 27 2023, 1:58 AM
This revision was automatically updated to reflect the committed changes.