This is an archive of the discontinued LLVM Phabricator instance.

[SVE] fix IRMover returning wrong modified vector type
ClosedPublic

Authored by nasherm on Feb 18 2021, 5:40 AM.

Details

Summary

Modified scalable vector types weren't correctly returned at link-time.
The previous behaviour was a FixedVectorType was constructed
when expecting a ScalableVectorType. This commit has added a regression
test which re-creates the failure as well as a fix.

Diff Detail

Event Timeline

nasherm created this revision.Feb 18 2021, 5:40 AM
nasherm requested review of this revision.Feb 18 2021, 5:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 18 2021, 5:40 AM
sdesmalen added subscribers: craig.topper, frasercrmck.

Hi @nasherm thanks for working on this fix.

llvm/lib/Linker/IRMover.cpp
301–305

These can both use the same interface to VectorType, e.g.:

case Type::ScalableVectorTyID:
case Type::FixedVectorTyID:
  return *Entry = VectorType::get(ElementTypes[0], cast<VectorType>(Ty)->getElementCount());
llvm/test/Linker/fixed-vector-type-construction.ll
1

I don't think this one needs a RUN line if you move this file to llvm/test/Linker/Inputs/

llvm/test/Linker/sve-type-construction.ll
1

Can you replace sve with scalable-vector (also in the filenames)? The test isn't necessarily specific to SVE.

1

This can use %s directly.

nasherm updated this revision to Diff 324633.Feb 18 2021, 7:44 AM

Addressing Sander's comments.

sdesmalen added inline comments.Feb 18 2021, 8:02 AM
llvm/test/Linker/Inputs/fixed-vector-type-construction.ll
3 ↗(On Diff #324633)

nit: please use 2 spaces.

llvm/test/Linker/scalable-vector-type-construction.ll
1 ↗(On Diff #324633)

use %s directly (that expands to the same)

6 ↗(On Diff #324633)

nit: please use 2 spaces.

nasherm updated this revision to Diff 324665.Feb 18 2021, 8:52 AM

In response to Sander's comments.

  • changed indentation of *.ll files to be in line with 2 space rule
  • use %s interpolation in scalable-vector-type-construction.ll
sdesmalen accepted this revision.Feb 18 2021, 8:59 AM

LGTM, thanks @nasherm!

This revision is now accepted and ready to land.Feb 18 2021, 8:59 AM