This is an archive of the discontinued LLVM Phabricator instance.

[IR] Allow all integer types for stepvector intrinsic
AbandonedPublic

Authored by david-arm on Nov 11 2021, 1:56 AM.

Details

Summary

This patch changes the Verifier and LangRef to permit any integer
element types when creating the experimental stepvector intrinsic.

When compiling some SPEC benchmark code the vectoriser was attempting
to vectorise loops with unusual integer types, i.e. i3, and create
corresponding vector induction variables. For scalable vectors this
requires generating a stepvector intrisic for vectors with i3 element
types.

Tests added here:

CodeGen/AArch64/sve-stepvector.ll

Diff Detail

Event Timeline

david-arm created this revision.Nov 11 2021, 1:56 AM
david-arm requested review of this revision.Nov 11 2021, 1:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 11 2021, 1:56 AM
sdesmalen added inline comments.Nov 11 2021, 4:21 AM
llvm/test/CodeGen/AArch64/sve-stepvector.ll
50

Should the code that promotes this value also mask the low 3 bits, thus anding this value with splat(7) ?

david-arm added inline comments.Nov 11 2021, 5:26 AM
llvm/test/CodeGen/AArch64/sve-stepvector.ll
50

We could do, but whenever the type is promoted to something that has to be stored out to memory there will have to be a zero- or sign-extend. At that point the and will definitely appear. I wasn't sure if this is something that we need to do explicitly as part of lowering stepvector because I just assumed that the remaining bits would be treated as undefined.

Having said that, if you still think it's worthwhile adding an explicit mask I can look into it.

Hi @david-arm, the problem with this patch is you're enabling a route into code generation that was previously not available. For example, the removed stepvector_i1 test is something that we'll need to support and is likely to fail for SVE because <vscale x 16 x i1> is a legal type and thus will not use the same type promotion logic that your new stepvector_nxv2i3 test covers.

david-arm abandoned this revision.Nov 12 2021, 6:14 AM

I'm abandoning this patch in favour of a different approach for now.