This is an archive of the discontinued LLVM Phabricator instance.

[LLVM] Remove support for constant scalable vector GEPs.
ClosedPublic

Authored by paulwalker-arm on Mar 6 2023, 10:45 AM.

Details

Summary

This work has fallen out from D134648 as a requirement to loosen
the "constness" of vscale.

Diff Detail

Event Timeline

paulwalker-arm created this revision.Mar 6 2023, 10:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2023, 10:45 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
paulwalker-arm requested review of this revision.Mar 6 2023, 10:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2023, 10:45 AM

Tighten up a couple of function signatures.

paulwalker-arm added inline comments.
llvm/lib/CodeGen/CodeGenPrepare.cpp
2353–2355 ↗(On Diff #502732)

Just being able to remove this wholesale seems optimistic but it doesn't seem to have any relevant test coverage.

llvm/test/Transforms/InstSimplify/vscale-inseltpoison.ll
157–160

These tests look like blind copies from vscale.ll and have no insert_eltement_poison related requirements so I've just remove them.

nikic added inline comments.Mar 6 2023, 11:21 AM
llvm/lib/CodeGen/CodeGenPrepare.cpp
2353–2355 ↗(On Diff #502732)

I'd suggest landing this as a separate change ahead of time.

llvm/test/Transforms/InstSimplify/vscale.ll
190

This case should still fold.

Restored simplification for case where isSupportedGetElementPtr() is false.

nikic accepted this revision.Mar 7 2023, 8:38 AM

LGTM. This is slightly non-optimal in terms of constant folding (what we really want is to export a GEP-folding API in ConstantFolding and not force going through ConstExpr + ConstantFoldConstant), but I don't think we need to block on that.

llvm/test/Transforms/InstSimplify/vscale.ll
198

Any reason for this change?

This revision is now accepted and ready to land.Mar 7 2023, 8:38 AM
nikic added a comment.Mar 7 2023, 8:38 AM

This should also get a LangRef mention that vscale is not valid in constant expression GEPs.

paulwalker-arm added inline comments.Mar 7 2023, 8:43 AM
llvm/test/Transforms/InstSimplify/vscale.ll
198

I wanted to show that even though all operands are constant this form of GEP is still not constant foldable. I figured this to be a better version of the original test, but I might have missed some subtlety that means an extra test is more appropriate?

nikic added inline comments.Mar 7 2023, 8:45 AM
llvm/test/Transforms/InstSimplify/vscale.ll
198

Oh I see, that makes sense.

paulwalker-arm added inline comments.Mar 8 2023, 7:56 AM
llvm/lib/CodeGen/CodeGenPrepare.cpp
2353–2355 ↗(On Diff #502732)

Just a note to say I've followed this advice and landed the CodeGenPrepare change via https://reviews.llvm.org/rGadbdf273efd5 and will await any fallout before landing the rest of this patch, probably towards the end of next week.