This is an archive of the discontinued LLVM Phabricator instance.

[SVE] Remove invalid usage of VectorType::getNumElements in Function
ClosedPublic

Authored by ctetreau on Apr 27 2020, 2:59 PM.

Details

Summary

Removes usage of VectorType::getNumElements identified by test located
at CodeGen/aarch64-sve-intrinsics/acle_sve_dot.c. This code explicitly
converts a potentially fixed length vector to scalable vector by
constructing the ElementCount = {getNumElements(), true}

Diff Detail

Event Timeline

ctetreau created this revision.Apr 27 2020, 2:59 PM
Herald added a reviewer: efriedma. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
ctetreau marked an inline comment as done.Apr 27 2020, 3:14 PM
ctetreau added inline comments.
llvm/lib/IR/Function.cpp
1079

This behavior was introduced in D65930. It seems to me that this would have just returned the decoded type if it were expected that the decoded type would be scalable.

efriedma added inline comments.Apr 27 2020, 3:20 PM
llvm/lib/IR/Function.cpp
1080

It's intentional. See EncodeFixedType in llvm/utils/TableGen/IntrinsicEmitter.cpp . Actually, Ty should always be a FixedVectorType here, I think; maybe we can just cast<FixedVectorType> here?

ctetreau updated this revision to Diff 260500.Apr 27 2020, 4:54 PM
ctetreau marked an inline comment as done.

address code review issues

ctetreau added inline comments.Apr 27 2020, 4:57 PM
llvm/lib/IR/Function.cpp
1080

It's not super clear to me because the types and values don't line up exactly, but it seems like this all has to do with serialization, and in the stream there's something like:

VALUE    -> PREFIX SUFFIX
PREFIX   -> SCALABLE |
SCALABLE -> [value that specifies if the following is actually a scalable vector]
SUFFIX   -> [value for a fixed width vector]

... seems like a bit of an abuse to me, but doing anything about it would involve changing the data layout.

This revision is now accepted and ready to land.Apr 27 2020, 5:22 PM
This revision was automatically updated to reflect the committed changes.